From 5347ea2049a9ffbc4d76935120b8383b96eb1cfa Mon Sep 17 00:00:00 2001 From: Alex Layton Date: Thu, 1 Aug 2024 21:04:12 -0400 Subject: [PATCH] fix(arango): update arangojs and token CLI --- common.yml | 1 + eslint.config.mjs | 1 - oada/libs/lib-arangodb/package.json | 4 +- oada/libs/lib-arangodb/src/config.ts | 6 +- oada/libs/lib-arangodb/src/db.ts | 4 +- .../libs/lib-arangodb/src/libs/deviceCodes.ts | 9 +- oada/libs/lib-arangodb/src/libs/errors.ts | 2 +- oada/libs/lib-arangodb/src/libs/users.ts | 7 +- oada/libs/lib-config/src/index.ts | 1 - oada/libs/lib-kafka/package.json | 2 +- oada/libs/lib-prom/package.json | 2 +- oada/libs/models/package.json | 2 +- oada/libs/pino-debug/package.json | 2 +- oada/libs/pino-debug/src/index.ts | 3 + oada/oada.config.mjs | 2 +- oada/package.json | 8 +- oada/services/auth/package.json | 4 +- oada/services/auth/src/cli/client.ts | 2 +- oada/services/auth/src/cli/token.ts | 27 +- .../auth/src/db/arango/deviceCodes.ts | 2 +- oada/services/auth/src/db/arango/init.ts | 7 +- .../services/auth/src/db/models/deviceCode.ts | 13 +- oada/services/auth/src/db/models/index.ts | 27 +- oada/services/auth/src/oauth2.ts | 22 +- oada/services/http-handler/package.json | 2 +- .../services/permissions-handler/package.json | 2 +- oada/services/rev-graph-update/package.json | 2 +- oada/services/startup/package.json | 2 +- oada/services/sync-handler/package.json | 2 +- oada/services/users/package.json | 8 +- oada/services/users/src/cli/useradd.ts | 144 +++++++ oada/services/users/src/server.ts | 6 +- oada/services/users/src/useradd.ts | 128 ------ oada/services/write-handler/package.json | 2 +- oada/yarn.lock | 397 ++++++++---------- 35 files changed, 427 insertions(+), 428 deletions(-) create mode 100644 oada/services/users/src/cli/useradd.ts delete mode 100644 oada/services/users/src/useradd.ts diff --git a/common.yml b/common.yml index 585c0684..33cd6f96 100644 --- a/common.yml +++ b/common.yml @@ -20,6 +20,7 @@ services: INSPECT: ${INSPECT---inspect=0.0.0.0:9229} DEBUG: ${DEBUG-*} PINO_LEVEL: ${PINO_LEVEL-debug} + PROM_HOST: '::' DEBUG_HIDE_DATE: ~ DEBUG_COLORS: ~ DEBUG_DEPTH: ~ diff --git a/eslint.config.mjs b/eslint.config.mjs index 74264eeb..cd69eda4 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -18,4 +18,3 @@ // @ts-check export * from './oada/eslint.config.mjs'; - diff --git a/oada/libs/lib-arangodb/package.json b/oada/libs/lib-arangodb/package.json index 6d24cf3c..cf2cc6ee 100644 --- a/oada/libs/lib-arangodb/package.json +++ b/oada/libs/lib-arangodb/package.json @@ -59,7 +59,7 @@ "@oada/models": "workspace:^", "@oada/oadaify": "^2.1.0", "@oada/types": "^4.0.0", - "arangojs": "^8.8.1", + "arangojs": "^9.0.0", "bcryptjs": "^2.4.3", "debug": "^4.3.6", "deep-equal": "^2.2.3", @@ -75,7 +75,7 @@ "@types/deep-equal": "^1.0.4", "@types/flat": "^5.0.5", "@types/json-pointer": "^1.0.34", - "@types/node": "^22.0.0", + "@types/node": "^22.0.2", "ava": "6.1.3", "type-fest": "^4.23.0" }, diff --git a/oada/libs/lib-arangodb/src/config.ts b/oada/libs/lib-arangodb/src/config.ts index 2ab25cef..8fe27fa0 100644 --- a/oada/libs/lib-arangodb/src/config.ts +++ b/oada/libs/lib-arangodb/src/config.ts @@ -19,8 +19,8 @@ import libConfig from '@oada/lib-config'; -import type { CreateCollectionOptions } from 'arangojs/collection.js'; -import type { EdgeDefinitionOptions } from 'arangojs/graph.js'; +import type { CreateCollectionOptions } from 'arangojs/collection'; +import type { EdgeDefinitionOptions } from 'arangojs/graph'; export interface Collection { name: string; @@ -165,7 +165,7 @@ export const { config, schema } = await libConfig({ default: { name: 'deviceCodes', indexes: ['deviceCode', 'userCode'], - defaults: './libs/exampledocs/codes.js', + // Defaults: './libs/exampledocs/deviceCodes.js', }, }, resources: { diff --git a/oada/libs/lib-arangodb/src/db.ts b/oada/libs/lib-arangodb/src/db.ts index 838d87bb..89d4bd55 100644 --- a/oada/libs/lib-arangodb/src/db.ts +++ b/oada/libs/lib-arangodb/src/db.ts @@ -21,9 +21,9 @@ import { config } from './config.js'; import { ArangoError, ArangoErrorCode } from './libs/errors.js'; -import type { AqlQuery } from 'arangojs/aql.js'; +import type { AqlQuery } from 'arangojs/aql'; import { Database } from 'arangojs'; -import type { QueryOptions } from 'arangojs/database.js'; +import type { QueryOptions } from 'arangojs/database'; import debug from 'debug'; const error = debug('arangodb#aql:error'); diff --git a/oada/libs/lib-arangodb/src/libs/deviceCodes.ts b/oada/libs/lib-arangodb/src/libs/deviceCodes.ts index 391007de..9b28d1be 100644 --- a/oada/libs/lib-arangodb/src/libs/deviceCodes.ts +++ b/oada/libs/lib-arangodb/src/libs/deviceCodes.ts @@ -61,12 +61,14 @@ export async function findByUserCode( export async function save( deviceCode: DeviceCode, ): Promise { - const { new: saved } = await deviceCodes.save(deviceCode, { returnNew: true }); + const { new: saved } = await deviceCodes.save(deviceCode, { + returnNew: true, + }); return saved; } export async function redeem(deviceCode: string) { - const cursor = await database.query<{ redeemed: boolean, code?: DeviceCode }>( + const cursor = await database.query<{ redeemed: boolean; code?: DeviceCode }>( aql` LET code = ( FOR c IN ${deviceCodes} @@ -83,6 +85,7 @@ export async function redeem(deviceCode: string) { redeemed: LENGTH(clear) == 1, code: FIRST(code), } - `); + `, + ); return (await cursor.next())!; } diff --git a/oada/libs/lib-arangodb/src/libs/errors.ts b/oada/libs/lib-arangodb/src/libs/errors.ts index 0b4d7719..1db93c42 100644 --- a/oada/libs/lib-arangodb/src/libs/errors.ts +++ b/oada/libs/lib-arangodb/src/libs/errors.ts @@ -26,7 +26,7 @@ // TODO: Add more of the error codes from above link -export { ArangoError } from 'arangojs/error.js'; +export { ArangoError } from 'arangojs/error'; /** * Error codes for ArangoErrorCode diff --git a/oada/libs/lib-arangodb/src/libs/users.ts b/oada/libs/lib-arangodb/src/libs/users.ts index 33b77cc4..a334cf11 100644 --- a/oada/libs/lib-arangodb/src/libs/users.ts +++ b/oada/libs/lib-arangodb/src/libs/users.ts @@ -15,11 +15,10 @@ * limitations under the License. */ -import type { CollectionReadOptions } from 'arangojs/collection.js'; +import type { CollectionReadOptions } from 'arangojs/collection'; import { aql } from 'arangojs'; import bcrypt from 'bcryptjs'; import debug from 'debug'; -import { flatten } from 'flat'; import type { Selector } from '../util.js'; import { config } from '../config.js'; @@ -167,10 +166,6 @@ export async function update( return sanitizeResult(u.new); } -export async function like(u: Partial): Promise> { - return users.byExample(flatten(u)); -} - export async function hashPw(pw: string): Promise { return bcrypt.hash(pw, roundsOrSalt); } diff --git a/oada/libs/lib-config/src/index.ts b/oada/libs/lib-config/src/index.ts index b2757dd0..59459540 100644 --- a/oada/libs/lib-config/src/index.ts +++ b/oada/libs/lib-config/src/index.ts @@ -188,7 +188,6 @@ export default async function loadConfig( // Allow extra items allowed: 'warn', // Do not actually output warnings about extra items? - output() {}, }); diff --git a/oada/libs/lib-kafka/package.json b/oada/libs/lib-kafka/package.json index 0fcadaf3..91bb1802 100644 --- a/oada/libs/lib-kafka/package.json +++ b/oada/libs/lib-kafka/package.json @@ -48,7 +48,7 @@ "@ava/typescript": "^5.0.0", "@types/convict": "^6.1.6", "@types/debug": "^4.1.12", - "@types/node": "^22.0.0", + "@types/node": "^22.0.2", "@types/uuid": "^10.0.0", "ava": "6.1.3" }, diff --git a/oada/libs/lib-prom/package.json b/oada/libs/lib-prom/package.json index f14c9cbe..7343b282 100644 --- a/oada/libs/lib-prom/package.json +++ b/oada/libs/lib-prom/package.json @@ -42,7 +42,7 @@ "devDependencies": { "@ava/typescript": "^5.0.0", "@types/convict": "^6.1.6", - "@types/node": "^22.0.0", + "@types/node": "^22.0.2", "@types/ws": "^8.5.12", "ava": "6.1.3", "fastify-plugin": "^4.5.1" diff --git a/oada/libs/models/package.json b/oada/libs/models/package.json index 5406ee8d..67eeabda 100644 --- a/oada/libs/models/package.json +++ b/oada/libs/models/package.json @@ -38,7 +38,7 @@ "node": "22.5.1" }, "devDependencies": { - "@types/node": "^22.0.0", + "@types/node": "^22.0.2", "jose": "^5.6.3" } } diff --git a/oada/libs/pino-debug/package.json b/oada/libs/pino-debug/package.json index 158fba31..f611d800 100644 --- a/oada/libs/pino-debug/package.json +++ b/oada/libs/pino-debug/package.json @@ -34,7 +34,7 @@ }, "devDependencies": { "@types/debug": "^4.1.12", - "@types/node": "^22.0.0" + "@types/node": "^22.0.2" }, "peerDependencies": { "debug": "*" diff --git a/oada/libs/pino-debug/src/index.ts b/oada/libs/pino-debug/src/index.ts index 92289d9a..e1287559 100644 --- a/oada/libs/pino-debug/src/index.ts +++ b/oada/libs/pino-debug/src/index.ts @@ -107,6 +107,9 @@ function createRootLogger(): Logger { 'access_token', '*.access_token', '*.*.access_token', + 'jti', + '*.jti', + '*.*.jti', 'client_secret', 'client.client_secret', '*.client.client_secret', diff --git a/oada/oada.config.mjs b/oada/oada.config.mjs index 352f9674..738612fb 100644 --- a/oada/oada.config.mjs +++ b/oada/oada.config.mjs @@ -46,7 +46,7 @@ export default { collections: { users: { name: 'users', - indexes: ['username', { name: 'oadaid', sparse: true }], + indexes: ['username', { name: 'oadaid', sparse: true }, 'sub', 'iss'], defaults: './libs/exampledocs/users.js', }, clients: { diff --git a/oada/package.json b/oada/package.json index dba062fb..41413bd3 100644 --- a/oada/package.json +++ b/oada/package.json @@ -22,9 +22,9 @@ "@tsconfig/node20": "^20.1.4", "@types/eslint": "^9.6.0", "@types/mocha": "^10.0.7", - "@types/node": "^22.0.0", - "@typescript-eslint/eslint-plugin": "^7.18.0", - "@typescript-eslint/parser": "^7.18.0", + "@types/node": "^22.0.2", + "@typescript-eslint/eslint-plugin": "^8.0.0", + "@typescript-eslint/parser": "^8.0.0", "@yarnpkg/sdks": "^3.1.3", "browserslist": "^4.23.2", "c8": "^10.1.2", @@ -59,7 +59,7 @@ "prettier": "^3.3.3", "tslib": "2.6.3", "typescript": "5.5.4", - "typescript-eslint": "^7.18.0", + "typescript-eslint": "^8.0.0", "update-browserslist-db": "^1.1.0", "zx": "^8.1.4" }, diff --git a/oada/services/auth/package.json b/oada/services/auth/package.json index 1ec43ff5..47bacb80 100644 --- a/oada/services/auth/package.json +++ b/oada/services/auth/package.json @@ -74,7 +74,7 @@ "@oada/types": "^4.0.0", "@oada/well-known-json": "^4.0.2", "@qlever-llc/interface2class": "^1.1.0", - "arangojs": "^8.8.1", + "arangojs": "^9.0.0", "bcryptjs": "^2.4.3", "chalk": "^5.3.0", "cmd-ts": "^0.13.0", @@ -99,7 +99,7 @@ "passport-oauth2-client-password": "~0.1.2", "pem-jwk": "^2.0.0", "qrcode-terminal": "^0.12.0", - "qs": "^6.12.3", + "qs": "^6.13.0", "random-id-base36": "^1.0.3", "serialize-error": "^11.0.3", "tslib": "2.6.3", diff --git a/oada/services/auth/src/cli/client.ts b/oada/services/auth/src/cli/client.ts index 5dc55b7f..386a9b77 100644 --- a/oada/services/auth/src/cli/client.ts +++ b/oada/services/auth/src/cli/client.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -/* eslint-disable no-console */ +/* eslint-disable no-console -- This is a CLI */ import '@oada/pino-debug'; diff --git a/oada/services/auth/src/cli/token.ts b/oada/services/auth/src/cli/token.ts index c70c29c5..0bcc03a8 100644 --- a/oada/services/auth/src/cli/token.ts +++ b/oada/services/auth/src/cli/token.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -/* eslint-disable no-console */ +/* eslint-disable no-console -- This is a CLI */ import '@oada/pino-debug'; @@ -147,10 +147,13 @@ const UserType: Type = { }, }; +/** + * @todo support other token storage?? + */ export const create = command({ name: 'create', aliases: ['issue', 'new'], - description: 'Create a token (only works when using local auth)', + description: 'Create a token (only works when using local auth in arango)', args: { iss, scope, @@ -172,24 +175,30 @@ export const create = command({ long: 'exp', short: 'e', }), + jti: positional({ + type: optional(string), + displayName: 'token id', + description: 'Token to create', + }), }, // eslint-disable-next-line @typescript-eslint/no-shadow - async handler({ iss, scope, user: { sub }, iat, exp }) { + async handler({ iss, scope, user: { sub }, iat, exp, jti }) { const { Authorization } = await import('@oada/models/authorization'); - const { getToken } = await import('../oauth2.js'); + const { create: createToken } = await import('../db/arango/tokens.js'); const auth = new Authorization({ + iss: iss ? `${iss}` : `${config.get('oidc.issuer')}`, sub, iat: iat as number, exp: exp as number, scope: scope?.join(' '), + jti, }); - const token = await getToken( - iss ? `${iss}` : `${config.get('oidc.issuer')}`, - auth, - ); + const token = await createToken(auth); - console.log(token); + if (!jti) { + console.log(token); + } }, }); diff --git a/oada/services/auth/src/db/arango/deviceCodes.ts b/oada/services/auth/src/db/arango/deviceCodes.ts index e7867be5..1fd0f8ff 100644 --- a/oada/services/auth/src/db/arango/deviceCodes.ts +++ b/oada/services/auth/src/db/arango/deviceCodes.ts @@ -42,5 +42,5 @@ export const redeem = async function (deviceCode) { return { redeemed, code: code as DeviceCode, - } + }; } satisfies IDeviceCodes['redeem']; diff --git a/oada/services/auth/src/db/arango/init.ts b/oada/services/auth/src/db/arango/init.ts index 2dda253b..c0684a44 100644 --- a/oada/services/auth/src/db/arango/init.ts +++ b/oada/services/auth/src/db/arango/init.ts @@ -24,6 +24,7 @@ import debug from 'debug'; import type { User } from '@oada/models/user'; import { config } from '../../config.js'; +import { findByUsername } from './users.js'; const log = debug('arango/init'); @@ -105,7 +106,11 @@ async function init() { const users = systemDatabase.collection('users'); for await (const user of Object.values(defaultUsers)) { try { - await users.firstExample({ username: user.username }); + const u = await findByUsername(user.username); + if (!u) { + throw new Error(`User ${user.username} not found`); + } + log('User % s exists', user.username); } catch { log(user, 'Saving user'); diff --git a/oada/services/auth/src/db/models/deviceCode.ts b/oada/services/auth/src/db/models/deviceCode.ts index 7ac13ed4..f0db60ca 100644 --- a/oada/services/auth/src/db/models/deviceCode.ts +++ b/oada/services/auth/src/db/models/deviceCode.ts @@ -34,7 +34,9 @@ export interface IDeviceCodes extends Store { userCode: DeviceCode['userCode'], ): Promisable | undefined>; save(code: C): Promisable; - redeem(code: DeviceCode['deviceCode']): Promisable<{ redeemed: boolean, code?: DeviceCode }>; + redeem( + code: DeviceCode['deviceCode'], + ): Promisable<{ redeemed: boolean; code?: DeviceCode }>; } const dataStores = await getDataStores( @@ -117,7 +119,10 @@ export async function activate( } } -export async function redeem(clientId: string, deviceCode: DeviceCode['deviceCode']): Promise<{ redeemed: boolean, code?: DeviceCode }> { +export async function redeem( + clientId: string, + deviceCode: DeviceCode['deviceCode'], +): Promise<{ redeemed: boolean; code?: DeviceCode }> { async function redeemDeviceCode(dataStore: IDeviceCodes) { const { redeemed, code } = await dataStore.redeem(deviceCode); if (!code) { @@ -135,5 +140,7 @@ export async function redeem(clientId: string, deviceCode: DeviceCode['deviceCod }; } - return (await tryDataStores(dataStores, redeemDeviceCode)) ?? { redeemed: false } + return ( + (await tryDataStores(dataStores, redeemDeviceCode)) ?? { redeemed: false } + ); } diff --git a/oada/services/auth/src/db/models/index.ts b/oada/services/auth/src/db/models/index.ts index d5844dd8..7b5f9f9f 100644 --- a/oada/services/auth/src/db/models/index.ts +++ b/oada/services/auth/src/db/models/index.ts @@ -29,16 +29,16 @@ export async function getDataStores( item: string, ): Promise { const array = Array.isArray(stores) ? stores : [stores]; - const promises = array.map( - async (dataStore) => { - const store: unknown = await import(path.join(dirname, '..', dataStore, `${item}.js`)); - return { - name: dataStore, - // @ts-expect-error stuff - ...store - } as T - } - ); + const promises = array.map(async (dataStore) => { + const store: unknown = await import( + path.join(dirname, '..', dataStore, `${item}.js`) + ); + return { + name: dataStore, + // @ts-expect-error stuff + ...store, + } as T; + }); return Promise.all(promises); } @@ -67,8 +67,7 @@ export async function tryDataStores( } const names = stores.map(({ name }) => name); - throw new Error( - `${queryFun.name} failed to find result(s) among ${names}`, - { cause: errors }, - ); + throw new Error(`${queryFun.name} failed to find result(s) among ${names}`, { + cause: errors, + }); } diff --git a/oada/services/auth/src/oauth2.ts b/oada/services/auth/src/oauth2.ts index bbbdbe72..9cf44118 100644 --- a/oada/services/auth/src/oauth2.ts +++ b/oada/services/auth/src/oauth2.ts @@ -22,7 +22,7 @@ import { createHash } from 'node:crypto'; import { join } from 'node:path/posix'; import { promisify } from 'node:util'; -import type { } from '@fastify/formbody'; +import type {} from '@fastify/formbody'; import type { FastifyPluginAsync, FastifyReply, FastifyRequest } from 'fastify'; import { @@ -101,7 +101,7 @@ declare module 'oauth2orize' { } // eslint-disable-next-line @typescript-eslint/no-shadow - interface MiddlewareRequest extends FastifyRequest { } + interface MiddlewareRequest extends FastifyRequest {} } interface DeserializedOauth2 extends OAuth2 { client: C; @@ -376,13 +376,19 @@ export const exchangeDeviceCode: ExchangeDeviceCodeFunction = async ( */ if (!redeemed) { - throw new TokenError('Device code not activated', 'authorization_pending'); + throw new TokenError( + 'Device code not activated', + 'authorization_pending', + ); } // Get user/scope from DB from user activation? const { userId, scope, approved } = code; if (!approved) { - throw new TokenError('User denied authorization request', 'access_denied'); + throw new TokenError( + 'User denied authorization request', + 'access_denied', + ); } const auth = new Authorization({ @@ -637,7 +643,8 @@ const plugin: FastifyPluginAsync = async ( issueDeviceCode, ), ); - fastify.post(deviceAuthorization, + fastify.post( + deviceAuthorization, { preValidation: fastifyPassport.authenticate( ['oauth2-client-password', 'oauth2-client-assertion'], @@ -660,9 +667,10 @@ const plugin: FastifyPluginAsync = async ( reply as unknown as ServerResponse, ); } - }); + }, + ); - fastify.get(activate, async (_request, _reply) => { }); + fastify.get(activate, async (_request, _reply) => {}); }; export default plugin; diff --git a/oada/services/http-handler/package.json b/oada/services/http-handler/package.json index c6abb14c..cd1fcf0b 100644 --- a/oada/services/http-handler/package.json +++ b/oada/services/http-handler/package.json @@ -79,7 +79,7 @@ "@oada/write-handler": "workspace:^", "@types/cacache": "^17.0.2", "@types/debug": "^4.1.12", - "@types/node": "^22.0.0", + "@types/node": "^22.0.2", "@types/type-is": "^1.6.6", "@types/uuid": "^10.0.0", "@types/ws": "^8.5.12", diff --git a/oada/services/permissions-handler/package.json b/oada/services/permissions-handler/package.json index 791e3ff3..1f536322 100644 --- a/oada/services/permissions-handler/package.json +++ b/oada/services/permissions-handler/package.json @@ -37,7 +37,7 @@ }, "devDependencies": { "@types/debug": "^4.1.12", - "@types/node": "^22.0.0", + "@types/node": "^22.0.2", "@types/type-is": "^1.6.6" }, "volta": { diff --git a/oada/services/rev-graph-update/package.json b/oada/services/rev-graph-update/package.json index 827338d9..c729428f 100644 --- a/oada/services/rev-graph-update/package.json +++ b/oada/services/rev-graph-update/package.json @@ -51,7 +51,7 @@ "@oada/client": "^5.1.0", "@oada/write-handler": "workspace:^", "@types/debug": "^4.1.12", - "@types/node": "^22.0.0", + "@types/node": "^22.0.2", "@types/randomstring": "^1.3.0", "ava": "6.1.3", "type-fest": "^4.23.0" diff --git a/oada/services/startup/package.json b/oada/services/startup/package.json index 638d9d7f..4674a1ea 100644 --- a/oada/services/startup/package.json +++ b/oada/services/startup/package.json @@ -41,7 +41,7 @@ }, "devDependencies": { "@types/debug": "^4.1.12", - "@types/node": "^22.0.0" + "@types/node": "^22.0.2" }, "volta": { "node": "22.5.1" diff --git a/oada/services/sync-handler/package.json b/oada/services/sync-handler/package.json index a1a31c3b..dc269335 100644 --- a/oada/services/sync-handler/package.json +++ b/oada/services/sync-handler/package.json @@ -40,7 +40,7 @@ "devDependencies": { "@oada/write-handler": "workspace:^", "@types/debug": "^4.1.12", - "@types/node": "^22.0.0" + "@types/node": "^22.0.2" }, "volta": { "node": "22.5.1" diff --git a/oada/services/users/package.json b/oada/services/users/package.json index 83b10352..2c3d382e 100644 --- a/oada/services/users/package.json +++ b/oada/services/users/package.json @@ -20,7 +20,7 @@ "start": "node ${INSPECT} --enable-source-maps --unhandled-rejections=strict dist/server.js" }, "bin": { - "add": "./dist/useradd.js" + "add": "./dist/cli/useradd.js" }, "dependencies": { "@oada/lib-arangodb": "workspace:^", @@ -30,16 +30,14 @@ "@oada/models": "workspace:^", "@oada/pino-debug": "workspace:^", "chalk": "^5.3.0", + "cmd-ts": "^0.13.0", "debug": "^4.3.6", + "es-main": "^1.3.0", "ksuid": "^3.0.0", - "minimist": "^1.2.8", - "promptly": "^3.2.0", "tslib": "2.6.3" }, "devDependencies": { "@types/debug": "^4.1.12", - "@types/minimist": "^1.2.5", - "@types/promptly": "^3.0.5", "type-fest": "^4.23.0" }, "volta": { diff --git a/oada/services/users/src/cli/useradd.ts b/oada/services/users/src/cli/useradd.ts new file mode 100644 index 00000000..8a6dc7cd --- /dev/null +++ b/oada/services/users/src/cli/useradd.ts @@ -0,0 +1,144 @@ +/** + * @license + * Copyright 2017-2024 Open Ag Data Alliance + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* eslint-disable no-console -- This is a CLI */ + +import '@oada/pino-debug'; + +import { + type Type, + array, + binary, + boolean, + command, + flag, + multioption, + option, + optional, + run, + string, +} from 'cmd-ts'; +import chalk from 'chalk'; + +import { config } from '../config.js'; + +import { Requester } from '@oada/lib-kafka'; +import User from '@oada/models/user'; +import { users } from '@oada/lib-arangodb'; + +import type { UserRequest, UserResponse } from '../server.js'; + +import esMain from 'es-main'; + +// eslint-disable-next-line @typescript-eslint/naming-convention +const UserType: Type = { + // eslint-disable-next-line @typescript-eslint/require-await + async from(username) { + return new User({ username }); + }, +}; + +export const cmd = command({ + name: 'useradd', + description: 'add a user to OADA', + args: { + user: option({ + type: UserType, + long: 'user', + short: 'u', + }), + password: option({ + type: string, + defaultValue: () => process.env.PASSWORD ?? '', + long: 'password', + short: 'p', + }), + admin: flag({ + type: optional(boolean), + long: 'admin', + short: 'a', + description: 'Admin role', + }), + roles: multioption({ + type: array(string), + long: 'roles', + short: 'r', + description: 'User roles to assign', + }), + domain: option({ + type: string, + long: 'domain', + defaultValue: () => process.env.DOMAIN ?? '', + short: 'd', + }), + }, + async handler({ user: u, password, admin = false, roles = [], domain }) { + const found = await users.findByUsername(u.username); + if (found) { + throw new Error(`User ${found.username} already exists`); + } + + // ------------------------------------- + // Talk to user service over Kafka... + // Produce a request to the user service to create one for us: + const kafkareq = new Requester({ + // Topic to look for final answer on (consume): + consumeTopic: config.get('kafka.topics.httpResponse'), + // Topic to send request on (produce): + produceTopic: config.get('kafka.topics.userRequest'), + // Group name + group: 'useradd', + }); + + try { + if (admin) { + roles.push('oada.admin.user:all'); + } + + const user = { + ...u, + domain, + password, + roles, + } satisfies Partial; + const response = (await kafkareq.send({ + // @ts-expect-error secret prop + connection_id: 'useradd', + token: 'admin', + authorization: { + scope: ['oada.admin.user:all'], + }, + // The "user" key is what goes into the DB + user, + } satisfies UserRequest)) as unknown as UserResponse; + + if (response.code !== 'success') { + throw new Error(`Creating user failed with code: ${response.code}`); + } + + // Now we have a user + const su = response.user; + console.log(chalk.green`User {cyan ${su!.sub}} now exists`); + } finally { + await kafkareq.disconnect(); + } + }, +}); + +if (esMain(import.meta)) { + await run(binary(cmd), process.argv); +} diff --git a/oada/services/users/src/server.ts b/oada/services/users/src/server.ts index 3c5344af..e659a134 100644 --- a/oada/services/users/src/server.ts +++ b/oada/services/users/src/server.ts @@ -170,10 +170,8 @@ export async function handleReq(request: UserRequest): Promise { { user: request.user }, 'Tried to create user, but it already existed (same username). Returning as if we had created it', ); - const like = await users.like({ username: request.user.username }); - for await (const user of like) { - trace(user, 'existing user found'); - } + const user = await users.findByUsername(request.user.username!); + trace({ user }, 'existing user found'); } else { throw Object.assign( new Error(`Error creating User ${request.user.username}`, { diff --git a/oada/services/users/src/useradd.ts b/oada/services/users/src/useradd.ts deleted file mode 100644 index 9a6f388c..00000000 --- a/oada/services/users/src/useradd.ts +++ /dev/null @@ -1,128 +0,0 @@ -/** - * @license - * Copyright 2017-2022 Open Ag Data Alliance - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* eslint-disable unicorn/no-process-exit, n/no-process-exit -- This is a cli command */ - -import '@oada/pino-debug'; -import { config } from './config.js'; - -import { Requester } from '@oada/lib-kafka'; -import User from '@oada/models/user'; -import { users } from '@oada/lib-arangodb'; - -import chalk from 'chalk'; -import debug from 'debug'; -import minimist from 'minimist'; -import promptly from 'promptly'; - -import type { UserRequest, UserResponse } from './server.js'; - -const argv = minimist(process.argv.slice(2)); - -const info = debug('useradd:info'); -const error = debug('useradd:error'); -const trace = debug('useradd:trace'); - -async function findUserByUsername(username: string) { - const like = await users.like({ username }); - - // eslint-disable-next-line no-unreachable-loop - for await (const user of like) { - trace({ user }, 'findUserByUsername: Finished users.like'); - return user; - } -} - -// The main event: -try { - if (argv.h || argv.help) { - error( - chalk.yellow`useradd [-u username] [-d domain] [-p password] [-a (if you want user to have admin privileges to create other users)]`, - ); - process.exit(); - } - - // ------------------------------------- - // Talk to user service over Kafka... - trace('Creating kafka requester...'); - // Produce a request to the user service to create one for us: - const kafkareq = new Requester({ - // Topic to look for final answer on (consume): - consumeTopic: config.get('kafka.topics.httpResponse'), - // Topic to send request on (produce): - produceTopic: config.get('kafka.topics.userRequest'), - // Group name - group: 'useradd', - }); - - // ----------------------------------------------------- - // Ensure we have a username and password... - const username = (argv.u || - argv.username || - (await promptly.prompt('Username: '))) as string; - if (await findUserByUsername(username)) { - error(chalk.red`Username ${username} already exists`); - process.exit(1); - } - - const p = (argv.password ?? argv.p) as string | boolean | undefined; - const password = p - ? p === true - ? await promptly.prompt('Password: ') - : p - : undefined; - const isAdmin = Boolean(argv.a || argv.isadmin || argv.isAdmin); - const domain = `${argv.domain || argv.d || process.env.DOMAIN || 'localhost'}`; - trace('Sending request to kafka'); - const user = { - username, - domain, - password, - // Add scope if you want the user to have permission to create other users - roles: isAdmin ? ['oada.admin.user:all'] : [], - } satisfies Partial; - const response = (await kafkareq.send({ - // @ts-expect-error secret prop - connection_id: 'useradd', - token: 'admin', - authorization: { - scope: ['oada.admin.user:all'], - }, - // The "user" key is what goes into the DB - user, - } satisfies UserRequest)) as unknown as UserResponse; - - trace({ response }, 'Finished kafka.send'); - // No need to keep hearing messages - trace('Disconnecting from kafka'); - await kafkareq.disconnect(); - - trace({ response }, 'Checking response.code'); - if (response.code !== 'success') { - error( - chalk.red`FAILED TO RECEIVE SUCCESSFUL RESPONSE FROM USER SERVICE WHEN CREATING USER!`, - ); - process.exit(1); - } - - // Now we have a user - const su = response.user; - info(chalk.green`User {cyan ${su!.sub}} now exists`); -} catch (cError: unknown) { - error({ error: cError }); - process.exit(1); -} diff --git a/oada/services/write-handler/package.json b/oada/services/write-handler/package.json index a377c51f..ac8cd183 100644 --- a/oada/services/write-handler/package.json +++ b/oada/services/write-handler/package.json @@ -60,7 +60,7 @@ "@oada/types": "^4.0.0", "@types/debug": "^4.1.12", "@types/json-pointer": "^1.0.34", - "@types/node": "^22.0.0", + "@types/node": "^22.0.2", "@types/object-assign-deep": "^0.4.3", "ava": "6.1.3" }, diff --git a/oada/yarn.lock b/oada/yarn.lock index 05ceacdc..589d758f 100644 --- a/oada/yarn.lock +++ b/oada/yarn.lock @@ -1031,7 +1031,7 @@ __metadata: "@types/qs": "npm:^6.9.15" "@types/urijs": "npm:^1.19.25" "@types/uuid": "npm:^10.0.0" - arangojs: "npm:^8.8.1" + arangojs: "npm:^9.0.0" bcryptjs: "npm:^2.4.3" c8: "npm:^10.1.2" chalk: "npm:^5.3.0" @@ -1058,7 +1058,7 @@ __metadata: passport-oauth2-client-password: "npm:~0.1.2" pem-jwk: "npm:^2.0.0" qrcode-terminal: "npm:^0.12.0" - qs: "npm:^6.12.3" + qs: "npm:^6.13.0" random-id-base36: "npm:^1.0.3" serialize-error: "npm:^11.0.3" tslib: "npm:2.6.3" @@ -1211,7 +1211,7 @@ __metadata: "@oada/write-handler": "workspace:^" "@types/cacache": "npm:^17.0.2" "@types/debug": "npm:^4.1.12" - "@types/node": "npm:^22.0.0" + "@types/node": "npm:^22.0.2" "@types/type-is": "npm:^1.6.6" "@types/uuid": "npm:^10.0.0" "@types/ws": "npm:^8.5.12" @@ -1252,8 +1252,8 @@ __metadata: "@types/deep-equal": "npm:^1.0.4" "@types/flat": "npm:^5.0.5" "@types/json-pointer": "npm:^1.0.34" - "@types/node": "npm:^22.0.0" - arangojs: "npm:^8.8.1" + "@types/node": "npm:^22.0.2" + arangojs: "npm:^9.0.0" ava: "npm:6.1.3" bcryptjs: "npm:^2.4.3" debug: "npm:^4.3.6" @@ -1297,7 +1297,7 @@ __metadata: "@oada/lib-config": "workspace:^" "@types/convict": "npm:^6.1.6" "@types/debug": "npm:^4.1.12" - "@types/node": "npm:^22.0.0" + "@types/node": "npm:^22.0.2" "@types/uuid": "npm:^10.0.0" ava: "npm:6.1.3" cls-rtracer: "npm:^2.6.3" @@ -1317,7 +1317,7 @@ __metadata: "@ava/typescript": "npm:^5.0.0" "@oada/lib-config": "workspace:^" "@types/convict": "npm:^6.1.6" - "@types/node": "npm:^22.0.0" + "@types/node": "npm:^22.0.2" "@types/ws": "npm:^8.5.12" ava: "npm:6.1.3" fastify-plugin: "npm:^4.5.1" @@ -1357,7 +1357,7 @@ __metadata: dependencies: "@oada/types": "npm:^4.0.0" "@qlever-llc/interface2class": "npm:^1.1.0" - "@types/node": "npm:^22.0.0" + "@types/node": "npm:^22.0.2" jose: "npm:^5.6.3" tslib: "npm:2.6.3" type-fest: "npm:^4.23.0" @@ -1386,7 +1386,7 @@ __metadata: "@oada/lib-prom": "workspace:^" "@oada/pino-debug": "workspace:^" "@types/debug": "npm:^4.1.12" - "@types/node": "npm:^22.0.0" + "@types/node": "npm:^22.0.2" "@types/type-is": "npm:^1.6.6" debug: "npm:^4.3.6" es-main: "npm:^1.3.0" @@ -1400,7 +1400,7 @@ __metadata: resolution: "@oada/pino-debug@workspace:libs/pino-debug" dependencies: "@types/debug": "npm:^4.1.12" - "@types/node": "npm:^22.0.0" + "@types/node": "npm:^22.0.2" cls-rtracer: "npm:^2.6.3" is-interactive: "npm:^2.0.0" pino: "npm:^9.3.2" @@ -1427,7 +1427,7 @@ __metadata: "@oada/pino-debug": "workspace:^" "@oada/write-handler": "workspace:^" "@types/debug": "npm:^4.1.12" - "@types/node": "npm:^22.0.0" + "@types/node": "npm:^22.0.2" "@types/randomstring": "npm:^1.3.0" ajv: "npm:^8.17.1" ava: "npm:6.1.3" @@ -1466,9 +1466,9 @@ __metadata: "@tsconfig/node20": "npm:^20.1.4" "@types/eslint": "npm:^9.6.0" "@types/mocha": "npm:^10.0.7" - "@types/node": "npm:^22.0.0" - "@typescript-eslint/eslint-plugin": "npm:^7.18.0" - "@typescript-eslint/parser": "npm:^7.18.0" + "@types/node": "npm:^22.0.2" + "@typescript-eslint/eslint-plugin": "npm:^8.0.0" + "@typescript-eslint/parser": "npm:^8.0.0" "@yarnpkg/sdks": "npm:^3.1.3" browserslist: "npm:^4.23.2" c8: "npm:^10.1.2" @@ -1504,7 +1504,7 @@ __metadata: prettier: "npm:^3.3.3" tslib: "npm:2.6.3" typescript: "npm:5.5.4" - typescript-eslint: "npm:^7.18.0" + typescript-eslint: "npm:^8.0.0" update-browserslist-db: "npm:^1.1.0" zx: "npm:^8.1.4" languageName: unknown @@ -1534,7 +1534,7 @@ __metadata: "@oada/lib-kafka": "workspace:^" "@oada/pino-debug": "workspace:^" "@types/debug": "npm:^4.1.12" - "@types/node": "npm:^22.0.0" + "@types/node": "npm:^22.0.2" debug: "npm:^4.3.6" tslib: "npm:2.6.3" languageName: unknown @@ -1551,7 +1551,7 @@ __metadata: "@oada/pino-debug": "workspace:^" "@oada/write-handler": "workspace:^" "@types/debug": "npm:^4.1.12" - "@types/node": "npm:^22.0.0" + "@types/node": "npm:^22.0.2" debug: "npm:^4.3.6" got: "npm:^14.4.2" tslib: "npm:2.6.3" @@ -1593,17 +1593,15 @@ __metadata: "@oada/models": "workspace:^" "@oada/pino-debug": "workspace:^" "@types/debug": "npm:^4.1.12" - "@types/minimist": "npm:^1.2.5" - "@types/promptly": "npm:^3.0.5" chalk: "npm:^5.3.0" + cmd-ts: "npm:^0.13.0" debug: "npm:^4.3.6" + es-main: "npm:^1.3.0" ksuid: "npm:^3.0.0" - minimist: "npm:^1.2.8" - promptly: "npm:^3.2.0" tslib: "npm:2.6.3" type-fest: "npm:^4.23.0" bin: - add: ./dist/useradd.js + add: ./dist/cli/useradd.js languageName: unknown linkType: soft @@ -1694,7 +1692,7 @@ __metadata: "@oada/types": "npm:^4.0.0" "@types/debug": "npm:^4.1.12" "@types/json-pointer": "npm:^1.0.34" - "@types/node": "npm:^22.0.0" + "@types/node": "npm:^22.0.2" "@types/object-assign-deep": "npm:^0.4.3" ava: "npm:6.1.3" debug: "npm:^4.3.6" @@ -2167,12 +2165,21 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:*, @types/node@npm:>=14, @types/node@npm:>=20, @types/node@npm:^22.0.0": - version: 22.0.0 - resolution: "@types/node@npm:22.0.0" +"@types/node@npm:*, @types/node@npm:>=20, @types/node@npm:^22.0.2": + version: 22.0.2 + resolution: "@types/node@npm:22.0.2" dependencies: undici-types: "npm:~6.11.1" - checksum: 10/7142a13ef1f884fde38f1e1499cbebcfe72755e8cb8657c4cb1ba1c2c91a3ae8656a72eb6e0a7d8189b0124c23c30e7c115324375d9c593435166da7a292e80e + checksum: 10/7f5937f22d5171df6d1764b838b64f03fd2686e0ebee15bb64eb609ee5280cfd8cbbb78efdf163bb49eee11c77de461ef8b85e2781e508d231777390ddf0e8ec + languageName: node + linkType: hard + +"@types/node@npm:^20.11.26": + version: 20.14.13 + resolution: "@types/node@npm:20.14.13" + dependencies: + undici-types: "npm:~5.26.4" + checksum: 10/749160b6bd9866e6169cb1a222e75aaf81da3868af1fda1e1e66d33c7e182be381f98a42b7d231fddf470f6389f2052ee842e776b3fdc677df798b933617866d languageName: node linkType: hard @@ -2268,15 +2275,6 @@ __metadata: languageName: node linkType: hard -"@types/promptly@npm:^3.0.5": - version: 3.0.5 - resolution: "@types/promptly@npm:3.0.5" - dependencies: - "@types/node": "npm:*" - checksum: 10/1d8b955fce0562649e04612a1a0b908ce6403bf2c302435cd9049cddde5fa3a3c8ff6bd76774dc8430b80cd6fc62f65b27bc846288b6c54434336456f50c41f4 - languageName: node - linkType: hard - "@types/qrcode-terminal@npm:^0.12.2": version: 0.12.2 resolution: "@types/qrcode-terminal@npm:0.12.2" @@ -2381,7 +2379,30 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:7.18.0, @typescript-eslint/eslint-plugin@npm:^7.0.1, @typescript-eslint/eslint-plugin@npm:^7.18.0": +"@typescript-eslint/eslint-plugin@npm:8.0.0, @typescript-eslint/eslint-plugin@npm:^8.0.0": + version: 8.0.0 + resolution: "@typescript-eslint/eslint-plugin@npm:8.0.0" + dependencies: + "@eslint-community/regexpp": "npm:^4.10.0" + "@typescript-eslint/scope-manager": "npm:8.0.0" + "@typescript-eslint/type-utils": "npm:8.0.0" + "@typescript-eslint/utils": "npm:8.0.0" + "@typescript-eslint/visitor-keys": "npm:8.0.0" + graphemer: "npm:^1.4.0" + ignore: "npm:^5.3.1" + natural-compare: "npm:^1.4.0" + ts-api-utils: "npm:^1.3.0" + peerDependencies: + "@typescript-eslint/parser": ^8.0.0 || ^8.0.0-alpha.0 + eslint: ^8.57.0 || ^9.0.0 + peerDependenciesMeta: + typescript: + optional: true + checksum: 10/80c52b37f8c3489a637cbb433ffce19e7d279bd20bd4ccd0db9e3647afd6d2e7643c8319feafa5907c62c460c48605ca87e12a9c7890a094f264f47e2579add4 + languageName: node + linkType: hard + +"@typescript-eslint/eslint-plugin@npm:^7.0.1": version: 7.18.0 resolution: "@typescript-eslint/eslint-plugin@npm:7.18.0" dependencies: @@ -2404,7 +2425,25 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/parser@npm:7.18.0, @typescript-eslint/parser@npm:^7.0.1, @typescript-eslint/parser@npm:^7.18.0": +"@typescript-eslint/parser@npm:8.0.0, @typescript-eslint/parser@npm:^8.0.0": + version: 8.0.0 + resolution: "@typescript-eslint/parser@npm:8.0.0" + dependencies: + "@typescript-eslint/scope-manager": "npm:8.0.0" + "@typescript-eslint/types": "npm:8.0.0" + "@typescript-eslint/typescript-estree": "npm:8.0.0" + "@typescript-eslint/visitor-keys": "npm:8.0.0" + debug: "npm:^4.3.4" + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 + peerDependenciesMeta: + typescript: + optional: true + checksum: 10/044a7deb299bc988b7f33a99b9c1dc387133e7ce4b2f7751568e4fd07a2e541c1d628e332205ac3cbd797fcad95f89d097a38e6e7e42707d9022fbf0b8b26e6c + languageName: node + linkType: hard + +"@typescript-eslint/parser@npm:^7.0.1": version: 7.18.0 resolution: "@typescript-eslint/parser@npm:7.18.0" dependencies: @@ -2432,6 +2471,16 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/scope-manager@npm:8.0.0": + version: 8.0.0 + resolution: "@typescript-eslint/scope-manager@npm:8.0.0" + dependencies: + "@typescript-eslint/types": "npm:8.0.0" + "@typescript-eslint/visitor-keys": "npm:8.0.0" + checksum: 10/444dbc156d9d6d2aa4f82e35ab171aed85d1818c5adf70f955f69d6d0591d9a0668f645d38bf5b759098849aa4114340ca128a673be5525a94fba9a048751d0c + languageName: node + linkType: hard + "@typescript-eslint/type-utils@npm:7.18.0": version: 7.18.0 resolution: "@typescript-eslint/type-utils@npm:7.18.0" @@ -2449,6 +2498,21 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/type-utils@npm:8.0.0": + version: 8.0.0 + resolution: "@typescript-eslint/type-utils@npm:8.0.0" + dependencies: + "@typescript-eslint/typescript-estree": "npm:8.0.0" + "@typescript-eslint/utils": "npm:8.0.0" + debug: "npm:^4.3.4" + ts-api-utils: "npm:^1.3.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10/89ca36511acdb8d45dfe524ac6e06dbee4dea04ac02af2dd7e42de1fedd33aff8e88a08a2407259fc4f10220f90363856d9cee419697dd1381ea7b3d0b19af69 + languageName: node + linkType: hard + "@typescript-eslint/types@npm:7.18.0": version: 7.18.0 resolution: "@typescript-eslint/types@npm:7.18.0" @@ -2456,6 +2520,13 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/types@npm:8.0.0": + version: 8.0.0 + resolution: "@typescript-eslint/types@npm:8.0.0" + checksum: 10/e28e79d8b7acfa42c90781fa63e90e56807ae018a0a92fc71c8e441d2bb3a250527c9d44ff6450ff1d47ceed0c3df28de6599f97f6c4c65ac554088867fc3517 + languageName: node + linkType: hard + "@typescript-eslint/typescript-estree@npm:7.18.0": version: 7.18.0 resolution: "@typescript-eslint/typescript-estree@npm:7.18.0" @@ -2475,7 +2546,40 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/utils@npm:*, @typescript-eslint/utils@npm:7.18.0": +"@typescript-eslint/typescript-estree@npm:8.0.0": + version: 8.0.0 + resolution: "@typescript-eslint/typescript-estree@npm:8.0.0" + dependencies: + "@typescript-eslint/types": "npm:8.0.0" + "@typescript-eslint/visitor-keys": "npm:8.0.0" + debug: "npm:^4.3.4" + globby: "npm:^11.1.0" + is-glob: "npm:^4.0.3" + minimatch: "npm:^9.0.4" + semver: "npm:^7.6.0" + ts-api-utils: "npm:^1.3.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10/99a80fb43d1e9cbd49a3dfdd264e7e361ffd4e19970d2b04b86a551fc730cc4f19202c3323d0d6bbfd7ce4672bf205cb7b756ba2e20c95729b24e878b96e66f3 + languageName: node + linkType: hard + +"@typescript-eslint/utils@npm:*, @typescript-eslint/utils@npm:8.0.0": + version: 8.0.0 + resolution: "@typescript-eslint/utils@npm:8.0.0" + dependencies: + "@eslint-community/eslint-utils": "npm:^4.4.0" + "@typescript-eslint/scope-manager": "npm:8.0.0" + "@typescript-eslint/types": "npm:8.0.0" + "@typescript-eslint/typescript-estree": "npm:8.0.0" + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 + checksum: 10/f76e65763725d944d3c6f0e78ea566cdb08247fa7ee9e2ec15310527f3e2325c92cb67c80a63e4a6dd29a5a7d96db3839aebd0a2e98810dcc248f6762414c995 + languageName: node + linkType: hard + +"@typescript-eslint/utils@npm:7.18.0": version: 7.18.0 resolution: "@typescript-eslint/utils@npm:7.18.0" dependencies: @@ -2499,6 +2603,16 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/visitor-keys@npm:8.0.0": + version: 8.0.0 + resolution: "@typescript-eslint/visitor-keys@npm:8.0.0" + dependencies: + "@typescript-eslint/types": "npm:8.0.0" + eslint-visitor-keys: "npm:^3.4.3" + checksum: 10/328106878ed42f1543590317477275a3c95c0455ba8203355fede94b0970844ec430cc5e090d4e1f48d805ac40ab1bd339270514e256b0810cabd423c6b2d52a + languageName: node + linkType: hard + "@vercel/nft@npm:^0.26.2": version: 0.26.3 resolution: "@vercel/nft@npm:0.26.3" @@ -2898,16 +3012,12 @@ __metadata: languageName: node linkType: hard -"arangojs@npm:^8.8.1": - version: 8.8.1 - resolution: "arangojs@npm:8.8.1" +"arangojs@npm:^9.0.0": + version: 9.0.0 + resolution: "arangojs@npm:9.0.0" dependencies: - "@types/node": "npm:>=14" - multi-part: "npm:^4.0.0" - path-browserify: "npm:^1.0.1" - x3-linkedlist: "npm:1.2.0" - xhr: "npm:^2.4.1" - checksum: 10/a0b39df91a963bb7140f7b5ccd33e900b64c9caf8076bb7fb35d598cd84604a175f3e7ed368c318dc1fd601b2eb53a7da3ec864f80f64211584ba7658b750517 + "@types/node": "npm:^20.11.26" + checksum: 10/9566ba6f0df65661ac8bf6415cb58b56126003294a1ba1a75e9d69a01f2de9e191acb1798ed2bd82ba7e0e7aea59833562afd5ea44782a6aeac668dfd799fb94 languageName: node linkType: hard @@ -4417,13 +4527,6 @@ __metadata: languageName: node linkType: hard -"dom-walk@npm:^0.1.0": - version: 0.1.2 - resolution: "dom-walk@npm:0.1.2" - checksum: 10/19eb0ce9c6de39d5e231530685248545d9cd2bd97b2cb3486e0bfc0f2a393a9addddfd5557463a932b52fdfcf68ad2a619020cd2c74a5fe46fbecaa8e80872f3 - languageName: node - linkType: hard - "dot-prop@npm:^5.1.0": version: 5.3.0 resolution: "dot-prop@npm:5.3.0" @@ -5764,17 +5867,6 @@ __metadata: languageName: node linkType: hard -"file-type@npm:^16.5.4": - version: 16.5.4 - resolution: "file-type@npm:16.5.4" - dependencies: - readable-web-to-node-stream: "npm:^3.0.0" - strtok3: "npm:^6.2.4" - token-types: "npm:^4.1.1" - checksum: 10/46ced46bb925ab547e0a6d43108a26d043619d234cb0588d7abce7b578dafac142bcfd2e23a6adb0a4faa4b951bd1b14b355134a193362e07cd352f9bf0dc349 - languageName: node - linkType: hard - "file-type@npm:^19.0.0": version: 19.0.0 resolution: "file-type@npm:19.0.0" @@ -6224,16 +6316,6 @@ __metadata: languageName: node linkType: hard -"global@npm:~4.4.0": - version: 4.4.0 - resolution: "global@npm:4.4.0" - dependencies: - min-document: "npm:^2.19.0" - process: "npm:^0.11.10" - checksum: 10/9c057557c8f5a5bcfbeb9378ba4fe2255d04679452be504608dd5f13b54edf79f7be1db1031ea06a4ec6edd3b9f5f17d2d172fb47e6c69dae57fd84b7e72b77f - languageName: node - linkType: hard - "globals@npm:^14.0.0": version: 14.0.0 resolution: "globals@npm:14.0.0" @@ -6852,13 +6934,6 @@ __metadata: languageName: node linkType: hard -"is-function@npm:^1.0.1": - version: 1.0.2 - resolution: "is-function@npm:1.0.2" - checksum: 10/7d564562e07b4b51359547d3ccc10fb93bb392fd1b8177ae2601ee4982a0ece86d952323fc172a9000743a3971f09689495ab78a1d49a9b14fc97a7e28521dc0 - languageName: node - linkType: hard - "is-generator-function@npm:^1.0.10": version: 1.0.10 resolution: "is-generator-function@npm:1.0.10" @@ -7888,17 +7963,7 @@ __metadata: languageName: node linkType: hard -"mime-kind@npm:^4.0.0": - version: 4.0.0 - resolution: "mime-kind@npm:4.0.0" - dependencies: - file-type: "npm:^16.5.4" - mime-types: "npm:^2.1.24" - checksum: 10/07e6edd0e690bba2f2b1296952914c2108726caf7cc809830a5036edfd74fb5ff1fdca35d90ecaff880dc76ffc76e271408a68829a27a92fbaebaa5138bdb441 - languageName: node - linkType: hard - -"mime-types@npm:^2.1.12, mime-types@npm:^2.1.24, mime-types@npm:~2.1.24, mime-types@npm:~2.1.34": +"mime-types@npm:^2.1.12, mime-types@npm:~2.1.24, mime-types@npm:~2.1.34": version: 2.1.35 resolution: "mime-types@npm:2.1.35" dependencies: @@ -7960,15 +8025,6 @@ __metadata: languageName: node linkType: hard -"min-document@npm:^2.19.0": - version: 2.19.0 - resolution: "min-document@npm:2.19.0" - dependencies: - dom-walk: "npm:^0.1.0" - checksum: 10/4e45a0686c81cc04509989235dc6107e2678a59bb48ce017d3c546d7d9a18d782e341103e66c78081dd04544704e2196e529905c41c2550bca069b69f95f07c8 - languageName: node - linkType: hard - "min-indent@npm:^1.0.0": version: 1.0.1 resolution: "min-indent@npm:1.0.1" @@ -8182,30 +8238,6 @@ __metadata: languageName: node linkType: hard -"multi-part-lite@npm:^1.0.0": - version: 1.0.0 - resolution: "multi-part-lite@npm:1.0.0" - checksum: 10/ca028a900bc7b3ef50001eaa408428fb1fa280f1cbc4b4c207ae059af4bbf12f95f8a1501840ec84290cbd20a742657fb8f288720addb6a7dac61ec236195714 - languageName: node - linkType: hard - -"multi-part@npm:^4.0.0": - version: 4.0.0 - resolution: "multi-part@npm:4.0.0" - dependencies: - mime-kind: "npm:^4.0.0" - multi-part-lite: "npm:^1.0.0" - checksum: 10/71786ce0bab216d4bd9215646ae292c5fcdfa8115197e0849ffa31a075a69f49a34cdb50390627498be9f5d8b65a22a399c70ea832625258d0c488648197536d - languageName: node - linkType: hard - -"mute-stream@npm:~0.0.4": - version: 0.0.8 - resolution: "mute-stream@npm:0.0.8" - checksum: 10/a2d2e79dde87e3424ffc8c334472c7f3d17b072137734ca46e6f221131f1b014201cc593b69a38062e974fb2394d3d1cb4349f80f012bbf8b8ac1b28033e515f - languageName: node - linkType: hard - "natural-compare@npm:^1.4.0": version: 1.4.0 resolution: "natural-compare@npm:1.4.0" @@ -8803,13 +8835,6 @@ __metadata: languageName: node linkType: hard -"parse-headers@npm:^2.0.0": - version: 2.0.5 - resolution: "parse-headers@npm:2.0.5" - checksum: 10/210b13bc0f99cf6f1183896f01de164797ac35b2720c9f1c82a3e2ceab256f87b9048e8e16a14cfd1b75448771f8379cd564bd1674a179ab0168c90005d4981b - languageName: node - linkType: hard - "parse-json@npm:^5.0.0, parse-json@npm:^5.2.0": version: 5.2.0 resolution: "parse-json@npm:5.2.0" @@ -8891,13 +8916,6 @@ __metadata: languageName: node linkType: hard -"path-browserify@npm:^1.0.1": - version: 1.0.1 - resolution: "path-browserify@npm:1.0.1" - checksum: 10/7e7368a5207e7c6b9051ef045711d0dc3c2b6203e96057e408e6e74d09f383061010d2be95cb8593fe6258a767c3e9fc6b2bfc7ce8d48ae8c3d9f6994cca9ad8 - languageName: node - linkType: hard - "path-exists@npm:^4.0.0": version: 4.0.0 resolution: "path-exists@npm:4.0.0" @@ -8978,13 +8996,6 @@ __metadata: languageName: node linkType: hard -"peek-readable@npm:^4.1.0": - version: 4.1.0 - resolution: "peek-readable@npm:4.1.0" - checksum: 10/97373215dcf382748645c3d22ac5e8dbd31759f7bd0c539d9fdbaaa7d22021838be3e55110ad0ed8f241c489342304b14a50dfee7ef3bcee2987d003b24ecc41 - languageName: node - linkType: hard - "peek-readable@npm:^5.0.0": version: 5.0.0 resolution: "peek-readable@npm:5.0.0" @@ -9271,15 +9282,6 @@ __metadata: languageName: node linkType: hard -"promptly@npm:^3.2.0": - version: 3.2.0 - resolution: "promptly@npm:3.2.0" - dependencies: - read: "npm:^1.0.4" - checksum: 10/2586798c651ab56cc4f26734c493b0111a15d25d31f81c660c608ac9a9f24114fff21af3161aa4c5016b29e029350da6249ab5061ad4cd622402014591d56bb3 - languageName: node - linkType: hard - "proxy-addr@npm:^2.0.7": version: 2.0.7 resolution: "proxy-addr@npm:2.0.7" @@ -9323,12 +9325,12 @@ __metadata: languageName: node linkType: hard -"qs@npm:^6.10.3, qs@npm:^6.11.0, qs@npm:^6.12.3": - version: 6.12.3 - resolution: "qs@npm:6.12.3" +"qs@npm:^6.10.3, qs@npm:^6.11.0, qs@npm:^6.13.0": + version: 6.13.0 + resolution: "qs@npm:6.13.0" dependencies: side-channel: "npm:^1.0.6" - checksum: 10/486d80cfa5e12886de6fe15a5aa2b3c7023bf4461f949a742022c3ae608499dbaebcb57b1f15c1f59d86356772969028768b33c1a7c01e76d99f149239e63d59 + checksum: 10/f548b376e685553d12e461409f0d6e5c59ec7c7d76f308e2a888fd9db3e0c5e89902bedd0754db3a9038eda5f27da2331a6f019c8517dc5e0a16b3c9a6e9cef8 languageName: node linkType: hard @@ -9425,15 +9427,6 @@ __metadata: languageName: node linkType: hard -"read@npm:^1.0.4": - version: 1.0.7 - resolution: "read@npm:1.0.7" - dependencies: - mute-stream: "npm:~0.0.4" - checksum: 10/2777c254e5732cac96f5d0a1c0f6b836c89ae23d8febd405b206f6f24d5de1873420f1a0795e0e3721066650d19adf802c7882c4027143ee0acf942a4f34f97b - languageName: node - linkType: hard - "readable-stream@npm:^3.1.1, readable-stream@npm:^3.6.0": version: 3.6.2 resolution: "readable-stream@npm:3.6.2" @@ -9458,7 +9451,7 @@ __metadata: languageName: node linkType: hard -"readable-web-to-node-stream@npm:^3.0.0, readable-web-to-node-stream@npm:^3.0.2": +"readable-web-to-node-stream@npm:^3.0.2": version: 3.0.2 resolution: "readable-web-to-node-stream@npm:3.0.2" dependencies: @@ -10325,16 +10318,6 @@ __metadata: languageName: node linkType: hard -"strtok3@npm:^6.2.4": - version: 6.3.0 - resolution: "strtok3@npm:6.3.0" - dependencies: - "@tokenizer/token": "npm:^0.3.0" - peek-readable: "npm:^4.1.0" - checksum: 10/98fba564d3830202aa3a6bcd5ccaf2cbd849bd87ae79ece91d337e1913916705a8e633c9577138d030a984f8ec987dea51807e01252f995cf5e183fdea35eb2b - languageName: node - linkType: hard - "strtok3@npm:^7.0.0": version: 7.0.0 resolution: "strtok3@npm:7.0.0" @@ -10550,16 +10533,6 @@ __metadata: languageName: node linkType: hard -"token-types@npm:^4.1.1": - version: 4.2.1 - resolution: "token-types@npm:4.2.1" - dependencies: - "@tokenizer/token": "npm:^0.3.0" - ieee754: "npm:^1.2.1" - checksum: 10/2995257d246387e773758c3c92a3cc99d0c0bf13cbafe0de5d712e4c35ed298da6704e21545cb123fa1f1b42ad62936c35bbd0611018b735e78c30b8b22b42d9 - languageName: node - linkType: hard - "token-types@npm:^5.0.1": version: 5.0.1 resolution: "token-types@npm:5.0.1" @@ -10741,19 +10714,17 @@ __metadata: languageName: node linkType: hard -"typescript-eslint@npm:^7.18.0": - version: 7.18.0 - resolution: "typescript-eslint@npm:7.18.0" +"typescript-eslint@npm:^8.0.0": + version: 8.0.0 + resolution: "typescript-eslint@npm:8.0.0" dependencies: - "@typescript-eslint/eslint-plugin": "npm:7.18.0" - "@typescript-eslint/parser": "npm:7.18.0" - "@typescript-eslint/utils": "npm:7.18.0" - peerDependencies: - eslint: ^8.56.0 + "@typescript-eslint/eslint-plugin": "npm:8.0.0" + "@typescript-eslint/parser": "npm:8.0.0" + "@typescript-eslint/utils": "npm:8.0.0" peerDependenciesMeta: typescript: optional: true - checksum: 10/7c1ad00ecd7141d8631a99ff602cfabdab3d9f8a9be5b0282b8b3291125df1fc37c4baa13d1ef26562de8ed1393a5851a7e861ded0224127fe670ffae6fed6aa + checksum: 10/128c1ff75dc6e6e79fbd93aff615a0c2a7abeeca507bc667689d805a1498e8c671277dbd3f31396fafad633ed82b6f7300686a6dea355e6f99f9c7dfb8918a21 languageName: node linkType: hard @@ -10810,6 +10781,13 @@ __metadata: languageName: node linkType: hard +"undici-types@npm:~5.26.4": + version: 5.26.5 + resolution: "undici-types@npm:5.26.5" + checksum: 10/0097779d94bc0fd26f0418b3a05472410408877279141ded2bd449167be1aed7ea5b76f756562cb3586a07f251b90799bab22d9019ceba49c037c76445f7cddd + languageName: node + linkType: hard + "undici-types@npm:~6.11.1": version: 6.11.1 resolution: "undici-types@npm:6.11.1" @@ -11142,25 +11120,6 @@ __metadata: languageName: node linkType: hard -"x3-linkedlist@npm:1.2.0": - version: 1.2.0 - resolution: "x3-linkedlist@npm:1.2.0" - checksum: 10/034f2f7a0937771fe9102ed5e6fccca1387d4d1bed2fa9a3220e539e11ed2d7c277f7d85977db25aa27fec8d49257e3710dd58c527d70d9ecb99b8c5ba27376f - languageName: node - linkType: hard - -"xhr@npm:^2.4.1": - version: 2.6.0 - resolution: "xhr@npm:2.6.0" - dependencies: - global: "npm:~4.4.0" - is-function: "npm:^1.0.1" - parse-headers: "npm:^2.0.0" - xtend: "npm:^4.0.0" - checksum: 10/31f34aba708955008c87bcd21482be6afc7ff8adc28090e633b1d3f8d3e8e93150bac47b262738b046d7729023a884b655d55cf34e9d14d5850a1275ab49fb37 - languageName: node - linkType: hard - "xksuid@https://github.com/aultac/xksuid.git#commit=22a21eb01331191feb62ea0a4e67d96d2e80f396": version: 0.0.3 resolution: "xksuid@https://github.com/aultac/xksuid.git#commit=22a21eb01331191feb62ea0a4e67d96d2e80f396"