Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
awlayton committed Apr 27, 2022
1 parent 5896ddc commit 5a04e68
Show file tree
Hide file tree
Showing 20 changed files with 203 additions and 229 deletions.
16 changes: 8 additions & 8 deletions oada/.yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,30 @@ packageExtensions:
peerDependenciesMeta:
ejs:
optional: true
fastify-accepts@*:
"@fastify/accepts@*":
dependencies:
"@types/accepts": "*"
peerDependencies:
fastify: "*"
fastify-bearer-auth@*:
"@fastify/bearer-auth@*":
peerDependencies:
fastify: "*"
fastify-cors@*:
"@fastify/cors@*":
peerDependencies:
fastify: "*"
fastify-graceful-shutdown@*:
"fastify-graceful-shutdown@*":
peerDependencies:
fastify: "*"
fastify-healthcheck@*:
"fastify-healthcheck@*":
peerDependencies:
fastify: "*"
fastify-helmet@*:
"@fastify/helmet@*":
peerDependencies:
fastify: "*"
fastify-sensible@*:
"@fastify/sensible@*":
peerDependencies:
fastify: "*"
fastify-websocket@*:
"@fastify/websocket@*":
peerDependencies:
"@types/ws": "*"
fastify: "*"
Expand Down
4 changes: 1 addition & 3 deletions oada/libs/lib-arangodb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
"@oada/types": "^2.0.1",
"arangojs": "^7.7.0",
"bcryptjs": "^2.4.3",
"bluebird": "^3.7.2",
"clone-deep": "^4.0.1",
"debug": "^4.3.4",
"deep-equal": "^2.0.5",
Expand All @@ -63,14 +62,13 @@
"devDependencies": {
"@ava/typescript": "^3.0.1",
"@types/bcryptjs": "^2.4.2",
"@types/bluebird": "^3.5.36",
"@types/clone-deep": "^4.0.1",
"@types/convict": "^6.1.1",
"@types/debug": "^4.1.7",
"@types/deep-equal": "^1.0.1",
"@types/flat": "^5.0.2",
"@types/json-pointer": "^1.0.31",
"@types/node": "^16.11.30",
"@types/node": "^16.11.31",
"ava": "4.0.0-rc.1",
"type-fest": "^2.12.2"
}
Expand Down
2 changes: 1 addition & 1 deletion oada/libs/lib-kafka/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@types/bluebird": "^3.5.36",
"@types/convict": "^6.1.1",
"@types/debug": "^4.1.7",
"@types/node": "16.11.30",
"@types/node": "^16.11.31",
"@types/uuid": "^8.3.4",
"ava": "4.0.0-rc.1"
}
Expand Down
2 changes: 1 addition & 1 deletion oada/libs/pino-debug/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"devDependencies": {
"@types/debug": "^4.1.7",
"@types/node": "^16.11.30"
"@types/node": "^16.11.31"
},
"peerDependencies": {
"debug": "*"
Expand Down
4 changes: 2 additions & 2 deletions oada/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
"@tsconfig/node16": "^1.0.2",
"@types/eslint": "^8.4.1",
"@types/mocha": "^9.1.1",
"@types/node": "^16.11.30",
"@types/node": "^16.11.31",
"@typescript-eslint/eslint-plugin": "^5.21.0",
"@typescript-eslint/parser": "^5.21.0",
"@yarnpkg/sdks": "^3.0.0-rc.2",
"@yarnpkg/sdks": "^3.0.0-rc.3",
"eslint": "^8.14.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-xo": "^0.40.0",
Expand Down
4 changes: 1 addition & 3 deletions oada/services/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@
"@oada/pino-debug": "^3.0.1",
"@oada/well-known-json": "^2.0.1",
"arangojs": "^7.7.0",
"axios": "^0.27.1",
"axios": "^0.27.2",
"bcryptjs": "^2.4.3",
"bluebird": "^3.7.2",
"body-parser": "^1.20.0",
"chalk": "^4.1.2",
"clone-deep": "^4.0.1",
Expand Down Expand Up @@ -82,7 +81,6 @@
"devDependencies": {
"@oada/types": "^2.0.1",
"@types/bcryptjs": "^2.4.2",
"@types/bluebird": "^3.5.36",
"@types/body-parser": "^1.19.2",
"@types/clone-deep": "^4.0.1",
"@types/connect-ensure-login": "^0.1.7",
Expand Down
15 changes: 9 additions & 6 deletions oada/services/auth/src/dynReg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,15 @@ const {
} = config.get('auth.dynamicRegistration.softwareStatement');
const timeout = config.get('auth.dynamicRegistration.trustedListLookupTimeout');

async function getSoftwareStatement({ software_statement }: Metadata) {
if (!software_statement) {
return undefined;
async function getSoftwareStatement({
software_statement: softwareStatement,
}: Metadata) {
if (!softwareStatement) {
return;
}

const { payload, trusted, valid, details } = await validate.validate(
software_statement,
softwareStatement,
{ timeout }
);
if (!valid) {
Expand All @@ -83,8 +85,9 @@ async function getSoftwareStatement({ software_statement }: Metadata) {
);
}

const statements: Metadata =
const statements: unknown =
typeof payload === 'string' ? JSON.parse(payload) : payload;
assertMetadata(statements);
return {
...statements,
// Set the "trusted" status based on JWS library return value
Expand All @@ -94,7 +97,7 @@ async function getSoftwareStatement({ software_statement }: Metadata) {

const dynReg: RequestHandler = async (request, response) => {
try {
const metadata = request.body;
const metadata: unknown = request.body;
// TODO: More thorough checking of sent metadata
assertMetadata(metadata);

Expand Down
21 changes: 0 additions & 21 deletions oada/services/auth/src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,6 @@
* limitations under the License.
*/

/*
declare module 'oada-error' {
import { RequestHandler } from 'express';
export class OADAError extends Error {
constructor(
message: string,
code?: number,
userMessage?: string | null,
href?: string | null,
detail?: string | null
);
}
// eslint-disable-next-line @typescript-eslint/naming-convention
export enum codes {
// eslint-disable-next-line @typescript-eslint/naming-convention
BAD_REQUEST,
}
export const middleware: () => RequestHandler;
}
*/

declare module 'connect-arango' {
import { Class } from 'type-fest';
import { Config } from 'arangojs';
Expand Down
17 changes: 8 additions & 9 deletions oada/services/http-handler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@
},
"homepage": "https://github.com/OADA/oada-srvc-http-handler#readme",
"dependencies": {
"@fastify/accepts": "^3.0.0",
"@fastify/bearer-auth": "^7.0.0",
"@fastify/cors": "^7.0.0",
"@fastify/helmet": "^8.0.0",
"@fastify/request-context": "^3.0.0",
"@fastify/sensible": "^4.0.0",
"@fastify/websocket": "^5.0.0",
"@oada/error": "^2.0.1",
"@oada/formats-server": "^2.0.0",
"@oada/lib-arangodb": "^3.0.1",
Expand All @@ -40,20 +47,12 @@
"@oada/permissions-handler": "^3.0.1",
"@oada/pino-debug": "^3.0.1",
"@oada/types": "^2.0.1",
"bluebird": "^3.7.2",
"cacache": "^16.0.6",
"debug": "^4.3.4",
"es-main": "^1.0.2",
"fastify": "^3.28.0",
"fastify-accepts": "^2.2.0",
"fastify-bearer-auth": "^6.2.0",
"fastify-cors": "^6.0.3",
"fastify-graceful-shutdown": "^3.1.0",
"fastify-healthcheck": "^3.1.0",
"fastify-helmet": "^7.0.1",
"fastify-request-context": "^2.2.0",
"fastify-sensible": "^3.1.2",
"fastify-websocket": "^4.2.2",
"json-ptr": "^3.1.0",
"ksuid": "^3.0.0",
"tslib": "^2.4.0",
Expand All @@ -65,7 +64,7 @@
"@oada/write-handler": "^3.0.1",
"@types/cacache": "^15.0.1",
"@types/debug": "^4.1.7",
"@types/node": "^16.11.30",
"@types/node": "^16.11.31",
"@types/type-is": "^1.6.3",
"@types/uuid": "^8.3.4",
"@types/ws": "^8.5.3",
Expand Down
2 changes: 1 addition & 1 deletion oada/services/http-handler/src/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export interface Options {
prefixPath(request: FastifyRequest): string;
}

declare module 'fastify-request-context' {
declare module '@fastify/request-context' {
interface RequestContextData {
// Add path within OADA to request context
oadaPath: string;
Expand Down
21 changes: 11 additions & 10 deletions oada/services/http-handler/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,18 @@ import resources from './resources.js';
import users from './users.js';
import websockets from './websockets.js';

import type { HTTPVersion, Handler } from 'find-my-way';
import fastify, { FastifyRequest } from 'fastify';
import bearerAuth from 'fastify-bearer-auth';
import cors from 'fastify-cors';
import esMain from 'es-main';
import fastifyAccepts from 'fastify-accepts';
import bearerAuth from '@fastify/bearer-auth';
import cors from '@fastify/cors';
import fastifyAccepts from '@fastify/accepts';
import fastifyGracefulShutdown from 'fastify-graceful-shutdown';
import fastifyHealthcheck from 'fastify-healthcheck';
import { fastifyRequestContextPlugin } from 'fastify-request-context';
import fastifySensible from 'fastify-sensible';
import helmet from 'fastify-helmet';
import { fastifyRequestContextPlugin } from '@fastify/request-context';
import fastifySensible from '@fastify/sensible';
import helmet from '@fastify/helmet';

import type { HTTPVersion, Handler } from 'find-my-way';
import esMain from 'es-main';

/**
* Supported values for X-OADA-Ensure-Link header
Expand Down Expand Up @@ -110,7 +111,7 @@ export async function start(): Promise<void> {
app.log.info('OADA Server started on port %d', config.get('server.port'));
}

declare module 'fastify-request-context' {
declare module '@fastify/request-context' {
interface RequestContextData {
// Add graph lookup result to request context
user: TokenResponse['doc'];
Expand Down Expand Up @@ -200,7 +201,7 @@ async function init(): Promise<void> {
await app.register(async (aApp) => {
await aApp.register(bearerAuth, {
keys: new Set<string>(),
async auth(token, request: FastifyRequest) {
async auth(token: string, request: FastifyRequest) {
try {
const tok = await tokenLookup({
// Connection_id: request.id,
Expand Down
2 changes: 1 addition & 1 deletion oada/services/http-handler/src/websockets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import type { FastifyPluginAsync } from 'fastify';
import { JsonPointer } from 'json-ptr';
import type LightMyRequest from 'light-my-request';
import type WebSocket from 'ws';
import fastifyWebsocket from 'fastify-websocket';
import fastifyWebsocket from '@fastify/websocket';
import { is } from 'type-is';
import log from 'debug';

Expand Down
2 changes: 1 addition & 1 deletion oada/services/permissions-handler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"devDependencies": {
"@types/debug": "^4.1.7",
"@types/node": "^16.11.30",
"@types/node": "^16.11.31",
"@types/type-is": "^1.6.3",
"typescript": "^4.6.3"
}
Expand Down
3 changes: 1 addition & 2 deletions oada/services/rev-graph-update/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@
"@ava/typescript": "^3.0.1",
"@oada/client": "^4.0.1",
"@oada/write-handler": "^3.0.1",
"@types/bluebird": "^3.5.36",
"@types/debug": "^4.1.7",
"@types/node": "^16.11.30",
"@types/node": "^16.11.31",
"@types/randomstring": "^1.1.8",
"ava": "4.0.0-rc.1",
"type-fest": "^2.12.2",
Expand Down
2 changes: 1 addition & 1 deletion oada/services/startup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@
},
"devDependencies": {
"@types/debug": "^4.1.7",
"@types/node": "^16.11.30"
"@types/node": "^16.11.31"
}
}
6 changes: 2 additions & 4 deletions oada/services/sync-handler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,13 @@
"@oada/lib-config": "^3.0.1",
"@oada/lib-kafka": "^3.0.1",
"@oada/pino-debug": "^3.0.1",
"axios": "^0.27.1",
"bluebird": "^3.7.2",
"axios": "^0.27.2",
"debug": "^4.3.4",
"tslib": "^2.4.0"
},
"devDependencies": {
"@oada/write-handler": "^3.0.1",
"@types/bluebird": "^3.5.36",
"@types/debug": "^4.1.7",
"@types/node": "^16.11.30"
"@types/node": "^16.11.31"
}
}
2 changes: 1 addition & 1 deletion oada/services/webhooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@oada/lib-config": "^3.0.1",
"@oada/lib-kafka": "^3.0.1",
"@oada/pino-debug": "^3.0.1",
"axios": "^0.27.1",
"axios": "^0.27.2",
"bluebird": "^3.7.2",
"debug": "^4.3.4",
"tslib": "^2.4.0"
Expand Down
2 changes: 1 addition & 1 deletion oada/services/well-known/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@oada/lib-config": "^3.0.1",
"@oada/pino-debug": "^3.0.1",
"@oada/well-known-json": "^2.0.1",
"axios": "^0.27.1",
"axios": "^0.27.2",
"cors": "^2.8.5",
"debug": "^4.3.4",
"express": "^4.18.0",
Expand Down
2 changes: 1 addition & 1 deletion oada/services/write-handler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@types/bluebird": "^3.5.36",
"@types/debug": "^4.1.7",
"@types/json-pointer": "^1.0.31",
"@types/node": "^16.11.30",
"@types/node": "^16.11.31",
"@types/object-assign-deep": "^0.4.0",
"ava": "4.0.0-rc.1",
"typescript": "^4.6.3"
Expand Down
Loading

0 comments on commit 5a04e68

Please sign in to comment.