From 37b9cfa57913b8ce2b7944f63ac79c4a8bb70506 Mon Sep 17 00:00:00 2001 From: getlarge Date: Sun, 14 Jan 2024 12:05:18 +0100 Subject: [PATCH 01/14] chore: install ory external libraries --- package.json | 3 ++ yarn.lock | 137 ++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 139 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 97bcef97..79a26198 100644 --- a/package.json +++ b/package.json @@ -117,6 +117,9 @@ "@fastify/secure-session": "7.1.0", "@fastify/static": "^6.11.0", "@fastify/swagger": "8.10.0", + "@getlarge/keto-client-wrapper": "0.0.1", + "@getlarge/keto-relations-parser": "0.0.1", + "@getlarge/kratos-client-wrapper": "0.0.1", "@nestjs/axios": "3.0.0", "@nestjs/bull": "10.0.1", "@nestjs/common": "10.2.4", diff --git a/yarn.lock b/yarn.lock index 1b5b0ee5..d11e5722 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3801,6 +3801,47 @@ __metadata: languageName: node linkType: hard +"@getlarge/keto-client-wrapper@npm:0.0.1": + version: 0.0.1 + resolution: "@getlarge/keto-client-wrapper@npm:0.0.1" + dependencies: + "@getlarge/keto-relations-parser": 0.0.1 + "@nestjs/axios": ^3.0.1 + "@nestjs/common": ^10.0.2 + "@nestjs/core": ^10.0.2 + "@ory/client": ^1.4.9 + axios: 1.6.5 + defekt: ^9.3.1 + lodash.get: ^4.4.2 + tslib: ^2.3.0 + checksum: 4f58f96d6bec9328ab1401e7dde76860554996e3970f78b601d97e9028c8ae1c539bf9de0e3ab47d86ba8f56f2f6b89e37d144c8c18944a46cc31ddd4281dca8 + languageName: node + linkType: hard + +"@getlarge/keto-relations-parser@npm:0.0.1": + version: 0.0.1 + resolution: "@getlarge/keto-relations-parser@npm:0.0.1" + dependencies: + defekt: ^9.3.1 + lodash.get: ^4.4.2 + tslib: ^2.3.0 + checksum: 64087eef5f0f37b45f20084019e2bd9dad84d62616ba8ae95da7e6cf73702b10dc1808e087ff70a64123ae869da294835756bdac96b407c3c8a3ac457ef32174 + languageName: node + linkType: hard + +"@getlarge/kratos-client-wrapper@npm:0.0.1": + version: 0.0.1 + resolution: "@getlarge/kratos-client-wrapper@npm:0.0.1" + dependencies: + "@nestjs/axios": ^3.0.1 + "@nestjs/common": ^10.0.2 + "@ory/client": ^1.4.9 + axios: 1.6.5 + tslib: ^2.3.0 + checksum: cb382c7882b22163879fe804188fad10b0d6a8a2f37817c5a16c0adab0147cd94ca79d08af78d9f398d29635863fa6a463993f1f5325e5482003e5adb7e621a0 + languageName: node + linkType: hard + "@golevelup/nestjs-discovery@npm:4.0.0": version: 4.0.0 resolution: "@golevelup/nestjs-discovery@npm:4.0.0" @@ -4350,6 +4391,18 @@ __metadata: languageName: node linkType: hard +"@nestjs/axios@npm:^3.0.1": + version: 3.0.1 + resolution: "@nestjs/axios@npm:3.0.1" + peerDependencies: + "@nestjs/common": ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 + axios: ^1.3.1 + reflect-metadata: ^0.1.12 + rxjs: ^6.0.0 || ^7.0.0 + checksum: 01cebc64efa7a1d9df7a9053fbc5124986a95078789a0f280a2a61c31601a70a35745e07fc385497b4f85c7bdb6216a3575728646f1e6e684c038ac31900129c + languageName: node + linkType: hard + "@nestjs/bull-shared@npm:^10.0.1": version: 10.0.1 resolution: "@nestjs/bull-shared@npm:10.0.1" @@ -4397,6 +4450,27 @@ __metadata: languageName: node linkType: hard +"@nestjs/common@npm:^10.0.2": + version: 10.3.0 + resolution: "@nestjs/common@npm:10.3.0" + dependencies: + iterare: 1.2.1 + tslib: 2.6.2 + uid: 2.0.2 + peerDependencies: + class-transformer: "*" + class-validator: "*" + reflect-metadata: ^0.1.12 + rxjs: ^7.1.0 + peerDependenciesMeta: + class-transformer: + optional: true + class-validator: + optional: true + checksum: c5444cb46bd4f4a4d28b5031f7c28a0cf9863bc2d5518910bfed6a49734f59e1ea08dd4651e2117ae82df81c933ef84f0963c5cdeee5ef1608cf1bd36ee291c5 + languageName: node + linkType: hard + "@nestjs/config@npm:3.1.1": version: 3.1.1 resolution: "@nestjs/config@npm:3.1.1" @@ -4440,6 +4514,34 @@ __metadata: languageName: node linkType: hard +"@nestjs/core@npm:^10.0.2": + version: 10.3.0 + resolution: "@nestjs/core@npm:10.3.0" + dependencies: + "@nuxtjs/opencollective": 0.3.2 + fast-safe-stringify: 2.1.1 + iterare: 1.2.1 + path-to-regexp: 3.2.0 + tslib: 2.6.2 + uid: 2.0.2 + peerDependencies: + "@nestjs/common": ^10.0.0 + "@nestjs/microservices": ^10.0.0 + "@nestjs/platform-express": ^10.0.0 + "@nestjs/websockets": ^10.0.0 + reflect-metadata: ^0.1.12 + rxjs: ^7.1.0 + peerDependenciesMeta: + "@nestjs/microservices": + optional: true + "@nestjs/platform-express": + optional: true + "@nestjs/websockets": + optional: true + checksum: 7677b9fb97c8dec512c2a736c273ef08698b377af8c046bc5aad442ba3d35acbc17d177e76bf44a66678cae2ced2d265183e85be4190c501a195f16496df6396 + languageName: node + linkType: hard + "@nestjs/jwt@npm:10.1.0": version: 10.1.0 resolution: "@nestjs/jwt@npm:10.1.0" @@ -5502,6 +5604,15 @@ __metadata: languageName: node linkType: hard +"@ory/client@npm:^1.4.9": + version: 1.5.1 + resolution: "@ory/client@npm:1.5.1" + dependencies: + axios: ^0.27.2 + checksum: acadd44f3d855827e4ada02f5b504a176e5b3c013e7db993bb70bdb62cab9c98354982bc36b74eadc083cbaabb87c17a99d60c226d854b80270979d185a9f93c + languageName: node + linkType: hard + "@phenomnomnominal/tsquery@npm:~5.0.1": version: 5.0.1 resolution: "@phenomnomnominal/tsquery@npm:5.0.1" @@ -8173,6 +8284,17 @@ __metadata: languageName: node linkType: hard +"axios@npm:1.6.5": + version: 1.6.5 + resolution: "axios@npm:1.6.5" + dependencies: + follow-redirects: ^1.15.4 + form-data: ^4.0.0 + proxy-from-env: ^1.1.0 + checksum: e28d67b2d9134cb4608c44d8068b0678cfdccc652742e619006f27264a30c7aba13b2cd19c6f1f52ae195b5232734925928fb192d5c85feea7edd2f273df206d + languageName: node + linkType: hard + "axios@npm:^0.27.2": version: 0.27.2 resolution: "axios@npm:0.27.2" @@ -13320,6 +13442,16 @@ __metadata: languageName: node linkType: hard +"follow-redirects@npm:^1.15.4": + version: 1.15.5 + resolution: "follow-redirects@npm:1.15.5" + peerDependenciesMeta: + debug: + optional: true + checksum: 5ca49b5ce6f44338cbfc3546823357e7a70813cecc9b7b768158a1d32c1e62e7407c944402a918ea8c38ae2e78266312d617dc68783fac502cbb55e1047b34ec + languageName: node + linkType: hard + "for-each@npm:^0.3.3": version: 0.3.3 resolution: "for-each@npm:0.3.3" @@ -16619,7 +16751,7 @@ __metadata: languageName: node linkType: hard -"lodash.get@npm:^4": +"lodash.get@npm:^4, lodash.get@npm:^4.4.2": version: 4.4.2 resolution: "lodash.get@npm:4.4.2" checksum: e403047ddb03181c9d0e92df9556570e2b67e0f0a930fcbbbd779370972368f5568e914f913e93f3b08f6d492abc71e14d4e9b7a18916c31fa04bd2306efe545 @@ -22357,6 +22489,9 @@ __metadata: "@fastify/secure-session": 7.1.0 "@fastify/static": ^6.11.0 "@fastify/swagger": 8.10.0 + "@getlarge/keto-client-wrapper": 0.0.1 + "@getlarge/keto-relations-parser": 0.0.1 + "@getlarge/kratos-client-wrapper": 0.0.1 "@jscutlery/semver": ^3.1.0 "@mermaid-js/mermaid-cli": ^8.13.4 "@nestjs/axios": 3.0.0 From 367b4a51bcc99210a4f161e636a3bdef40ccad52 Mon Sep 17 00:00:00 2001 From: getlarge Date: Sun, 14 Jan 2024 13:40:13 +0100 Subject: [PATCH 02/14] refactor: replace Ory modules and helpers by external libraries --- apps/auth/src/app/users/users.controller.ts | 44 +++++++- apps/auth/src/app/users/users.module.ts | 36 +----- .../src/app/orders/orders.controller.ts | 102 ++++++++++------- apps/orders/src/app/orders/orders.module.ts | 45 +++----- apps/orders/src/app/orders/orders.service.ts | 74 ++++++------ .../src/app/payments/payments.controller.ts | 51 +++++++-- .../src/app/payments/payments.module.ts | 41 +++---- .../src/app/payments/payments.service.ts | 44 ++++---- .../permissions-manager/src/app/app.module.ts | 23 +++- .../src/app/check-permission.command.ts | 15 +-- .../src/app/create-relation.command.spec.ts | 19 ++-- .../src/app/create-relation.command.ts | 23 ++-- .../src/app/delete-relation.command.ts | 22 ++-- .../src/app/expand-permissions.command.ts | 29 +++-- .../src/app/get-relations.command.ts | 22 +++- .../src/app/tickets/tickets.controller.ts | 105 +++++++++++------- .../tickets/src/app/tickets/tickets.module.ts | 40 +++---- .../src/app/tickets/tickets.service.ts | 33 +++--- 18 files changed, 424 insertions(+), 344 deletions(-) diff --git a/apps/auth/src/app/users/users.controller.ts b/apps/auth/src/app/users/users.controller.ts index 7f53676a..93633bfa 100644 --- a/apps/auth/src/app/users/users.controller.ts +++ b/apps/auth/src/app/users/users.controller.ts @@ -1,3 +1,4 @@ +import { OryAuthenticationGuard } from '@getlarge/kratos-client-wrapper'; import { Body, Controller, @@ -19,12 +20,14 @@ import { } from '@nestjs/swagger'; import { SecurityRequirements } from '@ticketing/microservices/shared/constants'; import { CurrentUser } from '@ticketing/microservices/shared/decorators'; +import { OryActionAuthGuard } from '@ticketing/microservices/shared/guards'; import { - OryActionAuthGuard, - OryAuthenticationGuard, -} from '@ticketing/microservices/shared/guards'; -import { Actions, Resources } from '@ticketing/shared/constants'; + Actions, + CURRENT_USER_KEY, + Resources, +} from '@ticketing/shared/constants'; import { requestValidationErrorFactory } from '@ticketing/shared/errors'; +import { FastifyRequest } from 'fastify/types/request'; import { User, UserCredentials, UserCredentialsDto, UserDto } from './models'; import { OnOrySignInDto, OnOrySignUpDto } from './models/ory-identity.dto'; @@ -108,7 +111,38 @@ export class UsersController { return this.usersService.signUp(credentials); } - @UseGuards(OryAuthenticationGuard) + @UseGuards( + OryAuthenticationGuard({ + cookieResolver: (ctx) => + ctx.switchToHttp().getRequest().headers.cookie, + isValidSession: (x) => { + return ( + !!x?.identity && + typeof x.identity.traits === 'object' && + !!x.identity.traits && + 'email' in x.identity.traits && + typeof x.identity.metadata_public === 'object' && + !!x.identity.metadata_public && + 'id' in x.identity.metadata_public && + typeof x.identity.metadata_public.id === 'string' + ); + }, + sessionTokenResolver: (ctx) => + ctx + .switchToHttp() + .getRequest() + .headers?.authorization?.replace('Bearer ', ''), + postValidationHook: (ctx, session) => { + ctx.switchToHttp().getRequest().session = session; + // eslint-disable-next-line security/detect-object-injection + ctx.switchToHttp().getRequest()[CURRENT_USER_KEY] = { + id: session.identity.metadata_public['id'], + email: session.identity.traits.email, + identityId: session.identity.id, + }; + }, + }), + ) @ApiOperation({ description: 'Get details about currently signed in user', summary: `Get current user - Scope : ${Resources.USERS}:${Actions.READ_ONE}`, diff --git a/apps/auth/src/app/users/users.module.ts b/apps/auth/src/app/users/users.module.ts index 09199e4a..d03b3af4 100644 --- a/apps/auth/src/app/users/users.module.ts +++ b/apps/auth/src/app/users/users.module.ts @@ -1,11 +1,7 @@ +import { OryFrontendModule } from '@getlarge/kratos-client-wrapper'; import { Module } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; -import { JwtModule } from '@nestjs/jwt'; import { MongooseModule } from '@nestjs/mongoose'; -import { OryAuthenticationModule } from '@ticketing/microservices/ory-client'; -import { PassportModule } from '@ticketing/microservices/shared/fastify-passport'; -import { JwtStrategy } from '@ticketing/microservices/shared/guards'; -import { CURRENT_USER_KEY } from '@ticketing/shared/constants'; import { EnvironmentVariables } from '../env'; import { User, UserSchema } from './schemas/user.schema'; @@ -23,40 +19,16 @@ import { UsersService } from './users.service'; inject: [ConfigService], }, ]), - PassportModule.register({ - assignProperty: CURRENT_USER_KEY, - session: true, - }), - JwtModule.registerAsync({ - useFactory: ( - configService: ConfigService, - ) => ({ - privateKey: configService.get('JWT_PRIVATE_KEY'), - publicKey: configService.get('JWT_PUBLIC_KEY'), - signOptions: { - expiresIn: configService.get('JWT_EXPIRES_IN'), - algorithm: configService.get('JWT_ALGORITHM'), - issuer: configService.get('JWT_ISSUER'), - audience: '', - }, - }), - inject: [ConfigService], - }), - OryAuthenticationModule.forRootAsync({ + OryFrontendModule.forRootAsync({ inject: [ConfigService], useFactory: ( configService: ConfigService, ) => ({ - kratosAccessToken: configService.get('ORY_KRATOS_API_KEY'), - kratosPublicApiPath: configService.get('ORY_KRATOS_PUBLIC_URL'), - kratosAdminApiPath: configService.get('ORY_KRATOS_ADMIN_URL'), - hydraAccessToken: configService.get('ORY_HYDRA_API_KEY'), - hydraAdminApiPath: configService.get('ORY_HYDRA_ADMIN_URL'), - hydraPublicApiPath: configService.get('ORY_HYDRA_PUBLIC_URL'), + basePath: configService.get('ORY_KRATOS_PUBLIC_URL'), }), }), ], controllers: [UsersController], - providers: [UsersService, JwtStrategy], + providers: [UsersService], }) export class UsersModule {} diff --git a/apps/orders/src/app/orders/orders.controller.ts b/apps/orders/src/app/orders/orders.controller.ts index 255fb3c0..655990ea 100644 --- a/apps/orders/src/app/orders/orders.controller.ts +++ b/apps/orders/src/app/orders/orders.controller.ts @@ -1,3 +1,9 @@ +import { + OryAuthorizationGuard, + OryPermissionChecks, +} from '@getlarge/keto-client-wrapper'; +import { relationTupleBuilder } from '@getlarge/keto-relations-parser'; +import { OryAuthenticationGuard } from '@getlarge/kratos-client-wrapper'; import { Body, Controller, @@ -19,17 +25,9 @@ import { ApiTags, } from '@nestjs/swagger'; import { SecurityRequirements } from '@ticketing/microservices/shared/constants'; -import { - CurrentUser, - PermissionCheck, -} from '@ticketing/microservices/shared/decorators'; -import { - OryAuthenticationGuard, - OryPermissionGuard, -} from '@ticketing/microservices/shared/guards'; +import { CurrentUser } from '@ticketing/microservices/shared/decorators'; import { PermissionNamespaces } from '@ticketing/microservices/shared/models'; import { ParseObjectId } from '@ticketing/microservices/shared/pipes'; -import { relationTupleToString } from '@ticketing/microservices/shared/relation-tuple-parser'; import { Actions, CURRENT_USER_KEY, @@ -43,27 +41,55 @@ import { get } from 'lodash-es'; import { CreateOrder, CreateOrderDto, Order, OrderDto } from './models'; import { OrdersService } from './orders.service'; +const AuthenticationGuard = OryAuthenticationGuard({ + cookieResolver: (ctx) => + ctx.switchToHttp().getRequest().headers.cookie, + isValidSession: (x) => { + return ( + !!x?.identity && + typeof x.identity.traits === 'object' && + !!x.identity.traits && + 'email' in x.identity.traits && + typeof x.identity.metadata_public === 'object' && + !!x.identity.metadata_public && + 'id' in x.identity.metadata_public && + typeof x.identity.metadata_public.id === 'string' + ); + }, + sessionTokenResolver: (ctx) => + ctx + .switchToHttp() + .getRequest() + .headers?.authorization?.replace('Bearer ', ''), + postValidationHook: (ctx, session) => { + ctx.switchToHttp().getRequest().session = session; + ctx.switchToHttp().getRequest()[CURRENT_USER_KEY] = { + id: session.identity.metadata_public['id'], + email: session.identity.traits.email, + identityId: session.identity.id, + }; + }, +}); + +const AuthorizationGuard = OryAuthorizationGuard({}); + @Controller(Resources.ORDERS) @ApiTags(Resources.ORDERS) export class OrdersController { constructor(private readonly ordersService: OrdersService) {} // TODO: check if ticket is reserved via Ory by adding orders to the tickets relations - @PermissionCheck((ctx) => { + @OryPermissionChecks((ctx) => { const req = ctx.switchToHttp().getRequest(); const currentUserId = get(req, `${CURRENT_USER_KEY}.id`); const resourceId = get(req.body as CreateOrder, 'ticketId'); - return relationTupleToString({ - namespace: PermissionNamespaces[Resources.TICKETS], - object: resourceId, - relation: 'order', - subjectIdOrSet: { - namespace: PermissionNamespaces[Resources.USERS], - object: currentUserId, - }, - }); + return relationTupleBuilder() + .subject(PermissionNamespaces[Resources.USERS], currentUserId) + .isIn('order') + .of(PermissionNamespaces[Resources.TICKETS], resourceId) + .toString(); }) - @UseGuards(OryAuthenticationGuard, OryPermissionGuard) + @UseGuards(AuthenticationGuard, AuthorizationGuard) @UsePipes( new ValidationPipe({ transform: true, @@ -110,21 +136,17 @@ export class OrdersController { return this.ordersService.find(currentUser); } - @PermissionCheck((ctx) => { + @OryPermissionChecks((ctx) => { const req = ctx.switchToHttp().getRequest(); const currentUserId = get(req, `${CURRENT_USER_KEY}.id`); const resourceId = get(req.params, 'id'); - return relationTupleToString({ - namespace: PermissionNamespaces[Resources.ORDERS], - object: resourceId, - relation: 'owners', - subjectIdOrSet: { - namespace: PermissionNamespaces[Resources.USERS], - object: currentUserId, - }, - }); + return relationTupleBuilder() + .subject(PermissionNamespaces[Resources.USERS], currentUserId) + .isIn('owners') + .of(PermissionNamespaces[Resources.ORDERS], resourceId) + .toString(); }) - @UseGuards(OryAuthenticationGuard) + @UseGuards(AuthenticationGuard, AuthorizationGuard) @ApiBearerAuth(SecurityRequirements.Bearer) @ApiCookieAuth(SecurityRequirements.Session) @ApiOperation({ @@ -141,21 +163,17 @@ export class OrdersController { return this.ordersService.findById(id); } - @PermissionCheck((ctx) => { + @OryPermissionChecks((ctx) => { const req = ctx.switchToHttp().getRequest(); const currentUserId = get(req, `${CURRENT_USER_KEY}.id`); const resourceId = get(req.params, 'id'); - return relationTupleToString({ - namespace: PermissionNamespaces[Resources.ORDERS], - object: resourceId, - relation: 'owners', - subjectIdOrSet: { - namespace: PermissionNamespaces[Resources.USERS], - object: currentUserId, - }, - }); + return relationTupleBuilder() + .subject(PermissionNamespaces[Resources.USERS], currentUserId) + .isIn('owners') + .of(PermissionNamespaces[Resources.ORDERS], resourceId) + .toString(); }) - @UseGuards(OryAuthenticationGuard) + @UseGuards(AuthenticationGuard, AuthorizationGuard) @UsePipes( new ValidationPipe({ transform: true, diff --git a/apps/orders/src/app/orders/orders.module.ts b/apps/orders/src/app/orders/orders.module.ts index 182f25ec..6dda08ff 100644 --- a/apps/orders/src/app/orders/orders.module.ts +++ b/apps/orders/src/app/orders/orders.module.ts @@ -1,3 +1,8 @@ +import { + OryPermissionsModule, + OryRelationshipsModule, +} from '@getlarge/keto-client-wrapper'; +import { OryFrontendModule } from '@getlarge/kratos-client-wrapper'; import { Module } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; import { APP_FILTER } from '@nestjs/core'; @@ -7,15 +12,9 @@ import { Transport, } from '@nestjs/microservices'; import { AmqpClient, AmqpOptions } from '@s1seven/nestjs-tools-amqp-transport'; -import { - OryAuthenticationModule, - OryPermissionsModule, -} from '@ticketing/microservices/ory-client'; -import { PassportModule } from '@ticketing/microservices/shared/fastify-passport'; import { GlobalErrorFilter } from '@ticketing/microservices/shared/filters'; -import { JwtStrategy } from '@ticketing/microservices/shared/guards'; import { getReplyQueueName } from '@ticketing/microservices/shared/rmq'; -import { CURRENT_USER_KEY, Services } from '@ticketing/shared/constants'; +import { Services } from '@ticketing/shared/constants'; import { AppConfigService, EnvironmentVariables } from '../env'; import { @@ -66,10 +65,6 @@ const clientFactory = ( @Module({ imports: [ MongooseFeatures, - PassportModule.register({ - assignProperty: CURRENT_USER_KEY, - session: true, - }), ClientsModule.registerAsync([ { name: TICKETS_CLIENT, @@ -81,8 +76,6 @@ const clientFactory = ( }; }, }, - ]), - ClientsModule.registerAsync([ { name: EXPIRATION_CLIENT, inject: [ConfigService], @@ -93,8 +86,6 @@ const clientFactory = ( }; }, }, - ]), - ClientsModule.registerAsync([ { name: PAYMENTS_CLIENT, inject: [ConfigService], @@ -106,18 +97,12 @@ const clientFactory = ( }, }, ]), - OryAuthenticationModule.forRootAsync({ + OryFrontendModule.forRootAsync({ inject: [ConfigService], useFactory: ( configService: ConfigService, ) => ({ - kratosAccessToken: configService.get('ORY_KRATOS_API_KEY'), - kratosPublicApiPath: configService.get('ORY_KRATOS_PUBLIC_URL'), - kratosAdminApiPath: configService.get('ORY_KRATOS_ADMIN_URL'), - - hydraAccessToken: configService.get('ORY_HYDRA_API_KEY'), - hydraPublicApiPath: configService.get('ORY_HYDRA_PUBLIC_URL'), - hydraAdminApiPath: configService.get('ORY_HYDRA_ADMIN_URL'), + basePath: configService.get('ORY_KRATOS_PUBLIC_URL'), }), }), OryPermissionsModule.forRootAsync({ @@ -125,9 +110,16 @@ const clientFactory = ( useFactory: ( configService: ConfigService, ) => ({ - ketoAccessToken: configService.get('ORY_KETO_API_KEY'), - ketoPublicApiPath: configService.get('ORY_KETO_PUBLIC_URL'), - ketoAdminApiPath: configService.get('ORY_KETO_ADMIN_URL'), + basePath: configService.get('ORY_KETO_PUBLIC_URL'), + }), + }), + OryRelationshipsModule.forRootAsync({ + inject: [ConfigService], + useFactory: ( + configService: ConfigService, + ) => ({ + accessToken: configService.get('ORY_KETO_API_KEY'), + basePath: configService.get('ORY_KETO_ADMIN_URL'), }), }), ], @@ -139,7 +131,6 @@ const clientFactory = ( }, GlobalErrorFilter, OrdersService, - JwtStrategy, ], }) export class OrdersModule {} diff --git a/apps/orders/src/app/orders/orders.service.ts b/apps/orders/src/app/orders/orders.service.ts index da55262f..2dd03e71 100644 --- a/apps/orders/src/app/orders/orders.service.ts +++ b/apps/orders/src/app/orders/orders.service.ts @@ -1,3 +1,9 @@ +import { OryRelationshipsService } from '@getlarge/keto-client-wrapper'; +import { + createRelationQuery, + RelationTuple, + relationTupleBuilder, +} from '@getlarge/keto-relations-parser'; import { BadRequestException, Inject, @@ -8,7 +14,6 @@ import { import { ConfigService } from '@nestjs/config'; import { ClientProxy } from '@nestjs/microservices'; import { InjectModel } from '@nestjs/mongoose'; -import { OryPermissionsService } from '@ticketing/microservices/ory-client'; import { EventsMap, Patterns, @@ -16,7 +21,6 @@ import { } from '@ticketing/microservices/shared/events'; import { PermissionNamespaces } from '@ticketing/microservices/shared/models'; import { transactionManager } from '@ticketing/microservices/shared/mongo'; -import { RelationTuple } from '@ticketing/microservices/shared/relation-tuple-parser'; import { Resources } from '@ticketing/shared/constants'; import { Ticket, User } from '@ticketing/shared/models'; import { isEmpty } from 'lodash-es'; @@ -43,8 +47,8 @@ export class OrdersService { @InjectModel(TicketSchema.name) private ticketModel: Model, @Inject(ConfigService) private configService: ConfigService, - @Inject(OryPermissionsService) - private oryPermissionsService: OryPermissionsService, + @Inject(OryRelationshipsService) + private oryRelationshipsService: OryRelationshipsService, @Inject(TICKETS_CLIENT) private ticketsClient: ClientProxy, @Inject(EXPIRATION_CLIENT) private expirationClient: ClientProxy, @Inject(PAYMENTS_CLIENT) private paymentsClient: ClientProxy, @@ -72,14 +76,20 @@ export class OrdersService { private async createRelationShip( relationTuple: RelationTuple, ): Promise { - await this.oryPermissionsService.createRelation(relationTuple); + const createRelationshipBody = + createRelationQuery(relationTuple).unwrapOrThrow(); + await this.oryRelationshipsService.createRelationship({ + createRelationshipBody, + }); this.logger.debug(`Created relation ${relationTuple.toString()}`); } private async deleteRelationShip( relationTuple: RelationTuple, ): Promise { - await this.oryPermissionsService.deleteRelation(relationTuple); + const relationshipQuery = + createRelationQuery(relationTuple).unwrapOrThrow(); + await this.oryRelationshipsService.deleteRelationships(relationshipQuery); this.logger.debug(`Deleted relation ${relationTuple.toString()}`); } @@ -117,29 +127,19 @@ export class OrdersService { const order = res[0].toJSON(); this.logger.debug(`Created order ${order.id}`); // 5. Create a relation between the ticket and the order - const relationTupleWithTicket = new RelationTuple( - PermissionNamespaces[Resources.ORDERS], - order.id, - 'parents', - { - namespace: PermissionNamespaces[Resources.TICKETS], - object: ticket.id, - }, - ); + const relationTupleWithTicket = relationTupleBuilder() + .subject(PermissionNamespaces[Resources.TICKETS], ticket.id) + .isIn('parents') + .of(PermissionNamespaces[Resources.ORDERS], order.id); await this.createRelationShip(relationTupleWithTicket); this.logger.debug( `Created relation ${relationTupleWithTicket.toString()}`, ); // 6. Create a relation between the user and the order - const relationTupleWithUser = new RelationTuple( - PermissionNamespaces[Resources.ORDERS], - order.id, - 'owners', - { - namespace: PermissionNamespaces[Resources.USERS], - object: order.userId, - }, - ); + const relationTupleWithUser = relationTupleBuilder() + .subject(PermissionNamespaces[Resources.USERS], order.userId) + .isIn('owners') + .of(PermissionNamespaces[Resources.ORDERS], order.id); await this.createRelationShip(relationTupleWithUser); this.logger.debug(`Created relation ${relationTupleWithUser.toString()}`); // 7. Publish an event @@ -185,15 +185,10 @@ export class OrdersService { await order.save({ session }); const updatedOrder = order.toJSON(); - const relationTuple = new RelationTuple( - PermissionNamespaces[Resources.ORDERS], - order.id, - 'parents', - { - namespace: PermissionNamespaces[Resources.TICKETS], - object: order.ticket.id, - }, - ); + const relationTuple = relationTupleBuilder() + .subject(PermissionNamespaces[Resources.TICKETS], order.ticket.id) + .isIn('parents') + .of(PermissionNamespaces[Resources.ORDERS], order.id); await this.deleteRelationShip(relationTuple); await lastValueFrom( @@ -223,15 +218,10 @@ export class OrdersService { await order.save({ session }); const updatedOrder = order.toJSON(); - const relationTuple = new RelationTuple( - PermissionNamespaces[Resources.ORDERS], - updatedOrder.id, - 'parents', - { - namespace: PermissionNamespaces[Resources.TICKETS], - object: order.ticket.id, - }, - ); + const relationTuple = relationTupleBuilder() + .subject(PermissionNamespaces[Resources.TICKETS], order.ticket.id) + .isIn('parents') + .of(PermissionNamespaces[Resources.ORDERS], id); await this.deleteRelationShip(relationTuple); await lastValueFrom( diff --git a/apps/payments/src/app/payments/payments.controller.ts b/apps/payments/src/app/payments/payments.controller.ts index 1757ceb1..7ff264fa 100644 --- a/apps/payments/src/app/payments/payments.controller.ts +++ b/apps/payments/src/app/payments/payments.controller.ts @@ -1,3 +1,9 @@ +import { + OryAuthorizationGuard, + OryPermissionChecks, +} from '@getlarge/keto-client-wrapper'; +import { relationTupleToString } from '@getlarge/keto-relations-parser'; +import { OryAuthenticationGuard } from '@getlarge/kratos-client-wrapper'; import { Body, Controller, @@ -16,16 +22,8 @@ import { ApiTags, } from '@nestjs/swagger'; import { SecurityRequirements } from '@ticketing/microservices/shared/constants'; -import { - CurrentUser, - PermissionCheck, -} from '@ticketing/microservices/shared/decorators'; -import { - OryAuthenticationGuard, - OryPermissionGuard, -} from '@ticketing/microservices/shared/guards'; +import { CurrentUser } from '@ticketing/microservices/shared/decorators'; import { PermissionNamespaces } from '@ticketing/microservices/shared/models'; -import { relationTupleToString } from '@ticketing/microservices/shared/relation-tuple-parser'; import { Actions, CURRENT_USER_KEY, @@ -44,7 +42,7 @@ import { PaymentsService } from './payments.service'; export class PaymentsController { constructor(private readonly paymentsService: PaymentsService) {} - @PermissionCheck((ctx) => { + @OryPermissionChecks((ctx) => { const req = ctx.switchToHttp().getRequest(); const currentUserId = get(req, `${CURRENT_USER_KEY}.id`); const resourceId = get(req.body as CreatePayment, 'orderId'); @@ -58,7 +56,38 @@ export class PaymentsController { }, }); }) - @UseGuards(OryAuthenticationGuard, OryPermissionGuard) + @UseGuards( + OryAuthenticationGuard({ + cookieResolver: (ctx) => + ctx.switchToHttp().getRequest().headers.cookie, + isValidSession: (x) => { + return ( + !!x?.identity && + typeof x.identity.traits === 'object' && + !!x.identity.traits && + 'email' in x.identity.traits && + typeof x.identity.metadata_public === 'object' && + !!x.identity.metadata_public && + 'id' in x.identity.metadata_public && + typeof x.identity.metadata_public.id === 'string' + ); + }, + sessionTokenResolver: (ctx) => + ctx + .switchToHttp() + .getRequest() + .headers?.authorization?.replace('Bearer ', ''), + postValidationHook: (ctx, session) => { + ctx.switchToHttp().getRequest().session = session; + ctx.switchToHttp().getRequest()[CURRENT_USER_KEY] = { + id: session.identity.metadata_public['id'], + email: session.identity.traits.email, + identityId: session.identity.id, + }; + }, + }), + OryAuthorizationGuard({}), + ) @UsePipes( new ValidationPipe({ transform: true, diff --git a/apps/payments/src/app/payments/payments.module.ts b/apps/payments/src/app/payments/payments.module.ts index 263bb5af..002f2911 100644 --- a/apps/payments/src/app/payments/payments.module.ts +++ b/apps/payments/src/app/payments/payments.module.ts @@ -1,3 +1,8 @@ +import { + OryPermissionsModule, + OryRelationshipsModule, +} from '@getlarge/keto-client-wrapper'; +import { OryFrontendModule } from '@getlarge/kratos-client-wrapper'; import { Module } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; import { APP_FILTER } from '@nestjs/core'; @@ -8,15 +13,9 @@ import { } from '@nestjs/microservices'; import { MongooseModule } from '@nestjs/mongoose'; import { AmqpClient, AmqpOptions } from '@s1seven/nestjs-tools-amqp-transport'; -import { - OryAuthenticationModule, - OryPermissionsModule, -} from '@ticketing/microservices/ory-client'; -import { PassportModule } from '@ticketing/microservices/shared/fastify-passport'; import { GlobalErrorFilter } from '@ticketing/microservices/shared/filters'; -import { JwtStrategy } from '@ticketing/microservices/shared/guards'; import { getReplyQueueName } from '@ticketing/microservices/shared/rmq'; -import { CURRENT_USER_KEY, Services } from '@ticketing/shared/constants'; +import { Services } from '@ticketing/shared/constants'; import { updateIfCurrentPlugin } from 'mongoose-update-if-current'; import { AppConfigService, EnvironmentVariables } from '../env'; @@ -49,10 +48,6 @@ const MongooseFeatures = MongooseModule.forFeatureAsync([ @Module({ imports: [ MongooseFeatures, - PassportModule.register({ - assignProperty: CURRENT_USER_KEY, - session: true, - }), ClientsModule.registerAsync([ { name: ORDERS_CLIENT, @@ -84,22 +79,16 @@ const MongooseFeatures = MongooseModule.forFeatureAsync([ customClass: AmqpClient, options, }; - return { ...clientOptions, transport: Transport.RMQ }; }, }, ]), - OryAuthenticationModule.forRootAsync({ + OryFrontendModule.forRootAsync({ inject: [ConfigService], useFactory: ( configService: ConfigService, ) => ({ - kratosAccessToken: configService.get('ORY_KRATOS_API_KEY'), - kratosPublicApiPath: configService.get('ORY_KRATOS_PUBLIC_URL'), - kratosAdminApiPath: configService.get('ORY_KRATOS_ADMIN_URL'), - hydraAccessToken: configService.get('ORY_HYDRA_API_KEY'), - hydraPublicApiPath: configService.get('ORY_HYDRA_PUBLIC_URL'), - hydraAdminApiPath: configService.get('ORY_HYDRA_ADMIN_URL'), + basePath: configService.get('ORY_KRATOS_PUBLIC_URL'), }), }), OryPermissionsModule.forRootAsync({ @@ -107,9 +96,16 @@ const MongooseFeatures = MongooseModule.forFeatureAsync([ useFactory: ( configService: ConfigService, ) => ({ - ketoAccessToken: configService.get('ORY_KETO_API_KEY'), - ketoPublicApiPath: configService.get('ORY_KETO_PUBLIC_URL'), - ketoAdminApiPath: configService.get('ORY_KETO_ADMIN_URL'), + basePath: configService.get('ORY_KETO_PUBLIC_URL'), + }), + }), + OryRelationshipsModule.forRootAsync({ + inject: [ConfigService], + useFactory: ( + configService: ConfigService, + ) => ({ + accessToken: configService.get('ORY_KETO_API_KEY'), + basePath: configService.get('ORY_KETO_ADMIN_URL'), }), }), ], @@ -120,7 +116,6 @@ const MongooseFeatures = MongooseModule.forFeatureAsync([ useExisting: GlobalErrorFilter, }, GlobalErrorFilter, - JwtStrategy, StripeService, PaymentsService, ], diff --git a/apps/payments/src/app/payments/payments.service.ts b/apps/payments/src/app/payments/payments.service.ts index b7f60e4c..559ed02c 100644 --- a/apps/payments/src/app/payments/payments.service.ts +++ b/apps/payments/src/app/payments/payments.service.ts @@ -1,3 +1,9 @@ +import { OryRelationshipsService } from '@getlarge/keto-client-wrapper'; +import { + createRelationQuery, + RelationTuple, + relationTupleBuilder, +} from '@getlarge/keto-relations-parser'; import { BadRequestException, Inject, @@ -7,14 +13,12 @@ import { } from '@nestjs/common'; import { ClientProxy } from '@nestjs/microservices'; import { InjectModel } from '@nestjs/mongoose'; -import { OryPermissionsService } from '@ticketing/microservices/ory-client'; import { Patterns, PaymentCreatedEvent, } from '@ticketing/microservices/shared/events'; import { PermissionNamespaces } from '@ticketing/microservices/shared/models'; import { transactionManager } from '@ticketing/microservices/shared/mongo'; -import { RelationTuple } from '@ticketing/microservices/shared/relation-tuple-parser'; import { Resources } from '@ticketing/shared/constants'; import { OrderStatus, User } from '@ticketing/shared/models'; import { Model } from 'mongoose'; @@ -34,8 +38,8 @@ export class PaymentsService { @InjectModel(OrderSchema.name) private orderModel: Model, @InjectModel(PaymentSchema.name) private paymentModel: Model, - @Inject(OryPermissionsService) - private readonly oryPermissionsService: OryPermissionsService, + @Inject(OryRelationshipsService) + private readonly oryRelationshipsService: OryRelationshipsService, @Inject(StripeService) private readonly stripeService: StripeService, @Inject(ORDERS_CLIENT) private client: ClientProxy, ) {} @@ -43,7 +47,11 @@ export class PaymentsService { private async createRelationShip( relationTuple: RelationTuple, ): Promise { - await this.oryPermissionsService.createRelation(relationTuple); + const createRelationshipBody = + createRelationQuery(relationTuple).unwrapOrThrow(); + await this.oryRelationshipsService.createRelationship({ + createRelationshipBody, + }); this.logger.debug(`Created relation ${relationTuple.toString()}`); } @@ -91,27 +99,17 @@ export class PaymentsService { ); const payment = res[0].toJSON(); // 5. create a relation between the order and the payment - const relationTupleWithOrder = new RelationTuple( - PermissionNamespaces[Resources.PAYMENTS], - payment.id, - 'parents', - { - namespace: PermissionNamespaces[Resources.ORDERS], - object: orderId, - }, - ); + const relationTupleWithOrder = relationTupleBuilder() + .subject(PermissionNamespaces[Resources.ORDERS], orderId) + .isIn('parents') + .of(PermissionNamespaces[Resources.PAYMENTS], payment.id); await this.createRelationShip(relationTupleWithOrder); // 6. create a relation between the user and the payment - const relationTupleWithUser = new RelationTuple( - PermissionNamespaces[Resources.PAYMENTS], - payment.id, - 'owners', - { - namespace: PermissionNamespaces[Resources.USERS], - object: currentUser.id, - }, - ); + const relationTupleWithUser = relationTupleBuilder() + .subject(PermissionNamespaces[Resources.USERS], currentUser.id) + .isIn('owners') + .of(PermissionNamespaces[Resources.PAYMENTS], payment.id); await this.createRelationShip(relationTupleWithUser); // 7. send payment:create event diff --git a/apps/permissions-manager/src/app/app.module.ts b/apps/permissions-manager/src/app/app.module.ts index ea94182c..ecd5a28e 100644 --- a/apps/permissions-manager/src/app/app.module.ts +++ b/apps/permissions-manager/src/app/app.module.ts @@ -1,6 +1,9 @@ +import { + OryPermissionsModule, + OryRelationshipsModule, +} from '@getlarge/keto-client-wrapper'; import { Module } from '@nestjs/common'; import { ConfigModule, ConfigService } from '@nestjs/config'; -import { OryPermissionsModule } from '@ticketing/microservices/ory-client'; import { validate } from '@ticketing/microservices/shared/env'; import { CheckPermissionCommand } from './check-permission.command'; @@ -22,9 +25,21 @@ import { GetRelationsCommand } from './get-relations.command'; useFactory: ( configService: ConfigService, ) => ({ - ketoAccessToken: configService.get('ORY_KETO_API_KEY'), - ketoPublicApiPath: configService.get('ORY_KETO_PUBLIC_URL'), - ketoAdminApiPath: configService.get('ORY_KETO_ADMIN_URL'), + basePath: configService.get('ORY_KETO_PUBLIC_URL'), + }), + }), + OryRelationshipsModule.forRootAsync({ + imports: [ + ConfigModule.forRoot({ + validate: validate(EnvironmentVariables), + }), + ], + inject: [ConfigService], + useFactory: ( + configService: ConfigService, + ) => ({ + accessToken: configService.get('ORY_KETO_API_KEY'), + basePath: configService.get('ORY_KETO_ADMIN_URL'), }), }), ], diff --git a/apps/permissions-manager/src/app/check-permission.command.ts b/apps/permissions-manager/src/app/check-permission.command.ts index 750dd2fc..3aa94a85 100644 --- a/apps/permissions-manager/src/app/check-permission.command.ts +++ b/apps/permissions-manager/src/app/check-permission.command.ts @@ -1,13 +1,14 @@ -import { Logger } from '@nestjs/common'; -import { OryPermissionsService } from '@ticketing/microservices/ory-client'; +import { OryPermissionsService } from '@getlarge/keto-client-wrapper'; import { - type RelationTuple, + createPermissionCheckQuery, parseRelationTuple, -} from '@ticketing/microservices/shared/relation-tuple-parser'; +} from '@getlarge/keto-relations-parser'; +import { Logger } from '@nestjs/common'; +import { PermissionApiCheckPermissionRequest } from '@ory/client'; import { Command, CommandRunner, Option } from 'nest-commander'; interface CommandOptions { - tuple: RelationTuple; + tuple: PermissionApiCheckPermissionRequest; } @Command({ name: 'check', description: 'Check permission on Ory Keto' }) @@ -30,11 +31,11 @@ export class CheckPermissionCommand extends CommandRunner { 'Relationship tuple to check permission from, using Zanzibar notation', required: true, }) - parseRelationTuple(val: string): RelationTuple { + parseRelationTuple(val: string): PermissionApiCheckPermissionRequest { const res = parseRelationTuple(val); if (res.hasError()) { throw res.error; } - return res.unwrapOrThrow(); + return createPermissionCheckQuery(res.value).unwrapOrThrow(); } } diff --git a/apps/permissions-manager/src/app/create-relation.command.spec.ts b/apps/permissions-manager/src/app/create-relation.command.spec.ts index 4ca75bf5..c6ddddbb 100644 --- a/apps/permissions-manager/src/app/create-relation.command.spec.ts +++ b/apps/permissions-manager/src/app/create-relation.command.spec.ts @@ -1,9 +1,9 @@ -import { jest } from '@jest/globals'; import { - OryPermissionsModule, - OryPermissionsService, -} from '@ticketing/microservices/ory-client'; -import { RelationTuple } from '@ticketing/microservices/shared/relation-tuple-parser'; + OryRelationshipsModule, + OryRelationshipsService, +} from '@getlarge/keto-client-wrapper'; +import { RelationTuple } from '@getlarge/keto-relations-parser'; +import { jest } from '@jest/globals'; import { MockOryPermissionService } from '@ticketing/microservices/shared/testing'; import { CommandTestFactory } from 'nest-commander-testing'; @@ -15,17 +15,16 @@ describe('CreateRelationCommand', () => { beforeAll(async () => { const app = await CommandTestFactory.createTestingCommand({ imports: [ - OryPermissionsModule.forRootAsync({ + OryRelationshipsModule.forRootAsync({ useFactory: () => ({ - ketoPublicApiPath: 'http://localhost:4466', - ketoAdminApiPath: 'http://localhost:4467', - ketoAccessToken: '', + basePath: 'http://localhost:4467', + accessToken: '', }), }), ], providers: [CreateRelationCommand], }) - .overrideProvider(OryPermissionsService) + .overrideProvider(OryRelationshipsService) .useClass(MockOryPermissionService) .compile(); diff --git a/apps/permissions-manager/src/app/create-relation.command.ts b/apps/permissions-manager/src/app/create-relation.command.ts index a66492f7..abc80646 100644 --- a/apps/permissions-manager/src/app/create-relation.command.ts +++ b/apps/permissions-manager/src/app/create-relation.command.ts @@ -1,26 +1,31 @@ -import { Logger } from '@nestjs/common'; -import { OryPermissionsService } from '@ticketing/microservices/ory-client'; +import { OryRelationshipsService } from '@getlarge/keto-client-wrapper'; import { - type RelationTuple, + createRelationQuery, parseRelationTuple, -} from '@ticketing/microservices/shared/relation-tuple-parser'; +} from '@getlarge/keto-relations-parser'; +import { Logger } from '@nestjs/common'; +import { RelationQuery } from '@ory/client'; import { Command, CommandRunner, Option } from 'nest-commander'; interface CommandOptions { - tuple: RelationTuple; + tuple: RelationQuery; } @Command({ name: 'create', description: 'Create relationship on Ory Keto' }) export class CreateRelationCommand extends CommandRunner { readonly logger = new Logger(CreateRelationCommand.name); - constructor(private readonly oryPermissionsService: OryPermissionsService) { + constructor( + private readonly oryRelationshipsService: OryRelationshipsService, + ) { super(); } async run(passedParams: string[], options: CommandOptions): Promise { const { tuple } = options; - await this.oryPermissionsService.createRelation(tuple); + await this.oryRelationshipsService.createRelationship({ + createRelationshipBody: tuple, + }); this.logger.debug('Created relation'); this.logger.log(tuple); } @@ -30,11 +35,11 @@ export class CreateRelationCommand extends CommandRunner { description: 'Relationship tuple to create, using Zanzibar notation', required: true, }) - parseRelationTuple(val: string): RelationTuple { + parseRelationTuple(val: string): RelationQuery { const res = parseRelationTuple(val); if (res.hasError()) { throw res.error; } - return res.unwrapOrThrow(); + return createRelationQuery(res.value).unwrapOrThrow(); } } diff --git a/apps/permissions-manager/src/app/delete-relation.command.ts b/apps/permissions-manager/src/app/delete-relation.command.ts index 1253feb5..13331cba 100644 --- a/apps/permissions-manager/src/app/delete-relation.command.ts +++ b/apps/permissions-manager/src/app/delete-relation.command.ts @@ -1,26 +1,29 @@ -import { Logger } from '@nestjs/common'; -import { OryPermissionsService } from '@ticketing/microservices/ory-client'; +import { OryRelationshipsService } from '@getlarge/keto-client-wrapper'; import { - type RelationTuple, + createRelationQuery, parseRelationTuple, -} from '@ticketing/microservices/shared/relation-tuple-parser'; +} from '@getlarge/keto-relations-parser'; +import { Logger } from '@nestjs/common'; +import { RelationQuery } from '@ory/client'; import { Command, CommandRunner, Option } from 'nest-commander'; interface CommandOptions { - tuple: RelationTuple; + tuple: RelationQuery; } @Command({ name: 'delete', description: 'Delete relationship on Ory Keto' }) export class DeleteRelationCommand extends CommandRunner { readonly logger = new Logger(DeleteRelationCommand.name); - constructor(private readonly oryPermissionsService: OryPermissionsService) { + constructor( + private readonly oryRelationshipsService: OryRelationshipsService, + ) { super(); } async run(passedParams: string[], options: CommandOptions): Promise { const { tuple } = options; - await this.oryPermissionsService.deleteRelation(tuple); + await this.oryRelationshipsService.deleteRelationships(tuple); this.logger.debug('Deleted relation'); this.logger.log(tuple); } @@ -30,11 +33,12 @@ export class DeleteRelationCommand extends CommandRunner { description: 'Relationship tuple to delete, using Zanzibar notation', required: true, }) - parseRelationTuple(val: string): RelationTuple { + parseRelationTuple(val: string): RelationQuery { const res = parseRelationTuple(val); if (res.hasError()) { throw res.error; } - return res.unwrapOrThrow(); + const relationQuery = createRelationQuery(res.value); + return relationQuery.unwrapOrThrow(); } } diff --git a/apps/permissions-manager/src/app/expand-permissions.command.ts b/apps/permissions-manager/src/app/expand-permissions.command.ts index 58b9c014..93464d0a 100644 --- a/apps/permissions-manager/src/app/expand-permissions.command.ts +++ b/apps/permissions-manager/src/app/expand-permissions.command.ts @@ -1,13 +1,14 @@ -import { Logger } from '@nestjs/common'; -import { OryPermissionsService } from '@ticketing/microservices/ory-client'; +import { OryPermissionsService } from '@getlarge/keto-client-wrapper'; import { - type RelationTuple, - parseRelationTupleString, -} from '@ticketing/microservices/shared/relation-tuple-parser'; + createExpandPermissionQuery, + parseRelationTuple, +} from '@getlarge/keto-relations-parser'; +import { Logger } from '@nestjs/common'; +import { PermissionApiExpandPermissionsRequest } from '@ory/client'; import { Command, CommandRunner, Option } from 'nest-commander'; interface CommandOptions { - tuple: Pick; + tuple: PermissionApiExpandPermissionsRequest; depth: number; } @@ -21,10 +22,10 @@ export class ExpandPermissionsCommand extends CommandRunner { async run(passedParams: string[], options: CommandOptions): Promise { const { depth, tuple } = options; - const tree = await this.oryPermissionsService.expandPermissions( - tuple, - depth, - ); + const tree = await this.oryPermissionsService.expandPermissions({ + ...tuple, + maxDepth: depth, + }); this.logger.log(tree); } @@ -34,16 +35,14 @@ export class ExpandPermissionsCommand extends CommandRunner { 'Relationship tuple to expand from, using Zanzibar notation (without subject)', required: true, }) - parseRelationTuple( - val: string, - ): Pick { - const res = parseRelationTupleString(val); + parseRelationTuple(val: string): PermissionApiExpandPermissionsRequest { + const res = parseRelationTuple(val); if (res.hasError()) { throw res.error; } const tuple = res.unwrapOrThrow(); delete tuple.subjectIdOrSet; - return tuple; + return createExpandPermissionQuery(tuple).unwrapOrThrow(); } @Option({ diff --git a/apps/permissions-manager/src/app/get-relations.command.ts b/apps/permissions-manager/src/app/get-relations.command.ts index 0031054f..4d9b0661 100644 --- a/apps/permissions-manager/src/app/get-relations.command.ts +++ b/apps/permissions-manager/src/app/get-relations.command.ts @@ -1,7 +1,10 @@ +import { OryRelationshipsService } from '@getlarge/keto-client-wrapper'; +import { + createFlattenRelationQuery, + RelationTuple, +} from '@getlarge/keto-relations-parser'; import { Logger } from '@nestjs/common'; -import { Relationship } from '@ory/client'; -import { OryPermissionsService } from '@ticketing/microservices/ory-client'; -import { type RelationTuple } from '@ticketing/microservices/shared/relation-tuple-parser'; +import type { Relationship } from '@ory/client'; import { Command, CommandRunner, Option } from 'nest-commander'; interface CommandOptions { @@ -17,7 +20,9 @@ interface CommandOptions { export class GetRelationsCommand extends CommandRunner { readonly logger = new Logger(GetRelationsCommand.name); - constructor(private readonly oryPermissionsService: OryPermissionsService) { + constructor( + private readonly oryRelationshipsService: OryRelationshipsService, + ) { super(); } @@ -58,8 +63,13 @@ export class GetRelationsCommand extends CommandRunner { tuple: Partial, options: { pageToken?: string; pageSize?: number } = { pageSize: 50 }, ): AsyncIterable<{ relationships: Relationship[]; pageToken: string }> { - const { relation_tuples, next_page_token } = - await this.oryPermissionsService.getRelations(tuple); + const relationQuery = createFlattenRelationQuery(tuple).unwrapOrThrow(); + const { data } = await this.oryRelationshipsService.getRelationships({ + ...relationQuery, + ...options, + }); + const { relation_tuples, next_page_token } = data; + yield { relationships: relation_tuples, pageToken: next_page_token }; if (next_page_token) { diff --git a/apps/tickets/src/app/tickets/tickets.controller.ts b/apps/tickets/src/app/tickets/tickets.controller.ts index 78ce849c..d7647048 100644 --- a/apps/tickets/src/app/tickets/tickets.controller.ts +++ b/apps/tickets/src/app/tickets/tickets.controller.ts @@ -1,3 +1,9 @@ +import { + OryAuthorizationGuard, + OryPermissionChecks, +} from '@getlarge/keto-client-wrapper'; +import { relationTupleBuilder } from '@getlarge/keto-relations-parser'; +import { OryAuthenticationGuard } from '@getlarge/kratos-client-wrapper'; import { Body, Controller, @@ -10,6 +16,7 @@ import { UseGuards, UsePipes, ValidationPipe, + ValidationPipeOptions, } from '@nestjs/common'; import { ApiBearerAuth, @@ -25,12 +32,7 @@ import { ApiNestedQuery, ApiPaginatedDto, CurrentUser, - PermissionChecks, } from '@ticketing/microservices/shared/decorators'; -import { - OryAuthenticationGuard, - OryPermissionGuard, -} from '@ticketing/microservices/shared/guards'; import { PaginatedDto, PaginateDto, @@ -41,7 +43,6 @@ import { ParseObjectId, ParseQuery, } from '@ticketing/microservices/shared/pipes'; -import { relationTupleToString } from '@ticketing/microservices/shared/relation-tuple-parser'; import { Actions, CURRENT_USER_KEY, @@ -49,7 +50,7 @@ import { } from '@ticketing/shared/constants'; import { requestValidationErrorFactory } from '@ticketing/shared/errors'; import { User } from '@ticketing/shared/models'; -import { FastifyRequest } from 'fastify/types/request'; +import type { FastifyRequest } from 'fastify/types/request'; import { get } from 'lodash-es'; import { @@ -62,21 +63,54 @@ import { } from './models'; import { TicketsService } from './tickets.service'; +const AuthenticationGuard = OryAuthenticationGuard({ + cookieResolver: (ctx) => + ctx.switchToHttp().getRequest().headers.cookie, + isValidSession: (x) => { + return ( + !!x?.identity && + typeof x.identity.traits === 'object' && + !!x.identity.traits && + 'email' in x.identity.traits && + typeof x.identity.metadata_public === 'object' && + !!x.identity.metadata_public && + 'id' in x.identity.metadata_public && + typeof x.identity.metadata_public.id === 'string' + ); + }, + sessionTokenResolver: (ctx) => + ctx + .switchToHttp() + .getRequest() + .headers?.authorization?.replace('Bearer ', ''), + postValidationHook: (ctx, session) => { + ctx.switchToHttp().getRequest().session = session; + // eslint-disable-next-line security/detect-object-injection + ctx.switchToHttp().getRequest()[CURRENT_USER_KEY] = { + id: session.identity.metadata_public['id'], + email: session.identity.traits.email, + identityId: session.identity.id, + }; + }, +}); + +const AuthorizationGuard = OryAuthorizationGuard({}); + +const validationPipeOptions: ValidationPipeOptions = { + transform: true, + exceptionFactory: requestValidationErrorFactory, + transformOptions: { enableImplicitConversion: true }, + forbidUnknownValues: true, +}; + @Controller(Resources.TICKETS) @ApiTags(Resources.TICKETS) @ApiExtraModels(PaginatedDto) export class TicketsController { - constructor(private readonly ticketsService: TicketsService) { } + constructor(private readonly ticketsService: TicketsService) {} - @UseGuards(OryAuthenticationGuard) - @UsePipes( - new ValidationPipe({ - transform: true, - exceptionFactory: requestValidationErrorFactory, - transformOptions: { enableImplicitConversion: true }, - forbidUnknownValues: true, - }), - ) + @UseGuards(AuthenticationGuard) + @UsePipes(new ValidationPipe(validationPipeOptions)) @ApiBearerAuth(SecurityRequirements.Bearer) @ApiCookieAuth(SecurityRequirements.Session) @ApiOperation({ @@ -133,31 +167,18 @@ export class TicketsController { } // TODO: check permission for ticket orderId if present - @PermissionChecks( - (ctx) => { - const req = ctx.switchToHttp().getRequest(); - const currentUserId = get(req, `${CURRENT_USER_KEY}.id`); - const resourceId = get(req, 'params.id'); - return relationTupleToString({ - namespace: PermissionNamespaces[Resources.TICKETS], - object: resourceId, - relation: 'owners', - subjectIdOrSet: { - namespace: PermissionNamespaces[Resources.USERS], - object: currentUserId, - }, - }); - } - ) - @UseGuards(OryAuthenticationGuard, OryPermissionGuard) - @UsePipes( - new ValidationPipe({ - transform: true, - exceptionFactory: requestValidationErrorFactory, - transformOptions: { enableImplicitConversion: true }, - forbidUnknownValues: true, - }), - ) + @OryPermissionChecks((ctx) => { + const req = ctx.switchToHttp().getRequest(); + const currentUserId = get(req, `${CURRENT_USER_KEY}.id`); + const resourceId = get(req, 'params.id'); + return relationTupleBuilder() + .subject(PermissionNamespaces[Resources.USERS], currentUserId) + .isIn('owners') + .of(PermissionNamespaces[Resources.TICKETS], resourceId) + .toString(); + }) + @UseGuards(AuthenticationGuard, AuthorizationGuard) + @UsePipes(new ValidationPipe(validationPipeOptions)) @ApiBearerAuth(SecurityRequirements.Bearer) @ApiCookieAuth(SecurityRequirements.Session) @ApiOperation({ diff --git a/apps/tickets/src/app/tickets/tickets.module.ts b/apps/tickets/src/app/tickets/tickets.module.ts index 62cbf718..e2891b88 100644 --- a/apps/tickets/src/app/tickets/tickets.module.ts +++ b/apps/tickets/src/app/tickets/tickets.module.ts @@ -1,3 +1,8 @@ +import { + OryPermissionsModule, + OryRelationshipsModule, +} from '@getlarge/keto-client-wrapper'; +import { OryFrontendModule } from '@getlarge/kratos-client-wrapper'; import { Module } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; import { APP_FILTER } from '@nestjs/core'; @@ -8,15 +13,9 @@ import { } from '@nestjs/microservices'; import { MongooseModule } from '@nestjs/mongoose'; import { AmqpClient, AmqpOptions } from '@s1seven/nestjs-tools-amqp-transport'; -import { - OryAuthenticationModule, - OryPermissionsModule, -} from '@ticketing/microservices/ory-client'; -import { PassportModule } from '@ticketing/microservices/shared/fastify-passport'; import { GlobalErrorFilter } from '@ticketing/microservices/shared/filters'; -import { JwtStrategy } from '@ticketing/microservices/shared/guards'; import { getReplyQueueName } from '@ticketing/microservices/shared/rmq'; -import { CURRENT_USER_KEY, Services } from '@ticketing/shared/constants'; +import { Services } from '@ticketing/shared/constants'; import { updateIfCurrentPlugin } from 'mongoose-update-if-current'; import { AppConfigService, EnvironmentVariables } from '../env'; @@ -76,22 +75,13 @@ const OrdersClient = ClientsModule.registerAsync([ @Module({ imports: [ MongooseFeatures, - PassportModule.register({ - assignProperty: CURRENT_USER_KEY, - session: true, - }), OrdersClient, - OryAuthenticationModule.forRootAsync({ + OryFrontendModule.forRootAsync({ inject: [ConfigService], useFactory: ( configService: ConfigService, ) => ({ - kratosAccessToken: configService.get('ORY_KRATOS_API_KEY'), - kratosPublicApiPath: configService.get('ORY_KRATOS_PUBLIC_URL'), - kratosAdminApiPath: configService.get('ORY_KRATOS_ADMIN_URL'), - hydraAccessToken: configService.get('ORY_HYDRA_API_KEY'), - hydraPublicApiPath: configService.get('ORY_HYDRA_PUBLIC_URL'), - hydraAdminApiPath: configService.get('ORY_HYDRA_ADMIN_URL'), + basePath: configService.get('ORY_KRATOS_PUBLIC_URL'), }), }), OryPermissionsModule.forRootAsync({ @@ -99,9 +89,16 @@ const OrdersClient = ClientsModule.registerAsync([ useFactory: ( configService: ConfigService, ) => ({ - ketoAccessToken: configService.get('ORY_KETO_API_KEY'), - ketoPublicApiPath: configService.get('ORY_KETO_PUBLIC_URL'), - ketoAdminApiPath: configService.get('ORY_KETO_ADMIN_URL'), + basePath: configService.get('ORY_KETO_PUBLIC_URL'), + }), + }), + OryRelationshipsModule.forRootAsync({ + inject: [ConfigService], + useFactory: ( + configService: ConfigService, + ) => ({ + accessToken: configService.get('ORY_KETO_API_KEY'), + basePath: configService.get('ORY_KETO_ADMIN_URL'), }), }), ], @@ -113,7 +110,6 @@ const OrdersClient = ClientsModule.registerAsync([ }, GlobalErrorFilter, TicketsService, - JwtStrategy, ], exports: [MongooseFeatures, OrdersClient, TicketsService], }) diff --git a/apps/tickets/src/app/tickets/tickets.service.ts b/apps/tickets/src/app/tickets/tickets.service.ts index d0f32c0c..118e8541 100644 --- a/apps/tickets/src/app/tickets/tickets.service.ts +++ b/apps/tickets/src/app/tickets/tickets.service.ts @@ -1,3 +1,8 @@ +import { OryRelationshipsService } from '@getlarge/keto-client-wrapper'; +import { + createRelationQuery, + relationTupleBuilder, +} from '@getlarge/keto-relations-parser'; import { BadRequestException, Inject, @@ -7,7 +12,6 @@ import { } from '@nestjs/common'; import { ClientProxy } from '@nestjs/microservices'; import { InjectModel } from '@nestjs/mongoose'; -import { OryPermissionsService } from '@ticketing/microservices/ory-client'; import { EventsMap, OrderCancelledEvent, @@ -20,7 +24,6 @@ import { PermissionNamespaces, } from '@ticketing/microservices/shared/models'; import { transactionManager } from '@ticketing/microservices/shared/mongo'; -import { RelationTuple } from '@ticketing/microservices/shared/relation-tuple-parser'; import { Resources } from '@ticketing/shared/constants'; import { User } from '@ticketing/shared/models'; import { isEmpty } from 'lodash-es'; @@ -39,8 +42,8 @@ export class TicketsService { constructor( @InjectModel(TicketSchema.name) private readonly ticketModel: Model, - @Inject(OryPermissionsService) - private readonly oryPermissionService: OryPermissionsService, + @Inject(OryRelationshipsService) + private readonly oryRelationshipsService: OryRelationshipsService, @Inject(ORDERS_CLIENT) private readonly client: ClientProxy, ) {} @@ -64,17 +67,17 @@ export class TicketsService { const newTicket = docs[0].toJSON(); this.logger.debug(`Created ticket ${newTicket.id}`); - const relationTuple = new RelationTuple( - PermissionNamespaces[Resources.TICKETS], - newTicket.id, - 'owners', - { - namespace: PermissionNamespaces[Resources.USERS], - object: currentUser.id, - }, - ); - await this.oryPermissionService.createRelation(relationTuple); - this.logger.debug(`Created relation ${relationTuple}`); + const relationTuple = relationTupleBuilder() + .subject(PermissionNamespaces[Resources.USERS], currentUser.id) + .isIn('owners') + .of(PermissionNamespaces[Resources.TICKETS], newTicket.id) + .toJSON(); + const createRelationshipBody = + createRelationQuery(relationTuple).unwrapOrThrow(); + await this.oryRelationshipsService.createRelationship({ + createRelationshipBody, + }); + this.logger.debug(`Created relation ${relationTuple.toString()}`); await lastValueFrom(this.sendEvent(Patterns.TicketCreated, newTicket)); this.logger.debug(`Sent event ${Patterns.TicketCreated}`); From 7a506fef097b0f06ec0965d7e9ffc5c8d8625f34 Mon Sep 17 00:00:00 2001 From: getlarge Date: Sun, 14 Jan 2024 13:42:14 +0100 Subject: [PATCH 03/14] refactor: remove internal Ory libs --- libs/microservices/ory-client/.eslintrc.json | 18 - libs/microservices/ory-client/README.md | 7 - libs/microservices/ory-client/jest.config.ts | 11 - libs/microservices/ory-client/project.json | 24 - libs/microservices/ory-client/src/index.ts | 6 - .../ory-client/src/lib/helpers.ts | 277 ----------- .../src/lib/ory-authentication.module.ts | 85 ---- .../src/lib/ory-authentication.service.ts | 188 ------- .../src/lib/ory-permissions.module.ts | 83 ---- .../src/lib/ory-permissions.service.ts | 129 ----- .../ory-client/src/lib/ory.error.ts | 93 ---- .../ory-client/src/lib/ory.interfaces.ts | 74 --- libs/microservices/ory-client/tsconfig.json | 22 - .../ory-client/tsconfig.lib.json | 16 - .../ory-client/tsconfig.spec.json | 14 - .../shared/decorators/src/index.ts | 1 - .../src/permission-check.decorator.ts | 82 --- libs/microservices/shared/guards/src/index.ts | 2 - .../guards/src/ory-authentication.guard.ts | 33 -- .../shared/guards/src/ory-permission.guard.ts | 42 -- .../relation-tuple-parser/.eslintrc.json | 25 - .../shared/relation-tuple-parser/README.md | 11 - .../relation-tuple-parser/jest.config.ts | 16 - .../shared/relation-tuple-parser/package.json | 15 - .../shared/relation-tuple-parser/project.json | 49 -- .../shared/relation-tuple-parser/src/index.ts | 20 - .../lib/errors/relation-tuple-syntax.error.ts | 15 - .../src/lib/errors/unknown.error.ts | 5 - .../lib/generated/antlr/RelationTuple.interp | 30 -- .../lib/generated/antlr/RelationTuple.tokens | 12 - .../generated/antlr/RelationTupleLexer.interp | 38 -- .../generated/antlr/RelationTupleLexer.tokens | 12 - .../lib/generated/antlr/RelationTupleLexer.ts | 125 ----- .../generated/antlr/RelationTupleParser.ts | 465 ------------------ .../generated/antlr/RelationTupleVisitor.ts | 51 -- .../src/lib/is-relation-tuple.ts | 33 -- .../src/lib/relation-tuple-antlr.ts | 129 ----- .../src/lib/relation-tuple-parser.spec.ts | 336 ------------- .../src/lib/relation-tuple-parser.ts | 164 ------ .../src/lib/relation-tuple.ts | 34 -- .../src/lib/util/access-to-path-proxy.spec.ts | 143 ------ .../src/lib/util/access-to-path-proxy.ts | 48 -- .../src/lib/util/two-way-map.ts | 21 - .../generate-replacer-function.ts | 89 ---- ...ion-tuple-with-replacements-parser.spec.ts | 205 -------- ...relation-tuple-with-replacements-parser.ts | 80 --- .../relation-tuple-with-replacements.ts | 65 --- .../with-replacements/replacement-values.ts | 3 - .../relation-tuple-parser/tsconfig.json | 23 - .../relation-tuple-parser/tsconfig.lib.json | 22 - .../relation-tuple-parser/tsconfig.spec.json | 20 - 51 files changed, 3511 deletions(-) delete mode 100644 libs/microservices/ory-client/.eslintrc.json delete mode 100644 libs/microservices/ory-client/README.md delete mode 100644 libs/microservices/ory-client/jest.config.ts delete mode 100644 libs/microservices/ory-client/project.json delete mode 100644 libs/microservices/ory-client/src/index.ts delete mode 100644 libs/microservices/ory-client/src/lib/helpers.ts delete mode 100644 libs/microservices/ory-client/src/lib/ory-authentication.module.ts delete mode 100644 libs/microservices/ory-client/src/lib/ory-authentication.service.ts delete mode 100644 libs/microservices/ory-client/src/lib/ory-permissions.module.ts delete mode 100644 libs/microservices/ory-client/src/lib/ory-permissions.service.ts delete mode 100644 libs/microservices/ory-client/src/lib/ory.error.ts delete mode 100644 libs/microservices/ory-client/src/lib/ory.interfaces.ts delete mode 100644 libs/microservices/ory-client/tsconfig.json delete mode 100644 libs/microservices/ory-client/tsconfig.lib.json delete mode 100644 libs/microservices/ory-client/tsconfig.spec.json delete mode 100644 libs/microservices/shared/decorators/src/permission-check.decorator.ts delete mode 100644 libs/microservices/shared/guards/src/ory-authentication.guard.ts delete mode 100644 libs/microservices/shared/guards/src/ory-permission.guard.ts delete mode 100644 libs/microservices/shared/relation-tuple-parser/.eslintrc.json delete mode 100644 libs/microservices/shared/relation-tuple-parser/README.md delete mode 100644 libs/microservices/shared/relation-tuple-parser/jest.config.ts delete mode 100644 libs/microservices/shared/relation-tuple-parser/package.json delete mode 100644 libs/microservices/shared/relation-tuple-parser/project.json delete mode 100644 libs/microservices/shared/relation-tuple-parser/src/index.ts delete mode 100644 libs/microservices/shared/relation-tuple-parser/src/lib/errors/relation-tuple-syntax.error.ts delete mode 100644 libs/microservices/shared/relation-tuple-parser/src/lib/errors/unknown.error.ts delete mode 100644 libs/microservices/shared/relation-tuple-parser/src/lib/generated/antlr/RelationTuple.interp delete mode 100644 libs/microservices/shared/relation-tuple-parser/src/lib/generated/antlr/RelationTuple.tokens delete mode 100644 libs/microservices/shared/relation-tuple-parser/src/lib/generated/antlr/RelationTupleLexer.interp delete mode 100644 libs/microservices/shared/relation-tuple-parser/src/lib/generated/antlr/RelationTupleLexer.tokens delete mode 100644 libs/microservices/shared/relation-tuple-parser/src/lib/generated/antlr/RelationTupleLexer.ts delete mode 100644 libs/microservices/shared/relation-tuple-parser/src/lib/generated/antlr/RelationTupleParser.ts delete mode 100644 libs/microservices/shared/relation-tuple-parser/src/lib/generated/antlr/RelationTupleVisitor.ts delete mode 100644 libs/microservices/shared/relation-tuple-parser/src/lib/is-relation-tuple.ts delete mode 100644 libs/microservices/shared/relation-tuple-parser/src/lib/relation-tuple-antlr.ts delete mode 100644 libs/microservices/shared/relation-tuple-parser/src/lib/relation-tuple-parser.spec.ts delete mode 100644 libs/microservices/shared/relation-tuple-parser/src/lib/relation-tuple-parser.ts delete mode 100644 libs/microservices/shared/relation-tuple-parser/src/lib/relation-tuple.ts delete mode 100644 libs/microservices/shared/relation-tuple-parser/src/lib/util/access-to-path-proxy.spec.ts delete mode 100644 libs/microservices/shared/relation-tuple-parser/src/lib/util/access-to-path-proxy.ts delete mode 100644 libs/microservices/shared/relation-tuple-parser/src/lib/util/two-way-map.ts delete mode 100644 libs/microservices/shared/relation-tuple-parser/src/lib/with-replacements/generate-replacer-function.ts delete mode 100644 libs/microservices/shared/relation-tuple-parser/src/lib/with-replacements/relation-tuple-with-replacements-parser.spec.ts delete mode 100644 libs/microservices/shared/relation-tuple-parser/src/lib/with-replacements/relation-tuple-with-replacements-parser.ts delete mode 100644 libs/microservices/shared/relation-tuple-parser/src/lib/with-replacements/relation-tuple-with-replacements.ts delete mode 100644 libs/microservices/shared/relation-tuple-parser/src/lib/with-replacements/replacement-values.ts delete mode 100644 libs/microservices/shared/relation-tuple-parser/tsconfig.json delete mode 100644 libs/microservices/shared/relation-tuple-parser/tsconfig.lib.json delete mode 100644 libs/microservices/shared/relation-tuple-parser/tsconfig.spec.json diff --git a/libs/microservices/ory-client/.eslintrc.json b/libs/microservices/ory-client/.eslintrc.json deleted file mode 100644 index 45409725..00000000 --- a/libs/microservices/ory-client/.eslintrc.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "extends": ["../../../.eslintrc.json"], - "ignorePatterns": ["!**/*"], - "overrides": [ - { - "files": ["*.ts", "*.tsx", "*.js", "*.jsx", "*.cjs"], - "rules": {} - }, - { - "files": ["*.ts", "*.tsx"], - "rules": {} - }, - { - "files": ["*.js", "*.jsx", "*.cjs"], - "rules": {} - } - ] -} diff --git a/libs/microservices/ory-client/README.md b/libs/microservices/ory-client/README.md deleted file mode 100644 index cae949df..00000000 --- a/libs/microservices/ory-client/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# microservices-ory-client - -This library was generated with [Nx](https://nx.dev). - -## Running unit tests - -Run `nx test microservices-ory-client` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/libs/microservices/ory-client/jest.config.ts b/libs/microservices/ory-client/jest.config.ts deleted file mode 100644 index dc3d5fa5..00000000 --- a/libs/microservices/ory-client/jest.config.ts +++ /dev/null @@ -1,11 +0,0 @@ -/* eslint-disable */ -export default { - displayName: 'microservices-ory-client', - preset: '../../../jest.preset.js', - testEnvironment: 'node', - transform: { - '^.+\\.[tj]s$': ['ts-jest', { tsconfig: '/tsconfig.spec.json' }], - }, - moduleFileExtensions: ['ts', 'js', 'html'], - coverageDirectory: '../../../coverage/libs/microservices/ory-client', -}; diff --git a/libs/microservices/ory-client/project.json b/libs/microservices/ory-client/project.json deleted file mode 100644 index 0cd76868..00000000 --- a/libs/microservices/ory-client/project.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "microservices-ory-client", - "$schema": "../../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "libs/microservices/ory-client/src", - "projectType": "library", - "targets": { - "lint": { - "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"], - "options": { - "lintFilePatterns": ["libs/microservices/ory-client/**/*.ts"] - } - }, - "test": { - "executor": "@nx/jest:jest", - "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], - "options": { - "jestConfig": "libs/microservices/ory-client/jest.config.ts", - "passWithNoTests": true - } - } - }, - "tags": ["scope:shared", "type:core", "platform:server"] -} diff --git a/libs/microservices/ory-client/src/index.ts b/libs/microservices/ory-client/src/index.ts deleted file mode 100644 index 95bc6a4a..00000000 --- a/libs/microservices/ory-client/src/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * from './lib/ory.error'; -export * from './lib/ory.interfaces'; -export * from './lib/ory-authentication.module'; -export * from './lib/ory-authentication.service'; -export * from './lib/ory-permissions.module'; -export * from './lib/ory-permissions.service'; diff --git a/libs/microservices/ory-client/src/lib/helpers.ts b/libs/microservices/ory-client/src/lib/helpers.ts deleted file mode 100644 index 325c8ea2..00000000 --- a/libs/microservices/ory-client/src/lib/helpers.ts +++ /dev/null @@ -1,277 +0,0 @@ -import type { - PermissionApiCheckPermissionRequest, - PermissionApiExpandPermissionsRequest, - RelationQuery, - Relationship, -} from '@ory/client'; -import { - isRelationTuple, - isRelationTupleWithReplacements, - RelationTuple, - RelationTupleWithReplacements, - ReplacementValues, -} from '@ticketing/microservices/shared/relation-tuple-parser'; -import { get, omitBy } from 'lodash-es'; - -type RelationQueryFlat = Omit & { - subjectSetNamespace?: string; - subjectSetObject?: string; - subjectSetRelation?: string; - subjectId?: string; -}; - -type PermissionTuple = Pick< - RelationTuple, - 'namespace' | 'object' | 'relation' -> & - Partial>; - -type PermissionTupleWithReplacements = Pick< - RelationTupleWithReplacements, - 'namespace' | 'object' | 'relation' -> & - Partial, 'subjectIdOrSet'>>; - -const resolveTupleProperty = < - T extends ReplacementValues, - U extends Partial>, ->( - property: string, - tuple: U, - replacements?: U extends RelationTupleWithReplacements ? T : never, -): string | undefined => { - const factory = get(tuple, property); - if (typeof factory === 'function') { - return factory(replacements ?? ({} as T)); - } - if (typeof factory === 'string') { - return factory; - } - return undefined; -}; - -export function createRelationQuery( - tuple: Partial, -): RelationQuery; -export function createRelationQuery( - tuple: Partial>, - replacements: T, -): RelationQuery; -export function createRelationQuery< - T extends ReplacementValues, - U extends Partial>, ->( - tuple: U, - replacements?: U extends RelationTupleWithReplacements ? T : never, -): RelationQuery { - const { subjectIdOrSet } = tuple; - const result: RelationQuery = {}; - - result.namespace = resolveTupleProperty('namespace', tuple, replacements); - result.object = resolveTupleProperty('object', tuple, replacements); - result.relation = resolveTupleProperty('relation', tuple, replacements); - - if (typeof subjectIdOrSet === 'object' && subjectIdOrSet) { - result.subject_set = omitBy( - { - namespace: - resolveTupleProperty( - 'subjectIdOrSet.namespace', - tuple, - replacements, - ) ?? '', - object: - resolveTupleProperty('subjectIdOrSet.object', tuple, replacements) ?? - '', - relation: - resolveTupleProperty( - 'subjectIdOrSet.relation', - tuple, - replacements, - ) ?? '', - }, - (v) => !v, - ) as unknown as RelationQuery['subject_set']; - } else { - result.subject_id = - resolveTupleProperty('subjectIdOrSet', tuple, replacements) ?? ''; - } - - return omitBy(result, (v) => !v); -} - -export function createFlattenRelationQuery( - tuple: Partial, -): RelationQueryFlat; -export function createFlattenRelationQuery( - tuple: Partial>, - replacements: T, -): RelationQueryFlat; -export function createFlattenRelationQuery< - T extends ReplacementValues, - U extends Partial>, ->( - tuple: U, - replacements?: U extends RelationTupleWithReplacements ? T : never, -): RelationQueryFlat { - const { subjectIdOrSet } = tuple; - const result: RelationQueryFlat = {}; - - result.namespace = resolveTupleProperty('namespace', tuple, replacements); - result.object = resolveTupleProperty('object', tuple, replacements); - result.relation = resolveTupleProperty('relation', tuple, replacements); - - if (typeof subjectIdOrSet === 'object' && subjectIdOrSet) { - result.subjectSetObject = - resolveTupleProperty('subjectIdOrSet.object', tuple, replacements) ?? ''; - result.subjectSetNamespace = - resolveTupleProperty('subjectIdOrSet.namespace', tuple, replacements) ?? - ''; - result.subjectSetRelation = - resolveTupleProperty('subjectIdOrSet.relation', tuple, replacements) ?? - ''; - } else { - result.subjectId = - resolveTupleProperty('subjectIdOrSet', tuple, replacements) ?? ''; - } - - return omitBy(result, (v) => !v); -} - -export function createRelationTuple(tuple: RelationTuple): Relationship; -export function createRelationTuple( - tuple: RelationTupleWithReplacements, - replacements: T, -): Relationship; -export function createRelationTuple( - tuple: RelationTuple | RelationTupleWithReplacements, - opt_replacements?: T, -): Relationship; -export function createRelationTuple< - T extends ReplacementValues, - U extends RelationTuple | RelationTupleWithReplacements, ->( - tuple: U, - opt_replacements?: U extends RelationTupleWithReplacements ? T : never, -): Relationship { - if (isRelationTuple(tuple)) { - const result: Relationship = { - namespace: tuple.namespace, - object: tuple.object, - relation: tuple.relation, - }; - - if (typeof tuple.subjectIdOrSet === 'string') { - result.subject_id = tuple.subjectIdOrSet; - } else { - result.subject_set = { - ...tuple.subjectIdOrSet, - relation: tuple.subjectIdOrSet.relation ?? '', - }; - } - - return result; - } - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const replacements: T = opt_replacements!; // cannot be null - - const result: Relationship = { - namespace: tuple.namespace(replacements), - object: tuple.object(replacements), - relation: tuple.relation(replacements), - }; - - if (typeof tuple.subjectIdOrSet === 'function') { - result.subject_id = tuple.subjectIdOrSet(replacements); - } else { - result.subject_set = { - namespace: tuple.subjectIdOrSet.namespace(replacements), - object: tuple.subjectIdOrSet.object(replacements), - relation: tuple.subjectIdOrSet.relation(replacements) ?? '', - }; - } - - return result; -} - -export function createPermissionCheckQuery( - tuple: PermissionTuple, -): PermissionApiCheckPermissionRequest; -export function createPermissionCheckQuery( - tuple: PermissionTupleWithReplacements, - replacements: T, -): PermissionApiCheckPermissionRequest; -export function createPermissionCheckQuery( - tuple: PermissionTuple | PermissionTupleWithReplacements, - replacements?: T, -): PermissionApiCheckPermissionRequest { - if (isRelationTuple(tuple)) { - tuple.subjectIdOrSet = tuple.subjectIdOrSet ?? ''; - } else if (isRelationTupleWithReplacements(tuple)) { - tuple.subjectIdOrSet = - tuple.subjectIdOrSet ?? - function () { - return ''; - }; - } else { - throw new TypeError('Invalid permission tuple'); - } - - const relationship = createRelationTuple(tuple, replacements); - - const result: PermissionApiCheckPermissionRequest = { - namespace: relationship.namespace, - object: relationship.object, - relation: relationship.relation, - }; - - if (relationship.subject_id) { - Object.defineProperty(result, 'subjectId', { - value: relationship.subject_id, - enumerable: true, - }); - delete relationship.subject_id; - } else if (relationship.subject_set) { - Object.defineProperties(result, { - subjectSetNamespace: { - value: relationship.subject_set.namespace, - enumerable: true, - }, - subjectSetObject: { - value: relationship.subject_set.object, - enumerable: true, - }, - subjectSetRelation: { - value: relationship.subject_set.relation, - enumerable: true, - }, - }); - delete relationship.subject_set; - } - return result; -} - -export function createExpandPermissionQuery( - tuple: PermissionTuple | PermissionTupleWithReplacements, - replacements?: T, -): PermissionApiExpandPermissionsRequest { - if (isRelationTuple(tuple)) { - tuple.subjectIdOrSet = tuple.subjectIdOrSet ?? ''; - } else if (isRelationTupleWithReplacements(tuple)) { - tuple.subjectIdOrSet = - tuple.subjectIdOrSet ?? - function () { - return ''; - }; - } else { - throw new TypeError('Invalid permission tuple'); - } - - const relationship = createRelationTuple(tuple, replacements); - - return { - namespace: relationship.namespace, - object: relationship.object, - relation: relationship.relation, - }; -} diff --git a/libs/microservices/ory-client/src/lib/ory-authentication.module.ts b/libs/microservices/ory-client/src/lib/ory-authentication.module.ts deleted file mode 100644 index 2449534d..00000000 --- a/libs/microservices/ory-client/src/lib/ory-authentication.module.ts +++ /dev/null @@ -1,85 +0,0 @@ -import { DynamicModule, Module, Provider, Type } from '@nestjs/common'; - -import { - IOryAuthenticationModuleOptions, - OryAuthenticationModuleAsyncOptions, - OryAuthenticationModuleOptions, - OryAuthenticationModuleOptionsFactory, -} from './ory.interfaces'; -import { OryAuthenticationService } from './ory-authentication.service'; - -@Module({}) -export class OryAuthenticationModule { - static forRoot( - options: IOryAuthenticationModuleOptions, - isGlobal?: boolean, - ): DynamicModule { - return { - module: OryAuthenticationModule, - providers: [ - { provide: OryAuthenticationModuleOptions, useValue: options }, - OryAuthenticationService, - ], - exports: [OryAuthenticationModuleOptions, OryAuthenticationService], - global: isGlobal, - }; - } - - static forRootAsync( - options: OryAuthenticationModuleAsyncOptions, - isGlobal?: boolean, - ): DynamicModule { - return { - module: OryAuthenticationModule, - imports: options.imports ?? [], - providers: [ - ...this.createAsyncProviders(options), - OryAuthenticationService, - ], - exports: [OryAuthenticationModuleOptions, OryAuthenticationService], - global: isGlobal, - }; - } - - private static createAsyncProviders( - options: OryAuthenticationModuleAsyncOptions, - ): Provider[] { - if (options.useExisting || options.useFactory) { - return [this.createAsyncOptionsProvider(options)]; - } - if (options.useClass) { - return [ - this.createAsyncOptionsProvider(options), - { - provide: options.useClass, - useClass: options.useClass, - }, - ]; - } - throw new Error('Invalid OryAuthenticationModuleAsyncOptions'); - } - - private static createAsyncOptionsProvider( - options: OryAuthenticationModuleAsyncOptions, - ): Provider { - if (options.useFactory) { - return { - provide: OryAuthenticationModuleOptions, - useFactory: options.useFactory, - inject: options.inject ?? [], - }; - } - if (!options.useExisting && !options.useClass) { - throw new Error('Invalid OryAuthenticationModuleAsyncOptions'); - } - return { - provide: OryAuthenticationModuleOptions, - useFactory: (optionsFactory: OryAuthenticationModuleOptionsFactory) => - optionsFactory.createOryOptions(), - inject: [ - (options.useExisting ?? - options.useClass) as Type, - ], - }; - } -} diff --git a/libs/microservices/ory-client/src/lib/ory-authentication.service.ts b/libs/microservices/ory-client/src/lib/ory-authentication.service.ts deleted file mode 100644 index af917320..00000000 --- a/libs/microservices/ory-client/src/lib/ory-authentication.service.ts +++ /dev/null @@ -1,188 +0,0 @@ -import { Inject, Injectable, Logger } from '@nestjs/common'; -import { - Configuration, - FrontendApi, - Identity, - IdentityApi, - JsonPatchOpEnum, - OAuth2Api, - OAuth2Client, - Session, -} from '@ory/client'; -import { CURRENT_USER_KEY } from '@ticketing/shared/constants'; -import type { FastifyRequest } from 'fastify/types/request'; - -import { OryError } from './ory.error'; -import { OryAuthenticationModuleOptions } from './ory.interfaces'; - -@Injectable() -export class OryAuthenticationService { - readonly logger = new Logger(OryAuthenticationService.name); - private readonly identityApi: IdentityApi; - private readonly oauth2Api: OAuth2Api; - private readonly frontendApi: FrontendApi; - - constructor( - @Inject(OryAuthenticationModuleOptions) - options: OryAuthenticationModuleOptions, - ) { - const { - kratosAccessToken, - kratosAdminApiPath, - kratosPublicApiPath, - hydraAccessToken, - hydraPublicApiPath, - } = options; - this.frontendApi = new FrontendApi( - new Configuration({ - basePath: kratosPublicApiPath, - }), - ); - this.identityApi = new IdentityApi( - new Configuration({ - basePath: kratosAdminApiPath, - accessToken: kratosAccessToken, - }), - ); - this.oauth2Api = new OAuth2Api( - new Configuration({ - basePath: hydraPublicApiPath, - accessToken: hydraAccessToken, - }), - ); - } - - // #region Frontend API - - private isValidSession(x: Session): x is Session & { - identity: { metadata_public: { id: string } }; - } { - return ( - !!x?.identity && - typeof x.identity.traits === 'object' && - !!x.identity.traits && - 'email' in x.identity.traits && - typeof x.identity.metadata_public === 'object' && - !!x.identity.metadata_public && - 'id' in x.identity.metadata_public && - typeof x.identity.metadata_public.id === 'string' - ); - } - - async validateSession(request: FastifyRequest): Promise { - const authHeader = request.headers.authorization; - const hasAuthHeader = - typeof authHeader === 'string' && - authHeader && - authHeader?.startsWith('Bearer '); - const sessionToken = hasAuthHeader - ? authHeader.slice(7, authHeader.length) - : undefined; - - try { - const { data: session } = await this.frontendApi.toSession({ - cookie: request.headers.cookie, - xSessionToken: sessionToken, - }); - if (!this.isValidSession(session)) { - this.logger.error('Invalid session', session); - return false; - } - Object.defineProperty(request, CURRENT_USER_KEY, { - value: { - identityId: session.identity.id, - id: session.identity.metadata_public.id, - email: session.identity.traits.email, - }, - }); - return !!session?.identity; - } catch (e) { - const error = new OryError(e); - this.logger.error(error); - return false; - } - } - - // #endregion - - // #region Identity API - async updateIdentityMetadata( - identityId: string, - metadata: Identity['metadata_public'], - ): Promise { - const response = await this.identityApi.patchIdentity({ - id: identityId, - jsonPatch: [ - { - op: JsonPatchOpEnum.Replace, - value: metadata, - path: '/metadata_public', - }, - ], - }); - return response.data; - } - - async getIdentity(identityId: string): Promise { - const { data } = await this.identityApi.getIdentity({ id: identityId }); - return data; - } - - async toggleIdentityState( - identityId: string, - state: 'active' | 'inactive', - ): Promise { - const response = await this.identityApi.patchIdentity({ - id: identityId, - jsonPatch: [ - { - op: JsonPatchOpEnum.Replace, - value: state, - path: '/state', - }, - ], - }); - return response.data; - } - - async deleteIdentity(identityId: string): Promise { - await this.identityApi.deleteIdentity({ id: identityId }); - } - - async signOut(sessionId: string): Promise { - await this.identityApi.disableSession({ - id: sessionId, - }); - } - - // #endregion - - // #region OAuth2 API - // TODO: allow users to create their own M2M clients - async createClient( - userId: string, - scope: string = 'openid offline', - ): Promise { - const response = await this.oauth2Api.createOAuth2Client({ - oAuth2Client: { - client_name: `client-${userId}`, - // audience: ['my api url'], - grant_types: ['client_credentials'], - response_types: ['token'], - scope, - token_endpoint_auth_method: 'client_secret_post', - metadata: { - user_id: userId, - }, - }, - }); - return response.data; - } - - async getClient(clientId: string): Promise { - const response = await this.oauth2Api.getOAuth2Client({ id: clientId }); - return response.data; - } - - // #endregion -} diff --git a/libs/microservices/ory-client/src/lib/ory-permissions.module.ts b/libs/microservices/ory-client/src/lib/ory-permissions.module.ts deleted file mode 100644 index 5a2b4696..00000000 --- a/libs/microservices/ory-client/src/lib/ory-permissions.module.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { DynamicModule, Module, Provider, Type } from '@nestjs/common'; - -import { - IOryPermissionsModuleOptions, - OryPermissionsModuleAsyncOptions, - OryPermissionsModuleOptions, - OryPermissionsModuleOptionsFactory, -} from './ory.interfaces'; -import {} from './ory-authentication.service'; -import { OryPermissionsService } from './ory-permissions.service'; - -@Module({}) -export class OryPermissionsModule { - static forRoot( - options: IOryPermissionsModuleOptions, - isGlobal?: boolean, - ): DynamicModule { - return { - module: OryPermissionsModule, - providers: [ - { provide: OryPermissionsModuleOptions, useValue: options }, - OryPermissionsService, - ], - exports: [OryPermissionsModuleOptions, OryPermissionsService], - global: isGlobal, - }; - } - - static forRootAsync( - options: OryPermissionsModuleAsyncOptions, - isGlobal?: boolean, - ): DynamicModule { - return { - module: OryPermissionsModule, - imports: options.imports ?? [], - providers: [...this.createAsyncProviders(options), OryPermissionsService], - exports: [OryPermissionsModuleOptions, OryPermissionsService], - global: isGlobal, - }; - } - - private static createAsyncProviders( - options: OryPermissionsModuleAsyncOptions, - ): Provider[] { - if (options.useExisting || options.useFactory) { - return [this.createAsyncOptionsProvider(options)]; - } - if (options.useClass) { - return [ - this.createAsyncOptionsProvider(options), - { - provide: options.useClass, - useClass: options.useClass, - }, - ]; - } - throw new Error('Invalid OryPermissionsModuleAsyncOptions'); - } - - private static createAsyncOptionsProvider( - options: OryPermissionsModuleAsyncOptions, - ): Provider { - if (options.useFactory) { - return { - provide: OryPermissionsModuleOptions, - useFactory: options.useFactory, - inject: options.inject ?? [], - }; - } - if (!options.useExisting && !options.useClass) { - throw new Error('Invalid OryPermissionsModuleAsyncOptions'); - } - return { - provide: OryPermissionsModuleOptions, - useFactory: (optionsFactory: OryPermissionsModuleOptionsFactory) => - optionsFactory.createOryOptions(), - inject: [ - (options.useExisting ?? - options.useClass) as Type, - ], - }; - } -} diff --git a/libs/microservices/ory-client/src/lib/ory-permissions.service.ts b/libs/microservices/ory-client/src/lib/ory-permissions.service.ts deleted file mode 100644 index 4a823046..00000000 --- a/libs/microservices/ory-client/src/lib/ory-permissions.service.ts +++ /dev/null @@ -1,129 +0,0 @@ -import { Inject, Injectable, Logger, OnModuleInit } from '@nestjs/common'; -import { - Configuration, - ExpandedPermissionTree, - PermissionApi, - RelationshipApi, - Relationships, -} from '@ory/client'; -import { type RelationTuple } from '@ticketing/microservices/shared/relation-tuple-parser'; - -import { - createExpandPermissionQuery, - createFlattenRelationQuery, - createPermissionCheckQuery, - createRelationQuery, - createRelationTuple, -} from './helpers'; -import { OryError } from './ory.error'; -import { OryPermissionsModuleOptions } from './ory.interfaces'; - -@Injectable() -export class OryPermissionsService implements OnModuleInit { - readonly logger = new Logger(OryPermissionsService.name); - private readonly relationShipApi: RelationshipApi; - private readonly permissionApi: PermissionApi; - - constructor( - @Inject(OryPermissionsModuleOptions) options: OryPermissionsModuleOptions, - ) { - const { ketoAccessToken, ketoAdminApiPath, ketoPublicApiPath } = options; - this.relationShipApi = new RelationshipApi( - new Configuration({ - basePath: ketoAdminApiPath, - accessToken: ketoAccessToken, - }), - ); - this.permissionApi = new PermissionApi( - new Configuration({ - basePath: ketoPublicApiPath, - accessToken: ketoAccessToken, - }), - ); - } - - onModuleInit(): void { - this.relationShipApi['axios'].defaults.validateStatus = ( - status: number, - ) => { - return status >= 200 && status < 300; - }; - this.relationShipApi['axios'].interceptors.response.use( - (response) => response, - (error) => { - // TODO: retry on 429 - const oryError = new OryError(error); - return Promise.reject(oryError); - }, - ); - - this.permissionApi['axios'].defaults.validateStatus = (status: number) => { - return status >= 200 && status < 300; - }; - this.permissionApi['axios'].interceptors.response.use( - (response) => response, - (error) => { - const oryError = new OryError(error); - return Promise.reject(oryError); - }, - ); - } - - createRelationQuery = createRelationQuery; - - createFlattenRelationQuery = createFlattenRelationQuery; - - createRelationTuple = createRelationTuple; - - createPermissionCheckQuery = createPermissionCheckQuery; - - createExpandPermissionQuery = createExpandPermissionQuery; - - async createRelation(tuple: Partial): Promise { - const createRelationshipBody = this.createRelationQuery(tuple); - await this.relationShipApi.createRelationship({ - createRelationshipBody, - }); - return true; - } - // TODO: write a batch create method with rollback on error - // async createRelations(tuples: RelationTuple[]): Promise { - // } - - async deleteRelation(tuple: Partial): Promise { - const relationQuery = this.createRelationQuery(tuple); - //! the type of RelationshipApiDeleteRelationshipsRequest is wrong in @ory/client - await this.relationShipApi.deleteRelationships(relationQuery); - return true; - } - - async getRelations( - tuple: Partial, - pagination: { pageSize?: number; pageToken?: string } = {}, - ): Promise { - const relationQuery = this.createFlattenRelationQuery(tuple); - const { data } = await this.relationShipApi.getRelationships({ - ...relationQuery, - ...pagination, - }); - return data; - } - - async checkPermission(relationTuple: RelationTuple): Promise { - const checkRequest = this.createPermissionCheckQuery(relationTuple); - const { data } = await this.permissionApi.checkPermission(checkRequest); - return data.allowed; - } - - async expandPermissions( - relationTuple: Pick, - maxDepth = 3, - ): Promise { - const checkRequest = this.createExpandPermissionQuery(relationTuple); - const { data } = await this.permissionApi.expandPermissions({ - ...checkRequest, - maxDepth, - }); - return data; - } -} diff --git a/libs/microservices/ory-client/src/lib/ory.error.ts b/libs/microservices/ory-client/src/lib/ory.error.ts deleted file mode 100644 index 1e12eb5a..00000000 --- a/libs/microservices/ory-client/src/lib/ory.error.ts +++ /dev/null @@ -1,93 +0,0 @@ -import { - type RelationTuple, - relationTupleToString, -} from '@ticketing/microservices/shared/relation-tuple-parser'; -import { CustomError } from '@ticketing/shared/errors'; -import type { AxiosError } from 'axios'; - -/** - * @description replacement of isAxiosError from axios, required as it is not exported in ESM build - * @param error - * @returns - */ -function isAxiosError(error: unknown): error is AxiosError { - return ( - typeof error === 'object' && !!error && !!(error as AxiosError).isAxiosError - ); -} - -export class OryError extends CustomError { - constructor( - readonly error: unknown, - readonly defaultStatus = 500, - readonly defaultReason = 'Error connecting to the Ory Keto API', - ) { - super(OryError.parseError(error)); - Object.setPrototypeOf(this, OryError.prototype); - } - - static parseError(error: unknown): string { - if (isAxiosError(error)) { - return error.cause?.message ?? error.message; - } - if (isOryError(error)) { - return error.errorMessage; - } - if (error instanceof Error) { - return error.message; - } - return 'Unknown error'; - } - - get errorMessage(): string { - return OryError.parseError(this.error) ?? this.defaultReason; - } - - get statusCode(): number { - if (isAxiosError(this.error)) { - return this.error.response?.status ?? this.defaultStatus; - } - if (isOryError(this.error)) { - return this.error.statusCode; - } - return this.defaultStatus; - } - - getDetails(): Record { - if (isAxiosError(this.error)) { - return (this.error.response?.data ?? {}) as Record; - } - if (isOryError(this.error)) { - return this.error.getDetails(); - } - return {}; - } - - serializeErrors(): { message: string; field?: string }[] { - return [{ message: this.errorMessage }]; - } -} - -export function isOryError(error: unknown): error is OryError { - return error instanceof OryError; -} - -export class OryPermissionError extends OryError { - constructor( - error: unknown, - readonly tuple?: Partial, - defaultStatus = 500, - defaultReason = 'Error connecting to the Ory Keto API', - ) { - super(error, defaultStatus, defaultReason); - Object.setPrototypeOf(this, OryPermissionError.prototype); - } - - get tupleString(): string { - return this.tuple ? relationTupleToString(this.tuple) : ''; - } - - override serializeErrors(): { message: string; field?: string }[] { - return [{ message: this.errorMessage, field: this.tupleString }]; - } -} diff --git a/libs/microservices/ory-client/src/lib/ory.interfaces.ts b/libs/microservices/ory-client/src/lib/ory.interfaces.ts deleted file mode 100644 index a7e5ae73..00000000 --- a/libs/microservices/ory-client/src/lib/ory.interfaces.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -import { ModuleMetadata, Type } from '@nestjs/common/interfaces'; - -export interface IOryAuthenticationModuleOptions { - kratosAdminApiPath: string; - kratosPublicApiPath: string; - kratosAccessToken?: string; - hydraAdminApiPath: string; - hydraPublicApiPath: string; - hydraAccessToken?: string; -} - -export interface OryAuthenticationModuleOptionsFactory { - createOryOptions(): - | Promise - | IOryAuthenticationModuleOptions; -} - -export interface OryAuthenticationModuleAsyncOptions - extends Pick { - useExisting?: Type; - useClass?: Type; - useFactory?: ( - ...args: any[] - ) => - | Promise - | IOryAuthenticationModuleOptions; - inject?: any[]; -} - -export class OryAuthenticationModuleOptions - implements IOryAuthenticationModuleOptions -{ - constructor( - public readonly kratosAdminApiPath: string, - public readonly kratosPublicApiPath: string, - public readonly kratosAccessToken: string, - public readonly hydraAdminApiPath: string, - public readonly hydraPublicApiPath: string, - public readonly hydraAccessToken: string, - ) {} -} - -export interface IOryPermissionsModuleOptions { - ketoPublicApiPath: string; - ketoAdminApiPath: string; - ketoAccessToken?: string; -} - -export interface OryPermissionsModuleOptionsFactory { - createOryOptions(): - | Promise - | IOryPermissionsModuleOptions; -} - -export interface OryPermissionsModuleAsyncOptions - extends Pick { - useExisting?: Type; - useClass?: Type; - useFactory?: ( - ...args: any[] - ) => Promise | IOryPermissionsModuleOptions; - inject?: any[]; -} - -export class OryPermissionsModuleOptions - implements IOryPermissionsModuleOptions -{ - constructor( - public readonly ketoPublicApiPath: string, - public readonly ketoAdminApiPath: string, - public readonly ketoAccessToken: string, - ) {} -} diff --git a/libs/microservices/ory-client/tsconfig.json b/libs/microservices/ory-client/tsconfig.json deleted file mode 100644 index c50bbbcc..00000000 --- a/libs/microservices/ory-client/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "../../../tsconfig.base.json", - "compilerOptions": { - "module": "esnext", - "forceConsistentCasingInFileNames": true, - "strict": true, - "noImplicitOverride": true, - "noPropertyAccessFromIndexSignature": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true - }, - "files": [], - "include": [], - "references": [ - { - "path": "./tsconfig.lib.json" - }, - { - "path": "./tsconfig.spec.json" - } - ] -} diff --git a/libs/microservices/ory-client/tsconfig.lib.json b/libs/microservices/ory-client/tsconfig.lib.json deleted file mode 100644 index dbf54fd7..00000000 --- a/libs/microservices/ory-client/tsconfig.lib.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../../dist/out-tsc", - "declaration": true, - "types": ["node"], - "target": "es2021", - "strictNullChecks": true, - "noImplicitAny": true, - "strictBindCallApply": true, - "forceConsistentCasingInFileNames": true, - "noFallthroughCasesInSwitch": true - }, - "include": ["src/**/*.ts"], - "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"] -} diff --git a/libs/microservices/ory-client/tsconfig.spec.json b/libs/microservices/ory-client/tsconfig.spec.json deleted file mode 100644 index 02e0a49e..00000000 --- a/libs/microservices/ory-client/tsconfig.spec.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../../dist/out-tsc", - "module": "esnext", - "types": ["jest", "node"] - }, - "include": [ - "jest.config.ts", - "src/**/*.test.ts", - "src/**/*.spec.ts", - "src/**/*.d.ts" - ] -} diff --git a/libs/microservices/shared/decorators/src/index.ts b/libs/microservices/shared/decorators/src/index.ts index aa117829..da898843 100644 --- a/libs/microservices/shared/decorators/src/index.ts +++ b/libs/microservices/shared/decorators/src/index.ts @@ -1,4 +1,3 @@ export * from './api-nested-query.decorator'; export * from './api-paginated-dto.decorator'; export * from './current-user.decorator'; -export * from './permission-check.decorator'; diff --git a/libs/microservices/shared/decorators/src/permission-check.decorator.ts b/libs/microservices/shared/decorators/src/permission-check.decorator.ts deleted file mode 100644 index 0116c117..00000000 --- a/libs/microservices/shared/decorators/src/permission-check.decorator.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { CustomDecorator, ExecutionContext, SetMetadata } from '@nestjs/common'; -import { Reflector } from '@nestjs/core'; -import { - parseRelationTuple, - RelationTuple, -} from '@ticketing/microservices/shared/relation-tuple-parser'; - -type PermissionCheckMetadataType = { - expression: (ctx: ExecutionContext) => string; - relationTupleFactory?: (ctx: ExecutionContext) => RelationTuple; -}; - -const PERMISSION_CHECKS_METADATA_KEY = Symbol('PermissionChecksKey'); -const PERMISSION_CHECK_METADATA_KEY = Symbol('PermissionCheckKey'); - -export const PermissionChecks = ( - ...relationTupleFactories: (string | ((ctx: ExecutionContext) => string))[] -): CustomDecorator => { - const valueToSet: PermissionCheckMetadataType[] = []; - - for (const relationTupleFactory of relationTupleFactories) { - if (typeof relationTupleFactory === 'string') { - valueToSet.push({ - expression: () => relationTupleFactory, - relationTupleFactory: () => - parseRelationTuple(relationTupleFactory).unwrapOrThrow(), - }); - } else { - valueToSet.push({ - expression: (ctx) => relationTupleFactory(ctx), - relationTupleFactory: (ctx) => - parseRelationTuple(relationTupleFactory(ctx)).unwrapOrThrow(), - }); - } - } - return SetMetadata(PERMISSION_CHECKS_METADATA_KEY, valueToSet); -}; - -export const PermissionCheck = ( - relationTupleFactory: string | ((ctx: ExecutionContext) => string), -): CustomDecorator => { - const valueToSet: PermissionCheckMetadataType = { - relationTupleFactory: null, - expression: null, - }; - - if (typeof relationTupleFactory === 'string') { - valueToSet.expression = () => relationTupleFactory; - valueToSet.relationTupleFactory = () => - parseRelationTuple(relationTupleFactory).unwrapOrThrow(); - } else { - valueToSet.expression = (ctx) => relationTupleFactory(ctx); - valueToSet.relationTupleFactory = (ctx) => - parseRelationTuple(relationTupleFactory(ctx)).unwrapOrThrow(); - } - - return SetMetadata(PERMISSION_CHECK_METADATA_KEY, valueToSet); -}; - -export const getGuardingRelationTuples = ( - reflector: Reflector, - handler: Parameters[1], -): PermissionCheckMetadataType[] | null => { - const permissionChecks: PermissionCheckMetadataType[] = []; - const permissionChecksMetadata = - reflector.get< - PermissionCheckMetadataType[], - typeof PERMISSION_CHECKS_METADATA_KEY - >(PERMISSION_CHECKS_METADATA_KEY, handler) ?? []; - permissionChecks.push(...permissionChecksMetadata); - - const permissionCheckMetadata = - reflector.get< - PermissionCheckMetadataType, - typeof PERMISSION_CHECK_METADATA_KEY - >(PERMISSION_CHECK_METADATA_KEY, handler) ?? null; - - if (permissionCheckMetadata) { - permissionChecks.push(permissionCheckMetadata); - } - return permissionChecks.length > 0 ? permissionChecks : null; -}; diff --git a/libs/microservices/shared/guards/src/index.ts b/libs/microservices/shared/guards/src/index.ts index 358bdbd3..1472d203 100644 --- a/libs/microservices/shared/guards/src/index.ts +++ b/libs/microservices/shared/guards/src/index.ts @@ -1,5 +1,3 @@ export * from './jwt.strategy'; export * from './jwt-auth.guard'; export * from './ory-action-auth.guard'; -export * from './ory-authentication.guard'; -export * from './ory-permission.guard'; diff --git a/libs/microservices/shared/guards/src/ory-authentication.guard.ts b/libs/microservices/shared/guards/src/ory-authentication.guard.ts deleted file mode 100644 index 5b1ee750..00000000 --- a/libs/microservices/shared/guards/src/ory-authentication.guard.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { - CanActivate, - ExecutionContext, - Inject, - Injectable, - Logger, - UnauthorizedException, -} from '@nestjs/common'; -import { OryAuthenticationService } from '@ticketing/microservices/ory-client'; -import type { FastifyRequest } from 'fastify/types/request'; - -@Injectable() -export class OryAuthenticationGuard implements CanActivate { - readonly logger = new Logger(OryAuthenticationGuard.name); - - constructor( - @Inject(OryAuthenticationService) - private readonly oryService: OryAuthenticationService, - ) {} - - private getRequest(context: ExecutionContext): FastifyRequest { - return context.switchToHttp().getRequest(); - } - - async canActivate(context: ExecutionContext): Promise { - const req = this.getRequest(context); - const result = await this.oryService.validateSession(req); - if (!result) { - throw new UnauthorizedException(); - } - return result; - } -} diff --git a/libs/microservices/shared/guards/src/ory-permission.guard.ts b/libs/microservices/shared/guards/src/ory-permission.guard.ts deleted file mode 100644 index aa9c72b3..00000000 --- a/libs/microservices/shared/guards/src/ory-permission.guard.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { - CanActivate, - ExecutionContext, - ForbiddenException, - Inject, - Injectable, - Logger, -} from '@nestjs/common'; -import { Reflector } from '@nestjs/core'; -import { OryPermissionsService } from '@ticketing/microservices/ory-client'; -import { getGuardingRelationTuples } from '@ticketing/microservices/shared/decorators'; - -@Injectable() -export class OryPermissionGuard implements CanActivate { - readonly logger = new Logger(OryPermissionGuard.name); - - constructor( - private readonly reflector: Reflector, - @Inject(OryPermissionsService) - private readonly oryService: OryPermissionsService, - ) {} - - async canActivate(context: ExecutionContext): Promise { - const factories = - getGuardingRelationTuples(this.reflector, context.getHandler()) ?? []; - - if (!factories?.length) { - // no relation tuple ? - should not use this guard then => Forbidden - return Promise.resolve(false); - } - for (const { expression, relationTupleFactory } of factories) { - const relationTuple = relationTupleFactory(context); - const isPermitted = await this.oryService.checkPermission(relationTuple); - if (!isPermitted) { - this.logger.warn(`Not allowed to access ${expression(context)}`); - throw new ForbiddenException(); - } - } - - return true; - } -} diff --git a/libs/microservices/shared/relation-tuple-parser/.eslintrc.json b/libs/microservices/shared/relation-tuple-parser/.eslintrc.json deleted file mode 100644 index db7f823c..00000000 --- a/libs/microservices/shared/relation-tuple-parser/.eslintrc.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "extends": ["../../../../.eslintrc.json"], - "ignorePatterns": ["!**/*", "**/generated/**/*"], - "overrides": [ - { - "files": ["*.ts", "*.tsx", "*.js", "*.jsx", "*.cjs"], - "rules": {} - }, - { - "files": ["*.ts", "*.tsx"], - "rules": {} - }, - { - "files": ["*.js", "*.jsx", "*.cjs"], - "rules": {} - }, - { - "files": ["*.json"], - "parser": "jsonc-eslint-parser", - "rules": { - "@nx/dependency-checks": "warn" - } - } - ] -} diff --git a/libs/microservices/shared/relation-tuple-parser/README.md b/libs/microservices/shared/relation-tuple-parser/README.md deleted file mode 100644 index 75005051..00000000 --- a/libs/microservices/shared/relation-tuple-parser/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# relation-tuple-parser - -This library was generated with [Nx](https://nx.dev). - -## Building - -Run `nx build relation-tuple-parser` to build the library. - -## Running unit tests - -Run `nx test relation-tuple-parser` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/libs/microservices/shared/relation-tuple-parser/jest.config.ts b/libs/microservices/shared/relation-tuple-parser/jest.config.ts deleted file mode 100644 index b85fc156..00000000 --- a/libs/microservices/shared/relation-tuple-parser/jest.config.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* eslint-disable */ -export default { - displayName: 'microservices-shared-relation-tuple-parser', - preset: '../../../../jest.preset.js', - testEnvironment: 'node', - transform: { - '^.+\\.[tjm]s$': [ - 'ts-jest', - { tsconfig: '/tsconfig.spec.json', useESM: true }, - ], - }, - moduleFileExtensions: ['ts', 'js', 'mjs'], - extensionsToTreatAsEsm: ['.ts'], - coverageDirectory: - '../../../../coverage/libs/microservices/shared/relation-tuple-parser', -}; diff --git a/libs/microservices/shared/relation-tuple-parser/package.json b/libs/microservices/shared/relation-tuple-parser/package.json deleted file mode 100644 index 175675e6..00000000 --- a/libs/microservices/shared/relation-tuple-parser/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "relation-tuple-parser", - "version": "0.0.1", - "dependencies": { - "tslib": "^2.3.0" - }, - "main": "./src/index.js", - "typings": "./src/index.d.ts", - "type": "module", - "exports": { - "types": "./src/index.d.ts", - "import": "./src/index.js", - "default": "./src/index.js" - } -} diff --git a/libs/microservices/shared/relation-tuple-parser/project.json b/libs/microservices/shared/relation-tuple-parser/project.json deleted file mode 100644 index cede1117..00000000 --- a/libs/microservices/shared/relation-tuple-parser/project.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "microservices-shared-relation-tuple-parser", - "$schema": "../../../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "libs/microservices/shared/relation-tuple-parser/src", - "projectType": "library", - "targets": { - "build": { - "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], - "options": { - "outputPath": "dist/libs/microservices/shared/relation-tuple-parser", - "main": "libs/microservices/shared/relation-tuple-parser/src/index.ts", - "tsConfig": "libs/microservices/shared/relation-tuple-parser/tsconfig.lib.json", - "assets": ["libs/microservices/shared/relation-tuple-parser/*.md"], - "updateBuildableProjectDepsInPackageJson": true, - "buildableProjectDepsInPackageJsonType": "peerDependencies" - } - }, - "lint": { - "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"], - "options": { - "lintFilePatterns": [ - "libs/microservices/shared/relation-tuple-parser/**/*.ts", - "libs/microservices/shared/relation-tuple-parser/package.json" - ] - } - }, - "test": { - "executor": "@nx/jest:jest", - "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], - "options": { - "jestConfig": "libs/microservices/shared/relation-tuple-parser/jest.config.ts" - } - }, - "generate-parser": { - "executor": "nx:run-commands", - "options": { - "commands": [ - "rm -rf src/lib/generated/antlr", - "antlr4ng -Dlanguage=TypeScript -no-listener -visitor RelationTuple.g4 -o src/lib/generated/antlr" - ], - "cwd": "libs/microservices/shared/relation-tuple-parser", - "parallel": false - } - } - }, - "tags": ["scope:shared", "type:utils", "platform:server"] -} diff --git a/libs/microservices/shared/relation-tuple-parser/src/index.ts b/libs/microservices/shared/relation-tuple-parser/src/index.ts deleted file mode 100644 index 74b49787..00000000 --- a/libs/microservices/shared/relation-tuple-parser/src/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -export { RelationTupleSyntaxError } from './lib/errors/relation-tuple-syntax.error.js'; -export { UnknownError } from './lib/errors/unknown.error.js'; -export { - isRelationTuple, - isRelationTupleWithReplacements, -} from './lib/is-relation-tuple.js'; -export { RelationTuple, SubjectSet } from './lib/relation-tuple.js'; -export { - parseRelationTuple, - parseRelationTupleString, - relationTupleToString, -} from './lib/relation-tuple-parser.js'; -export type { ReplaceableString } from './lib/with-replacements/relation-tuple-with-replacements.js'; -export { - RelationTupleWithReplacements, - SubjectSetWithReplacements, -} from './lib/with-replacements/relation-tuple-with-replacements.js'; -export type { RelationTupleStringGenerator } from './lib/with-replacements/relation-tuple-with-replacements-parser.js'; -export { parseRelationTupleWithReplacements } from './lib/with-replacements/relation-tuple-with-replacements-parser.js'; -export type { ReplacementValues } from './lib/with-replacements/replacement-values.js'; diff --git a/libs/microservices/shared/relation-tuple-parser/src/lib/errors/relation-tuple-syntax.error.ts b/libs/microservices/shared/relation-tuple-parser/src/lib/errors/relation-tuple-syntax.error.ts deleted file mode 100644 index 3a8044d8..00000000 --- a/libs/microservices/shared/relation-tuple-parser/src/lib/errors/relation-tuple-syntax.error.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { defekt } from 'defekt'; - -export type RelationTupleSyntaxErrorDetail = { - wholeInput: string; - line: number; - charPositionInLine: number; - offendingSymbol?: string; -}; - -export class RelationTupleSyntaxError extends defekt< - { errors: Array }, - 'RelationTupleSyntaxError' ->({ - code: 'RelationTupleSyntaxError', -}) {} diff --git a/libs/microservices/shared/relation-tuple-parser/src/lib/errors/unknown.error.ts b/libs/microservices/shared/relation-tuple-parser/src/lib/errors/unknown.error.ts deleted file mode 100644 index 5890942e..00000000 --- a/libs/microservices/shared/relation-tuple-parser/src/lib/errors/unknown.error.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { defekt } from 'defekt'; - -export class UnknownError extends defekt({ - code: 'UnknownError', -}) {} diff --git a/libs/microservices/shared/relation-tuple-parser/src/lib/generated/antlr/RelationTuple.interp b/libs/microservices/shared/relation-tuple-parser/src/lib/generated/antlr/RelationTuple.interp deleted file mode 100644 index c1a0a048..00000000 --- a/libs/microservices/shared/relation-tuple-parser/src/lib/generated/antlr/RelationTuple.interp +++ /dev/null @@ -1,30 +0,0 @@ -token literal names: -null -'#' -'@' -':' -'(' -')' -null -null - -token symbolic names: -null -null -null -null -null -null -STRING -CHAR - -rule names: -relationTuple -namespacedObject -subject -subjectId -subjectSet - - -atn: -[4, 1, 7, 44, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 32, 8, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 3, 4, 39, 8, 4, 1, 4, 3, 4, 42, 8, 4, 1, 4, 0, 0, 5, 0, 2, 4, 6, 8, 0, 0, 43, 0, 10, 1, 0, 0, 0, 2, 17, 1, 0, 0, 0, 4, 31, 1, 0, 0, 0, 6, 33, 1, 0, 0, 0, 8, 41, 1, 0, 0, 0, 10, 11, 3, 2, 1, 0, 11, 12, 5, 1, 0, 0, 12, 13, 5, 6, 0, 0, 13, 14, 5, 2, 0, 0, 14, 15, 3, 4, 2, 0, 15, 16, 5, 0, 0, 1, 16, 1, 1, 0, 0, 0, 17, 18, 5, 6, 0, 0, 18, 19, 5, 3, 0, 0, 19, 20, 5, 6, 0, 0, 20, 3, 1, 0, 0, 0, 21, 32, 3, 6, 3, 0, 22, 32, 3, 8, 4, 0, 23, 24, 5, 4, 0, 0, 24, 25, 3, 6, 3, 0, 25, 26, 5, 5, 0, 0, 26, 32, 1, 0, 0, 0, 27, 28, 5, 4, 0, 0, 28, 29, 3, 8, 4, 0, 29, 30, 5, 5, 0, 0, 30, 32, 1, 0, 0, 0, 31, 21, 1, 0, 0, 0, 31, 22, 1, 0, 0, 0, 31, 23, 1, 0, 0, 0, 31, 27, 1, 0, 0, 0, 32, 5, 1, 0, 0, 0, 33, 34, 5, 6, 0, 0, 34, 7, 1, 0, 0, 0, 35, 36, 3, 2, 1, 0, 36, 38, 5, 1, 0, 0, 37, 39, 5, 6, 0, 0, 38, 37, 1, 0, 0, 0, 38, 39, 1, 0, 0, 0, 39, 42, 1, 0, 0, 0, 40, 42, 3, 2, 1, 0, 41, 35, 1, 0, 0, 0, 41, 40, 1, 0, 0, 0, 42, 9, 1, 0, 0, 0, 3, 31, 38, 41] \ No newline at end of file diff --git a/libs/microservices/shared/relation-tuple-parser/src/lib/generated/antlr/RelationTuple.tokens b/libs/microservices/shared/relation-tuple-parser/src/lib/generated/antlr/RelationTuple.tokens deleted file mode 100644 index ca9d6732..00000000 --- a/libs/microservices/shared/relation-tuple-parser/src/lib/generated/antlr/RelationTuple.tokens +++ /dev/null @@ -1,12 +0,0 @@ -T__0=1 -T__1=2 -T__2=3 -T__3=4 -T__4=5 -STRING=6 -CHAR=7 -'#'=1 -'@'=2 -':'=3 -'('=4 -')'=5 diff --git a/libs/microservices/shared/relation-tuple-parser/src/lib/generated/antlr/RelationTupleLexer.interp b/libs/microservices/shared/relation-tuple-parser/src/lib/generated/antlr/RelationTupleLexer.interp deleted file mode 100644 index 5121656b..00000000 --- a/libs/microservices/shared/relation-tuple-parser/src/lib/generated/antlr/RelationTupleLexer.interp +++ /dev/null @@ -1,38 +0,0 @@ -token literal names: -null -'#' -'@' -':' -'(' -')' -null -null - -token symbolic names: -null -null -null -null -null -null -STRING -CHAR - -rule names: -T__0 -T__1 -T__2 -T__3 -T__4 -STRING -CHAR - -channel names: -DEFAULT_TOKEN_CHANNEL -HIDDEN - -mode names: -DEFAULT_MODE - -atn: -[4, 0, 7, 32, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 4, 5, 27, 8, 5, 11, 5, 12, 5, 28, 1, 6, 1, 6, 0, 0, 7, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 1, 0, 1, 4, 0, 35, 35, 40, 41, 58, 58, 64, 64, 32, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 1, 15, 1, 0, 0, 0, 3, 17, 1, 0, 0, 0, 5, 19, 1, 0, 0, 0, 7, 21, 1, 0, 0, 0, 9, 23, 1, 0, 0, 0, 11, 26, 1, 0, 0, 0, 13, 30, 1, 0, 0, 0, 15, 16, 5, 35, 0, 0, 16, 2, 1, 0, 0, 0, 17, 18, 5, 64, 0, 0, 18, 4, 1, 0, 0, 0, 19, 20, 5, 58, 0, 0, 20, 6, 1, 0, 0, 0, 21, 22, 5, 40, 0, 0, 22, 8, 1, 0, 0, 0, 23, 24, 5, 41, 0, 0, 24, 10, 1, 0, 0, 0, 25, 27, 3, 13, 6, 0, 26, 25, 1, 0, 0, 0, 27, 28, 1, 0, 0, 0, 28, 26, 1, 0, 0, 0, 28, 29, 1, 0, 0, 0, 29, 12, 1, 0, 0, 0, 30, 31, 8, 0, 0, 0, 31, 14, 1, 0, 0, 0, 2, 0, 28, 0] \ No newline at end of file diff --git a/libs/microservices/shared/relation-tuple-parser/src/lib/generated/antlr/RelationTupleLexer.tokens b/libs/microservices/shared/relation-tuple-parser/src/lib/generated/antlr/RelationTupleLexer.tokens deleted file mode 100644 index ca9d6732..00000000 --- a/libs/microservices/shared/relation-tuple-parser/src/lib/generated/antlr/RelationTupleLexer.tokens +++ /dev/null @@ -1,12 +0,0 @@ -T__0=1 -T__1=2 -T__2=3 -T__3=4 -T__4=5 -STRING=6 -CHAR=7 -'#'=1 -'@'=2 -':'=3 -'('=4 -')'=5 diff --git a/libs/microservices/shared/relation-tuple-parser/src/lib/generated/antlr/RelationTupleLexer.ts b/libs/microservices/shared/relation-tuple-parser/src/lib/generated/antlr/RelationTupleLexer.ts deleted file mode 100644 index 207c46e6..00000000 --- a/libs/microservices/shared/relation-tuple-parser/src/lib/generated/antlr/RelationTupleLexer.ts +++ /dev/null @@ -1,125 +0,0 @@ -// Generated from RelationTuple.g4 by ANTLR 4.13.1 - -import * as antlr from 'antlr4ng'; - -export class RelationTupleLexer extends antlr.Lexer { - public static readonly T__0 = 1; - public static readonly T__1 = 2; - public static readonly T__2 = 3; - public static readonly T__3 = 4; - public static readonly T__4 = 5; - public static readonly STRING = 6; - public static readonly CHAR = 7; - - public static readonly channelNames = ['DEFAULT_TOKEN_CHANNEL', 'HIDDEN']; - - public static readonly literalNames = [ - null, - "'#'", - "'@'", - "':'", - "'('", - "')'", - ]; - - public static readonly symbolicNames = [ - null, - null, - null, - null, - null, - null, - 'STRING', - 'CHAR', - ]; - - public static readonly modeNames = ['DEFAULT_MODE']; - - public static readonly ruleNames = [ - 'T__0', - 'T__1', - 'T__2', - 'T__3', - 'T__4', - 'STRING', - 'CHAR', - ]; - - public constructor(input: antlr.CharStream) { - super(input); - this.interpreter = new antlr.LexerATNSimulator( - this, - RelationTupleLexer._ATN, - RelationTupleLexer.decisionsToDFA, - new antlr.PredictionContextCache(), - ); - } - - public get grammarFileName(): string { - return 'RelationTuple.g4'; - } - - public get literalNames(): (string | null)[] { - return RelationTupleLexer.literalNames; - } - public get symbolicNames(): (string | null)[] { - return RelationTupleLexer.symbolicNames; - } - public get ruleNames(): string[] { - return RelationTupleLexer.ruleNames; - } - - public get serializedATN(): number[] { - return RelationTupleLexer._serializedATN; - } - - public get channelNames(): string[] { - return RelationTupleLexer.channelNames; - } - - public get modeNames(): string[] { - return RelationTupleLexer.modeNames; - } - - public static readonly _serializedATN: number[] = [ - 4, 0, 7, 32, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, - 4, 2, 5, 7, 5, 2, 6, 7, 6, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, - 1, 4, 1, 4, 1, 5, 4, 5, 27, 8, 5, 11, 5, 12, 5, 28, 1, 6, 1, 6, 0, 0, 7, 1, - 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 1, 0, 1, 4, 0, 35, 35, 40, 41, 58, - 58, 64, 64, 32, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, - 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 1, 15, - 1, 0, 0, 0, 3, 17, 1, 0, 0, 0, 5, 19, 1, 0, 0, 0, 7, 21, 1, 0, 0, 0, 9, 23, - 1, 0, 0, 0, 11, 26, 1, 0, 0, 0, 13, 30, 1, 0, 0, 0, 15, 16, 5, 35, 0, 0, 16, - 2, 1, 0, 0, 0, 17, 18, 5, 64, 0, 0, 18, 4, 1, 0, 0, 0, 19, 20, 5, 58, 0, 0, - 20, 6, 1, 0, 0, 0, 21, 22, 5, 40, 0, 0, 22, 8, 1, 0, 0, 0, 23, 24, 5, 41, 0, - 0, 24, 10, 1, 0, 0, 0, 25, 27, 3, 13, 6, 0, 26, 25, 1, 0, 0, 0, 27, 28, 1, - 0, 0, 0, 28, 26, 1, 0, 0, 0, 28, 29, 1, 0, 0, 0, 29, 12, 1, 0, 0, 0, 30, 31, - 8, 0, 0, 0, 31, 14, 1, 0, 0, 0, 2, 0, 28, 0, - ]; - - private static __ATN: antlr.ATN; - public static get _ATN(): antlr.ATN { - if (!RelationTupleLexer.__ATN) { - RelationTupleLexer.__ATN = new antlr.ATNDeserializer().deserialize( - RelationTupleLexer._serializedATN, - ); - } - - return RelationTupleLexer.__ATN; - } - - private static readonly vocabulary = new antlr.Vocabulary( - RelationTupleLexer.literalNames, - RelationTupleLexer.symbolicNames, - [], - ); - - public override get vocabulary(): antlr.Vocabulary { - return RelationTupleLexer.vocabulary; - } - - private static readonly decisionsToDFA = - RelationTupleLexer._ATN.decisionToState.map( - (ds: antlr.DecisionState, index: number) => new antlr.DFA(ds, index), - ); -} diff --git a/libs/microservices/shared/relation-tuple-parser/src/lib/generated/antlr/RelationTupleParser.ts b/libs/microservices/shared/relation-tuple-parser/src/lib/generated/antlr/RelationTupleParser.ts deleted file mode 100644 index 1821cdc1..00000000 --- a/libs/microservices/shared/relation-tuple-parser/src/lib/generated/antlr/RelationTupleParser.ts +++ /dev/null @@ -1,465 +0,0 @@ -// Generated from RelationTuple.g4 by ANTLR 4.13.1 - -import * as antlr from 'antlr4ng'; -import { Token } from 'antlr4ng'; - -import { RelationTupleVisitor } from './RelationTupleVisitor.js'; - -// for running tests with parameters, TODO: discuss strategy for typed parameters in CI -// eslint-disable-next-line no-unused-vars -type int = number; - -export class RelationTupleParser extends antlr.Parser { - public static readonly T__0 = 1; - public static readonly T__1 = 2; - public static readonly T__2 = 3; - public static readonly T__3 = 4; - public static readonly T__4 = 5; - public static readonly STRING = 6; - public static readonly CHAR = 7; - public static readonly RULE_relationTuple = 0; - public static readonly RULE_namespacedObject = 1; - public static readonly RULE_subject = 2; - public static readonly RULE_subjectId = 3; - public static readonly RULE_subjectSet = 4; - - public static readonly literalNames = [ - null, - "'#'", - "'@'", - "':'", - "'('", - "')'", - ]; - - public static readonly symbolicNames = [ - null, - null, - null, - null, - null, - null, - 'STRING', - 'CHAR', - ]; - public static readonly ruleNames = [ - 'relationTuple', - 'namespacedObject', - 'subject', - 'subjectId', - 'subjectSet', - ]; - - public get grammarFileName(): string { - return 'RelationTuple.g4'; - } - public get literalNames(): (string | null)[] { - return RelationTupleParser.literalNames; - } - public get symbolicNames(): (string | null)[] { - return RelationTupleParser.symbolicNames; - } - public get ruleNames(): string[] { - return RelationTupleParser.ruleNames; - } - public get serializedATN(): number[] { - return RelationTupleParser._serializedATN; - } - - protected createFailedPredicateException( - predicate?: string, - message?: string, - ): antlr.FailedPredicateException { - return new antlr.FailedPredicateException(this, predicate, message); - } - - public constructor(input: antlr.TokenStream) { - super(input); - this.interpreter = new antlr.ParserATNSimulator( - this, - RelationTupleParser._ATN, - RelationTupleParser.decisionsToDFA, - new antlr.PredictionContextCache(), - ); - } - public relationTuple(): RelationTupleContext { - let localContext = new RelationTupleContext(this.context, this.state); - this.enterRule(localContext, 0, RelationTupleParser.RULE_relationTuple); - try { - this.enterOuterAlt(localContext, 1); - { - this.state = 10; - this.namespacedObject(); - this.state = 11; - this.match(RelationTupleParser.T__0); - this.state = 12; - localContext._relation = this.match(RelationTupleParser.STRING); - this.state = 13; - this.match(RelationTupleParser.T__1); - this.state = 14; - this.subject(); - this.state = 15; - this.match(RelationTupleParser.EOF); - } - } catch (re) { - if (re instanceof antlr.RecognitionException) { - localContext.exception = re; - this.errorHandler.reportError(this, re); - this.errorHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localContext; - } - public namespacedObject(): NamespacedObjectContext { - let localContext = new NamespacedObjectContext(this.context, this.state); - this.enterRule(localContext, 2, RelationTupleParser.RULE_namespacedObject); - try { - this.enterOuterAlt(localContext, 1); - { - this.state = 17; - localContext._namespace = this.match(RelationTupleParser.STRING); - this.state = 18; - this.match(RelationTupleParser.T__2); - this.state = 19; - localContext._object = this.match(RelationTupleParser.STRING); - } - } catch (re) { - if (re instanceof antlr.RecognitionException) { - localContext.exception = re; - this.errorHandler.reportError(this, re); - this.errorHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localContext; - } - public subject(): SubjectContext { - let localContext = new SubjectContext(this.context, this.state); - this.enterRule(localContext, 4, RelationTupleParser.RULE_subject); - try { - this.state = 31; - this.errorHandler.sync(this); - switch ( - this.interpreter.adaptivePredict(this.tokenStream, 0, this.context) - ) { - case 1: - this.enterOuterAlt(localContext, 1); - { - this.state = 21; - this.subjectId(); - } - break; - case 2: - this.enterOuterAlt(localContext, 2); - { - this.state = 22; - this.subjectSet(); - } - break; - case 3: - this.enterOuterAlt(localContext, 3); - { - this.state = 23; - this.match(RelationTupleParser.T__3); - this.state = 24; - this.subjectId(); - this.state = 25; - this.match(RelationTupleParser.T__4); - } - break; - case 4: - this.enterOuterAlt(localContext, 4); - { - this.state = 27; - this.match(RelationTupleParser.T__3); - this.state = 28; - this.subjectSet(); - this.state = 29; - this.match(RelationTupleParser.T__4); - } - break; - } - } catch (re) { - if (re instanceof antlr.RecognitionException) { - localContext.exception = re; - this.errorHandler.reportError(this, re); - this.errorHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localContext; - } - public subjectId(): SubjectIdContext { - let localContext = new SubjectIdContext(this.context, this.state); - this.enterRule(localContext, 6, RelationTupleParser.RULE_subjectId); - try { - this.enterOuterAlt(localContext, 1); - { - this.state = 33; - this.match(RelationTupleParser.STRING); - } - } catch (re) { - if (re instanceof antlr.RecognitionException) { - localContext.exception = re; - this.errorHandler.reportError(this, re); - this.errorHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localContext; - } - public subjectSet(): SubjectSetContext { - let localContext = new SubjectSetContext(this.context, this.state); - this.enterRule(localContext, 8, RelationTupleParser.RULE_subjectSet); - let _la: number; - try { - this.state = 41; - this.errorHandler.sync(this); - switch ( - this.interpreter.adaptivePredict(this.tokenStream, 2, this.context) - ) { - case 1: - this.enterOuterAlt(localContext, 1); - { - this.state = 35; - this.namespacedObject(); - this.state = 36; - this.match(RelationTupleParser.T__0); - this.state = 38; - this.errorHandler.sync(this); - _la = this.tokenStream.LA(1); - if (_la === 6) { - { - this.state = 37; - localContext._subjectRelation = this.match( - RelationTupleParser.STRING, - ); - } - } - } - break; - case 2: - this.enterOuterAlt(localContext, 2); - { - this.state = 40; - this.namespacedObject(); - } - break; - } - } catch (re) { - if (re instanceof antlr.RecognitionException) { - localContext.exception = re; - this.errorHandler.reportError(this, re); - this.errorHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localContext; - } - - public static readonly _serializedATN: number[] = [ - 4, 1, 7, 44, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 1, - 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 32, 8, 2, 1, 3, 1, 3, - 1, 4, 1, 4, 1, 4, 3, 4, 39, 8, 4, 1, 4, 3, 4, 42, 8, 4, 1, 4, 0, 0, 5, 0, 2, - 4, 6, 8, 0, 0, 43, 0, 10, 1, 0, 0, 0, 2, 17, 1, 0, 0, 0, 4, 31, 1, 0, 0, 0, - 6, 33, 1, 0, 0, 0, 8, 41, 1, 0, 0, 0, 10, 11, 3, 2, 1, 0, 11, 12, 5, 1, 0, - 0, 12, 13, 5, 6, 0, 0, 13, 14, 5, 2, 0, 0, 14, 15, 3, 4, 2, 0, 15, 16, 5, 0, - 0, 1, 16, 1, 1, 0, 0, 0, 17, 18, 5, 6, 0, 0, 18, 19, 5, 3, 0, 0, 19, 20, 5, - 6, 0, 0, 20, 3, 1, 0, 0, 0, 21, 32, 3, 6, 3, 0, 22, 32, 3, 8, 4, 0, 23, 24, - 5, 4, 0, 0, 24, 25, 3, 6, 3, 0, 25, 26, 5, 5, 0, 0, 26, 32, 1, 0, 0, 0, 27, - 28, 5, 4, 0, 0, 28, 29, 3, 8, 4, 0, 29, 30, 5, 5, 0, 0, 30, 32, 1, 0, 0, 0, - 31, 21, 1, 0, 0, 0, 31, 22, 1, 0, 0, 0, 31, 23, 1, 0, 0, 0, 31, 27, 1, 0, 0, - 0, 32, 5, 1, 0, 0, 0, 33, 34, 5, 6, 0, 0, 34, 7, 1, 0, 0, 0, 35, 36, 3, 2, - 1, 0, 36, 38, 5, 1, 0, 0, 37, 39, 5, 6, 0, 0, 38, 37, 1, 0, 0, 0, 38, 39, 1, - 0, 0, 0, 39, 42, 1, 0, 0, 0, 40, 42, 3, 2, 1, 0, 41, 35, 1, 0, 0, 0, 41, 40, - 1, 0, 0, 0, 42, 9, 1, 0, 0, 0, 3, 31, 38, 41, - ]; - - private static __ATN: antlr.ATN; - public static get _ATN(): antlr.ATN { - if (!RelationTupleParser.__ATN) { - RelationTupleParser.__ATN = new antlr.ATNDeserializer().deserialize( - RelationTupleParser._serializedATN, - ); - } - - return RelationTupleParser.__ATN; - } - - private static readonly vocabulary = new antlr.Vocabulary( - RelationTupleParser.literalNames, - RelationTupleParser.symbolicNames, - [], - ); - - public override get vocabulary(): antlr.Vocabulary { - return RelationTupleParser.vocabulary; - } - - private static readonly decisionsToDFA = - RelationTupleParser._ATN.decisionToState.map( - (ds: antlr.DecisionState, index: number) => new antlr.DFA(ds, index), - ); -} - -export class RelationTupleContext extends antlr.ParserRuleContext { - public _relation?: Token | null; - public constructor( - parent: antlr.ParserRuleContext | null, - invokingState: number, - ) { - super(parent, invokingState); - } - public namespacedObject(): NamespacedObjectContext { - return this.getRuleContext(0, NamespacedObjectContext)!; - } - public subject(): SubjectContext { - return this.getRuleContext(0, SubjectContext)!; - } - public EOF(): antlr.TerminalNode { - return this.getToken(RelationTupleParser.EOF, 0)!; - } - public STRING(): antlr.TerminalNode { - return this.getToken(RelationTupleParser.STRING, 0)!; - } - public override get ruleIndex(): number { - return RelationTupleParser.RULE_relationTuple; - } - public override accept( - visitor: RelationTupleVisitor, - ): Result | null { - if (visitor.visitRelationTuple) { - return visitor.visitRelationTuple(this); - } else { - return visitor.visitChildren(this); - } - } -} - -export class NamespacedObjectContext extends antlr.ParserRuleContext { - public _namespace?: Token | null; - public _object?: Token | null; - public constructor( - parent: antlr.ParserRuleContext | null, - invokingState: number, - ) { - super(parent, invokingState); - } - public STRING(): antlr.TerminalNode[]; - public STRING(i: number): antlr.TerminalNode | null; - public STRING(i?: number): antlr.TerminalNode | null | antlr.TerminalNode[] { - if (i === undefined) { - return this.getTokens(RelationTupleParser.STRING); - } else { - return this.getToken(RelationTupleParser.STRING, i); - } - } - public override get ruleIndex(): number { - return RelationTupleParser.RULE_namespacedObject; - } - public override accept( - visitor: RelationTupleVisitor, - ): Result | null { - if (visitor.visitNamespacedObject) { - return visitor.visitNamespacedObject(this); - } else { - return visitor.visitChildren(this); - } - } -} - -export class SubjectContext extends antlr.ParserRuleContext { - public constructor( - parent: antlr.ParserRuleContext | null, - invokingState: number, - ) { - super(parent, invokingState); - } - public subjectId(): SubjectIdContext | null { - return this.getRuleContext(0, SubjectIdContext); - } - public subjectSet(): SubjectSetContext | null { - return this.getRuleContext(0, SubjectSetContext); - } - public override get ruleIndex(): number { - return RelationTupleParser.RULE_subject; - } - public override accept( - visitor: RelationTupleVisitor, - ): Result | null { - if (visitor.visitSubject) { - return visitor.visitSubject(this); - } else { - return visitor.visitChildren(this); - } - } -} - -export class SubjectIdContext extends antlr.ParserRuleContext { - public constructor( - parent: antlr.ParserRuleContext | null, - invokingState: number, - ) { - super(parent, invokingState); - } - public STRING(): antlr.TerminalNode { - return this.getToken(RelationTupleParser.STRING, 0)!; - } - public override get ruleIndex(): number { - return RelationTupleParser.RULE_subjectId; - } - public override accept( - visitor: RelationTupleVisitor, - ): Result | null { - if (visitor.visitSubjectId) { - return visitor.visitSubjectId(this); - } else { - return visitor.visitChildren(this); - } - } -} - -export class SubjectSetContext extends antlr.ParserRuleContext { - public _subjectRelation?: Token | null; - public constructor( - parent: antlr.ParserRuleContext | null, - invokingState: number, - ) { - super(parent, invokingState); - } - public namespacedObject(): NamespacedObjectContext { - return this.getRuleContext(0, NamespacedObjectContext)!; - } - public STRING(): antlr.TerminalNode | null { - return this.getToken(RelationTupleParser.STRING, 0); - } - public override get ruleIndex(): number { - return RelationTupleParser.RULE_subjectSet; - } - public override accept( - visitor: RelationTupleVisitor, - ): Result | null { - if (visitor.visitSubjectSet) { - return visitor.visitSubjectSet(this); - } else { - return visitor.visitChildren(this); - } - } -} diff --git a/libs/microservices/shared/relation-tuple-parser/src/lib/generated/antlr/RelationTupleVisitor.ts b/libs/microservices/shared/relation-tuple-parser/src/lib/generated/antlr/RelationTupleVisitor.ts deleted file mode 100644 index 1e9f1ecb..00000000 --- a/libs/microservices/shared/relation-tuple-parser/src/lib/generated/antlr/RelationTupleVisitor.ts +++ /dev/null @@ -1,51 +0,0 @@ -// Generated from RelationTuple.g4 by ANTLR 4.13.1 - -import { AbstractParseTreeVisitor } from 'antlr4ng'; - -import { RelationTupleContext } from './RelationTupleParser.js'; -import { NamespacedObjectContext } from './RelationTupleParser.js'; -import { SubjectContext } from './RelationTupleParser.js'; -import { SubjectIdContext } from './RelationTupleParser.js'; -import { SubjectSetContext } from './RelationTupleParser.js'; - -/** - * This interface defines a complete generic visitor for a parse tree produced - * by `RelationTupleParser`. - * - * @param The return type of the visit operation. Use `void` for - * operations with no return type. - */ -export class RelationTupleVisitor< - Result, -> extends AbstractParseTreeVisitor { - /** - * Visit a parse tree produced by `RelationTupleParser.relationTuple`. - * @param ctx the parse tree - * @return the visitor result - */ - visitRelationTuple?: (ctx: RelationTupleContext) => Result; - /** - * Visit a parse tree produced by `RelationTupleParser.namespacedObject`. - * @param ctx the parse tree - * @return the visitor result - */ - visitNamespacedObject?: (ctx: NamespacedObjectContext) => Result; - /** - * Visit a parse tree produced by `RelationTupleParser.subject`. - * @param ctx the parse tree - * @return the visitor result - */ - visitSubject?: (ctx: SubjectContext) => Result; - /** - * Visit a parse tree produced by `RelationTupleParser.subjectId`. - * @param ctx the parse tree - * @return the visitor result - */ - visitSubjectId?: (ctx: SubjectIdContext) => Result; - /** - * Visit a parse tree produced by `RelationTupleParser.subjectSet`. - * @param ctx the parse tree - * @return the visitor result - */ - visitSubjectSet?: (ctx: SubjectSetContext) => Result; -} diff --git a/libs/microservices/shared/relation-tuple-parser/src/lib/is-relation-tuple.ts b/libs/microservices/shared/relation-tuple-parser/src/lib/is-relation-tuple.ts deleted file mode 100644 index 21d80aab..00000000 --- a/libs/microservices/shared/relation-tuple-parser/src/lib/is-relation-tuple.ts +++ /dev/null @@ -1,33 +0,0 @@ -import type { - RelationTupleWithReplacements, - ReplacementValues, -} from '../index.js'; -import type { RelationTuple } from './relation-tuple.js'; - -export function isRelationTuple(x: unknown): x is RelationTuple { - return ( - typeof x === 'object' && - x != null && - 'namespace' in x && - typeof x.namespace === 'string' && - 'object' in x && - typeof x.object === 'string' && - 'relation' in x && - typeof x.relation === 'string' - ); -} - -export function isRelationTupleWithReplacements( - x: unknown, -): x is RelationTupleWithReplacements { - return ( - typeof x === 'object' && - x != null && - 'namespace' in x && - typeof x.namespace === 'function' && - 'object' in x && - typeof x.object === 'function' && - 'relation' in x && - typeof x.relation === 'function' - ); -} diff --git a/libs/microservices/shared/relation-tuple-parser/src/lib/relation-tuple-antlr.ts b/libs/microservices/shared/relation-tuple-parser/src/lib/relation-tuple-antlr.ts deleted file mode 100644 index 688d7e6a..00000000 --- a/libs/microservices/shared/relation-tuple-parser/src/lib/relation-tuple-antlr.ts +++ /dev/null @@ -1,129 +0,0 @@ -import { - AbstractParseTreeVisitor, - ANTLRErrorListener, - Recognizer, - Token, -} from 'antlr4ng'; - -import { - RelationTupleSyntaxError, - RelationTupleSyntaxErrorDetail, -} from './errors/relation-tuple-syntax.error.js'; -import { - NamespacedObjectContext, - RelationTupleContext, - SubjectIdContext, - SubjectSetContext, -} from './generated/antlr/RelationTupleParser.js'; -import { RelationTupleVisitor } from './generated/antlr/RelationTupleVisitor.js'; -import { RelationTuple } from './relation-tuple.js'; - -const DEFAULT_TUPLE: RelationTuple = { - namespace: '', - object: '', - relation: '', - subjectIdOrSet: '', -}; - -export class MyRelationTupleVisitor - extends AbstractParseTreeVisitor - implements RelationTupleVisitor -{ - protected override defaultResult(): RelationTuple { - return { - namespace: '', - object: '', - relation: '', - } as RelationTuple; - } - - override aggregateResult( - aggregate: RelationTuple, - nextResult: RelationTuple, - ): RelationTuple { - Object.assign(aggregate, nextResult); - return aggregate; - } - - visitRelationTuple(ctx: RelationTupleContext): RelationTuple { - const aggregate = this.visitChildren(ctx) ?? DEFAULT_TUPLE; - const namespacedObjectContext = ctx.namespacedObject(); - - aggregate.relation = ctx._relation?.text ?? ''; - aggregate.namespace = namespacedObjectContext._namespace?.text ?? ''; - aggregate.object = namespacedObjectContext._object?.text ?? ''; - - return aggregate; - } - - visitSubjectId(ctx: SubjectIdContext): RelationTuple { - const aggregate = this.visitChildren(ctx) ?? DEFAULT_TUPLE; - aggregate.subjectIdOrSet = ctx?.getText(); - // aggregate.subjectIdOrSet = ctx.text - - return aggregate; - } - - visitSubjectSet(ctx: SubjectSetContext): RelationTuple { - const aggregate = this.visitChildren(ctx) ?? DEFAULT_TUPLE; - - let namespacedObjectContext: NamespacedObjectContext; - try { - namespacedObjectContext = ctx.namespacedObject(); - } catch (e) { - throw new RelationTupleSyntaxError( - `Expected SubjectSet to contain an namespaced object`, - ); - } - - const subjectIdOrSet: RelationTuple['subjectIdOrSet'] = { - namespace: namespacedObjectContext._namespace?.text ?? '', - object: namespacedObjectContext._object?.text ?? '', - }; - if (ctx._subjectRelation?.text != null) { - subjectIdOrSet.relation = ctx._subjectRelation.text; - } - - aggregate.subjectIdOrSet = subjectIdOrSet; - - return aggregate; - } -} - -export class MyParserErrorListener implements ANTLRErrorListener { - private _errors: Array = []; - public get errors(): Array { - return this._errors; - } - - constructor(private readonly wholeInput: string) {} - - syntaxError( - // eslint-disable-next-line @typescript-eslint/no-explicit-any - recognizer: Recognizer, - offendingSymbol: Token | null, - line: number, - charPositionInLine: number, - ): void { - const errorDetail = { - wholeInput: this.wholeInput, - line, - charPositionInLine, - offendingSymbol: offendingSymbol?.text ?? undefined, - }; - - this._errors.push(errorDetail); - } - - reportAmbiguity(): void { - throw new Error('Method not implemented.'); - } - - reportAttemptingFullContext(): void { - throw new Error('Method not implemented.'); - } - - reportContextSensitivity(): void { - throw new Error('Method not implemented.'); - } -} diff --git a/libs/microservices/shared/relation-tuple-parser/src/lib/relation-tuple-parser.spec.ts b/libs/microservices/shared/relation-tuple-parser/src/lib/relation-tuple-parser.spec.ts deleted file mode 100644 index b88cb310..00000000 --- a/libs/microservices/shared/relation-tuple-parser/src/lib/relation-tuple-parser.spec.ts +++ /dev/null @@ -1,336 +0,0 @@ -/* eslint-disable max-nested-callbacks */ -/* eslint-disable max-lines-per-function */ -import { RelationTuple } from './relation-tuple.js'; -import { - parseRelationTuple, - parseRelationTupleString, - relationTupleToString, -} from './relation-tuple-parser.js'; - -function fail(reason = 'fail was called in a test.'): void { - throw new Error(reason); -} - -function nsToMs(ns: bigint): bigint; -function nsToMs(ns: number): number; -function nsToMs(ns: bigint | number): bigint | number { - if (typeof ns === 'bigint') { - return ns / BigInt(1_000_000); - } else { - return ns / 1_000_000; - } -} - -const generateRelationTuple = (i: number, withSubjectSet: boolean): string => { - const uuidLengthString = String(i).repeat(36); - const subjectSet = `${uuidLengthString}:${uuidLengthString}#${uuidLengthString}`; - - if (withSubjectSet) { - return `${subjectSet}@${subjectSet}`; - } - return `${subjectSet}@${uuidLengthString}`; -}; - -describe('parseRelationTuple tests', () => { - describe(`parses valid RelationTuples`, () => { - const testCases: [string, RelationTuple][] = [ - [ - 'namespace:object#relation@subject', - { - namespace: 'namespace', - object: 'object', - relation: 'relation', - subjectIdOrSet: 'subject', - } as RelationTuple, - ], - [ - ' namespace:object#relation@subject ', - { - namespace: 'namespace', - object: 'object', - relation: 'relation', - subjectIdOrSet: 'subject', - } as RelationTuple, - ], - [ - 'namespace:object#relation@(subject)', - { - namespace: 'namespace', - object: 'object', - relation: 'relation', - subjectIdOrSet: 'subject', - } as RelationTuple, - ], - [ - 'namespace:object#relation@subjectNamespace:subjectObject#subjectRelation', - { - namespace: 'namespace', - object: 'object', - relation: 'relation', - subjectIdOrSet: { - namespace: 'subjectNamespace', - object: 'subjectObject', - relation: 'subjectRelation', - }, - } as RelationTuple, - ], - [ - ' namespace:object#relation@subjectNamespace:subjectObject#subjectRelation ', - { - namespace: 'namespace', - object: 'object', - relation: 'relation', - subjectIdOrSet: { - namespace: 'subjectNamespace', - object: 'subjectObject', - relation: 'subjectRelation', - }, - } as RelationTuple, - ], - [ - 'namespace:object#relation@(subjectNamespace:subjectObject#subjectRelation)', - { - namespace: 'namespace', - object: 'object', - relation: 'relation', - subjectIdOrSet: { - namespace: 'subjectNamespace', - object: 'subjectObject', - relation: 'subjectRelation', - }, - } as RelationTuple, - ], - [ - 'namespace:object#relation@(subjectNamespace:subjectObject)', - { - namespace: 'namespace', - object: 'object', - relation: 'relation', - subjectIdOrSet: { - namespace: 'subjectNamespace', - object: 'subjectObject', - }, - } as RelationTuple, - ], - [ - 'namespace:object#relation@(subjectNamespace:subjectObject#)', - { - namespace: 'namespace', - object: 'object', - relation: 'relation', - subjectIdOrSet: { - namespace: 'subjectNamespace', - object: 'subjectObject', - }, - } as RelationTuple, - ], - ]; - it.each(testCases)('%s', (str, expectedRelationTuple) => { - const result = parseRelationTuple(str); - - expect(result.unwrapOrThrow()).toEqual(expectedRelationTuple); - }); - }); - - describe('performance tests', () => { - describe('parseRelationTuple', () => { - it('with subject', () => { - const relationTuples = Array.from({ length: 100 }, (_, i) => - generateRelationTuple(i, false), - ); - - const result = relationTuples.map((tuple) => { - const start = process.hrtime.bigint(); - const res = parseRelationTuple(tuple); - const end = process.hrtime.bigint(); - - expect(res.unwrapOrThrow()).toBeDefined(); - - return end - start; - }); - - const sumInNs = Number(result.reduce((a, b) => a + b, BigInt(0))); - const avgInNs = Number(sumInNs) / result.length; - - const sumInMs = nsToMs(sumInNs); - const avgInMs = nsToMs(avgInNs); - - console.info( - `performance tests :: with subject :: Execution for ${result.length} elements took: ${sumInMs}ms (avg: ${avgInMs}ms)`, - ); - - const expectation = process.env['CI'] ? 1.5 : 0.5; - expect(avgInMs).toBeLessThan(expectation); - }); - - it('with subjectSet', () => { - const relationTuples = Array.from({ length: 100 }, (_, i) => - generateRelationTuple(i, true), - ); - - const result = relationTuples.map((tuple) => { - const start = process.hrtime.bigint(); - const res = parseRelationTuple(tuple); - const end = process.hrtime.bigint(); - - expect(res.unwrapOrThrow()).toBeDefined(); - - return end - start; - }); - - const sumInNs = Number(result.reduce((a, b) => a + b, BigInt(0))); - const avgInNs = Number(sumInNs) / result.length; - - const sumInMs = nsToMs(sumInNs); - const avgInMs = nsToMs(avgInNs); - - console.info( - `performance tests :: with subjectSet :: Execution for ${result.length} elements took: ${sumInMs}ms (avg: ${avgInMs}ms)`, - ); - - const expectation = process.env['CI'] ? 1.5 : 0.5; - expect(avgInMs).toBeLessThan(expectation); - }); - }); - - describe('parseRelationTupleString', () => { - it('with subject', () => { - const relationTuples = Array.from({ length: 100 }, (_, i) => - generateRelationTuple(i, false), - ); - - const result = relationTuples.map((tuple) => { - const start = process.hrtime.bigint(); - const res = parseRelationTupleString(tuple); - const end = process.hrtime.bigint(); - - expect(res.unwrapOrThrow()).toBeDefined(); - - return end - start; - }); - - const sumInNs = Number(result.reduce((a, b) => a + b, BigInt(0))); - const avgInNs = Number(sumInNs) / result.length; - - const sumInMs = nsToMs(sumInNs); - const avgInMs = nsToMs(avgInNs); - - console.info( - `performance tests :: with subject :: Execution for ${result.length} elements took: ${sumInMs}ms (avg: ${avgInMs}ms)`, - ); - - expect(avgInMs).toBeLessThan(0.5); - }); - - it('with subjectSet', () => { - const relationTuples = Array.from({ length: 100 }, (_, i) => - generateRelationTuple(i, true), - ); - - const result = relationTuples.map((tuple) => { - const start = process.hrtime.bigint(); - const res = parseRelationTupleString(tuple); - const end = process.hrtime.bigint(); - - expect(res.unwrapOrThrow()).toBeDefined(); - - return end - start; - }); - - const sumInNs = Number(result.reduce((a, b) => a + b, BigInt(0))); - const avgInNs = Number(sumInNs) / result.length; - - const sumInMs = nsToMs(sumInNs); - const avgInMs = nsToMs(avgInNs); - - console.info( - `performance tests :: with subjectSet :: Execution for ${result.length} elements took: ${sumInMs}ms (avg: ${avgInMs}ms)`, - ); - - expect(avgInMs).toBeLessThan(0.7); - }); - }); - }); - - describe('rejects wrong syntax', () => { - it.each([ - ['asdfhg'], - ['object#relation'], - ['object@subject'], - ['object#relation@subject@sdf'], - ['object#relation@subjectObject#relation@sdf'], - ['object#relation@subjectObject#relation'], - ['namespace:object#relation@subjectObject#relation'], - ['object#relation@namespace:subjectObject#relation'], - ['object#relation@subjectId'], - ['namespace:object#@subjectId'], - ['namespace:#relation@subjectId'], - [':object#relation@subjectId'], - ['namespace:object#relation@'], - ['namespace:object#relation@:subjectObject#relation'], - ['namespace:object#relation@namespace:#relation'], - ['namespace:object#relation@id:'], - ['namespace::object#relation@id'], - ['namespace:object##relation@id'], - ['namespace:object#relation@@id'], - ])('%s', (str) => { - const result = parseRelationTuple(str); - - if (result.hasValue()) { - console.warn(`Result has value: `, result.value); - - fail( - `Expected result to contain an error but got a value: \n${JSON.stringify( - result.value, - undefined, - 2, - )}`, - ); - } - }); - }); -}); - -describe('relationTupleToString tests', () => { - const testCases: [RelationTuple, string][] = [ - [ - { - namespace: 'namespace', - object: 'object', - relation: 'relation', - subjectIdOrSet: 'subject', - }, - 'namespace:object#relation@subject', - ], - [ - { - namespace: 'namespace', - object: 'object', - relation: 'relation', - subjectIdOrSet: { - namespace: 'subjectNamespace', - object: 'subjectObject', - relation: 'subjectRelation', - }, - }, - 'namespace:object#relation@subjectNamespace:subjectObject#subjectRelation', - ], - [ - { - namespace: 'namespace', - object: 'object', - relation: 'relation', - subjectIdOrSet: { - namespace: 'subjectNamespace', - object: 'subjectObject', - }, - }, - 'namespace:object#relation@subjectNamespace:subjectObject', - ], - ]; - it.each(testCases)('%s', (relationTuple, expectedString) => { - const result = relationTupleToString(relationTuple); - - expect(result).toEqual(expectedString); - }); -}); diff --git a/libs/microservices/shared/relation-tuple-parser/src/lib/relation-tuple-parser.ts b/libs/microservices/shared/relation-tuple-parser/src/lib/relation-tuple-parser.ts deleted file mode 100644 index 8dcd5441..00000000 --- a/libs/microservices/shared/relation-tuple-parser/src/lib/relation-tuple-parser.ts +++ /dev/null @@ -1,164 +0,0 @@ -import { CharStreams, CommonTokenStream } from 'antlr4ng'; -import { error, Result, value } from 'defekt'; - -import { RelationTupleSyntaxError } from './errors/relation-tuple-syntax.error.js'; -import { UnknownError } from './errors/unknown.error.js'; -import { RelationTupleLexer } from './generated/antlr/RelationTupleLexer.js'; -import { RelationTupleParser } from './generated/antlr/RelationTupleParser.js'; -import { RelationTuple } from './relation-tuple.js'; -import { - MyParserErrorListener, - MyRelationTupleVisitor, -} from './relation-tuple-antlr.js'; - -/** - * Parses the given string to a {@link RelationTuple}. - * str syntax: - * ``` - * ::= '#'relation'@' | '#'relation'@('')' - * ::= namespace':'object_id - * ::= subject_id | - * ::= '#'relation - * ``` - * example: `object#relation@subject` - * The characters `:@#()` are reserved for syntax use only (=> forbidden in values) - * - * @param str - * @return The parsed {@link RelationTuple} or {@link RelationTupleSyntaxError} in case of an invalid string. - */ -export const parseRelationTuple = ( - str: string, -): Result => { - const trimmedStr = str.trim(); - - const inputStream = CharStreams.fromString(trimmedStr); - const lexer = new RelationTupleLexer(inputStream); - const tokenStream = new CommonTokenStream(lexer); - const parser = new RelationTupleParser(tokenStream); - - const parserErrorListener = new MyParserErrorListener(trimmedStr); - - parser.removeErrorListeners(); - parser.addErrorListener(parserErrorListener); - const visitor = new MyRelationTupleVisitor(); - try { - const parsedRelationTuple = visitor.visit(parser.relationTuple()); - - if (!parsedRelationTuple || parserErrorListener.errors.length > 0) { - return error( - new RelationTupleSyntaxError({ - data: { errors: parserErrorListener.errors }, - }), - ); - } - - return value(parsedRelationTuple); - } catch (e) { - if (e instanceof RelationTupleSyntaxError) { - return error(e); - } - return error(new UnknownError({ data: e })); - } -}; - -type Namespace = string; -type TupleObject = string; -type Relation = string; -type SubjectId = string; -type SubjectNamespace = string; -type SubjectObject = string; -type SubjectRelation = string; - -type RelationTupleString = - | `${Namespace}` - | `${Namespace}:${TupleObject}` - | `${Namespace}:${TupleObject}#${Relation}` - | `${Namespace}:${TupleObject}#${Relation}@${SubjectId}` - | `${Namespace}:${TupleObject}#${Relation}@${SubjectNamespace}:${SubjectObject}` - | `${Namespace}:${TupleObject}#${Relation}@${SubjectNamespace}:${SubjectObject}#${SubjectRelation}` - | `${Namespace}:${TupleObject}#${Relation}@(${SubjectId})` - | `${Namespace}:${TupleObject}#${Relation}@(${SubjectNamespace}:${SubjectObject})` - | `${Namespace}:${TupleObject}#${Relation}@(${SubjectNamespace}:${SubjectObject}#${SubjectRelation})`; - -/** - * @description use Regex to parse a string into a RelationTuple instead of using antlr - * @warn regex does not handle parentheses in subject parts - **/ -export function parseRelationTupleString( - input: string, -): Result { - const regex = - /^([^:]+)(?::([^#]+))?(?:#([^@]+)(?:@([^:]+)(?::([^#]+))?(?:#([^()]+(?:\([^()]+\))?)?)?)?)?$/; - const match = input.match(regex); - - if (!match) { - return error( - new RelationTupleSyntaxError({ - data: { - errors: [ - { - wholeInput: input, - line: 1, - charPositionInLine: 0, - }, - ], - }, - }), - ); - } - - const [ - , - namespace, - object, - relation, - idOrNamespace, - subjectObject, - subjectRelation, - ] = match; - - try { - const result: RelationTuple = { - namespace, - object, - relation, - subjectIdOrSet: '', - }; - - if (subjectRelation) { - result.subjectIdOrSet = { - namespace: idOrNamespace || '', - object: subjectObject || '', - relation: subjectRelation, - }; - } else if (subjectObject) { - result.subjectIdOrSet = { - namespace: idOrNamespace || '', - object: subjectObject, - }; - } else if (idOrNamespace) { - result.subjectIdOrSet = idOrNamespace; - } - - return value(result); - } catch (e) { - return error(new UnknownError({ data: e })); - } -} - -export const relationTupleToString = ( - tuple: Partial, -): RelationTupleString => { - const base: `${string}:${string}#${string}` = `${tuple.namespace}:${tuple.object}#${tuple.relation}`; - if (!tuple.subjectIdOrSet) { - return base; - } - if (typeof tuple.subjectIdOrSet === 'string') { - return `${base}@${tuple.subjectIdOrSet}`; - } - const { namespace, object, relation } = tuple.subjectIdOrSet; - if (!relation) { - return `${base}@${namespace}:${object}`; - } - return `${base}@${namespace}:${object}#${relation}`; -}; diff --git a/libs/microservices/shared/relation-tuple-parser/src/lib/relation-tuple.ts b/libs/microservices/shared/relation-tuple-parser/src/lib/relation-tuple.ts deleted file mode 100644 index d772937a..00000000 --- a/libs/microservices/shared/relation-tuple-parser/src/lib/relation-tuple.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { relationTupleToString } from './relation-tuple-parser.js'; - -export class SubjectSet { - namespace: string; - object: string; - relation?: string; - constructor(namespace: string, object: string, relation?: string) { - this.namespace = namespace; - this.object = object; - this.relation = relation; - } -} - -export class RelationTuple { - namespace: string; - object: string; - relation: string; - subjectIdOrSet: string | SubjectSet; - constructor( - namespace: string, - object: string, - relation: string, - subjectIdOrSet: string | SubjectSet, - ) { - this.namespace = namespace; - this.object = object; - this.relation = relation; - this.subjectIdOrSet = subjectIdOrSet; - } - - toString(): string { - return relationTupleToString(this); - } -} diff --git a/libs/microservices/shared/relation-tuple-parser/src/lib/util/access-to-path-proxy.spec.ts b/libs/microservices/shared/relation-tuple-parser/src/lib/util/access-to-path-proxy.spec.ts deleted file mode 100644 index 8672f601..00000000 --- a/libs/microservices/shared/relation-tuple-parser/src/lib/util/access-to-path-proxy.spec.ts +++ /dev/null @@ -1,143 +0,0 @@ -/* eslint-disable max-nested-callbacks */ -/* eslint-disable max-lines-per-function */ -import { createAccessToPathProxy } from './access-to-path-proxy.js'; - -describe('AccessToPathProxy tests', () => { - describe('test different conversions', () => { - it(`String(proxy.a)`, () => { - type MyType = { - a: string; - }; - const proxy = createAccessToPathProxy((path) => path.join('.')); - - expect(String(proxy.a)).toEqual('a'); - }); - - it(`'' + proxy.a`, () => { - type MyType = { - a: string; - }; - const proxy = createAccessToPathProxy((path) => path.join('.')); - - expect('' + proxy.a).toEqual('a'); - }); - - it(`\`\${proxy.a}\``, () => { - type MyType = { - a: string; - }; - const proxy = createAccessToPathProxy((path) => path.join('.')); - - expect(`${proxy.a}`).toEqual('a'); - }); - }); - - describe('in string template', () => { - it(`create simple path`, () => { - type MyType = { - a: string; - }; - const proxy = createAccessToPathProxy((path) => path.join('.')); - - expect(`${proxy.a}`).toEqual('a'); - }); - - it(`create simple path; multiple on root-layer`, () => { - type MyType = { - a: string; - b: string; - }; - const proxy = createAccessToPathProxy((path) => path.join('.')); - - expect(`${proxy.a}`).toEqual('a'); - expect(`${proxy.b}`).toEqual('b'); - }); - - it(`create nested path`, () => { - type MyType = { - nest: { - a: string; - }; - }; - const proxy = createAccessToPathProxy((path) => path.join('.')); - - expect(`${proxy.nest.a}`).toEqual('nest.a'); - }); - - it(`create nested path; multiple on layer 1`, () => { - type MyType = { - nest: { - a: string; - b: string; - }; - }; - const proxy = createAccessToPathProxy((path) => path.join('.')); - - expect(`${proxy.nest.a}`).toEqual('nest.a'); - expect(`${proxy.nest.b}`).toEqual('nest.b'); - }); - - it(`create multiple layers nested path`, () => { - type MyType = { - nest: { - nest: { - nest: { - nest: { - a: string; - }; - }; - }; - }; - }; - const proxy = createAccessToPathProxy((path) => path.join('.')); - - expect(`${proxy.nest.nest.nest.nest.a}`).toEqual('nest.nest.nest.nest.a'); - }); - - it(`create multiple layers nested path; multiple on layer 4`, () => { - type MyType = { - nest: { - nest: { - nest: { - nest: { - a: string; - b: string; - }; - }; - }; - }; - }; - const proxy = createAccessToPathProxy((path) => path.join('.')); - - expect(`${proxy.nest.nest.nest.nest.a}`).toEqual('nest.nest.nest.nest.a'); - expect(`${proxy.nest.nest.nest.nest.b}`).toEqual('nest.nest.nest.nest.b'); - }); - - it(`random layers`, () => { - type MyType = { - object: { - namespace: string; - object: string; - }; - relation: string; - nest: { - nest: { - subject: string; - }; - }; - }; - - const proxy = createAccessToPathProxy((path) => path.join('.')); - - expect(`${proxy.object.namespace}`).toEqual('object.namespace'); - expect(`${proxy.object.object}`).toEqual('object.object'); - expect(`${proxy.relation}`).toEqual('relation'); - expect(`${proxy.nest.nest.subject}`).toEqual('nest.nest.subject'); - - const { object, relation, nest } = proxy; - expect( - `${object.namespace}:${object.object}#${relation}@${nest.nest.subject}`, - ).toEqual('object.namespace:object.object#relation@nest.nest.subject'); - }); - }); -}); diff --git a/libs/microservices/shared/relation-tuple-parser/src/lib/util/access-to-path-proxy.ts b/libs/microservices/shared/relation-tuple-parser/src/lib/util/access-to-path-proxy.ts deleted file mode 100644 index 9f2e3647..00000000 --- a/libs/microservices/shared/relation-tuple-parser/src/lib/util/access-to-path-proxy.ts +++ /dev/null @@ -1,48 +0,0 @@ -const InternalValues = Symbol('internalValues'); - -type ProxyState = { - path: Array; - depth: number; -}; - -type ProxyStateExtension = { - [InternalValues]: ProxyState; -}; - -export const createAccessToPathProxy = ( - onNewPath: (path: Array) => string, -): T => { - const validator: ProxyHandler = { - get(target: T & ProxyStateExtension, p: string | symbol): unknown { - const internalValues = target[InternalValues]; - const path = internalValues.path; - - if ( - p === 'toString' || - p === Symbol.toPrimitive || - p === Symbol.toStringTag - ) { - return () => onNewPath(path ?? []); - } else if (typeof p === 'symbol') { - throw new Error(`Symbols are not supported as keys: ${String(p)}`); - } - - return new Proxy( - { - ...target, - [InternalValues]: { - path: [...path, p], - depth: internalValues.depth + 1, - }, - }, - validator, - ); - }, - }; - - return new Proxy( - { [InternalValues]: { path: [] as Array, depth: 0 } } as T & - ProxyStateExtension, - validator, - ); -}; diff --git a/libs/microservices/shared/relation-tuple-parser/src/lib/util/two-way-map.ts b/libs/microservices/shared/relation-tuple-parser/src/lib/util/two-way-map.ts deleted file mode 100644 index cd4a07ac..00000000 --- a/libs/microservices/shared/relation-tuple-parser/src/lib/util/two-way-map.ts +++ /dev/null @@ -1,21 +0,0 @@ -export class TwoWayMap { - private readonly reverseMap = new Map(); - - constructor(private readonly map: Map) { - map.forEach((value, key) => { - this.reverseMap.set(value, key); - }); - } - - get(key: K): V | undefined { - return this.map.get(key); - } - - getByValue(value: V): K | undefined { - return this.reverseMap.get(value); - } - - values(): IterableIterator { - return this.map.values(); - } -} diff --git a/libs/microservices/shared/relation-tuple-parser/src/lib/with-replacements/generate-replacer-function.ts b/libs/microservices/shared/relation-tuple-parser/src/lib/with-replacements/generate-replacer-function.ts deleted file mode 100644 index 19d886e8..00000000 --- a/libs/microservices/shared/relation-tuple-parser/src/lib/with-replacements/generate-replacer-function.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { get as lodashGet } from 'lodash-es'; - -import { TwoWayMap } from '../util/two-way-map.js'; -import type { ReplaceableString } from './relation-tuple-with-replacements.js'; -import type { ReplacementValues } from './replacement-values.js'; - -function findReplacementsInString( - str: string, - possibleReplacements: TwoWayMap, -): Array<{ start: number; endExcl: number; prop: keyof T }> { - const regexStr = `(${Array.from(possibleReplacements.values()).join('|')})`; - const regex = new RegExp(regexStr, 'g'); - - return Array.from(str.matchAll(regex)).flatMap((x) => { - if (x.index == null) { - return []; - } - - const value = x.values().next().value; - return [ - { - start: x.index, - endExcl: x.index + value.length, - prop: possibleReplacements.getByValue(value) as keyof T, - }, - ]; - }); -} - -function generateReplacerFunctions( - sortedFoundReplacements: Array<{ - start: number; - endExcl: number; - prop: keyof T; - }>, - str: string, -): Array> { - const resultStringParts: Array> = []; - - let pos = 0; - sortedFoundReplacements.forEach(({ start, endExcl, prop }) => { - const strPart = str.substring(pos, Math.max(0, start)); // let calculation happen before - resultStringParts.push(() => strPart); - resultStringParts.push((replacements) => - String(lodashGet(replacements, prop)), - ); - - pos = endExcl; - }); - - if (pos < str.length) { - const strPart = str.substring(pos, str.length); - resultStringParts.push(() => strPart); - } - return resultStringParts; -} - -export const generateReplacerFunction = ( - str: string, - possibleReplacements: TwoWayMap, -): ReplaceableString => { - const foundReplacements = findReplacementsInString(str, possibleReplacements); - - const hasNoReplacements = foundReplacements.length === 0; - const isWholeStringReplacement = - foundReplacements.length === 1 && - foundReplacements[0].start === 0 && - foundReplacements[0].endExcl === str.length; - - if (hasNoReplacements) { - return () => str; - } else if (isWholeStringReplacement) { - return (replacements) => - String(lodashGet(replacements, foundReplacements[0].prop)); - } - - const foundReplacementsSortedByStartIndexASC = foundReplacements.sort( - (a, b) => a.start - b.start, - ); - - const resultStringParts = generateReplacerFunctions( - foundReplacementsSortedByStartIndexASC, - str, - ); - - return (replacements) => { - return resultStringParts.map((x) => x(replacements)).join(''); - }; -}; diff --git a/libs/microservices/shared/relation-tuple-parser/src/lib/with-replacements/relation-tuple-with-replacements-parser.spec.ts b/libs/microservices/shared/relation-tuple-parser/src/lib/with-replacements/relation-tuple-with-replacements-parser.spec.ts deleted file mode 100644 index a786820e..00000000 --- a/libs/microservices/shared/relation-tuple-parser/src/lib/with-replacements/relation-tuple-with-replacements-parser.spec.ts +++ /dev/null @@ -1,205 +0,0 @@ -/* eslint-disable max-nested-callbacks */ -/* eslint-disable max-lines-per-function */ -import { type RelationTuple } from '../relation-tuple.js'; -import { applyReplacements } from './relation-tuple-with-replacements.js'; -import { parseRelationTupleWithReplacements } from './relation-tuple-with-replacements-parser.js'; - -describe('parseRelationTupleWithReplacements tests', () => { - it('simple replacements with subject', () => { - const relationTupleWithReplacements = parseRelationTupleWithReplacements( - ({ namespace, object, relation, subject }) => - `${namespace}:${object}#${relation}@${subject}`, - ).unwrapOrThrow(); - - const relationTuple = applyReplacements(relationTupleWithReplacements, { - namespace: 'aaa', - object: 'bbb', - relation: 'ccc', - subject: 'ddd', - }); - - expect(relationTuple).toEqual({ - namespace: 'aaa', - object: 'bbb', - relation: 'ccc', - subjectIdOrSet: 'ddd', - } as RelationTuple); - }); - - it('simple replacements with (subjectSet)', () => { - const relationTupleWithReplacements = parseRelationTupleWithReplacements( - ({ - namespace, - object, - relation, - subjectNamespace, - subjectObject, - subjectRelation, - }) => - `${namespace}:${object}#${relation}@(${subjectNamespace}:${subjectObject}#${subjectRelation})`, - ).unwrapOrThrow(); - - const relationTuple = applyReplacements(relationTupleWithReplacements, { - namespace: 'aaa', - object: 'bbb', - relation: 'ccc', - subjectNamespace: 'ddd', - subjectObject: 'eee', - subjectRelation: 'fff', - }); - - expect(relationTuple).toEqual({ - namespace: 'aaa', - object: 'bbb', - relation: 'ccc', - subjectIdOrSet: { - namespace: 'ddd', - object: 'eee', - relation: 'fff', - }, - } as RelationTuple); - }); - - it('simple replacements with static part', () => { - const relationTupleWithReplacements = parseRelationTupleWithReplacements( - ({ namespace, object, relation, subject }) => - `*${namespace}*:*${object}*#*${relation}@${subject}*`, - ).unwrapOrThrow(); - - const relationTuple = applyReplacements(relationTupleWithReplacements, { - namespace: 'aaa', - object: 'bbb', - relation: 'ccc', - subject: 'ddd', - }); - - expect(relationTuple).toEqual({ - namespace: '*aaa*', - object: '*bbb*', - relation: '*ccc', - subjectIdOrSet: 'ddd*', - } as RelationTuple); - }); - - it('multiple replacements per part with subject', () => { - const relationTupleWithReplacements = parseRelationTupleWithReplacements( - ({ namespace, a, object, b, relation, c, subject, d }) => - `*${namespace}-${a}-${namespace}*:*${object}-${b}*#*${relation}-${c}*@*${subject}-${d}*`, - ).unwrapOrThrow(); - - const relationTuple = applyReplacements(relationTupleWithReplacements, { - namespace: 'aaa', - object: 'bbb', - relation: 'ccc', - subject: 'ddd', - a: '1', - b: '2', - c: '3', - d: '4', - }); - - expect(relationTuple).toEqual({ - namespace: '*aaa-1-aaa*', - object: '*bbb-2*', - relation: '*ccc-3*', - subjectIdOrSet: '*ddd-4*', - } as RelationTuple); - }); - - it('replacements support multiple types', () => { - const replacements = { - numberInt: 1, - numberFP: 1.5, - booleanTrue: true, - booleanFalse: false, - string: 'myTestString', - }; - - const relationTupleWithReplacements = parseRelationTupleWithReplacements( - (r: typeof replacements) => - `${r.numberInt}|${r.numberFP}|${r.booleanTrue}|${r.booleanFalse}|${r.string}:object#relation@subject`, - ).unwrapOrThrow(); - - const relationTuple = applyReplacements( - relationTupleWithReplacements, - replacements, - ); - - expect(relationTuple).toEqual({ - namespace: '1|1.5|true|false|myTestString', - object: 'object', - relation: 'relation', - subjectIdOrSet: 'subject', - } as RelationTuple); - }); - - describe('nested replacements', () => { - it('with subject', () => { - const replacements = { - object: { - namespace: 'aaa', - object: 'bbb', - }, - relation: 'ccc', - nest: { - nest: { - subject: 'ddd', - }, - }, - }; - - const relationTupleWithReplacements = parseRelationTupleWithReplacements< - typeof replacements - >( - ({ object, relation, nest }) => - `${object.namespace}:${object.object}#${relation}@${nest.nest.subject}`, - ).unwrapOrThrow(); - - const relationTuple = applyReplacements( - relationTupleWithReplacements, - replacements, - ); - - expect(relationTuple).toEqual({ - namespace: 'aaa', - object: 'bbb', - relation: 'ccc', - subjectIdOrSet: 'ddd', - } as RelationTuple); - }); - - it('with subject and replacements inside parts', () => { - const replacements = { - object: { - namespace: 'aaa', - object: 'bbb', - }, - relation: 'ccc', - nest: { - nest: { - subject: 'ddd', - }, - }, - }; - - const relationTupleWithReplacements = parseRelationTupleWithReplacements< - typeof replacements - >( - ({ object, relation, nest }) => - `${object.namespace}:${object.namespace}${object.object}#df${relation}dfg${nest.nest.subject}sdf@asd${nest.nest.subject}`, - ).unwrapOrThrow(); - - const relationTuple = applyReplacements( - relationTupleWithReplacements, - replacements, - ); - - expect(relationTuple).toEqual({ - namespace: 'aaa', - object: 'aaabbb', - relation: 'dfcccdfgdddsdf', - subjectIdOrSet: 'asdddd', - } as RelationTuple); - }); - }); -}); diff --git a/libs/microservices/shared/relation-tuple-parser/src/lib/with-replacements/relation-tuple-with-replacements-parser.ts b/libs/microservices/shared/relation-tuple-parser/src/lib/with-replacements/relation-tuple-with-replacements-parser.ts deleted file mode 100644 index 889e3aec..00000000 --- a/libs/microservices/shared/relation-tuple-parser/src/lib/with-replacements/relation-tuple-with-replacements-parser.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { error, Result, value } from 'defekt'; - -import { RelationTupleSyntaxError } from '../errors/relation-tuple-syntax.error.js'; -import { UnknownError } from '../errors/unknown.error.js'; -import { parseRelationTuple } from '../relation-tuple-parser.js'; -import { createAccessToPathProxy } from '../util/access-to-path-proxy.js'; -import { TwoWayMap } from '../util/two-way-map.js'; -import { generateReplacerFunction } from './generate-replacer-function.js'; -import type { RelationTupleWithReplacements } from './relation-tuple-with-replacements.js'; -import type { ReplacementValues } from './replacement-values.js'; - -const delimiter = '\u2744'; - -export type RelationTupleStringGenerator = (args: T) => string; - -export const parseRelationTupleWithReplacements = ( - relationTupleStringGenerator: RelationTupleStringGenerator, -): Result< - RelationTupleWithReplacements, - RelationTupleSyntaxError | UnknownError -> => { - const usedPlaceholder = new Map(); - - const registerAndReturnPlaceholder = (path: Array): string => { - const pathAsString = path.join('.'); - const placeholder = `${delimiter}${pathAsString}${delimiter}`; - usedPlaceholder.set(pathAsString, placeholder); - return placeholder; - }; - - const argsProxy = createAccessToPathProxy(registerAndReturnPlaceholder); - - const relationTupleStr = relationTupleStringGenerator(argsProxy); - - const relationTupleResult = parseRelationTuple(relationTupleStr); - if (relationTupleResult.hasError()) { - return error(relationTupleResult.error); - } - const tuple = relationTupleResult.value; - - const usedPlaceholderLookupMap = new TwoWayMap(usedPlaceholder); - - let subjectIdOrSet: RelationTupleWithReplacements['subjectIdOrSet']; - if (typeof tuple.subjectIdOrSet === 'object') { - subjectIdOrSet = { - namespace: generateReplacerFunction( - tuple.subjectIdOrSet.namespace, - usedPlaceholderLookupMap, - ), - object: generateReplacerFunction( - tuple.subjectIdOrSet.object, - usedPlaceholderLookupMap, - ), - relation: tuple.subjectIdOrSet.relation - ? generateReplacerFunction( - tuple.subjectIdOrSet.relation, - usedPlaceholderLookupMap, - ) - : () => undefined, - }; - } else { - subjectIdOrSet = generateReplacerFunction( - tuple.subjectIdOrSet, - usedPlaceholderLookupMap, - ); - } - - return value({ - namespace: generateReplacerFunction( - tuple.namespace, - usedPlaceholderLookupMap, - ), - object: generateReplacerFunction(tuple.object, usedPlaceholderLookupMap), - relation: generateReplacerFunction( - tuple.relation, - usedPlaceholderLookupMap, - ), - subjectIdOrSet, - }); -}; diff --git a/libs/microservices/shared/relation-tuple-parser/src/lib/with-replacements/relation-tuple-with-replacements.ts b/libs/microservices/shared/relation-tuple-parser/src/lib/with-replacements/relation-tuple-with-replacements.ts deleted file mode 100644 index 7f1e4699..00000000 --- a/libs/microservices/shared/relation-tuple-parser/src/lib/with-replacements/relation-tuple-with-replacements.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { RelationTuple } from '../relation-tuple.js'; -import { ReplacementValues } from './replacement-values.js'; - -export type ReplaceableString< - T extends ReplacementValues, - R extends string | undefined = string, -> = (replacements: T) => R; - -export class SubjectSetWithReplacements { - namespace: ReplaceableString; - object: ReplaceableString; - relation: ReplaceableString; - - constructor( - namespace: ReplaceableString, - object: ReplaceableString, - relation?: ReplaceableString, - ) { - this.namespace = namespace; - this.object = object; - this.relation = relation ?? (() => undefined); - } -} - -export class RelationTupleWithReplacements { - namespace: ReplaceableString; - object: ReplaceableString; - relation: ReplaceableString; - subjectIdOrSet: ReplaceableString | SubjectSetWithReplacements; - - constructor( - namespace: ReplaceableString, - object: ReplaceableString, - relation: ReplaceableString, - subjectIdOrSet: ReplaceableString | SubjectSetWithReplacements, - ) { - this.namespace = namespace; - this.object = object; - this.relation = relation; - this.subjectIdOrSet = subjectIdOrSet; - } -} - -export const applyReplacements = ( - relationTuple: RelationTupleWithReplacements, - replacements: T, -): RelationTuple => { - let subjectIdOrSet: RelationTuple['subjectIdOrSet']; - if (typeof relationTuple.subjectIdOrSet === 'object') { - subjectIdOrSet = { - namespace: relationTuple.subjectIdOrSet.namespace(replacements), - object: relationTuple.subjectIdOrSet.object(replacements), - relation: relationTuple.subjectIdOrSet.relation(replacements), - }; - } else { - subjectIdOrSet = relationTuple.subjectIdOrSet(replacements); - } - - return { - namespace: relationTuple.namespace(replacements), - object: relationTuple.object(replacements), - relation: relationTuple.relation(replacements), - subjectIdOrSet, - }; -}; diff --git a/libs/microservices/shared/relation-tuple-parser/src/lib/with-replacements/replacement-values.ts b/libs/microservices/shared/relation-tuple-parser/src/lib/with-replacements/replacement-values.ts deleted file mode 100644 index 4d9869e6..00000000 --- a/libs/microservices/shared/relation-tuple-parser/src/lib/with-replacements/replacement-values.ts +++ /dev/null @@ -1,3 +0,0 @@ -export type ReplacementValues = { - [P in string]: string | number | boolean | ReplacementValues; -}; diff --git a/libs/microservices/shared/relation-tuple-parser/tsconfig.json b/libs/microservices/shared/relation-tuple-parser/tsconfig.json deleted file mode 100644 index 0b44b5e2..00000000 --- a/libs/microservices/shared/relation-tuple-parser/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "extends": "../../../../tsconfig.base.json", - "compilerOptions": { - "module": "ESNext", - "moduleResolution": "Bundler", - "forceConsistentCasingInFileNames": true, - "strict": true, - "noImplicitOverride": true, - "noPropertyAccessFromIndexSignature": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true - }, - "files": [], - "include": [], - "references": [ - { - "path": "./tsconfig.lib.json" - }, - { - "path": "./tsconfig.spec.json" - } - ] -} diff --git a/libs/microservices/shared/relation-tuple-parser/tsconfig.lib.json b/libs/microservices/shared/relation-tuple-parser/tsconfig.lib.json deleted file mode 100644 index 7eba77ed..00000000 --- a/libs/microservices/shared/relation-tuple-parser/tsconfig.lib.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../../../dist/out-tsc", - "declaration": true, - "moduleResolution": "Bundler", - "module": "esnext", - "target": "es2022", - "emitDecoratorMetadata": true, - "types": [ - "node" - ] - }, - "include": [ - "src/**/*.ts" - ], - "exclude": [ - "jest.config.ts", - "src/**/*.spec.ts", - "src/**/*.test.ts" - ] -} diff --git a/libs/microservices/shared/relation-tuple-parser/tsconfig.spec.json b/libs/microservices/shared/relation-tuple-parser/tsconfig.spec.json deleted file mode 100644 index e0fa414d..00000000 --- a/libs/microservices/shared/relation-tuple-parser/tsconfig.spec.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../../../dist/out-tsc", - "moduleResolution": "Bundler", - "module": "esnext", - "target": "es2022", - "emitDecoratorMetadata": true, - "types": [ - "jest", - "node" - ] - }, - "include": [ - "jest.config.ts", - "src/**/*.test.ts", - "src/**/*.spec.ts", - "src/**/*.d.ts" - ] -} From 904691322c9e1c6ec8437cd50da6ab36b07231b1 Mon Sep 17 00:00:00 2001 From: getlarge Date: Sun, 14 Jan 2024 13:51:36 +0100 Subject: [PATCH 04/14] chore: update ESLint configurations to keep package.json in check --- .eslintrc.json | 2 +- apps/auth/.eslintrc.json | 17 ++++++++++++ apps/auth/package.json | 29 +++----------------- apps/auth/project.json | 6 ++++- apps/expiration/.eslintrc.json | 17 ++++++++++++ apps/expiration/package.json | 26 +----------------- apps/expiration/project.json | 6 ++++- apps/orders/.eslintrc.json | 17 ++++++++++++ apps/orders/package.json | 28 ++++---------------- apps/orders/project.json | 6 ++++- apps/payments/.eslintrc.json | 17 ++++++++++++ apps/payments/package.json | 29 ++++---------------- apps/payments/project.json | 6 ++++- apps/permissions-manager/.eslintrc.json | 17 ++++++++++++ apps/permissions-manager/project.json | 6 ++++- apps/tickets/.eslintrc.json | 17 ++++++++++++ apps/tickets/package.json | 28 ++++---------------- apps/tickets/project.json | 6 ++++- package.json | 6 ++--- tsconfig.base.json | 6 ----- yarn.lock | 35 +++---------------------- 21 files changed, 158 insertions(+), 169 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index e1b3cb4f..f63e260a 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,7 +1,7 @@ { "root": true, "ignorePatterns": ["**/*"], - "plugins": ["@nx/eslint-plugin"], + "plugins": ["@nx"], "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx", "*.cjs"], diff --git a/apps/auth/.eslintrc.json b/apps/auth/.eslintrc.json index 856c2a69..912dafd3 100644 --- a/apps/auth/.eslintrc.json +++ b/apps/auth/.eslintrc.json @@ -18,6 +18,23 @@ { "files": ["*.js", "*.jsx", "*.cjs"], "rules": {} + }, + { + "files": ["*.json"], + "parser": "jsonc-eslint-parser", + "rules": { + "@nx/dependency-checks": [ + "error", + { + "buildTargets": ["build"], + "checkMissingDependencies": true, + "checkObsoleteDependencies": true, + "checkVersionMismatches": true, + "includeTransitiveDependencies": false, + "ignoredDependencies": ["@jest/globals", "@nestjs/testing"] + } + ] + } } ] } diff --git a/apps/auth/package.json b/apps/auth/package.json index ba233cf2..383c06c6 100644 --- a/apps/auth/package.json +++ b/apps/auth/package.json @@ -2,57 +2,34 @@ "name": "auth", "version": "0.2.0", "dependencies": { - "@fastify/cookie": "9.0.4", "@fastify/cors": "8.3.0", "@fastify/helmet": "11.0.0", "@fastify/passport": "2.3.0", "@fastify/secure-session": "7.1.0", - "@fastify/static": "6.11.0", - "@nestjs-plugins/nestjs-nats-streaming-transport": "1.2.0", + "@getlarge/kratos-client-wrapper": "0.0.1", "@nestjs/axios": "3.0.0", "@nestjs/common": "10.2.4", "@nestjs/config": "3.1.1", "@nestjs/core": "10.2.4", - "@nestjs/jwt": "10.1.0", - "@nestjs/microservices": "10.2.4", "@nestjs/mongoose": "10.0.1", "@nestjs/platform-fastify": "10.2.4", "@nestjs/swagger": "7.1.10", "@nestjs/terminus": "10.0.1", "@nx/webpack": "17.1.3", - "amqp-connection-manager": "4.1.14", - "amqplib": "0.10.3", - "antlr4ng": "2.0.3", - "axios": "1.5.0", "class-transformer": "0.5.1", "class-validator": "0.13.2", - "defekt": "9.3.1", "dotenv": "16.3.1", - "dotenv-expand": "10.0.0", "fastify": "4.22.0", - "lodash": "4.17.21", "lodash-es": "4.17.21", - "mongoose": "6.12.0", - "nestjs-keyset-paginator": "3.0.4", + "mongoose": "^6.1.0", "nestjs-pino": "3.4.0", - "passport-jwt": "4.0.0", - "pino-http": "8.5.0", - "reflect-metadata": "0.1.13", - "rxjs": "7.8.1", "ts-mixer": "6.0.1", - "tslib": "2.6.2", "webpack-node-externals": "3.0.0" }, - "peerDependencies": { - "ioredis": "4.28.5", - "nats": "1.4.12" - }, + "peerDependencies": {}, "peerDependenciesMeta": { "ioredis": { "optional": true - }, - "nats": { - "optional": true } }, "main": "main.js" diff --git a/apps/auth/project.json b/apps/auth/project.json index 63533082..b50f33ff 100644 --- a/apps/auth/project.json +++ b/apps/auth/project.json @@ -56,7 +56,11 @@ "executor": "@nx/eslint:lint", "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": ["apps/auth/**/*.ts"] + "lintFilePatterns": [ + "apps/auth/**/*.ts", + "apps/auth/**/package.json", + "apps/auth/**/project.json" + ] } }, "test": { diff --git a/apps/expiration/.eslintrc.json b/apps/expiration/.eslintrc.json index e87e3f78..82a1ee90 100644 --- a/apps/expiration/.eslintrc.json +++ b/apps/expiration/.eslintrc.json @@ -13,6 +13,23 @@ { "files": ["*.js", "*.jsx", "*.cjs"], "rules": {} + }, + { + "files": ["*.json"], + "parser": "jsonc-eslint-parser", + "rules": { + "@nx/dependency-checks": [ + "error", + { + "buildTargets": ["build"], + "checkMissingDependencies": true, + "checkObsoleteDependencies": true, + "checkVersionMismatches": true, + "includeTransitiveDependencies": false, + "ignoredDependencies": ["@jest/globals", "@nestjs/testing"] + } + ] + } } ] } diff --git a/apps/expiration/package.json b/apps/expiration/package.json index 82b419f9..05a777b6 100644 --- a/apps/expiration/package.json +++ b/apps/expiration/package.json @@ -2,17 +2,13 @@ "name": "expiration", "version": "0.2.0", "dependencies": { - "@fastify/cookie": "9.0.4", "@fastify/helmet": "11.0.0", - "@fastify/static": "6.11.0", - "@nestjs-plugins/nestjs-nats-streaming-transport": "1.2.0", "@nestjs/axios": "3.0.0", "@nestjs/bull": "10.0.1", "@nestjs/common": "10.2.4", "@nestjs/config": "3.1.1", "@nestjs/core": "10.2.4", "@nestjs/microservices": "10.2.4", - "@nestjs/mongoose": "10.0.1", "@nestjs/platform-fastify": "10.2.4", "@nestjs/swagger": "7.1.10", "@nestjs/terminus": "10.0.1", @@ -20,34 +16,14 @@ "@s1seven/nestjs-tools-amqp-transport": "0.5.1", "amqp-connection-manager": "4.1.14", "amqplib": "0.10.3", - "axios": "1.5.0", "bull": "4.8.2", "class-transformer": "0.5.1", - "class-validator": "0.13.2", "dotenv": "16.3.1", - "dotenv-expand": "10.0.0", - "fastify": "4.22.0", - "ioredis": "4.28.5", - "lodash": "4.17.21", - "lodash-es": "4.17.21", - "mongoose": "6.12.0", "nestjs-pino": "3.4.0", - "node-nats-streaming": "0.3.2", - "pino-http": "8.5.0", - "reflect-metadata": "0.1.13", "rxjs": "7.8.1", "ts-mixer": "6.0.1", - "url": "0.11.1", "webpack-node-externals": "3.0.0" }, - "peerDependencies": { - "nats": "1.4.12", - "uuid": "8.3.2" - }, - "peerDependenciesMeta": { - "nats": { - "optional": true - } - }, + "peerDependencies": {}, "main": "main.js" } diff --git a/apps/expiration/project.json b/apps/expiration/project.json index 3be18e51..7c94b401 100644 --- a/apps/expiration/project.json +++ b/apps/expiration/project.json @@ -56,7 +56,11 @@ "executor": "@nx/eslint:lint", "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": ["apps/expiration/**/*.ts"] + "lintFilePatterns": [ + "apps/expiration/**/*.ts", + "apps/expiration/**/package.json", + "apps/expiration/**/project.json" + ] } }, "test": { diff --git a/apps/orders/.eslintrc.json b/apps/orders/.eslintrc.json index e87e3f78..82a1ee90 100644 --- a/apps/orders/.eslintrc.json +++ b/apps/orders/.eslintrc.json @@ -13,6 +13,23 @@ { "files": ["*.js", "*.jsx", "*.cjs"], "rules": {} + }, + { + "files": ["*.json"], + "parser": "jsonc-eslint-parser", + "rules": { + "@nx/dependency-checks": [ + "error", + { + "buildTargets": ["build"], + "checkMissingDependencies": true, + "checkObsoleteDependencies": true, + "checkVersionMismatches": true, + "includeTransitiveDependencies": false, + "ignoredDependencies": ["@jest/globals", "@nestjs/testing"] + } + ] + } } ] } diff --git a/apps/orders/package.json b/apps/orders/package.json index 78fe60bd..e0a7b1ba 100644 --- a/apps/orders/package.json +++ b/apps/orders/package.json @@ -2,19 +2,18 @@ "name": "orders", "version": "0.2.0", "dependencies": { - "@fastify/cookie": "9.0.4", "@fastify/cors": "8.3.0", "@fastify/helmet": "11.0.0", "@fastify/passport": "2.3.0", "@fastify/secure-session": "7.1.0", - "@fastify/static": "6.11.0", "@jest/globals": "29.7.0", - "@nestjs-plugins/nestjs-nats-streaming-transport": "1.2.0", + "@getlarge/keto-client-wrapper": "0.0.1", + "@getlarge/keto-relations-parser": "0.0.1", + "@getlarge/kratos-client-wrapper": "0.0.1", "@nestjs/axios": "3.0.0", "@nestjs/common": "10.2.4", "@nestjs/config": "3.1.1", "@nestjs/core": "10.2.4", - "@nestjs/jwt": "10.1.0", "@nestjs/microservices": "10.2.4", "@nestjs/mongoose": "10.0.1", "@nestjs/platform-fastify": "10.2.4", @@ -24,36 +23,19 @@ "@s1seven/nestjs-tools-amqp-transport": "0.5.1", "amqp-connection-manager": "4.1.14", "amqplib": "0.10.3", - "antlr4ng": "2.0.3", - "axios": "1.5.0", "class-transformer": "0.5.1", "class-validator": "0.13.2", - "defekt": "9.3.1", "dotenv": "16.3.1", - "dotenv-expand": "10.0.0", - "events": "3.3.0", "fastify": "4.22.0", - "lodash": "4.17.21", "lodash-es": "4.17.21", - "mongoose": "6.12.0", + "mongoose": "^6.1.0", "mongoose-update-if-current": "1.4.0", - "nestjs-keyset-paginator": "3.0.4", "nestjs-pino": "3.4.0", - "node-nats-streaming": "0.3.2", - "passport-jwt": "4.0.0", - "pino-http": "8.5.0", - "reflect-metadata": "0.1.13", "rxjs": "7.8.1", - "sodium-native": "4.0.4", "ts-mixer": "6.0.1", - "tslib": "2.6.2", "webpack-node-externals": "3.0.0" }, - "peerDependencies": { - "ioredis": "4.28.5", - "nats": "1.4.12", - "uuid": "8.3.2" - }, + "peerDependencies": {}, "peerDependenciesMeta": { "ioredis": { "optional": true diff --git a/apps/orders/project.json b/apps/orders/project.json index d95a60c0..a2e384fb 100644 --- a/apps/orders/project.json +++ b/apps/orders/project.json @@ -55,7 +55,11 @@ "executor": "@nx/eslint:lint", "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": ["apps/orders/**/*.ts"] + "lintFilePatterns": [ + "apps/orders/**/*.ts", + "apps/orders/**/package.json", + "apps/orders/**/project.json" + ] } }, "test": { diff --git a/apps/payments/.eslintrc.json b/apps/payments/.eslintrc.json index e87e3f78..82a1ee90 100644 --- a/apps/payments/.eslintrc.json +++ b/apps/payments/.eslintrc.json @@ -13,6 +13,23 @@ { "files": ["*.js", "*.jsx", "*.cjs"], "rules": {} + }, + { + "files": ["*.json"], + "parser": "jsonc-eslint-parser", + "rules": { + "@nx/dependency-checks": [ + "error", + { + "buildTargets": ["build"], + "checkMissingDependencies": true, + "checkObsoleteDependencies": true, + "checkVersionMismatches": true, + "includeTransitiveDependencies": false, + "ignoredDependencies": ["@jest/globals", "@nestjs/testing"] + } + ] + } } ] } diff --git a/apps/payments/package.json b/apps/payments/package.json index 4ba394e6..a76ed36a 100644 --- a/apps/payments/package.json +++ b/apps/payments/package.json @@ -2,19 +2,17 @@ "name": "payments", "version": "0.2.0", "dependencies": { - "@fastify/cookie": "9.0.4", "@fastify/cors": "8.3.0", "@fastify/helmet": "11.0.0", "@fastify/passport": "2.3.0", "@fastify/secure-session": "7.1.0", - "@fastify/static": "6.11.0", - "@jest/globals": "29.7.0", - "@nestjs-plugins/nestjs-nats-streaming-transport": "1.2.0", + "@getlarge/keto-client-wrapper": "0.0.1", + "@getlarge/keto-relations-parser": "0.0.1", + "@getlarge/kratos-client-wrapper": "0.0.1", "@nestjs/axios": "3.0.0", "@nestjs/common": "10.2.4", "@nestjs/config": "3.1.1", "@nestjs/core": "10.2.4", - "@nestjs/jwt": "10.1.0", "@nestjs/microservices": "10.2.4", "@nestjs/mongoose": "10.0.1", "@nestjs/platform-fastify": "10.2.4", @@ -24,37 +22,20 @@ "@s1seven/nestjs-tools-amqp-transport": "0.5.1", "amqp-connection-manager": "4.1.14", "amqplib": "0.10.3", - "antlr4ng": "2.0.3", - "axios": "1.5.0", "class-transformer": "0.5.1", "class-validator": "0.13.2", - "defekt": "9.3.1", "dotenv": "16.3.1", - "dotenv-expand": "10.0.0", - "events": "3.3.0", "fastify": "4.22.0", - "lodash": "4.17.21", "lodash-es": "4.17.21", - "mongoose": "6.12.0", + "mongoose": "^6.1.0", "mongoose-update-if-current": "1.4.0", - "nestjs-keyset-paginator": "3.0.4", "nestjs-pino": "3.4.0", - "node-nats-streaming": "0.3.2", - "passport-jwt": "4.0.0", - "pino-http": "8.5.0", - "reflect-metadata": "0.1.13", "rxjs": "7.8.1", - "sodium-native": "4.0.4", "stripe": "8.222.0", "ts-mixer": "6.0.1", - "tslib": "2.6.2", "webpack-node-externals": "3.0.0" }, - "peerDependencies": { - "ioredis": "4.28.5", - "nats": "1.4.12", - "uuid": "8.3.2" - }, + "peerDependencies": {}, "peerDependenciesMeta": { "ioredis": { "optional": true diff --git a/apps/payments/project.json b/apps/payments/project.json index ec4be4e3..9addf22c 100644 --- a/apps/payments/project.json +++ b/apps/payments/project.json @@ -55,7 +55,11 @@ "executor": "@nx/eslint:lint", "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": ["apps/payments/**/*.ts"] + "lintFilePatterns": [ + "apps/payments/**/*.ts", + "apps/payments/**/package.json", + "apps/payments/**/project.json" + ] } }, "test": { diff --git a/apps/permissions-manager/.eslintrc.json b/apps/permissions-manager/.eslintrc.json index 9d9c0db5..7eb065e0 100644 --- a/apps/permissions-manager/.eslintrc.json +++ b/apps/permissions-manager/.eslintrc.json @@ -13,6 +13,23 @@ { "files": ["*.js", "*.jsx"], "rules": {} + }, + { + "files": ["*.json"], + "parser": "jsonc-eslint-parser", + "rules": { + "@nx/dependency-checks": [ + "error", + { + "buildTargets": ["build"], + "checkMissingDependencies": true, + "checkObsoleteDependencies": true, + "checkVersionMismatches": true, + "includeTransitiveDependencies": false, + "ignoredDependencies": ["@jest/globals", "@nestjs/testing"] + } + ] + } } ] } diff --git a/apps/permissions-manager/project.json b/apps/permissions-manager/project.json index 63fea89c..738967d2 100644 --- a/apps/permissions-manager/project.json +++ b/apps/permissions-manager/project.json @@ -52,7 +52,11 @@ "executor": "@nx/eslint:lint", "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": ["apps/permissions-manager/**/*.ts"] + "lintFilePatterns": [ + "apps/permissions-manager/**/*.ts", + "apps/permissions-manager/**/package.json", + "apps/permissions-manager/**/project.json" + ] } }, "test": { diff --git a/apps/tickets/.eslintrc.json b/apps/tickets/.eslintrc.json index 856c2a69..912dafd3 100644 --- a/apps/tickets/.eslintrc.json +++ b/apps/tickets/.eslintrc.json @@ -18,6 +18,23 @@ { "files": ["*.js", "*.jsx", "*.cjs"], "rules": {} + }, + { + "files": ["*.json"], + "parser": "jsonc-eslint-parser", + "rules": { + "@nx/dependency-checks": [ + "error", + { + "buildTargets": ["build"], + "checkMissingDependencies": true, + "checkObsoleteDependencies": true, + "checkVersionMismatches": true, + "includeTransitiveDependencies": false, + "ignoredDependencies": ["@jest/globals", "@nestjs/testing"] + } + ] + } } ] } diff --git a/apps/tickets/package.json b/apps/tickets/package.json index 2782c49e..32a6a0bd 100644 --- a/apps/tickets/package.json +++ b/apps/tickets/package.json @@ -3,19 +3,17 @@ "type": "module", "version": "0.2.0", "dependencies": { - "@fastify/cookie": "9.0.4", "@fastify/cors": "8.3.0", "@fastify/helmet": "11.0.0", "@fastify/passport": "2.3.0", "@fastify/secure-session": "7.1.0", - "@fastify/static": "6.11.0", - "@jest/globals": "29.7.0", - "@nestjs-plugins/nestjs-nats-streaming-transport": "1.2.0", + "@getlarge/keto-client-wrapper": "0.0.1", + "@getlarge/keto-relations-parser": "0.0.1", + "@getlarge/kratos-client-wrapper": "0.0.1", "@nestjs/axios": "3.0.0", "@nestjs/common": "10.2.4", "@nestjs/config": "3.1.1", "@nestjs/core": "10.2.4", - "@nestjs/jwt": "10.1.0", "@nestjs/microservices": "10.2.4", "@nestjs/mongoose": "10.0.1", "@nestjs/platform-fastify": "10.2.4", @@ -25,36 +23,20 @@ "@s1seven/nestjs-tools-amqp-transport": "0.5.1", "amqp-connection-manager": "4.1.14", "amqplib": "0.10.3", - "antlr4ng": "2.0.3", - "axios": "1.5.0", "class-transformer": "0.5.1", "class-validator": "0.13.2", - "defekt": "9.3.1", "dotenv": "16.3.1", - "dotenv-expand": "10.0.0", - "events": "3.3.0", "fastify": "4.22.0", - "lodash": "4.17.21", "lodash-es": "4.17.21", - "mongoose": "6.12.0", + "mongoose": "^6.1.0", "mongoose-update-if-current": "1.4.0", "nestjs-keyset-paginator": "3.0.4", "nestjs-pino": "3.4.0", - "node-nats-streaming": "0.3.2", - "passport-jwt": "4.0.0", - "pino-http": "8.5.0", - "reflect-metadata": "0.1.13", "rxjs": "7.8.1", - "sodium-native": "4.0.4", "ts-mixer": "6.0.1", - "tslib": "2.6.2", "webpack-node-externals": "3.0.0" }, - "peerDependencies": { - "ioredis": "4.28.5", - "nats": "1.4.12", - "uuid": "8.3.2" - }, + "peerDependencies": {}, "peerDependenciesMeta": { "ioredis": { "optional": true diff --git a/apps/tickets/project.json b/apps/tickets/project.json index 6aa8f6a8..bd3f6e63 100644 --- a/apps/tickets/project.json +++ b/apps/tickets/project.json @@ -56,7 +56,11 @@ "executor": "@nx/eslint:lint", "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": ["apps/tickets/**/*.ts"] + "lintFilePatterns": [ + "apps/tickets/**/*.ts", + "apps/tickets/**/package.json", + "apps/tickets/**/project.json" + ] } }, "test": { diff --git a/package.json b/package.json index 79a26198..4ce16b73 100644 --- a/package.json +++ b/package.json @@ -115,7 +115,7 @@ "@fastify/helmet": "11.0.0", "@fastify/passport": "2.3.0", "@fastify/secure-session": "7.1.0", - "@fastify/static": "^6.11.0", + "@fastify/static": "^6.12.0", "@fastify/swagger": "8.10.0", "@getlarge/keto-client-wrapper": "0.0.1", "@getlarge/keto-relations-parser": "0.0.1", @@ -142,7 +142,6 @@ "@stripe/stripe-js": "1.34.0", "amqp-connection-manager": "4.1.14", "amqplib": "0.10.3", - "antlr4ng": "^2.0.3", "axios": "1.6.2", "bootstrap": "^5.1.3", "bull": "4.8.2", @@ -165,7 +164,7 @@ "passport-local": "1.0.0", "pino-http": "8.5.0", "pino-pretty": "10.2.3", - "reflect-metadata": "^0.2.1", + "reflect-metadata": "^0.1.13", "regenerator-runtime": "0.13.7", "rxjs": "7.8.1", "stripe": "8.222.0", @@ -216,7 +215,6 @@ "@types/shortid": "^0.0.29", "@typescript-eslint/eslint-plugin": "6.14.0", "@typescript-eslint/parser": "6.14.0", - "antlr4ng-cli": "^1.0.6", "commitizen": "^4.2.4", "cypress": "^8.3.0", "cz-conventional-changelog": "^3.3.0", diff --git a/tsconfig.base.json b/tsconfig.base.json index 5e441a3e..0904de68 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -18,9 +18,6 @@ "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, "paths": { - "@ticketing/microservices/ory-client": [ - "libs/microservices/ory-client/src/index.ts" - ], "@ticketing/microservices/shared/constants": [ "libs/microservices/shared/constants/src/index.ts" ], @@ -54,9 +51,6 @@ "@ticketing/microservices/shared/redis": [ "libs/microservices/shared/redis/src/index.ts" ], - "@ticketing/microservices/shared/relation-tuple-parser": [ - "libs/microservices/shared/relation-tuple-parser/src/index.ts" - ], "@ticketing/microservices/shared/rmq": [ "libs/microservices/shared/rmq/src/index.ts" ], diff --git a/yarn.lock b/yarn.lock index d11e5722..d9232ee8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3763,7 +3763,7 @@ __metadata: languageName: node linkType: hard -"@fastify/static@npm:^6.11.0": +"@fastify/static@npm:^6.12.0": version: 6.12.0 resolution: "@fastify/static@npm:6.12.0" dependencies: @@ -7909,24 +7909,6 @@ __metadata: languageName: node linkType: hard -"antlr4ng-cli@npm:^1.0.6": - version: 1.0.6 - resolution: "antlr4ng-cli@npm:1.0.6" - bin: - antlr4ng: index.js - checksum: f776bf997d1dc373a4d32ad3d312c9eb3822e670e7bc7a8fab17ef20f2f4521e4e3cc99efc5ffb5d4ba8e3932a8a5e38d4d1ae30565523fb4ad8b15391d46f67 - languageName: node - linkType: hard - -"antlr4ng@npm:^2.0.3": - version: 2.0.3 - resolution: "antlr4ng@npm:2.0.3" - peerDependencies: - antlr4ng-cli: ^1.0.0 - checksum: 9a69db48b7a31f9295ad33902c912b407bd941d2e4424f948032488343c71ee79258711202e0350c1c68635862f9ae5b564d736f4d64f80f30ca1a99cce68f5c - languageName: node - linkType: hard - "anymatch@npm:^3.0.3, anymatch@npm:~3.1.2": version: 3.1.3 resolution: "anymatch@npm:3.1.3" @@ -20461,20 +20443,13 @@ __metadata: languageName: node linkType: hard -"reflect-metadata@npm:^0.1.2": +"reflect-metadata@npm:^0.1.13, reflect-metadata@npm:^0.1.2": version: 0.1.14 resolution: "reflect-metadata@npm:0.1.14" checksum: 155ad339319cec3c2d9d84719f730f8b6a6cd2a074733ec29dbae6c89d48a2914c7d07a2350212594f3aae160fa4da4f903e6512f27ceaf968443a7c692bcad0 languageName: node linkType: hard -"reflect-metadata@npm:^0.2.1": - version: 0.2.1 - resolution: "reflect-metadata@npm:0.2.1" - checksum: 772f552a544e04b999c1bf2c868225fef10032274e9d9e315bc3e7a687a504b8b115fa71966665b9619acfd323123a941f892b593250140da809330d41564181 - languageName: node - linkType: hard - "reftools@npm:^1.1.6, reftools@npm:^1.1.9": version: 1.1.9 resolution: "reftools@npm:1.1.9" @@ -22487,7 +22462,7 @@ __metadata: "@fastify/helmet": 11.0.0 "@fastify/passport": 2.3.0 "@fastify/secure-session": 7.1.0 - "@fastify/static": ^6.11.0 + "@fastify/static": ^6.12.0 "@fastify/swagger": 8.10.0 "@getlarge/keto-client-wrapper": 0.0.1 "@getlarge/keto-relations-parser": 0.0.1 @@ -22544,8 +22519,6 @@ __metadata: "@typescript-eslint/parser": 6.14.0 amqp-connection-manager: 4.1.14 amqplib: 0.10.3 - antlr4ng: ^2.0.3 - antlr4ng-cli: ^1.0.6 axios: 1.6.2 bootstrap: ^5.1.3 bull: 4.8.2 @@ -22598,7 +22571,7 @@ __metadata: pino-pretty: 10.2.3 prettier: 3.1.1 redoc-cli: ^0.13.0 - reflect-metadata: ^0.2.1 + reflect-metadata: ^0.1.13 regenerator-runtime: 0.13.7 rxjs: 7.8.1 stripe: 8.222.0 From ccbcbeea18daa1c24d5478efd4add497316d90e9 Mon Sep 17 00:00:00 2001 From: getlarge Date: Sun, 14 Jan 2024 16:24:45 +0100 Subject: [PATCH 05/14] chore: update CI dependencies --- .github/actions/checkout-and-yarn/action.yaml | 6 +++--- .github/workflows/cd.yaml | 8 ++++---- .github/workflows/ci.yaml | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/actions/checkout-and-yarn/action.yaml b/.github/actions/checkout-and-yarn/action.yaml index 072162e7..b4613e58 100644 --- a/.github/actions/checkout-and-yarn/action.yaml +++ b/.github/actions/checkout-and-yarn/action.yaml @@ -33,7 +33,7 @@ runs: token: ${{ inputs.token }} - name: Set up Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ inputs.node-version }} @@ -50,7 +50,7 @@ runs: # follow advice in https://gist.github.com/belgattitude/042f9caf10d029badbde6cf9d43e400a - name: Cache / restore yarn cache id: yarn-cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.yarn-config.outputs.CACHE_FOLDER }} key: yarn-cache-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }} @@ -59,7 +59,7 @@ runs: - name: ♻️ Cache / restore yarn install state id: yarn-install-state-cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: .yarn/ci-cache/ key: yarn-install-state-cache-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ hashFiles('yarn.lock', '.yarnrc.yml') }} diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 2790b3d4..5a31bef5 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -130,7 +130,7 @@ jobs: - name: Derive appropriate SHAs for base and head for `nx affected` commands id: set-shas - uses: nrwl/nx-set-shas@v3 + uses: nrwl/nx-set-shas@v4 with: # solves issue where no projects are affected after merging to main workflow-id: ${{ steps.ref-workflow.outputs.value }} @@ -242,7 +242,7 @@ jobs: # When building images in CI runner - name: Retrieve build output from external workflow if: github.event_name == 'workflow_dispatch' - uses: dawidd6/action-download-artifact@v2 + uses: dawidd6/action-download-artifact@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} branch: ${{ needs.init.outputs.current-branch }} @@ -259,7 +259,7 @@ jobs: - name: Retrieve build output from current workflow if: github.event_name != 'workflow_dispatch' && steps.check-build-artifact.outputs.exists == 'true' - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: ${{ env.BUILD_ARTIFACTS }} path: ${{ env.BUILD_FOLDER }} @@ -274,7 +274,7 @@ jobs: run: exit 1 - name: Login to GitHub Container Registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2900dada..8675717c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -125,7 +125,7 @@ jobs: - name: Derive appropriate SHAs for base and head for `nx affected` commands id: set-shas uses: - nrwl/nx-set-shas@v3 + nrwl/nx-set-shas@v4 # get commits count and increment by 1 for safety - name: Find depth of NX_BASE @@ -449,7 +449,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - name: Derive appropriate SHAs for base and head for `nx affected` commands - uses: nrwl/nx-set-shas@v3 + uses: nrwl/nx-set-shas@v4 - run: npx nx-cloud start-ci-run From 34a77d7a7eb1452013dcce0cdc84e898f9d56e20 Mon Sep 17 00:00:00 2001 From: getlarge Date: Mon, 15 Jan 2024 08:57:15 +0100 Subject: [PATCH 06/14] chore: update Ory-NestJS libraries --- apps/auth/package.json | 2 +- apps/orders/package.json | 6 +- .../src/app/orders/orders.controller.ts | 71 +++++----- apps/payments/openapi.json | 2 +- apps/payments/package.json | 6 +- apps/tickets/package.json | 6 +- package.json | 6 +- yarn.lock | 133 +++--------------- 8 files changed, 73 insertions(+), 159 deletions(-) diff --git a/apps/auth/package.json b/apps/auth/package.json index 383c06c6..55727e3f 100644 --- a/apps/auth/package.json +++ b/apps/auth/package.json @@ -6,7 +6,7 @@ "@fastify/helmet": "11.0.0", "@fastify/passport": "2.3.0", "@fastify/secure-session": "7.1.0", - "@getlarge/kratos-client-wrapper": "0.0.1", + "@getlarge/kratos-client-wrapper": "0.0.2", "@nestjs/axios": "3.0.0", "@nestjs/common": "10.2.4", "@nestjs/config": "3.1.1", diff --git a/apps/orders/package.json b/apps/orders/package.json index e0a7b1ba..e3f02917 100644 --- a/apps/orders/package.json +++ b/apps/orders/package.json @@ -7,9 +7,9 @@ "@fastify/passport": "2.3.0", "@fastify/secure-session": "7.1.0", "@jest/globals": "29.7.0", - "@getlarge/keto-client-wrapper": "0.0.1", - "@getlarge/keto-relations-parser": "0.0.1", - "@getlarge/kratos-client-wrapper": "0.0.1", + "@getlarge/keto-client-wrapper": "0.0.2", + "@getlarge/keto-relations-parser": "0.0.2", + "@getlarge/kratos-client-wrapper": "0.0.2", "@nestjs/axios": "3.0.0", "@nestjs/common": "10.2.4", "@nestjs/config": "3.1.1", diff --git a/apps/orders/src/app/orders/orders.controller.ts b/apps/orders/src/app/orders/orders.controller.ts index 655990ea..b48bca8c 100644 --- a/apps/orders/src/app/orders/orders.controller.ts +++ b/apps/orders/src/app/orders/orders.controller.ts @@ -6,12 +6,14 @@ import { relationTupleBuilder } from '@getlarge/keto-relations-parser'; import { OryAuthenticationGuard } from '@getlarge/kratos-client-wrapper'; import { Body, + CanActivate, Controller, Delete, Get, HttpStatus, Param, Post, + Type, UseGuards, UsePipes, ValidationPipe, @@ -41,37 +43,38 @@ import { get } from 'lodash-es'; import { CreateOrder, CreateOrderDto, Order, OrderDto } from './models'; import { OrdersService } from './orders.service'; -const AuthenticationGuard = OryAuthenticationGuard({ - cookieResolver: (ctx) => - ctx.switchToHttp().getRequest().headers.cookie, - isValidSession: (x) => { - return ( - !!x?.identity && - typeof x.identity.traits === 'object' && - !!x.identity.traits && - 'email' in x.identity.traits && - typeof x.identity.metadata_public === 'object' && - !!x.identity.metadata_public && - 'id' in x.identity.metadata_public && - typeof x.identity.metadata_public.id === 'string' - ); - }, - sessionTokenResolver: (ctx) => - ctx - .switchToHttp() - .getRequest() - .headers?.authorization?.replace('Bearer ', ''), - postValidationHook: (ctx, session) => { - ctx.switchToHttp().getRequest().session = session; - ctx.switchToHttp().getRequest()[CURRENT_USER_KEY] = { - id: session.identity.metadata_public['id'], - email: session.identity.traits.email, - identityId: session.identity.id, - }; - }, -}); +const AuthenticationGuard = (): Type => + OryAuthenticationGuard({ + cookieResolver: (ctx) => + ctx.switchToHttp().getRequest().headers.cookie, + isValidSession: (x) => { + return ( + !!x?.identity && + typeof x.identity.traits === 'object' && + !!x.identity.traits && + 'email' in x.identity.traits && + typeof x.identity.metadata_public === 'object' && + !!x.identity.metadata_public && + 'id' in x.identity.metadata_public && + typeof x.identity.metadata_public.id === 'string' + ); + }, + sessionTokenResolver: (ctx) => + ctx + .switchToHttp() + .getRequest() + .headers?.authorization?.replace('Bearer ', ''), + postValidationHook: (ctx, session) => { + ctx.switchToHttp().getRequest().session = session; + ctx.switchToHttp().getRequest()[CURRENT_USER_KEY] = { + id: session.identity.metadata_public['id'], + email: session.identity.traits.email, + identityId: session.identity.id, + }; + }, + }); -const AuthorizationGuard = OryAuthorizationGuard({}); +const AuthorizationGuard = (): Type => OryAuthorizationGuard({}); @Controller(Resources.ORDERS) @ApiTags(Resources.ORDERS) @@ -89,7 +92,7 @@ export class OrdersController { .of(PermissionNamespaces[Resources.TICKETS], resourceId) .toString(); }) - @UseGuards(AuthenticationGuard, AuthorizationGuard) + @UseGuards(AuthenticationGuard(), AuthorizationGuard()) @UsePipes( new ValidationPipe({ transform: true, @@ -118,7 +121,7 @@ export class OrdersController { return this.ordersService.create(order, currentUser); } - @UseGuards(OryAuthenticationGuard) + @UseGuards(AuthenticationGuard()) @ApiBearerAuth(SecurityRequirements.Bearer) @ApiCookieAuth(SecurityRequirements.Session) @ApiOperation({ @@ -146,7 +149,7 @@ export class OrdersController { .of(PermissionNamespaces[Resources.ORDERS], resourceId) .toString(); }) - @UseGuards(AuthenticationGuard, AuthorizationGuard) + @UseGuards(AuthenticationGuard(), AuthorizationGuard()) @ApiBearerAuth(SecurityRequirements.Bearer) @ApiCookieAuth(SecurityRequirements.Session) @ApiOperation({ @@ -173,7 +176,7 @@ export class OrdersController { .of(PermissionNamespaces[Resources.ORDERS], resourceId) .toString(); }) - @UseGuards(AuthenticationGuard, AuthorizationGuard) + @UseGuards(AuthenticationGuard(), AuthorizationGuard()) @UsePipes( new ValidationPipe({ transform: true, diff --git a/apps/payments/openapi.json b/apps/payments/openapi.json index eb420c42..1ec51e0c 100644 --- a/apps/payments/openapi.json +++ b/apps/payments/openapi.json @@ -112,7 +112,7 @@ }, "version": { "type": "number", - "description": "Payment version represented by a number incremented at each updated" + "description": "Payment version represented by a number incremented at each update" } }, "required": [ diff --git a/apps/payments/package.json b/apps/payments/package.json index a76ed36a..c086fb76 100644 --- a/apps/payments/package.json +++ b/apps/payments/package.json @@ -6,9 +6,9 @@ "@fastify/helmet": "11.0.0", "@fastify/passport": "2.3.0", "@fastify/secure-session": "7.1.0", - "@getlarge/keto-client-wrapper": "0.0.1", - "@getlarge/keto-relations-parser": "0.0.1", - "@getlarge/kratos-client-wrapper": "0.0.1", + "@getlarge/keto-client-wrapper": "0.0.2", + "@getlarge/keto-relations-parser": "0.0.2", + "@getlarge/kratos-client-wrapper": "0.0.2", "@nestjs/axios": "3.0.0", "@nestjs/common": "10.2.4", "@nestjs/config": "3.1.1", diff --git a/apps/tickets/package.json b/apps/tickets/package.json index 32a6a0bd..f9d2b494 100644 --- a/apps/tickets/package.json +++ b/apps/tickets/package.json @@ -7,9 +7,9 @@ "@fastify/helmet": "11.0.0", "@fastify/passport": "2.3.0", "@fastify/secure-session": "7.1.0", - "@getlarge/keto-client-wrapper": "0.0.1", - "@getlarge/keto-relations-parser": "0.0.1", - "@getlarge/kratos-client-wrapper": "0.0.1", + "@getlarge/keto-client-wrapper": "0.0.2", + "@getlarge/keto-relations-parser": "0.0.2", + "@getlarge/kratos-client-wrapper": "0.0.2", "@nestjs/axios": "3.0.0", "@nestjs/common": "10.2.4", "@nestjs/config": "3.1.1", diff --git a/package.json b/package.json index 4ce16b73..15f4b390 100644 --- a/package.json +++ b/package.json @@ -117,9 +117,9 @@ "@fastify/secure-session": "7.1.0", "@fastify/static": "^6.12.0", "@fastify/swagger": "8.10.0", - "@getlarge/keto-client-wrapper": "0.0.1", - "@getlarge/keto-relations-parser": "0.0.1", - "@getlarge/kratos-client-wrapper": "0.0.1", + "@getlarge/keto-client-wrapper": "0.0.2", + "@getlarge/keto-relations-parser": "0.0.2", + "@getlarge/kratos-client-wrapper": "0.0.2", "@nestjs/axios": "3.0.0", "@nestjs/bull": "10.0.1", "@nestjs/common": "10.2.4", diff --git a/yarn.lock b/yarn.lock index d9232ee8..a93bef09 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3801,44 +3801,46 @@ __metadata: languageName: node linkType: hard -"@getlarge/keto-client-wrapper@npm:0.0.1": - version: 0.0.1 - resolution: "@getlarge/keto-client-wrapper@npm:0.0.1" +"@getlarge/keto-client-wrapper@npm:0.0.2": + version: 0.0.2 + resolution: "@getlarge/keto-client-wrapper@npm:0.0.2" dependencies: - "@getlarge/keto-relations-parser": 0.0.1 + "@getlarge/keto-relations-parser": 0.0.2 + defekt: ^9.3.1 + lodash.get: ^4.4.2 + tslib: ^2.3.0 + peerDependencies: "@nestjs/axios": ^3.0.1 "@nestjs/common": ^10.0.2 "@nestjs/core": ^10.0.2 "@ory/client": ^1.4.9 axios: 1.6.5 - defekt: ^9.3.1 - lodash.get: ^4.4.2 - tslib: ^2.3.0 - checksum: 4f58f96d6bec9328ab1401e7dde76860554996e3970f78b601d97e9028c8ae1c539bf9de0e3ab47d86ba8f56f2f6b89e37d144c8c18944a46cc31ddd4281dca8 + checksum: d38a03c5eb818a41646b9f3e3c2b07713c624f2e58e3b6c9faf3e7340fd1d47bc7764e7ab550788803b3948a892b14b3eb11286e0a98b994ce396848dda79cbe languageName: node linkType: hard -"@getlarge/keto-relations-parser@npm:0.0.1": - version: 0.0.1 - resolution: "@getlarge/keto-relations-parser@npm:0.0.1" +"@getlarge/keto-relations-parser@npm:0.0.2": + version: 0.0.2 + resolution: "@getlarge/keto-relations-parser@npm:0.0.2" dependencies: defekt: ^9.3.1 lodash.get: ^4.4.2 tslib: ^2.3.0 - checksum: 64087eef5f0f37b45f20084019e2bd9dad84d62616ba8ae95da7e6cf73702b10dc1808e087ff70a64123ae869da294835756bdac96b407c3c8a3ac457ef32174 + checksum: 98a25663324717202e2d9dcb49daa5f589006300c5a89fec2245bbac1aed74b9701cb5d0eca2aabba5ad316ab0452a9670756d6cfa15df1785c9e40f3f4bd872 languageName: node linkType: hard -"@getlarge/kratos-client-wrapper@npm:0.0.1": - version: 0.0.1 - resolution: "@getlarge/kratos-client-wrapper@npm:0.0.1" +"@getlarge/kratos-client-wrapper@npm:0.0.2": + version: 0.0.2 + resolution: "@getlarge/kratos-client-wrapper@npm:0.0.2" dependencies: + tslib: ^2.3.0 + peerDependencies: "@nestjs/axios": ^3.0.1 "@nestjs/common": ^10.0.2 "@ory/client": ^1.4.9 axios: 1.6.5 - tslib: ^2.3.0 - checksum: cb382c7882b22163879fe804188fad10b0d6a8a2f37817c5a16c0adab0147cd94ca79d08af78d9f398d29635863fa6a463993f1f5325e5482003e5adb7e621a0 + checksum: adfa8f2c43c4ccb339f96bcda665730eec695a5828ca4438600181e646ddb8ec443b710d9747b2bf20d260e029f7cc0f1616998a8e611053c7b9c0f0764e657e languageName: node linkType: hard @@ -4391,18 +4393,6 @@ __metadata: languageName: node linkType: hard -"@nestjs/axios@npm:^3.0.1": - version: 3.0.1 - resolution: "@nestjs/axios@npm:3.0.1" - peerDependencies: - "@nestjs/common": ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 - axios: ^1.3.1 - reflect-metadata: ^0.1.12 - rxjs: ^6.0.0 || ^7.0.0 - checksum: 01cebc64efa7a1d9df7a9053fbc5124986a95078789a0f280a2a61c31601a70a35745e07fc385497b4f85c7bdb6216a3575728646f1e6e684c038ac31900129c - languageName: node - linkType: hard - "@nestjs/bull-shared@npm:^10.0.1": version: 10.0.1 resolution: "@nestjs/bull-shared@npm:10.0.1" @@ -4450,27 +4440,6 @@ __metadata: languageName: node linkType: hard -"@nestjs/common@npm:^10.0.2": - version: 10.3.0 - resolution: "@nestjs/common@npm:10.3.0" - dependencies: - iterare: 1.2.1 - tslib: 2.6.2 - uid: 2.0.2 - peerDependencies: - class-transformer: "*" - class-validator: "*" - reflect-metadata: ^0.1.12 - rxjs: ^7.1.0 - peerDependenciesMeta: - class-transformer: - optional: true - class-validator: - optional: true - checksum: c5444cb46bd4f4a4d28b5031f7c28a0cf9863bc2d5518910bfed6a49734f59e1ea08dd4651e2117ae82df81c933ef84f0963c5cdeee5ef1608cf1bd36ee291c5 - languageName: node - linkType: hard - "@nestjs/config@npm:3.1.1": version: 3.1.1 resolution: "@nestjs/config@npm:3.1.1" @@ -4514,34 +4483,6 @@ __metadata: languageName: node linkType: hard -"@nestjs/core@npm:^10.0.2": - version: 10.3.0 - resolution: "@nestjs/core@npm:10.3.0" - dependencies: - "@nuxtjs/opencollective": 0.3.2 - fast-safe-stringify: 2.1.1 - iterare: 1.2.1 - path-to-regexp: 3.2.0 - tslib: 2.6.2 - uid: 2.0.2 - peerDependencies: - "@nestjs/common": ^10.0.0 - "@nestjs/microservices": ^10.0.0 - "@nestjs/platform-express": ^10.0.0 - "@nestjs/websockets": ^10.0.0 - reflect-metadata: ^0.1.12 - rxjs: ^7.1.0 - peerDependenciesMeta: - "@nestjs/microservices": - optional: true - "@nestjs/platform-express": - optional: true - "@nestjs/websockets": - optional: true - checksum: 7677b9fb97c8dec512c2a736c273ef08698b377af8c046bc5aad442ba3d35acbc17d177e76bf44a66678cae2ced2d265183e85be4190c501a195f16496df6396 - languageName: node - linkType: hard - "@nestjs/jwt@npm:10.1.0": version: 10.1.0 resolution: "@nestjs/jwt@npm:10.1.0" @@ -5604,15 +5545,6 @@ __metadata: languageName: node linkType: hard -"@ory/client@npm:^1.4.9": - version: 1.5.1 - resolution: "@ory/client@npm:1.5.1" - dependencies: - axios: ^0.27.2 - checksum: acadd44f3d855827e4ada02f5b504a176e5b3c013e7db993bb70bdb62cab9c98354982bc36b74eadc083cbaabb87c17a99d60c226d854b80270979d185a9f93c - languageName: node - linkType: hard - "@phenomnomnominal/tsquery@npm:~5.0.1": version: 5.0.1 resolution: "@phenomnomnominal/tsquery@npm:5.0.1" @@ -8266,17 +8198,6 @@ __metadata: languageName: node linkType: hard -"axios@npm:1.6.5": - version: 1.6.5 - resolution: "axios@npm:1.6.5" - dependencies: - follow-redirects: ^1.15.4 - form-data: ^4.0.0 - proxy-from-env: ^1.1.0 - checksum: e28d67b2d9134cb4608c44d8068b0678cfdccc652742e619006f27264a30c7aba13b2cd19c6f1f52ae195b5232734925928fb192d5c85feea7edd2f273df206d - languageName: node - linkType: hard - "axios@npm:^0.27.2": version: 0.27.2 resolution: "axios@npm:0.27.2" @@ -13424,16 +13345,6 @@ __metadata: languageName: node linkType: hard -"follow-redirects@npm:^1.15.4": - version: 1.15.5 - resolution: "follow-redirects@npm:1.15.5" - peerDependenciesMeta: - debug: - optional: true - checksum: 5ca49b5ce6f44338cbfc3546823357e7a70813cecc9b7b768158a1d32c1e62e7407c944402a918ea8c38ae2e78266312d617dc68783fac502cbb55e1047b34ec - languageName: node - linkType: hard - "for-each@npm:^0.3.3": version: 0.3.3 resolution: "for-each@npm:0.3.3" @@ -22464,9 +22375,9 @@ __metadata: "@fastify/secure-session": 7.1.0 "@fastify/static": ^6.12.0 "@fastify/swagger": 8.10.0 - "@getlarge/keto-client-wrapper": 0.0.1 - "@getlarge/keto-relations-parser": 0.0.1 - "@getlarge/kratos-client-wrapper": 0.0.1 + "@getlarge/keto-client-wrapper": 0.0.2 + "@getlarge/keto-relations-parser": 0.0.2 + "@getlarge/kratos-client-wrapper": 0.0.2 "@jscutlery/semver": ^3.1.0 "@mermaid-js/mermaid-cli": ^8.13.4 "@nestjs/axios": 3.0.0 From 5cc72fd9b1a0cdf3bfc0941a67bc590a6ed6caaa Mon Sep 17 00:00:00 2001 From: getlarge Date: Mon, 15 Jan 2024 09:27:48 +0100 Subject: [PATCH 07/14] test(microservices-shared-testing): update Ory mock classes --- .../microservices/shared/testing/src/index.ts | 5 +++-- .../src/ory-authentication.service.mock.ts | 12 ----------- .../testing/src/ory-frontend.service.mock.ts | 5 +++++ .../src/ory-permission.service.mock.ts | 21 ------------------- .../src/ory-permissions.service.mock.ts | 6 ++++++ .../src/ory-relationships.service.mock.ts | 7 +++++++ 6 files changed, 21 insertions(+), 35 deletions(-) delete mode 100644 libs/microservices/shared/testing/src/ory-authentication.service.mock.ts create mode 100644 libs/microservices/shared/testing/src/ory-frontend.service.mock.ts delete mode 100644 libs/microservices/shared/testing/src/ory-permission.service.mock.ts create mode 100644 libs/microservices/shared/testing/src/ory-permissions.service.mock.ts create mode 100644 libs/microservices/shared/testing/src/ory-relationships.service.mock.ts diff --git a/libs/microservices/shared/testing/src/index.ts b/libs/microservices/shared/testing/src/index.ts index bec61dbf..0891c952 100644 --- a/libs/microservices/shared/testing/src/index.ts +++ b/libs/microservices/shared/testing/src/index.ts @@ -1,5 +1,6 @@ export * from './client-proxy.mock'; export * from './mongoose-model.mock'; -export * from './ory-authentication.service.mock'; -export * from './ory-permission.service.mock'; +export * from './ory-frontend.service.mock'; +export * from './ory-permissions.service.mock'; +export * from './ory-relationships.service.mock'; export * from './sign-in.mock'; diff --git a/libs/microservices/shared/testing/src/ory-authentication.service.mock.ts b/libs/microservices/shared/testing/src/ory-authentication.service.mock.ts deleted file mode 100644 index b1a03331..00000000 --- a/libs/microservices/shared/testing/src/ory-authentication.service.mock.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { jest } from '@jest/globals'; - -export class MockOryAuthenticationService { - validateSession = jest.fn(); - updateIdentityMetadata = jest.fn(); - getIdentity = jest.fn(); - toggleIdentityState = jest.fn(); - deleteIdentity = jest.fn(); - signOut = jest.fn(); - createClient = jest.fn(); - getClient = jest.fn(); -} diff --git a/libs/microservices/shared/testing/src/ory-frontend.service.mock.ts b/libs/microservices/shared/testing/src/ory-frontend.service.mock.ts new file mode 100644 index 00000000..9c352760 --- /dev/null +++ b/libs/microservices/shared/testing/src/ory-frontend.service.mock.ts @@ -0,0 +1,5 @@ +import { jest } from '@jest/globals'; + +export class MockOryFrontendService { + toSession = jest.fn(); +} diff --git a/libs/microservices/shared/testing/src/ory-permission.service.mock.ts b/libs/microservices/shared/testing/src/ory-permission.service.mock.ts deleted file mode 100644 index a1aaad2c..00000000 --- a/libs/microservices/shared/testing/src/ory-permission.service.mock.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { jest } from '@jest/globals'; -import { Logger } from '@nestjs/common'; -import type { PermissionApi, RelationshipApi } from '@ory/client'; - -export class MockOryPermissionService { - readonly logger = new Logger(); - private readonly relationShipApi: RelationshipApi; - private readonly permissionApi: PermissionApi; - - createRelationQuery = jest.fn(); - createFlattenRelationQuery = jest.fn(); - createRelationTuple = jest.fn(); - createPermissionCheckQuery = jest.fn(); - createExpandPermissionQuery = jest.fn(); - - createRelation = jest.fn(); - deleteRelation = jest.fn(); - getRelations = jest.fn(); - checkPermission = jest.fn(); - expandPermissions = jest.fn(); -} diff --git a/libs/microservices/shared/testing/src/ory-permissions.service.mock.ts b/libs/microservices/shared/testing/src/ory-permissions.service.mock.ts new file mode 100644 index 00000000..383318ab --- /dev/null +++ b/libs/microservices/shared/testing/src/ory-permissions.service.mock.ts @@ -0,0 +1,6 @@ +import { jest } from '@jest/globals'; + +export class MockOryPermissionsService { + checkPermission = jest.fn(); + expandPermissions = jest.fn(); +} diff --git a/libs/microservices/shared/testing/src/ory-relationships.service.mock.ts b/libs/microservices/shared/testing/src/ory-relationships.service.mock.ts new file mode 100644 index 00000000..ed648ac2 --- /dev/null +++ b/libs/microservices/shared/testing/src/ory-relationships.service.mock.ts @@ -0,0 +1,7 @@ +import { jest } from '@jest/globals'; + +export class MockOryRelationshipsService { + createRelationship = jest.fn(); + deleteRelationships = jest.fn(); + getRelationships = jest.fn(); +} From 8cf88e8a9123512128f851787e9028c4123e45f0 Mon Sep 17 00:00:00 2001 From: getlarge Date: Mon, 15 Jan 2024 17:44:43 +0100 Subject: [PATCH 08/14] test: update TS configurations --- apps/auth/tsconfig.spec.json | 1 + apps/expiration/tsconfig.spec.json | 1 + apps/ng-client/tsconfig.spec.json | 6 ++---- apps/orders/tsconfig.spec.json | 1 + apps/payments/tsconfig.spec.json | 1 + apps/permissions-manager/tsconfig.spec.json | 1 + apps/tickets/tsconfig.spec.json | 1 + 7 files changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/auth/tsconfig.spec.json b/apps/auth/tsconfig.spec.json index bfa20ebe..427d8447 100644 --- a/apps/auth/tsconfig.spec.json +++ b/apps/auth/tsconfig.spec.json @@ -13,6 +13,7 @@ "allowJs": true }, "include": [ + "**/*.ts", "**/*.e2e-spec.ts", "**/*.spec.ts", "**/*.d.ts", diff --git a/apps/expiration/tsconfig.spec.json b/apps/expiration/tsconfig.spec.json index bfa20ebe..427d8447 100644 --- a/apps/expiration/tsconfig.spec.json +++ b/apps/expiration/tsconfig.spec.json @@ -13,6 +13,7 @@ "allowJs": true }, "include": [ + "**/*.ts", "**/*.e2e-spec.ts", "**/*.spec.ts", "**/*.d.ts", diff --git a/apps/ng-client/tsconfig.spec.json b/apps/ng-client/tsconfig.spec.json index 996e22c0..b08c8854 100644 --- a/apps/ng-client/tsconfig.spec.json +++ b/apps/ng-client/tsconfig.spec.json @@ -11,13 +11,11 @@ ], "strictPropertyInitialization": false }, - "files": [ - "src/test-setup.ts" - ], "include": [ "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts", - "jest.config.ts" + "jest.config.ts", + "src/test-setup.ts" ] } diff --git a/apps/orders/tsconfig.spec.json b/apps/orders/tsconfig.spec.json index bfa20ebe..427d8447 100644 --- a/apps/orders/tsconfig.spec.json +++ b/apps/orders/tsconfig.spec.json @@ -13,6 +13,7 @@ "allowJs": true }, "include": [ + "**/*.ts", "**/*.e2e-spec.ts", "**/*.spec.ts", "**/*.d.ts", diff --git a/apps/payments/tsconfig.spec.json b/apps/payments/tsconfig.spec.json index bfa20ebe..427d8447 100644 --- a/apps/payments/tsconfig.spec.json +++ b/apps/payments/tsconfig.spec.json @@ -13,6 +13,7 @@ "allowJs": true }, "include": [ + "**/*.ts", "**/*.e2e-spec.ts", "**/*.spec.ts", "**/*.d.ts", diff --git a/apps/permissions-manager/tsconfig.spec.json b/apps/permissions-manager/tsconfig.spec.json index bfa20ebe..427d8447 100644 --- a/apps/permissions-manager/tsconfig.spec.json +++ b/apps/permissions-manager/tsconfig.spec.json @@ -13,6 +13,7 @@ "allowJs": true }, "include": [ + "**/*.ts", "**/*.e2e-spec.ts", "**/*.spec.ts", "**/*.d.ts", diff --git a/apps/tickets/tsconfig.spec.json b/apps/tickets/tsconfig.spec.json index c11d419b..0fd80b03 100644 --- a/apps/tickets/tsconfig.spec.json +++ b/apps/tickets/tsconfig.spec.json @@ -13,6 +13,7 @@ "allowJs": true }, "include": [ + "**/*.ts", "**/*.e2e-spec.ts", "**/*.mock.ts", "**/*.spec.ts", From b6c281eae714f7171c62ba2213cbec7863c8b497 Mon Sep 17 00:00:00 2001 From: getlarge Date: Mon, 15 Jan 2024 17:45:21 +0100 Subject: [PATCH 09/14] test: update unit tests --- apps/auth/src/app/app.controller.spec.ts | 1 + apps/auth/src/app/app.service.spec.ts | 1 + .../expiration/src/app/app.controller.spec.ts | 1 + apps/expiration/src/app/app.service.spec.ts | 1 + apps/orders/src/app/app.controller.spec.ts | 1 + apps/orders/src/app/app.service.spec.ts | 1 + .../app/orders/orders-ms.controller.spec.ts | 10 ++++++-- apps/payments/src/app/app.controller.spec.ts | 1 + apps/payments/src/app/app.service.spec.ts | 1 + .../src/app/create-relation.command.spec.ts | 23 +++++++++++-------- apps/tickets/src/app/app.controller.spec.ts | 1 + apps/tickets/src/app/app.service.spec.ts | 1 + .../app/orders/orders-ms.controller.spec.ts | 4 ++-- 13 files changed, 34 insertions(+), 13 deletions(-) diff --git a/apps/auth/src/app/app.controller.spec.ts b/apps/auth/src/app/app.controller.spec.ts index 3e86c436..260e842f 100644 --- a/apps/auth/src/app/app.controller.spec.ts +++ b/apps/auth/src/app/app.controller.spec.ts @@ -1,3 +1,4 @@ +import { beforeAll, describe, expect, it } from '@jest/globals'; import { Test, TestingModule } from '@nestjs/testing'; import { AppController } from './app.controller'; diff --git a/apps/auth/src/app/app.service.spec.ts b/apps/auth/src/app/app.service.spec.ts index 3f6d1d7e..c8e7256c 100644 --- a/apps/auth/src/app/app.service.spec.ts +++ b/apps/auth/src/app/app.service.spec.ts @@ -1,3 +1,4 @@ +import { beforeAll, describe, expect, it } from '@jest/globals'; import { Test } from '@nestjs/testing'; import { AppService } from './app.service'; diff --git a/apps/expiration/src/app/app.controller.spec.ts b/apps/expiration/src/app/app.controller.spec.ts index f5eb6eca..d6254e59 100644 --- a/apps/expiration/src/app/app.controller.spec.ts +++ b/apps/expiration/src/app/app.controller.spec.ts @@ -1,3 +1,4 @@ +import { beforeAll, describe, expect, it } from '@jest/globals'; import { Test, TestingModule } from '@nestjs/testing'; import { AppController } from './app.controller'; diff --git a/apps/expiration/src/app/app.service.spec.ts b/apps/expiration/src/app/app.service.spec.ts index c3032e95..307e0b92 100644 --- a/apps/expiration/src/app/app.service.spec.ts +++ b/apps/expiration/src/app/app.service.spec.ts @@ -1,3 +1,4 @@ +import { beforeAll, describe, expect, it } from '@jest/globals'; import { Test } from '@nestjs/testing'; import { AppService } from './app.service'; diff --git a/apps/orders/src/app/app.controller.spec.ts b/apps/orders/src/app/app.controller.spec.ts index d040607b..032535ff 100644 --- a/apps/orders/src/app/app.controller.spec.ts +++ b/apps/orders/src/app/app.controller.spec.ts @@ -1,3 +1,4 @@ +import { beforeAll, describe, expect, it } from '@jest/globals'; import { Test, TestingModule } from '@nestjs/testing'; import { AppController } from './app.controller'; diff --git a/apps/orders/src/app/app.service.spec.ts b/apps/orders/src/app/app.service.spec.ts index 2bb9d999..a4f2d2af 100644 --- a/apps/orders/src/app/app.service.spec.ts +++ b/apps/orders/src/app/app.service.spec.ts @@ -1,3 +1,4 @@ +import { beforeAll, describe, expect, it } from '@jest/globals'; import { Test } from '@nestjs/testing'; import { AppService } from './app.service'; diff --git a/apps/orders/src/app/orders/orders-ms.controller.spec.ts b/apps/orders/src/app/orders/orders-ms.controller.spec.ts index c180efad..46e8c52a 100644 --- a/apps/orders/src/app/orders/orders-ms.controller.spec.ts +++ b/apps/orders/src/app/orders/orders-ms.controller.spec.ts @@ -1,13 +1,15 @@ /* eslint-disable max-nested-callbacks */ /* eslint-disable max-lines-per-function */ /* eslint-disable @typescript-eslint/no-explicit-any */ +import { OryPermissionsService } from '@getlarge/keto-client-wrapper'; import { jest } from '@jest/globals'; import { ConfigService } from '@nestjs/config'; import { Test, TestingModule } from '@nestjs/testing'; import { createRmqContext, MockModel, - MockOryPermissionService, + MockOryPermissionsService, + MockOryRelationshipsService, MockPublisher, } from '@ticketing/microservices/shared/testing'; import { Channel } from 'amqp-connection-manager'; @@ -30,12 +32,16 @@ describe('OrdersMSController', () => { new MockModel() as any, new MockModel() as any, new ConfigService({ EXPIRATION_WINDOW_SECONDS: 15 * 60 }), - new MockOryPermissionService() as any, + new MockOryRelationshipsService() as any, new MockPublisher() as any, new MockPublisher() as any, new MockPublisher() as any, ), }, + { + provide: OryPermissionsService, + useValue: new MockOryPermissionsService() as any, + }, ], }).compile(); }); diff --git a/apps/payments/src/app/app.controller.spec.ts b/apps/payments/src/app/app.controller.spec.ts index d37f216f..64976ec5 100644 --- a/apps/payments/src/app/app.controller.spec.ts +++ b/apps/payments/src/app/app.controller.spec.ts @@ -1,3 +1,4 @@ +import { beforeAll, describe, expect, it } from '@jest/globals'; import { Test, TestingModule } from '@nestjs/testing'; import { AppController } from './app.controller'; diff --git a/apps/payments/src/app/app.service.spec.ts b/apps/payments/src/app/app.service.spec.ts index 5d4be800..a171eeca 100644 --- a/apps/payments/src/app/app.service.spec.ts +++ b/apps/payments/src/app/app.service.spec.ts @@ -1,3 +1,4 @@ +import { beforeAll, describe, expect, it } from '@jest/globals'; import { Test } from '@nestjs/testing'; import { AppService } from './app.service'; diff --git a/apps/permissions-manager/src/app/create-relation.command.spec.ts b/apps/permissions-manager/src/app/create-relation.command.spec.ts index c6ddddbb..30a2fd0a 100644 --- a/apps/permissions-manager/src/app/create-relation.command.spec.ts +++ b/apps/permissions-manager/src/app/create-relation.command.spec.ts @@ -2,15 +2,19 @@ import { OryRelationshipsModule, OryRelationshipsService, } from '@getlarge/keto-client-wrapper'; -import { RelationTuple } from '@getlarge/keto-relations-parser'; +import { + createRelationQuery, + RelationTuple, +} from '@getlarge/keto-relations-parser'; import { jest } from '@jest/globals'; -import { MockOryPermissionService } from '@ticketing/microservices/shared/testing'; +import { MockOryRelationshipsService } from '@ticketing/microservices/shared/testing'; import { CommandTestFactory } from 'nest-commander-testing'; import { CreateRelationCommand } from './create-relation.command'; describe('CreateRelationCommand', () => { let service: CreateRelationCommand; + const mockOryRelationshipsService = new MockOryRelationshipsService(); beforeAll(async () => { const app = await CommandTestFactory.createTestingCommand({ @@ -25,7 +29,7 @@ describe('CreateRelationCommand', () => { providers: [CreateRelationCommand], }) .overrideProvider(OryRelationshipsService) - .useClass(MockOryPermissionService) + .useValue(mockOryRelationshipsService) .compile(); service = app.get(CreateRelationCommand); @@ -33,7 +37,7 @@ describe('CreateRelationCommand', () => { describe('run', () => { it('should process tuple and create relationship', async () => { - const expectedTuple: RelationTuple = { + const tuple: RelationTuple = { namespace: 'Group', object: 'admin', relation: 'members', @@ -42,18 +46,19 @@ describe('CreateRelationCommand', () => { object: '1', }, }; - service['oryPermissionsService'].createRelation = jest + const expectedQuery = createRelationQuery(tuple).unwrapOrThrow(); + mockOryRelationshipsService.createRelationship = jest .fn(() => Promise.resolve(true)) .mockResolvedValue(true); await expect( service.run(['--tuple', 'Group:admin#members@User:1'], { - tuple: expectedTuple, + tuple: expectedQuery, }), ).resolves.toBeUndefined(); - expect(service['oryPermissionsService'].createRelation).toBeCalledWith( - expectedTuple, - ); + expect(mockOryRelationshipsService.createRelationship).toBeCalledWith({ + createRelationshipBody: expectedQuery, + }); }); }); }); diff --git a/apps/tickets/src/app/app.controller.spec.ts b/apps/tickets/src/app/app.controller.spec.ts index 619b0c14..16866c4e 100644 --- a/apps/tickets/src/app/app.controller.spec.ts +++ b/apps/tickets/src/app/app.controller.spec.ts @@ -1,3 +1,4 @@ +import { beforeAll, describe, expect, it } from '@jest/globals'; import { Test, TestingModule } from '@nestjs/testing'; import { AppController } from './app.controller'; diff --git a/apps/tickets/src/app/app.service.spec.ts b/apps/tickets/src/app/app.service.spec.ts index a8ec2a3b..9a9b26df 100644 --- a/apps/tickets/src/app/app.service.spec.ts +++ b/apps/tickets/src/app/app.service.spec.ts @@ -1,3 +1,4 @@ +import { beforeAll, describe, expect, it } from '@jest/globals'; import { Test } from '@nestjs/testing'; import { AppService } from './app.service'; diff --git a/apps/tickets/src/app/orders/orders-ms.controller.spec.ts b/apps/tickets/src/app/orders/orders-ms.controller.spec.ts index 2be3bc9b..ffbba44f 100644 --- a/apps/tickets/src/app/orders/orders-ms.controller.spec.ts +++ b/apps/tickets/src/app/orders/orders-ms.controller.spec.ts @@ -6,7 +6,7 @@ import { Test, TestingModule } from '@nestjs/testing'; import { createRmqContext, MockModel, - MockOryPermissionService, + MockOryRelationshipsService, MockPublisher, } from '@ticketing/microservices/shared/testing'; import { Channel } from 'amqp-connection-manager'; @@ -27,7 +27,7 @@ describe('OrdersMSController', () => { provide: TicketsService, useValue: new TicketsService( new MockModel() as any, - new MockOryPermissionService() as any, + new MockOryRelationshipsService() as any, new MockPublisher() as any, ), }, From 181b34af67fd8d6cbd57980ed33babde8e90319d Mon Sep 17 00:00:00 2001 From: getlarge Date: Mon, 15 Jan 2024 18:52:02 +0100 Subject: [PATCH 10/14] ci: revert cache action bump --- .github/actions/checkout-and-yarn/action.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/checkout-and-yarn/action.yaml b/.github/actions/checkout-and-yarn/action.yaml index b4613e58..dac4efd9 100644 --- a/.github/actions/checkout-and-yarn/action.yaml +++ b/.github/actions/checkout-and-yarn/action.yaml @@ -50,7 +50,7 @@ runs: # follow advice in https://gist.github.com/belgattitude/042f9caf10d029badbde6cf9d43e400a - name: Cache / restore yarn cache id: yarn-cache - uses: actions/cache@v4 + uses: actions/cache@v3 with: path: ${{ steps.yarn-config.outputs.CACHE_FOLDER }} key: yarn-cache-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }} @@ -59,7 +59,7 @@ runs: - name: ♻️ Cache / restore yarn install state id: yarn-install-state-cache - uses: actions/cache@v4 + uses: actions/cache@v3 with: path: .yarn/ci-cache/ key: yarn-install-state-cache-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ hashFiles('yarn.lock', '.yarnrc.yml') }} From da2e087c9c6bb01d14b1638acf1ee05fa3f30333 Mon Sep 17 00:00:00 2001 From: getlarge Date: Mon, 15 Jan 2024 17:54:52 +0000 Subject: [PATCH 11/14] chore: regenerate backend package*.json [skip ci] --- apps/auth/package-lock.json | 883 +++++++++++++++++++++++------- apps/auth/package.json | 17 +- apps/expiration/package-lock.json | 775 ++++++++++++++++++++++---- apps/expiration/package.json | 18 +- apps/orders/package-lock.json | 286 +++------- apps/orders/package.json | 16 +- apps/payments/package-lock.json | 286 +++------- apps/payments/package.json | 15 +- apps/tickets/package-lock.json | 286 +++------- apps/tickets/package.json | 14 +- 10 files changed, 1712 insertions(+), 884 deletions(-) diff --git a/apps/auth/package-lock.json b/apps/auth/package-lock.json index 10e94e3b..72ba0e3b 100644 --- a/apps/auth/package-lock.json +++ b/apps/auth/package-lock.json @@ -13,13 +13,13 @@ "@fastify/helmet": "11.0.0", "@fastify/passport": "2.3.0", "@fastify/secure-session": "7.1.0", - "@fastify/static": "6.11.0", - "@nestjs-plugins/nestjs-nats-streaming-transport": "1.2.0", + "@fastify/static": "6.12.0", + "@getlarge/kratos-client-wrapper": "0.0.2", + "@jest/globals": "29.7.0", "@nestjs/axios": "3.0.0", "@nestjs/common": "10.2.4", "@nestjs/config": "3.1.1", "@nestjs/core": "10.2.4", - "@nestjs/jwt": "10.1.0", "@nestjs/microservices": "10.2.4", "@nestjs/mongoose": "10.0.1", "@nestjs/platform-fastify": "10.2.4", @@ -28,37 +28,29 @@ "@nx/webpack": "17.1.3", "amqp-connection-manager": "4.1.14", "amqplib": "0.10.3", - "antlr4ng": "2.0.3", - "axios": "1.5.0", + "axios": "1.6.2", "class-transformer": "0.5.1", "class-validator": "0.13.2", - "defekt": "9.3.1", "dotenv": "16.3.1", "dotenv-expand": "10.0.0", "fastify": "4.22.0", - "lodash": "4.17.21", "lodash-es": "4.17.21", - "mongoose": "6.12.0", + "mongoose": "^6.1.0", "nestjs-keyset-paginator": "3.0.4", "nestjs-pino": "3.4.0", "passport-jwt": "4.0.0", "pino-http": "8.5.0", - "reflect-metadata": "0.1.13", + "reflect-metadata": "0.1.14", "rxjs": "7.8.1", "ts-mixer": "6.0.1", - "tslib": "2.6.2", "webpack-node-externals": "3.0.0" }, "peerDependencies": { - "ioredis": "4.28.5", - "nats": "1.4.12" + "ioredis": "4.28.5" }, "peerDependenciesMeta": { "ioredis": { "optional": true - }, - "nats": { - "optional": true } } }, @@ -1346,6 +1338,17 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/plugin-syntax-bigint": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", + "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/@babel/plugin-syntax-class-properties": { "version": "7.12.13", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", @@ -2692,17 +2695,212 @@ } }, "node_modules/@fastify/static": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/@fastify/static/-/static-6.11.0.tgz", - "integrity": "sha512-jgnqpRojDqOLHnnKlZgvvUFzR8rrxqkqzbtmuHp1amIArxGVJDXyBMPbxb3yteklBA7tPilXbx5xzDRiGXR0RA==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@fastify/static/-/static-6.12.0.tgz", + "integrity": "sha512-KK1B84E6QD/FcQWxDI2aiUCwHxMJBI1KeCUzm1BwYpPY1b742+jeKruGHP2uOluuM6OkBPI8CIANrXcCRtC2oQ==", "dependencies": { "@fastify/accept-negotiator": "^1.0.0", "@fastify/send": "^2.0.0", "content-disposition": "^0.5.3", "fastify-plugin": "^4.0.0", "glob": "^8.0.1", - "p-limit": "^3.1.0", - "readable-stream": "^4.0.0" + "p-limit": "^3.1.0" + } + }, + "node_modules/@getlarge/kratos-client-wrapper": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/@getlarge/kratos-client-wrapper/-/kratos-client-wrapper-0.0.2.tgz", + "integrity": "sha512-lycbuorh3WKyCgU8eOfLvCIHSWK48M5ysfRHooFd+mjYigh3R7g0TO6aLZVKlbWoKzj4JwszBnwd3oQe8Ot2CQ==", + "dependencies": { + "tslib": "^2.3.0" + }, + "peerDependencies": { + "@nestjs/axios": "^3.0.1", + "@nestjs/common": "^10.0.2", + "@ory/client": "^1.4.9", + "axios": "1.6.5" + } + }, + "node_modules/@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", + "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", + "dependencies": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "engines": { + "node": ">=6" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/environment": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.7.0.tgz", + "integrity": "sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==", + "dependencies": { + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ==", + "dependencies": { + "expect": "^29.7.0", + "jest-snapshot": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/expect-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.7.0.tgz", + "integrity": "sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==", + "dependencies": { + "jest-get-type": "^29.6.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/fake-timers": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.7.0.tgz", + "integrity": "sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==", + "dependencies": { + "@jest/types": "^29.6.3", + "@sinonjs/fake-timers": "^10.0.2", + "@types/node": "*", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/globals": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.7.0.tgz", + "integrity": "sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ==", + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/types": "^29.6.3", + "jest-mock": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/@jest/schemas": { @@ -2716,6 +2914,39 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/@jest/transform": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.7.0.tgz", + "integrity": "sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==", + "dependencies": { + "@babel/core": "^7.11.6", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "babel-plugin-istanbul": "^6.1.1", + "chalk": "^4.0.0", + "convert-source-map": "^2.0.0", + "fast-json-stable-stringify": "^2.1.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "micromatch": "^4.0.4", + "pirates": "^4.0.4", + "slash": "^3.0.0", + "write-file-atomic": "^4.0.2" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/transform/node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "engines": { + "node": ">=8" + } + }, "node_modules/@jest/types": { "version": "29.6.3", "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz", @@ -2814,22 +3045,6 @@ "sparse-bitfield": "^3.0.3" } }, - "node_modules/@nestjs-plugins/nestjs-nats-streaming-transport": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@nestjs-plugins/nestjs-nats-streaming-transport/-/nestjs-nats-streaming-transport-1.2.0.tgz", - "integrity": "sha512-SS0+JXVboKihYOQhB3rBqxUKTo2ppLr5/PrwnoWb1GCoMNYgwOKz6m6A1w1P/4D6cokQ0f/V8okZE3Ya1RmHfw==", - "dependencies": { - "node-nats-streaming": "^0.3.2", - "reflect-metadata": "^0.1.13", - "rxjs": "^7.5.7", - "shortid": "^2.2.16" - }, - "peerDependencies": { - "@nestjs/common": "^9.2.0", - "@nestjs/core": "^9.2.0", - "@nestjs/microservices": "^9.2.0" - } - }, "node_modules/@nestjs/axios": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@nestjs/axios/-/axios-3.0.0.tgz", @@ -2921,18 +3136,6 @@ } } }, - "node_modules/@nestjs/jwt": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/@nestjs/jwt/-/jwt-10.1.0.tgz", - "integrity": "sha512-iLwCGS25ybUxGS7i5j/Mwuyzvp/WxJftHlm8aLEBv5GV92apz6L1QVjxLdZrqXbzo++C8gdJauhzil8qitY+6w==", - "dependencies": { - "@types/jsonwebtoken": "9.0.2", - "jsonwebtoken": "9.0.0" - }, - "peerDependencies": { - "@nestjs/common": "^8.0.0 || ^9.0.0 || ^10.0.0" - } - }, "node_modules/@nestjs/mapped-types": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/@nestjs/mapped-types/-/mapped-types-2.0.2.tgz", @@ -3748,16 +3951,6 @@ "node": ">= 10" } }, - "node_modules/@nx/workspace/node_modules/axios": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", - "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", - "dependencies": { - "follow-redirects": "^1.15.0", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - } - }, "node_modules/@nx/workspace/node_modules/glob": { "version": "7.1.4", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", @@ -3875,6 +4068,25 @@ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, + "node_modules/@ory/client": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@ory/client/-/client-1.5.1.tgz", + "integrity": "sha512-5OiO/ZFQKbv51i3LUIu3ENHdo0cdgUpkO7i3+dY3qoE2FjrBRD8Vh+fF7njTJO89hdSc9ua0UhU/6yUxiM3SSg==", + "peer": true, + "dependencies": { + "axios": "^0.27.2" + } + }, + "node_modules/@ory/client/node_modules/axios": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", + "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", + "peer": true, + "dependencies": { + "follow-redirects": "^1.14.9", + "form-data": "^4.0.0" + } + }, "node_modules/@phenomnomnominal/tsquery": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/@phenomnomnominal/tsquery/-/tsquery-5.0.1.tgz", @@ -3891,6 +4103,22 @@ "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==" }, + "node_modules/@sinonjs/commons": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.0.tgz", + "integrity": "sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA==", + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/@sinonjs/fake-timers": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz", + "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==", + "dependencies": { + "@sinonjs/commons": "^3.0.0" + } + }, "node_modules/@smithy/abort-controller": { "version": "2.0.15", "resolved": "https://registry.npmjs.org/@smithy/abort-controller/-/abort-controller-2.0.15.tgz", @@ -4548,6 +4776,14 @@ "@types/send": "*" } }, + "node_modules/@types/graceful-fs": { + "version": "4.1.9", + "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", + "integrity": "sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/http-errors": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz", @@ -4587,14 +4823,6 @@ "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==" }, - "node_modules/@types/jsonwebtoken": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz", - "integrity": "sha512-drE6uz7QBKq1fYqqoFKTDRdFCPHd5TCub75BM+D+cMx7NU9hUz7SESLfC2fSCXVFMO5Yj8sOWHuGqPgjc+fz0Q==", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/mime": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", @@ -4671,6 +4899,11 @@ "@types/node": "*" } }, + "node_modules/@types/stack-utils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", + "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==" + }, "node_modules/@types/webidl-conversions": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.3.tgz", @@ -5100,23 +5333,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/antlr4ng": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/antlr4ng/-/antlr4ng-2.0.3.tgz", - "integrity": "sha512-usw0hZsNbTQrJ899P6sHLlQbmKgwQ9UBYq5rh6ZFicPf5qtRJogPVTBj4fSB3OY5ZLP5TSZ7d8tR2p4I5KyiLQ==", - "peerDependencies": { - "antlr4ng-cli": "^1.0.0" - } - }, - "node_modules/antlr4ng-cli": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/antlr4ng-cli/-/antlr4ng-cli-1.0.7.tgz", - "integrity": "sha512-qN2FsDBmLvsQcA5CWTrPz8I8gNXeS1fgXBBhI78VyxBSBV/EJgqy8ks6IDTC9jyugpl40csCQ4sL5K4i2YZ/2w==", - "peer": true, - "bin": { - "antlr4ng": "index.js" - } - }, "node_modules/anymatch": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", @@ -5225,9 +5441,9 @@ } }, "node_modules/axios": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.5.0.tgz", - "integrity": "sha512-D4DdjDo5CY50Qms0qGQTTw6Q44jl7zRwY7bthds06pUGfChBCTcQs+N743eFWGEd6pRTMd6A+I87aWyFV5wiZQ==", + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", + "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", "dependencies": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", @@ -5263,6 +5479,21 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/babel-plugin-istanbul": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", + "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0", + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-instrument": "^5.0.4", + "test-exclude": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/babel-plugin-macros": { "version": "2.8.0", "resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-2.8.0.tgz", @@ -5317,6 +5548,28 @@ "@babel/helper-plugin-utils": "^7.0.0" } }, + "node_modules/babel-preset-current-node-syntax": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz", + "integrity": "sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==", + "dependencies": { + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-bigint": "^7.8.3", + "@babel/plugin-syntax-class-properties": "^7.8.3", + "@babel/plugin-syntax-import-meta": "^7.8.3", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.8.3", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-top-level-await": "^7.8.3" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -5534,6 +5787,14 @@ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, + "node_modules/bser": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", + "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", + "dependencies": { + "node-int64": "^0.4.0" + } + }, "node_modules/bson": { "version": "4.7.2", "resolved": "https://registry.npmjs.org/bson/-/bson-4.7.2.tgz", @@ -6408,11 +6669,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/defekt": { - "version": "9.3.1", - "resolved": "https://registry.npmjs.org/defekt/-/defekt-9.3.1.tgz", - "integrity": "sha512-/aw6CuhAm/Fdbr6jHRt3HIhv6BGUgX1we7Q8lQQkE8izZ5v99UZnQbX5gxB7rp+zjSQLp3qyGfJXytdTlWeFpQ==" - }, "node_modules/define-data-property": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz", @@ -6857,6 +7113,21 @@ "url": "https://github.com/sindresorhus/execa?sponsor=1" } }, + "node_modules/expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==", + "dependencies": { + "@jest/expect-utils": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, "node_modules/express": { "version": "4.18.2", "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", @@ -7125,6 +7396,14 @@ "node": ">=0.8.0" } }, + "node_modules/fb-watchman": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", + "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", + "dependencies": { + "bser": "2.1.1" + } + }, "node_modules/figures": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", @@ -7533,6 +7812,14 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/get-stream": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", @@ -7624,11 +7911,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/google-protobuf": { - "version": "3.21.2", - "resolved": "https://registry.npmjs.org/google-protobuf/-/google-protobuf-3.21.2.tgz", - "integrity": "sha512-3MSOYFO5U9mPGikIYCzK0SaThypfGgS6bHqrUGXG3DPHCrb+txNqeEcns1W0lkGfk0rCyNXm7xB9rMxnCiZOoA==" - }, "node_modules/gopd": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", @@ -7932,6 +8214,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "engines": { + "node": ">=0.8.19" + } + }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -8102,6 +8392,29 @@ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", + "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-instrument": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", + "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", + "dependencies": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/iterare": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/iterare/-/iterare-1.2.1.tgz", @@ -8160,6 +8473,152 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/jest-haste-map": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.7.0.tgz", + "integrity": "sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==", + "dependencies": { + "@jest/types": "^29.6.3", + "@types/graceful-fs": "^4.1.3", + "@types/node": "*", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "graceful-fs": "^4.2.9", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "micromatch": "^4.0.4", + "walker": "^1.0.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "optionalDependencies": { + "fsevents": "^2.3.2" + } + }, + "node_modules/jest-matcher-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz", + "integrity": "sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==", + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-message-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.7.0.tgz", + "integrity": "sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==", + "dependencies": { + "@babel/code-frame": "^7.12.13", + "@jest/types": "^29.6.3", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-message-util/node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-mock": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.7.0.tgz", + "integrity": "sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==", + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-regex-util": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.6.3.tgz", + "integrity": "sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==", + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-snapshot": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.7.0.tgz", + "integrity": "sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==", + "dependencies": { + "@babel/core": "^7.11.6", + "@babel/generator": "^7.7.2", + "@babel/plugin-syntax-jsx": "^7.7.2", + "@babel/plugin-syntax-typescript": "^7.7.2", + "@babel/types": "^7.3.3", + "@jest/expect-utils": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0", + "chalk": "^4.0.0", + "expect": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "natural-compare": "^1.4.0", + "pretty-format": "^29.7.0", + "semver": "^7.5.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-snapshot/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jest-snapshot/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jest-snapshot/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, "node_modules/jest-util": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", @@ -8276,51 +8735,6 @@ "graceful-fs": "^4.1.6" } }, - "node_modules/jsonwebtoken": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.0.tgz", - "integrity": "sha512-tuGfYXxkQGDPnLJ7SibiQgVgeDgfbPq2k2ICcbgqW8WxWLBAxKQM/ZCu/IT8SOSwmaYl4dpTFCW5xZv7YbbWUw==", - "dependencies": { - "jws": "^3.2.2", - "lodash": "^4.17.21", - "ms": "^2.1.1", - "semver": "^7.3.8" - }, - "engines": { - "node": ">=12", - "npm": ">=6" - } - }, - "node_modules/jsonwebtoken/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/jsonwebtoken/node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/jsonwebtoken/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" - }, "node_modules/jwa": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", @@ -8613,6 +9027,14 @@ "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" }, + "node_modules/makeerror": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", + "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", + "dependencies": { + "tmpl": "1.0.5" + } + }, "node_modules/mdn-data": { "version": "2.0.30", "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.30.tgz", @@ -8878,6 +9300,8 @@ "version": "1.4.12", "resolved": "https://registry.npmjs.org/nats/-/nats-1.4.12.tgz", "integrity": "sha512-Jf4qesEF0Ay0D4AMw3OZnKMRTQm+6oZ5q8/m4gpy5bTmiDiK6wCXbZpzEslmezGpE93LV3RojNEG6dpK/mysLQ==", + "optional": true, + "peer": true, "dependencies": { "nuid": "^1.1.4", "ts-nkeys": "^1.0.16" @@ -8892,6 +9316,11 @@ "node": ">= 8.0.0" } }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==" + }, "node_modules/needle": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/needle/-/needle-3.3.1.tgz", @@ -9007,28 +9436,16 @@ "node-gyp-build-test": "build-test.js" } }, + "node_modules/node-int64": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==" + }, "node_modules/node-machine-id": { "version": "1.1.12", "resolved": "https://registry.npmjs.org/node-machine-id/-/node-machine-id-1.1.12.tgz", "integrity": "sha512-QNABxbrPa3qEIfrE6GOJ7BYIuignnJw7iQ2YPbc3Nla1HzRJjXzZOiikfF8m7eAMfichLt3M4VgLOetqgDmgGQ==" }, - "node_modules/node-nats-streaming": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/node-nats-streaming/-/node-nats-streaming-0.3.2.tgz", - "integrity": "sha512-exeT+FwGYW3UbBSzu8a7ykwWoY6R/vjQLr1RoZ1gnoJ9F66WVvpMZQWCZzLxlf9XRpJTTygcp6P1+WRw9h07Sg==", - "dependencies": { - "google-protobuf": "^3.11.2", - "nats": "^1.4.9", - "nuid": "^1.1.4" - }, - "bin": { - "node-stan-pub": "examples/stan-pub.js", - "node-stan-sub": "examples/stan-sub.js" - }, - "engines": { - "node": ">= 8.0.0" - } - }, "node_modules/node-releases": { "version": "2.0.14", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", @@ -9120,6 +9537,8 @@ "version": "1.1.6", "resolved": "https://registry.npmjs.org/nuid/-/nuid-1.1.6.tgz", "integrity": "sha512-Eb3CPCupYscP1/S1FQcO5nxtu6l/F3k0MQ69h7f5osnsemVk5pkc8/5AyalVT+NCfra9M71U8POqF6EZa6IHvg==", + "optional": true, + "peer": true, "engines": { "node": ">= 8.16.0" } @@ -9195,17 +9614,6 @@ } } }, - "node_modules/nx/node_modules/axios": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", - "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", - "peer": true, - "dependencies": { - "follow-redirects": "^1.15.0", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - } - }, "node_modules/nx/node_modules/glob": { "version": "7.1.4", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", @@ -9425,6 +9833,14 @@ "node": ">=8" } }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "engines": { + "node": ">=6" + } + }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -9638,6 +10054,14 @@ "resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-6.2.2.tgz", "integrity": "sha512-cHjPPsE+vhj/tnhCy/wiMh3M3z3h/j15zHQX+S9GkTBgqJuTuJzYJ4gUyACLhDaJ7kk9ba9iRDmbH2tJU03OiA==" }, + "node_modules/pirates": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", + "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", + "engines": { + "node": ">= 6" + } + }, "node_modules/pkg-dir": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-7.0.0.tgz", @@ -10470,9 +10894,9 @@ } }, "node_modules/reflect-metadata": { - "version": "0.1.13", - "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", - "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==" + "version": "0.1.14", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.14.tgz", + "integrity": "sha512-ZhYeb6nRaXCfhnndflDK8qI6ZQ/YcWZCISRAWICW9XYqMUwjZM9Z0DveWX/ABN01oxSHwVxKQmxeYZSsm0jh5A==" }, "node_modules/regenerate": { "version": "1.4.2", @@ -11027,20 +11451,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/shortid": { - "version": "2.2.16", - "resolved": "https://registry.npmjs.org/shortid/-/shortid-2.2.16.tgz", - "integrity": "sha512-Ugt+GIZqvGXCIItnsL+lvFJOiN7RYqlGy7QE41O3YC1xbNSeDGIRO7xg2JJXIAj1cAGnOeC1r7/T9pgrtQbv4g==", - "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", - "dependencies": { - "nanoid": "^2.1.0" - } - }, - "node_modules/shortid/node_modules/nanoid": { - "version": "2.1.11", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.11.tgz", - "integrity": "sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA==" - }, "node_modules/side-channel": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", @@ -11240,6 +11650,25 @@ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==" }, + "node_modules/stack-utils": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", + "dependencies": { + "escape-string-regexp": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/stack-utils/node_modules/escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "engines": { + "node": ">=8" + } + }, "node_modules/statuses": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", @@ -11700,6 +12129,49 @@ "source-map": "^0.6.0" } }, + "node_modules/test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/test-exclude/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/test-exclude/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/thread-stream": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/thread-stream/-/thread-stream-2.4.1.tgz", @@ -11737,6 +12209,11 @@ "node": ">=8.17.0" } }, + "node_modules/tmpl": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", + "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==" + }, "node_modules/to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", @@ -11841,6 +12318,8 @@ "version": "1.0.16", "resolved": "https://registry.npmjs.org/ts-nkeys/-/ts-nkeys-1.0.16.tgz", "integrity": "sha512-1qrhAlavbm36wtW+7NtKOgxpzl+70NTF8xlz9mEhiA5zHMlMxjj3sEVKWm3pGZhHXE0Q3ykjrj+OSRVaYw+Dqg==", + "optional": true, + "peer": true, "dependencies": { "tweetnacl": "^1.0.3" } @@ -11921,7 +12400,17 @@ "node_modules/tweetnacl": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", - "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==", + "optional": true, + "peer": true + }, + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "engines": { + "node": ">=4" + } }, "node_modules/type-fest": { "version": "0.20.2", @@ -12136,6 +12625,14 @@ "node": ">= 0.8" } }, + "node_modules/walker": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", + "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", + "dependencies": { + "makeerror": "1.0.12" + } + }, "node_modules/watchpack": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", @@ -12466,6 +12963,18 @@ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" }, + "node_modules/write-file-atomic": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", + "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", + "dependencies": { + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.7" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, "node_modules/ws": { "version": "8.15.1", "resolved": "https://registry.npmjs.org/ws/-/ws-8.15.1.tgz", diff --git a/apps/auth/package.json b/apps/auth/package.json index 55727e3f..ab19289d 100644 --- a/apps/auth/package.json +++ b/apps/auth/package.json @@ -2,31 +2,46 @@ "name": "auth", "version": "0.2.0", "dependencies": { + "@fastify/cookie": "9.0.4", "@fastify/cors": "8.3.0", "@fastify/helmet": "11.0.0", "@fastify/passport": "2.3.0", "@fastify/secure-session": "7.1.0", + "@fastify/static": "6.12.0", "@getlarge/kratos-client-wrapper": "0.0.2", + "@jest/globals": "29.7.0", "@nestjs/axios": "3.0.0", "@nestjs/common": "10.2.4", "@nestjs/config": "3.1.1", "@nestjs/core": "10.2.4", + "@nestjs/microservices": "10.2.4", "@nestjs/mongoose": "10.0.1", "@nestjs/platform-fastify": "10.2.4", "@nestjs/swagger": "7.1.10", "@nestjs/terminus": "10.0.1", "@nx/webpack": "17.1.3", + "amqp-connection-manager": "4.1.14", + "amqplib": "0.10.3", + "axios": "1.6.2", "class-transformer": "0.5.1", "class-validator": "0.13.2", "dotenv": "16.3.1", + "dotenv-expand": "10.0.0", "fastify": "4.22.0", "lodash-es": "4.17.21", "mongoose": "^6.1.0", + "nestjs-keyset-paginator": "3.0.4", "nestjs-pino": "3.4.0", + "passport-jwt": "4.0.0", + "pino-http": "8.5.0", + "reflect-metadata": "0.1.14", + "rxjs": "7.8.1", "ts-mixer": "6.0.1", "webpack-node-externals": "3.0.0" }, - "peerDependencies": {}, + "peerDependencies": { + "ioredis": "4.28.5" + }, "peerDependenciesMeta": { "ioredis": { "optional": true diff --git a/apps/expiration/package-lock.json b/apps/expiration/package-lock.json index 4ba1406a..5b3cf236 100644 --- a/apps/expiration/package-lock.json +++ b/apps/expiration/package-lock.json @@ -10,8 +10,8 @@ "dependencies": { "@fastify/cookie": "9.0.4", "@fastify/helmet": "11.0.0", - "@fastify/static": "6.11.0", - "@nestjs-plugins/nestjs-nats-streaming-transport": "1.2.0", + "@fastify/static": "6.12.0", + "@jest/globals": "29.7.0", "@nestjs/axios": "3.0.0", "@nestjs/bull": "10.0.1", "@nestjs/common": "10.2.4", @@ -26,7 +26,7 @@ "@s1seven/nestjs-tools-amqp-transport": "0.5.1", "amqp-connection-manager": "4.1.14", "amqplib": "0.10.3", - "axios": "1.5.0", + "axios": "1.6.2", "bull": "4.8.2", "class-transformer": "0.5.1", "class-validator": "0.13.2", @@ -34,26 +34,18 @@ "dotenv-expand": "10.0.0", "fastify": "4.22.0", "ioredis": "4.28.5", - "lodash": "4.17.21", "lodash-es": "4.17.21", - "mongoose": "6.12.0", + "mongoose": "6.12.3", "nestjs-pino": "3.4.0", - "node-nats-streaming": "0.3.2", "pino-http": "8.5.0", - "reflect-metadata": "0.1.13", + "reflect-metadata": "0.1.14", "rxjs": "7.8.1", "ts-mixer": "6.0.1", - "url": "0.11.1", + "url": "0.11.3", "webpack-node-externals": "3.0.0" }, "peerDependencies": { - "nats": "1.4.12", "uuid": "8.3.2" - }, - "peerDependenciesMeta": { - "nats": { - "optional": true - } } }, "node_modules/@acuminous/bitsyntax": { @@ -1340,6 +1332,17 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/plugin-syntax-bigint": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", + "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/@babel/plugin-syntax-class-properties": { "version": "7.12.13", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", @@ -2656,17 +2659,198 @@ } }, "node_modules/@fastify/static": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/@fastify/static/-/static-6.11.0.tgz", - "integrity": "sha512-jgnqpRojDqOLHnnKlZgvvUFzR8rrxqkqzbtmuHp1amIArxGVJDXyBMPbxb3yteklBA7tPilXbx5xzDRiGXR0RA==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@fastify/static/-/static-6.12.0.tgz", + "integrity": "sha512-KK1B84E6QD/FcQWxDI2aiUCwHxMJBI1KeCUzm1BwYpPY1b742+jeKruGHP2uOluuM6OkBPI8CIANrXcCRtC2oQ==", "dependencies": { "@fastify/accept-negotiator": "^1.0.0", "@fastify/send": "^2.0.0", "content-disposition": "^0.5.3", "fastify-plugin": "^4.0.0", "glob": "^8.0.1", - "p-limit": "^3.1.0", - "readable-stream": "^4.0.0" + "p-limit": "^3.1.0" + } + }, + "node_modules/@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", + "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", + "dependencies": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "engines": { + "node": ">=6" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/environment": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.7.0.tgz", + "integrity": "sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==", + "dependencies": { + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ==", + "dependencies": { + "expect": "^29.7.0", + "jest-snapshot": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/expect-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.7.0.tgz", + "integrity": "sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==", + "dependencies": { + "jest-get-type": "^29.6.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/fake-timers": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.7.0.tgz", + "integrity": "sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==", + "dependencies": { + "@jest/types": "^29.6.3", + "@sinonjs/fake-timers": "^10.0.2", + "@types/node": "*", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/globals": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.7.0.tgz", + "integrity": "sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ==", + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/types": "^29.6.3", + "jest-mock": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/@jest/schemas": { @@ -2680,6 +2864,39 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/@jest/transform": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.7.0.tgz", + "integrity": "sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==", + "dependencies": { + "@babel/core": "^7.11.6", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "babel-plugin-istanbul": "^6.1.1", + "chalk": "^4.0.0", + "convert-source-map": "^2.0.0", + "fast-json-stable-stringify": "^2.1.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "micromatch": "^4.0.4", + "pirates": "^4.0.4", + "slash": "^3.0.0", + "write-file-atomic": "^4.0.2" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/transform/node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "engines": { + "node": ">=8" + } + }, "node_modules/@jest/types": { "version": "29.6.3", "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz", @@ -2850,22 +3067,6 @@ "win32" ] }, - "node_modules/@nestjs-plugins/nestjs-nats-streaming-transport": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@nestjs-plugins/nestjs-nats-streaming-transport/-/nestjs-nats-streaming-transport-1.2.0.tgz", - "integrity": "sha512-SS0+JXVboKihYOQhB3rBqxUKTo2ppLr5/PrwnoWb1GCoMNYgwOKz6m6A1w1P/4D6cokQ0f/V8okZE3Ya1RmHfw==", - "dependencies": { - "node-nats-streaming": "^0.3.2", - "reflect-metadata": "^0.1.13", - "rxjs": "^7.5.7", - "shortid": "^2.2.16" - }, - "peerDependencies": { - "@nestjs/common": "^9.2.0", - "@nestjs/core": "^9.2.0", - "@nestjs/microservices": "^9.2.0" - } - }, "node_modules/@nestjs/axios": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@nestjs/axios/-/axios-3.0.0.tgz", @@ -3826,16 +4027,6 @@ "node": ">= 10" } }, - "node_modules/@nx/workspace/node_modules/axios": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", - "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", - "dependencies": { - "follow-redirects": "^1.15.0", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - } - }, "node_modules/@nx/workspace/node_modules/glob": { "version": "7.1.4", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", @@ -3992,6 +4183,22 @@ "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==" }, + "node_modules/@sinonjs/commons": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.0.tgz", + "integrity": "sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA==", + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/@sinonjs/fake-timers": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz", + "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==", + "dependencies": { + "@sinonjs/commons": "^3.0.0" + } + }, "node_modules/@smithy/abort-controller": { "version": "2.0.15", "resolved": "https://registry.npmjs.org/@smithy/abort-controller/-/abort-controller-2.0.15.tgz", @@ -4640,6 +4847,14 @@ "@types/send": "*" } }, + "node_modules/@types/graceful-fs": { + "version": "4.1.9", + "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", + "integrity": "sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/http-errors": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz", @@ -4755,6 +4970,11 @@ "@types/node": "*" } }, + "node_modules/@types/stack-utils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", + "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==" + }, "node_modules/@types/webidl-conversions": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.3.tgz", @@ -5292,9 +5512,9 @@ } }, "node_modules/axios": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.5.0.tgz", - "integrity": "sha512-D4DdjDo5CY50Qms0qGQTTw6Q44jl7zRwY7bthds06pUGfChBCTcQs+N743eFWGEd6pRTMd6A+I87aWyFV5wiZQ==", + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", + "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", "dependencies": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", @@ -5330,6 +5550,21 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/babel-plugin-istanbul": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", + "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0", + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-instrument": "^5.0.4", + "test-exclude": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/babel-plugin-macros": { "version": "2.8.0", "resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-2.8.0.tgz", @@ -5384,6 +5619,28 @@ "@babel/helper-plugin-utils": "^7.0.0" } }, + "node_modules/babel-preset-current-node-syntax": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz", + "integrity": "sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==", + "dependencies": { + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-bigint": "^7.8.3", + "@babel/plugin-syntax-class-properties": "^7.8.3", + "@babel/plugin-syntax-import-meta": "^7.8.3", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.8.3", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-top-level-await": "^7.8.3" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -5615,6 +5872,14 @@ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, + "node_modules/bser": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", + "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", + "dependencies": { + "node-int64": "^0.4.0" + } + }, "node_modules/bson": { "version": "4.7.2", "resolved": "https://registry.npmjs.org/bson/-/bson-4.7.2.tgz", @@ -7005,6 +7270,21 @@ "url": "https://github.com/sindresorhus/execa?sponsor=1" } }, + "node_modules/expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==", + "dependencies": { + "@jest/expect-utils": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, "node_modules/express": { "version": "4.18.2", "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", @@ -7287,6 +7567,14 @@ "node": ">=0.8.0" } }, + "node_modules/fb-watchman": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", + "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", + "dependencies": { + "bser": "2.1.1" + } + }, "node_modules/figures": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", @@ -7695,6 +7983,14 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/get-port": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/get-port/-/get-port-5.1.1.tgz", @@ -7797,11 +8093,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/google-protobuf": { - "version": "3.21.2", - "resolved": "https://registry.npmjs.org/google-protobuf/-/google-protobuf-3.21.2.tgz", - "integrity": "sha512-3MSOYFO5U9mPGikIYCzK0SaThypfGgS6bHqrUGXG3DPHCrb+txNqeEcns1W0lkGfk0rCyNXm7xB9rMxnCiZOoA==" - }, "node_modules/gopd": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", @@ -8105,6 +8396,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "engines": { + "node": ">=0.8.19" + } + }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -8300,6 +8599,29 @@ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", + "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-instrument": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", + "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", + "dependencies": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/iterare": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/iterare/-/iterare-1.2.1.tgz", @@ -8358,6 +8680,152 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/jest-haste-map": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.7.0.tgz", + "integrity": "sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==", + "dependencies": { + "@jest/types": "^29.6.3", + "@types/graceful-fs": "^4.1.3", + "@types/node": "*", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "graceful-fs": "^4.2.9", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "micromatch": "^4.0.4", + "walker": "^1.0.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "optionalDependencies": { + "fsevents": "^2.3.2" + } + }, + "node_modules/jest-matcher-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz", + "integrity": "sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==", + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-message-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.7.0.tgz", + "integrity": "sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==", + "dependencies": { + "@babel/code-frame": "^7.12.13", + "@jest/types": "^29.6.3", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-message-util/node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-mock": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.7.0.tgz", + "integrity": "sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==", + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-regex-util": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.6.3.tgz", + "integrity": "sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==", + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-snapshot": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.7.0.tgz", + "integrity": "sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==", + "dependencies": { + "@babel/core": "^7.11.6", + "@babel/generator": "^7.7.2", + "@babel/plugin-syntax-jsx": "^7.7.2", + "@babel/plugin-syntax-typescript": "^7.7.2", + "@babel/types": "^7.3.3", + "@jest/expect-utils": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0", + "chalk": "^4.0.0", + "expect": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "natural-compare": "^1.4.0", + "pretty-format": "^29.7.0", + "semver": "^7.5.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-snapshot/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jest-snapshot/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jest-snapshot/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, "node_modules/jest-util": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", @@ -8735,6 +9203,14 @@ "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" }, + "node_modules/makeerror": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", + "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", + "dependencies": { + "tmpl": "1.0.5" + } + }, "node_modules/mdn-data": { "version": "2.0.30", "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.30.tgz", @@ -8918,9 +9394,9 @@ } }, "node_modules/mongoose": { - "version": "6.12.0", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.12.0.tgz", - "integrity": "sha512-sd/q83C6TBRPBrrD2A/POSbA/exbCFM2WOuY7Lf2JuIJFlHFG39zYSDTTAEiYlzIfahNOLmXPxBGFxdAch41Mw==", + "version": "6.12.3", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.12.3.tgz", + "integrity": "sha512-MNJymaaXali7w7rHBxVUoQ3HzHHMk/7I/+yeeoSa4rUzdjZwIWQznBNvVgc0A8ghuJwsuIkb5LyLV6gSjGjWyQ==", "dependencies": { "bson": "^4.7.2", "kareem": "2.5.1", @@ -9029,6 +9505,8 @@ "version": "1.4.12", "resolved": "https://registry.npmjs.org/nats/-/nats-1.4.12.tgz", "integrity": "sha512-Jf4qesEF0Ay0D4AMw3OZnKMRTQm+6oZ5q8/m4gpy5bTmiDiK6wCXbZpzEslmezGpE93LV3RojNEG6dpK/mysLQ==", + "optional": true, + "peer": true, "dependencies": { "nuid": "^1.1.4", "ts-nkeys": "^1.0.16" @@ -9043,6 +9521,11 @@ "node": ">= 8.0.0" } }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==" + }, "node_modules/needle": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/needle/-/needle-3.3.1.tgz", @@ -9147,28 +9630,16 @@ "node-gyp-build-optional-packages-test": "build-test.js" } }, + "node_modules/node-int64": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==" + }, "node_modules/node-machine-id": { "version": "1.1.12", "resolved": "https://registry.npmjs.org/node-machine-id/-/node-machine-id-1.1.12.tgz", "integrity": "sha512-QNABxbrPa3qEIfrE6GOJ7BYIuignnJw7iQ2YPbc3Nla1HzRJjXzZOiikfF8m7eAMfichLt3M4VgLOetqgDmgGQ==" }, - "node_modules/node-nats-streaming": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/node-nats-streaming/-/node-nats-streaming-0.3.2.tgz", - "integrity": "sha512-exeT+FwGYW3UbBSzu8a7ykwWoY6R/vjQLr1RoZ1gnoJ9F66WVvpMZQWCZzLxlf9XRpJTTygcp6P1+WRw9h07Sg==", - "dependencies": { - "google-protobuf": "^3.11.2", - "nats": "^1.4.9", - "nuid": "^1.1.4" - }, - "bin": { - "node-stan-pub": "examples/stan-pub.js", - "node-stan-sub": "examples/stan-sub.js" - }, - "engines": { - "node": ">= 8.0.0" - } - }, "node_modules/node-releases": { "version": "2.0.14", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", @@ -9260,6 +9731,8 @@ "version": "1.1.6", "resolved": "https://registry.npmjs.org/nuid/-/nuid-1.1.6.tgz", "integrity": "sha512-Eb3CPCupYscP1/S1FQcO5nxtu6l/F3k0MQ69h7f5osnsemVk5pkc8/5AyalVT+NCfra9M71U8POqF6EZa6IHvg==", + "optional": true, + "peer": true, "engines": { "node": ">= 8.16.0" } @@ -9335,17 +9808,6 @@ } } }, - "node_modules/nx/node_modules/axios": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", - "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", - "peer": true, - "dependencies": { - "follow-redirects": "^1.15.0", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - } - }, "node_modules/nx/node_modules/glob": { "version": "7.1.4", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", @@ -9592,6 +10054,14 @@ "node": ">=8" } }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "engines": { + "node": ">=6" + } + }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -9759,6 +10229,14 @@ "resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-6.2.2.tgz", "integrity": "sha512-cHjPPsE+vhj/tnhCy/wiMh3M3z3h/j15zHQX+S9GkTBgqJuTuJzYJ4gUyACLhDaJ7kk9ba9iRDmbH2tJU03OiA==" }, + "node_modules/pirates": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", + "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", + "engines": { + "node": ">= 6" + } + }, "node_modules/pkg-dir": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-7.0.0.tgz", @@ -10615,9 +11093,9 @@ } }, "node_modules/reflect-metadata": { - "version": "0.1.13", - "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", - "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==" + "version": "0.1.14", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.14.tgz", + "integrity": "sha512-ZhYeb6nRaXCfhnndflDK8qI6ZQ/YcWZCISRAWICW9XYqMUwjZM9Z0DveWX/ABN01oxSHwVxKQmxeYZSsm0jh5A==" }, "node_modules/regenerate": { "version": "1.4.2", @@ -11172,20 +11650,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/shortid": { - "version": "2.2.16", - "resolved": "https://registry.npmjs.org/shortid/-/shortid-2.2.16.tgz", - "integrity": "sha512-Ugt+GIZqvGXCIItnsL+lvFJOiN7RYqlGy7QE41O3YC1xbNSeDGIRO7xg2JJXIAj1cAGnOeC1r7/T9pgrtQbv4g==", - "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", - "dependencies": { - "nanoid": "^2.1.0" - } - }, - "node_modules/shortid/node_modules/nanoid": { - "version": "2.1.11", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.11.tgz", - "integrity": "sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA==" - }, "node_modules/side-channel": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", @@ -11368,6 +11832,25 @@ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==" }, + "node_modules/stack-utils": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", + "dependencies": { + "escape-string-regexp": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/stack-utils/node_modules/escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "engines": { + "node": ">=8" + } + }, "node_modules/standard-as-callback": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/standard-as-callback/-/standard-as-callback-2.1.0.tgz", @@ -11833,6 +12316,49 @@ "source-map": "^0.6.0" } }, + "node_modules/test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/test-exclude/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/test-exclude/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/thread-stream": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/thread-stream/-/thread-stream-2.4.1.tgz", @@ -11870,6 +12396,11 @@ "node": ">=8.17.0" } }, + "node_modules/tmpl": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", + "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==" + }, "node_modules/to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", @@ -11974,6 +12505,8 @@ "version": "1.0.16", "resolved": "https://registry.npmjs.org/ts-nkeys/-/ts-nkeys-1.0.16.tgz", "integrity": "sha512-1qrhAlavbm36wtW+7NtKOgxpzl+70NTF8xlz9mEhiA5zHMlMxjj3sEVKWm3pGZhHXE0Q3ykjrj+OSRVaYw+Dqg==", + "optional": true, + "peer": true, "dependencies": { "tweetnacl": "^1.0.3" } @@ -12054,7 +12587,17 @@ "node_modules/tweetnacl": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", - "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==", + "optional": true, + "peer": true + }, + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "engines": { + "node": ">=4" + } }, "node_modules/type-fest": { "version": "0.20.2", @@ -12203,12 +12746,12 @@ } }, "node_modules/url": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/url/-/url-0.11.1.tgz", - "integrity": "sha512-rWS3H04/+mzzJkv0eZ7vEDGiQbgquI1fGfOad6zKvgYQi1SzMmhl7c/DdRGxhaWrVH6z0qWITo8rpnxK/RfEhA==", + "version": "0.11.3", + "resolved": "https://registry.npmjs.org/url/-/url-0.11.3.tgz", + "integrity": "sha512-6hxOLGfZASQK/cijlZnZJTq8OXAkt/3YGfQX45vvMYXpZoo8NdWZcY73K108Jf759lS1Bv/8wXnHDTSz17dSRw==", "dependencies": { "punycode": "^1.4.1", - "qs": "^6.11.0" + "qs": "^6.11.2" } }, "node_modules/url-parse": { @@ -12283,6 +12826,14 @@ "node": ">= 0.8" } }, + "node_modules/walker": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", + "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", + "dependencies": { + "makeerror": "1.0.12" + } + }, "node_modules/watchpack": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", @@ -12613,6 +13164,18 @@ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" }, + "node_modules/write-file-atomic": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", + "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", + "dependencies": { + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.7" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, "node_modules/ws": { "version": "8.15.1", "resolved": "https://registry.npmjs.org/ws/-/ws-8.15.1.tgz", diff --git a/apps/expiration/package.json b/apps/expiration/package.json index 05a777b6..2a07004f 100644 --- a/apps/expiration/package.json +++ b/apps/expiration/package.json @@ -2,13 +2,17 @@ "name": "expiration", "version": "0.2.0", "dependencies": { + "@fastify/cookie": "9.0.4", "@fastify/helmet": "11.0.0", + "@fastify/static": "6.12.0", + "@jest/globals": "29.7.0", "@nestjs/axios": "3.0.0", "@nestjs/bull": "10.0.1", "@nestjs/common": "10.2.4", "@nestjs/config": "3.1.1", "@nestjs/core": "10.2.4", "@nestjs/microservices": "10.2.4", + "@nestjs/mongoose": "10.0.1", "@nestjs/platform-fastify": "10.2.4", "@nestjs/swagger": "7.1.10", "@nestjs/terminus": "10.0.1", @@ -16,14 +20,26 @@ "@s1seven/nestjs-tools-amqp-transport": "0.5.1", "amqp-connection-manager": "4.1.14", "amqplib": "0.10.3", + "axios": "1.6.2", "bull": "4.8.2", "class-transformer": "0.5.1", + "class-validator": "0.13.2", "dotenv": "16.3.1", + "dotenv-expand": "10.0.0", + "fastify": "4.22.0", + "ioredis": "4.28.5", + "lodash-es": "4.17.21", + "mongoose": "6.12.3", "nestjs-pino": "3.4.0", + "pino-http": "8.5.0", + "reflect-metadata": "0.1.14", "rxjs": "7.8.1", "ts-mixer": "6.0.1", + "url": "0.11.3", "webpack-node-externals": "3.0.0" }, - "peerDependencies": {}, + "peerDependencies": { + "uuid": "8.3.2" + }, "main": "main.js" } diff --git a/apps/orders/package-lock.json b/apps/orders/package-lock.json index 7d2d76ea..857c1a4b 100644 --- a/apps/orders/package-lock.json +++ b/apps/orders/package-lock.json @@ -13,9 +13,11 @@ "@fastify/helmet": "11.0.0", "@fastify/passport": "2.3.0", "@fastify/secure-session": "7.1.0", - "@fastify/static": "6.11.0", + "@fastify/static": "6.12.0", + "@getlarge/keto-client-wrapper": "0.0.2", + "@getlarge/keto-relations-parser": "0.0.2", + "@getlarge/kratos-client-wrapper": "0.0.2", "@jest/globals": "29.7.0", - "@nestjs-plugins/nestjs-nats-streaming-transport": "1.2.0", "@nestjs/axios": "3.0.0", "@nestjs/common": "10.2.4", "@nestjs/config": "3.1.1", @@ -30,34 +32,26 @@ "@s1seven/nestjs-tools-amqp-transport": "0.5.1", "amqp-connection-manager": "4.1.14", "amqplib": "0.10.3", - "antlr4ng": "2.0.3", - "axios": "1.5.0", + "axios": "1.6.2", "class-transformer": "0.5.1", "class-validator": "0.13.2", - "defekt": "9.3.1", "dotenv": "16.3.1", "dotenv-expand": "10.0.0", - "events": "3.3.0", "fastify": "4.22.0", - "lodash": "4.17.21", "lodash-es": "4.17.21", - "mongoose": "6.12.0", + "mongoose": "^6.1.0", "mongoose-update-if-current": "1.4.0", "nestjs-keyset-paginator": "3.0.4", "nestjs-pino": "3.4.0", - "node-nats-streaming": "0.3.2", - "passport-jwt": "4.0.0", "pino-http": "8.5.0", - "reflect-metadata": "0.1.13", + "reflect-metadata": "0.1.14", "rxjs": "7.8.1", "sodium-native": "4.0.4", "ts-mixer": "6.0.1", - "tslib": "2.6.2", "webpack-node-externals": "3.0.0" }, "peerDependencies": { "ioredis": "4.28.5", - "nats": "1.4.12", "uuid": "8.3.2" }, "peerDependenciesMeta": { @@ -2710,17 +2704,58 @@ } }, "node_modules/@fastify/static": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/@fastify/static/-/static-6.11.0.tgz", - "integrity": "sha512-jgnqpRojDqOLHnnKlZgvvUFzR8rrxqkqzbtmuHp1amIArxGVJDXyBMPbxb3yteklBA7tPilXbx5xzDRiGXR0RA==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@fastify/static/-/static-6.12.0.tgz", + "integrity": "sha512-KK1B84E6QD/FcQWxDI2aiUCwHxMJBI1KeCUzm1BwYpPY1b742+jeKruGHP2uOluuM6OkBPI8CIANrXcCRtC2oQ==", "dependencies": { "@fastify/accept-negotiator": "^1.0.0", "@fastify/send": "^2.0.0", "content-disposition": "^0.5.3", "fastify-plugin": "^4.0.0", "glob": "^8.0.1", - "p-limit": "^3.1.0", - "readable-stream": "^4.0.0" + "p-limit": "^3.1.0" + } + }, + "node_modules/@getlarge/keto-client-wrapper": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/@getlarge/keto-client-wrapper/-/keto-client-wrapper-0.0.2.tgz", + "integrity": "sha512-CiuUVYeevpz51JYym3GAvfUkz1jdPWzU3S+n6xgr94qbrq+snUBna9Tf0IczG4vellt/st1HSmIo27EsGWYODw==", + "dependencies": { + "@getlarge/keto-relations-parser": "0.0.2", + "defekt": "^9.3.1", + "lodash.get": "^4.4.2", + "tslib": "^2.3.0" + }, + "peerDependencies": { + "@nestjs/axios": "^3.0.1", + "@nestjs/common": "^10.0.2", + "@nestjs/core": "^10.0.2", + "@ory/client": "^1.4.9", + "axios": "1.6.5" + } + }, + "node_modules/@getlarge/keto-relations-parser": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/@getlarge/keto-relations-parser/-/keto-relations-parser-0.0.2.tgz", + "integrity": "sha512-Ikq/8SxO8OjKf0+3dkzkRfOYKQbNUfHidrZDsK+9fQRjXmPbLHSj/R6n6Bolqaewsy5sD5sCp0wwU1gahzHeoA==", + "dependencies": { + "defekt": "^9.3.1", + "lodash.get": "^4.4.2", + "tslib": "^2.3.0" + } + }, + "node_modules/@getlarge/kratos-client-wrapper": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/@getlarge/kratos-client-wrapper/-/kratos-client-wrapper-0.0.2.tgz", + "integrity": "sha512-lycbuorh3WKyCgU8eOfLvCIHSWK48M5ysfRHooFd+mjYigh3R7g0TO6aLZVKlbWoKzj4JwszBnwd3oQe8Ot2CQ==", + "dependencies": { + "tslib": "^2.3.0" + }, + "peerDependencies": { + "@nestjs/axios": "^3.0.1", + "@nestjs/common": "^10.0.2", + "@ory/client": "^1.4.9", + "axios": "1.6.5" } }, "node_modules/@istanbuljs/load-nyc-config": { @@ -3047,22 +3082,6 @@ "sparse-bitfield": "^3.0.3" } }, - "node_modules/@nestjs-plugins/nestjs-nats-streaming-transport": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@nestjs-plugins/nestjs-nats-streaming-transport/-/nestjs-nats-streaming-transport-1.2.0.tgz", - "integrity": "sha512-SS0+JXVboKihYOQhB3rBqxUKTo2ppLr5/PrwnoWb1GCoMNYgwOKz6m6A1w1P/4D6cokQ0f/V8okZE3Ya1RmHfw==", - "dependencies": { - "node-nats-streaming": "^0.3.2", - "reflect-metadata": "^0.1.13", - "rxjs": "^7.5.7", - "shortid": "^2.2.16" - }, - "peerDependencies": { - "@nestjs/common": "^9.2.0", - "@nestjs/core": "^9.2.0", - "@nestjs/microservices": "^9.2.0" - } - }, "node_modules/@nestjs/axios": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@nestjs/axios/-/axios-3.0.0.tgz", @@ -3989,16 +4008,6 @@ "node": ">= 10" } }, - "node_modules/@nx/workspace/node_modules/axios": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", - "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", - "dependencies": { - "follow-redirects": "^1.15.0", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - } - }, "node_modules/@nx/workspace/node_modules/glob": { "version": "7.1.4", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", @@ -4116,6 +4125,25 @@ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, + "node_modules/@ory/client": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@ory/client/-/client-1.5.1.tgz", + "integrity": "sha512-5OiO/ZFQKbv51i3LUIu3ENHdo0cdgUpkO7i3+dY3qoE2FjrBRD8Vh+fF7njTJO89hdSc9ua0UhU/6yUxiM3SSg==", + "peer": true, + "dependencies": { + "axios": "^0.27.2" + } + }, + "node_modules/@ory/client/node_modules/axios": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", + "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", + "peer": true, + "dependencies": { + "follow-redirects": "^1.14.9", + "form-data": "^4.0.0" + } + }, "node_modules/@phenomnomnominal/tsquery": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/@phenomnomnominal/tsquery/-/tsquery-5.0.1.tgz", @@ -5384,23 +5412,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/antlr4ng": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/antlr4ng/-/antlr4ng-2.0.3.tgz", - "integrity": "sha512-usw0hZsNbTQrJ899P6sHLlQbmKgwQ9UBYq5rh6ZFicPf5qtRJogPVTBj4fSB3OY5ZLP5TSZ7d8tR2p4I5KyiLQ==", - "peerDependencies": { - "antlr4ng-cli": "^1.0.0" - } - }, - "node_modules/antlr4ng-cli": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/antlr4ng-cli/-/antlr4ng-cli-1.0.7.tgz", - "integrity": "sha512-qN2FsDBmLvsQcA5CWTrPz8I8gNXeS1fgXBBhI78VyxBSBV/EJgqy8ks6IDTC9jyugpl40csCQ4sL5K4i2YZ/2w==", - "peer": true, - "bin": { - "antlr4ng": "index.js" - } - }, "node_modules/anymatch": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", @@ -5509,9 +5520,9 @@ } }, "node_modules/axios": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.5.0.tgz", - "integrity": "sha512-D4DdjDo5CY50Qms0qGQTTw6Q44jl7zRwY7bthds06pUGfChBCTcQs+N743eFWGEd6pRTMd6A+I87aWyFV5wiZQ==", + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", + "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", "dependencies": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", @@ -7994,11 +8005,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/google-protobuf": { - "version": "3.21.2", - "resolved": "https://registry.npmjs.org/google-protobuf/-/google-protobuf-3.21.2.tgz", - "integrity": "sha512-3MSOYFO5U9mPGikIYCzK0SaThypfGgS6bHqrUGXG3DPHCrb+txNqeEcns1W0lkGfk0rCyNXm7xB9rMxnCiZOoA==" - }, "node_modules/gopd": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", @@ -9065,46 +9071,16 @@ "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==" }, - "node_modules/lodash.includes": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", - "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==" - }, - "node_modules/lodash.isboolean": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", - "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==" - }, - "node_modules/lodash.isinteger": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", - "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==" - }, - "node_modules/lodash.isnumber": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", - "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==" - }, - "node_modules/lodash.isplainobject": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", - "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==" - }, - "node_modules/lodash.isstring": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", - "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==" + "node_modules/lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==" }, "node_modules/lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==" }, - "node_modules/lodash.once": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", - "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==" - }, "node_modules/lodash.uniq": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", @@ -9454,6 +9430,8 @@ "version": "1.4.12", "resolved": "https://registry.npmjs.org/nats/-/nats-1.4.12.tgz", "integrity": "sha512-Jf4qesEF0Ay0D4AMw3OZnKMRTQm+6oZ5q8/m4gpy5bTmiDiK6wCXbZpzEslmezGpE93LV3RojNEG6dpK/mysLQ==", + "optional": true, + "peer": true, "dependencies": { "nuid": "^1.1.4", "ts-nkeys": "^1.0.16" @@ -9598,23 +9576,6 @@ "resolved": "https://registry.npmjs.org/node-machine-id/-/node-machine-id-1.1.12.tgz", "integrity": "sha512-QNABxbrPa3qEIfrE6GOJ7BYIuignnJw7iQ2YPbc3Nla1HzRJjXzZOiikfF8m7eAMfichLt3M4VgLOetqgDmgGQ==" }, - "node_modules/node-nats-streaming": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/node-nats-streaming/-/node-nats-streaming-0.3.2.tgz", - "integrity": "sha512-exeT+FwGYW3UbBSzu8a7ykwWoY6R/vjQLr1RoZ1gnoJ9F66WVvpMZQWCZzLxlf9XRpJTTygcp6P1+WRw9h07Sg==", - "dependencies": { - "google-protobuf": "^3.11.2", - "nats": "^1.4.9", - "nuid": "^1.1.4" - }, - "bin": { - "node-stan-pub": "examples/stan-pub.js", - "node-stan-sub": "examples/stan-sub.js" - }, - "engines": { - "node": ">= 8.0.0" - } - }, "node_modules/node-releases": { "version": "2.0.14", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", @@ -9706,6 +9667,8 @@ "version": "1.1.6", "resolved": "https://registry.npmjs.org/nuid/-/nuid-1.1.6.tgz", "integrity": "sha512-Eb3CPCupYscP1/S1FQcO5nxtu6l/F3k0MQ69h7f5osnsemVk5pkc8/5AyalVT+NCfra9M71U8POqF6EZa6IHvg==", + "optional": true, + "peer": true, "engines": { "node": ">= 8.16.0" } @@ -9781,17 +9744,6 @@ } } }, - "node_modules/nx/node_modules/axios": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", - "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", - "peer": true, - "dependencies": { - "follow-redirects": "^1.15.0", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - } - }, "node_modules/nx/node_modules/glob": { "version": "7.1.4", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", @@ -10073,52 +10025,6 @@ "node": ">= 0.8" } }, - "node_modules/passport-jwt": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/passport-jwt/-/passport-jwt-4.0.0.tgz", - "integrity": "sha512-BwC0n2GP/1hMVjR4QpnvqA61TxenUMlmfNjYNgK0ZAs0HK4SOQkHcSv4L328blNTLtHq7DbmvyNJiH+bn6C5Mg==", - "dependencies": { - "jsonwebtoken": "^8.2.0", - "passport-strategy": "^1.0.0" - } - }, - "node_modules/passport-jwt/node_modules/jsonwebtoken": { - "version": "8.5.1", - "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz", - "integrity": "sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w==", - "dependencies": { - "jws": "^3.2.2", - "lodash.includes": "^4.3.0", - "lodash.isboolean": "^3.0.3", - "lodash.isinteger": "^4.0.4", - "lodash.isnumber": "^3.0.3", - "lodash.isplainobject": "^4.0.6", - "lodash.isstring": "^4.0.1", - "lodash.once": "^4.0.0", - "ms": "^2.1.1", - "semver": "^5.6.0" - }, - "engines": { - "node": ">=4", - "npm": ">=1.4.28" - } - }, - "node_modules/passport-jwt/node_modules/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/passport-strategy": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/passport-strategy/-/passport-strategy-1.0.0.tgz", - "integrity": "sha512-CB97UUvDKJde2V0KDWWB3lyf6PC3FaZP7YxZ2G8OAtn9p4HI9j9JLP9qjOGZFvyl8uwNT8qM+hGnz/n16NI7oA==", - "engines": { - "node": ">= 0.4.0" - } - }, "node_modules/path-exists": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", @@ -11072,9 +10978,9 @@ } }, "node_modules/reflect-metadata": { - "version": "0.1.13", - "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", - "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==" + "version": "0.1.14", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.14.tgz", + "integrity": "sha512-ZhYeb6nRaXCfhnndflDK8qI6ZQ/YcWZCISRAWICW9XYqMUwjZM9Z0DveWX/ABN01oxSHwVxKQmxeYZSsm0jh5A==" }, "node_modules/regenerate": { "version": "1.4.2", @@ -11629,20 +11535,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/shortid": { - "version": "2.2.16", - "resolved": "https://registry.npmjs.org/shortid/-/shortid-2.2.16.tgz", - "integrity": "sha512-Ugt+GIZqvGXCIItnsL+lvFJOiN7RYqlGy7QE41O3YC1xbNSeDGIRO7xg2JJXIAj1cAGnOeC1r7/T9pgrtQbv4g==", - "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", - "dependencies": { - "nanoid": "^2.1.0" - } - }, - "node_modules/shortid/node_modules/nanoid": { - "version": "2.1.11", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.11.tgz", - "integrity": "sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA==" - }, "node_modules/side-channel": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", @@ -12502,6 +12394,8 @@ "version": "1.0.16", "resolved": "https://registry.npmjs.org/ts-nkeys/-/ts-nkeys-1.0.16.tgz", "integrity": "sha512-1qrhAlavbm36wtW+7NtKOgxpzl+70NTF8xlz9mEhiA5zHMlMxjj3sEVKWm3pGZhHXE0Q3ykjrj+OSRVaYw+Dqg==", + "optional": true, + "peer": true, "dependencies": { "tweetnacl": "^1.0.3" } @@ -12582,7 +12476,9 @@ "node_modules/tweetnacl": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", - "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==", + "optional": true, + "peer": true }, "node_modules/type-detect": { "version": "4.0.8", diff --git a/apps/orders/package.json b/apps/orders/package.json index e3f02917..9463dc10 100644 --- a/apps/orders/package.json +++ b/apps/orders/package.json @@ -2,18 +2,21 @@ "name": "orders", "version": "0.2.0", "dependencies": { + "@fastify/cookie": "9.0.4", "@fastify/cors": "8.3.0", "@fastify/helmet": "11.0.0", "@fastify/passport": "2.3.0", "@fastify/secure-session": "7.1.0", - "@jest/globals": "29.7.0", + "@fastify/static": "6.12.0", "@getlarge/keto-client-wrapper": "0.0.2", "@getlarge/keto-relations-parser": "0.0.2", "@getlarge/kratos-client-wrapper": "0.0.2", + "@jest/globals": "29.7.0", "@nestjs/axios": "3.0.0", "@nestjs/common": "10.2.4", "@nestjs/config": "3.1.1", "@nestjs/core": "10.2.4", + "@nestjs/jwt": "10.1.0", "@nestjs/microservices": "10.2.4", "@nestjs/mongoose": "10.0.1", "@nestjs/platform-fastify": "10.2.4", @@ -23,19 +26,28 @@ "@s1seven/nestjs-tools-amqp-transport": "0.5.1", "amqp-connection-manager": "4.1.14", "amqplib": "0.10.3", + "axios": "1.6.2", "class-transformer": "0.5.1", "class-validator": "0.13.2", "dotenv": "16.3.1", + "dotenv-expand": "10.0.0", "fastify": "4.22.0", "lodash-es": "4.17.21", "mongoose": "^6.1.0", "mongoose-update-if-current": "1.4.0", + "nestjs-keyset-paginator": "3.0.4", "nestjs-pino": "3.4.0", + "pino-http": "8.5.0", + "reflect-metadata": "0.1.14", "rxjs": "7.8.1", + "sodium-native": "4.0.4", "ts-mixer": "6.0.1", "webpack-node-externals": "3.0.0" }, - "peerDependencies": {}, + "peerDependencies": { + "ioredis": "4.28.5", + "uuid": "8.3.2" + }, "peerDependenciesMeta": { "ioredis": { "optional": true diff --git a/apps/payments/package-lock.json b/apps/payments/package-lock.json index 1372b819..ff134efc 100644 --- a/apps/payments/package-lock.json +++ b/apps/payments/package-lock.json @@ -13,9 +13,11 @@ "@fastify/helmet": "11.0.0", "@fastify/passport": "2.3.0", "@fastify/secure-session": "7.1.0", - "@fastify/static": "6.11.0", + "@fastify/static": "6.12.0", + "@getlarge/keto-client-wrapper": "0.0.2", + "@getlarge/keto-relations-parser": "0.0.2", + "@getlarge/kratos-client-wrapper": "0.0.2", "@jest/globals": "29.7.0", - "@nestjs-plugins/nestjs-nats-streaming-transport": "1.2.0", "@nestjs/axios": "3.0.0", "@nestjs/common": "10.2.4", "@nestjs/config": "3.1.1", @@ -30,35 +32,27 @@ "@s1seven/nestjs-tools-amqp-transport": "0.5.1", "amqp-connection-manager": "4.1.14", "amqplib": "0.10.3", - "antlr4ng": "2.0.3", - "axios": "1.5.0", + "axios": "1.6.2", "class-transformer": "0.5.1", "class-validator": "0.13.2", - "defekt": "9.3.1", "dotenv": "16.3.1", "dotenv-expand": "10.0.0", - "events": "3.3.0", "fastify": "4.22.0", - "lodash": "4.17.21", "lodash-es": "4.17.21", - "mongoose": "6.12.0", + "mongoose": "^6.1.0", "mongoose-update-if-current": "1.4.0", "nestjs-keyset-paginator": "3.0.4", "nestjs-pino": "3.4.0", - "node-nats-streaming": "0.3.2", - "passport-jwt": "4.0.0", "pino-http": "8.5.0", - "reflect-metadata": "0.1.13", + "reflect-metadata": "0.1.14", "rxjs": "7.8.1", "sodium-native": "4.0.4", "stripe": "8.222.0", "ts-mixer": "6.0.1", - "tslib": "2.6.2", "webpack-node-externals": "3.0.0" }, "peerDependencies": { "ioredis": "4.28.5", - "nats": "1.4.12", "uuid": "8.3.2" }, "peerDependenciesMeta": { @@ -2711,17 +2705,58 @@ } }, "node_modules/@fastify/static": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/@fastify/static/-/static-6.11.0.tgz", - "integrity": "sha512-jgnqpRojDqOLHnnKlZgvvUFzR8rrxqkqzbtmuHp1amIArxGVJDXyBMPbxb3yteklBA7tPilXbx5xzDRiGXR0RA==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@fastify/static/-/static-6.12.0.tgz", + "integrity": "sha512-KK1B84E6QD/FcQWxDI2aiUCwHxMJBI1KeCUzm1BwYpPY1b742+jeKruGHP2uOluuM6OkBPI8CIANrXcCRtC2oQ==", "dependencies": { "@fastify/accept-negotiator": "^1.0.0", "@fastify/send": "^2.0.0", "content-disposition": "^0.5.3", "fastify-plugin": "^4.0.0", "glob": "^8.0.1", - "p-limit": "^3.1.0", - "readable-stream": "^4.0.0" + "p-limit": "^3.1.0" + } + }, + "node_modules/@getlarge/keto-client-wrapper": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/@getlarge/keto-client-wrapper/-/keto-client-wrapper-0.0.2.tgz", + "integrity": "sha512-CiuUVYeevpz51JYym3GAvfUkz1jdPWzU3S+n6xgr94qbrq+snUBna9Tf0IczG4vellt/st1HSmIo27EsGWYODw==", + "dependencies": { + "@getlarge/keto-relations-parser": "0.0.2", + "defekt": "^9.3.1", + "lodash.get": "^4.4.2", + "tslib": "^2.3.0" + }, + "peerDependencies": { + "@nestjs/axios": "^3.0.1", + "@nestjs/common": "^10.0.2", + "@nestjs/core": "^10.0.2", + "@ory/client": "^1.4.9", + "axios": "1.6.5" + } + }, + "node_modules/@getlarge/keto-relations-parser": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/@getlarge/keto-relations-parser/-/keto-relations-parser-0.0.2.tgz", + "integrity": "sha512-Ikq/8SxO8OjKf0+3dkzkRfOYKQbNUfHidrZDsK+9fQRjXmPbLHSj/R6n6Bolqaewsy5sD5sCp0wwU1gahzHeoA==", + "dependencies": { + "defekt": "^9.3.1", + "lodash.get": "^4.4.2", + "tslib": "^2.3.0" + } + }, + "node_modules/@getlarge/kratos-client-wrapper": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/@getlarge/kratos-client-wrapper/-/kratos-client-wrapper-0.0.2.tgz", + "integrity": "sha512-lycbuorh3WKyCgU8eOfLvCIHSWK48M5ysfRHooFd+mjYigh3R7g0TO6aLZVKlbWoKzj4JwszBnwd3oQe8Ot2CQ==", + "dependencies": { + "tslib": "^2.3.0" + }, + "peerDependencies": { + "@nestjs/axios": "^3.0.1", + "@nestjs/common": "^10.0.2", + "@ory/client": "^1.4.9", + "axios": "1.6.5" } }, "node_modules/@istanbuljs/load-nyc-config": { @@ -3048,22 +3083,6 @@ "sparse-bitfield": "^3.0.3" } }, - "node_modules/@nestjs-plugins/nestjs-nats-streaming-transport": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@nestjs-plugins/nestjs-nats-streaming-transport/-/nestjs-nats-streaming-transport-1.2.0.tgz", - "integrity": "sha512-SS0+JXVboKihYOQhB3rBqxUKTo2ppLr5/PrwnoWb1GCoMNYgwOKz6m6A1w1P/4D6cokQ0f/V8okZE3Ya1RmHfw==", - "dependencies": { - "node-nats-streaming": "^0.3.2", - "reflect-metadata": "^0.1.13", - "rxjs": "^7.5.7", - "shortid": "^2.2.16" - }, - "peerDependencies": { - "@nestjs/common": "^9.2.0", - "@nestjs/core": "^9.2.0", - "@nestjs/microservices": "^9.2.0" - } - }, "node_modules/@nestjs/axios": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@nestjs/axios/-/axios-3.0.0.tgz", @@ -3990,16 +4009,6 @@ "node": ">= 10" } }, - "node_modules/@nx/workspace/node_modules/axios": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", - "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", - "dependencies": { - "follow-redirects": "^1.15.0", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - } - }, "node_modules/@nx/workspace/node_modules/glob": { "version": "7.1.4", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", @@ -4117,6 +4126,25 @@ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, + "node_modules/@ory/client": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@ory/client/-/client-1.5.1.tgz", + "integrity": "sha512-5OiO/ZFQKbv51i3LUIu3ENHdo0cdgUpkO7i3+dY3qoE2FjrBRD8Vh+fF7njTJO89hdSc9ua0UhU/6yUxiM3SSg==", + "peer": true, + "dependencies": { + "axios": "^0.27.2" + } + }, + "node_modules/@ory/client/node_modules/axios": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", + "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", + "peer": true, + "dependencies": { + "follow-redirects": "^1.14.9", + "form-data": "^4.0.0" + } + }, "node_modules/@phenomnomnominal/tsquery": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/@phenomnomnominal/tsquery/-/tsquery-5.0.1.tgz", @@ -5385,23 +5413,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/antlr4ng": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/antlr4ng/-/antlr4ng-2.0.3.tgz", - "integrity": "sha512-usw0hZsNbTQrJ899P6sHLlQbmKgwQ9UBYq5rh6ZFicPf5qtRJogPVTBj4fSB3OY5ZLP5TSZ7d8tR2p4I5KyiLQ==", - "peerDependencies": { - "antlr4ng-cli": "^1.0.0" - } - }, - "node_modules/antlr4ng-cli": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/antlr4ng-cli/-/antlr4ng-cli-1.0.7.tgz", - "integrity": "sha512-qN2FsDBmLvsQcA5CWTrPz8I8gNXeS1fgXBBhI78VyxBSBV/EJgqy8ks6IDTC9jyugpl40csCQ4sL5K4i2YZ/2w==", - "peer": true, - "bin": { - "antlr4ng": "index.js" - } - }, "node_modules/anymatch": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", @@ -5510,9 +5521,9 @@ } }, "node_modules/axios": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.5.0.tgz", - "integrity": "sha512-D4DdjDo5CY50Qms0qGQTTw6Q44jl7zRwY7bthds06pUGfChBCTcQs+N743eFWGEd6pRTMd6A+I87aWyFV5wiZQ==", + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", + "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", "dependencies": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", @@ -8023,11 +8034,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/google-protobuf": { - "version": "3.21.2", - "resolved": "https://registry.npmjs.org/google-protobuf/-/google-protobuf-3.21.2.tgz", - "integrity": "sha512-3MSOYFO5U9mPGikIYCzK0SaThypfGgS6bHqrUGXG3DPHCrb+txNqeEcns1W0lkGfk0rCyNXm7xB9rMxnCiZOoA==" - }, "node_modules/gopd": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", @@ -9094,46 +9100,16 @@ "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==" }, - "node_modules/lodash.includes": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", - "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==" - }, - "node_modules/lodash.isboolean": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", - "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==" - }, - "node_modules/lodash.isinteger": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", - "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==" - }, - "node_modules/lodash.isnumber": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", - "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==" - }, - "node_modules/lodash.isplainobject": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", - "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==" - }, - "node_modules/lodash.isstring": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", - "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==" + "node_modules/lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==" }, "node_modules/lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==" }, - "node_modules/lodash.once": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", - "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==" - }, "node_modules/lodash.uniq": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", @@ -9483,6 +9459,8 @@ "version": "1.4.12", "resolved": "https://registry.npmjs.org/nats/-/nats-1.4.12.tgz", "integrity": "sha512-Jf4qesEF0Ay0D4AMw3OZnKMRTQm+6oZ5q8/m4gpy5bTmiDiK6wCXbZpzEslmezGpE93LV3RojNEG6dpK/mysLQ==", + "optional": true, + "peer": true, "dependencies": { "nuid": "^1.1.4", "ts-nkeys": "^1.0.16" @@ -9627,23 +9605,6 @@ "resolved": "https://registry.npmjs.org/node-machine-id/-/node-machine-id-1.1.12.tgz", "integrity": "sha512-QNABxbrPa3qEIfrE6GOJ7BYIuignnJw7iQ2YPbc3Nla1HzRJjXzZOiikfF8m7eAMfichLt3M4VgLOetqgDmgGQ==" }, - "node_modules/node-nats-streaming": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/node-nats-streaming/-/node-nats-streaming-0.3.2.tgz", - "integrity": "sha512-exeT+FwGYW3UbBSzu8a7ykwWoY6R/vjQLr1RoZ1gnoJ9F66WVvpMZQWCZzLxlf9XRpJTTygcp6P1+WRw9h07Sg==", - "dependencies": { - "google-protobuf": "^3.11.2", - "nats": "^1.4.9", - "nuid": "^1.1.4" - }, - "bin": { - "node-stan-pub": "examples/stan-pub.js", - "node-stan-sub": "examples/stan-sub.js" - }, - "engines": { - "node": ">= 8.0.0" - } - }, "node_modules/node-releases": { "version": "2.0.14", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", @@ -9735,6 +9696,8 @@ "version": "1.1.6", "resolved": "https://registry.npmjs.org/nuid/-/nuid-1.1.6.tgz", "integrity": "sha512-Eb3CPCupYscP1/S1FQcO5nxtu6l/F3k0MQ69h7f5osnsemVk5pkc8/5AyalVT+NCfra9M71U8POqF6EZa6IHvg==", + "optional": true, + "peer": true, "engines": { "node": ">= 8.16.0" } @@ -9810,17 +9773,6 @@ } } }, - "node_modules/nx/node_modules/axios": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", - "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", - "peer": true, - "dependencies": { - "follow-redirects": "^1.15.0", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - } - }, "node_modules/nx/node_modules/glob": { "version": "7.1.4", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", @@ -10102,52 +10054,6 @@ "node": ">= 0.8" } }, - "node_modules/passport-jwt": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/passport-jwt/-/passport-jwt-4.0.0.tgz", - "integrity": "sha512-BwC0n2GP/1hMVjR4QpnvqA61TxenUMlmfNjYNgK0ZAs0HK4SOQkHcSv4L328blNTLtHq7DbmvyNJiH+bn6C5Mg==", - "dependencies": { - "jsonwebtoken": "^8.2.0", - "passport-strategy": "^1.0.0" - } - }, - "node_modules/passport-jwt/node_modules/jsonwebtoken": { - "version": "8.5.1", - "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz", - "integrity": "sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w==", - "dependencies": { - "jws": "^3.2.2", - "lodash.includes": "^4.3.0", - "lodash.isboolean": "^3.0.3", - "lodash.isinteger": "^4.0.4", - "lodash.isnumber": "^3.0.3", - "lodash.isplainobject": "^4.0.6", - "lodash.isstring": "^4.0.1", - "lodash.once": "^4.0.0", - "ms": "^2.1.1", - "semver": "^5.6.0" - }, - "engines": { - "node": ">=4", - "npm": ">=1.4.28" - } - }, - "node_modules/passport-jwt/node_modules/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/passport-strategy": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/passport-strategy/-/passport-strategy-1.0.0.tgz", - "integrity": "sha512-CB97UUvDKJde2V0KDWWB3lyf6PC3FaZP7YxZ2G8OAtn9p4HI9j9JLP9qjOGZFvyl8uwNT8qM+hGnz/n16NI7oA==", - "engines": { - "node": ">= 0.4.0" - } - }, "node_modules/path-exists": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", @@ -11101,9 +11007,9 @@ } }, "node_modules/reflect-metadata": { - "version": "0.1.13", - "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", - "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==" + "version": "0.1.14", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.14.tgz", + "integrity": "sha512-ZhYeb6nRaXCfhnndflDK8qI6ZQ/YcWZCISRAWICW9XYqMUwjZM9Z0DveWX/ABN01oxSHwVxKQmxeYZSsm0jh5A==" }, "node_modules/regenerate": { "version": "1.4.2", @@ -11658,20 +11564,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/shortid": { - "version": "2.2.16", - "resolved": "https://registry.npmjs.org/shortid/-/shortid-2.2.16.tgz", - "integrity": "sha512-Ugt+GIZqvGXCIItnsL+lvFJOiN7RYqlGy7QE41O3YC1xbNSeDGIRO7xg2JJXIAj1cAGnOeC1r7/T9pgrtQbv4g==", - "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", - "dependencies": { - "nanoid": "^2.1.0" - } - }, - "node_modules/shortid/node_modules/nanoid": { - "version": "2.1.11", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.11.tgz", - "integrity": "sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA==" - }, "node_modules/side-channel": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", @@ -12543,6 +12435,8 @@ "version": "1.0.16", "resolved": "https://registry.npmjs.org/ts-nkeys/-/ts-nkeys-1.0.16.tgz", "integrity": "sha512-1qrhAlavbm36wtW+7NtKOgxpzl+70NTF8xlz9mEhiA5zHMlMxjj3sEVKWm3pGZhHXE0Q3ykjrj+OSRVaYw+Dqg==", + "optional": true, + "peer": true, "dependencies": { "tweetnacl": "^1.0.3" } @@ -12623,7 +12517,9 @@ "node_modules/tweetnacl": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", - "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==", + "optional": true, + "peer": true }, "node_modules/type-detect": { "version": "4.0.8", diff --git a/apps/payments/package.json b/apps/payments/package.json index c086fb76..1885f51c 100644 --- a/apps/payments/package.json +++ b/apps/payments/package.json @@ -2,17 +2,21 @@ "name": "payments", "version": "0.2.0", "dependencies": { + "@fastify/cookie": "9.0.4", "@fastify/cors": "8.3.0", "@fastify/helmet": "11.0.0", "@fastify/passport": "2.3.0", "@fastify/secure-session": "7.1.0", + "@fastify/static": "6.12.0", "@getlarge/keto-client-wrapper": "0.0.2", "@getlarge/keto-relations-parser": "0.0.2", "@getlarge/kratos-client-wrapper": "0.0.2", + "@jest/globals": "29.7.0", "@nestjs/axios": "3.0.0", "@nestjs/common": "10.2.4", "@nestjs/config": "3.1.1", "@nestjs/core": "10.2.4", + "@nestjs/jwt": "10.1.0", "@nestjs/microservices": "10.2.4", "@nestjs/mongoose": "10.0.1", "@nestjs/platform-fastify": "10.2.4", @@ -22,20 +26,29 @@ "@s1seven/nestjs-tools-amqp-transport": "0.5.1", "amqp-connection-manager": "4.1.14", "amqplib": "0.10.3", + "axios": "1.6.2", "class-transformer": "0.5.1", "class-validator": "0.13.2", "dotenv": "16.3.1", + "dotenv-expand": "10.0.0", "fastify": "4.22.0", "lodash-es": "4.17.21", "mongoose": "^6.1.0", "mongoose-update-if-current": "1.4.0", + "nestjs-keyset-paginator": "3.0.4", "nestjs-pino": "3.4.0", + "pino-http": "8.5.0", + "reflect-metadata": "0.1.14", "rxjs": "7.8.1", + "sodium-native": "4.0.4", "stripe": "8.222.0", "ts-mixer": "6.0.1", "webpack-node-externals": "3.0.0" }, - "peerDependencies": {}, + "peerDependencies": { + "ioredis": "4.28.5", + "uuid": "8.3.2" + }, "peerDependenciesMeta": { "ioredis": { "optional": true diff --git a/apps/tickets/package-lock.json b/apps/tickets/package-lock.json index 57c2b612..4bdf953b 100644 --- a/apps/tickets/package-lock.json +++ b/apps/tickets/package-lock.json @@ -13,9 +13,11 @@ "@fastify/helmet": "11.0.0", "@fastify/passport": "2.3.0", "@fastify/secure-session": "7.1.0", - "@fastify/static": "6.11.0", + "@fastify/static": "6.12.0", + "@getlarge/keto-client-wrapper": "0.0.2", + "@getlarge/keto-relations-parser": "0.0.2", + "@getlarge/kratos-client-wrapper": "0.0.2", "@jest/globals": "29.7.0", - "@nestjs-plugins/nestjs-nats-streaming-transport": "1.2.0", "@nestjs/axios": "3.0.0", "@nestjs/common": "10.2.4", "@nestjs/config": "3.1.1", @@ -30,34 +32,26 @@ "@s1seven/nestjs-tools-amqp-transport": "0.5.1", "amqp-connection-manager": "4.1.14", "amqplib": "0.10.3", - "antlr4ng": "2.0.3", - "axios": "1.5.0", + "axios": "1.6.2", "class-transformer": "0.5.1", "class-validator": "0.13.2", - "defekt": "9.3.1", "dotenv": "16.3.1", "dotenv-expand": "10.0.0", - "events": "3.3.0", "fastify": "4.22.0", - "lodash": "4.17.21", "lodash-es": "4.17.21", - "mongoose": "6.12.0", + "mongoose": "^6.1.0", "mongoose-update-if-current": "1.4.0", "nestjs-keyset-paginator": "3.0.4", "nestjs-pino": "3.4.0", - "node-nats-streaming": "0.3.2", - "passport-jwt": "4.0.0", "pino-http": "8.5.0", - "reflect-metadata": "0.1.13", + "reflect-metadata": "0.1.14", "rxjs": "7.8.1", "sodium-native": "4.0.4", "ts-mixer": "6.0.1", - "tslib": "2.6.2", "webpack-node-externals": "3.0.0" }, "peerDependencies": { "ioredis": "4.28.5", - "nats": "1.4.12", "uuid": "8.3.2" }, "peerDependenciesMeta": { @@ -2710,17 +2704,58 @@ } }, "node_modules/@fastify/static": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/@fastify/static/-/static-6.11.0.tgz", - "integrity": "sha512-jgnqpRojDqOLHnnKlZgvvUFzR8rrxqkqzbtmuHp1amIArxGVJDXyBMPbxb3yteklBA7tPilXbx5xzDRiGXR0RA==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@fastify/static/-/static-6.12.0.tgz", + "integrity": "sha512-KK1B84E6QD/FcQWxDI2aiUCwHxMJBI1KeCUzm1BwYpPY1b742+jeKruGHP2uOluuM6OkBPI8CIANrXcCRtC2oQ==", "dependencies": { "@fastify/accept-negotiator": "^1.0.0", "@fastify/send": "^2.0.0", "content-disposition": "^0.5.3", "fastify-plugin": "^4.0.0", "glob": "^8.0.1", - "p-limit": "^3.1.0", - "readable-stream": "^4.0.0" + "p-limit": "^3.1.0" + } + }, + "node_modules/@getlarge/keto-client-wrapper": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/@getlarge/keto-client-wrapper/-/keto-client-wrapper-0.0.2.tgz", + "integrity": "sha512-CiuUVYeevpz51JYym3GAvfUkz1jdPWzU3S+n6xgr94qbrq+snUBna9Tf0IczG4vellt/st1HSmIo27EsGWYODw==", + "dependencies": { + "@getlarge/keto-relations-parser": "0.0.2", + "defekt": "^9.3.1", + "lodash.get": "^4.4.2", + "tslib": "^2.3.0" + }, + "peerDependencies": { + "@nestjs/axios": "^3.0.1", + "@nestjs/common": "^10.0.2", + "@nestjs/core": "^10.0.2", + "@ory/client": "^1.4.9", + "axios": "1.6.5" + } + }, + "node_modules/@getlarge/keto-relations-parser": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/@getlarge/keto-relations-parser/-/keto-relations-parser-0.0.2.tgz", + "integrity": "sha512-Ikq/8SxO8OjKf0+3dkzkRfOYKQbNUfHidrZDsK+9fQRjXmPbLHSj/R6n6Bolqaewsy5sD5sCp0wwU1gahzHeoA==", + "dependencies": { + "defekt": "^9.3.1", + "lodash.get": "^4.4.2", + "tslib": "^2.3.0" + } + }, + "node_modules/@getlarge/kratos-client-wrapper": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/@getlarge/kratos-client-wrapper/-/kratos-client-wrapper-0.0.2.tgz", + "integrity": "sha512-lycbuorh3WKyCgU8eOfLvCIHSWK48M5ysfRHooFd+mjYigh3R7g0TO6aLZVKlbWoKzj4JwszBnwd3oQe8Ot2CQ==", + "dependencies": { + "tslib": "^2.3.0" + }, + "peerDependencies": { + "@nestjs/axios": "^3.0.1", + "@nestjs/common": "^10.0.2", + "@ory/client": "^1.4.9", + "axios": "1.6.5" } }, "node_modules/@istanbuljs/load-nyc-config": { @@ -3047,22 +3082,6 @@ "sparse-bitfield": "^3.0.3" } }, - "node_modules/@nestjs-plugins/nestjs-nats-streaming-transport": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@nestjs-plugins/nestjs-nats-streaming-transport/-/nestjs-nats-streaming-transport-1.2.0.tgz", - "integrity": "sha512-SS0+JXVboKihYOQhB3rBqxUKTo2ppLr5/PrwnoWb1GCoMNYgwOKz6m6A1w1P/4D6cokQ0f/V8okZE3Ya1RmHfw==", - "dependencies": { - "node-nats-streaming": "^0.3.2", - "reflect-metadata": "^0.1.13", - "rxjs": "^7.5.7", - "shortid": "^2.2.16" - }, - "peerDependencies": { - "@nestjs/common": "^9.2.0", - "@nestjs/core": "^9.2.0", - "@nestjs/microservices": "^9.2.0" - } - }, "node_modules/@nestjs/axios": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@nestjs/axios/-/axios-3.0.0.tgz", @@ -3989,16 +4008,6 @@ "node": ">= 10" } }, - "node_modules/@nx/workspace/node_modules/axios": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", - "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", - "dependencies": { - "follow-redirects": "^1.15.0", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - } - }, "node_modules/@nx/workspace/node_modules/glob": { "version": "7.1.4", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", @@ -4116,6 +4125,25 @@ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, + "node_modules/@ory/client": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@ory/client/-/client-1.5.1.tgz", + "integrity": "sha512-5OiO/ZFQKbv51i3LUIu3ENHdo0cdgUpkO7i3+dY3qoE2FjrBRD8Vh+fF7njTJO89hdSc9ua0UhU/6yUxiM3SSg==", + "peer": true, + "dependencies": { + "axios": "^0.27.2" + } + }, + "node_modules/@ory/client/node_modules/axios": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", + "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", + "peer": true, + "dependencies": { + "follow-redirects": "^1.14.9", + "form-data": "^4.0.0" + } + }, "node_modules/@phenomnomnominal/tsquery": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/@phenomnomnominal/tsquery/-/tsquery-5.0.1.tgz", @@ -5384,23 +5412,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/antlr4ng": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/antlr4ng/-/antlr4ng-2.0.3.tgz", - "integrity": "sha512-usw0hZsNbTQrJ899P6sHLlQbmKgwQ9UBYq5rh6ZFicPf5qtRJogPVTBj4fSB3OY5ZLP5TSZ7d8tR2p4I5KyiLQ==", - "peerDependencies": { - "antlr4ng-cli": "^1.0.0" - } - }, - "node_modules/antlr4ng-cli": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/antlr4ng-cli/-/antlr4ng-cli-1.0.7.tgz", - "integrity": "sha512-qN2FsDBmLvsQcA5CWTrPz8I8gNXeS1fgXBBhI78VyxBSBV/EJgqy8ks6IDTC9jyugpl40csCQ4sL5K4i2YZ/2w==", - "peer": true, - "bin": { - "antlr4ng": "index.js" - } - }, "node_modules/anymatch": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", @@ -5509,9 +5520,9 @@ } }, "node_modules/axios": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.5.0.tgz", - "integrity": "sha512-D4DdjDo5CY50Qms0qGQTTw6Q44jl7zRwY7bthds06pUGfChBCTcQs+N743eFWGEd6pRTMd6A+I87aWyFV5wiZQ==", + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", + "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", "dependencies": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", @@ -7994,11 +8005,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/google-protobuf": { - "version": "3.21.2", - "resolved": "https://registry.npmjs.org/google-protobuf/-/google-protobuf-3.21.2.tgz", - "integrity": "sha512-3MSOYFO5U9mPGikIYCzK0SaThypfGgS6bHqrUGXG3DPHCrb+txNqeEcns1W0lkGfk0rCyNXm7xB9rMxnCiZOoA==" - }, "node_modules/gopd": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", @@ -9065,46 +9071,16 @@ "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==" }, - "node_modules/lodash.includes": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", - "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==" - }, - "node_modules/lodash.isboolean": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", - "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==" - }, - "node_modules/lodash.isinteger": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", - "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==" - }, - "node_modules/lodash.isnumber": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", - "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==" - }, - "node_modules/lodash.isplainobject": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", - "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==" - }, - "node_modules/lodash.isstring": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", - "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==" + "node_modules/lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==" }, "node_modules/lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==" }, - "node_modules/lodash.once": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", - "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==" - }, "node_modules/lodash.uniq": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", @@ -9454,6 +9430,8 @@ "version": "1.4.12", "resolved": "https://registry.npmjs.org/nats/-/nats-1.4.12.tgz", "integrity": "sha512-Jf4qesEF0Ay0D4AMw3OZnKMRTQm+6oZ5q8/m4gpy5bTmiDiK6wCXbZpzEslmezGpE93LV3RojNEG6dpK/mysLQ==", + "optional": true, + "peer": true, "dependencies": { "nuid": "^1.1.4", "ts-nkeys": "^1.0.16" @@ -9598,23 +9576,6 @@ "resolved": "https://registry.npmjs.org/node-machine-id/-/node-machine-id-1.1.12.tgz", "integrity": "sha512-QNABxbrPa3qEIfrE6GOJ7BYIuignnJw7iQ2YPbc3Nla1HzRJjXzZOiikfF8m7eAMfichLt3M4VgLOetqgDmgGQ==" }, - "node_modules/node-nats-streaming": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/node-nats-streaming/-/node-nats-streaming-0.3.2.tgz", - "integrity": "sha512-exeT+FwGYW3UbBSzu8a7ykwWoY6R/vjQLr1RoZ1gnoJ9F66WVvpMZQWCZzLxlf9XRpJTTygcp6P1+WRw9h07Sg==", - "dependencies": { - "google-protobuf": "^3.11.2", - "nats": "^1.4.9", - "nuid": "^1.1.4" - }, - "bin": { - "node-stan-pub": "examples/stan-pub.js", - "node-stan-sub": "examples/stan-sub.js" - }, - "engines": { - "node": ">= 8.0.0" - } - }, "node_modules/node-releases": { "version": "2.0.14", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", @@ -9706,6 +9667,8 @@ "version": "1.1.6", "resolved": "https://registry.npmjs.org/nuid/-/nuid-1.1.6.tgz", "integrity": "sha512-Eb3CPCupYscP1/S1FQcO5nxtu6l/F3k0MQ69h7f5osnsemVk5pkc8/5AyalVT+NCfra9M71U8POqF6EZa6IHvg==", + "optional": true, + "peer": true, "engines": { "node": ">= 8.16.0" } @@ -9781,17 +9744,6 @@ } } }, - "node_modules/nx/node_modules/axios": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", - "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", - "peer": true, - "dependencies": { - "follow-redirects": "^1.15.0", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - } - }, "node_modules/nx/node_modules/glob": { "version": "7.1.4", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", @@ -10073,52 +10025,6 @@ "node": ">= 0.8" } }, - "node_modules/passport-jwt": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/passport-jwt/-/passport-jwt-4.0.0.tgz", - "integrity": "sha512-BwC0n2GP/1hMVjR4QpnvqA61TxenUMlmfNjYNgK0ZAs0HK4SOQkHcSv4L328blNTLtHq7DbmvyNJiH+bn6C5Mg==", - "dependencies": { - "jsonwebtoken": "^8.2.0", - "passport-strategy": "^1.0.0" - } - }, - "node_modules/passport-jwt/node_modules/jsonwebtoken": { - "version": "8.5.1", - "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz", - "integrity": "sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w==", - "dependencies": { - "jws": "^3.2.2", - "lodash.includes": "^4.3.0", - "lodash.isboolean": "^3.0.3", - "lodash.isinteger": "^4.0.4", - "lodash.isnumber": "^3.0.3", - "lodash.isplainobject": "^4.0.6", - "lodash.isstring": "^4.0.1", - "lodash.once": "^4.0.0", - "ms": "^2.1.1", - "semver": "^5.6.0" - }, - "engines": { - "node": ">=4", - "npm": ">=1.4.28" - } - }, - "node_modules/passport-jwt/node_modules/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/passport-strategy": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/passport-strategy/-/passport-strategy-1.0.0.tgz", - "integrity": "sha512-CB97UUvDKJde2V0KDWWB3lyf6PC3FaZP7YxZ2G8OAtn9p4HI9j9JLP9qjOGZFvyl8uwNT8qM+hGnz/n16NI7oA==", - "engines": { - "node": ">= 0.4.0" - } - }, "node_modules/path-exists": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", @@ -11072,9 +10978,9 @@ } }, "node_modules/reflect-metadata": { - "version": "0.1.13", - "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", - "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==" + "version": "0.1.14", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.14.tgz", + "integrity": "sha512-ZhYeb6nRaXCfhnndflDK8qI6ZQ/YcWZCISRAWICW9XYqMUwjZM9Z0DveWX/ABN01oxSHwVxKQmxeYZSsm0jh5A==" }, "node_modules/regenerate": { "version": "1.4.2", @@ -11629,20 +11535,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/shortid": { - "version": "2.2.16", - "resolved": "https://registry.npmjs.org/shortid/-/shortid-2.2.16.tgz", - "integrity": "sha512-Ugt+GIZqvGXCIItnsL+lvFJOiN7RYqlGy7QE41O3YC1xbNSeDGIRO7xg2JJXIAj1cAGnOeC1r7/T9pgrtQbv4g==", - "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", - "dependencies": { - "nanoid": "^2.1.0" - } - }, - "node_modules/shortid/node_modules/nanoid": { - "version": "2.1.11", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.11.tgz", - "integrity": "sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA==" - }, "node_modules/side-channel": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", @@ -12502,6 +12394,8 @@ "version": "1.0.16", "resolved": "https://registry.npmjs.org/ts-nkeys/-/ts-nkeys-1.0.16.tgz", "integrity": "sha512-1qrhAlavbm36wtW+7NtKOgxpzl+70NTF8xlz9mEhiA5zHMlMxjj3sEVKWm3pGZhHXE0Q3ykjrj+OSRVaYw+Dqg==", + "optional": true, + "peer": true, "dependencies": { "tweetnacl": "^1.0.3" } @@ -12582,7 +12476,9 @@ "node_modules/tweetnacl": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", - "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==", + "optional": true, + "peer": true }, "node_modules/type-detect": { "version": "4.0.8", diff --git a/apps/tickets/package.json b/apps/tickets/package.json index f9d2b494..61330b8a 100644 --- a/apps/tickets/package.json +++ b/apps/tickets/package.json @@ -3,17 +3,21 @@ "type": "module", "version": "0.2.0", "dependencies": { + "@fastify/cookie": "9.0.4", "@fastify/cors": "8.3.0", "@fastify/helmet": "11.0.0", "@fastify/passport": "2.3.0", "@fastify/secure-session": "7.1.0", + "@fastify/static": "6.12.0", "@getlarge/keto-client-wrapper": "0.0.2", "@getlarge/keto-relations-parser": "0.0.2", "@getlarge/kratos-client-wrapper": "0.0.2", + "@jest/globals": "29.7.0", "@nestjs/axios": "3.0.0", "@nestjs/common": "10.2.4", "@nestjs/config": "3.1.1", "@nestjs/core": "10.2.4", + "@nestjs/jwt": "10.1.0", "@nestjs/microservices": "10.2.4", "@nestjs/mongoose": "10.0.1", "@nestjs/platform-fastify": "10.2.4", @@ -23,20 +27,28 @@ "@s1seven/nestjs-tools-amqp-transport": "0.5.1", "amqp-connection-manager": "4.1.14", "amqplib": "0.10.3", + "axios": "1.6.2", "class-transformer": "0.5.1", "class-validator": "0.13.2", "dotenv": "16.3.1", + "dotenv-expand": "10.0.0", "fastify": "4.22.0", "lodash-es": "4.17.21", "mongoose": "^6.1.0", "mongoose-update-if-current": "1.4.0", "nestjs-keyset-paginator": "3.0.4", "nestjs-pino": "3.4.0", + "pino-http": "8.5.0", + "reflect-metadata": "0.1.14", "rxjs": "7.8.1", + "sodium-native": "4.0.4", "ts-mixer": "6.0.1", "webpack-node-externals": "3.0.0" }, - "peerDependencies": {}, + "peerDependencies": { + "ioredis": "4.28.5", + "uuid": "8.3.2" + }, "peerDependenciesMeta": { "ioredis": { "optional": true From 55154ad7959f4c00171ec169c720feb44ad65583 Mon Sep 17 00:00:00 2001 From: getlarge Date: Mon, 15 Jan 2024 19:03:13 +0100 Subject: [PATCH 12/14] ci: disable package.json regeneration script --- .github/workflows/ci.yaml | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8675717c..580a5cf0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -291,9 +291,22 @@ jobs: node-version: ${{ env.NODE_VERSION }} token: ${{ secrets.GITHUB_TOKEN }} - - name: Regenerate backend apps package.json - if: needs.init.outputs.should-update-packages == 'true' - run: NX_CLOUD_DISTRIBUTED_EXECUTION=false yarn refresh-pkg-json + # this step now goes in conflict with package.json regeneration via ESLint @nx/dependency-checks rule + # - name: Regenerate backend apps package.json + # if: needs.init.outputs.should-update-packages == 'true' + # run: NX_CLOUD_DISTRIBUTED_EXECUTION=false yarn refresh-pkg-json + + # - name: Add, commit and push backend package.json + # if: needs.init.outputs.should-update-packages == 'true' + # id: commit-pkg + # uses: stefanzweifel/git-auto-commit-action@v4 + # with: + # commit_message: 'chore: regenerate backend package*.json [skip ci]' + # file_pattern: 'apps/**/package*.json' + # commit_options: '--no-verify' + + # - if: steps.commit-pkg.outputs.changes_detected == 'true' + # run: echo "BASE_DEPTH=$((${{ env.BASE_DEPTH }} + 1))" >> $GITHUB_ENV - name: Regenerate frontend models if: needs.init.outputs.should-update-models == 'true' @@ -303,18 +316,6 @@ jobs: if: needs.init.outputs.should-update-models == 'true' run: npx nx format:write --projects=shared-ng-open-api - - name: Add, commit and push backend package.json - if: needs.init.outputs.should-update-packages == 'true' - id: commit-pkg - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: 'chore: regenerate backend package*.json [skip ci]' - file_pattern: 'apps/**/package*.json' - commit_options: '--no-verify' - - - if: steps.commit-pkg.outputs.changes_detected == 'true' - run: echo "BASE_DEPTH=$((${{ env.BASE_DEPTH }} + 1))" >> $GITHUB_ENV - - name: Add, commit and push generated models if: needs.init.outputs.should-update-models == 'true' id: commit-ng-models From 7fa3c985bb24e8ecb792e54dc7d3c0e3b9bf14bc Mon Sep 17 00:00:00 2001 From: getlarge Date: Mon, 15 Jan 2024 19:03:47 +0100 Subject: [PATCH 13/14] chore: update ESLint @nx/dependency-checks rule config --- apps/auth/.eslintrc.json | 2 +- apps/auth/package.json | 9 +-------- apps/expiration/.eslintrc.json | 2 +- apps/expiration/package.json | 9 +-------- apps/orders/.eslintrc.json | 2 +- apps/orders/package.json | 8 +------- apps/payments/.eslintrc.json | 2 +- apps/payments/package.json | 8 +------- apps/permissions-manager/.eslintrc.json | 2 +- apps/tickets/.eslintrc.json | 2 +- apps/tickets/package.json | 8 +------- 11 files changed, 11 insertions(+), 43 deletions(-) diff --git a/apps/auth/.eslintrc.json b/apps/auth/.eslintrc.json index 912dafd3..722563df 100644 --- a/apps/auth/.eslintrc.json +++ b/apps/auth/.eslintrc.json @@ -30,7 +30,7 @@ "checkMissingDependencies": true, "checkObsoleteDependencies": true, "checkVersionMismatches": true, - "includeTransitiveDependencies": false, + "includeTransitiveDependencies": true, "ignoredDependencies": ["@jest/globals", "@nestjs/testing"] } ] diff --git a/apps/auth/package.json b/apps/auth/package.json index ab19289d..1fbcfe70 100644 --- a/apps/auth/package.json +++ b/apps/auth/package.json @@ -7,7 +7,6 @@ "@fastify/helmet": "11.0.0", "@fastify/passport": "2.3.0", "@fastify/secure-session": "7.1.0", - "@fastify/static": "6.12.0", "@getlarge/kratos-client-wrapper": "0.0.2", "@jest/globals": "29.7.0", "@nestjs/axios": "3.0.0", @@ -20,9 +19,6 @@ "@nestjs/swagger": "7.1.10", "@nestjs/terminus": "10.0.1", "@nx/webpack": "17.1.3", - "amqp-connection-manager": "4.1.14", - "amqplib": "0.10.3", - "axios": "1.6.2", "class-transformer": "0.5.1", "class-validator": "0.13.2", "dotenv": "16.3.1", @@ -33,15 +29,12 @@ "nestjs-keyset-paginator": "3.0.4", "nestjs-pino": "3.4.0", "passport-jwt": "4.0.0", - "pino-http": "8.5.0", "reflect-metadata": "0.1.14", "rxjs": "7.8.1", "ts-mixer": "6.0.1", "webpack-node-externals": "3.0.0" }, - "peerDependencies": { - "ioredis": "4.28.5" - }, + "peerDependencies": {}, "peerDependenciesMeta": { "ioredis": { "optional": true diff --git a/apps/expiration/.eslintrc.json b/apps/expiration/.eslintrc.json index 82a1ee90..61056da9 100644 --- a/apps/expiration/.eslintrc.json +++ b/apps/expiration/.eslintrc.json @@ -25,7 +25,7 @@ "checkMissingDependencies": true, "checkObsoleteDependencies": true, "checkVersionMismatches": true, - "includeTransitiveDependencies": false, + "includeTransitiveDependencies": true, "ignoredDependencies": ["@jest/globals", "@nestjs/testing"] } ] diff --git a/apps/expiration/package.json b/apps/expiration/package.json index 2a07004f..71718c27 100644 --- a/apps/expiration/package.json +++ b/apps/expiration/package.json @@ -4,7 +4,6 @@ "dependencies": { "@fastify/cookie": "9.0.4", "@fastify/helmet": "11.0.0", - "@fastify/static": "6.12.0", "@jest/globals": "29.7.0", "@nestjs/axios": "3.0.0", "@nestjs/bull": "10.0.1", @@ -12,7 +11,6 @@ "@nestjs/config": "3.1.1", "@nestjs/core": "10.2.4", "@nestjs/microservices": "10.2.4", - "@nestjs/mongoose": "10.0.1", "@nestjs/platform-fastify": "10.2.4", "@nestjs/swagger": "7.1.10", "@nestjs/terminus": "10.0.1", @@ -20,7 +18,6 @@ "@s1seven/nestjs-tools-amqp-transport": "0.5.1", "amqp-connection-manager": "4.1.14", "amqplib": "0.10.3", - "axios": "1.6.2", "bull": "4.8.2", "class-transformer": "0.5.1", "class-validator": "0.13.2", @@ -29,17 +26,13 @@ "fastify": "4.22.0", "ioredis": "4.28.5", "lodash-es": "4.17.21", - "mongoose": "6.12.3", "nestjs-pino": "3.4.0", - "pino-http": "8.5.0", "reflect-metadata": "0.1.14", "rxjs": "7.8.1", "ts-mixer": "6.0.1", "url": "0.11.3", "webpack-node-externals": "3.0.0" }, - "peerDependencies": { - "uuid": "8.3.2" - }, + "peerDependencies": {}, "main": "main.js" } diff --git a/apps/orders/.eslintrc.json b/apps/orders/.eslintrc.json index 82a1ee90..61056da9 100644 --- a/apps/orders/.eslintrc.json +++ b/apps/orders/.eslintrc.json @@ -25,7 +25,7 @@ "checkMissingDependencies": true, "checkObsoleteDependencies": true, "checkVersionMismatches": true, - "includeTransitiveDependencies": false, + "includeTransitiveDependencies": true, "ignoredDependencies": ["@jest/globals", "@nestjs/testing"] } ] diff --git a/apps/orders/package.json b/apps/orders/package.json index 9463dc10..13f344e7 100644 --- a/apps/orders/package.json +++ b/apps/orders/package.json @@ -7,7 +7,6 @@ "@fastify/helmet": "11.0.0", "@fastify/passport": "2.3.0", "@fastify/secure-session": "7.1.0", - "@fastify/static": "6.12.0", "@getlarge/keto-client-wrapper": "0.0.2", "@getlarge/keto-relations-parser": "0.0.2", "@getlarge/kratos-client-wrapper": "0.0.2", @@ -26,7 +25,6 @@ "@s1seven/nestjs-tools-amqp-transport": "0.5.1", "amqp-connection-manager": "4.1.14", "amqplib": "0.10.3", - "axios": "1.6.2", "class-transformer": "0.5.1", "class-validator": "0.13.2", "dotenv": "16.3.1", @@ -37,17 +35,13 @@ "mongoose-update-if-current": "1.4.0", "nestjs-keyset-paginator": "3.0.4", "nestjs-pino": "3.4.0", - "pino-http": "8.5.0", "reflect-metadata": "0.1.14", "rxjs": "7.8.1", "sodium-native": "4.0.4", "ts-mixer": "6.0.1", "webpack-node-externals": "3.0.0" }, - "peerDependencies": { - "ioredis": "4.28.5", - "uuid": "8.3.2" - }, + "peerDependencies": {}, "peerDependenciesMeta": { "ioredis": { "optional": true diff --git a/apps/payments/.eslintrc.json b/apps/payments/.eslintrc.json index 82a1ee90..61056da9 100644 --- a/apps/payments/.eslintrc.json +++ b/apps/payments/.eslintrc.json @@ -25,7 +25,7 @@ "checkMissingDependencies": true, "checkObsoleteDependencies": true, "checkVersionMismatches": true, - "includeTransitiveDependencies": false, + "includeTransitiveDependencies": true, "ignoredDependencies": ["@jest/globals", "@nestjs/testing"] } ] diff --git a/apps/payments/package.json b/apps/payments/package.json index 1885f51c..bd715b5c 100644 --- a/apps/payments/package.json +++ b/apps/payments/package.json @@ -7,7 +7,6 @@ "@fastify/helmet": "11.0.0", "@fastify/passport": "2.3.0", "@fastify/secure-session": "7.1.0", - "@fastify/static": "6.12.0", "@getlarge/keto-client-wrapper": "0.0.2", "@getlarge/keto-relations-parser": "0.0.2", "@getlarge/kratos-client-wrapper": "0.0.2", @@ -26,7 +25,6 @@ "@s1seven/nestjs-tools-amqp-transport": "0.5.1", "amqp-connection-manager": "4.1.14", "amqplib": "0.10.3", - "axios": "1.6.2", "class-transformer": "0.5.1", "class-validator": "0.13.2", "dotenv": "16.3.1", @@ -37,7 +35,6 @@ "mongoose-update-if-current": "1.4.0", "nestjs-keyset-paginator": "3.0.4", "nestjs-pino": "3.4.0", - "pino-http": "8.5.0", "reflect-metadata": "0.1.14", "rxjs": "7.8.1", "sodium-native": "4.0.4", @@ -45,10 +42,7 @@ "ts-mixer": "6.0.1", "webpack-node-externals": "3.0.0" }, - "peerDependencies": { - "ioredis": "4.28.5", - "uuid": "8.3.2" - }, + "peerDependencies": {}, "peerDependenciesMeta": { "ioredis": { "optional": true diff --git a/apps/permissions-manager/.eslintrc.json b/apps/permissions-manager/.eslintrc.json index 7eb065e0..256337ec 100644 --- a/apps/permissions-manager/.eslintrc.json +++ b/apps/permissions-manager/.eslintrc.json @@ -25,7 +25,7 @@ "checkMissingDependencies": true, "checkObsoleteDependencies": true, "checkVersionMismatches": true, - "includeTransitiveDependencies": false, + "includeTransitiveDependencies": true, "ignoredDependencies": ["@jest/globals", "@nestjs/testing"] } ] diff --git a/apps/tickets/.eslintrc.json b/apps/tickets/.eslintrc.json index 912dafd3..722563df 100644 --- a/apps/tickets/.eslintrc.json +++ b/apps/tickets/.eslintrc.json @@ -30,7 +30,7 @@ "checkMissingDependencies": true, "checkObsoleteDependencies": true, "checkVersionMismatches": true, - "includeTransitiveDependencies": false, + "includeTransitiveDependencies": true, "ignoredDependencies": ["@jest/globals", "@nestjs/testing"] } ] diff --git a/apps/tickets/package.json b/apps/tickets/package.json index 61330b8a..fe8f32c2 100644 --- a/apps/tickets/package.json +++ b/apps/tickets/package.json @@ -8,7 +8,6 @@ "@fastify/helmet": "11.0.0", "@fastify/passport": "2.3.0", "@fastify/secure-session": "7.1.0", - "@fastify/static": "6.12.0", "@getlarge/keto-client-wrapper": "0.0.2", "@getlarge/keto-relations-parser": "0.0.2", "@getlarge/kratos-client-wrapper": "0.0.2", @@ -27,7 +26,6 @@ "@s1seven/nestjs-tools-amqp-transport": "0.5.1", "amqp-connection-manager": "4.1.14", "amqplib": "0.10.3", - "axios": "1.6.2", "class-transformer": "0.5.1", "class-validator": "0.13.2", "dotenv": "16.3.1", @@ -38,17 +36,13 @@ "mongoose-update-if-current": "1.4.0", "nestjs-keyset-paginator": "3.0.4", "nestjs-pino": "3.4.0", - "pino-http": "8.5.0", "reflect-metadata": "0.1.14", "rxjs": "7.8.1", "sodium-native": "4.0.4", "ts-mixer": "6.0.1", "webpack-node-externals": "3.0.0" }, - "peerDependencies": { - "ioredis": "4.28.5", - "uuid": "8.3.2" - }, + "peerDependencies": {}, "peerDependenciesMeta": { "ioredis": { "optional": true From a4799fbb641d4997ff4dae44dd0258df427ee8d2 Mon Sep 17 00:00:00 2001 From: getlarge Date: Mon, 15 Jan 2024 19:11:36 +0100 Subject: [PATCH 14/14] chore: generate sorted projects list [skip ci] --- tools/nx/fast-lint.ts | 2 +- tools/nx/get-affected-projects-cli.ts | 2 +- tools/nx/get-affected-projects.ts | 2 +- tools/nx/get-dependencies.ts | 9 +++++---- tools/nx/get-projects-cli.ts | 7 ++++++- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/tools/nx/fast-lint.ts b/tools/nx/fast-lint.ts index e919a8ea..1456fda9 100644 --- a/tools/nx/fast-lint.ts +++ b/tools/nx/fast-lint.ts @@ -10,7 +10,7 @@ const getAffectedProjects = (projects = []) => { return projects; } const affectedLibs = execSync( - `npx nx print-affected --type=lib --select=projects --exclude=platform`, + `npx nx print-affected --type=lib --select=projects --exclude=workspace`, { encoding: 'utf8' } ); const affectedApps = execSync( diff --git a/tools/nx/get-affected-projects-cli.ts b/tools/nx/get-affected-projects-cli.ts index cef4384e..2a88b866 100644 --- a/tools/nx/get-affected-projects-cli.ts +++ b/tools/nx/get-affected-projects-cli.ts @@ -50,7 +50,7 @@ import { getAffectedProjects } from './get-affected-projects'; if (plain) { console.log(projects); } else { - console.log(JSON.stringify(projects.split(','))); + console.log(JSON.stringify(projects.split(',').sort())); } process.exit(0); } catch (error) { diff --git a/tools/nx/get-affected-projects.ts b/tools/nx/get-affected-projects.ts index 66595b7d..551f9240 100644 --- a/tools/nx/get-affected-projects.ts +++ b/tools/nx/get-affected-projects.ts @@ -18,7 +18,7 @@ export async function getAffectedProjects( throw new Error(`Supported project types are ${supportedProjectTypes}`); } const { stdout } = await execAsync( - `nx print-affected --type=${searchType} --select=projects --exclude=platform,tools --base=${base} --head=${head}`, + `nx print-affected --type=${searchType} --select=projects --exclude=workspace,tools --base=${base} --head=${head}`, ); return stdout; } diff --git a/tools/nx/get-dependencies.ts b/tools/nx/get-dependencies.ts index 9e1a4848..7bdc96bc 100644 --- a/tools/nx/get-dependencies.ts +++ b/tools/nx/get-dependencies.ts @@ -22,7 +22,8 @@ export async function getProjects(searchType = 'app'): Promise { const { type } = graph.nodes[name]; return type === searchType ? name : null; }) - .filter((e) => !!e && !excludedProjects.includes(e)); + .filter((e) => !!e && !excludedProjects.includes(e)) + .sort(); } export async function getProjectDependenciesFiles({ @@ -57,7 +58,7 @@ export async function getProjectDependenciesFiles({ deps.flatMap((c) => getOneDependency(c)); const libTargets: string[] = getAllDependencies( - getTargetDependencies(projectName) + getTargetDependencies(projectName), ).map(({ target }) => target); const libsDependencies = Array.from(new Set(libTargets)); @@ -73,13 +74,13 @@ export async function getProjectDependenciesFiles({ return files.filter( (file) => !exclude.some((val) => minimatch(file, val, { matchBase: true })) && - include.some((val) => minimatch(file, val, { matchBase: true })) + include.some((val) => minimatch(file, val, { matchBase: true })), ); }; const appDependenciesFiles = getFilesFromNode(getNode(projectName)); const libsDependenciesFiles = libsDependencies.flatMap((target) => - getFilesFromNode(getNode(target)) + getFilesFromNode(getNode(target)), ); const dependenciesFiles = [...appDependenciesFiles, ...libsDependenciesFiles]; diff --git a/tools/nx/get-projects-cli.ts b/tools/nx/get-projects-cli.ts index 977197ad..a5f3abf4 100644 --- a/tools/nx/get-projects-cli.ts +++ b/tools/nx/get-projects-cli.ts @@ -34,7 +34,12 @@ import { getProjects } from './get-dependencies'; const { plain, type } = argv; const projects = await getProjects(type); if (plain) { - console.log(projects.map((p) => p.trim()).join(',')); + console.log( + projects + .map((p) => p.trim()) + .sort() + .join(','), + ); } else { console.log(JSON.stringify(projects)); }