mongodb-dynamic-api 4.9.0 → 4.10.0
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/CHANGELOG.md +12 -0
- package/package.json +1 -1
- package/src/dynamic-api.module.d.ts +1 -1
- package/src/dynamic-api.module.js +14 -1
- package/src/dynamic-api.module.js.map +1 -1
- package/src/helpers/route-description.helper.js +2 -0
- package/src/helpers/route-description.helper.js.map +1 -1
- package/src/interfaces/dynamic-api-custom-route.interface.d.ts +34 -0
- package/src/interfaces/dynamic-api-custom-route.interface.js +3 -0
- package/src/interfaces/dynamic-api-custom-route.interface.js.map +1 -0
- package/src/interfaces/dynamic-api-options.interface.d.ts +2 -0
- package/src/interfaces/dynamic-api-options.interface.js.map +1 -1
- package/src/interfaces/dynamic-api-route-type.type.d.ts +1 -1
- package/src/interfaces/index.d.ts +1 -0
- package/src/interfaces/index.js +1 -0
- package/src/interfaces/index.js.map +1 -1
- package/src/routes/custom/create-custom-route-controller.d.ts +7 -0
- package/src/routes/custom/create-custom-route-controller.js +133 -0
- package/src/routes/custom/create-custom-route-controller.js.map +1 -0
- package/src/routes/custom/create-custom-route-gateway.d.ts +6 -0
- package/src/routes/custom/create-custom-route-gateway.js +98 -0
- package/src/routes/custom/create-custom-route-gateway.js.map +1 -0
- package/src/routes/custom/index.d.ts +2 -0
- package/src/routes/custom/index.js +19 -0
- package/src/routes/custom/index.js.map +1 -0
- package/src/routes/index.d.ts +1 -0
- package/src/routes/index.js +1 -0
- package/src/routes/index.js.map +1 -1
- package/src/version.json +1 -1
- package/test/for-feature/custom-routes.e2e-spec.d.ts +1 -0
- package/test/for-feature/custom-routes.e2e-spec.js +275 -0
- package/test/for-feature/custom-routes.e2e-spec.js.map +1 -0
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
Changelog
|
|
2
2
|
|
|
3
|
+
## [4.10.0](https://github.com/MikeDev75015/mongodb-dynamic-api/compare/v4.9.0...v4.10.0) (2026-05-25)
|
|
4
|
+
|
|
5
|
+
### custom-route
|
|
6
|
+
|
|
7
|
+
* **custom-route:** add WebSocket gateway support ([f7b54a4](https://github.com/MikeDev75015/mongodb-dynamic-api/commit/f7b54a4))
|
|
8
|
+
* **custom-route:** remove unnecessary type casts in controller factory ([8448e8e](https://github.com/MikeDev75015/mongodb-dynamic-api/commit/8448e8ee16c3ada8fdcb08c3d3252a05ca82b90a))
|
|
9
|
+
* **custom-route:** rename DynamicApiCustomRouteConfig to CustomRouteConfig ([4b67e6b](https://github.com/MikeDev75015/mongodb-dynamic-api/commit/4b67e6bffad70424d6898db3ffa47db0ac4e9a26))
|
|
10
|
+
|
|
11
|
+
### custom-routes
|
|
12
|
+
|
|
13
|
+
* **custom-routes:** add customRoutes option to forFeature() ([3a06adb](https://github.com/MikeDev75015/mongodb-dynamic-api/commit/3a06adb032102233d9a13bab35f05a7e7fbcb19e))
|
|
14
|
+
|
|
3
15
|
## [4.9.0](https://github.com/MikeDev75015/mongodb-dynamic-api/compare/v4.8.0...v4.9.0) (2026-05-25)
|
|
4
16
|
|
|
5
17
|
### presence
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ import { DynamicApiGlobalStateService } from './services';
|
|
|
5
5
|
export declare class DynamicApiModule {
|
|
6
6
|
static readonly state: DynamicApiGlobalStateService;
|
|
7
7
|
static forRoot<Entity extends BaseEntity = any>(uri: string, { useGlobalCache, cacheOptions, useAuth, routesConfig, webSocket, broadcastGatewayOptions, }?: DynamicApiForRootOptions<Entity>): DynamicModule;
|
|
8
|
-
static forFeature<Entity extends BaseEntity>({ entity, controllerOptions, routes, webSocket: featureWebSocket, extraImports, extraProviders, extraControllers, }: DynamicApiForFeatureOptions<Entity>): Promise<DynamicModule>;
|
|
8
|
+
static forFeature<Entity extends BaseEntity>({ entity, controllerOptions, routes, webSocket: featureWebSocket, extraImports, extraProviders, extraControllers, customRoutes, }: DynamicApiForFeatureOptions<Entity>): Promise<DynamicModule>;
|
|
9
9
|
private static buildStateFromOptions;
|
|
10
10
|
private static setDefaultRoutes;
|
|
11
11
|
}
|
|
@@ -52,7 +52,7 @@ let DynamicApiModule = DynamicApiModule_1 = class DynamicApiModule {
|
|
|
52
52
|
exports: [modules_1.DynamicApiConfigModule],
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
static forFeature({ entity, controllerOptions, routes, webSocket: featureWebSocket, extraImports, extraProviders, extraControllers, }) {
|
|
55
|
+
static forFeature({ entity, controllerOptions, routes, webSocket: featureWebSocket, extraImports, extraProviders, extraControllers, customRoutes = [], }) {
|
|
56
56
|
const schema = (0, helpers_1.buildSchemaFromEntity)(entity);
|
|
57
57
|
const databaseModule = mongoose_1.MongooseModule.forFeature([{ name: entity.name, schema }], this.state.get('connectionName'));
|
|
58
58
|
services_1.DynamicApiGlobalStateService.addEntitySchema(entity, schema);
|
|
@@ -68,6 +68,16 @@ let DynamicApiModule = DynamicApiModule_1 = class DynamicApiModule {
|
|
|
68
68
|
clearTimeout(waitForState);
|
|
69
69
|
}
|
|
70
70
|
const { version: controllerVersion, validationPipeOptions: controllerValidationPipeOptions, routesConfig: controllerRoutesConfig, } = controllerOptions;
|
|
71
|
+
const customRouteControllers = customRoutes.map((customRoute) => (0, routes_1.createCustomRouteController)(entity, controllerOptions, customRoute, controllerVersion, controllerValidationPipeOptions));
|
|
72
|
+
const customRouteGateways = customRoutes
|
|
73
|
+
.filter((cr) => cr.webSocket)
|
|
74
|
+
.map((customRoute) => {
|
|
75
|
+
const wsOptions = customRoute.webSocket
|
|
76
|
+
? (0, helpers_1.initializeConfigFromOptions)(customRoute.webSocket)
|
|
77
|
+
: DynamicApiModule_1.state.get('gatewayOptions') ?? null;
|
|
78
|
+
return (0, routes_1.createCustomRouteGateway)(entity, controllerOptions, customRoute, controllerVersion, controllerValidationPipeOptions, wsOptions ?? {});
|
|
79
|
+
});
|
|
80
|
+
const needsDatabaseModule = customRouteControllers.length > 0 || customRouteGateways.length > 0;
|
|
71
81
|
const castType = (t) => t;
|
|
72
82
|
const castModule = (m) => m;
|
|
73
83
|
const moduleByRouteType = new Map([
|
|
@@ -89,6 +99,7 @@ let DynamicApiModule = DynamicApiModule_1 = class DynamicApiModule {
|
|
|
89
99
|
const apiModule = {
|
|
90
100
|
module: DynamicApiModule_1,
|
|
91
101
|
imports: [
|
|
102
|
+
...(needsDatabaseModule ? [databaseModule] : []),
|
|
92
103
|
...routes.map((routeConfig) => {
|
|
93
104
|
const { type, description: routeDescription, version: routeVersion, validationPipeOptions: routeValidationPipeOptions, webSocket: routeWebSocket, } = routeConfig;
|
|
94
105
|
const module = moduleByRouteType.get(type);
|
|
@@ -104,6 +115,7 @@ let DynamicApiModule = DynamicApiModule_1 = class DynamicApiModule {
|
|
|
104
115
|
}),
|
|
105
116
|
],
|
|
106
117
|
controllers: [
|
|
118
|
+
...customRouteControllers,
|
|
107
119
|
...(isCacheEnabledForFeature
|
|
108
120
|
? [(0, routes_1.createCachePurgeController)(entity, controllerOptions)]
|
|
109
121
|
: []),
|
|
@@ -122,6 +134,7 @@ let DynamicApiModule = DynamicApiModule_1 = class DynamicApiModule {
|
|
|
122
134
|
?? this.state.get('gatewayOptions')
|
|
123
135
|
?? {}),
|
|
124
136
|
] : []),
|
|
137
|
+
...customRouteGateways,
|
|
125
138
|
],
|
|
126
139
|
};
|
|
127
140
|
resolve(apiModule);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-api.module.js","sourceRoot":"","sources":["../../libs/dynamic-api/src/dynamic-api.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,yDAAmE;AACnE,2CAAuD;AACvD,uCAAqE;AACrE,8EAAyE;AACzE,+CAAkD;AAElD,yCAA8D;AAC9D,qCAAkD;AAClD,uCAA2H;AAC3H,iDAA4D;AAC5D,6CAAuQ;AAEvQ,uCAAsF;AACtF,
|
|
1
|
+
{"version":3,"file":"dynamic-api.module.js","sourceRoot":"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
return `Update one ${contentName}`;
|
|
30
30
|
case 'Aggregate':
|
|
31
31
|
return `Get aggregated ${contentName}`;
|
|
32
|
+
case 'Custom':
|
|
33
|
+
return `Custom ${contentName} endpoint`;
|
|
32
34
|
default:
|
|
33
35
|
throw new Error(`Route type "${routeType}" is not supported`);
|
|
34
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-description.helper.js","sourceRoot":"","sources":["../../../libs/dynamic-api/src/helpers/route-description.helper.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"route-description.helper.js","sourceRoot":"","sources":["../../../libs/dynamic-api/src/helpers/route-description.helper.ts"],"names":[],"mappings":";;AAuCS,gEAA0B;AAvCnC,mDAA4C;AAI5C,SAAS,0BAA0B,CAAC,SAAoB,EAAE,UAAkB;IAC1E,MAAM,WAAW,GAAG,IAAA,yBAAS,EAAC,UAAU,CAAC,CAAC;IAE1C,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,YAAY;YACf,OAAO,eAAe,WAAW,EAAE,CAAC;QACtC,KAAK,WAAW;YACd,OAAO,cAAc,WAAW,EAAE,CAAC;QACrC,KAAK,YAAY;YACf,OAAO,eAAe,WAAW,EAAE,CAAC;QACtC,KAAK,WAAW;YACd,OAAO,cAAc,WAAW,EAAE,CAAC;QACrC,KAAK,eAAe;YAClB,OAAO,kBAAkB,WAAW,EAAE,CAAC;QACzC,KAAK,cAAc;YACjB,OAAO,iBAAiB,WAAW,EAAE,CAAC;QACxC,KAAK,SAAS;YACZ,OAAO,YAAY,WAAW,EAAE,CAAC;QACnC,KAAK,QAAQ;YACX,OAAO,WAAW,WAAW,QAAQ,CAAC;QACxC,KAAK,YAAY;YACf,OAAO,eAAe,WAAW,EAAE,CAAC;QACtC,KAAK,YAAY;YACf,OAAO,eAAe,WAAW,EAAE,CAAC;QACtC,KAAK,WAAW;YACd,OAAO,cAAc,WAAW,EAAE,CAAC;QACrC,KAAK,WAAW;YACd,OAAO,kBAAkB,WAAW,EAAE,CAAC;QACzC,KAAK,QAAQ;YACX,OAAO,UAAU,WAAW,WAAW,CAAC;QAC1C;YACE,MAAM,IAAI,KAAK,CAAC,eAAe,SAAS,oBAAoB,CAAC,CAAC;IAClE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { CanActivate, Type, ValidationPipeOptions } from '@nestjs/common';
|
|
2
|
+
import { Model } from 'mongoose';
|
|
3
|
+
import { BaseEntity } from '../models';
|
|
4
|
+
import { AbilityPredicate, PredicateBehavior } from './dynamic-api-ability.interface';
|
|
5
|
+
import { Mappable } from './dynamic-api-route-dtos-bundle.type';
|
|
6
|
+
import { DynamicApiWebSocketOptions } from './dynamic-api-web-socket.interface';
|
|
7
|
+
type HttpMethod = 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
|
|
8
|
+
interface CustomRouteContext<Entity extends BaseEntity, Body = unknown, Query = unknown, Params extends Record<string, string> = Record<string, string>> {
|
|
9
|
+
model: Model<Entity>;
|
|
10
|
+
user: unknown;
|
|
11
|
+
params: Params;
|
|
12
|
+
body: Body;
|
|
13
|
+
query: Query;
|
|
14
|
+
}
|
|
15
|
+
interface CustomRouteConfig<Entity extends BaseEntity, Body = unknown, Query = unknown, Params extends Record<string, string> = Record<string, string>, Response = unknown> {
|
|
16
|
+
path: string;
|
|
17
|
+
method: HttpMethod;
|
|
18
|
+
handler: (ctx: CustomRouteContext<Entity, Body, Query, Params>) => Promise<Response>;
|
|
19
|
+
version?: string;
|
|
20
|
+
isPublic?: boolean;
|
|
21
|
+
description?: string;
|
|
22
|
+
guards?: Type<CanActivate>[];
|
|
23
|
+
abilityPredicate?: AbilityPredicate<Entity>;
|
|
24
|
+
predicateBehavior?: PredicateBehavior;
|
|
25
|
+
validationPipeOptions?: ValidationPipeOptions;
|
|
26
|
+
webSocket?: DynamicApiWebSocketOptions;
|
|
27
|
+
eventName?: string;
|
|
28
|
+
dTOs?: {
|
|
29
|
+
body?: Type;
|
|
30
|
+
query?: Type;
|
|
31
|
+
presenter?: Type & Partial<Mappable<Entity>>;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export type { HttpMethod, CustomRouteContext, CustomRouteConfig };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dynamic-api-custom-route.interface.js","sourceRoot":"","sources":["../../../libs/dynamic-api/src/interfaces/dynamic-api-custom-route.interface.ts"],"names":[],"mappings":""}
|
|
@@ -4,6 +4,7 @@ import { BaseEntity } from '../models';
|
|
|
4
4
|
import { DynamicApiAuthOptions } from '../modules';
|
|
5
5
|
import { DynamicApiControllerOptions } from './dynamic-api-controller-options.interface';
|
|
6
6
|
import { DynamicApiCacheOptions } from './dynamic-api-cache-options.interface';
|
|
7
|
+
import { CustomRouteConfig } from './dynamic-api-custom-route.interface';
|
|
7
8
|
import { RoutesConfig } from './dynamic-api-global-state.interface';
|
|
8
9
|
import { DynamicAPIRouteConfig } from './dynamic-api-route-config.interface';
|
|
9
10
|
import { DynamicApiWebSocketOptions } from './dynamic-api-web-socket.interface';
|
|
@@ -24,5 +25,6 @@ interface DynamicApiForFeatureOptions<Entity extends BaseEntity> {
|
|
|
24
25
|
extraImports?: ModuleMetadata['imports'];
|
|
25
26
|
extraProviders?: ModuleMetadata['providers'];
|
|
26
27
|
extraControllers?: ModuleMetadata['controllers'];
|
|
28
|
+
customRoutes?: CustomRouteConfig<Entity>[];
|
|
27
29
|
}
|
|
28
30
|
export { DynamicApiForFeatureOptions, DynamicApiForRootOptions, DYNAMIC_API_GLOBAL_STATE };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-api-options.interface.js","sourceRoot":"","sources":["../../../libs/dynamic-api/src/interfaces/dynamic-api-options.interface.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"dynamic-api-options.interface.js","sourceRoot":"","sources":["../../../libs/dynamic-api/src/interfaces/dynamic-api-options.interface.ts"],"names":[],"mappings":";;;AAYA,MAAM,wBAAwB,GAAG,MAAM,CAAC,0BAA0B,CAAC,CAAC;AA2BJ,4DAAwB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
type RouteType = 'CreateMany' | 'CreateOne' | 'DeleteMany' | 'DeleteOne' | 'DuplicateMany' | 'DuplicateOne' | 'GetMany' | 'GetOne' | 'ReplaceOne' | 'UpdateMany' | 'UpdateOne' | 'Aggregate';
|
|
1
|
+
type RouteType = 'CreateMany' | 'CreateOne' | 'DeleteMany' | 'DeleteOne' | 'DuplicateMany' | 'DuplicateOne' | 'GetMany' | 'GetOne' | 'ReplaceOne' | 'UpdateMany' | 'UpdateOne' | 'Aggregate' | 'Custom';
|
|
2
2
|
export { RouteType };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './dynamic-api-controller-options.interface';
|
|
2
|
+
export * from './dynamic-api-custom-route.interface';
|
|
2
3
|
export * from './dynamic-api-request.interface';
|
|
3
4
|
export * from './dynamic-api-decorator-builder.interface';
|
|
4
5
|
export * from './dynamic-api-cache-options.interface';
|
package/src/interfaces/index.js
CHANGED
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./dynamic-api-controller-options.interface"), exports);
|
|
18
|
+
__exportStar(require("./dynamic-api-custom-route.interface"), exports);
|
|
18
19
|
__exportStar(require("./dynamic-api-request.interface"), exports);
|
|
19
20
|
__exportStar(require("./dynamic-api-decorator-builder.interface"), exports);
|
|
20
21
|
__exportStar(require("./dynamic-api-cache-options.interface"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../libs/dynamic-api/src/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6EAA2D;AAC3D,kEAAgD;AAChD,4EAA0D;AAC1D,wEAAsD;AACtD,kEAAgD;AAChD,2EAAyD;AACzD,yEAAuD;AACvD,yEAAuD;AACvD,uEAAqD;AACrD,kEAAgD;AAChD,yEAAuD;AACvD,uEAAqD;AACrD,uEAAqD;AACrD,kEAAgD;AAChD,oEAAkD;AAClD,gEAA8C;AAC9C,yEAAuD;AACvD,uFAAqE;AACrE,2EAAyD;AACzD,2EAAyD;AACzD,qEAAmD;AACnD,qEAAmD;AACnD,mEAAiD"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../libs/dynamic-api/src/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6EAA2D;AAC3D,uEAAqD;AACrD,kEAAgD;AAChD,4EAA0D;AAC1D,wEAAsD;AACtD,kEAAgD;AAChD,2EAAyD;AACzD,yEAAuD;AACvD,yEAAuD;AACvD,uEAAqD;AACrD,kEAAgD;AAChD,yEAAuD;AACvD,uEAAqD;AACrD,uEAAqD;AACrD,kEAAgD;AAChD,oEAAkD;AAClD,gEAA8C;AAC9C,yEAAuD;AACvD,uFAAqE;AACrE,2EAAyD;AACzD,2EAAyD;AACzD,qEAAmD;AACnD,qEAAmD;AACnD,mEAAiD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Type, ValidationPipeOptions } from '@nestjs/common';
|
|
2
|
+
import { DynamicApiControllerOptions, CustomRouteConfig } from '../../interfaces';
|
|
3
|
+
import { BaseEntity } from '../../models';
|
|
4
|
+
declare function createCustomRouteController<Entity extends BaseEntity, Body = unknown, QueryDto = unknown, Params extends Record<string, string> = Record<string, string>, Response = unknown>(entity: Type<Entity>, { useInterceptors, ...controllerOptions }: DynamicApiControllerOptions<Entity>, customRouteConfig: CustomRouteConfig<Entity, Body, QueryDto, Params, Response>, controllerVersion?: string, controllerValidationPipeOptions?: ValidationPipeOptions): Type;
|
|
5
|
+
declare function getCustomRouteControllerName(entityName: string, routePath: string, apiTag?: string, version?: string): string;
|
|
6
|
+
declare function getCustomRoutePoliciesGuardName(entityName: string, routePath: string, apiTag?: string, version?: string): string;
|
|
7
|
+
export { createCustomRouteController, getCustomRouteControllerName, getCustomRoutePoliciesGuardName, };
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.createCustomRouteController = createCustomRouteController;
|
|
16
|
+
exports.getCustomRouteControllerName = getCustomRouteControllerName;
|
|
17
|
+
exports.getCustomRoutePoliciesGuardName = getCustomRoutePoliciesGuardName;
|
|
18
|
+
const common_1 = require("@nestjs/common");
|
|
19
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
20
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
21
|
+
const mongoose_2 = require("mongoose");
|
|
22
|
+
const decorators_1 = require("../../decorators");
|
|
23
|
+
const dynamic_api_module_1 = require("../../dynamic-api.module");
|
|
24
|
+
const helpers_1 = require("../../helpers");
|
|
25
|
+
const mixins_1 = require("../../mixins");
|
|
26
|
+
const HTTP_METHOD_DECORATOR_MAP = {
|
|
27
|
+
GET: common_1.Get,
|
|
28
|
+
POST: common_1.Post,
|
|
29
|
+
PATCH: common_1.Patch,
|
|
30
|
+
PUT: common_1.Put,
|
|
31
|
+
DELETE: common_1.Delete,
|
|
32
|
+
};
|
|
33
|
+
function createCustomRouteController(entity, { useInterceptors = [], ...controllerOptions }, customRouteConfig, controllerVersion, controllerValidationPipeOptions) {
|
|
34
|
+
const { path: routePath, method, handler, version: routeVersion, isPublic, description, guards = [], abilityPredicate, predicateBehavior, validationPipeOptions: routeValidationPipeOptions, dTOs, } = customRouteConfig;
|
|
35
|
+
const { path: controllerPath, apiTag } = controllerOptions;
|
|
36
|
+
const effectiveVersion = routeVersion ?? controllerVersion;
|
|
37
|
+
const effectiveValidationPipeOptions = routeValidationPipeOptions ?? controllerValidationPipeOptions;
|
|
38
|
+
const baseDisplayedName = (0, helpers_1.getDisplayedName)(apiTag, entity.name, undefined);
|
|
39
|
+
const routePathPascal = (0, helpers_1.pascalCase)(routePath) ?? 'Custom';
|
|
40
|
+
const uniqueDisplayedName = `${routePathPascal}${baseDisplayedName}`;
|
|
41
|
+
const isAuthEnabled = dynamic_api_module_1.DynamicApiModule.state.get('isAuthEnabled');
|
|
42
|
+
const connectionName = dynamic_api_module_1.DynamicApiModule.state.get('connectionName');
|
|
43
|
+
const allGuards = [];
|
|
44
|
+
if (abilityPredicate) {
|
|
45
|
+
const PoliciesGuard = (0, mixins_1.RoutePoliciesGuardMixin)(entity, 'Custom', uniqueDisplayedName, effectiveVersion, abilityPredicate, undefined, predicateBehavior);
|
|
46
|
+
allGuards.push(PoliciesGuard);
|
|
47
|
+
}
|
|
48
|
+
allGuards.push(...guards);
|
|
49
|
+
const presenterType = dTOs?.presenter ?? entity;
|
|
50
|
+
let CustomRouteController = class CustomRouteController {
|
|
51
|
+
constructor(model) {
|
|
52
|
+
this.model = model;
|
|
53
|
+
this.entity = entity;
|
|
54
|
+
}
|
|
55
|
+
async handle(params, body, query, req) {
|
|
56
|
+
const result = await handler({
|
|
57
|
+
model: this.model,
|
|
58
|
+
user: req?.user,
|
|
59
|
+
params: params,
|
|
60
|
+
body: body,
|
|
61
|
+
query: query,
|
|
62
|
+
});
|
|
63
|
+
const fromEntity = presenterType.fromEntity;
|
|
64
|
+
return fromEntity ? fromEntity(result) : result;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
__decorate([
|
|
68
|
+
__param(0, (0, common_1.Param)()),
|
|
69
|
+
__param(1, (0, common_1.Body)()),
|
|
70
|
+
__param(2, (0, common_1.Query)()),
|
|
71
|
+
__param(3, (0, common_1.Request)()),
|
|
72
|
+
__metadata("design:type", Function),
|
|
73
|
+
__metadata("design:paramtypes", [Object, Object, Object, Object]),
|
|
74
|
+
__metadata("design:returntype", Promise)
|
|
75
|
+
], CustomRouteController.prototype, "handle", null);
|
|
76
|
+
CustomRouteController = __decorate([
|
|
77
|
+
(0, common_1.Controller)({ path: controllerPath, version: effectiveVersion }),
|
|
78
|
+
(0, swagger_1.ApiTags)(apiTag ?? entity.name),
|
|
79
|
+
(0, decorators_1.ValidatorPipe)(effectiveValidationPipeOptions),
|
|
80
|
+
(0, common_1.UseInterceptors)(common_1.ClassSerializerInterceptor, ...useInterceptors),
|
|
81
|
+
__param(0, (0, mongoose_1.InjectModel)(entity.name, connectionName)),
|
|
82
|
+
__metadata("design:paramtypes", [mongoose_2.Model])
|
|
83
|
+
], CustomRouteController);
|
|
84
|
+
if (dTOs?.body ?? dTOs?.query) {
|
|
85
|
+
const paramTypes = [Object, Object, Object, Object];
|
|
86
|
+
if (dTOs?.body)
|
|
87
|
+
paramTypes[1] = dTOs.body;
|
|
88
|
+
if (dTOs?.query)
|
|
89
|
+
paramTypes[2] = dTOs.query;
|
|
90
|
+
Reflect.defineMetadata('design:paramtypes', paramTypes, CustomRouteController.prototype, 'handle');
|
|
91
|
+
}
|
|
92
|
+
const descriptor = Object.getOwnPropertyDescriptor(CustomRouteController.prototype, 'handle');
|
|
93
|
+
HTTP_METHOD_DECORATOR_MAP[method](routePath)(CustomRouteController.prototype, 'handle', descriptor);
|
|
94
|
+
(0, swagger_1.ApiOperation)({
|
|
95
|
+
operationId: `custom${routePathPascal}${baseDisplayedName}${effectiveVersion ? 'V' + effectiveVersion : ''}`,
|
|
96
|
+
summary: description ?? `${method} /${routePath} — custom endpoint for ${entity.name}`,
|
|
97
|
+
})(CustomRouteController.prototype, 'handle', descriptor);
|
|
98
|
+
(0, swagger_1.ApiResponse)({
|
|
99
|
+
type: presenterType,
|
|
100
|
+
})(CustomRouteController.prototype, 'handle', descriptor);
|
|
101
|
+
if (dTOs?.body) {
|
|
102
|
+
(0, swagger_1.ApiBody)({ type: dTOs.body })(CustomRouteController.prototype, 'handle', descriptor);
|
|
103
|
+
}
|
|
104
|
+
if (dTOs?.query) {
|
|
105
|
+
(0, swagger_1.ApiQuery)({ type: dTOs.query })(CustomRouteController.prototype, 'handle', descriptor);
|
|
106
|
+
}
|
|
107
|
+
if (allGuards.length > 0) {
|
|
108
|
+
(0, common_1.UseGuards)(...allGuards)(CustomRouteController.prototype, 'handle', descriptor);
|
|
109
|
+
}
|
|
110
|
+
if (isPublic) {
|
|
111
|
+
(0, decorators_1.Public)()(CustomRouteController.prototype, 'handle', descriptor);
|
|
112
|
+
}
|
|
113
|
+
else if (isAuthEnabled) {
|
|
114
|
+
(0, swagger_1.ApiBearerAuth)()(CustomRouteController.prototype, 'handle', descriptor);
|
|
115
|
+
}
|
|
116
|
+
Object.defineProperty(CustomRouteController, 'name', {
|
|
117
|
+
value: `Custom${uniqueDisplayedName}${(0, helpers_1.addVersionSuffix)(effectiveVersion)}Controller`,
|
|
118
|
+
writable: false,
|
|
119
|
+
});
|
|
120
|
+
return CustomRouteController;
|
|
121
|
+
}
|
|
122
|
+
function getCustomRouteControllerName(entityName, routePath, apiTag, version) {
|
|
123
|
+
const baseDisplayedName = (0, helpers_1.getDisplayedName)(apiTag, entityName, undefined);
|
|
124
|
+
const routePathPascal = (0, helpers_1.pascalCase)(routePath) ?? 'Custom';
|
|
125
|
+
return `Custom${routePathPascal}${baseDisplayedName}${(0, helpers_1.addVersionSuffix)(version)}Controller`;
|
|
126
|
+
}
|
|
127
|
+
function getCustomRoutePoliciesGuardName(entityName, routePath, apiTag, version) {
|
|
128
|
+
const baseDisplayedName = (0, helpers_1.getDisplayedName)(apiTag, entityName, undefined);
|
|
129
|
+
const routePathPascal = (0, helpers_1.pascalCase)(routePath) ?? 'Custom';
|
|
130
|
+
const uniqueDisplayedName = `${routePathPascal}${baseDisplayedName}`;
|
|
131
|
+
return (0, helpers_1.provideName)('Custom', uniqueDisplayedName, version, 'PoliciesGuard');
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=create-custom-route-controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-custom-route-controller.js","sourceRoot":"","sources":["../../../../libs/dynamic-api/src/routes/custom/create-custom-route-controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAyPE,kEAA2B;AAC3B,oEAA4B;AAC5B,0EAA+B;AA3PjC,2CAiBwB;AACxB,+CAA+C;AAC/C,6CAOyB;AACzB,uCAAiC;AACjC,iDAAyD;AACzD,iEAA4D;AAC5D,2CAKuB;AAQvB,yCAAuD;AAKvD,MAAM,yBAAyB,GAAmD;IAChF,GAAG,EAAE,YAAG;IACR,IAAI,EAAE,aAAI;IACV,KAAK,EAAE,cAAK;IACZ,GAAG,EAAE,YAAG;IACR,MAAM,EAAE,eAAM;CACf,CAAC;AAeF,SAAS,2BAA2B,CAOlC,MAAoB,EACpB,EAAE,eAAe,GAAG,EAAE,EAAE,GAAG,iBAAiB,EAAuC,EACnF,iBAA8E,EAC9E,iBAA0B,EAC1B,+BAAuD;IAEvD,MAAM,EACJ,IAAI,EAAE,SAAS,EACf,MAAM,EACN,OAAO,EACP,OAAO,EAAE,YAAY,EACrB,QAAQ,EACR,WAAW,EACX,MAAM,GAAG,EAAE,EACX,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,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AAG,iBAAiB,EAAE,CAAC;IACrE,OAAO,IAAA,qBAAW,EAAC,QAAQ,EAAE,mBAAmB,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Type, ValidationPipeOptions } from '@nestjs/common';
|
|
2
|
+
import { CustomRouteConfig, DynamicApiControllerOptions, GatewayOptions } from '../../interfaces';
|
|
3
|
+
import { BaseEntity } from '../../models';
|
|
4
|
+
declare function createCustomRouteGateway<Entity extends BaseEntity, Body = unknown, QueryDto = unknown, Params extends Record<string, string> = Record<string, string>, Response = unknown>(entity: Type<Entity>, { useInterceptors, ...controllerOptions }: DynamicApiControllerOptions<Entity>, customRouteConfig: CustomRouteConfig<Entity, Body, QueryDto, Params, Response>, controllerVersion?: string, controllerValidationPipeOptions?: ValidationPipeOptions, gatewayOptions?: GatewayOptions): Type;
|
|
5
|
+
declare function getCustomRouteGatewayName(entityName: string, routePath: string, apiTag?: string, version?: string): string;
|
|
6
|
+
export { createCustomRouteGateway, getCustomRouteGatewayName };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.createCustomRouteGateway = createCustomRouteGateway;
|
|
16
|
+
exports.getCustomRouteGatewayName = getCustomRouteGatewayName;
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
const jwt_1 = require("@nestjs/jwt");
|
|
19
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
20
|
+
const websockets_1 = require("@nestjs/websockets");
|
|
21
|
+
const mongoose_2 = require("mongoose");
|
|
22
|
+
const decorators_1 = require("../../decorators");
|
|
23
|
+
const filters_1 = require("../../filters");
|
|
24
|
+
const gateways_1 = require("../../gateways");
|
|
25
|
+
const guards_1 = require("../../guards");
|
|
26
|
+
const helpers_1 = require("../../helpers");
|
|
27
|
+
const mixins_1 = require("../../mixins");
|
|
28
|
+
const dynamic_api_module_1 = require("../../dynamic-api.module");
|
|
29
|
+
function createCustomRouteGateway(entity, { useInterceptors = [], ...controllerOptions }, customRouteConfig, controllerVersion, controllerValidationPipeOptions, gatewayOptions = {}) {
|
|
30
|
+
const { path: routePath, handler, version: routeVersion, isPublic, guards = [], abilityPredicate, predicateBehavior, validationPipeOptions: routeValidationPipeOptions, eventName, dTOs, } = customRouteConfig;
|
|
31
|
+
const { apiTag } = controllerOptions;
|
|
32
|
+
const effectiveVersion = routeVersion ?? controllerVersion;
|
|
33
|
+
const effectiveValidationPipeOptions = routeValidationPipeOptions ?? controllerValidationPipeOptions;
|
|
34
|
+
const connectionName = dynamic_api_module_1.DynamicApiModule.state.get('connectionName');
|
|
35
|
+
const displayedName = (0, helpers_1.getDisplayedName)(apiTag, entity.name, undefined);
|
|
36
|
+
const routePathPascal = (0, helpers_1.pascalCase)(routePath) ?? 'Custom';
|
|
37
|
+
const uniqueDisplayedName = `${routePathPascal}${displayedName}`;
|
|
38
|
+
const event = eventName ?? (0, helpers_1.kebabCase)(`custom/${routePath}/${apiTag ?? entity.name}`);
|
|
39
|
+
const presenterType = dTOs?.presenter ?? entity;
|
|
40
|
+
const guardInstances = [
|
|
41
|
+
new guards_1.JwtSocketGuard(isPublic),
|
|
42
|
+
];
|
|
43
|
+
if (abilityPredicate) {
|
|
44
|
+
const PoliciesGuard = (0, mixins_1.SocketPoliciesGuardMixin)(entity, 'Custom', event, effectiveVersion, { abilityPredicate, isPublic, predicateBehavior });
|
|
45
|
+
guardInstances.push(PoliciesGuard);
|
|
46
|
+
}
|
|
47
|
+
guardInstances.push(...guards);
|
|
48
|
+
let CustomRouteGateway = class CustomRouteGateway extends gateways_1.BaseGateway {
|
|
49
|
+
constructor(model, jwtService) {
|
|
50
|
+
super(jwtService);
|
|
51
|
+
this.model = model;
|
|
52
|
+
this.jwtService = jwtService;
|
|
53
|
+
this.entity = entity;
|
|
54
|
+
}
|
|
55
|
+
async handle(socket, body) {
|
|
56
|
+
const result = await handler({
|
|
57
|
+
model: this.model,
|
|
58
|
+
user: socket?.user,
|
|
59
|
+
params: {},
|
|
60
|
+
body: body,
|
|
61
|
+
query: {},
|
|
62
|
+
});
|
|
63
|
+
const fromEntity = presenterType.fromEntity;
|
|
64
|
+
const data = fromEntity ? fromEntity(result) : result;
|
|
65
|
+
return { event, data };
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, common_1.UseFilters)(new filters_1.DynamicAPIWsExceptionFilter()),
|
|
70
|
+
(0, common_1.UseGuards)(...guardInstances),
|
|
71
|
+
(0, websockets_1.SubscribeMessage)(event),
|
|
72
|
+
__param(0, (0, websockets_1.ConnectedSocket)()),
|
|
73
|
+
__param(1, (0, websockets_1.MessageBody)()),
|
|
74
|
+
__metadata("design:type", Function),
|
|
75
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
76
|
+
__metadata("design:returntype", Object)
|
|
77
|
+
], CustomRouteGateway.prototype, "handle", null);
|
|
78
|
+
CustomRouteGateway = __decorate([
|
|
79
|
+
(0, websockets_1.WebSocketGateway)(gatewayOptions),
|
|
80
|
+
(0, decorators_1.ValidatorPipe)(effectiveValidationPipeOptions),
|
|
81
|
+
(0, common_1.UseInterceptors)(common_1.ClassSerializerInterceptor, ...useInterceptors),
|
|
82
|
+
__param(0, (0, mongoose_1.InjectModel)(entity.name, connectionName)),
|
|
83
|
+
__param(1, (0, common_1.Optional)()),
|
|
84
|
+
__metadata("design:paramtypes", [mongoose_2.Model,
|
|
85
|
+
jwt_1.JwtService])
|
|
86
|
+
], CustomRouteGateway);
|
|
87
|
+
Object.defineProperty(CustomRouteGateway, 'name', {
|
|
88
|
+
value: `Custom${uniqueDisplayedName}${(0, helpers_1.addVersionSuffix)(effectiveVersion)}Gateway`,
|
|
89
|
+
writable: false,
|
|
90
|
+
});
|
|
91
|
+
return CustomRouteGateway;
|
|
92
|
+
}
|
|
93
|
+
function getCustomRouteGatewayName(entityName, routePath, apiTag, version) {
|
|
94
|
+
const displayedName = (0, helpers_1.getDisplayedName)(apiTag, entityName, undefined);
|
|
95
|
+
const routePathPascal = (0, helpers_1.pascalCase)(routePath) ?? 'Custom';
|
|
96
|
+
return `Custom${routePathPascal}${displayedName}${(0, helpers_1.addVersionSuffix)(version)}Gateway`;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=create-custom-route-gateway.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-custom-route-gateway.js","sourceRoot":"","sources":["../../../../libs/dynamic-api/src/routes/custom/create-custom-route-gateway.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAsKS,4DAAwB;AAAE,8DAAyB;AAtK5D,2CASwB;AACxB,qCAAyC;AACzC,+CAA+C;AAC/C,mDAK4B;AAC5B,uCAAiC;AACjC,iDAAiD;AACjD,2CAA4D;AAC5D,6CAA6C;AAC7C,yCAA8C;AAC9C,2CAA0F;AAS1F,yCAAwD;AAExD,iEAA4D;AAc5D,SAAS,wBAAwB,CAO/B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A0B,EAAE,GAAG,eAAe,CAAC;QAK3D,WAAA,IAAA,sBAAW,EAAC,MAAM,CAAC,IAAI,EAAE,cAAc,CAAC,CAAA;QAExC,WAAA,IAAA,iBAAQ,GAAE,CAAA;yCADe,gBAAK;YACY,gBAAU;OANnD,kBAAkB,CA+BvB;IAED,MAAM,CAAC,cAAc,CAAC,kBAAkB,EAAE,MAAM,EAAE;QAChD,KAAK,EAAE,SAAS,mBAAmB,GAAG,IAAA,0BAAgB,EAAC,gBAAgB,CAAC,SAAS;QACjF,QAAQ,EAAE,KAAK;KAChB,CAAC,CAAC;IAEH,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAMD,SAAS,yBAAyB,CAChC,UAAkB,EAClB,SAAiB,EACjB,MAAe,EACf,OAAgB;IAEhB,MAAM,aAAa,GAAG,IAAA,0BAAgB,EAAC,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;IACtE,MAAM,eAAe,GAAG,IAAA,oBAAU,EAAC,SAAS,CAAC,IAAI,QAAQ,CAAC;IAC1D,OAAO,SAAS,eAAe,GAAG,aAAa,GAAG,IAAA,0BAAgB,EAAC,OAAO,CAAC,SAAS,CAAC;AACvF,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./create-custom-route-controller"), exports);
|
|
18
|
+
__exportStar(require("./create-custom-route-gateway"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/dynamic-api/src/routes/custom/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAiD;AACjD,gEAA8C"}
|
package/src/routes/index.d.ts
CHANGED
package/src/routes/index.js
CHANGED
|
@@ -18,6 +18,7 @@ __exportStar(require("./aggregate"), exports);
|
|
|
18
18
|
__exportStar(require("./cache-purge"), exports);
|
|
19
19
|
__exportStar(require("./create-many"), exports);
|
|
20
20
|
__exportStar(require("./create-one"), exports);
|
|
21
|
+
__exportStar(require("./custom"), exports);
|
|
21
22
|
__exportStar(require("./delete-many"), exports);
|
|
22
23
|
__exportStar(require("./delete-one"), exports);
|
|
23
24
|
__exportStar(require("./duplicate-many"), exports);
|
package/src/routes/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../libs/dynamic-api/src/routes/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,gDAA8B;AAC9B,gDAA8B;AAC9B,+CAA6B;AAC7B,gDAA8B;AAC9B,+CAA6B;AAC7B,mDAAiC;AACjC,kDAAgC;AAChC,6CAA2B;AAC3B,4CAA0B;AAC1B,gDAA8B;AAC9B,gDAA8B;AAC9B,+CAA6B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../libs/dynamic-api/src/routes/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,gDAA8B;AAC9B,gDAA8B;AAC9B,+CAA6B;AAC7B,2CAAyB;AACzB,gDAA8B;AAC9B,+CAA6B;AAC7B,mDAAiC;AACjC,kDAAgC;AAChC,6CAA2B;AAC3B,4CAA0B;AAC1B,gDAA8B;AAC9B,gDAA8B;AAC9B,+CAA6B"}
|
package/src/version.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import 'dotenv/config';
|