@adaas/a-utils 0.1.10 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +914 -0
- package/dist/index.d.ts +914 -27
- package/dist/index.js +1760 -90
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1738 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +5 -3
- package/src/index.ts +70 -0
- package/src/lib/A-Logger/A-Logger.component.ts +10 -3
- package/src/lib/A-Polyfill/A-Polyfill.component.ts +153 -15
- package/src/lib/A-Polyfill/A-Polyfill.types.ts +54 -0
- package/src/lib/A-Polyfill/classes/A-Buffer-Polyfill.class.ts +85 -0
- package/src/lib/A-Polyfill/classes/A-Crypto-Polyfill.class.ts +87 -0
- package/src/lib/A-Polyfill/classes/A-FS-Polyfill.class.ts +61 -0
- package/src/lib/A-Polyfill/classes/A-Http-Polyfill.class.ts +100 -0
- package/src/lib/A-Polyfill/classes/A-Https-Polyfill.class.ts +100 -0
- package/src/lib/A-Polyfill/classes/A-Path-Polyfill.class.ts +97 -0
- package/src/lib/A-Polyfill/classes/A-Process-Polyfill.class.ts +73 -0
- package/src/lib/A-Polyfill/classes/A-Url-Polyfill.class.ts +88 -0
- package/tests/A-Config.test.ts +5 -5
- package/tests/A-Polyfill.test.ts +446 -29
- package/tsconfig.json +1 -1
- package/tsup.config.ts +15 -0
- package/dist/src/constants/errors.constants.d.ts +0 -0
- package/dist/src/constants/errors.constants.js +0 -2
- package/dist/src/constants/errors.constants.js.map +0 -1
- package/dist/src/lib/A-Channel/A-Channel.component.d.ts +0 -22
- package/dist/src/lib/A-Channel/A-Channel.component.js +0 -84
- package/dist/src/lib/A-Channel/A-Channel.component.js.map +0 -1
- package/dist/src/lib/A-Channel/A-Channel.error.d.ts +0 -4
- package/dist/src/lib/A-Channel/A-Channel.error.js +0 -9
- package/dist/src/lib/A-Channel/A-Channel.error.js.map +0 -1
- package/dist/src/lib/A-Channel/A-Channel.types.d.ts +0 -0
- package/dist/src/lib/A-Channel/A-Channel.types.js +0 -2
- package/dist/src/lib/A-Channel/A-Channel.types.js.map +0 -1
- package/dist/src/lib/A-Command/A-Command.constants.d.ts +0 -22
- package/dist/src/lib/A-Command/A-Command.constants.js +0 -28
- package/dist/src/lib/A-Command/A-Command.constants.js.map +0 -1
- package/dist/src/lib/A-Command/A-Command.entity.d.ts +0 -133
- package/dist/src/lib/A-Command/A-Command.entity.js +0 -273
- package/dist/src/lib/A-Command/A-Command.entity.js.map +0 -1
- package/dist/src/lib/A-Command/A-Command.error.d.ts +0 -3
- package/dist/src/lib/A-Command/A-Command.error.js +0 -8
- package/dist/src/lib/A-Command/A-Command.error.js.map +0 -1
- package/dist/src/lib/A-Command/A-Command.types.d.ts +0 -73
- package/dist/src/lib/A-Command/A-Command.types.js +0 -4
- package/dist/src/lib/A-Command/A-Command.types.js.map +0 -1
- package/dist/src/lib/A-Config/A-Config.constants.d.ts +0 -3
- package/dist/src/lib/A-Config/A-Config.constants.js +0 -6
- package/dist/src/lib/A-Config/A-Config.constants.js.map +0 -1
- package/dist/src/lib/A-Config/A-Config.container.d.ts +0 -6
- package/dist/src/lib/A-Config/A-Config.container.js +0 -77
- package/dist/src/lib/A-Config/A-Config.container.js.map +0 -1
- package/dist/src/lib/A-Config/A-Config.context.d.ts +0 -29
- package/dist/src/lib/A-Config/A-Config.context.js +0 -63
- package/dist/src/lib/A-Config/A-Config.context.js.map +0 -1
- package/dist/src/lib/A-Config/A-Config.error.d.ts +0 -4
- package/dist/src/lib/A-Config/A-Config.error.js +0 -9
- package/dist/src/lib/A-Config/A-Config.error.js.map +0 -1
- package/dist/src/lib/A-Config/A-Config.types.d.ts +0 -19
- package/dist/src/lib/A-Config/A-Config.types.js +0 -7
- package/dist/src/lib/A-Config/A-Config.types.js.map +0 -1
- package/dist/src/lib/A-Config/components/ConfigReader.component.d.ts +0 -30
- package/dist/src/lib/A-Config/components/ConfigReader.component.js +0 -103
- package/dist/src/lib/A-Config/components/ConfigReader.component.js.map +0 -1
- package/dist/src/lib/A-Config/components/ENVConfigReader.component.d.ts +0 -14
- package/dist/src/lib/A-Config/components/ENVConfigReader.component.js +0 -72
- package/dist/src/lib/A-Config/components/ENVConfigReader.component.js.map +0 -1
- package/dist/src/lib/A-Config/components/FileConfigReader.component.d.ts +0 -11
- package/dist/src/lib/A-Config/components/FileConfigReader.component.js +0 -47
- package/dist/src/lib/A-Config/components/FileConfigReader.component.js.map +0 -1
- package/dist/src/lib/A-Logger/A-Logger.component.d.ts +0 -29
- package/dist/src/lib/A-Logger/A-Logger.component.js +0 -152
- package/dist/src/lib/A-Logger/A-Logger.component.js.map +0 -1
- package/dist/src/lib/A-Logger/A-Logger.types.d.ts +0 -0
- package/dist/src/lib/A-Logger/A-Logger.types.js +0 -2
- package/dist/src/lib/A-Logger/A-Logger.types.js.map +0 -1
- package/dist/src/lib/A-Manifest/A-Manifest.context.d.ts +0 -52
- package/dist/src/lib/A-Manifest/A-Manifest.context.js +0 -154
- package/dist/src/lib/A-Manifest/A-Manifest.context.js.map +0 -1
- package/dist/src/lib/A-Manifest/A-Manifest.error.d.ts +0 -4
- package/dist/src/lib/A-Manifest/A-Manifest.error.js +0 -9
- package/dist/src/lib/A-Manifest/A-Manifest.error.js.map +0 -1
- package/dist/src/lib/A-Manifest/A-Manifest.types.d.ts +0 -43
- package/dist/src/lib/A-Manifest/A-Manifest.types.js +0 -3
- package/dist/src/lib/A-Manifest/A-Manifest.types.js.map +0 -1
- package/dist/src/lib/A-Manifest/classes/A-ManifestChecker.class.d.ts +0 -14
- package/dist/src/lib/A-Manifest/classes/A-ManifestChecker.class.js +0 -24
- package/dist/src/lib/A-Manifest/classes/A-ManifestChecker.class.js.map +0 -1
- package/dist/src/lib/A-Memory/A-Memory.context.d.ts +0 -64
- package/dist/src/lib/A-Memory/A-Memory.context.js +0 -105
- package/dist/src/lib/A-Memory/A-Memory.context.js.map +0 -1
- package/dist/src/lib/A-Polyfill/A-Polyfill.component.d.ts +0 -20
- package/dist/src/lib/A-Polyfill/A-Polyfill.component.js +0 -53
- package/dist/src/lib/A-Polyfill/A-Polyfill.component.js.map +0 -1
- package/dist/src/lib/A-Polyfill/A-Polyfill.types.d.ts +0 -9
- package/dist/src/lib/A-Polyfill/A-Polyfill.types.js +0 -3
- package/dist/src/lib/A-Polyfill/A-Polyfill.types.js.map +0 -1
- package/dist/src/lib/A-Polyfill/A-Polyfills.class.d.ts +0 -11
- package/dist/src/lib/A-Polyfill/A-Polyfills.class.js +0 -123
- package/dist/src/lib/A-Polyfill/A-Polyfills.class.js.map +0 -1
- package/dist/src/lib/A-Schedule/A-Deferred.class.d.ts +0 -12
- package/dist/src/lib/A-Schedule/A-Deferred.class.js +0 -23
- package/dist/src/lib/A-Schedule/A-Deferred.class.js.map +0 -1
- package/dist/src/lib/A-Schedule/A-Schedule.component.d.ts +0 -57
- package/dist/src/lib/A-Schedule/A-Schedule.component.js +0 -49
- package/dist/src/lib/A-Schedule/A-Schedule.component.js.map +0 -1
- package/dist/src/lib/A-Schedule/A-Schedule.types.d.ts +0 -10
- package/dist/src/lib/A-Schedule/A-Schedule.types.js +0 -3
- package/dist/src/lib/A-Schedule/A-Schedule.types.js.map +0 -1
- package/dist/src/lib/A-Schedule/A-ScheduleObject.class.d.ts +0 -29
- package/dist/src/lib/A-Schedule/A-ScheduleObject.class.js +0 -58
- package/dist/src/lib/A-Schedule/A-ScheduleObject.class.js.map +0 -1
- package/index.ts +0 -71
- package/src/lib/A-Polyfill/A-Polyfills.class.ts +0 -99
- package/tsconfig.build.json +0 -56
|
@@ -1,152 +0,0 @@
|
|
|
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 __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
9
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.A_Logger = void 0;
|
|
13
|
-
const a_concept_1 = require("@adaas/a-concept");
|
|
14
|
-
const A_Config_context_1 = require("../A-Config/A-Config.context");
|
|
15
|
-
let A_Logger = class A_Logger extends a_concept_1.A_Component {
|
|
16
|
-
constructor(scope, config) {
|
|
17
|
-
super();
|
|
18
|
-
this.scope = scope;
|
|
19
|
-
this.config = config;
|
|
20
|
-
this.colors = {
|
|
21
|
-
green: '32',
|
|
22
|
-
blue: '34',
|
|
23
|
-
red: '31',
|
|
24
|
-
yellow: '33',
|
|
25
|
-
gray: '90',
|
|
26
|
-
magenta: '35',
|
|
27
|
-
cyan: '36',
|
|
28
|
-
white: '37',
|
|
29
|
-
pink: '95',
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
get scopeLength() {
|
|
33
|
-
return this.scope.name.length;
|
|
34
|
-
}
|
|
35
|
-
compile(color, ...args) {
|
|
36
|
-
return [
|
|
37
|
-
`\x1b[${this.colors[color]}m[${this.scope.name}] |${this.getTime()}|`,
|
|
38
|
-
(args.length > 1
|
|
39
|
-
? '\n' + `${' '.repeat(this.scopeLength + 3)}|-------------------------------`
|
|
40
|
-
: ''),
|
|
41
|
-
...(args
|
|
42
|
-
.map((arg, i) => {
|
|
43
|
-
switch (true) {
|
|
44
|
-
case arg instanceof a_concept_1.A_Error:
|
|
45
|
-
return this.compile_A_Error(arg);
|
|
46
|
-
case arg instanceof Error:
|
|
47
|
-
return this.compile_Error(arg);
|
|
48
|
-
case typeof arg === 'object':
|
|
49
|
-
return JSON.stringify(arg, null, 2)
|
|
50
|
-
.replace(/\n/g, '\n' + `${' '.repeat(this.scopeLength + 3)}| `);
|
|
51
|
-
default:
|
|
52
|
-
return String(((i > 0 || args.length > 1) ? '\n' : '')
|
|
53
|
-
+ arg)
|
|
54
|
-
.replace(/\n/g, '\n' + `${' '.repeat(this.scopeLength + 3)}| `);
|
|
55
|
-
}
|
|
56
|
-
})),
|
|
57
|
-
(args.length > 1
|
|
58
|
-
? '\n' + `${' '.repeat(this.scopeLength + 3)}|-------------------------------\x1b[0m`
|
|
59
|
-
: '\x1b[0m')
|
|
60
|
-
];
|
|
61
|
-
}
|
|
62
|
-
get allowedToLog() {
|
|
63
|
-
return this.config.get('CONFIG_VERBOSE') !== undefined
|
|
64
|
-
&& this.config.get('CONFIG_VERBOSE') !== 'false'
|
|
65
|
-
&& this.config.get('CONFIG_VERBOSE') !== false;
|
|
66
|
-
}
|
|
67
|
-
log(param1, ...args) {
|
|
68
|
-
if (!this.allowedToLog)
|
|
69
|
-
return;
|
|
70
|
-
if (typeof param1 === 'string' && this.colors[param1]) {
|
|
71
|
-
console.log(...this.compile(param1, ...args));
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
console.log(...this.compile('blue', param1, ...args));
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
warning(...args) {
|
|
79
|
-
if (!this.allowedToLog)
|
|
80
|
-
return;
|
|
81
|
-
console.log(...this.compile('yellow', ...args));
|
|
82
|
-
}
|
|
83
|
-
error(...args) {
|
|
84
|
-
if (this.config.get('CONFIG_IGNORE_ERRORS'))
|
|
85
|
-
return;
|
|
86
|
-
return console.log(...this.compile('red', ...args));
|
|
87
|
-
}
|
|
88
|
-
log_A_Error(error) {
|
|
89
|
-
var _a, _b;
|
|
90
|
-
const time = this.getTime();
|
|
91
|
-
console.log(`\x1b[31m[${this.scope.name}] |${time}| ERROR ${error.code}
|
|
92
|
-
${' '.repeat(this.scopeLength + 3)}| ${error.message}
|
|
93
|
-
${' '.repeat(this.scopeLength + 3)}| ${error.description}
|
|
94
|
-
${' '.repeat(this.scopeLength + 3)}|-------------------------------
|
|
95
|
-
${' '.repeat(this.scopeLength + 3)}| ${((_a = error.stack) === null || _a === void 0 ? void 0 : _a.split('\n').map((line, index) => index === 0 ? line : `${' '.repeat(this.scopeLength + 3)}| ${line}`).join('\n')) || 'No stack trace'}
|
|
96
|
-
${' '.repeat(this.scopeLength + 3)}|-------------------------------
|
|
97
|
-
\x1b[0m`
|
|
98
|
-
+ (error.originalError ? `\x1b[31m${' '.repeat(this.scopeLength + 3)}| Wrapped From ${error.originalError.message}
|
|
99
|
-
${' '.repeat(this.scopeLength + 3)}|-------------------------------
|
|
100
|
-
${' '.repeat(this.scopeLength + 3)}| ${((_b = error.originalError.stack) === null || _b === void 0 ? void 0 : _b.split('\n').map((line, index) => index === 0 ? line : `${' '.repeat(this.scopeLength + 3)}| ${line}`).join('\n')) || 'No stack trace'}
|
|
101
|
-
${' '.repeat(this.scopeLength + 3)}|-------------------------------
|
|
102
|
-
\x1b[0m` : '')
|
|
103
|
-
+ (error.link ? `\x1b[31m${' '.repeat(this.scopeLength + 3)}| Read in docs: ${error.link}
|
|
104
|
-
${' '.repeat(this.scopeLength + 3)}|-------------------------------
|
|
105
|
-
\x1b[0m` : ''));
|
|
106
|
-
}
|
|
107
|
-
compile_A_Error(error) {
|
|
108
|
-
var _a, _b;
|
|
109
|
-
const time = this.getTime();
|
|
110
|
-
return '\n' +
|
|
111
|
-
`${' '.repeat(this.scopeLength + 3)}|-------------------------------` +
|
|
112
|
-
'\n' +
|
|
113
|
-
`${' '.repeat(this.scopeLength + 3)}| Error: | ${error.code}
|
|
114
|
-
${' '.repeat(this.scopeLength + 3)}|-------------------------------
|
|
115
|
-
${' '.repeat(this.scopeLength + 3)}|${' '.repeat(10)}| ${error.message}
|
|
116
|
-
${' '.repeat(this.scopeLength + 3)}|${' '.repeat(10)}| ${error.description}
|
|
117
|
-
${' '.repeat(this.scopeLength + 3)}|-------------------------------
|
|
118
|
-
${' '.repeat(this.scopeLength + 3)}| ${((_a = error.stack) === null || _a === void 0 ? void 0 : _a.split('\n').map((line, index) => index === 0 ? line : `${' '.repeat(this.scopeLength + 3)}| ${line}`).join('\n')) || 'No stack trace'}
|
|
119
|
-
${' '.repeat(this.scopeLength + 3)}|-------------------------------`
|
|
120
|
-
+
|
|
121
|
-
(error.originalError ? `${' '.repeat(this.scopeLength + 3)}| Wrapped From ${error.originalError.message}
|
|
122
|
-
${' '.repeat(this.scopeLength + 3)}|-------------------------------
|
|
123
|
-
${' '.repeat(this.scopeLength + 3)}| ${((_b = error.originalError.stack) === null || _b === void 0 ? void 0 : _b.split('\n').map((line, index) => index === 0 ? line : `${' '.repeat(this.scopeLength + 3)}| ${line}`).join('\n')) || 'No stack trace'}
|
|
124
|
-
${' '.repeat(this.scopeLength + 3)}|-------------------------------` : '')
|
|
125
|
-
+
|
|
126
|
-
(error.link ? `${' '.repeat(this.scopeLength + 3)}| Read in docs: ${error.link}
|
|
127
|
-
${' '.repeat(this.scopeLength + 3)}|-------------------------------` : '');
|
|
128
|
-
}
|
|
129
|
-
compile_Error(error) {
|
|
130
|
-
var _a;
|
|
131
|
-
return JSON.stringify({
|
|
132
|
-
name: error.name,
|
|
133
|
-
message: error.message,
|
|
134
|
-
stack: (_a = error.stack) === null || _a === void 0 ? void 0 : _a.split('\n').map((line, index) => index === 0 ? line : `${' '.repeat(this.scopeLength + 3)}| ${line}`).join('\n')
|
|
135
|
-
}, null, 2)
|
|
136
|
-
.replace(/\n/g, '\n' + `${' '.repeat(this.scopeLength + 3)}| `)
|
|
137
|
-
.replace(/\\n/g, '\n');
|
|
138
|
-
}
|
|
139
|
-
getTime() {
|
|
140
|
-
const now = new Date();
|
|
141
|
-
const minutes = String(now.getMinutes()).padStart(2, '0');
|
|
142
|
-
const seconds = String(now.getSeconds()).padStart(2, '0');
|
|
143
|
-
const milliseconds = String(now.getMilliseconds()).padStart(4, '0');
|
|
144
|
-
return `${minutes}:${seconds}:${milliseconds}`;
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
exports.A_Logger = A_Logger;
|
|
148
|
-
exports.A_Logger = A_Logger = __decorate([
|
|
149
|
-
__param(0, (0, a_concept_1.A_Inject)(a_concept_1.A_Scope)),
|
|
150
|
-
__param(1, (0, a_concept_1.A_Inject)(A_Config_context_1.A_Config))
|
|
151
|
-
], A_Logger);
|
|
152
|
-
//# sourceMappingURL=A-Logger.component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"A-Logger.component.js","sourceRoot":"","sources":["../../../../src/lib/A-Logger/A-Logger.component.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAA2E;AAC3E,mEAAwD;AAIjD,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,uBAAW;IAErC,YACuB,KAAwB,EACvB,MAA0B;QAE9C,KAAK,EAAE,CAAC;QAHqB,UAAK,GAAL,KAAK,CAAS;QACb,WAAM,GAAN,MAAM,CAAU;QAKzC,WAAM,GAAG;YACd,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,IAAI;YACV,GAAG,EAAE,IAAI;YACT,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,IAAI;SACJ,CAAA;IAZV,CAAC;IAeD,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;IAClC,CAAC;IAGD,OAAO,CACH,KAA+B,EAC/B,GAAG,IAAW;QAGd,OAAO;YACH,QAAQ,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE,GAAG;YACrE,CACI,IAAI,CAAC,MAAM,GAAG,CAAC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AO,IAAI,YAAY,EAAE,CAAC;IACnD,CAAC;CACJ,CAAA;AAxLY,4BAAQ;mBAAR,QAAQ;IAGZ,WAAA,IAAA,oBAAQ,EAAC,mBAAO,CAAC,CAAA;IACjB,WAAA,IAAA,oBAAQ,EAAC,2BAAQ,CAAC,CAAA;GAJd,QAAQ,CAwLpB"}
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"A-Logger.types.js","sourceRoot":"","sources":["../../../../src/lib/A-Logger/A-Logger.types.ts"],"names":[],"mappings":""}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { A_Component, A_Fragment, A_TYPES__Component_Constructor } from "@adaas/a-concept";
|
|
2
|
-
import { A_UTILS_TYPES__Manifest_Init, A_UTILS_TYPES__ManifestQuery } from "./A-Manifest.types";
|
|
3
|
-
import { A_ManifestChecker } from "./classes/A-ManifestChecker.class";
|
|
4
|
-
export declare class A_Manifest extends A_Fragment {
|
|
5
|
-
private rules;
|
|
6
|
-
/**
|
|
7
|
-
* A-Manifest is a configuration set that allows to include or exclude component application for the particular methods.
|
|
8
|
-
*
|
|
9
|
-
* For example, if A-Scope provides polymorphic A-Component that applies for All A-Entities in it but you have another component that should be used for only One particular Entity, you can use A-Manifest to specify this behavior.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* By default if Component is provided in the scope - it applies for all entities in it. However, if you want to exclude some entities or include only some entities for the particular component - you can use A-Manifest to define this behavior.
|
|
13
|
-
*
|
|
14
|
-
* @param config - Array of component configurations
|
|
15
|
-
*/
|
|
16
|
-
constructor(config?: A_UTILS_TYPES__Manifest_Init);
|
|
17
|
-
/**
|
|
18
|
-
* Should convert received configuration into internal Regexp applicable for internal storage
|
|
19
|
-
*/
|
|
20
|
-
protected prepare(config: A_UTILS_TYPES__Manifest_Init): void;
|
|
21
|
-
/**
|
|
22
|
-
* Process a single configuration item and convert it to internal rules
|
|
23
|
-
*/
|
|
24
|
-
private processConfigItem;
|
|
25
|
-
/**
|
|
26
|
-
* Convert a constructor to a regex pattern
|
|
27
|
-
*/
|
|
28
|
-
private constructorToRegex;
|
|
29
|
-
/**
|
|
30
|
-
* Convert a method name or regex to a regex pattern
|
|
31
|
-
*/
|
|
32
|
-
private methodToRegex;
|
|
33
|
-
/**
|
|
34
|
-
* Convert allowed components array or regex to a single regex
|
|
35
|
-
*/
|
|
36
|
-
private allowedComponentsToRegex;
|
|
37
|
-
/**
|
|
38
|
-
* Escape special regex characters in a string
|
|
39
|
-
*/
|
|
40
|
-
private escapeRegex;
|
|
41
|
-
protected configItemToRegexp(item: A_TYPES__Component_Constructor): RegExp;
|
|
42
|
-
protected ID(component: A_TYPES__Component_Constructor, method: string): string;
|
|
43
|
-
/**
|
|
44
|
-
* Check if a component and method combination is allowed for a target
|
|
45
|
-
*/
|
|
46
|
-
isAllowed<T extends A_Component>(ctor: T | A_TYPES__Component_Constructor<T>, method: string): A_ManifestChecker;
|
|
47
|
-
/**
|
|
48
|
-
* Internal method to check if access is allowed
|
|
49
|
-
*/
|
|
50
|
-
internal_checkAccess(query: A_UTILS_TYPES__ManifestQuery): boolean;
|
|
51
|
-
isExcluded<T extends A_Component>(ctor: T | A_TYPES__Component_Constructor<T>, method: string): A_ManifestChecker;
|
|
52
|
-
}
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.A_Manifest = void 0;
|
|
4
|
-
const a_concept_1 = require("@adaas/a-concept");
|
|
5
|
-
const A_Manifest_error_1 = require("./A-Manifest.error");
|
|
6
|
-
const A_ManifestChecker_class_1 = require("./classes/A-ManifestChecker.class");
|
|
7
|
-
class A_Manifest extends a_concept_1.A_Fragment {
|
|
8
|
-
/**
|
|
9
|
-
* A-Manifest is a configuration set that allows to include or exclude component application for the particular methods.
|
|
10
|
-
*
|
|
11
|
-
* For example, if A-Scope provides polymorphic A-Component that applies for All A-Entities in it but you have another component that should be used for only One particular Entity, you can use A-Manifest to specify this behavior.
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* By default if Component is provided in the scope - it applies for all entities in it. However, if you want to exclude some entities or include only some entities for the particular component - you can use A-Manifest to define this behavior.
|
|
15
|
-
*
|
|
16
|
-
* @param config - Array of component configurations
|
|
17
|
-
*/
|
|
18
|
-
constructor(config = []) {
|
|
19
|
-
super({
|
|
20
|
-
name: 'A-Manifest',
|
|
21
|
-
});
|
|
22
|
-
this.rules = [];
|
|
23
|
-
this.prepare(config);
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Should convert received configuration into internal Regexp applicable for internal storage
|
|
27
|
-
*/
|
|
28
|
-
prepare(config) {
|
|
29
|
-
if (!a_concept_1.A_TypeGuards.isArray(config))
|
|
30
|
-
throw new A_Manifest_error_1.A_ManifestError(A_Manifest_error_1.A_ManifestError.ManifestInitializationError, `A-Manifest configuration should be an array of configurations`);
|
|
31
|
-
for (const item of config) {
|
|
32
|
-
this.processConfigItem(item);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Process a single configuration item and convert it to internal rules
|
|
37
|
-
*/
|
|
38
|
-
processConfigItem(item) {
|
|
39
|
-
if (!a_concept_1.A_TypeGuards.isComponentConstructor(item.component))
|
|
40
|
-
throw new A_Manifest_error_1.A_ManifestError(A_Manifest_error_1.A_ManifestError.ManifestInitializationError, `A-Manifest configuration item should be a A-Component constructor`);
|
|
41
|
-
const componentRegex = this.constructorToRegex(item.component);
|
|
42
|
-
// Always add component-level rule first (applies to all methods)
|
|
43
|
-
if (item.apply || item.exclude) {
|
|
44
|
-
const methodRegex = /.*/; // Match all methods
|
|
45
|
-
this.rules.push({
|
|
46
|
-
componentRegex,
|
|
47
|
-
methodRegex,
|
|
48
|
-
applyRegex: item.apply ? this.allowedComponentsToRegex(item.apply) : undefined,
|
|
49
|
-
excludeRegex: item.exclude ? this.allowedComponentsToRegex(item.exclude) : undefined,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
// Then add method-level configurations (these will override component-level)
|
|
53
|
-
if (item.methods && item.methods.length > 0) {
|
|
54
|
-
for (const methodConfig of item.methods) {
|
|
55
|
-
const methodRegex = this.methodToRegex(methodConfig.method);
|
|
56
|
-
this.rules.push({
|
|
57
|
-
componentRegex,
|
|
58
|
-
methodRegex,
|
|
59
|
-
applyRegex: methodConfig.apply ? this.allowedComponentsToRegex(methodConfig.apply) : undefined,
|
|
60
|
-
excludeRegex: methodConfig.exclude ? this.allowedComponentsToRegex(methodConfig.exclude) : undefined,
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Convert a constructor to a regex pattern
|
|
67
|
-
*/
|
|
68
|
-
constructorToRegex(ctor) {
|
|
69
|
-
return new RegExp(`^${this.escapeRegex(ctor.name)}$`);
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Convert a method name or regex to a regex pattern
|
|
73
|
-
*/
|
|
74
|
-
methodToRegex(method) {
|
|
75
|
-
if (method instanceof RegExp) {
|
|
76
|
-
return method;
|
|
77
|
-
}
|
|
78
|
-
return new RegExp(`^${this.escapeRegex(method)}$`);
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Convert allowed components array or regex to a single regex
|
|
82
|
-
*/
|
|
83
|
-
allowedComponentsToRegex(components) {
|
|
84
|
-
if (components instanceof RegExp) {
|
|
85
|
-
return components;
|
|
86
|
-
}
|
|
87
|
-
const patterns = components.map(ctor => this.escapeRegex(ctor.name));
|
|
88
|
-
return new RegExp(`^(${patterns.join('|')})$`);
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Escape special regex characters in a string
|
|
92
|
-
*/
|
|
93
|
-
escapeRegex(str) {
|
|
94
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
95
|
-
}
|
|
96
|
-
configItemToRegexp(item) {
|
|
97
|
-
return this.constructorToRegex(item);
|
|
98
|
-
}
|
|
99
|
-
ID(component, method) {
|
|
100
|
-
return `${component.name}.${method}`;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Check if a component and method combination is allowed for a target
|
|
104
|
-
*/
|
|
105
|
-
isAllowed(ctor, method) {
|
|
106
|
-
const componentCtor = typeof ctor === 'function' ? ctor : ctor.constructor;
|
|
107
|
-
return new A_ManifestChecker_class_1.A_ManifestChecker(this, componentCtor, method);
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Internal method to check if access is allowed
|
|
111
|
-
*/
|
|
112
|
-
internal_checkAccess(query) {
|
|
113
|
-
const componentName = query.component.name;
|
|
114
|
-
const methodName = query.method;
|
|
115
|
-
const targetName = query.target.name;
|
|
116
|
-
// Find matching rules, sorted by specificity (method-specific rules first)
|
|
117
|
-
const matchingRules = this.rules
|
|
118
|
-
.filter(rule => rule.componentRegex.test(componentName) &&
|
|
119
|
-
rule.methodRegex.test(methodName))
|
|
120
|
-
.sort((a, b) => {
|
|
121
|
-
// Method-specific rules (not .* pattern) should come before general rules
|
|
122
|
-
const aIsGeneral = a.methodRegex.source === '.*';
|
|
123
|
-
const bIsGeneral = b.methodRegex.source === '.*';
|
|
124
|
-
if (aIsGeneral && !bIsGeneral)
|
|
125
|
-
return 1; // b comes first
|
|
126
|
-
if (!aIsGeneral && bIsGeneral)
|
|
127
|
-
return -1; // a comes first
|
|
128
|
-
return 0; // same priority
|
|
129
|
-
});
|
|
130
|
-
// If no rules match, allow by default
|
|
131
|
-
if (matchingRules.length === 0) {
|
|
132
|
-
return true;
|
|
133
|
-
}
|
|
134
|
-
// Process rules in order of specificity (most specific first)
|
|
135
|
-
for (const rule of matchingRules) {
|
|
136
|
-
// If this rule has an exclusion that matches, deny access
|
|
137
|
-
if (rule.excludeRegex && rule.excludeRegex.test(targetName)) {
|
|
138
|
-
return false;
|
|
139
|
-
}
|
|
140
|
-
// If this rule has an apply list, check if target is in it
|
|
141
|
-
if (rule.applyRegex) {
|
|
142
|
-
return rule.applyRegex.test(targetName);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
// If we have rules but no specific apply/exclude, allow by default
|
|
146
|
-
return true;
|
|
147
|
-
}
|
|
148
|
-
isExcluded(ctor, method) {
|
|
149
|
-
const componentCtor = typeof ctor === 'function' ? ctor : ctor.constructor;
|
|
150
|
-
return new A_ManifestChecker_class_1.A_ManifestChecker(this, componentCtor, method, true);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
exports.A_Manifest = A_Manifest;
|
|
154
|
-
//# sourceMappingURL=A-Manifest.context.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"A-Manifest.context.js","sourceRoot":"","sources":["../../../../src/lib/A-Manifest/A-Manifest.context.ts"],"names":[],"mappings":";;;AAAA,gDAAyG;AAEzG,yDAAqD;AACrD,+EAAsE;AAMtE,MAAa,UAAW,SAAQ,sBAAU;IAItC;;;;;;;;;OASG;IACH,YAAY,SAAuC,EAAE;QACjD,KAAK,CAAC;YACF,IAAI,EAAE,YAAY;SACrB,CAAC,CAAC;QAfC,UAAK,GAAkC,EAAE,CAAC;QAiB9C,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC;IAGD;;OAEG;IACO,OAAO,CAAC,MAAoC;QAClD,IAAI,CAAC,wBAAY,CAAC,OAAO,CAAC,MAAM,CAAC;YAC7B,MAAM,IAAI,kCAAe,CACrB,kCAAe,CAAC,2BAA2B,EAC3C,+DAA+D,CAClE,CAAC;QAEN,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;YACxB,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC;IACL,CAAC;IAED;;OAEG;IACK,iBAAiB,CAAC,IAAkD;QACxE,IAAI,CAAC,wBAAY,CAAC,sBAAsB,CAAC,IAAI,CAAC,SAAS,CAAC;YACpD,MAAM,IAAI,kCAAe,CACr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OAAO,KAAK,CAAC;YACjB,CAAC;YAED,2DAA2D;YAC3D,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;gBAClB,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC5C,CAAC;QACL,CAAC;QAED,mEAAmE;QACnE,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,UAAU,CACN,IAA2C,EAC3C,MAAc;QAEd,MAAM,aAAa,GAAG,OAAO,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,WAA6C,CAAC;QAC7G,OAAO,IAAI,2CAAiB,CAAC,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACpE,CAAC;CACJ;AA5LD,gCA4LC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.A_ManifestError = void 0;
|
|
4
|
-
const a_concept_1 = require("@adaas/a-concept");
|
|
5
|
-
class A_ManifestError extends a_concept_1.A_Error {
|
|
6
|
-
}
|
|
7
|
-
exports.A_ManifestError = A_ManifestError;
|
|
8
|
-
A_ManifestError.ManifestInitializationError = 'A-Manifest Initialization Error';
|
|
9
|
-
//# sourceMappingURL=A-Manifest.error.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"A-Manifest.error.js","sourceRoot":"","sources":["../../../../src/lib/A-Manifest/A-Manifest.error.ts"],"names":[],"mappings":";;;AAAA,gDAA2C;AAE3C,MAAa,eAAgB,SAAQ,mBAAO;;AAA5C,0CAIC;AAFmB,2CAA2B,GAAG,iCAAiC,CAAC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { A_Component, A_TYPES__Component_Constructor, A_TYPES__Entity_Constructor, A_TYPES__Fragment_Constructor } from "@adaas/a-concept";
|
|
2
|
-
import { A_TYPES__Container_Constructor } from "@adaas/a-concept/dist/src/global/A-Container/A-Container.types";
|
|
3
|
-
export type A_UTILS_TYPES__Manifest_Init = Array<A_UTILS_TYPES__Manifest_ComponentLevelConfig>;
|
|
4
|
-
export type A_UTILS_TYPES__Manifest_ComponentLevelConfig<T extends A_Component = A_Component> = {
|
|
5
|
-
/**
|
|
6
|
-
* Component constructor
|
|
7
|
-
*/
|
|
8
|
-
component: A_TYPES__Component_Constructor<T>;
|
|
9
|
-
/**
|
|
10
|
-
* Method level configurations for the component
|
|
11
|
-
*/
|
|
12
|
-
methods?: Array<A_UTILS_TYPES__Manifest_MethodLevelConfig<T>>;
|
|
13
|
-
} & Partial<A_UTILS_TYPES__Manifest_Rules>;
|
|
14
|
-
export type A_UTILS_TYPES__Manifest_MethodLevelConfig<T extends A_Component = A_Component> = {
|
|
15
|
-
/**
|
|
16
|
-
* Method name from the component provided
|
|
17
|
-
*/
|
|
18
|
-
method: string | RegExp;
|
|
19
|
-
} & Partial<A_UTILS_TYPES__Manifest_Rules>;
|
|
20
|
-
export type A_UTILS_TYPES__Manifest_Rules = {
|
|
21
|
-
/**
|
|
22
|
-
* A list of entities to which a component is applied
|
|
23
|
-
*
|
|
24
|
-
* By default is for all
|
|
25
|
-
*/
|
|
26
|
-
apply: Array<A_UTILS_TYPES__Manifest_AllowedComponents> | RegExp;
|
|
27
|
-
/**
|
|
28
|
-
* A list of entities to which a component is excluded
|
|
29
|
-
*/
|
|
30
|
-
exclude: Array<A_UTILS_TYPES__Manifest_AllowedComponents> | RegExp;
|
|
31
|
-
};
|
|
32
|
-
export type A_UTILS_TYPES__Manifest_AllowedComponents = A_TYPES__Component_Constructor | A_TYPES__Entity_Constructor | A_TYPES__Fragment_Constructor | A_TYPES__Container_Constructor;
|
|
33
|
-
export interface A_UTILS_TYPES__ManifestRule {
|
|
34
|
-
componentRegex: RegExp;
|
|
35
|
-
methodRegex: RegExp;
|
|
36
|
-
applyRegex?: RegExp;
|
|
37
|
-
excludeRegex?: RegExp;
|
|
38
|
-
}
|
|
39
|
-
export interface A_UTILS_TYPES__ManifestQuery {
|
|
40
|
-
component: A_TYPES__Component_Constructor;
|
|
41
|
-
method: string;
|
|
42
|
-
target: A_UTILS_TYPES__Manifest_AllowedComponents;
|
|
43
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"A-Manifest.types.js","sourceRoot":"","sources":["../../../../src/lib/A-Manifest/A-Manifest.types.ts"],"names":[],"mappings":""}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { A_TYPES__Component_Constructor } from "@adaas/a-concept";
|
|
2
|
-
import { A_Manifest } from "../A-Manifest.context";
|
|
3
|
-
import { A_UTILS_TYPES__Manifest_AllowedComponents } from "../A-Manifest.types";
|
|
4
|
-
/**
|
|
5
|
-
* Fluent API for checking manifest permissions
|
|
6
|
-
*/
|
|
7
|
-
export declare class A_ManifestChecker {
|
|
8
|
-
private manifest;
|
|
9
|
-
private component;
|
|
10
|
-
private method;
|
|
11
|
-
private checkExclusion;
|
|
12
|
-
constructor(manifest: A_Manifest, component: A_TYPES__Component_Constructor, method: string, checkExclusion?: boolean);
|
|
13
|
-
for(target: A_UTILS_TYPES__Manifest_AllowedComponents): boolean;
|
|
14
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.A_ManifestChecker = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Fluent API for checking manifest permissions
|
|
6
|
-
*/
|
|
7
|
-
class A_ManifestChecker {
|
|
8
|
-
constructor(manifest, component, method, checkExclusion = false) {
|
|
9
|
-
this.manifest = manifest;
|
|
10
|
-
this.component = component;
|
|
11
|
-
this.method = method;
|
|
12
|
-
this.checkExclusion = checkExclusion;
|
|
13
|
-
}
|
|
14
|
-
for(target) {
|
|
15
|
-
const result = this.manifest.internal_checkAccess({
|
|
16
|
-
component: this.component,
|
|
17
|
-
method: this.method,
|
|
18
|
-
target: target
|
|
19
|
-
});
|
|
20
|
-
return this.checkExclusion ? !result : result;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
exports.A_ManifestChecker = A_ManifestChecker;
|
|
24
|
-
//# sourceMappingURL=A-ManifestChecker.class.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"A-ManifestChecker.class.js","sourceRoot":"","sources":["../../../../../src/lib/A-Manifest/classes/A-ManifestChecker.class.ts"],"names":[],"mappings":";;;AAIA;;GAEG;AACH,MAAa,iBAAiB;IAC1B,YACY,QAAoB,EACpB,SAAyC,EACzC,MAAc,EACd,iBAA0B,KAAK;QAH/B,aAAQ,GAAR,QAAQ,CAAY;QACpB,cAAS,GAAT,SAAS,CAAgC;QACzC,WAAM,GAAN,MAAM,CAAQ;QACd,mBAAc,GAAd,cAAc,CAAiB;IACxC,CAAC;IAEJ,GAAG,CAAC,MAAiD;QACjD,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC;YAC9C,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,MAAM,EAAE,MAAM;SACjB,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;IAClD,CAAC;CACJ;AAjBD,8CAiBC"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { A_Error, A_Fragment } from "@adaas/a-concept";
|
|
2
|
-
export declare class A_Memory<_MemoryType extends Record<string, any> = Record<string, any>, _SerializedType extends Record<string, any> = Record<string, any>> extends A_Fragment {
|
|
3
|
-
/**
|
|
4
|
-
* Internal storage of all intermediate values
|
|
5
|
-
*/
|
|
6
|
-
protected _memory: Map<keyof _MemoryType, _MemoryType[keyof _MemoryType]>;
|
|
7
|
-
/**
|
|
8
|
-
* Errors encountered during the execution
|
|
9
|
-
*/
|
|
10
|
-
protected _errors: Set<A_Error>;
|
|
11
|
-
/**
|
|
12
|
-
* Memory object that allows to store intermediate values and errors
|
|
13
|
-
*
|
|
14
|
-
* @param initialValues
|
|
15
|
-
*/
|
|
16
|
-
constructor(initialValues?: _MemoryType);
|
|
17
|
-
get Errors(): Set<A_Error> | undefined;
|
|
18
|
-
/**
|
|
19
|
-
* Verifies that all required keys are present in the proxy values
|
|
20
|
-
*
|
|
21
|
-
* @param requiredKeys
|
|
22
|
-
* @returns
|
|
23
|
-
*/
|
|
24
|
-
verifyPrerequisites(requiredKeys: Array<keyof _MemoryType>): Promise<boolean>;
|
|
25
|
-
/**
|
|
26
|
-
* Adds an error to the context
|
|
27
|
-
*
|
|
28
|
-
* @param error
|
|
29
|
-
*/
|
|
30
|
-
error(error: A_Error): Promise<void>;
|
|
31
|
-
/**
|
|
32
|
-
* Saves a value in the context memory
|
|
33
|
-
*
|
|
34
|
-
* @param key
|
|
35
|
-
* @param value
|
|
36
|
-
*/
|
|
37
|
-
set<K extends keyof _MemoryType>(
|
|
38
|
-
/**
|
|
39
|
-
* Key to save the value under
|
|
40
|
-
*/
|
|
41
|
-
key: K,
|
|
42
|
-
/**
|
|
43
|
-
* Value to save
|
|
44
|
-
*/
|
|
45
|
-
value: _MemoryType[K]): Promise<void>;
|
|
46
|
-
/**
|
|
47
|
-
* Removes a value from the context memory by key
|
|
48
|
-
*
|
|
49
|
-
* @param key
|
|
50
|
-
*/
|
|
51
|
-
drop(key: keyof _MemoryType): Promise<void>;
|
|
52
|
-
/**
|
|
53
|
-
* Clears all stored values in the context memory
|
|
54
|
-
*/
|
|
55
|
-
clear(): Promise<void>;
|
|
56
|
-
/**
|
|
57
|
-
* Converts all stored values to a plain object
|
|
58
|
-
*
|
|
59
|
-
* [!] By default uses all saved in memory values
|
|
60
|
-
*
|
|
61
|
-
* @returns
|
|
62
|
-
*/
|
|
63
|
-
toJSON(): _SerializedType;
|
|
64
|
-
}
|