@revisium/core 2.1.0 → 2.2.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package.json +3 -1
- package/dist/src/__tests__/utils/queryTest.d.ts +1 -1
- package/dist/src/__tests__/utils/queryTest.js +1 -1
- package/dist/src/__tests__/utils/queryTest.js.map +1 -1
- package/dist/src/api/graphql-api/graphql-api.module.js +2 -0
- package/dist/src/api/graphql-api/graphql-api.module.js.map +1 -1
- package/dist/src/api/graphql-api/row/row.resolver.d.ts +9 -11
- package/dist/src/api/graphql-api/row/row.resolver.js +14 -16
- package/dist/src/api/graphql-api/row/row.resolver.js.map +1 -1
- package/dist/src/api/graphql-api/table/table.resolver.d.ts +5 -3
- package/dist/src/api/graphql-api/table/table.resolver.js +7 -6
- package/dist/src/api/graphql-api/table/table.resolver.js.map +1 -1
- package/dist/src/api/rest-api/rest-api.module.js +2 -0
- package/dist/src/api/rest-api/rest-api.module.js.map +1 -1
- package/dist/src/api/rest-api/row/row-by-id.controller.d.ts +5 -3
- package/dist/src/api/rest-api/row/row-by-id.controller.js +20 -10
- package/dist/src/api/rest-api/row/row-by-id.controller.js.map +1 -1
- package/dist/src/api/rest-api/share/model/order-by.model.d.ts +21 -1
- package/dist/src/api/rest-api/share/model/order-by.model.js +38 -1
- package/dist/src/api/rest-api/share/model/order-by.model.js.map +1 -1
- package/dist/src/api/rest-api/share/utils/mapToPrismaOrderBy.d.ts +2 -2
- package/dist/src/api/rest-api/share/utils/mapToPrismaOrderBy.js +15 -3
- package/dist/src/api/rest-api/share/utils/mapToPrismaOrderBy.js.map +1 -1
- package/dist/src/api/rest-api/share/validators/is-valid-data-field-order.validator.d.ts +2 -0
- package/dist/src/api/rest-api/share/validators/is-valid-data-field-order.validator.js +30 -0
- package/dist/src/api/rest-api/share/validators/is-valid-data-field-order.validator.js.map +1 -0
- package/dist/src/api/rest-api/table/dto/get-table-rows.dto.js +4 -0
- package/dist/src/api/rest-api/table/dto/get-table-rows.dto.js.map +1 -1
- package/dist/src/api/rest-api/table/table-by-id.controller.d.ts +3 -1
- package/dist/src/api/rest-api/table/table-by-id.controller.js +7 -7
- package/dist/src/api/rest-api/table/table-by-id.controller.js.map +1 -1
- package/dist/src/features/draft/commands/handlers/__tests__/utils.js +6 -4
- package/dist/src/features/draft/commands/handlers/__tests__/utils.js.map +1 -1
- package/dist/src/features/draft/commands/handlers/api-base-row.handler.d.ts +4 -3
- package/dist/src/features/draft/commands/handlers/api-base-row.handler.js +4 -4
- package/dist/src/features/draft/commands/handlers/api-base-row.handler.js.map +1 -1
- package/dist/src/features/draft/commands/handlers/api-create-revision.handler.js +1 -1
- package/dist/src/features/draft/commands/handlers/api-create-revision.handler.js.map +1 -1
- package/dist/src/features/draft/commands/handlers/api-create-row.handler.d.ts +3 -1
- package/dist/src/features/draft/commands/handlers/api-create-row.handler.js +6 -3
- package/dist/src/features/draft/commands/handlers/api-create-row.handler.js.map +1 -1
- package/dist/src/features/draft/commands/handlers/api-patch-row.handler.d.ts +3 -1
- package/dist/src/features/draft/commands/handlers/api-patch-row.handler.js +6 -3
- package/dist/src/features/draft/commands/handlers/api-patch-row.handler.js.map +1 -1
- package/dist/src/features/draft/commands/handlers/api-rename-row.handler.d.ts +3 -1
- package/dist/src/features/draft/commands/handlers/api-rename-row.handler.js +6 -3
- package/dist/src/features/draft/commands/handlers/api-rename-row.handler.js.map +1 -1
- package/dist/src/features/draft/commands/handlers/api-update-row.handler.d.ts +3 -1
- package/dist/src/features/draft/commands/handlers/api-update-row.handler.js +6 -3
- package/dist/src/features/draft/commands/handlers/api-update-row.handler.js.map +1 -1
- package/dist/src/features/draft/commands/handlers/api-upload-file.handler.d.ts +3 -1
- package/dist/src/features/draft/commands/handlers/api-upload-file.handler.js +6 -3
- package/dist/src/features/draft/commands/handlers/api-upload-file.handler.js.map +1 -1
- package/dist/src/features/draft/commands/impl/api-patch-row.command.d.ts +2 -2
- package/dist/src/features/draft/commands/impl/api-rename-row.command.d.ts +2 -2
- package/dist/src/features/draft/commands/impl/api-upload-file.command.d.ts +2 -2
- package/dist/src/features/draft/commands/types/api-create-row.handler.types.d.ts +2 -2
- package/dist/src/features/draft/commands/types/api-update-row.handler.types.d.ts +2 -2
- package/dist/src/features/draft/draft.module.js +2 -0
- package/dist/src/features/draft/draft.module.js.map +1 -1
- package/dist/src/features/endpoint/commands/handlers/create-endpoint.handler.d.ts +2 -2
- package/dist/src/features/endpoint/commands/handlers/create-endpoint.handler.js +2 -2
- package/dist/src/features/endpoint/commands/handlers/create-endpoint.handler.js.map +1 -1
- package/dist/src/features/endpoint/commands/handlers/delete-endpoint.handler.js +1 -1
- package/dist/src/features/endpoint/commands/handlers/delete-endpoint.handler.js.map +1 -1
- package/dist/src/features/endpoint/commands/impl/create-endpoint.command.d.ts +2 -0
- package/dist/src/features/plugin/file/utils/validate-file-data-for-restore.js +1 -1
- package/dist/src/features/plugin/file/utils/validate-file-data-for-restore.js.map +1 -1
- package/dist/src/features/project/commands/handlers/delete-project.handler.js +3 -3
- package/dist/src/features/project/commands/handlers/delete-project.handler.js.map +1 -1
- package/dist/src/features/row/queries/handlers/get-row-by-id.handler.d.ts +2 -3
- package/dist/src/features/row/queries/handlers/get-row-by-id.handler.js.map +1 -1
- package/dist/src/features/row/queries/handlers/get-row.handler.d.ts +3 -4
- package/dist/src/features/row/queries/handlers/get-row.handler.js.map +1 -1
- package/dist/src/features/row/queries/handlers/get-rows.handler.d.ts +21 -5
- package/dist/src/features/row/queries/handlers/get-rows.handler.js +23 -20
- package/dist/src/features/row/queries/handlers/get-rows.handler.js.map +1 -1
- package/dist/src/features/row/queries/handlers/resolve-row-count-foreign-keys-by.handler.d.ts +3 -4
- package/dist/src/features/row/queries/handlers/resolve-row-count-foreign-keys-by.handler.js +2 -2
- package/dist/src/features/row/queries/handlers/resolve-row-count-foreign-keys-by.handler.js.map +1 -1
- package/dist/src/features/row/queries/handlers/resolve-row-count-foreign-keys-to.handler.d.ts +2 -2
- package/dist/src/features/row/queries/handlers/resolve-row-count-foreign-keys-to.handler.js.map +1 -1
- package/dist/src/features/row/queries/handlers/resolve-row-foreign-keys-by.handler.d.ts +1 -2
- package/dist/src/features/row/queries/handlers/resolve-row-foreign-keys-by.handler.js.map +1 -1
- package/dist/src/features/row/queries/handlers/resolve-row-foreign-keys-to.handler.d.ts +1 -2
- package/dist/src/features/row/queries/handlers/resolve-row-foreign-keys-to.handler.js.map +1 -1
- package/dist/src/features/row/queries/impl/get-row-by-id.query.d.ts +3 -0
- package/dist/src/features/row/queries/impl/get-row-by-id.query.js.map +1 -1
- package/dist/src/features/row/queries/impl/get-row.query.d.ts +3 -0
- package/dist/src/features/row/queries/impl/get-row.query.js.map +1 -1
- package/dist/src/features/row/queries/impl/get-rows.query.d.ts +15 -2
- package/dist/src/features/row/queries/impl/get-rows.query.js.map +1 -1
- package/dist/src/features/row/queries/impl/resolve-row-count-foreign-keys-by.query.d.ts +2 -0
- package/dist/src/features/row/queries/impl/resolve-row-count-foreign-keys-to.query.d.ts +2 -0
- package/dist/src/features/row/queries/impl/resolve-row-foreign-keys-by.query.d.ts +4 -0
- package/dist/src/features/row/queries/impl/resolve-row-foreign-keys-by.query.js.map +1 -1
- package/dist/src/features/row/queries/impl/resolve-row-foreign-keys-to.query.d.ts +4 -0
- package/dist/src/features/row/queries/impl/resolve-row-foreign-keys-to.query.js.map +1 -1
- package/dist/src/features/row/row-api.service.d.ts +13 -0
- package/dist/src/features/row/row-api.service.js +47 -0
- package/dist/src/features/row/row-api.service.js.map +1 -0
- package/dist/src/features/row/row.module.js +3 -1
- package/dist/src/features/row/row.module.js.map +1 -1
- package/dist/src/features/share/commands/handlers/notify-endpoints.handler.js +1 -1
- package/dist/src/features/share/commands/handlers/notify-endpoints.handler.js.map +1 -1
- package/dist/src/features/share/foreign-keys.service.d.ts +7 -4
- package/dist/src/features/share/foreign-keys.service.js +77 -38
- package/dist/src/features/share/foreign-keys.service.js.map +1 -1
- package/dist/src/features/share/queries/handlers/transactional/find-table-in-revision-or-throw.handler.d.ts +1 -1
- package/dist/src/features/share/queries/handlers/transactional/find-table-in-revision-or-throw.handler.js +3 -3
- package/dist/src/features/share/queries/handlers/transactional/find-table-in-revision-or-throw.handler.js.map +1 -1
- package/dist/src/features/table/queries/handlers/index.d.ts +1 -2
- package/dist/src/features/table/queries/handlers/index.js +0 -2
- package/dist/src/features/table/queries/handlers/index.js.map +1 -1
- package/dist/src/infrastructure/database/database.module.js +3 -0
- package/dist/src/infrastructure/database/database.module.js.map +1 -1
- package/dist/src/infrastructure/database/postgresql-notification.service.d.ts +7 -0
- package/dist/src/infrastructure/database/postgresql-notification.service.js +33 -0
- package/dist/src/infrastructure/database/postgresql-notification.service.js.map +1 -0
- package/dist/src/infrastructure/database/transaction-prisma.service.d.ts +1 -0
- package/dist/src/infrastructure/database/transaction-prisma.service.js +3 -0
- package/dist/src/infrastructure/database/transaction-prisma.service.js.map +1 -1
- package/dist/src/infrastructure/notification/endpoint-notification.service.d.ts +7 -7
- package/dist/src/infrastructure/notification/endpoint-notification.service.js +15 -15
- package/dist/src/infrastructure/notification/endpoint-notification.service.js.map +1 -1
- package/dist/src/infrastructure/notification/notification.module.js +2 -1
- package/dist/src/infrastructure/notification/notification.module.js.map +1 -1
- package/dist/src/utils/prisma-sql-generator/__tests__/shared-helpers.d.ts +16 -0
- package/dist/src/utils/prisma-sql-generator/__tests__/shared-helpers.js +70 -0
- package/dist/src/utils/prisma-sql-generator/__tests__/shared-helpers.js.map +1 -0
- package/dist/src/utils/prisma-sql-generator/__tests__/test-helpers.d.ts +52 -0
- package/dist/src/utils/prisma-sql-generator/__tests__/test-helpers.js +531 -0
- package/dist/src/utils/prisma-sql-generator/__tests__/test-helpers.js.map +1 -0
- package/dist/src/utils/prisma-sql-generator/index.d.ts +2 -0
- package/dist/src/{features/row/queries/types → utils/prisma-sql-generator}/index.js +5 -5
- package/dist/src/utils/prisma-sql-generator/index.js.map +1 -0
- package/dist/src/utils/prisma-sql-generator/json-path.d.ts +14 -0
- package/dist/src/utils/prisma-sql-generator/json-path.js +121 -0
- package/dist/src/utils/prisma-sql-generator/json-path.js.map +1 -0
- package/dist/src/utils/prisma-sql-generator/types.d.ts +105 -0
- package/dist/src/{features/row/queries/types/get-row.types.js → utils/prisma-sql-generator/types.js} +1 -1
- package/dist/src/utils/prisma-sql-generator/types.js.map +1 -0
- package/dist/src/utils/prisma-sql-generator/where-generator.prisma.d.ts +21 -0
- package/dist/src/utils/prisma-sql-generator/where-generator.prisma.js +499 -0
- package/dist/src/utils/prisma-sql-generator/where-generator.prisma.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +3 -1
- package/dist/src/__tests__/utils/createMocks.d.ts +0 -19
- package/dist/src/__tests__/utils/createMocks.js +0 -30
- package/dist/src/__tests__/utils/createMocks.js.map +0 -1
- package/dist/src/features/row/queries/types/get-row-by-id.types.d.ts +0 -2
- package/dist/src/features/row/queries/types/get-row-by-id.types.js +0 -3
- package/dist/src/features/row/queries/types/get-row-by-id.types.js.map +0 -1
- package/dist/src/features/row/queries/types/get-row.types.d.ts +0 -2
- package/dist/src/features/row/queries/types/get-row.types.js.map +0 -1
- package/dist/src/features/row/queries/types/get-rows.types.d.ts +0 -3
- package/dist/src/features/row/queries/types/get-rows.types.js +0 -3
- package/dist/src/features/row/queries/types/get-rows.types.js.map +0 -1
- package/dist/src/features/row/queries/types/index.d.ts +0 -5
- package/dist/src/features/row/queries/types/index.js.map +0 -1
- package/dist/src/features/row/queries/types/resolve-row-foreign-keys-by.types.d.ts +0 -3
- package/dist/src/features/row/queries/types/resolve-row-foreign-keys-by.types.js +0 -3
- package/dist/src/features/row/queries/types/resolve-row-foreign-keys-by.types.js.map +0 -1
- package/dist/src/features/row/queries/types/resolve-row-foreign-keys-to.types.d.ts +0 -3
- package/dist/src/features/row/queries/types/resolve-row-foreign-keys-to.types.js +0 -3
- package/dist/src/features/row/queries/types/resolve-row-foreign-keys-to.types.js.map +0 -1
- package/dist/src/features/table/queries/handlers/get-rows-by-table.handler.d.ts +0 -30
- package/dist/src/features/table/queries/handlers/get-rows-by-table.handler.js +0 -70
- package/dist/src/features/table/queries/handlers/get-rows-by-table.handler.js.map +0 -1
- package/dist/src/features/table/queries/impl/get-rows-by-table.query.d.ts +0 -21
- package/dist/src/features/table/queries/impl/get-rows-by-table.query.js +0 -10
- package/dist/src/features/table/queries/impl/get-rows-by-table.query.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgresql-notification.service.js","sourceRoot":"","sources":["../../../../src/infrastructure/database/postgresql-notification.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAE5C,qDAA2E;AAGpE,IAAM,6BAA6B,GAAnC,MAAM,6BAA6B;IACxC,YAA6B,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;IAAG,CAAC;IAE7D,KAAK,CAAC,MAAM,CAAC,YAAoB,EAAE,OAAyB;QAC1D,MAAM,IAAI,CAAC,aAAa,CAAC,WAAW,CAAA;;UAE9B,YAAY;UACZ,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;;KAE5B,CAAC;IACJ,CAAC;CACF,CAAA;AAXY,sEAA6B;wCAA7B,6BAA6B;IADzC,IAAA,mBAAU,GAAE;qCAEiC,8BAAa;GAD9C,6BAA6B,CAWzC"}
|
|
@@ -7,6 +7,7 @@ export declare class TransactionPrismaService {
|
|
|
7
7
|
constructor(prismaService: PrismaService);
|
|
8
8
|
getTransaction(): TransactionPrismaClient;
|
|
9
9
|
getTransactionUnsafe(): TransactionPrismaClient | undefined;
|
|
10
|
+
getTransactionOrPrisma(): TransactionPrismaClient;
|
|
10
11
|
run<T>(handler: (...rest: unknown[]) => Promise<T>, options?: {
|
|
11
12
|
maxWait?: number;
|
|
12
13
|
timeout?: number;
|
|
@@ -29,6 +29,9 @@ let TransactionPrismaService = class TransactionPrismaService {
|
|
|
29
29
|
const transactionInCurrentContext = this.asyncLocalStorage.getStore();
|
|
30
30
|
return transactionInCurrentContext?.$prisma;
|
|
31
31
|
}
|
|
32
|
+
getTransactionOrPrisma() {
|
|
33
|
+
return this.getTransactionUnsafe() ?? this.prismaService;
|
|
34
|
+
}
|
|
32
35
|
run(handler, options) {
|
|
33
36
|
return this.prismaService.$transaction(async ($prisma) => {
|
|
34
37
|
return this.asyncLocalStorage.run({ $prisma }, handler);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-prisma.service.js","sourceRoot":"","sources":["../../../../src/infrastructure/database/transaction-prisma.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA0E;AAE1E,6CAAgD;AAChD,qDAA2E;AAIpE,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAKnC,YAA6B,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;QAJxC,sBAAiB,GAAG,IAAI,+BAAiB,EAEtD,CAAC;IAEuD,CAAC;IAEtD,cAAc;QACnB,MAAM,2BAA2B,GAAG,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC;QAEtE,IAAI,CAAC,2BAA2B,EAAE,OAAO,EAAE,CAAC;YAC1C,MAAM,IAAI,qCAA4B,CACpC,kKAAkK,CACnK,CAAC;QACJ,CAAC;QAED,OAAO,2BAA2B,CAAC,OAAO,CAAC;IAC7C,CAAC;IAEM,oBAAoB;QACzB,MAAM,2BAA2B,GAAG,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC;QAEtE,OAAO,2BAA2B,EAAE,OAAO,CAAC;IAC9C,CAAC;IAEM,GAAG,CACR,OAA2C,EAC3C,OAIC;QAED,OAAO,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YACvD,OAAO,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;QAC1D,CAAC,EAAE,OAAO,CAAC,CAAC;IACd,CAAC;CACF,CAAA;
|
|
1
|
+
{"version":3,"file":"transaction-prisma.service.js","sourceRoot":"","sources":["../../../../src/infrastructure/database/transaction-prisma.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA0E;AAE1E,6CAAgD;AAChD,qDAA2E;AAIpE,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAKnC,YAA6B,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;QAJxC,sBAAiB,GAAG,IAAI,+BAAiB,EAEtD,CAAC;IAEuD,CAAC;IAEtD,cAAc;QACnB,MAAM,2BAA2B,GAAG,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC;QAEtE,IAAI,CAAC,2BAA2B,EAAE,OAAO,EAAE,CAAC;YAC1C,MAAM,IAAI,qCAA4B,CACpC,kKAAkK,CACnK,CAAC;QACJ,CAAC;QAED,OAAO,2BAA2B,CAAC,OAAO,CAAC;IAC7C,CAAC;IAEM,oBAAoB;QACzB,MAAM,2BAA2B,GAAG,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC;QAEtE,OAAO,2BAA2B,EAAE,OAAO,CAAC;IAC9C,CAAC;IAEM,sBAAsB;QAC3B,OAAO,IAAI,CAAC,oBAAoB,EAAE,IAAI,IAAI,CAAC,aAAa,CAAC;IAC3D,CAAC;IAEM,GAAG,CACR,OAA2C,EAC3C,OAIC;QAED,OAAO,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YACvD,OAAO,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;QAC1D,CAAC,EAAE,OAAO,CAAC,CAAC;IACd,CAAC;CACF,CAAA;AAzCY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,mBAAU,GAAE;qCAMiC,8BAAa;GAL9C,wBAAwB,CAyCpC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { NotificationClient } from '../../infrastructure/notification/notification-client.interface';
|
|
1
|
+
import { PostgresqlNotificationService } from '../../infrastructure/database/postgresql-notification.service';
|
|
3
2
|
export declare class EndpointNotificationService {
|
|
4
|
-
private readonly
|
|
3
|
+
private readonly postgresqlNotificationService;
|
|
5
4
|
private readonly logger;
|
|
6
|
-
constructor(
|
|
7
|
-
create(endpointId: string): void
|
|
8
|
-
update(endpointId: string): void
|
|
9
|
-
delete(endpointId: string
|
|
5
|
+
constructor(postgresqlNotificationService: PostgresqlNotificationService);
|
|
6
|
+
create(endpointId: string): Promise<void>;
|
|
7
|
+
update(endpointId: string): Promise<void>;
|
|
8
|
+
delete(endpointId: string): Promise<void>;
|
|
9
|
+
private postgresqlNotification;
|
|
10
10
|
}
|
|
@@ -8,38 +8,38 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
11
|
var EndpointNotificationService_1;
|
|
15
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
13
|
exports.EndpointNotificationService = void 0;
|
|
17
14
|
const common_1 = require("@nestjs/common");
|
|
15
|
+
const postgresql_notification_service_1 = require("../database/postgresql-notification.service");
|
|
18
16
|
let EndpointNotificationService = EndpointNotificationService_1 = class EndpointNotificationService {
|
|
19
|
-
constructor(
|
|
20
|
-
this.
|
|
17
|
+
constructor(postgresqlNotificationService) {
|
|
18
|
+
this.postgresqlNotificationService = postgresqlNotificationService;
|
|
21
19
|
this.logger = new common_1.Logger(EndpointNotificationService_1.name);
|
|
22
20
|
}
|
|
23
|
-
create(endpointId) {
|
|
21
|
+
async create(endpointId) {
|
|
24
22
|
this.logger.log(`endpoint_created id=${endpointId}`);
|
|
25
|
-
this.
|
|
23
|
+
await this.postgresqlNotification('created', endpointId);
|
|
26
24
|
}
|
|
27
|
-
update(endpointId) {
|
|
25
|
+
async update(endpointId) {
|
|
28
26
|
this.logger.log(`endpoint_updated id=${endpointId}`);
|
|
29
|
-
this.
|
|
27
|
+
await this.postgresqlNotification('updated', endpointId);
|
|
28
|
+
}
|
|
29
|
+
async delete(endpointId) {
|
|
30
|
+
this.logger.log(`endpoint_deleted id=${endpointId}`);
|
|
31
|
+
await this.postgresqlNotification('deleted', endpointId);
|
|
30
32
|
}
|
|
31
|
-
|
|
32
|
-
this.
|
|
33
|
-
|
|
33
|
+
postgresqlNotification(action, endpointId) {
|
|
34
|
+
return this.postgresqlNotificationService.notify('endpoint_changes', {
|
|
35
|
+
action,
|
|
34
36
|
endpointId,
|
|
35
|
-
endpointType,
|
|
36
37
|
});
|
|
37
38
|
}
|
|
38
39
|
};
|
|
39
40
|
exports.EndpointNotificationService = EndpointNotificationService;
|
|
40
41
|
exports.EndpointNotificationService = EndpointNotificationService = EndpointNotificationService_1 = __decorate([
|
|
41
42
|
(0, common_1.Injectable)(),
|
|
42
|
-
|
|
43
|
-
__metadata("design:paramtypes", [Object])
|
|
43
|
+
__metadata("design:paramtypes", [postgresql_notification_service_1.PostgresqlNotificationService])
|
|
44
44
|
], EndpointNotificationService);
|
|
45
45
|
//# sourceMappingURL=endpoint-notification.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-notification.service.js","sourceRoot":"","sources":["../../../../src/infrastructure/notification/endpoint-notification.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"endpoint-notification.service.js","sourceRoot":"","sources":["../../../../src/infrastructure/notification/endpoint-notification.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,iGAA4G;AAGrG,IAAM,2BAA2B,mCAAjC,MAAM,2BAA2B;IAGtC,YACmB,6BAA4D;QAA5D,kCAA6B,GAA7B,6BAA6B,CAA+B;QAH9D,WAAM,GAAG,IAAI,eAAM,CAAC,6BAA2B,CAAC,IAAI,CAAC,CAAC;IAIpE,CAAC;IAEG,KAAK,CAAC,MAAM,CAAC,UAAkB;QACpC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,uBAAuB,UAAU,EAAE,CAAC,CAAC;QACrD,MAAM,IAAI,CAAC,sBAAsB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IAC3D,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,UAAkB;QACpC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,uBAAuB,UAAU,EAAE,CAAC,CAAC;QACrD,MAAM,IAAI,CAAC,sBAAsB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IAC3D,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,UAAkB;QACpC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,uBAAuB,UAAU,EAAE,CAAC,CAAC;QACrD,MAAM,IAAI,CAAC,sBAAsB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IAC3D,CAAC;IAEO,sBAAsB,CAAC,MAAc,EAAE,UAAkB;QAC/D,OAAO,IAAI,CAAC,6BAA6B,CAAC,MAAM,CAAC,kBAAkB,EAAE;YACnE,MAAM;YACN,UAAU;SACX,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AA5BY,kEAA2B;sCAA3B,2BAA2B;IADvC,IAAA,mBAAU,GAAE;qCAKuC,+DAA6B;GAJpE,2BAA2B,CA4BvC"}
|
|
@@ -12,6 +12,7 @@ const config_1 = require("@nestjs/config");
|
|
|
12
12
|
const event_emitter_1 = require("@nestjs/event-emitter");
|
|
13
13
|
const microservices_1 = require("@nestjs/microservices");
|
|
14
14
|
const app_mode_1 = require("../../app-mode");
|
|
15
|
+
const database_module_1 = require("../database/database.module");
|
|
15
16
|
const endpoint_notification_service_1 = require("./endpoint-notification.service");
|
|
16
17
|
const in_memory_notification_client_1 = require("./in-memory-notification-client");
|
|
17
18
|
const redis_notification_client_1 = require("./redis-notification-client");
|
|
@@ -20,7 +21,7 @@ let NotificationModule = class NotificationModule {
|
|
|
20
21
|
exports.NotificationModule = NotificationModule;
|
|
21
22
|
exports.NotificationModule = NotificationModule = __decorate([
|
|
22
23
|
(0, common_1.Module)({
|
|
23
|
-
imports: [config_1.ConfigModule, event_emitter_1.EventEmitterModule.forRoot()],
|
|
24
|
+
imports: [config_1.ConfigModule, database_module_1.DatabaseModule, event_emitter_1.EventEmitterModule.forRoot()],
|
|
24
25
|
providers: [
|
|
25
26
|
{
|
|
26
27
|
provide: 'ENDPOINT_MICROSERVICE',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.module.js","sourceRoot":"","sources":["../../../../src/infrastructure/notification/notification.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,2CAA6D;AAC7D,yDAA0E;AAC1E,yDAAsE;AACtE,6CAA6D;AAC7D,mFAA4G;AAC5G,mFAA2G;AAC3G,2EAAoG;AAmC7F,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;CAAG,CAAA;AAArB,gDAAkB;6BAAlB,kBAAkB;IAjC9B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,qBAAY,EAAE,kCAAkB,CAAC,OAAO,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"notification.module.js","sourceRoot":"","sources":["../../../../src/infrastructure/notification/notification.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,2CAA6D;AAC7D,yDAA0E;AAC1E,yDAAsE;AACtE,6CAA6D;AAC7D,iEAA6E;AAC7E,mFAA4G;AAC5G,mFAA2G;AAC3G,2EAAoG;AAmC7F,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;CAAG,CAAA;AAArB,gDAAkB;6BAAlB,kBAAkB;IAjC9B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,qBAAY,EAAE,gCAAc,EAAE,kCAAkB,CAAC,OAAO,EAAE,CAAC;QACrE,SAAS,EAAE;YACT;gBACE,OAAO,EAAE,uBAAuB;gBAChC,UAAU,EAAE,KAAK,EACf,aAA4B,EAC5B,OAAsB,EACtB,UAAsB,EACtB,EAAE;oBACF,IAAI,UAAU,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;wBACnC,OAAO,IAAI,0DAA0B,CAAC,OAAO,CAAC,CAAC;oBACjD,CAAC;oBAED,MAAM,IAAI,GAAG,aAAa,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;oBACvD,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,EAAE,CAAC,CAAC;oBAErE,MAAM,MAAM,GAAG,kCAAkB,CAAC,MAAM,CAAC;wBACvC,SAAS,EAAE,yBAAS,CAAC,KAAK;wBAC1B,OAAO,EAAE;4BACP,IAAI;4BACJ,IAAI;yBACL;qBACF,CAAC,CAAC;oBAEH,OAAO,IAAI,mDAAuB,CAAC,MAAM,CAAC,CAAC;gBAC7C,CAAC;gBACD,MAAM,EAAE,CAAC,sBAAa,EAAE,6BAAa,EAAE,4BAAiB,CAAC;aAC1D;YACD,2DAA2B;SAC5B;QACD,OAAO,EAAE,CAAC,2DAA2B,CAAC;KACvC,CAAC;GACW,kBAAkB,CAAG"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Prisma } from '@prisma/client';
|
|
2
|
+
export declare function runPrismaOrmRows(prisma: any, { tableVersionId, where, orderBy, take, skip, }: {
|
|
3
|
+
tableVersionId: string;
|
|
4
|
+
where?: any;
|
|
5
|
+
orderBy?: any;
|
|
6
|
+
take?: number;
|
|
7
|
+
skip?: number;
|
|
8
|
+
}): Promise<any>;
|
|
9
|
+
export declare function runViaPrismaRaw(prisma: any, sqlNode: Prisma.Sql): Promise<any[]>;
|
|
10
|
+
export declare function compareByIds(prismaRows: any[], rawRows: any[]): void;
|
|
11
|
+
export declare function compareExactly(prismaRows: any[], rawRows: any[]): void;
|
|
12
|
+
export declare function validateSqlStructure(query: Prisma.Sql): {
|
|
13
|
+
sql: string;
|
|
14
|
+
params: unknown[];
|
|
15
|
+
};
|
|
16
|
+
export declare function testPagination(prisma: any, tableVersionId: string, generator: any, options: any): Promise<void>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runPrismaOrmRows = runPrismaOrmRows;
|
|
4
|
+
exports.runViaPrismaRaw = runViaPrismaRaw;
|
|
5
|
+
exports.compareByIds = compareByIds;
|
|
6
|
+
exports.compareExactly = compareExactly;
|
|
7
|
+
exports.validateSqlStructure = validateSqlStructure;
|
|
8
|
+
exports.testPagination = testPagination;
|
|
9
|
+
async function runPrismaOrmRows(prisma, { tableVersionId, where, orderBy, take = 50, skip = 0, }) {
|
|
10
|
+
return prisma.table
|
|
11
|
+
.findUniqueOrThrow({ where: { versionId: tableVersionId } })
|
|
12
|
+
.rows({ take, skip, orderBy, where });
|
|
13
|
+
}
|
|
14
|
+
async function runViaPrismaRaw(prisma, sqlNode) {
|
|
15
|
+
return prisma.$queryRaw(sqlNode);
|
|
16
|
+
}
|
|
17
|
+
function compareByIds(prismaRows, rawRows) {
|
|
18
|
+
expect(rawRows.length).toBe(prismaRows.length);
|
|
19
|
+
if (!rawRows.length)
|
|
20
|
+
return;
|
|
21
|
+
const prismaIds = prismaRows
|
|
22
|
+
.map((r) => r.id)
|
|
23
|
+
.slice()
|
|
24
|
+
.sort();
|
|
25
|
+
const rawIds = rawRows
|
|
26
|
+
.map((r) => r.id)
|
|
27
|
+
.slice()
|
|
28
|
+
.sort();
|
|
29
|
+
expect(rawIds).toEqual(prismaIds);
|
|
30
|
+
}
|
|
31
|
+
function compareExactly(prismaRows, rawRows) {
|
|
32
|
+
expect(rawRows.length).toBe(prismaRows.length);
|
|
33
|
+
if (!rawRows.length)
|
|
34
|
+
return;
|
|
35
|
+
const prismaIds = prismaRows.map((r) => r.id);
|
|
36
|
+
const rawIds = rawRows.map((r) => r.id);
|
|
37
|
+
expect(rawIds).toEqual(prismaIds);
|
|
38
|
+
}
|
|
39
|
+
function validateSqlStructure(query) {
|
|
40
|
+
const sql = query.inspect().sql;
|
|
41
|
+
expect(sql).toContain('SELECT');
|
|
42
|
+
expect(sql).toContain('FROM "Row" r');
|
|
43
|
+
expect(sql).toContain('INNER JOIN "_RowToTable" rt');
|
|
44
|
+
expect(sql).toContain('WHERE rt."B" =');
|
|
45
|
+
expect(sql).toContain('ORDER BY');
|
|
46
|
+
expect(sql).toContain('LIMIT');
|
|
47
|
+
expect(sql).toContain('OFFSET');
|
|
48
|
+
const params = query.inspect().values;
|
|
49
|
+
expect(Array.isArray(params)).toBe(true);
|
|
50
|
+
return { sql, params };
|
|
51
|
+
}
|
|
52
|
+
async function testPagination(prisma, tableVersionId, generator, options) {
|
|
53
|
+
const scenarios = [
|
|
54
|
+
{ take: 5, skip: 0 },
|
|
55
|
+
{ take: 5, skip: 5 },
|
|
56
|
+
{ take: 10, skip: 0 },
|
|
57
|
+
{ take: 50, skip: 0 },
|
|
58
|
+
];
|
|
59
|
+
for (const scenario of scenarios) {
|
|
60
|
+
const testOptions = { ...options, ...scenario };
|
|
61
|
+
const prismaResult = await runPrismaOrmRows(prisma, {
|
|
62
|
+
tableVersionId,
|
|
63
|
+
...testOptions,
|
|
64
|
+
});
|
|
65
|
+
const query = generator.generateGetRowsQueryPrisma(tableVersionId, testOptions);
|
|
66
|
+
const rawResult = await runViaPrismaRaw(prisma, query);
|
|
67
|
+
compareByIds(prismaResult, rawResult);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=shared-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-helpers.js","sourceRoot":"","sources":["../../../../../src/utils/prisma-sql-generator/__tests__/shared-helpers.ts"],"names":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,SAAS,GAAG;QAChB,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE;QACpB,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE;QACpB,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;QACrB,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;KACtB,CAAC;IAEF,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,MAAM,WAAW,GAAG,EAAE,GAAG,OAAO,EAAE,GAAG,QAAQ,EAAE,CAAC;QAEhD,MAAM,YAAY,GAAG,MAAM,gBAAgB,CAAC,MAAM,EAAE;YAClD,cAAc;YACd,GAAG,WAAW;SACf,CAAC,CAAC;QAEH,MAAM,KAAK,GAAG,SAAS,CAAC,0BAA0B,CAChD,cAAc,EACd,WAAW,CACZ,CAAC;QACF,MAAM,SAAS,GAAG,MAAM,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAEvD,YAAY,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IACxC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { PrismaService } from '../../../infrastructure/database/prisma.service';
|
|
2
|
+
export interface TestRow {
|
|
3
|
+
id: string;
|
|
4
|
+
data?: any;
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}
|
|
7
|
+
export declare function createTableWithJsonData(prismaService: PrismaService): Promise<{
|
|
8
|
+
table: {
|
|
9
|
+
id: string;
|
|
10
|
+
createdId: string;
|
|
11
|
+
createdAt: Date;
|
|
12
|
+
versionId: string;
|
|
13
|
+
readonly: boolean;
|
|
14
|
+
updatedAt: Date;
|
|
15
|
+
system: boolean;
|
|
16
|
+
};
|
|
17
|
+
}>;
|
|
18
|
+
export declare function createTableWithStringData(prismaService: PrismaService): Promise<{
|
|
19
|
+
table: {
|
|
20
|
+
id: string;
|
|
21
|
+
createdId: string;
|
|
22
|
+
createdAt: Date;
|
|
23
|
+
versionId: string;
|
|
24
|
+
readonly: boolean;
|
|
25
|
+
updatedAt: Date;
|
|
26
|
+
system: boolean;
|
|
27
|
+
};
|
|
28
|
+
}>;
|
|
29
|
+
export declare function createTableWithDateData(prismaService: PrismaService): Promise<{
|
|
30
|
+
table: {
|
|
31
|
+
id: string;
|
|
32
|
+
createdId: string;
|
|
33
|
+
createdAt: Date;
|
|
34
|
+
versionId: string;
|
|
35
|
+
readonly: boolean;
|
|
36
|
+
updatedAt: Date;
|
|
37
|
+
system: boolean;
|
|
38
|
+
};
|
|
39
|
+
baseDate: Date;
|
|
40
|
+
dates: Date[];
|
|
41
|
+
}>;
|
|
42
|
+
export declare function createTableWithComplexJsonData(prismaService: PrismaService): Promise<{
|
|
43
|
+
table: {
|
|
44
|
+
id: string;
|
|
45
|
+
createdId: string;
|
|
46
|
+
createdAt: Date;
|
|
47
|
+
versionId: string;
|
|
48
|
+
readonly: boolean;
|
|
49
|
+
updatedAt: Date;
|
|
50
|
+
system: boolean;
|
|
51
|
+
};
|
|
52
|
+
}>;
|