@tstdl/base 0.71.64 → 0.71.67
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/application/application.d.ts +4 -3
- package/application/application.js +20 -8
- package/application/application.js.map +1 -1
- package/examples/reflection/basic.d.ts +11 -0
- package/examples/reflection/basic.js +69 -0
- package/examples/reflection/basic.js.map +1 -0
- package/image-service/image-service.d.ts +1 -1
- package/module/modules/function.module.d.ts +10 -0
- package/module/modules/function.module.js +16 -0
- package/module/modules/function.module.js.map +1 -0
- package/module/modules/index.d.ts +1 -0
- package/module/modules/index.js +1 -0
- package/module/modules/index.js.map +1 -1
- package/package.json +11 -11
- package/reflection/decorator-data.d.ts +47 -0
- package/reflection/decorator-data.js +68 -0
- package/reflection/decorator-data.js.map +1 -0
- package/reflection/decorators.d.ts +12 -0
- package/reflection/decorators.js +43 -0
- package/reflection/decorators.js.map +1 -0
- package/reflection/index.d.ts +4 -0
- package/reflection/index.js +21 -0
- package/reflection/index.js.map +1 -0
- package/reflection/registry.d.ts +42 -0
- package/reflection/registry.js +95 -0
- package/reflection/registry.js.map +1 -0
- package/reflection/utils.d.ts +27 -0
- package/reflection/utils.js +115 -0
- package/reflection/utils.js.map +1 -0
- package/schema/schemas/object.js +1 -1
- package/schema/schemas/object.js.map +1 -1
- package/search-index/elastic/index.d.ts +1 -0
- package/search-index/elastic/index.js +1 -0
- package/search-index/elastic/index.js.map +1 -1
- package/search-index/elastic/keyword-rewriter.d.ts +8 -0
- package/search-index/elastic/keyword-rewriter.js +22 -0
- package/search-index/elastic/keyword-rewriter.js.map +1 -0
- package/search-index/elastic/search-index.d.ts +4 -2
- package/search-index/elastic/search-index.js +14 -3
- package/search-index/elastic/search-index.js.map +1 -1
- package/search-index/elastic/sort-converter.d.ts +2 -1
- package/search-index/elastic/sort-converter.js +2 -3
- package/search-index/elastic/sort-converter.js.map +1 -1
- package/search-index/memory/memory-search-index.d.ts +1 -0
- package/search-index/memory/memory-search-index.js +4 -0
- package/search-index/memory/memory-search-index.js.map +1 -1
- package/search-index/search-index.d.ts +1 -0
- package/search-index/search-index.js.map +1 -1
- package/types.d.ts +8 -3
- package/utils/type-guards.d.ts +3 -3
- package/utils/type-guards.js.map +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Logger } from "../logger";
|
|
2
2
|
import type { Module } from "../module";
|
|
3
|
-
import type {
|
|
3
|
+
import type { FunctionModuleFunction } from "../module/modules";
|
|
4
|
+
import type { OneOrMany, Type } from "../types";
|
|
4
5
|
export declare class Application {
|
|
5
6
|
private static _instance;
|
|
6
7
|
private static get instance();
|
|
@@ -11,10 +12,10 @@ export declare class Application {
|
|
|
11
12
|
constructor(logger: Logger);
|
|
12
13
|
static registerModule(moduleType: Type<Module>): void;
|
|
13
14
|
static registerModuleInstance(module: Module): void;
|
|
14
|
-
static run(): Promise<void>;
|
|
15
|
+
static run(...functions: OneOrMany<FunctionModuleFunction>[]): Promise<void>;
|
|
15
16
|
static shutdown(): Promise<void>;
|
|
16
17
|
registerModule(moduleType: Type<Module>): void;
|
|
17
18
|
registerModuleInstance(module: Module): void;
|
|
18
|
-
run(): Promise<void>;
|
|
19
|
+
run(...functions: OneOrMany<FunctionModuleFunction>[]): Promise<void>;
|
|
19
20
|
shutdown(): Promise<void>;
|
|
20
21
|
}
|
|
@@ -17,6 +17,8 @@ exports.Application = void 0;
|
|
|
17
17
|
const container_1 = require("../container");
|
|
18
18
|
const core_1 = require("../core");
|
|
19
19
|
const logger_1 = require("../logger");
|
|
20
|
+
const module_1 = require("../module");
|
|
21
|
+
const modules_1 = require("../module/modules");
|
|
20
22
|
const process_shutdown_1 = require("../process-shutdown");
|
|
21
23
|
const promise_1 = require("../promise");
|
|
22
24
|
const async_iterable_helpers_1 = require("../utils/async-iterable-helpers");
|
|
@@ -41,8 +43,8 @@ let Application = Application_1 = class Application {
|
|
|
41
43
|
static registerModuleInstance(module) {
|
|
42
44
|
Application_1.instance.registerModuleInstance(module);
|
|
43
45
|
}
|
|
44
|
-
static async run() {
|
|
45
|
-
await Application_1.instance.run();
|
|
46
|
+
static async run(...functions) {
|
|
47
|
+
await Application_1.instance.run(...functions);
|
|
46
48
|
}
|
|
47
49
|
static async shutdown() {
|
|
48
50
|
await Application_1.instance.shutdown();
|
|
@@ -53,7 +55,11 @@ let Application = Application_1 = class Application {
|
|
|
53
55
|
registerModuleInstance(module) {
|
|
54
56
|
this.moduleInstances.add(module);
|
|
55
57
|
}
|
|
56
|
-
async run() {
|
|
58
|
+
async run(...functions) {
|
|
59
|
+
for (const fn of functions.flatMap((fns) => fns)) {
|
|
60
|
+
const module = new modules_1.FunctionModule(fn);
|
|
61
|
+
this.registerModuleInstance(module);
|
|
62
|
+
}
|
|
57
63
|
const resolvedModules = await (0, async_iterable_helpers_1.toArrayAsync)((0, async_iterable_helpers_1.mapAsync)(this.moduleTypes, async (type) => container_1.container.resolveAsync(type)));
|
|
58
64
|
const modules = [...resolvedModules, ...this.moduleInstances];
|
|
59
65
|
try {
|
|
@@ -69,12 +75,12 @@ let Application = Application_1 = class Application {
|
|
|
69
75
|
(0, process_shutdown_1.requestShutdown)();
|
|
70
76
|
await stopModules(modules, this.logger);
|
|
71
77
|
await (0, core_1.disposeInstances)();
|
|
72
|
-
this.logger.info('
|
|
78
|
+
this.logger.info('Bye');
|
|
73
79
|
}
|
|
74
80
|
this.shutdownPromise.resolve();
|
|
75
81
|
}
|
|
76
82
|
async shutdown() {
|
|
77
|
-
this.logger.info('
|
|
83
|
+
this.logger.info('Shutting down');
|
|
78
84
|
(0, process_shutdown_1.requestShutdown)();
|
|
79
85
|
await this.shutdownPromise;
|
|
80
86
|
}
|
|
@@ -88,7 +94,7 @@ exports.Application = Application;
|
|
|
88
94
|
async function runModules(modules, logger) {
|
|
89
95
|
const promises = modules.map(async (module) => {
|
|
90
96
|
if (logger != undefined) {
|
|
91
|
-
logger.verbose(`
|
|
97
|
+
logger.verbose(`Starting module ${module.name}`);
|
|
92
98
|
}
|
|
93
99
|
await module.run();
|
|
94
100
|
});
|
|
@@ -96,12 +102,18 @@ async function runModules(modules, logger) {
|
|
|
96
102
|
}
|
|
97
103
|
async function stopModules(modules, logger) {
|
|
98
104
|
const promises = modules.map(async (module) => {
|
|
105
|
+
if (module.state == module_1.ModuleState.Stopped) {
|
|
106
|
+
if (logger != undefined) {
|
|
107
|
+
logger.verbose(`Module ${module.name} already stopped`);
|
|
108
|
+
}
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
99
111
|
if (logger != undefined) {
|
|
100
|
-
logger.verbose(`
|
|
112
|
+
logger.verbose(`Stopping module ${module.name}`);
|
|
101
113
|
}
|
|
102
114
|
await module.stop();
|
|
103
115
|
if (logger != undefined) {
|
|
104
|
-
logger.verbose(`
|
|
116
|
+
logger.verbose(`Stopped module ${module.name}`);
|
|
105
117
|
}
|
|
106
118
|
});
|
|
107
119
|
await Promise.all(promises);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.js","sourceRoot":"","sources":["../../source/application/application.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA+D;AAC/D,kCAA0C;AAE1C,sCAAkC;AAElC,0DAAuF;AACvF,wCAA4C;AAE5C,4EAAwE;AACxE,sDAAkD;AAElD,IAAA,oCAAiB,GAAE,CAAC;AAGpB,IAAa,WAAW,mBAAxB,MAAa,WAAW;IAgBtB,YAA+C,MAAc;QAC3D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,IAAI,CAAC,WAAW,GAAG,IAAI,GAAG,EAAE,CAAC;QAC7B,IAAI,CAAC,eAAe,GAAG,IAAI,GAAG,EAAE,CAAC;QACjC,IAAI,CAAC,eAAe,GAAG,IAAI,yBAAe,EAAE,CAAC;IAC/C,CAAC;IAnBO,MAAM,KAAK,QAAQ;QACzB,IAAI,IAAA,yBAAW,EAAC,IAAI,CAAC,SAAS,CAAC,EAAE;YAC/B,IAAI,CAAC,SAAS,GAAG,qBAAS,CAAC,OA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AAM,CAAC,KAAK,IAAI,oBAAW,CAAC,OAAO,EAAE;YACvC,IAAI,MAAM,IAAI,SAAS,EAAE;gBACvB,MAAM,CAAC,OAAO,CAAC,UAAU,MAAM,CAAC,IAAI,kBAAkB,CAAC,CAAC;aACzD;YAED,OAAO;SACR;QAED,IAAI,MAAM,IAAI,SAAS,EAAE;YACvB,MAAM,CAAC,OAAO,CAAC,mBAAmB,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;SAClD;QAED,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QAEpB,IAAI,MAAM,IAAI,SAAS,EAAE;YACvB,MAAM,CAAC,OAAO,CAAC,kBAAkB,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;SACjD;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReflectionRegistry } from "../../reflection";
|
|
2
|
+
export declare class Foo {
|
|
3
|
+
private readonly registry;
|
|
4
|
+
get someGetter(): number;
|
|
5
|
+
static get someStaticGetter(): number;
|
|
6
|
+
someProperty: number;
|
|
7
|
+
static someStaticProperty: number;
|
|
8
|
+
constructor(registry: ReflectionRegistry);
|
|
9
|
+
static someStaticMethod(_parameter: string): void;
|
|
10
|
+
someMethod(_parameter: bigint): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
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.Foo = void 0;
|
|
16
|
+
const reflection_1 = require("../../reflection");
|
|
17
|
+
let Foo = class Foo {
|
|
18
|
+
constructor(registry) {
|
|
19
|
+
this.registry = registry;
|
|
20
|
+
}
|
|
21
|
+
get someGetter() {
|
|
22
|
+
return 5;
|
|
23
|
+
}
|
|
24
|
+
static get someStaticGetter() {
|
|
25
|
+
return 5;
|
|
26
|
+
}
|
|
27
|
+
static someStaticMethod(_parameter) { }
|
|
28
|
+
someMethod(_parameter) { }
|
|
29
|
+
};
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, reflection_1.Accessor)(),
|
|
32
|
+
__metadata("design:type", Number),
|
|
33
|
+
__metadata("design:paramtypes", [])
|
|
34
|
+
], Foo.prototype, "someGetter", null);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, reflection_1.Property)(),
|
|
37
|
+
__metadata("design:type", Number)
|
|
38
|
+
], Foo.prototype, "someProperty", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, reflection_1.Method)(),
|
|
41
|
+
__param(0, (0, reflection_1.Parameter)()),
|
|
42
|
+
__metadata("design:type", Function),
|
|
43
|
+
__metadata("design:paramtypes", [typeof BigInt === "function" ? BigInt : Object]),
|
|
44
|
+
__metadata("design:returntype", void 0)
|
|
45
|
+
], Foo.prototype, "someMethod", null);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, reflection_1.Accessor)(),
|
|
48
|
+
__metadata("design:type", Number),
|
|
49
|
+
__metadata("design:paramtypes", [])
|
|
50
|
+
], Foo, "someStaticGetter", null);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, reflection_1.Property)(),
|
|
53
|
+
__metadata("design:type", Number)
|
|
54
|
+
], Foo, "someStaticProperty", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, reflection_1.Method)(),
|
|
57
|
+
__param(0, (0, reflection_1.Parameter)()),
|
|
58
|
+
__metadata("design:type", Function),
|
|
59
|
+
__metadata("design:paramtypes", [String]),
|
|
60
|
+
__metadata("design:returntype", void 0)
|
|
61
|
+
], Foo, "someStaticMethod", null);
|
|
62
|
+
Foo = __decorate([
|
|
63
|
+
(0, reflection_1.Class)(undefined, { data: { tableName: 'foos' } }),
|
|
64
|
+
__param(0, (0, reflection_1.Parameter)()),
|
|
65
|
+
__metadata("design:paramtypes", [reflection_1.ReflectionRegistry])
|
|
66
|
+
], Foo);
|
|
67
|
+
exports.Foo = Foo;
|
|
68
|
+
(0, reflection_1.printType)(Foo);
|
|
69
|
+
//# sourceMappingURL=basic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"basic.js","sourceRoot":"","sources":["../../../source/examples/reflection/basic.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,iDAA2G;AAI3G,IAAa,GAAG,GAAhB,MAAa,GAAG;IAmBd,YAAyB,QAA4B;QACnD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAjBD,IAAI,UAAU;QACZ,OAAO,CAAC,CAAC;IACX,CAAC;IAGD,MAAM,KAAK,gBAAgB;QACzB,OAAO,CAAC,CAAC;IACX,CAAC;IAaD,MAAM,CAAC,gBAAgB,CAAc,UAAkB,IAAU,CAAC;IAGlE,UAAU,CAAc,UAAkB,IAAU,CAAC;CACtD,CAAA;AAxBC;IADC,IAAA,qBAAQ,GAAE;;;qCAGV;AAQD;IADC,IAAA,qBAAQ,GAAE;;yCACU;AAarB;IADC,IAAA,mBAAM,GAAE;IACG,WAAA,IAAA,sBAAS,GAAE,CAAA;;;;qCAA8B;AAlBrD;IADC,IAAA,qBAAQ,GAAE;;;iCAGV;AAMD;IADC,IAAA,qBAAQ,GAAE;;qCACuB;AAOlC;IADC,IAAA,mBAAM,GAAE;IACgB,WAAA,IAAA,sBAAS,GAAE,CAAA;;;;iCAA8B;AAxBvD,GAAG;IADf,IAAA,kBAAK,EAAC,SAAS,EAAE,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC;IAoBnC,WAAA,IAAA,sBAAS,GAAE,CAAA;qCAAW,+BAAkB;GAnB1C,GAAG,CA4Bf;AA5BY,kBAAG;AA8BhB,IAAA,sBAAS,EAAC,GAAG,CAAC,CAAC"}
|
|
@@ -27,8 +27,8 @@ export declare const imageFormatSchema: import("superstruct").Struct<"png" | "jp
|
|
|
27
27
|
export declare type ImageFormat = Infer<typeof imageFormatSchema>;
|
|
28
28
|
export declare const imageOptionsSchema: import("superstruct").Struct<{
|
|
29
29
|
origin?: "center" | "smart" | "top" | "left" | "right" | "bottom" | "topleft" | "topright" | "bottomleft" | "bottomright" | undefined;
|
|
30
|
-
width?: number | undefined;
|
|
31
30
|
height?: number | undefined;
|
|
31
|
+
width?: number | undefined;
|
|
32
32
|
format?: "png" | "jpg" | "jpeg" | "webp" | "avif" | undefined;
|
|
33
33
|
resizeMode?: "fill" | "fit" | undefined;
|
|
34
34
|
quality?: number | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReadonlyCancellationToken } from "../../utils/cancellation-token";
|
|
2
|
+
import type { Module } from '../module';
|
|
3
|
+
import { ModuleBase } from '../module-base';
|
|
4
|
+
export declare type FunctionModuleFunction = (cancellationToken: ReadonlyCancellationToken) => void | Promise<void>;
|
|
5
|
+
export declare class FunctionModule extends ModuleBase implements Module {
|
|
6
|
+
private readonly fn;
|
|
7
|
+
readonly metrics: {};
|
|
8
|
+
constructor(fn: FunctionModuleFunction, name?: string);
|
|
9
|
+
protected _run(cancellationToken: ReadonlyCancellationToken): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FunctionModule = void 0;
|
|
4
|
+
const module_base_1 = require("../module-base");
|
|
5
|
+
class FunctionModule extends module_base_1.ModuleBase {
|
|
6
|
+
constructor(fn, name = fn.name) {
|
|
7
|
+
super(name);
|
|
8
|
+
this.metrics = {};
|
|
9
|
+
this.fn = fn;
|
|
10
|
+
}
|
|
11
|
+
async _run(cancellationToken) {
|
|
12
|
+
return this.fn(cancellationToken);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.FunctionModule = FunctionModule;
|
|
16
|
+
//# sourceMappingURL=function.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function.module.js","sourceRoot":"","sources":["../../../source/module/modules/function.module.ts"],"names":[],"mappings":";;;AAEA,gDAA4C;AAI5C,MAAa,cAAe,SAAQ,wBAAU;IAK5C,YAAY,EAA0B,EAAE,OAAe,EAAE,CAAC,IAAI;QAC5D,KAAK,CAAC,IAAI,CAAC,CAAC;QAHL,YAAO,GAAG,EAAE,CAAC;QAKpB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;IAES,KAAK,CAAC,IAAI,CAAC,iBAA4C;QAC/D,OAAO,IAAI,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC;IACpC,CAAC;CACF;AAdD,wCAcC"}
|
package/module/modules/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./function.module"), exports);
|
|
17
18
|
__exportStar(require("./old-web-server.module"), exports);
|
|
18
19
|
__exportStar(require("./web-server.module"), exports);
|
|
19
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/module/modules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,sDAAoC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/module/modules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,0DAAwC;AACxC,sDAAoC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tstdl/base",
|
|
3
|
-
"version": "0.71.
|
|
3
|
+
"version": "0.71.67",
|
|
4
4
|
"author": "Patrick Hein",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -15,25 +15,25 @@
|
|
|
15
15
|
"pub": "npm run build:prod && rm -vf dist/test* && npm publish dist/"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"luxon": "^2",
|
|
18
|
+
"luxon": "^2.4",
|
|
19
19
|
"reflect-metadata": "^0.1",
|
|
20
|
-
"rxjs": "^7",
|
|
21
|
-
"type-fest": "^2"
|
|
20
|
+
"rxjs": "^7.5",
|
|
21
|
+
"type-fest": "^2.14"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@types/chroma-js": "
|
|
24
|
+
"@types/chroma-js": "2.1",
|
|
25
25
|
"@types/koa__router": "8.0",
|
|
26
26
|
"@types/luxon": "2.3",
|
|
27
27
|
"@types/minio": "7.0",
|
|
28
28
|
"@types/mjml": "4.7",
|
|
29
|
-
"@types/node": "
|
|
30
|
-
"@types/nodemailer": "
|
|
29
|
+
"@types/node": "18",
|
|
30
|
+
"@types/nodemailer": "6.4",
|
|
31
31
|
"@types/yup": "0.29",
|
|
32
|
-
"@typescript-eslint/eslint-plugin": "5
|
|
33
|
-
"@typescript-eslint/parser": "5
|
|
32
|
+
"@typescript-eslint/eslint-plugin": "5",
|
|
33
|
+
"@typescript-eslint/parser": "5",
|
|
34
34
|
"eslint": "8.18",
|
|
35
35
|
"ttypescript": "1.5",
|
|
36
|
-
"typedoc": "0.
|
|
36
|
+
"typedoc": "0.23",
|
|
37
37
|
"typescript": "4.7",
|
|
38
38
|
"typescript-transform-paths": "3.3"
|
|
39
39
|
},
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"mjml": "^4.12",
|
|
50
50
|
"mongodb": "^4.7",
|
|
51
51
|
"nodemailer": "^6.7",
|
|
52
|
-
"puppeteer": "^
|
|
52
|
+
"puppeteer": "^15.1",
|
|
53
53
|
"superstruct": "^0.16",
|
|
54
54
|
"undici": "^5.5",
|
|
55
55
|
"urlpattern-polyfill": "^4.0"
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Constructor } from "../types";
|
|
2
|
+
export declare type ClassDecoratorData = {
|
|
3
|
+
type: 'class';
|
|
4
|
+
constructor: Constructor;
|
|
5
|
+
prototype: object;
|
|
6
|
+
};
|
|
7
|
+
export declare type PropertyDecoratorData = {
|
|
8
|
+
type: 'property';
|
|
9
|
+
constructor: Constructor;
|
|
10
|
+
prototype: object;
|
|
11
|
+
static: boolean;
|
|
12
|
+
propertyKey: string | symbol;
|
|
13
|
+
};
|
|
14
|
+
export declare type AccessorDecoratorData = {
|
|
15
|
+
type: 'accessor';
|
|
16
|
+
constructor: Constructor;
|
|
17
|
+
prototype: object;
|
|
18
|
+
static: boolean;
|
|
19
|
+
propertyKey: string | symbol;
|
|
20
|
+
descriptor: PropertyDescriptor;
|
|
21
|
+
};
|
|
22
|
+
export declare type PropertyOrAccessorDecoratorData = PropertyDecoratorData | AccessorDecoratorData;
|
|
23
|
+
export declare type MethodDecoratorData = {
|
|
24
|
+
type: 'method';
|
|
25
|
+
constructor: Constructor;
|
|
26
|
+
prototype: object;
|
|
27
|
+
static: boolean;
|
|
28
|
+
methodKey: string | symbol;
|
|
29
|
+
descriptor: PropertyDescriptor;
|
|
30
|
+
};
|
|
31
|
+
export declare type MethodParameterDecoratorData = {
|
|
32
|
+
type: 'parameter';
|
|
33
|
+
constructor: Constructor;
|
|
34
|
+
prototype: object;
|
|
35
|
+
static: boolean;
|
|
36
|
+
methodKey: string | symbol;
|
|
37
|
+
index: number;
|
|
38
|
+
};
|
|
39
|
+
export declare type ConstructorParameterDecoratorData = {
|
|
40
|
+
type: 'constructor-parameter';
|
|
41
|
+
constructor: Constructor;
|
|
42
|
+
prototype: object;
|
|
43
|
+
index: number;
|
|
44
|
+
};
|
|
45
|
+
export declare type ParameterDecoratorData = MethodParameterDecoratorData | ConstructorParameterDecoratorData;
|
|
46
|
+
export declare type DecoratorData = ClassDecoratorData | PropertyDecoratorData | AccessorDecoratorData | MethodDecoratorData | ParameterDecoratorData;
|
|
47
|
+
export declare function getDecoratorData(target: object, propertyKey?: string | symbol, descriptorOrParameterIndex?: PropertyDescriptor | number): DecoratorData;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDecoratorData = void 0;
|
|
4
|
+
const type_guards_1 = require("../utils/type-guards");
|
|
5
|
+
const utils_1 = require("./utils");
|
|
6
|
+
// eslint-disable-next-line max-lines-per-function
|
|
7
|
+
function getDecoratorData(target, propertyKey, descriptorOrParameterIndex) {
|
|
8
|
+
const constructor = (0, utils_1.getConstructor)(target);
|
|
9
|
+
const prototype = constructor.prototype;
|
|
10
|
+
const isStatic = typeof target == 'function';
|
|
11
|
+
if ((0, type_guards_1.isUndefined)(propertyKey) && (0, type_guards_1.isUndefined)(descriptorOrParameterIndex)) {
|
|
12
|
+
return {
|
|
13
|
+
type: 'class',
|
|
14
|
+
constructor,
|
|
15
|
+
prototype
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
else if ((0, type_guards_1.isDefined)(propertyKey) && (0, type_guards_1.isUndefined)(descriptorOrParameterIndex)) {
|
|
19
|
+
return {
|
|
20
|
+
type: 'property',
|
|
21
|
+
constructor,
|
|
22
|
+
prototype,
|
|
23
|
+
static: isStatic,
|
|
24
|
+
propertyKey
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
else if ((0, type_guards_1.isDefined)(propertyKey) && (0, type_guards_1.isObject)(descriptorOrParameterIndex) && ((0, type_guards_1.isFunction)(descriptorOrParameterIndex.get ?? descriptorOrParameterIndex.set))) { // eslint-disable-line @typescript-eslint/unbound-method
|
|
28
|
+
return {
|
|
29
|
+
type: 'accessor',
|
|
30
|
+
constructor,
|
|
31
|
+
prototype,
|
|
32
|
+
static: isStatic,
|
|
33
|
+
propertyKey,
|
|
34
|
+
descriptor: descriptorOrParameterIndex
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
else if ((0, type_guards_1.isDefined)(propertyKey) && (0, type_guards_1.isObject)(descriptorOrParameterIndex) && (0, type_guards_1.isFunction)(descriptorOrParameterIndex.value)) {
|
|
38
|
+
return {
|
|
39
|
+
type: 'method',
|
|
40
|
+
constructor,
|
|
41
|
+
prototype,
|
|
42
|
+
static: isStatic,
|
|
43
|
+
methodKey: propertyKey,
|
|
44
|
+
descriptor: descriptorOrParameterIndex
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
else if ((0, type_guards_1.isDefined)(propertyKey) && (0, type_guards_1.isNumber)(descriptorOrParameterIndex)) {
|
|
48
|
+
return {
|
|
49
|
+
type: 'parameter',
|
|
50
|
+
constructor,
|
|
51
|
+
prototype,
|
|
52
|
+
static: isStatic,
|
|
53
|
+
methodKey: propertyKey,
|
|
54
|
+
index: descriptorOrParameterIndex
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
else if ((0, type_guards_1.isNumber)(descriptorOrParameterIndex)) {
|
|
58
|
+
return {
|
|
59
|
+
type: 'constructor-parameter',
|
|
60
|
+
constructor,
|
|
61
|
+
prototype,
|
|
62
|
+
index: descriptorOrParameterIndex
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
throw new Error('unknown type');
|
|
66
|
+
}
|
|
67
|
+
exports.getDecoratorData = getDecoratorData;
|
|
68
|
+
//# sourceMappingURL=decorator-data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorator-data.js","sourceRoot":"","sources":["../../source/reflection/decorator-data.ts"],"names":[],"mappings":";;;AACA,sDAA6F;AAC7F,mCAAyC;AAwDzC,kDAAkD;AAClD,SAAgB,gBAAgB,CAAC,MAAc,EAAE,WAA6B,EAAE,0BAAwD;IACtI,MAAM,WAAW,GAAG,IAAA,sBAAc,EAAC,MAAM,CAAC,CAAC;IAC3C,MAAM,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC;IACxC,MAAM,QAAQ,GAAG,OAAO,MAAM,IAAI,UAAU,CAAC;IAE7C,IAAI,IAAA,yBAAW,EAAC,WAAW,CAAC,IAAI,IAAA,yBAAW,EAAC,0BAA0B,CAAC,EAAE;QACvE,OAAO;YACL,IAAI,EAAE,OAAO;YACb,WAAW;YACX,SAAS;SACV,CAAC;KACH;SACI,IAAI,IAAA,uBAAS,EAAC,WAAW,CAAC,IAAI,IAAA,yBAAW,EAAC,0BAA0B,CAAC,EAAE;QAC1E,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,WAAW;YACX,SAAS;YACT,MAAM,EAAE,QAAQ;YAChB,WAAW;SACZ,CAAC;KACH;SACI,IAAI,IAAA,uBAAS,EAAC,WAAW,CAAC,IAAI,IAAA,sBAAQ,EAAC,0BAA0B,CAAC,IAAI,CAAC,IAAA,wBAAU,EAAC,0BAA0B,CAAC,GAAG,IAAI,0BAA0B,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,wDAAwD;QACnN,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,WAAW;YACX,SAAS;YACT,MAAM,EAAE,QAAQ;YAChB,WAAW;YACX,UAAU,EAAE,0BAA0B;SACvC,CAAC;KACH;SACI,IAAI,IAAA,uBAAS,EAAC,WAAW,CAAC,IAAI,IAAA,sBAAQ,EAAC,0BAA0B,CAAC,IAAI,IAAA,wBAAU,EAAC,0BAA0B,CAAC,KAAK,CAAC,EAAE;QACvH,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,WAAW;YACX,SAAS;YACT,MAAM,EAAE,QAAQ;YAChB,SAAS,EAAE,WAAW;YACtB,UAAU,EAAE,0BAA0B;SACvC,CAAC;KACH;SACI,IAAI,IAAA,uBAAS,EAAC,WAAW,CAAC,IAAI,IAAA,sBAAQ,EAAC,0BAA0B,CAAC,EAAE;QACvE,OAAO;YACL,IAAI,EAAE,WAAW;YACjB,WAAW;YACX,SAAS;YACT,MAAM,EAAE,QAAQ;YAChB,SAAS,EAAE,WAAW;YACtB,KAAK,EAAE,0BAA0B;SAClC,CAAC;KACH;SACI,IAAI,IAAA,sBAAQ,EAAC,0BAA0B,CAAC,EAAE;QAC7C,OAAO;YACL,IAAI,EAAE,uBAAuB;YAC7B,WAAW;YACX,SAAS;YACT,KAAK,EAAE,0BAA0B;SAClC,CAAC;KACH;IAED,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;AAClC,CAAC;AA7DD,4CA6DC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Constructor } from "../types";
|
|
2
|
+
import 'reflect-metadata';
|
|
3
|
+
import type { AccessorDecoratorHandler, ClassDecoratorHandler, ConstructorParameterDecoratorHandler, CreateDecoratorOptions, Decorator, DecoratorHandler, MethodDecoratorHandler, MethodParameterDecoratorHandler, ParameterDecoratorHandler, PropertyDecoratorHandler, PropertyOrAccessorDecoratorHandler } from './utils';
|
|
4
|
+
export declare function Decorate(handler?: DecoratorHandler, options?: CreateDecoratorOptions): Decorator;
|
|
5
|
+
export declare function Class<T extends Constructor = Constructor>(handler?: ClassDecoratorHandler<T>, options?: CreateDecoratorOptions): ClassDecorator;
|
|
6
|
+
export declare function Property(handler?: PropertyDecoratorHandler, options?: CreateDecoratorOptions): PropertyDecorator;
|
|
7
|
+
export declare function Accessor(handler?: AccessorDecoratorHandler, options?: CreateDecoratorOptions): MethodDecorator;
|
|
8
|
+
export declare function PropertyOrAccessor(handler?: PropertyOrAccessorDecoratorHandler, options?: CreateDecoratorOptions): PropertyDecorator | MethodDecorator;
|
|
9
|
+
export declare function Method(handler?: MethodDecoratorHandler, options?: CreateDecoratorOptions): MethodDecorator;
|
|
10
|
+
export declare function Parameter(handler?: ParameterDecoratorHandler, options?: CreateDecoratorOptions): ParameterDecorator;
|
|
11
|
+
export declare function ConstructorParameter(handler?: ConstructorParameterDecoratorHandler, options?: CreateDecoratorOptions): ParameterDecorator;
|
|
12
|
+
export declare function MethodParameter(handler?: MethodParameterDecoratorHandler, options?: CreateDecoratorOptions): ParameterDecorator;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MethodParameter = exports.ConstructorParameter = exports.Parameter = exports.Method = exports.PropertyOrAccessor = exports.Accessor = exports.Property = exports.Class = exports.Decorate = void 0;
|
|
4
|
+
const noop_1 = require("../utils/noop");
|
|
5
|
+
require("reflect-metadata");
|
|
6
|
+
const utils_1 = require("./utils");
|
|
7
|
+
function Decorate(handler = noop_1.noop, options = {}) {
|
|
8
|
+
return (0, utils_1.createDecorator)(handler, options);
|
|
9
|
+
}
|
|
10
|
+
exports.Decorate = Decorate;
|
|
11
|
+
function Class(handler = noop_1.noop, options = {}) {
|
|
12
|
+
return (0, utils_1.createClassDecorator)(handler, options);
|
|
13
|
+
}
|
|
14
|
+
exports.Class = Class;
|
|
15
|
+
function Property(handler = noop_1.noop, options = {}) {
|
|
16
|
+
return (0, utils_1.createPropertyDecorator)(handler, options);
|
|
17
|
+
}
|
|
18
|
+
exports.Property = Property;
|
|
19
|
+
function Accessor(handler = noop_1.noop, options = {}) {
|
|
20
|
+
return (0, utils_1.createAccessorDecorator)(handler, options);
|
|
21
|
+
}
|
|
22
|
+
exports.Accessor = Accessor;
|
|
23
|
+
function PropertyOrAccessor(handler = noop_1.noop, options = {}) {
|
|
24
|
+
return (0, utils_1.createPropertyOrAccessorDecorator)(handler, options);
|
|
25
|
+
}
|
|
26
|
+
exports.PropertyOrAccessor = PropertyOrAccessor;
|
|
27
|
+
function Method(handler = noop_1.noop, options = {}) {
|
|
28
|
+
return (0, utils_1.createMethodDecorator)(handler, options);
|
|
29
|
+
}
|
|
30
|
+
exports.Method = Method;
|
|
31
|
+
function Parameter(handler = noop_1.noop, options = {}) {
|
|
32
|
+
return (0, utils_1.createParameterDecorator)(handler, options);
|
|
33
|
+
}
|
|
34
|
+
exports.Parameter = Parameter;
|
|
35
|
+
function ConstructorParameter(handler = noop_1.noop, options = {}) {
|
|
36
|
+
return (0, utils_1.createConstructorParameterDecorator)(handler, options);
|
|
37
|
+
}
|
|
38
|
+
exports.ConstructorParameter = ConstructorParameter;
|
|
39
|
+
function MethodParameter(handler = noop_1.noop, options = {}) {
|
|
40
|
+
return (0, utils_1.createMethodParameterDecorator)(handler, options);
|
|
41
|
+
}
|
|
42
|
+
exports.MethodParameter = MethodParameter;
|
|
43
|
+
//# sourceMappingURL=decorators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../source/reflection/decorators.ts"],"names":[],"mappings":";;;AACA,wCAAoC;AACpC,4BAA0B;AAE1B,mCAA2Q;AAE3Q,SAAgB,QAAQ,CAAC,UAA4B,WAAI,EAAE,UAAkC,EAAE;IAC7F,OAAO,IAAA,uBAAe,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC;AAFD,4BAEC;AAED,SAAgB,KAAK,CAAsC,UAAoC,WAAI,EAAE,UAAkC,EAAE;IACvI,OAAO,IAAA,4BAAoB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC;AAFD,sBAEC;AAED,SAAgB,QAAQ,CAAC,UAAoC,WAAI,EAAE,UAAkC,EAAE;IACrG,OAAO,IAAA,+BAAuB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACnD,CAAC;AAFD,4BAEC;AAED,SAAgB,QAAQ,CAAC,UAAoC,WAAI,EAAE,UAAkC,EAAE;IACrG,OAAO,IAAA,+BAAuB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACnD,CAAC;AAFD,4BAEC;AAED,SAAgB,kBAAkB,CAAC,UAA8C,WAAI,EAAE,UAAkC,EAAE;IACzH,OAAO,IAAA,yCAAiC,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC7D,CAAC;AAFD,gDAEC;AAED,SAAgB,MAAM,CAAC,UAAkC,WAAI,EAAE,UAAkC,EAAE;IACjG,OAAO,IAAA,6BAAqB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACjD,CAAC;AAFD,wBAEC;AAED,SAAgB,SAAS,CAAC,UAAqC,WAAI,EAAE,UAAkC,EAAE;IACvG,OAAO,IAAA,gCAAwB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC;AAFD,8BAEC;AAED,SAAgB,oBAAoB,CAAC,UAAgD,WAAI,EAAE,UAAkC,EAAE;IAC7H,OAAO,IAAA,2CAAmC,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC/D,CAAC;AAFD,oDAEC;AAED,SAAgB,eAAe,CAAC,UAA2C,WAAI,EAAE,UAAkC,EAAE;IACnH,OAAO,IAAA,sCAA8B,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC1D,CAAC;AAFD,0CAEC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
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("./decorator-data"), exports);
|
|
18
|
+
__exportStar(require("./decorators"), exports);
|
|
19
|
+
__exportStar(require("./registry"), exports);
|
|
20
|
+
__exportStar(require("./utils"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/reflection/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,+CAA6B;AAC7B,6CAA2B;AAC3B,0CAAwB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Constructor, Type } from "../types";
|
|
2
|
+
import type { DecoratorData } from './decorator-data';
|
|
3
|
+
declare type Data = Map<string | symbol, any>;
|
|
4
|
+
export declare type ReflectionMetadata = TypeMetadata | PropertyMetadata | MethodMetadata | ParameterMetadata;
|
|
5
|
+
export declare type TypeMetadata = {
|
|
6
|
+
constructor: Constructor;
|
|
7
|
+
parameters: ParameterMetadata[];
|
|
8
|
+
properties: Map<string | symbol, PropertyMetadata>;
|
|
9
|
+
staticProperties: Map<string | symbol, PropertyMetadata>;
|
|
10
|
+
methods: Map<string | symbol, MethodMetadata>;
|
|
11
|
+
staticMethods: Map<string | symbol, MethodMetadata>;
|
|
12
|
+
data: Data;
|
|
13
|
+
};
|
|
14
|
+
export declare type PropertyMetadata = {
|
|
15
|
+
type: Type;
|
|
16
|
+
data: Data;
|
|
17
|
+
};
|
|
18
|
+
export declare type MethodMetadata = {
|
|
19
|
+
parameters: ParameterMetadata[];
|
|
20
|
+
returnType: Type | undefined;
|
|
21
|
+
data: Data;
|
|
22
|
+
};
|
|
23
|
+
export declare type ParameterMetadata = {
|
|
24
|
+
type: Type;
|
|
25
|
+
data: Data;
|
|
26
|
+
};
|
|
27
|
+
export declare class ReflectionRegistry {
|
|
28
|
+
private readonly metadataMap;
|
|
29
|
+
constructor();
|
|
30
|
+
getMetadata(type: Constructor): TypeMetadata;
|
|
31
|
+
register(target: object, propertyKey?: string | symbol, descriptorOrParameterIndex?: PropertyDescriptor | number): DecoratorData;
|
|
32
|
+
registerDecoratorData(data: DecoratorData): ReflectionMetadata;
|
|
33
|
+
/**
|
|
34
|
+
* Unregister a type. Can be useful if you replace a class with an decorator.
|
|
35
|
+
* However, this should not be necessary since WeakRefs are used.
|
|
36
|
+
* @param type Type to unregister
|
|
37
|
+
*/
|
|
38
|
+
unregister(type: Type): void;
|
|
39
|
+
private initializeType;
|
|
40
|
+
}
|
|
41
|
+
export declare const reflectionRegistry: ReflectionRegistry;
|
|
42
|
+
export {};
|