@decaf-ts/for-nest 0.2.39 → 0.2.41
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/README.md +1 -1
- package/dist/for-nest.cjs +1 -1
- package/dist/for-nest.cjs.map +1 -1
- package/dist/for-nest.js +1 -1
- package/dist/for-nest.js.map +1 -1
- package/lib/core-module.cjs +39 -25
- package/lib/core-module.d.ts +1 -1
- package/lib/core-module.js.map +1 -1
- package/lib/decaf-model/DecafModelModule.cjs +0 -24
- package/lib/decaf-model/DecafModelModule.js.map +1 -1
- package/lib/decaf-model/decorators/decorators.d.ts +1 -1
- package/lib/decaf-model/decorators/decorators.js.map +1 -1
- package/lib/esm/core-module.d.ts +1 -1
- package/lib/esm/core-module.js +40 -26
- package/lib/esm/core-module.js.map +1 -1
- package/lib/esm/decaf-model/DecafModelModule.js +0 -24
- package/lib/esm/decaf-model/DecafModelModule.js.map +1 -1
- package/lib/esm/decaf-model/decorators/decorators.d.ts +1 -1
- package/lib/esm/decaf-model/decorators/decorators.js.map +1 -1
- package/lib/esm/index.d.ts +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/interceptors/DecafRequestHandlerInterceptor.js +8 -2
- package/lib/esm/interceptors/DecafRequestHandlerInterceptor.js.map +1 -1
- package/lib/esm/module.js +1 -2
- package/lib/esm/module.js.map +1 -1
- package/lib/esm/request/DecafHandlerExecutor.js +6 -2
- package/lib/esm/request/DecafHandlerExecutor.js.map +1 -1
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/interceptors/DecafRequestHandlerInterceptor.cjs +8 -2
- package/lib/interceptors/DecafRequestHandlerInterceptor.js.map +1 -1
- package/lib/module.cjs +1 -2
- package/lib/module.js.map +1 -1
- package/lib/request/DecafHandlerExecutor.cjs +6 -2
- package/lib/request/DecafHandlerExecutor.js.map +1 -1
- package/package.json +1 -1
|
@@ -11,10 +11,6 @@ const common_1 = require("@nestjs/common");
|
|
|
11
11
|
const core_1 = require("@decaf-ts/core");
|
|
12
12
|
const logging_1 = require("@decaf-ts/logging");
|
|
13
13
|
const FromModelController_1 = require("./FromModelController.cjs");
|
|
14
|
-
const interceptors_1 = require("./../interceptors/index.cjs");
|
|
15
|
-
const core_2 = require("@nestjs/core");
|
|
16
|
-
const request_1 = require("./../request/index.cjs");
|
|
17
|
-
const constants_1 = require("./../constants.cjs");
|
|
18
14
|
function getModuleFor(flavour) {
|
|
19
15
|
var DecafModelModule_1;
|
|
20
16
|
let DecafModelModule = class DecafModelModule {
|
|
@@ -42,26 +38,6 @@ function getModuleFor(flavour) {
|
|
|
42
38
|
module: DecafModelModule_1,
|
|
43
39
|
controllers,
|
|
44
40
|
providers: [
|
|
45
|
-
{
|
|
46
|
-
provide: constants_1.DECAF_HANDLERS,
|
|
47
|
-
useFactory: () => {
|
|
48
|
-
return (options.handlers?.map((H) => {
|
|
49
|
-
log.info(`Registered request handler: ${H.name}`);
|
|
50
|
-
return new H();
|
|
51
|
-
}) ?? []);
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
interceptors_1.AuthInterceptor,
|
|
55
|
-
{
|
|
56
|
-
provide: core_2.APP_INTERCEPTOR,
|
|
57
|
-
useExisting: interceptors_1.AuthInterceptor,
|
|
58
|
-
},
|
|
59
|
-
request_1.DecafRequestContext,
|
|
60
|
-
request_1.DecafHandlerExecutor,
|
|
61
|
-
{
|
|
62
|
-
provide: core_2.APP_INTERCEPTOR,
|
|
63
|
-
useClass: interceptors_1.DecafRequestHandlerInterceptor,
|
|
64
|
-
},
|
|
65
41
|
...modelServices,
|
|
66
42
|
],
|
|
67
43
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DecafModelModule.js","sourceRoot":"","sources":["../../src/decaf-model/DecafModelModule.ts"],"names":[],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"DecafModelModule.js","sourceRoot":"","sources":["../../src/decaf-model/DecafModelModule.ts"],"names":[],"mappings":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,cAAc,CAAC,CAAC;YAExD,OAAO;gBACL,MAAM,EAAE,kBAAgB;gBACxB,WAAW;gBACX,SAAS,EAAE;oBACT,GAAG,aAAa;iBACjB;aACF,CAAC;QACJ,CAAC;;IAxCG,gBAAgB;QADrB,IAAA,eAAM,EAAC,EAAE,CAAC;OACL,gBAAgB,CAyCrB;IACD,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,EAAE;QACtC,KAAK,EAAE,cAAc,OAAO,EAAE;KAC/B,CAAC,CAAC;IACH,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
|
|
@@ -26,4 +26,4 @@ import { Constructor } from "@decaf-ts/decoration";
|
|
|
26
26
|
* }
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
|
-
export declare function Auth(model
|
|
29
|
+
export declare function Auth(model?: string | Constructor): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../src/decaf-model/decorators/decorators.ts"],"names":[],"mappings":";;AAiCA,oBASC;AA1CD,2CAA+E;AAE/E,qDAAgD;AAChD,6CAAgD;AAChD,8EAAqE;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,SAAgB,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../src/decaf-model/decorators/decorators.ts"],"names":[],"mappings":";;AAiCA,oBASC;AA1CD,2CAA+E;AAE/E,qDAAgD;AAChD,6CAAgD;AAChD,8EAAqE;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,SAAgB,IAAI,CAAC,KAA4B;IAC/C,MAAM,QAAQ,GAAG,KAAK;QACpB,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ;YACzB,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,KAAK,CAAC,IAAI;QACd,CAAC,CAAC,SAAS,CAAC;IACd,MAAM,IAAI,GAAG,CAAC,IAAA,uBAAa,GAAE,EAAE,IAAA,wBAAe,EAAC,iCAAe,CAAC,CAAC,CAAC;IACjE,IAAI,QAAQ;QAAE,IAAI,CAAC,IAAI,CAAC,IAAA,oBAAW,EAAC,yBAAa,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC9D,OAAO,IAAA,wBAAe,EAAC,GAAG,IAAI,CAAC,CAAC;AAClC,CAAC"}
|
package/lib/esm/core-module.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare class DecafCoreModule<CONF, ADAPTER extends Adapter<CONF, any, an
|
|
|
11
11
|
protected static get persistence(): PersistenceService<any>;
|
|
12
12
|
protected static get log(): Logger;
|
|
13
13
|
constructor(options: DecafModuleOptions<CONF, ADAPTER>, moduleRef: ModuleRef);
|
|
14
|
-
static bootPersistence(options: DecafModuleOptions): Promise<Adapter<any, any, any, any>[]>;
|
|
15
14
|
static forRoot(options: DecafModuleOptions): DynamicModule;
|
|
15
|
+
static bootPersistence(options: DecafModuleOptions): Promise<Adapter<any, any, any, any>[]>;
|
|
16
16
|
onApplicationShutdown(): Promise<void>;
|
|
17
17
|
}
|
package/lib/esm/core-module.js
CHANGED
|
@@ -11,13 +11,14 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
11
11
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
12
|
};
|
|
13
13
|
var DecafCoreModule_1;
|
|
14
|
-
import { Global, Inject, Module,
|
|
15
|
-
import { ModuleRef } from "@nestjs/core";
|
|
16
|
-
import { DECAF_ADAPTER_ID, DECAF_MODULE_OPTIONS } from "./constants.js";
|
|
14
|
+
import { Global, Inject, Module, } from "@nestjs/common";
|
|
15
|
+
import { APP_INTERCEPTOR, ModuleRef } from "@nestjs/core";
|
|
16
|
+
import { DECAF_ADAPTER_ID, DECAF_HANDLERS, DECAF_MODULE_OPTIONS } from "./constants.js";
|
|
17
17
|
import { Adapter, PersistenceService } from "@decaf-ts/core";
|
|
18
18
|
import { Logging } from "@decaf-ts/logging";
|
|
19
19
|
import { InternalError } from "@decaf-ts/db-decorators";
|
|
20
|
-
import { RequestToContextTransformer, requestToContextTransformer, } from "./interceptors/
|
|
20
|
+
import { AuthInterceptor, DecafRequestHandlerInterceptor, RequestToContextTransformer, requestToContextTransformer, } from "./interceptors/index.js";
|
|
21
|
+
import { DecafHandlerExecutor, DecafRequestContext } from "./request/index.js";
|
|
21
22
|
let DecafCoreModule = class DecafCoreModule {
|
|
22
23
|
static { DecafCoreModule_1 = this; }
|
|
23
24
|
static get persistence() {
|
|
@@ -34,6 +35,41 @@ let DecafCoreModule = class DecafCoreModule {
|
|
|
34
35
|
this.options = options;
|
|
35
36
|
this.moduleRef = moduleRef;
|
|
36
37
|
}
|
|
38
|
+
static forRoot(options) {
|
|
39
|
+
const log = this.log.for(this.forRoot);
|
|
40
|
+
return {
|
|
41
|
+
module: DecafCoreModule_1,
|
|
42
|
+
providers: [
|
|
43
|
+
{ provide: DECAF_MODULE_OPTIONS, useValue: options },
|
|
44
|
+
{ provide: DECAF_ADAPTER_ID, useValue: this.persistence.client },
|
|
45
|
+
{
|
|
46
|
+
provide: DECAF_HANDLERS,
|
|
47
|
+
useFactory: () => options.handlers?.map((H) => {
|
|
48
|
+
log.info(`Registered request handler: ${H.name}`);
|
|
49
|
+
return new H();
|
|
50
|
+
}) ?? [],
|
|
51
|
+
},
|
|
52
|
+
AuthInterceptor,
|
|
53
|
+
{
|
|
54
|
+
provide: APP_INTERCEPTOR,
|
|
55
|
+
useExisting: AuthInterceptor,
|
|
56
|
+
},
|
|
57
|
+
DecafRequestContext,
|
|
58
|
+
DecafHandlerExecutor,
|
|
59
|
+
{
|
|
60
|
+
provide: APP_INTERCEPTOR,
|
|
61
|
+
useClass: DecafRequestHandlerInterceptor,
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
exports: [
|
|
65
|
+
DECAF_MODULE_OPTIONS,
|
|
66
|
+
DECAF_ADAPTER_ID,
|
|
67
|
+
DECAF_HANDLERS,
|
|
68
|
+
DecafRequestContext,
|
|
69
|
+
DecafHandlerExecutor,
|
|
70
|
+
],
|
|
71
|
+
};
|
|
72
|
+
}
|
|
37
73
|
static async bootPersistence(options) {
|
|
38
74
|
const log = this.log.for(this.bootPersistence);
|
|
39
75
|
if (!this._persistence) {
|
|
@@ -75,28 +111,6 @@ let DecafCoreModule = class DecafCoreModule {
|
|
|
75
111
|
// }
|
|
76
112
|
// return this.persistence;
|
|
77
113
|
}
|
|
78
|
-
static forRoot(options) {
|
|
79
|
-
const typeOrmModuleOptions = {
|
|
80
|
-
provide: DECAF_MODULE_OPTIONS,
|
|
81
|
-
useValue: options,
|
|
82
|
-
};
|
|
83
|
-
const adapter = {
|
|
84
|
-
useFactory: async (opts) => {
|
|
85
|
-
return DecafCoreModule_1.bootPersistence(opts);
|
|
86
|
-
},
|
|
87
|
-
provide: DECAF_ADAPTER_ID,
|
|
88
|
-
durable: true,
|
|
89
|
-
scope: Scope.DEFAULT,
|
|
90
|
-
inject: [DECAF_MODULE_OPTIONS],
|
|
91
|
-
};
|
|
92
|
-
const providers = [adapter, typeOrmModuleOptions];
|
|
93
|
-
const exports = [adapter];
|
|
94
|
-
return {
|
|
95
|
-
module: DecafCoreModule_1,
|
|
96
|
-
providers,
|
|
97
|
-
exports,
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
114
|
async onApplicationShutdown() {
|
|
101
115
|
const log = DecafCoreModule_1.log.for(this.onApplicationShutdown);
|
|
102
116
|
const adapters = this.moduleRef.get(DECAF_ADAPTER_ID);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-module.js","sourceRoot":"","sources":["../../src/core-module.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAEL,MAAM,EACN,MAAM,EACN,MAAM,
|
|
1
|
+
{"version":3,"file":"core-module.js","sourceRoot":"","sources":["../../src/core-module.ts"],"names":[],"mappings":";;;;;;;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G,GAAG,iBAAe,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAChE,MAAM,QAAQ,GACZ,IAAI,CAAC,SAAS,CAAC,GAAG,CAAM,gBAAgB,CAAC,CAAC;QAC5C,KAAK,MAAM,OAAO,IAAI,QAAQ;YAC5B,IAAI,CAAC;gBACH,IAAI,OAAO,EAAE,CAAC;oBACZ,GAAG,CAAC,IAAI,CAAC,iBAAiB,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;oBAChD,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAC;gBAC3B,CAAC;YACH,CAAC;YAAC,OAAO,CAAU,EAAE,CAAC;gBACpB,GAAG,CAAC,KAAK,CAAC,gCAAgC,EAAE,CAAU,CAAC,CAAC;YAC1D,CAAC;IACL,CAAC;CACF,CAAA;AA3HY,eAAe;IAF3B,MAAM,EAAE;IACR,MAAM,CAAC,EAAE,CAAC;IAoBN,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;6CAED,SAAS;GArB5B,eAAe,CA2H3B"}
|
|
@@ -8,10 +8,6 @@ import { Module } from "@nestjs/common";
|
|
|
8
8
|
import { Adapter, ModelService } from "@decaf-ts/core";
|
|
9
9
|
import { Logging } from "@decaf-ts/logging";
|
|
10
10
|
import { FromModelController } from "./FromModelController.js";
|
|
11
|
-
import { AuthInterceptor, DecafRequestHandlerInterceptor } from "./../interceptors/index.js";
|
|
12
|
-
import { APP_INTERCEPTOR } from "@nestjs/core";
|
|
13
|
-
import { DecafHandlerExecutor, DecafRequestContext } from "./../request/index.js";
|
|
14
|
-
import { DECAF_HANDLERS } from "./../constants.js";
|
|
15
11
|
export function getModuleFor(flavour) {
|
|
16
12
|
var DecafModelModule_1;
|
|
17
13
|
let DecafModelModule = class DecafModelModule {
|
|
@@ -39,26 +35,6 @@ export function getModuleFor(flavour) {
|
|
|
39
35
|
module: DecafModelModule_1,
|
|
40
36
|
controllers,
|
|
41
37
|
providers: [
|
|
42
|
-
{
|
|
43
|
-
provide: DECAF_HANDLERS,
|
|
44
|
-
useFactory: () => {
|
|
45
|
-
return (options.handlers?.map((H) => {
|
|
46
|
-
log.info(`Registered request handler: ${H.name}`);
|
|
47
|
-
return new H();
|
|
48
|
-
}) ?? []);
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
AuthInterceptor,
|
|
52
|
-
{
|
|
53
|
-
provide: APP_INTERCEPTOR,
|
|
54
|
-
useExisting: AuthInterceptor,
|
|
55
|
-
},
|
|
56
|
-
DecafRequestContext,
|
|
57
|
-
DecafHandlerExecutor,
|
|
58
|
-
{
|
|
59
|
-
provide: APP_INTERCEPTOR,
|
|
60
|
-
useClass: DecafRequestHandlerInterceptor,
|
|
61
|
-
},
|
|
62
38
|
...modelServices,
|
|
63
39
|
],
|
|
64
40
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DecafModelModule.js","sourceRoot":"","sources":["../../../src/decaf-model/DecafModelModule.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAiB,MAAM,EAAY,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,iCAA8B;
|
|
1
|
+
{"version":3,"file":"DecafModelModule.js","sourceRoot":"","sources":["../../../src/decaf-model/DecafModelModule.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAiB,MAAM,EAAY,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,iCAA8B;AAI5D,MAAM,UAAU,YAAY,CAAC,OAAe;;IAE1C,IAAM,gBAAgB,GAAtB,MAAM,gBAA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MAAM,CAAC,EAAE,CAAC;OACL,gBAAgB,CAyCrB;IACD,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,EAAE;QACtC,KAAK,EAAE,cAAc,OAAO,EAAE;KAC/B,CAAC,CAAC;IACH,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
|
|
@@ -26,4 +26,4 @@ import { Constructor } from "@decaf-ts/decoration";
|
|
|
26
26
|
* }
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
|
-
export declare function Auth(model
|
|
29
|
+
export declare function Auth(model?: string | Constructor): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../../src/decaf-model/decorators/decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE/E,OAAO,EAAE,aAAa,EAAE,6BAAwB;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,gDAA2C;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../../src/decaf-model/decorators/decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE/E,OAAO,EAAE,aAAa,EAAE,6BAAwB;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,gDAA2C;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,IAAI,CAAC,KAA4B;IAC/C,MAAM,QAAQ,GAAG,KAAK;QACpB,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ;YACzB,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,KAAK,CAAC,IAAI;QACd,CAAC,CAAC,SAAS,CAAC;IACd,MAAM,IAAI,GAAG,CAAC,aAAa,EAAE,EAAE,eAAe,CAAC,eAAe,CAAC,CAAC,CAAC;IACjE,IAAI,QAAQ;QAAE,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC9D,OAAO,eAAe,CAAC,GAAG,IAAI,CAAC,CAAC;AAClC,CAAC"}
|
package/lib/esm/index.d.ts
CHANGED
package/lib/esm/index.js
CHANGED
|
@@ -39,7 +39,7 @@ export * from "./events-module/index.js";
|
|
|
39
39
|
* @constant
|
|
40
40
|
* @type {string}
|
|
41
41
|
*/
|
|
42
|
-
export const VERSION = "0.2.
|
|
42
|
+
export const VERSION = "0.2.40";
|
|
43
43
|
export const PACKAGE_NAME = "@decaf-ts/for-nest";
|
|
44
44
|
Metadata.registerLibrary(PACKAGE_NAME, VERSION);
|
|
45
45
|
//# sourceMappingURL=index.js.map
|
|
@@ -7,6 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
+
var DecafRequestHandlerInterceptor_1;
|
|
10
11
|
import { Injectable, Scope, } from "@nestjs/common";
|
|
11
12
|
import { DecafHandlerExecutor, DecafRequestContext } from "./../request/index.js";
|
|
12
13
|
import { Adapter, Context, DefaultAdapterFlags } from "@decaf-ts/core";
|
|
@@ -59,7 +60,7 @@ import { InternalError } from "@decaf-ts/db-decorators";
|
|
|
59
60
|
* Interceptor->>Controller: next.handle()
|
|
60
61
|
* Controller-->>Client: Response
|
|
61
62
|
*/
|
|
62
|
-
let DecafRequestHandlerInterceptor = class DecafRequestHandlerInterceptor {
|
|
63
|
+
let DecafRequestHandlerInterceptor = DecafRequestHandlerInterceptor_1 = class DecafRequestHandlerInterceptor {
|
|
63
64
|
constructor(requestContext, executor) {
|
|
64
65
|
this.requestContext = requestContext;
|
|
65
66
|
this.executor = executor;
|
|
@@ -91,13 +92,18 @@ let DecafRequestHandlerInterceptor = class DecafRequestHandlerInterceptor {
|
|
|
91
92
|
async intercept(context, next) {
|
|
92
93
|
const req = context.switchToHttp().getRequest();
|
|
93
94
|
const res = context.switchToHttp().getResponse();
|
|
95
|
+
const log = Logging.for(DecafRequestHandlerInterceptor_1).for(this.intercept);
|
|
96
|
+
log.debug(`CONTEXT ${this.requestContext.uuid} - request: ${req.method} ${req.url}`);
|
|
94
97
|
const ctx = await this.contextualize(req);
|
|
98
|
+
log.debug(`CONTEXT ${this.requestContext.uuid} contextualized - request: ${req.method} ${req.url}`);
|
|
95
99
|
this.requestContext.applyCtx(ctx);
|
|
100
|
+
log.debug(`CONTEXT ${this.requestContext.uuid} applied - request: ${req.method} ${req.url}`);
|
|
96
101
|
await this.executor.exec(req, res);
|
|
102
|
+
log.debug(`CONTEXT ${this.requestContext.uuid} executors finished - request: ${req.method} ${req.url}`);
|
|
97
103
|
return next.handle();
|
|
98
104
|
}
|
|
99
105
|
};
|
|
100
|
-
DecafRequestHandlerInterceptor = __decorate([
|
|
106
|
+
DecafRequestHandlerInterceptor = DecafRequestHandlerInterceptor_1 = __decorate([
|
|
101
107
|
Injectable({ scope: Scope.REQUEST }),
|
|
102
108
|
__metadata("design:paramtypes", [DecafRequestContext,
|
|
103
109
|
DecafHandlerExecutor])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DecafRequestHandlerInterceptor.js","sourceRoot":"","sources":["../../../src/interceptors/DecafRequestHandlerInterceptor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DecafRequestHandlerInterceptor.js","sourceRoot":"","sources":["../../../src/interceptors/DecafRequestHandlerInterceptor.ts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kC,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,GAAG,EAAE,CAC7F,CAAC;QACF,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;IACvB,CAAC;CACF,CAAA;AA/DY,8BAA8B;IAD1C,UAAU,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;qCAGE,mBAAmB;QACzB,oBAAoB;GAHxC,8BAA8B,CA+D1C"}
|
package/lib/esm/module.js
CHANGED
|
@@ -14,7 +14,7 @@ import { DecafStreamModule } from "./events-module/index.js";
|
|
|
14
14
|
*/
|
|
15
15
|
let DecafModule = DecafModule_1 = class DecafModule {
|
|
16
16
|
static async forRootAsync(options) {
|
|
17
|
-
const { autoControllers, autoServices
|
|
17
|
+
const { autoControllers, autoServices } = options;
|
|
18
18
|
const adapters = await DecafCoreModule.bootPersistence(options);
|
|
19
19
|
const flavours = adapters.map((adapter) => adapter.flavour);
|
|
20
20
|
const imports = [DecafCoreModule.forRoot(options)];
|
|
@@ -22,7 +22,6 @@ let DecafModule = DecafModule_1 = class DecafModule {
|
|
|
22
22
|
flavours.forEach((flavour) => {
|
|
23
23
|
imports.push(getModuleFor(flavour).forRoot(flavour, {
|
|
24
24
|
autoServices,
|
|
25
|
-
handlers,
|
|
26
25
|
}));
|
|
27
26
|
});
|
|
28
27
|
}
|
package/lib/esm/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAmC,MAAM,EAAQ,MAAM,gBAAgB,CAAC;AAE/E,OAAO,EAAE,eAAe,EAAE,yBAAsB;AAEhD,OAAO,EAAE,YAAY,EAAE,+BAA4B;AACnD,OAAO,EAAE,iBAAiB,EAAE,iCAAwB;AAEpD;;GAEG;AAEI,IAAM,WAAW,mBAAjB,MAAM,WAAW;IACtB,MAAM,CAAC,KAAK,CAAC,YAAY,CACvB,OAA2B;QAE3B,MA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E,CAAC;GACE,WAAW,CAsCvB"}
|
|
@@ -10,9 +10,11 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
11
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
12
|
};
|
|
13
|
+
var DecafHandlerExecutor_1;
|
|
13
14
|
import { Inject, Injectable, Scope } from "@nestjs/common";
|
|
14
15
|
import { DecafRequestContext } from "./DecafRequestContext.js";
|
|
15
16
|
import { DECAF_HANDLERS } from "./../constants.js";
|
|
17
|
+
import { Logging } from "@decaf-ts/logging";
|
|
16
18
|
/**
|
|
17
19
|
* @description
|
|
18
20
|
* Executes all registered {@link DecafRequestHandler} instances for the current request,
|
|
@@ -57,18 +59,20 @@ import { DECAF_HANDLERS } from "./../constants.js";
|
|
|
57
59
|
* HandlerB-->>Executor: completed
|
|
58
60
|
* Executor-->>Client: processing finished
|
|
59
61
|
*/
|
|
60
|
-
let DecafHandlerExecutor = class DecafHandlerExecutor {
|
|
62
|
+
let DecafHandlerExecutor = DecafHandlerExecutor_1 = class DecafHandlerExecutor {
|
|
61
63
|
constructor(handlers, context) {
|
|
62
64
|
this.handlers = handlers;
|
|
63
65
|
this.context = context;
|
|
64
66
|
}
|
|
65
67
|
async exec(req, res) {
|
|
68
|
+
const log = Logging.for(DecafHandlerExecutor_1.name).for(this.exec);
|
|
69
|
+
log.debug(`CONTEXT ${this.context.uuid} running ${this.handlers.length} handlers for request ${req.method} ${req.url}`);
|
|
66
70
|
for (const handler of this.handlers) {
|
|
67
71
|
await handler.handle(this.context, req, res);
|
|
68
72
|
}
|
|
69
73
|
}
|
|
70
74
|
};
|
|
71
|
-
DecafHandlerExecutor = __decorate([
|
|
75
|
+
DecafHandlerExecutor = DecafHandlerExecutor_1 = __decorate([
|
|
72
76
|
Injectable({ scope: Scope.REQUEST }),
|
|
73
77
|
__param(0, Inject(DECAF_HANDLERS)),
|
|
74
78
|
__metadata("design:paramtypes", [Array, DecafRequestContext])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DecafHandlerExecutor.js","sourceRoot":"","sources":["../../../src/request/DecafHandlerExecutor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DecafHandlerExecutor.js","sourceRoot":"","sources":["../../../src/request/DecafHandlerExecutor.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,iCAA8B;AAE5D,OAAO,EAAE,cAAc,EAAE,0BAAqB;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEI,IAAM,oBAAoB,4BAA1B,MAAM,oBAAoB;IAC/B,YAC2C,QAA+B,EACvD,OAA4B;QADJ,aAAQ,GAAR,QAAQ,CAAuB;QACvD,YAAO,GAAP,OAAO,CAAqB;IAC5C,CAAC;IAEJ,KAAK,CAAC,IAAI,CAAC,GAAY,EAAE,GAAa;QACpC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,sBAAoB,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClE,GAAG,CAAC,KAAK,CACP,WAAW,IAAI,CAAC,OAAO,CAAC,IAAI,YAAY,IAAI,CAAC,QAAQ,CAAC,MAAM,yBAAyB,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,GAAG,EAAE,CAC7G,CAAC;QACF,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACpC,MAAM,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;CACF,CAAA;AAfY,oBAAoB;IADhC,UAAU,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;IAGhC,WAAA,MAAM,CAAC,cAAc,CAAC,CAAA;4CACG,mBAAmB;GAHpC,oBAAoB,CAehC"}
|
package/lib/index.cjs
CHANGED
|
@@ -56,7 +56,7 @@ __exportStar(require("./events-module/index.cjs"), exports);
|
|
|
56
56
|
* @constant
|
|
57
57
|
* @type {string}
|
|
58
58
|
*/
|
|
59
|
-
exports.VERSION = "0.2.
|
|
59
|
+
exports.VERSION = "0.2.40";
|
|
60
60
|
exports.PACKAGE_NAME = "@decaf-ts/for-nest";
|
|
61
61
|
decoration_1.Metadata.registerLibrary(exports.PACKAGE_NAME, exports.VERSION);
|
|
62
62
|
//# sourceMappingURL=index.js.map
|
package/lib/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ 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 DecafRequestHandlerInterceptor_1;
|
|
11
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
13
|
exports.DecafRequestHandlerInterceptor = void 0;
|
|
13
14
|
const common_1 = require("@nestjs/common");
|
|
@@ -62,7 +63,7 @@ const db_decorators_1 = require("@decaf-ts/db-decorators");
|
|
|
62
63
|
* Interceptor->>Controller: next.handle()
|
|
63
64
|
* Controller-->>Client: Response
|
|
64
65
|
*/
|
|
65
|
-
let DecafRequestHandlerInterceptor = class DecafRequestHandlerInterceptor {
|
|
66
|
+
let DecafRequestHandlerInterceptor = DecafRequestHandlerInterceptor_1 = class DecafRequestHandlerInterceptor {
|
|
66
67
|
constructor(requestContext, executor) {
|
|
67
68
|
this.requestContext = requestContext;
|
|
68
69
|
this.executor = executor;
|
|
@@ -94,14 +95,19 @@ let DecafRequestHandlerInterceptor = class DecafRequestHandlerInterceptor {
|
|
|
94
95
|
async intercept(context, next) {
|
|
95
96
|
const req = context.switchToHttp().getRequest();
|
|
96
97
|
const res = context.switchToHttp().getResponse();
|
|
98
|
+
const log = logging_1.Logging.for(DecafRequestHandlerInterceptor_1).for(this.intercept);
|
|
99
|
+
log.debug(`CONTEXT ${this.requestContext.uuid} - request: ${req.method} ${req.url}`);
|
|
97
100
|
const ctx = await this.contextualize(req);
|
|
101
|
+
log.debug(`CONTEXT ${this.requestContext.uuid} contextualized - request: ${req.method} ${req.url}`);
|
|
98
102
|
this.requestContext.applyCtx(ctx);
|
|
103
|
+
log.debug(`CONTEXT ${this.requestContext.uuid} applied - request: ${req.method} ${req.url}`);
|
|
99
104
|
await this.executor.exec(req, res);
|
|
105
|
+
log.debug(`CONTEXT ${this.requestContext.uuid} executors finished - request: ${req.method} ${req.url}`);
|
|
100
106
|
return next.handle();
|
|
101
107
|
}
|
|
102
108
|
};
|
|
103
109
|
exports.DecafRequestHandlerInterceptor = DecafRequestHandlerInterceptor;
|
|
104
|
-
exports.DecafRequestHandlerInterceptor = DecafRequestHandlerInterceptor = __decorate([
|
|
110
|
+
exports.DecafRequestHandlerInterceptor = DecafRequestHandlerInterceptor = DecafRequestHandlerInterceptor_1 = __decorate([
|
|
105
111
|
(0, common_1.Injectable)({ scope: common_1.Scope.REQUEST }),
|
|
106
112
|
__metadata("design:paramtypes", [request_1.DecafRequestContext,
|
|
107
113
|
request_1.DecafHandlerExecutor])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DecafRequestHandlerInterceptor.js","sourceRoot":"","sources":["../../src/interceptors/DecafRequestHandlerInterceptor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DecafRequestHandlerInterceptor.js","sourceRoot":"","sources":["../../src/interceptors/DecafRequestHandlerInterceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAMwB;AACxB,oDAAuE;AACvE,yCAAuE;AAEvE,oCAAsB;AACtB,+CAA4C;AA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-17,7 +17,7 @@ const events_module_1 = require("./events-module/index.cjs");
|
|
|
17
17
|
*/
|
|
18
18
|
let DecafModule = DecafModule_1 = class DecafModule {
|
|
19
19
|
static async forRootAsync(options) {
|
|
20
|
-
const { autoControllers, autoServices
|
|
20
|
+
const { autoControllers, autoServices } = options;
|
|
21
21
|
const adapters = await core_module_1.DecafCoreModule.bootPersistence(options);
|
|
22
22
|
const flavours = adapters.map((adapter) => adapter.flavour);
|
|
23
23
|
const imports = [core_module_1.DecafCoreModule.forRoot(options)];
|
|
@@ -25,7 +25,6 @@ let DecafModule = DecafModule_1 = class DecafModule {
|
|
|
25
25
|
flavours.forEach((flavour) => {
|
|
26
26
|
imports.push((0, index_1.getModuleFor)(flavour).forRoot(flavour, {
|
|
27
27
|
autoServices,
|
|
28
|
-
handlers,
|
|
29
28
|
}));
|
|
30
29
|
});
|
|
31
30
|
}
|
package/lib/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAA+E;AAE/E,mDAAgD;AAEhD,mDAAmD;AACnD,6DAAoD;AAEpD;;GAEG;AAEI,IAAM,WAAW,mBAAjB,MAAM,WAAW;IACtB,MAAM,CAAC,KAAK,CAAC,YAAY,CACvB,OAA2B;QAE3B,MAAM,EAAE,eAAe,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAA+E;AAE/E,mDAAgD;AAEhD,mDAAmD;AACnD,6DAAoD;AAEpD;;GAEG;AAEI,IAAM,WAAW,mBAAjB,MAAM,WAAW;IACtB,MAAM,CAAC,KAAK,CAAC,YAAY,CACvB,OAA2B;QAE3B,MAAM,EAAE,eAAe,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;QAElD,MAAM,QAAQ,GACZ,MAAM,6BAAe,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QACjD,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAE5D,MAAM,OAAO,GAOG,CAAC,6BAAe,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QAEnD,IAAI,eAAe,EAAE,CAAC;YACpB,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBAC3B,OAAO,CAAC,IAAI,CACV,IAAA,oBAAY,EAAC,OAAO,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE;oBACrC,YAAY;iBACb,CAAC,CACH,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;QAED,IAAI,OAAO,CAAC,eAAe,EAAE,oBAAoB,EAAE,CAAC;YAClD,OAAO,CAAC,IAAI,CAAC,iCAAiB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;QACxD,CAAC;QAED,OAAO;YACL,MAAM,EAAE,aAAW;YACnB,OAAO,EAAE,OAAO;SACjB,CAAC;IACJ,CAAC;CACF,CAAA;AAtCY,kCAAW;sBAAX,WAAW;IADvB,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,WAAW,CAsCvB"}
|
|
@@ -11,11 +11,13 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
|
+
var DecafHandlerExecutor_1;
|
|
14
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
16
|
exports.DecafHandlerExecutor = void 0;
|
|
16
17
|
const common_1 = require("@nestjs/common");
|
|
17
18
|
const DecafRequestContext_1 = require("./DecafRequestContext.cjs");
|
|
18
19
|
const constants_1 = require("./../constants.cjs");
|
|
20
|
+
const logging_1 = require("@decaf-ts/logging");
|
|
19
21
|
/**
|
|
20
22
|
* @description
|
|
21
23
|
* Executes all registered {@link DecafRequestHandler} instances for the current request,
|
|
@@ -60,19 +62,21 @@ const constants_1 = require("./../constants.cjs");
|
|
|
60
62
|
* HandlerB-->>Executor: completed
|
|
61
63
|
* Executor-->>Client: processing finished
|
|
62
64
|
*/
|
|
63
|
-
let DecafHandlerExecutor = class DecafHandlerExecutor {
|
|
65
|
+
let DecafHandlerExecutor = DecafHandlerExecutor_1 = class DecafHandlerExecutor {
|
|
64
66
|
constructor(handlers, context) {
|
|
65
67
|
this.handlers = handlers;
|
|
66
68
|
this.context = context;
|
|
67
69
|
}
|
|
68
70
|
async exec(req, res) {
|
|
71
|
+
const log = logging_1.Logging.for(DecafHandlerExecutor_1.name).for(this.exec);
|
|
72
|
+
log.debug(`CONTEXT ${this.context.uuid} running ${this.handlers.length} handlers for request ${req.method} ${req.url}`);
|
|
69
73
|
for (const handler of this.handlers) {
|
|
70
74
|
await handler.handle(this.context, req, res);
|
|
71
75
|
}
|
|
72
76
|
}
|
|
73
77
|
};
|
|
74
78
|
exports.DecafHandlerExecutor = DecafHandlerExecutor;
|
|
75
|
-
exports.DecafHandlerExecutor = DecafHandlerExecutor = __decorate([
|
|
79
|
+
exports.DecafHandlerExecutor = DecafHandlerExecutor = DecafHandlerExecutor_1 = __decorate([
|
|
76
80
|
(0, common_1.Injectable)({ scope: common_1.Scope.REQUEST }),
|
|
77
81
|
__param(0, (0, common_1.Inject)(constants_1.DECAF_HANDLERS)),
|
|
78
82
|
__metadata("design:paramtypes", [Array, DecafRequestContext_1.DecafRequestContext])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DecafHandlerExecutor.js","sourceRoot":"","sources":["../../src/request/DecafHandlerExecutor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DecafHandlerExecutor.js","sourceRoot":"","sources":["../../src/request/DecafHandlerExecutor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA2D;AAC3D,mEAA4D;AAE5D,kDAA8C;AAC9C,+CAA4C;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEI,IAAM,oBAAoB,4BAA1B,MAAM,oBAAoB;IAC/B,YAC2C,QAA+B,EACvD,OAA4B;QADJ,aAAQ,GAAR,QAAQ,CAAuB;QACvD,YAAO,GAAP,OAAO,CAAqB;IAC5C,CAAC;IAEJ,KAAK,CAAC,IAAI,CAAC,GAAY,EAAE,GAAa;QACpC,MAAM,GAAG,GAAG,iBAAO,CAAC,GAAG,CAAC,sBAAoB,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClE,GAAG,CAAC,KAAK,CACP,WAAW,IAAI,CAAC,OAAO,CAAC,IAAI,YAAY,IAAI,CAAC,QAAQ,CAAC,MAAM,yBAAyB,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,GAAG,EAAE,CAC7G,CAAC;QACF,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACpC,MAAM,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;CACF,CAAA;AAfY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,mBAAU,EAAC,EAAE,KAAK,EAAE,cAAK,CAAC,OAAO,EAAE,CAAC;IAGhC,WAAA,IAAA,eAAM,EAAC,0BAAc,CAAC,CAAA;4CACG,yCAAmB;GAHpC,oBAAoB,CAehC"}
|