Skip to content

Commit

Permalink
feat: stability improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
awlayton committed Mar 31, 2023
1 parent 1a088f7 commit 82f6d3b
Show file tree
Hide file tree
Showing 23 changed files with 239 additions and 207 deletions.
2 changes: 2 additions & 0 deletions oada/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ rules:
node/no-missing-import: off
import/no-unresolved: off
unicorn/prefer-spread: off
unicorn/prevent-abbreviations:
[warn, { replacements: { db: false, req: false } }]
no-constructor-bind/no-constructor-bind: error
no-constructor-bind/no-constructor-state: error
sort-imports: [warn, { allowSeparatedGroups: true }]
Expand Down
8 changes: 4 additions & 4 deletions oada/libs/lib-arangodb/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oada/lib-arangodb",
"version": "3.7.0",
"version": "3.8.0",
"description": "All OADA Arango interface code in one place.",
"main": "dist/index.js",
"type": "module",
Expand Down Expand Up @@ -55,7 +55,7 @@
"@oada/lib-config": "^3.7.0",
"@oada/oadaify": "^2.1.0",
"@oada/types": "^3.4.3",
"arangojs": "^8.1.0",
"arangojs": "^8.2.0",
"bcryptjs": "^2.4.3",
"clone-deep": "^4.0.1",
"debug": "^4.3.4",
Expand All @@ -73,9 +73,9 @@
"@types/deep-equal": "^1.0.1",
"@types/flat": "^5.0.2",
"@types/json-pointer": "^1.0.31",
"@types/node": "^18.15.10",
"@types/node": "^18.15.11",
"ava": "5.2.0",
"type-fest": "^3.7.1"
"type-fest": "^3.7.2"
},
"volta": {
"node": "18.13.0"
Expand Down
4 changes: 1 addition & 3 deletions oada/libs/lib-arangodb/src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,7 @@ export async function run(): Promise<void> {
};
// Override global ensureDefaults if this column explicitly specifies a value for it:
const colSpecificEnsureDefaults =
colinfo.ensureDefaults === undefined
? ensureDefaults
: colinfo.ensureDefaults;
colinfo.ensureDefaults ?? ensureDefaults;

// TODO: clean up this any nonsense
for await (const document of data) {
Expand Down
2 changes: 1 addition & 1 deletion oada/libs/lib-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oada/lib-config",
"version": "3.7.0",
"version": "3.8.0",
"description": "Confing wrapper",
"main": "dist/index.js",
"type": "module",
Expand Down
4 changes: 2 additions & 2 deletions oada/libs/lib-kafka/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oada/lib-kafka",
"version": "3.7.0",
"version": "3.8.0",
"description": "OADA Kafka library",
"main": "./dist/index.js",
"type": "module",
Expand Down Expand Up @@ -48,7 +48,7 @@
"@ava/typescript": "^4.0.0",
"@types/convict": "^6.1.1",
"@types/debug": "^4.1.7",
"@types/node": "^18.15.10",
"@types/node": "^18.15.11",
"@types/uuid": "^9.0.1",
"ava": "5.2.0"
},
Expand Down
2 changes: 1 addition & 1 deletion oada/libs/lib-prom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"devDependencies": {
"@ava/typescript": "^4.0.0",
"@types/convict": "^6.1.1",
"@types/node": "^18.15.10",
"@types/node": "^18.15.11",
"@types/ws": "^8.5.4",
"ava": "5.2.0",
"fastify-plugin": "^4.5.0"
Expand Down
4 changes: 2 additions & 2 deletions oada/libs/pino-debug/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oada/pino-debug",
"version": "3.7.0",
"version": "3.8.0",
"description": "OADA pino-debug wrapper",
"main": "dist/index.js",
"engines": {
Expand Down Expand Up @@ -33,7 +33,7 @@
},
"devDependencies": {
"@types/debug": "^4.1.7",
"@types/node": "^18.15.10"
"@types/node": "^18.15.11"
},
"peerDependencies": {
"debug": "*"
Expand Down
14 changes: 8 additions & 6 deletions oada/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
"@commitlint/cli": "^17.5.1",
"@commitlint/config-conventional": "^17.4.4",
"@tsconfig/node18": "^1.0.1",
"@types/eslint": "^8.21.3",
"@types/eslint": "^8.37.0",
"@types/mocha": "^10.0.1",
"@types/node": "^18.15.10",
"@types/node": "^18.15.11",
"@typescript-eslint/eslint-plugin": "^5.57.0",
"@typescript-eslint/parser": "^5.57.0",
"@yarnpkg/sdks": "^3.0.0-rc.41",
"@yarnpkg/sdks": "^3.0.0-rc.42",
"browserslist": "^4.21.5",
"c8": "^7.13.0",
"eslint": "^8.36.0",
"eslint": "^8.37.0",
"eslint-config-prettier": "^8.8.0",
"eslint-config-xo": "^0.43.1",
"eslint-config-xo-typescript": "^0.56.0",
Expand All @@ -45,13 +46,14 @@
"eslint-plugin-optimize-regex": "^1.2.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-regexp": "^1.13.0",
"eslint-plugin-regexp": "^1.14.0",
"eslint-plugin-security": "^1.7.1",
"eslint-plugin-sonarjs": "^0.19.0",
"eslint-plugin-unicorn": "^46.0.0",
"get-port": "^6.1.2",
"prettier": "^2.8.7",
"typescript": "5.0.2",
"typescript": "5.0.3",
"update-browserslist-db": "^1.0.10",
"zx": "^7.2.1"
},
"dependencies": {
Expand Down
6 changes: 3 additions & 3 deletions oada/services/auth/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oada/auth",
"version": "3.7.0",
"version": "3.8.0",
"description": "Reference implementation of OADA Authentication and Authorization server.",
"bin": {
"token": "./dist/token.js"
Expand Down Expand Up @@ -54,7 +54,7 @@
"@oada/pino-debug": "^3.7.0",
"@oada/types": "^3.4.3",
"@oada/well-known-json": "^4.0.0",
"arangojs": "^8.1.0",
"arangojs": "^8.2.0",
"bcryptjs": "^2.4.3",
"body-parser": "^1.20.2",
"chalk": "^5.2.0",
Expand Down Expand Up @@ -105,7 +105,7 @@
"@types/urijs": "^1.19.19",
"@types/uuid": "^9.0.1",
"c8": "^7.13.0",
"type-fest": "^3.7.1"
"type-fest": "^3.7.2"
},
"volta": {
"node": "18.13.0"
Expand Down
14 changes: 5 additions & 9 deletions oada/services/auth/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import '@oada/pino-debug';
import { config, domainConfigs } from './config.js';

import '@oada/lib-prom';
import { arango as database } from '@oada/lib-arangodb';

import https from 'node:https';
import path from 'node:path';
Expand All @@ -31,8 +32,9 @@ import bodyParser from 'body-parser';
import express from 'express';
import session from 'express-session';

import ArangoSessionStore from 'connect-arango';
import type { Database } from 'arangojs';
import URI from 'urijs';
import connectArango from 'connect-arango';
import cors from 'cors';
import debug from 'debug';
import got from 'got';
Expand Down Expand Up @@ -72,9 +74,6 @@ declare module 'express-session' {
const info = debug('auth#index:info');
const trace = debug('auth#index:trace');

// eslint-disable-next-line @typescript-eslint/naming-convention
const ArangoSessionStore = connectArango(session);

export default run;
async function run() {
// Deepcode ignore UseCsurfForExpress: helmet handles this
Expand Down Expand Up @@ -105,11 +104,8 @@ async function run() {
resave: false,
saveUninitialized: false,
store: new ArangoSessionStore({
collectionName: config.get('arangodb.collections.sessions').name,
db: {
databaseName: config.get('arangodb.database'),
url: config.get('arangodb.connectionString'),
},
collection: config.get('arangodb.collections.sessions').name,
db: database as Database,
}),
})
);
Expand Down
14 changes: 6 additions & 8 deletions oada/services/auth/src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,16 @@

declare module 'connect-arango' {
import type { Class } from 'type-fest';
import type { Config } from 'arangojs';
import type { Database } from 'arangojs';
import session from 'express-session';
class ArangoSore extends session.Store {}
class ArangoStore extends session.Store {}
export interface Options {
collectionName: string;
db: Config;
ttl?: number;
collection: string;
db: Database;
}

function connect(s: typeof session): Class<ArangoSore, [Options]>;

export = connect;
const c: Class<ArangoStore, [Options]>;
export = c;
}

declare module 'es-main' {
Expand Down
4 changes: 2 additions & 2 deletions oada/services/http-handler/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oada/http-handler",
"version": "3.7.0",
"version": "3.8.0",
"type": "module",
"description": "",
"main": "dist/server.js",
Expand Down Expand Up @@ -71,7 +71,7 @@
"@oada/write-handler": "^3.7.0",
"@types/cacache": "^15.0.1",
"@types/debug": "^4.1.7",
"@types/node": "^18.15.10",
"@types/node": "^18.15.11",
"@types/type-is": "^1.6.3",
"@types/uuid": "^9.0.1",
"@types/ws": "^8.5.4",
Expand Down
4 changes: 3 additions & 1 deletion oada/services/http-handler/src/requester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ import { Requester } from '@oada/lib-kafka';
import { config } from './config.js';

// TODO: Is it better to have one requester per topic?
export default new Requester({
const requester = new Requester({
consumeTopic: config.get('kafka.topics.httpResponse'),
group: 'http-handlers',
});

export default requester;
4 changes: 2 additions & 2 deletions oada/services/permissions-handler/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@oada/permissions-handler",
"description": "",
"version": "3.7.0",
"version": "3.8.0",
"type": "module",
"author": "",
"license": "Apache-2.0",
Expand Down Expand Up @@ -37,7 +37,7 @@
},
"devDependencies": {
"@types/debug": "^4.1.7",
"@types/node": "^18.15.10",
"@types/node": "^18.15.11",
"@types/type-is": "^1.6.3"
},
"volta": {
Expand Down
6 changes: 3 additions & 3 deletions oada/services/rev-graph-update/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oada/rev-graph-update",
"version": "3.7.0",
"version": "3.8.0",
"type": "module",
"description": "",
"author": "",
Expand Down Expand Up @@ -51,10 +51,10 @@
"@oada/client": "^4.5.0",
"@oada/write-handler": "^3.7.0",
"@types/debug": "^4.1.7",
"@types/node": "^18.15.10",
"@types/node": "^18.15.11",
"@types/randomstring": "^1.1.8",
"ava": "5.2.0",
"type-fest": "^3.7.1"
"type-fest": "^3.7.2"
},
"volta": {
"node": "18.13.0"
Expand Down
2 changes: 1 addition & 1 deletion oada/services/shares/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oada/shares",
"version": "3.7.0",
"version": "3.8.0",
"type": "module",
"description": "",
"author": "",
Expand Down
4 changes: 2 additions & 2 deletions oada/services/startup/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oada/startup",
"version": "3.7.0",
"version": "3.8.0",
"type": "module",
"description": "Handles startup of services for docker in OADA docker implementation.",
"main": "dist/index.js",
Expand Down Expand Up @@ -41,7 +41,7 @@
},
"devDependencies": {
"@types/debug": "^4.1.7",
"@types/node": "^18.15.10"
"@types/node": "^18.15.11"
},
"volta": {
"node": "18.13.0"
Expand Down
4 changes: 2 additions & 2 deletions oada/services/sync-handler/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oada/sync-handler",
"version": "3.7.0",
"version": "3.8.0",
"type": "module",
"description": "",
"main": "dist/server.js",
Expand Down Expand Up @@ -40,7 +40,7 @@
"devDependencies": {
"@oada/write-handler": "^3.7.0",
"@types/debug": "^4.1.7",
"@types/node": "^18.15.10"
"@types/node": "^18.15.11"
},
"volta": {
"node": "18.13.0"
Expand Down
2 changes: 1 addition & 1 deletion oada/services/users/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oada/users",
"version": "3.7.0",
"version": "3.8.0",
"type": "module",
"description": "",
"author": "Alex Layton <alex@layton.in>",
Expand Down
2 changes: 1 addition & 1 deletion oada/services/webhooks/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oada/webhooks",
"version": "3.7.0",
"version": "3.8.0",
"type": "module",
"description": "",
"main": "dist/server.js",
Expand Down
2 changes: 1 addition & 1 deletion oada/services/well-known/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oada/well-known",
"version": "3.7.0",
"version": "3.8.0",
"type": "module",
"description": "Microservice for serving well-known at an OADA cloud. Plays nicely with oada-ref-auth-js.",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions oada/services/write-handler/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oada/write-handler",
"version": "3.7.0",
"version": "3.8.0",
"type": "module",
"description": "",
"engines": {
Expand Down Expand Up @@ -60,7 +60,7 @@
"@oada/types": "^3.4.3",
"@types/debug": "^4.1.7",
"@types/json-pointer": "^1.0.31",
"@types/node": "^18.15.10",
"@types/node": "^18.15.11",
"@types/object-assign-deep": "^0.4.0",
"ava": "5.2.0"
},
Expand Down
Loading

0 comments on commit 82f6d3b

Please sign in to comment.