@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
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,914 @@
|
|
|
1
|
+
import { A_Component, A_Error, A_TYPES__Error_Serialized, A_TYPES__Entity_Serialized, A_Meta, A_TYPES__FeatureExtendDecoratorMeta, A_TYPES__FeatureDefineDecoratorMeta, A_Entity, A_Scope, A_TYPES__ConceptENVVariables, A_TYPES__Fragment_Constructor, A_Fragment, A_Container, A_Feature, A_TYPES__Component_Constructor, A_TYPES__Entity_Constructor } from '@adaas/a-concept';
|
|
2
|
+
import { A_TYPES__Container_Constructor } from '@adaas/a-concept/dist/src/global/A-Container/A-Container.types';
|
|
3
|
+
|
|
4
|
+
declare class A_Channel extends A_Component {
|
|
5
|
+
/**
|
|
6
|
+
* Indicates whether the channel is processing requests
|
|
7
|
+
*/
|
|
8
|
+
protected _processing: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Indicates whether the channel is connected
|
|
11
|
+
*/
|
|
12
|
+
protected _initialized?: Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Indicates whether the channel is processing requests
|
|
15
|
+
*/
|
|
16
|
+
get processing(): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Indicates whether the channel is connected
|
|
19
|
+
*/
|
|
20
|
+
get initialize(): Promise<void>;
|
|
21
|
+
connect(): Promise<void>;
|
|
22
|
+
request(params: any): Promise<any>;
|
|
23
|
+
send(message: any): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare class A_ChannelError extends A_Error {
|
|
27
|
+
static readonly MethodNotImplemented = "A-Channel Method Not Implemented";
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
declare enum A_TYPES__CommandMetaKey {
|
|
31
|
+
EXTENSIONS = "a-command-extensions",
|
|
32
|
+
FEATURES = "a-command-features",
|
|
33
|
+
ABSTRACTIONS = "a-command-abstractions"
|
|
34
|
+
}
|
|
35
|
+
declare enum A_CONSTANTS__A_Command_Status {
|
|
36
|
+
INITIALIZED = "INITIALIZED",
|
|
37
|
+
IN_PROGRESS = "IN_PROGRESS",
|
|
38
|
+
COMPLETED = "COMPLETED",
|
|
39
|
+
FAILED = "FAILED"
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A-Command Lifecycle Features
|
|
43
|
+
*/
|
|
44
|
+
declare enum A_CONSTANTS_A_Command_Features {
|
|
45
|
+
INIT = "init",
|
|
46
|
+
COMPLIED = "complied",
|
|
47
|
+
EXECUTE = "execute",
|
|
48
|
+
COMPLETE = "complete",
|
|
49
|
+
FAIL = "fail"
|
|
50
|
+
}
|
|
51
|
+
type A_CONSTANTS__A_Command_Event = 'init' | 'compile' | 'execute' | 'complete' | 'fail';
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Command constructor type
|
|
55
|
+
* Uses the generic type T to specify the type of the entity
|
|
56
|
+
*/
|
|
57
|
+
type A_TYPES__Command_Constructor<T = A_Command> = new (...args: any[]) => T;
|
|
58
|
+
/**
|
|
59
|
+
* Command initialization type
|
|
60
|
+
*/
|
|
61
|
+
type A_TYPES__Command_Init = any;
|
|
62
|
+
/**
|
|
63
|
+
* Command serialized type
|
|
64
|
+
*/
|
|
65
|
+
type A_TYPES__Command_Serialized<ResultType extends Record<string, any> = Record<string, any>> = {
|
|
66
|
+
/**
|
|
67
|
+
* Unique code of the command
|
|
68
|
+
*/
|
|
69
|
+
code: string;
|
|
70
|
+
/**
|
|
71
|
+
* Current status of the command
|
|
72
|
+
*/
|
|
73
|
+
status: A_CONSTANTS__A_Command_Status;
|
|
74
|
+
/**
|
|
75
|
+
* The time when the command was created
|
|
76
|
+
*/
|
|
77
|
+
startedAt?: string;
|
|
78
|
+
/**
|
|
79
|
+
* The time when the command execution ended
|
|
80
|
+
*/
|
|
81
|
+
endedAt?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Duration of the command execution in milliseconds
|
|
84
|
+
*/
|
|
85
|
+
duration?: number;
|
|
86
|
+
/**
|
|
87
|
+
* Result of the command execution
|
|
88
|
+
*/
|
|
89
|
+
result?: ResultType;
|
|
90
|
+
/**
|
|
91
|
+
* List of errors occurred during the command execution
|
|
92
|
+
*/
|
|
93
|
+
errors?: Array<A_TYPES__Error_Serialized>;
|
|
94
|
+
} & A_TYPES__Entity_Serialized;
|
|
95
|
+
/**
|
|
96
|
+
* Command listener type
|
|
97
|
+
*/
|
|
98
|
+
type A_TYPES__Command_Listener<InvokeType extends A_TYPES__Command_Init = A_TYPES__Command_Init, ResultType extends Record<string, any> = Record<string, any>, LifecycleEvents extends string = A_CONSTANTS__A_Command_Event> = (command?: A_Command<InvokeType, ResultType, LifecycleEvents>) => void;
|
|
99
|
+
/**
|
|
100
|
+
* Command meta type
|
|
101
|
+
*/
|
|
102
|
+
type A_TYPES__CommandMeta = {
|
|
103
|
+
[A_TYPES__CommandMetaKey.EXTENSIONS]: A_Meta<{
|
|
104
|
+
/**
|
|
105
|
+
* Where Key the regexp for what to apply the extension
|
|
106
|
+
* A set of container names or a wildcard, or a regexp
|
|
107
|
+
*
|
|
108
|
+
*
|
|
109
|
+
* Where value is the extension instructions
|
|
110
|
+
*/
|
|
111
|
+
[Key: string]: A_TYPES__FeatureExtendDecoratorMeta[];
|
|
112
|
+
}>;
|
|
113
|
+
case: any;
|
|
114
|
+
[A_TYPES__CommandMetaKey.FEATURES]: A_Meta<{
|
|
115
|
+
/**
|
|
116
|
+
* Where Key is the name of the feature
|
|
117
|
+
*
|
|
118
|
+
* Where value is the list of features
|
|
119
|
+
*/
|
|
120
|
+
[Key: string]: A_TYPES__FeatureDefineDecoratorMeta;
|
|
121
|
+
}>;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
declare class A_Command<InvokeType extends A_TYPES__Command_Init = A_TYPES__Command_Init, ResultType extends Record<string, any> = Record<string, any>, LifecycleEvents extends string = A_CONSTANTS__A_Command_Event> extends A_Entity<InvokeType, A_TYPES__Command_Serialized<ResultType>> {
|
|
125
|
+
/**
|
|
126
|
+
* Command Identifier that corresponds to the class name
|
|
127
|
+
*/
|
|
128
|
+
static get code(): string;
|
|
129
|
+
protected _result?: ResultType;
|
|
130
|
+
protected _executionScope: A_Scope;
|
|
131
|
+
protected _errors?: Set<A_Error>;
|
|
132
|
+
protected _params: InvokeType;
|
|
133
|
+
protected _status: A_CONSTANTS__A_Command_Status;
|
|
134
|
+
protected _listeners: Map<LifecycleEvents | A_CONSTANTS__A_Command_Event, Set<A_TYPES__Command_Listener<InvokeType, ResultType, LifecycleEvents>>>;
|
|
135
|
+
protected _startTime?: Date;
|
|
136
|
+
protected _endTime?: Date;
|
|
137
|
+
/**
|
|
138
|
+
* Execution Duration in milliseconds
|
|
139
|
+
*/
|
|
140
|
+
get duration(): number | undefined;
|
|
141
|
+
/**
|
|
142
|
+
* A shared scope between all features of the command during its execution
|
|
143
|
+
*/
|
|
144
|
+
get scope(): A_Scope;
|
|
145
|
+
/**
|
|
146
|
+
* Unique code identifying the command type
|
|
147
|
+
* Example: 'user.create', 'task.complete', etc.
|
|
148
|
+
*
|
|
149
|
+
*/
|
|
150
|
+
get code(): string;
|
|
151
|
+
/**
|
|
152
|
+
* Current status of the command
|
|
153
|
+
*/
|
|
154
|
+
get status(): A_CONSTANTS__A_Command_Status;
|
|
155
|
+
/**
|
|
156
|
+
* Start time of the command execution
|
|
157
|
+
*/
|
|
158
|
+
get startedAt(): Date | undefined;
|
|
159
|
+
/**
|
|
160
|
+
* End time of the command execution
|
|
161
|
+
*/
|
|
162
|
+
get endedAt(): Date | undefined;
|
|
163
|
+
/**
|
|
164
|
+
* Result of the command execution stored in the context
|
|
165
|
+
*/
|
|
166
|
+
get result(): ResultType | undefined;
|
|
167
|
+
/**
|
|
168
|
+
* Errors encountered during the command execution stored in the context
|
|
169
|
+
*/
|
|
170
|
+
get errors(): Set<A_Error> | undefined;
|
|
171
|
+
/**
|
|
172
|
+
* Parameters used to invoke the command
|
|
173
|
+
*/
|
|
174
|
+
get params(): InvokeType;
|
|
175
|
+
/**
|
|
176
|
+
* Indicates if the command has failed
|
|
177
|
+
*/
|
|
178
|
+
get isFailed(): boolean;
|
|
179
|
+
/**
|
|
180
|
+
* Indicates if the command has completed successfully
|
|
181
|
+
*/
|
|
182
|
+
get isCompleted(): boolean;
|
|
183
|
+
/**
|
|
184
|
+
*
|
|
185
|
+
* A-Command represents an executable command with a specific code and parameters.
|
|
186
|
+
* It can be executed within a given scope and stores execution results and errors.
|
|
187
|
+
*
|
|
188
|
+
*
|
|
189
|
+
* A-Command should be context independent and execution logic should be based on attached components
|
|
190
|
+
*
|
|
191
|
+
* @param code
|
|
192
|
+
* @param params
|
|
193
|
+
*/
|
|
194
|
+
constructor(
|
|
195
|
+
/**
|
|
196
|
+
* Command invocation parameters
|
|
197
|
+
*/
|
|
198
|
+
params: InvokeType | A_TYPES__Command_Serialized<ResultType> | string);
|
|
199
|
+
init(): Promise<void>;
|
|
200
|
+
compile(): Promise<void>;
|
|
201
|
+
/**
|
|
202
|
+
* Executes the command logic.
|
|
203
|
+
*/
|
|
204
|
+
execute(): Promise<any>;
|
|
205
|
+
/**
|
|
206
|
+
* Marks the command as completed
|
|
207
|
+
*/
|
|
208
|
+
complete(): Promise<void>;
|
|
209
|
+
/**
|
|
210
|
+
* Marks the command as failed
|
|
211
|
+
*/
|
|
212
|
+
fail(): Promise<void>;
|
|
213
|
+
/**
|
|
214
|
+
* Registers an event listener for a specific event
|
|
215
|
+
*
|
|
216
|
+
* @param event
|
|
217
|
+
* @param listener
|
|
218
|
+
*/
|
|
219
|
+
on(event: LifecycleEvents | A_CONSTANTS__A_Command_Event, listener: A_TYPES__Command_Listener<InvokeType, ResultType, LifecycleEvents>): void;
|
|
220
|
+
/**
|
|
221
|
+
* Removes an event listener for a specific event
|
|
222
|
+
*
|
|
223
|
+
* @param event
|
|
224
|
+
* @param listener
|
|
225
|
+
*/
|
|
226
|
+
off(event: LifecycleEvents | A_CONSTANTS__A_Command_Event, listener: A_TYPES__Command_Listener<InvokeType, ResultType, LifecycleEvents>): void;
|
|
227
|
+
/**
|
|
228
|
+
* Emits an event to all registered listeners
|
|
229
|
+
*
|
|
230
|
+
* @param event
|
|
231
|
+
*/
|
|
232
|
+
emit(event: LifecycleEvents | A_CONSTANTS__A_Command_Event): void;
|
|
233
|
+
/**
|
|
234
|
+
* Allows to create a Command instance from new data
|
|
235
|
+
*
|
|
236
|
+
* @param newEntity
|
|
237
|
+
*/
|
|
238
|
+
fromNew(newEntity: InvokeType): void;
|
|
239
|
+
/**
|
|
240
|
+
* Allows to convert serialized data to Command instance
|
|
241
|
+
*
|
|
242
|
+
* [!] By default it omits params as they are not stored in the serialized data
|
|
243
|
+
*
|
|
244
|
+
* @param serialized
|
|
245
|
+
*/
|
|
246
|
+
fromJSON(serialized: A_TYPES__Command_Serialized<ResultType>): void;
|
|
247
|
+
/**
|
|
248
|
+
* Converts the Command instance to a plain object
|
|
249
|
+
*
|
|
250
|
+
* @returns
|
|
251
|
+
*/
|
|
252
|
+
toJSON(): A_TYPES__Command_Serialized<ResultType>;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
declare class A_CommandError extends A_Error {
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
interface Ifspolyfill {
|
|
259
|
+
readFileSync: (path: string, encoding: string) => string;
|
|
260
|
+
existsSync: (path: string) => boolean;
|
|
261
|
+
createReadStream: (path: string, options?: BufferEncoding) => any;
|
|
262
|
+
}
|
|
263
|
+
interface IcryptoInterface {
|
|
264
|
+
createTextHash(text: string, algorithm: string): Promise<string>;
|
|
265
|
+
createFileHash(filePath: string, algorithm: string): Promise<string>;
|
|
266
|
+
}
|
|
267
|
+
interface IhttpInterface {
|
|
268
|
+
request: (options: any, callback?: (res: any) => void) => any;
|
|
269
|
+
get: (url: string | any, callback?: (res: any) => void) => any;
|
|
270
|
+
createServer: (requestListener?: (req: any, res: any) => void) => any;
|
|
271
|
+
}
|
|
272
|
+
interface IhttpsInterface {
|
|
273
|
+
request: (options: any, callback?: (res: any) => void) => any;
|
|
274
|
+
get: (url: string | any, callback?: (res: any) => void) => any;
|
|
275
|
+
createServer: (options: any, requestListener?: (req: any, res: any) => void) => any;
|
|
276
|
+
}
|
|
277
|
+
interface IpathInterface {
|
|
278
|
+
join: (...paths: string[]) => string;
|
|
279
|
+
resolve: (...paths: string[]) => string;
|
|
280
|
+
dirname: (path: string) => string;
|
|
281
|
+
basename: (path: string, ext?: string) => string;
|
|
282
|
+
extname: (path: string) => string;
|
|
283
|
+
relative: (from: string, to: string) => string;
|
|
284
|
+
normalize: (path: string) => string;
|
|
285
|
+
isAbsolute: (path: string) => boolean;
|
|
286
|
+
parse: (path: string) => any;
|
|
287
|
+
format: (pathObject: any) => string;
|
|
288
|
+
sep: string;
|
|
289
|
+
delimiter: string;
|
|
290
|
+
}
|
|
291
|
+
interface IurlInterface {
|
|
292
|
+
parse: (urlString: string) => any;
|
|
293
|
+
format: (urlObject: any) => string;
|
|
294
|
+
resolve: (from: string, to: string) => string;
|
|
295
|
+
URL: typeof URL;
|
|
296
|
+
URLSearchParams: typeof URLSearchParams;
|
|
297
|
+
}
|
|
298
|
+
interface IbufferInterface {
|
|
299
|
+
from: (data: any, encoding?: string) => any;
|
|
300
|
+
alloc: (size: number, fill?: any) => any;
|
|
301
|
+
allocUnsafe: (size: number) => any;
|
|
302
|
+
isBuffer: (obj: any) => boolean;
|
|
303
|
+
concat: (list: any[], totalLength?: number) => any;
|
|
304
|
+
}
|
|
305
|
+
interface IprocessInterface {
|
|
306
|
+
env: Record<string, string | undefined>;
|
|
307
|
+
argv: string[];
|
|
308
|
+
platform: string;
|
|
309
|
+
version: string;
|
|
310
|
+
versions: Record<string, string>;
|
|
311
|
+
cwd: () => string;
|
|
312
|
+
exit: (code?: number) => never;
|
|
313
|
+
nextTick: (callback: Function, ...args: any[]) => void;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
declare enum A_TYPES__ConfigFeature {
|
|
317
|
+
}
|
|
318
|
+
type A_TYPES__ConfigContainerConstructor<T extends Array<string | A_TYPES__ConceptENVVariables[number]>> = {
|
|
319
|
+
/**
|
|
320
|
+
* If set to true, the SDK will throw an error if the variable is not defined OR not presented in the defaults
|
|
321
|
+
*/
|
|
322
|
+
strict: boolean;
|
|
323
|
+
/**
|
|
324
|
+
* Allows to define the names of variable to be loaded
|
|
325
|
+
*/
|
|
326
|
+
variables: T;
|
|
327
|
+
/**
|
|
328
|
+
* Allows to set the default values for the variables
|
|
329
|
+
*/
|
|
330
|
+
defaults: {
|
|
331
|
+
[key in T[number]]?: any;
|
|
332
|
+
};
|
|
333
|
+
} & A_TYPES__Fragment_Constructor;
|
|
334
|
+
|
|
335
|
+
declare class A_Config<T extends Array<string | A_TYPES__ConceptENVVariables[number]> = any[]> extends A_Fragment {
|
|
336
|
+
config: A_TYPES__ConfigContainerConstructor<T>;
|
|
337
|
+
private VARIABLES;
|
|
338
|
+
CONFIG_PROPERTIES: T;
|
|
339
|
+
protected DEFAULT_ALLOWED_TO_READ_PROPERTIES: ("A_CONCEPT_NAME" | "A_CONCEPT_ROOT_SCOPE" | "A_CONCEPT_ENVIRONMENT" | "A_CONCEPT_ROOT_FOLDER" | "A_ERROR_DEFAULT_DESCRIPTION")[];
|
|
340
|
+
constructor(config: Partial<A_TYPES__ConfigContainerConstructor<T>>);
|
|
341
|
+
/**
|
|
342
|
+
* This method is used to get the configuration property by name
|
|
343
|
+
*
|
|
344
|
+
* @param property
|
|
345
|
+
* @returns
|
|
346
|
+
*/
|
|
347
|
+
get<_OutType = any>(property: T[number] | typeof this.DEFAULT_ALLOWED_TO_READ_PROPERTIES[number]): _OutType;
|
|
348
|
+
/**
|
|
349
|
+
*
|
|
350
|
+
* This method is used to set the configuration property by name
|
|
351
|
+
* OR set multiple properties at once by passing an array of objects
|
|
352
|
+
*
|
|
353
|
+
* @param variables
|
|
354
|
+
*/
|
|
355
|
+
set(variables: Array<{
|
|
356
|
+
property: T[number] | A_TYPES__ConceptENVVariables[number];
|
|
357
|
+
value: any;
|
|
358
|
+
}>): any;
|
|
359
|
+
set(variables: Partial<Record<T[number] | A_TYPES__ConceptENVVariables[number], any>>): any;
|
|
360
|
+
set(property: T[number] | A_TYPES__ConceptENVVariables[number], value: any): any;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
declare class A_Logger extends A_Component {
|
|
364
|
+
protected scope: A_Scope;
|
|
365
|
+
protected config?: A_Config<any>;
|
|
366
|
+
constructor(scope: A_Scope);
|
|
367
|
+
readonly colors: {
|
|
368
|
+
readonly green: "32";
|
|
369
|
+
readonly blue: "34";
|
|
370
|
+
readonly red: "31";
|
|
371
|
+
readonly yellow: "33";
|
|
372
|
+
readonly gray: "90";
|
|
373
|
+
readonly magenta: "35";
|
|
374
|
+
readonly cyan: "36";
|
|
375
|
+
readonly white: "37";
|
|
376
|
+
readonly pink: "95";
|
|
377
|
+
};
|
|
378
|
+
get scopeLength(): number;
|
|
379
|
+
compile(color: keyof typeof this.colors, ...args: any[]): Array<string>;
|
|
380
|
+
protected get allowedToLog(): boolean;
|
|
381
|
+
log(color: keyof typeof this.colors, ...args: any[]): any;
|
|
382
|
+
log(...args: any[]): any;
|
|
383
|
+
warning(...args: any[]): void;
|
|
384
|
+
error(...args: any[]): void;
|
|
385
|
+
protected log_A_Error(error: A_Error): void;
|
|
386
|
+
protected compile_A_Error(error: A_Error): string;
|
|
387
|
+
protected compile_Error(error: Error): string;
|
|
388
|
+
protected getTime(): string;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
declare class A_FSPolyfillClass {
|
|
392
|
+
protected logger: A_Logger;
|
|
393
|
+
private _fs;
|
|
394
|
+
private _initialized;
|
|
395
|
+
constructor(logger: A_Logger);
|
|
396
|
+
get isInitialized(): boolean;
|
|
397
|
+
get(): Promise<Ifspolyfill>;
|
|
398
|
+
private init;
|
|
399
|
+
private initServer;
|
|
400
|
+
private initBrowser;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
declare class A_CryptoPolyfillClass {
|
|
404
|
+
protected logger: A_Logger;
|
|
405
|
+
private _crypto;
|
|
406
|
+
private _initialized;
|
|
407
|
+
private _fsPolyfill?;
|
|
408
|
+
constructor(logger: A_Logger);
|
|
409
|
+
get isInitialized(): boolean;
|
|
410
|
+
get(fsPolyfill?: Ifspolyfill): Promise<IcryptoInterface>;
|
|
411
|
+
private init;
|
|
412
|
+
private initServer;
|
|
413
|
+
private initBrowser;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
declare class A_HttpPolyfillClass {
|
|
417
|
+
protected logger: A_Logger;
|
|
418
|
+
private _http;
|
|
419
|
+
private _initialized;
|
|
420
|
+
constructor(logger: A_Logger);
|
|
421
|
+
get isInitialized(): boolean;
|
|
422
|
+
get(): Promise<IhttpInterface>;
|
|
423
|
+
private init;
|
|
424
|
+
private initServer;
|
|
425
|
+
private initBrowser;
|
|
426
|
+
private createMockRequest;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
declare class A_HttpsPolyfillClass {
|
|
430
|
+
protected logger: A_Logger;
|
|
431
|
+
private _https;
|
|
432
|
+
private _initialized;
|
|
433
|
+
constructor(logger: A_Logger);
|
|
434
|
+
get isInitialized(): boolean;
|
|
435
|
+
get(): Promise<IhttpsInterface>;
|
|
436
|
+
private init;
|
|
437
|
+
private initServer;
|
|
438
|
+
private initBrowser;
|
|
439
|
+
private createMockRequest;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
declare class A_PathPolyfillClass {
|
|
443
|
+
protected logger: A_Logger;
|
|
444
|
+
private _path;
|
|
445
|
+
private _initialized;
|
|
446
|
+
constructor(logger: A_Logger);
|
|
447
|
+
get isInitialized(): boolean;
|
|
448
|
+
get(): Promise<IpathInterface>;
|
|
449
|
+
private init;
|
|
450
|
+
private initServer;
|
|
451
|
+
private initBrowser;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
declare class A_UrlPolyfillClass {
|
|
455
|
+
protected logger: A_Logger;
|
|
456
|
+
private _url;
|
|
457
|
+
private _initialized;
|
|
458
|
+
get isInitialized(): boolean;
|
|
459
|
+
constructor(logger: A_Logger);
|
|
460
|
+
get(): Promise<IurlInterface>;
|
|
461
|
+
private init;
|
|
462
|
+
private initServer;
|
|
463
|
+
private initBrowser;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
declare class A_BufferPolyfillClass {
|
|
467
|
+
protected logger: A_Logger;
|
|
468
|
+
private _buffer;
|
|
469
|
+
private _initialized;
|
|
470
|
+
constructor(logger: A_Logger);
|
|
471
|
+
get isInitialized(): boolean;
|
|
472
|
+
get(): Promise<IbufferInterface>;
|
|
473
|
+
private init;
|
|
474
|
+
private initServer;
|
|
475
|
+
private initBrowser;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
declare class A_ProcessPolyfillClass {
|
|
479
|
+
protected logger: A_Logger;
|
|
480
|
+
private _process;
|
|
481
|
+
private _initialized;
|
|
482
|
+
get isInitialized(): boolean;
|
|
483
|
+
constructor(logger: A_Logger);
|
|
484
|
+
get(): Promise<IprocessInterface>;
|
|
485
|
+
private init;
|
|
486
|
+
private initServer;
|
|
487
|
+
private initBrowser;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
declare class A_Polyfill extends A_Component {
|
|
491
|
+
protected logger: A_Logger;
|
|
492
|
+
protected _fsPolyfill: A_FSPolyfillClass;
|
|
493
|
+
protected _cryptoPolyfill: A_CryptoPolyfillClass;
|
|
494
|
+
protected _httpPolyfill: A_HttpPolyfillClass;
|
|
495
|
+
protected _httpsPolyfill: A_HttpsPolyfillClass;
|
|
496
|
+
protected _pathPolyfill: A_PathPolyfillClass;
|
|
497
|
+
protected _urlPolyfill: A_UrlPolyfillClass;
|
|
498
|
+
protected _bufferPolyfill: A_BufferPolyfillClass;
|
|
499
|
+
protected _processPolyfill: A_ProcessPolyfillClass;
|
|
500
|
+
protected _initializing: Promise<void> | null;
|
|
501
|
+
/**
|
|
502
|
+
* Indicates whether the channel is connected
|
|
503
|
+
*/
|
|
504
|
+
protected _initialized?: Promise<void>;
|
|
505
|
+
constructor(logger: A_Logger);
|
|
506
|
+
/**
|
|
507
|
+
* Indicates whether the channel is connected
|
|
508
|
+
*/
|
|
509
|
+
get ready(): Promise<void>;
|
|
510
|
+
load(): Promise<void>;
|
|
511
|
+
attachToWindow(): Promise<void>;
|
|
512
|
+
protected _loadInternal(): Promise<void>;
|
|
513
|
+
/**
|
|
514
|
+
* Allows to use the 'fs' polyfill methods regardless of the environment
|
|
515
|
+
* This method loads the 'fs' polyfill and returns its instance
|
|
516
|
+
*
|
|
517
|
+
* @returns
|
|
518
|
+
*/
|
|
519
|
+
fs(): Promise<Ifspolyfill>;
|
|
520
|
+
/**
|
|
521
|
+
* Allows to use the 'crypto' polyfill methods regardless of the environment
|
|
522
|
+
* This method loads the 'crypto' polyfill and returns its instance
|
|
523
|
+
*
|
|
524
|
+
* @returns
|
|
525
|
+
*/
|
|
526
|
+
crypto(): Promise<IcryptoInterface>;
|
|
527
|
+
/**
|
|
528
|
+
* Allows to use the 'http' polyfill methods regardless of the environment
|
|
529
|
+
* This method loads the 'http' polyfill and returns its instance
|
|
530
|
+
*
|
|
531
|
+
* @returns
|
|
532
|
+
*/
|
|
533
|
+
http(): Promise<IhttpInterface>;
|
|
534
|
+
/**
|
|
535
|
+
* Allows to use the 'https' polyfill methods regardless of the environment
|
|
536
|
+
* This method loads the 'https' polyfill and returns its instance
|
|
537
|
+
*
|
|
538
|
+
* @returns
|
|
539
|
+
*/
|
|
540
|
+
https(): Promise<IhttpsInterface>;
|
|
541
|
+
/**
|
|
542
|
+
* Allows to use the 'path' polyfill methods regardless of the environment
|
|
543
|
+
* This method loads the 'path' polyfill and returns its instance
|
|
544
|
+
*
|
|
545
|
+
* @returns
|
|
546
|
+
*/
|
|
547
|
+
path(): Promise<IpathInterface>;
|
|
548
|
+
/**
|
|
549
|
+
* Allows to use the 'url' polyfill methods regardless of the environment
|
|
550
|
+
* This method loads the 'url' polyfill and returns its instance
|
|
551
|
+
*
|
|
552
|
+
* @returns
|
|
553
|
+
*/
|
|
554
|
+
url(): Promise<IurlInterface>;
|
|
555
|
+
/**
|
|
556
|
+
* Allows to use the 'buffer' polyfill methods regardless of the environment
|
|
557
|
+
* This method loads the 'buffer' polyfill and returns its instance
|
|
558
|
+
*
|
|
559
|
+
* @returns
|
|
560
|
+
*/
|
|
561
|
+
buffer(): Promise<IbufferInterface>;
|
|
562
|
+
/**
|
|
563
|
+
* Allows to use the 'process' polyfill methods regardless of the environment
|
|
564
|
+
* This method loads the 'process' polyfill and returns its instance
|
|
565
|
+
*
|
|
566
|
+
* @returns
|
|
567
|
+
*/
|
|
568
|
+
process(): Promise<IprocessInterface>;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
declare class A_ConfigLoader extends A_Container {
|
|
572
|
+
private reader;
|
|
573
|
+
prepare(polyfill: A_Polyfill): Promise<void>;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
declare class A_ConfigError extends A_Error {
|
|
577
|
+
static readonly InitializationError = "A-Config Initialization Error";
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* Config Reader
|
|
582
|
+
*/
|
|
583
|
+
declare class ConfigReader extends A_Component {
|
|
584
|
+
protected polyfill: A_Polyfill;
|
|
585
|
+
constructor(polyfill: A_Polyfill);
|
|
586
|
+
attachContext(container: A_Container, feature: A_Feature): Promise<void>;
|
|
587
|
+
initialize(config: A_Config): Promise<void>;
|
|
588
|
+
/**
|
|
589
|
+
* Get the configuration property by Name
|
|
590
|
+
* @param property
|
|
591
|
+
*/
|
|
592
|
+
resolve<_ReturnType = any>(property: string): _ReturnType;
|
|
593
|
+
/**
|
|
594
|
+
* This method reads the configuration and sets the values to the context
|
|
595
|
+
*
|
|
596
|
+
* @returns
|
|
597
|
+
*/
|
|
598
|
+
read<T extends string>(variables?: Array<T>): Promise<Record<T, any>>;
|
|
599
|
+
/**
|
|
600
|
+
* Finds the root directory of the project by locating the folder containing package.json
|
|
601
|
+
*
|
|
602
|
+
* @param {string} startPath - The initial directory to start searching from (default is __dirname)
|
|
603
|
+
* @returns {string|null} - The path to the root directory or null if package.json is not found
|
|
604
|
+
*/
|
|
605
|
+
protected getProjectRoot(startPath?: string): Promise<string>;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
declare class ENVConfigReader extends ConfigReader {
|
|
609
|
+
readEnvFile(config: A_Config<A_TYPES__ConceptENVVariables>, polyfill: A_Polyfill, feature: A_Feature): Promise<void>;
|
|
610
|
+
/**
|
|
611
|
+
* Get the configuration property Name
|
|
612
|
+
* @param property
|
|
613
|
+
*/
|
|
614
|
+
getConfigurationProperty_ENV_Alias(property: string): string;
|
|
615
|
+
resolve<_ReturnType = any>(property: string): _ReturnType;
|
|
616
|
+
read<T extends string>(variables?: Array<T>): Promise<Record<T, any>>;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
declare class FileConfigReader extends ConfigReader {
|
|
620
|
+
private FileData;
|
|
621
|
+
/**
|
|
622
|
+
* Get the configuration property Name
|
|
623
|
+
* @param property
|
|
624
|
+
*/
|
|
625
|
+
getConfigurationProperty_File_Alias(property: string): string;
|
|
626
|
+
resolve<_ReturnType = any>(property: string): _ReturnType;
|
|
627
|
+
read<T extends string>(variables?: Array<T>): Promise<Record<T, any>>;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
declare const A_CONSTANTS__CONFIG_ENV_VARIABLES: {};
|
|
631
|
+
type A_TYPES__ConfigENVVariables = (typeof A_CONSTANTS__CONFIG_ENV_VARIABLES)[keyof typeof A_CONSTANTS__CONFIG_ENV_VARIABLES][];
|
|
632
|
+
declare const A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY: readonly [];
|
|
633
|
+
|
|
634
|
+
type A_UTILS_TYPES__Manifest_Init = Array<A_UTILS_TYPES__Manifest_ComponentLevelConfig>;
|
|
635
|
+
type A_UTILS_TYPES__Manifest_ComponentLevelConfig<T extends A_Component = A_Component> = {
|
|
636
|
+
/**
|
|
637
|
+
* Component constructor
|
|
638
|
+
*/
|
|
639
|
+
component: A_TYPES__Component_Constructor<T>;
|
|
640
|
+
/**
|
|
641
|
+
* Method level configurations for the component
|
|
642
|
+
*/
|
|
643
|
+
methods?: Array<A_UTILS_TYPES__Manifest_MethodLevelConfig<T>>;
|
|
644
|
+
} & Partial<A_UTILS_TYPES__Manifest_Rules>;
|
|
645
|
+
type A_UTILS_TYPES__Manifest_MethodLevelConfig<T extends A_Component = A_Component> = {
|
|
646
|
+
/**
|
|
647
|
+
* Method name from the component provided
|
|
648
|
+
*/
|
|
649
|
+
method: string | RegExp;
|
|
650
|
+
} & Partial<A_UTILS_TYPES__Manifest_Rules>;
|
|
651
|
+
type A_UTILS_TYPES__Manifest_Rules = {
|
|
652
|
+
/**
|
|
653
|
+
* A list of entities to which a component is applied
|
|
654
|
+
*
|
|
655
|
+
* By default is for all
|
|
656
|
+
*/
|
|
657
|
+
apply: Array<A_UTILS_TYPES__Manifest_AllowedComponents> | RegExp;
|
|
658
|
+
/**
|
|
659
|
+
* A list of entities to which a component is excluded
|
|
660
|
+
*/
|
|
661
|
+
exclude: Array<A_UTILS_TYPES__Manifest_AllowedComponents> | RegExp;
|
|
662
|
+
};
|
|
663
|
+
type A_UTILS_TYPES__Manifest_AllowedComponents = A_TYPES__Component_Constructor | A_TYPES__Entity_Constructor | A_TYPES__Fragment_Constructor | A_TYPES__Container_Constructor;
|
|
664
|
+
interface A_UTILS_TYPES__ManifestRule {
|
|
665
|
+
componentRegex: RegExp;
|
|
666
|
+
methodRegex: RegExp;
|
|
667
|
+
applyRegex?: RegExp;
|
|
668
|
+
excludeRegex?: RegExp;
|
|
669
|
+
}
|
|
670
|
+
interface A_UTILS_TYPES__ManifestQuery {
|
|
671
|
+
component: A_TYPES__Component_Constructor;
|
|
672
|
+
method: string;
|
|
673
|
+
target: A_UTILS_TYPES__Manifest_AllowedComponents;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* Fluent API for checking manifest permissions
|
|
678
|
+
*/
|
|
679
|
+
declare class A_ManifestChecker {
|
|
680
|
+
private manifest;
|
|
681
|
+
private component;
|
|
682
|
+
private method;
|
|
683
|
+
private checkExclusion;
|
|
684
|
+
constructor(manifest: A_Manifest, component: A_TYPES__Component_Constructor, method: string, checkExclusion?: boolean);
|
|
685
|
+
for(target: A_UTILS_TYPES__Manifest_AllowedComponents): boolean;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
declare class A_Manifest extends A_Fragment {
|
|
689
|
+
private rules;
|
|
690
|
+
/**
|
|
691
|
+
* A-Manifest is a configuration set that allows to include or exclude component application for the particular methods.
|
|
692
|
+
*
|
|
693
|
+
* 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.
|
|
694
|
+
*
|
|
695
|
+
*
|
|
696
|
+
* 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.
|
|
697
|
+
*
|
|
698
|
+
* @param config - Array of component configurations
|
|
699
|
+
*/
|
|
700
|
+
constructor(config?: A_UTILS_TYPES__Manifest_Init);
|
|
701
|
+
/**
|
|
702
|
+
* Should convert received configuration into internal Regexp applicable for internal storage
|
|
703
|
+
*/
|
|
704
|
+
protected prepare(config: A_UTILS_TYPES__Manifest_Init): void;
|
|
705
|
+
/**
|
|
706
|
+
* Process a single configuration item and convert it to internal rules
|
|
707
|
+
*/
|
|
708
|
+
private processConfigItem;
|
|
709
|
+
/**
|
|
710
|
+
* Convert a constructor to a regex pattern
|
|
711
|
+
*/
|
|
712
|
+
private constructorToRegex;
|
|
713
|
+
/**
|
|
714
|
+
* Convert a method name or regex to a regex pattern
|
|
715
|
+
*/
|
|
716
|
+
private methodToRegex;
|
|
717
|
+
/**
|
|
718
|
+
* Convert allowed components array or regex to a single regex
|
|
719
|
+
*/
|
|
720
|
+
private allowedComponentsToRegex;
|
|
721
|
+
/**
|
|
722
|
+
* Escape special regex characters in a string
|
|
723
|
+
*/
|
|
724
|
+
private escapeRegex;
|
|
725
|
+
protected configItemToRegexp(item: A_TYPES__Component_Constructor): RegExp;
|
|
726
|
+
protected ID(component: A_TYPES__Component_Constructor, method: string): string;
|
|
727
|
+
/**
|
|
728
|
+
* Check if a component and method combination is allowed for a target
|
|
729
|
+
*/
|
|
730
|
+
isAllowed<T extends A_Component>(ctor: T | A_TYPES__Component_Constructor<T>, method: string): A_ManifestChecker;
|
|
731
|
+
/**
|
|
732
|
+
* Internal method to check if access is allowed
|
|
733
|
+
*/
|
|
734
|
+
internal_checkAccess(query: A_UTILS_TYPES__ManifestQuery): boolean;
|
|
735
|
+
isExcluded<T extends A_Component>(ctor: T | A_TYPES__Component_Constructor<T>, method: string): A_ManifestChecker;
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
declare class A_ManifestError extends A_Error {
|
|
739
|
+
static readonly ManifestInitializationError = "A-Manifest Initialization Error";
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
declare class A_Memory<_MemoryType extends Record<string, any> = Record<string, any>, _SerializedType extends Record<string, any> = Record<string, any>> extends A_Fragment {
|
|
743
|
+
/**
|
|
744
|
+
* Internal storage of all intermediate values
|
|
745
|
+
*/
|
|
746
|
+
protected _memory: Map<keyof _MemoryType, _MemoryType[keyof _MemoryType]>;
|
|
747
|
+
/**
|
|
748
|
+
* Errors encountered during the execution
|
|
749
|
+
*/
|
|
750
|
+
protected _errors: Set<A_Error>;
|
|
751
|
+
/**
|
|
752
|
+
* Memory object that allows to store intermediate values and errors
|
|
753
|
+
*
|
|
754
|
+
* @param initialValues
|
|
755
|
+
*/
|
|
756
|
+
constructor(initialValues?: _MemoryType);
|
|
757
|
+
get Errors(): Set<A_Error> | undefined;
|
|
758
|
+
/**
|
|
759
|
+
* Verifies that all required keys are present in the proxy values
|
|
760
|
+
*
|
|
761
|
+
* @param requiredKeys
|
|
762
|
+
* @returns
|
|
763
|
+
*/
|
|
764
|
+
verifyPrerequisites(requiredKeys: Array<keyof _MemoryType>): Promise<boolean>;
|
|
765
|
+
/**
|
|
766
|
+
* Adds an error to the context
|
|
767
|
+
*
|
|
768
|
+
* @param error
|
|
769
|
+
*/
|
|
770
|
+
error(error: A_Error): Promise<void>;
|
|
771
|
+
/**
|
|
772
|
+
* Saves a value in the context memory
|
|
773
|
+
*
|
|
774
|
+
* @param key
|
|
775
|
+
* @param value
|
|
776
|
+
*/
|
|
777
|
+
set<K extends keyof _MemoryType>(
|
|
778
|
+
/**
|
|
779
|
+
* Key to save the value under
|
|
780
|
+
*/
|
|
781
|
+
key: K,
|
|
782
|
+
/**
|
|
783
|
+
* Value to save
|
|
784
|
+
*/
|
|
785
|
+
value: _MemoryType[K]): Promise<void>;
|
|
786
|
+
/**
|
|
787
|
+
* Removes a value from the context memory by key
|
|
788
|
+
*
|
|
789
|
+
* @param key
|
|
790
|
+
*/
|
|
791
|
+
drop(key: keyof _MemoryType): Promise<void>;
|
|
792
|
+
/**
|
|
793
|
+
* Clears all stored values in the context memory
|
|
794
|
+
*/
|
|
795
|
+
clear(): Promise<void>;
|
|
796
|
+
/**
|
|
797
|
+
* Converts all stored values to a plain object
|
|
798
|
+
*
|
|
799
|
+
* [!] By default uses all saved in memory values
|
|
800
|
+
*
|
|
801
|
+
* @returns
|
|
802
|
+
*/
|
|
803
|
+
toJSON(): _SerializedType;
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
type A_UTILS_TYPES__ScheduleObjectConfig = {
|
|
807
|
+
/**
|
|
808
|
+
* If the timeout is cleared, should the promise resolve or reject?
|
|
809
|
+
* BY Default it rejects
|
|
810
|
+
*
|
|
811
|
+
* !!!NOTE: If the property is set to true, the promise will resolve with undefined
|
|
812
|
+
*/
|
|
813
|
+
resolveOnClear: boolean;
|
|
814
|
+
};
|
|
815
|
+
type A_UTILS_TYPES__ScheduleObjectCallback<T> = () => Promise<T>;
|
|
816
|
+
|
|
817
|
+
declare class A_ScheduleObject<T extends any = any> {
|
|
818
|
+
private timeout;
|
|
819
|
+
private deferred;
|
|
820
|
+
private config;
|
|
821
|
+
/**
|
|
822
|
+
* Creates a scheduled object that will execute the action after specified milliseconds
|
|
823
|
+
*
|
|
824
|
+
*
|
|
825
|
+
* @param ms - milliseconds to wait before executing the action
|
|
826
|
+
* @param action - the action to execute
|
|
827
|
+
* @param config - configuration options for the schedule object
|
|
828
|
+
*/
|
|
829
|
+
constructor(
|
|
830
|
+
/**
|
|
831
|
+
* Milliseconds to wait before executing the action
|
|
832
|
+
*/
|
|
833
|
+
ms: number,
|
|
834
|
+
/**
|
|
835
|
+
* The action to execute after the specified milliseconds
|
|
836
|
+
*/
|
|
837
|
+
action: A_UTILS_TYPES__ScheduleObjectCallback<T>,
|
|
838
|
+
/**
|
|
839
|
+
* Configuration options for the schedule object
|
|
840
|
+
*/
|
|
841
|
+
config?: A_UTILS_TYPES__ScheduleObjectConfig);
|
|
842
|
+
get promise(): Promise<T>;
|
|
843
|
+
clear(): void;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
declare class A_Schedule extends A_Component {
|
|
847
|
+
/**
|
|
848
|
+
* Allows to schedule a callback for particular time in the future
|
|
849
|
+
*
|
|
850
|
+
* @param timestamp - Unix timestamp in milliseconds
|
|
851
|
+
* @param callback - The callback to execute
|
|
852
|
+
* @returns A promise that resolves to the schedule object
|
|
853
|
+
*/
|
|
854
|
+
schedule<T extends any = any>(
|
|
855
|
+
/**
|
|
856
|
+
* Unix timestamp in milliseconds
|
|
857
|
+
*/
|
|
858
|
+
timestamp: number,
|
|
859
|
+
/**
|
|
860
|
+
* The callback to execute
|
|
861
|
+
*/
|
|
862
|
+
callback: A_UTILS_TYPES__ScheduleObjectCallback<T>,
|
|
863
|
+
/**
|
|
864
|
+
* Configuration options for the schedule object
|
|
865
|
+
*/
|
|
866
|
+
config?: A_UTILS_TYPES__ScheduleObjectConfig): Promise<A_ScheduleObject<T>>;
|
|
867
|
+
schedule<T extends any = any>(
|
|
868
|
+
/**
|
|
869
|
+
* ISO date string representing the date and time to schedule the callback for
|
|
870
|
+
*/
|
|
871
|
+
date: string,
|
|
872
|
+
/**
|
|
873
|
+
* The callback to execute
|
|
874
|
+
*/
|
|
875
|
+
callback: A_UTILS_TYPES__ScheduleObjectCallback<T>,
|
|
876
|
+
/**
|
|
877
|
+
* Configuration options for the schedule object
|
|
878
|
+
*/
|
|
879
|
+
config?: A_UTILS_TYPES__ScheduleObjectConfig): Promise<A_ScheduleObject<T>>;
|
|
880
|
+
/**
|
|
881
|
+
* Allows to execute callback after particular delay in milliseconds
|
|
882
|
+
* So the callback will be executed after the specified delay
|
|
883
|
+
*
|
|
884
|
+
* @param ms
|
|
885
|
+
*/
|
|
886
|
+
delay<T extends any = any>(
|
|
887
|
+
/**
|
|
888
|
+
* Delay in milliseconds
|
|
889
|
+
*/
|
|
890
|
+
ms: number,
|
|
891
|
+
/**
|
|
892
|
+
* The callback to execute after the delay
|
|
893
|
+
*/
|
|
894
|
+
callback: A_UTILS_TYPES__ScheduleObjectCallback<T>,
|
|
895
|
+
/**
|
|
896
|
+
* Configuration options for the schedule object
|
|
897
|
+
*/
|
|
898
|
+
config?: A_UTILS_TYPES__ScheduleObjectConfig): Promise<A_ScheduleObject<T>>;
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
declare class A_Deferred<T> {
|
|
902
|
+
promise: Promise<T>;
|
|
903
|
+
private resolveFn;
|
|
904
|
+
private rejectFn;
|
|
905
|
+
/**
|
|
906
|
+
* Creates a deferred promise
|
|
907
|
+
* @returns A promise that can be resolved or rejected later
|
|
908
|
+
*/
|
|
909
|
+
constructor();
|
|
910
|
+
resolve(value: T | PromiseLike<T>): void;
|
|
911
|
+
reject(reason?: any): void;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
export { A_CONSTANTS_A_Command_Features, type A_CONSTANTS__A_Command_Event, A_CONSTANTS__A_Command_Status, A_CONSTANTS__CONFIG_ENV_VARIABLES, A_CONSTANTS__CONFIG_ENV_VARIABLES_ARRAY, A_Channel, A_ChannelError, A_Command, A_CommandError, A_Config, A_ConfigError, A_ConfigLoader, A_Deferred, A_Logger, A_Manifest, A_ManifestChecker, A_ManifestError, A_Memory, A_Polyfill, A_Schedule, A_ScheduleObject, type A_TYPES__CommandMeta, A_TYPES__CommandMetaKey, type A_TYPES__Command_Constructor, type A_TYPES__Command_Init, type A_TYPES__Command_Listener, type A_TYPES__Command_Serialized, type A_TYPES__ConfigContainerConstructor, type A_TYPES__ConfigENVVariables, A_TYPES__ConfigFeature, type A_UTILS_TYPES__ManifestQuery, type A_UTILS_TYPES__ManifestRule, type A_UTILS_TYPES__Manifest_AllowedComponents, type A_UTILS_TYPES__Manifest_ComponentLevelConfig, type A_UTILS_TYPES__Manifest_Init, type A_UTILS_TYPES__Manifest_MethodLevelConfig, type A_UTILS_TYPES__Manifest_Rules, type A_UTILS_TYPES__ScheduleObjectCallback, type A_UTILS_TYPES__ScheduleObjectConfig, ConfigReader, ENVConfigReader, FileConfigReader, type IbufferInterface, type IcryptoInterface, type Ifspolyfill, type IhttpInterface, type IhttpsInterface, type IpathInterface, type IprocessInterface, type IurlInterface };
|