@zenflux/core 0.1.7 → 0.1.9
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/src/bases/controller-base.d.ts +4 -4
- package/dist/src/bases/index.d.ts +5 -2
- package/dist/src/bases/initialize-base.d.ts +8 -0
- package/dist/src/bases/object-base.d.ts +3 -22
- package/dist/src/clients/http.d.ts +3 -3
- package/dist/src/command-bases/command-base.d.ts +3 -3
- package/dist/src/command-bases/command-internal.d.ts +1 -1
- package/dist/src/command-bases/command-public.d.ts +1 -1
- package/dist/src/command-bases/command-restful.d.ts +1 -1
- package/dist/src/command-bases/index.d.ts +4 -4
- package/dist/src/errors/command-already-registered.d.ts +1 -1
- package/dist/src/errors/controller-already-registered.d.ts +1 -1
- package/dist/src/errors/controller-already-set.d.ts +1 -1
- package/dist/src/errors/error-with-metadata.d.ts +4 -0
- package/dist/src/errors/force-method-implementation.d.ts +1 -7
- package/dist/src/errors/index-public.d.ts +1 -1
- package/dist/src/errors/index.d.ts +9 -5
- package/dist/src/exports-index.d.ts +5 -5
- package/dist/src/exports.d.ts +3 -16
- package/dist/src/index.d.ts +2 -2
- package/dist/src/interfaces/index.d.ts +4 -4
- package/dist/src/interfaces/logger.d.ts +3 -2
- package/dist/src/managers/commands.d.ts +4 -4
- package/dist/src/managers/controllers.d.ts +2 -2
- package/dist/src/managers/export.d.ts +5 -5
- package/dist/src/managers/index.d.ts +4 -4
- package/dist/src/managers/internal.d.ts +1 -1
- package/dist/src/managers/restful.d.ts +5 -5
- package/dist/src/modules/debugger.d.ts +17 -0
- package/dist/src/modules/event-bus/event-bus.d.ts +28 -0
- package/dist/src/modules/logger/config.d.ts +6 -0
- package/dist/src/modules/logger/implementation.d.ts +46 -0
- package/dist/src/modules/logger/index.d.ts +2 -0
- package/dist/src/modules/logger/logger-browser-infra.d.ts +60 -0
- package/dist/src/modules/logger/utils/index.d.ts +2 -0
- package/dist/src/modules/logger/utils/object.d.ts +6 -0
- package/dist/src/modules/logger/utils/rgb.d.ts +6 -0
- package/dist/src/modules/mcp-server/mcp-server.d.ts +10 -0
- package/dist/src/modules/mcp-server/mcp-service.d.ts +13 -0
- package/dist/src/modules/service/service-base.d.ts +15 -0
- package/dist/src/modules/service/service-locator.d.ts +34 -0
- package/dist/src/modules/service/service-with-dependencies-base.d.ts +17 -0
- package/dist/zenflux-core.cjs +58 -14
- package/dist/zenflux-core.d.ts +508 -3
- package/dist/zenflux-core.mjs +58 -14
- package/package.json +11 -2
- package/src/bases/controller-base.ts +5 -5
- package/src/bases/index.ts +6 -2
- package/src/bases/initialize-base.ts +32 -0
- package/src/bases/object-base.ts +15 -43
- package/src/clients/http.ts +3 -3
- package/src/command-bases/command-base.ts +4 -4
- package/src/command-bases/command-internal.ts +1 -1
- package/src/command-bases/command-public.ts +1 -1
- package/src/command-bases/command-restful.ts +3 -3
- package/src/command-bases/index.ts +5 -4
- package/src/errors/command-already-registered.ts +1 -1
- package/src/errors/controller-already-registered.ts +1 -1
- package/src/errors/controller-already-set.ts +1 -1
- package/src/errors/error-with-metadata.ts +14 -0
- package/src/errors/force-method-implementation.ts +3 -11
- package/src/errors/index-public.ts +1 -1
- package/src/errors/index.ts +10 -5
- package/src/exports-index.ts +5 -5
- package/src/exports.ts +5 -16
- package/src/index.ts +3 -2
- package/src/interfaces/index.ts +5 -4
- package/src/interfaces/logger.ts +3 -2
- package/src/managers/commands.ts +6 -6
- package/src/managers/controllers.ts +3 -3
- package/src/managers/export.ts +5 -5
- package/src/managers/index.ts +5 -4
- package/src/managers/internal.ts +1 -1
- package/src/managers/restful.ts +5 -5
- package/src/modules/debugger.ts +89 -0
- package/src/modules/event-bus/event-bus.ts +204 -0
- package/src/modules/logger/config.ts +44 -0
- package/src/modules/logger/implementation.ts +287 -0
- package/src/modules/logger/index.ts +2 -0
- package/src/modules/logger/logger-browser-infra.ts +306 -0
- package/src/modules/logger/types/picocolors.d.ts +15 -0
- package/src/modules/logger/utils/index.ts +3 -0
- package/src/modules/logger/utils/object.ts +19 -0
- package/src/modules/logger/utils/rgb.ts +34 -0
- package/src/modules/mcp-server/mcp-server.ts +139 -0
- package/src/modules/mcp-server/mcp-service.ts +80 -0
- package/src/modules/service/service-base.ts +55 -0
- package/src/modules/service/service-locator.ts +205 -0
- package/src/modules/service/service-with-dependencies-base.ts +51 -0
package/dist/zenflux-core.d.ts
CHANGED
|
@@ -1,8 +1,513 @@
|
|
|
1
|
-
|
|
1
|
+
declare const afterInitializeCallbacks: (() => void)[];
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
declare namespace bases {
|
|
4
|
+
export {
|
|
5
|
+
ControllerBase,
|
|
6
|
+
ObjectBase
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export { bases }
|
|
10
|
+
|
|
11
|
+
declare const classes: {
|
|
12
|
+
Logger: typeof Logger;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
declare abstract class CommandBase extends ObjectBase {
|
|
16
|
+
private static controller;
|
|
17
|
+
protected args: ICommandArgsInterface;
|
|
18
|
+
protected options: ICommandOptionsInterface;
|
|
19
|
+
private readonly logger;
|
|
20
|
+
static getName(): string;
|
|
21
|
+
static setController(controller: ControllerBase): void;
|
|
22
|
+
static getController(): ControllerBase;
|
|
23
|
+
constructor(args?: ICommandArgsInterface, options?: {});
|
|
24
|
+
protected initialize(args: ICommandArgsInterface, options: ICommandOptionsInterface): void;
|
|
25
|
+
/**
|
|
26
|
+
* TODO: Maybe abstract, currently not sure about parameters initialization.
|
|
27
|
+
*/
|
|
28
|
+
protected apply(args?: ICommandArgsInterface, options?: ICommandOptionsInterface): any;
|
|
29
|
+
protected onBeforeApply?(): void;
|
|
30
|
+
protected onAfterApply?(): void;
|
|
31
|
+
run(): Promise<any>;
|
|
32
|
+
private runInternal;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare namespace commandBases {
|
|
36
|
+
export {
|
|
37
|
+
CommandPublic,
|
|
38
|
+
CommandRestful,
|
|
39
|
+
CommandBase,
|
|
40
|
+
CommandInternal
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export { commandBases }
|
|
44
|
+
|
|
45
|
+
declare class CommandInternal extends CommandBase {
|
|
46
|
+
static getName(): string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
declare class CommandPublic extends CommandBase {
|
|
50
|
+
static getName(): string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
declare abstract class CommandRestful extends CommandBase {
|
|
54
|
+
static getName(): string;
|
|
55
|
+
/**
|
|
56
|
+
* Override this method is required to determine endpoint and magic query params.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```
|
|
60
|
+
* args = { query: { id: 1 } };
|
|
61
|
+
* getEndpoint() = '/api/v1/users/{id}';
|
|
62
|
+
* result = '/api/v1/users/1';
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
getEndpoint(): string;
|
|
66
|
+
protected apply(args?: ICommandArgsInterface, options?: ICommandOptionsInterface): Promise<any>;
|
|
67
|
+
private applyEndpointFormat;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
declare class Commands extends ObjectBase {
|
|
71
|
+
static readonly trace: string[];
|
|
72
|
+
private current;
|
|
73
|
+
private currentArgs;
|
|
74
|
+
private trace;
|
|
75
|
+
private commands;
|
|
76
|
+
private onBeforeHooks;
|
|
77
|
+
private onBeforeUIHooks;
|
|
78
|
+
private onAfterHooks;
|
|
79
|
+
private onAfterOnceHooks;
|
|
80
|
+
private onAfterUIHooks;
|
|
81
|
+
private onAfterAffectHooks;
|
|
82
|
+
private readonly logger;
|
|
83
|
+
static getName(): string;
|
|
84
|
+
private static runCallbacks;
|
|
85
|
+
private static hookCommand;
|
|
86
|
+
constructor();
|
|
87
|
+
run(command: string | CommandBase, args?: ICommandArgsInterface, options?: any): Promise<any>;
|
|
88
|
+
register(commands: {
|
|
89
|
+
[key: string]: typeof CommandBase;
|
|
90
|
+
}, controller: ControllerBase): {
|
|
91
|
+
[key: string]: typeof CommandBase;
|
|
92
|
+
};
|
|
93
|
+
getAll(): {
|
|
94
|
+
[key: string]: typeof CommandBase;
|
|
95
|
+
};
|
|
96
|
+
getByName(name: string): typeof CommandBase;
|
|
97
|
+
getLogger(): ILogger;
|
|
98
|
+
getCommandInstance(name: string, args?: ICommandArgsInterface, options?: {}): CommandBase;
|
|
99
|
+
/**
|
|
100
|
+
* Used to set hooks that effects only data and not UI.
|
|
101
|
+
*/
|
|
102
|
+
onBefore(hookCommand: string, callback: TCommandCallbackType): void;
|
|
103
|
+
/**
|
|
104
|
+
* Used to set hooks that effects only UI.
|
|
105
|
+
*/
|
|
106
|
+
onBeforeUI(hookCommand: string, callback: TCommandCallbackType): void;
|
|
107
|
+
/**
|
|
108
|
+
* Used to set hooks that effects only data and not UI.
|
|
109
|
+
*/
|
|
110
|
+
onAfter(hookCommand: string, callback: TCommandCallbackType): void;
|
|
111
|
+
/**
|
|
112
|
+
* Used to set hooks that effects only UI.
|
|
113
|
+
*/
|
|
114
|
+
onAfterUI(command: string, callback: TCommandCallbackType): void;
|
|
115
|
+
/**
|
|
116
|
+
* Used to set hooks that effects only data and not UI.
|
|
117
|
+
*/
|
|
118
|
+
onAfterOnce(command: string, callback: TCommandCallbackType): void;
|
|
119
|
+
/**
|
|
120
|
+
* Used to register a trigger that runs command after `hookCommand` run's.
|
|
121
|
+
*/
|
|
122
|
+
onAfterAffect(hookCommand: string, affectCommand: string): void;
|
|
123
|
+
protected onBeforeRun(command: CommandBase, args?: ICommandArgsInterface, options?: {}): void;
|
|
124
|
+
protected runInstance(command: CommandBase, args?: ICommandArgsInterface, options?: {}): Promise<any>;
|
|
125
|
+
protected onAfterRun(command: CommandBase, args: ICommandArgsInterface, options: {}, result: any): Promise<any>;
|
|
126
|
+
protected attachCurrent(command: CommandBase, args?: any): void;
|
|
127
|
+
protected detachCurrent(command: CommandBase): void;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
declare let commands: Commands;
|
|
131
|
+
|
|
132
|
+
declare const config: interfaces.IAPIConfig;
|
|
133
|
+
|
|
134
|
+
declare abstract class ControllerBase extends ObjectBase {
|
|
135
|
+
private commands;
|
|
136
|
+
private restful;
|
|
137
|
+
private internal;
|
|
138
|
+
static getName(): string;
|
|
139
|
+
/**
|
|
140
|
+
* Constructor for `ControllerBase` instances.
|
|
141
|
+
* Initializes the base class and invokes the `initialize()` method.
|
|
142
|
+
*/
|
|
143
|
+
constructor();
|
|
144
|
+
/**
|
|
145
|
+
* Initializes the controller by calling the `register()` method and optionally the `setupHooks()` method.
|
|
146
|
+
*/
|
|
147
|
+
protected initialize(): void;
|
|
148
|
+
/**
|
|
149
|
+
* Registers commands and command types by calling manager functions.
|
|
150
|
+
*/
|
|
151
|
+
protected register(): void;
|
|
152
|
+
/**
|
|
153
|
+
* Retrieve the public commands associated with this controller.
|
|
154
|
+
* Derived classes can override this method to specify their own commands.
|
|
155
|
+
*/
|
|
156
|
+
protected getCommands(): {
|
|
157
|
+
[key: string]: typeof CommandPublic;
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Retrieve the RESTful commands associated with this controller.
|
|
161
|
+
* Derived classes can override this method to specify their own RESTful commands.
|
|
162
|
+
*/
|
|
163
|
+
protected getRestful(): {
|
|
164
|
+
[key: string]: typeof CommandRestful;
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Retrieve the internal commands associated with this controller.
|
|
168
|
+
* Derived classes can override this method to specify their own internal commands.
|
|
169
|
+
*/
|
|
170
|
+
protected getInternal(): {
|
|
171
|
+
[key: string]: typeof CommandInternal;
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* A hook method that can be optionally overridden in derived classes to set up hooks or event listeners.
|
|
175
|
+
*/
|
|
176
|
+
protected setupHooks?(): void;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
declare class Controllers extends ObjectBase {
|
|
180
|
+
private controllers;
|
|
181
|
+
constructor();
|
|
182
|
+
static getName(): string;
|
|
183
|
+
get(name: string): ControllerBase;
|
|
184
|
+
getAll(): {
|
|
185
|
+
[key: string]: ControllerBase;
|
|
186
|
+
};
|
|
187
|
+
register(controller: ControllerBase): ControllerBase;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
declare let controllers: Controllers;
|
|
191
|
+
|
|
192
|
+
declare function destroy(): void;
|
|
193
|
+
|
|
194
|
+
declare function destroy_2(): void;
|
|
195
|
+
|
|
196
|
+
declare enum E_HTTP_METHOD_TYPE {
|
|
197
|
+
DELETE = "DELETE",// Delete.
|
|
198
|
+
GET = "GET",// Read.
|
|
199
|
+
OPTIONS = "OPTIONS",// Options about the request
|
|
200
|
+
PATCH = "PATCH",// Update/Modify.
|
|
201
|
+
POST = "POST",// Create.
|
|
202
|
+
PUT = "PUT",// Update/Replace.
|
|
203
|
+
"__EMPTY__" = ""
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
declare enum E_RESPONSE_HANDLER_TYPE {
|
|
207
|
+
ERROR_HANDLER = "error_handler",
|
|
208
|
+
RESPONSE_FILTER = "response_filter",
|
|
209
|
+
RESPONSE_HANDLER = "response_handler"
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
declare namespace errors {
|
|
213
|
+
export {
|
|
214
|
+
ForceMethodImplementation
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
export { errors }
|
|
218
|
+
|
|
219
|
+
declare class ForceMethodImplementation extends Error {
|
|
220
|
+
constructor(context: ObjectBase | typeof ObjectBase | string, methodName: string);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
declare class Http extends ObjectBase {
|
|
224
|
+
private readonly logger;
|
|
225
|
+
private readonly apiBaseUrl;
|
|
226
|
+
private readonly requestInit;
|
|
227
|
+
private errorHandler?;
|
|
228
|
+
private responseFilter?;
|
|
229
|
+
private responseHandler?;
|
|
230
|
+
static getName(): string;
|
|
231
|
+
/**
|
|
232
|
+
* Initializes the base class and sets up configuration parameters.
|
|
233
|
+
*/
|
|
234
|
+
constructor(apiBaseUrl?: string, requestInit?: RequestInit);
|
|
235
|
+
/**
|
|
236
|
+
* Fetches data from the specified path using the given HTTP method and optional request body.
|
|
237
|
+
*/
|
|
238
|
+
fetch(path: string, method: E_HTTP_METHOD_TYPE, body?: any): Promise<any>;
|
|
239
|
+
/**
|
|
240
|
+
* Sets the error handler callback for handling errors during fetch requests.
|
|
241
|
+
*/
|
|
242
|
+
setErrorHandler(callback: TErrorHandlerCallbackType): void;
|
|
243
|
+
/**
|
|
244
|
+
* Sets the response filter callback for filtering the response text.
|
|
245
|
+
*/
|
|
246
|
+
setResponseFilter(callback: TResponseFilterCallbackType): void;
|
|
247
|
+
/**
|
|
248
|
+
* Sets the response handler callback for handling the response data.
|
|
249
|
+
*/
|
|
250
|
+
setResponseHandler(callback: TResponseHandlerCallbackType): void;
|
|
251
|
+
private applyErrorHandler;
|
|
252
|
+
private applyResponseFilter;
|
|
253
|
+
private applyResponseHandler;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* @author Leonid Vinikov <leonidvinikov@gmail.com>
|
|
258
|
+
*/
|
|
259
|
+
/**
|
|
260
|
+
*
|
|
261
|
+
*/
|
|
262
|
+
declare interface IAPIConfig {
|
|
263
|
+
/**
|
|
264
|
+
* @description API version, from `package.json`
|
|
265
|
+
*/
|
|
266
|
+
version: string;
|
|
267
|
+
/**
|
|
268
|
+
* @description API base url for http requests.
|
|
269
|
+
*/
|
|
270
|
+
baseURL?: string;
|
|
271
|
+
/**
|
|
272
|
+
* @description Request Init for fetch API.
|
|
273
|
+
*/
|
|
274
|
+
requestInit?: RequestInit;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
declare type ICaller = interfaces.TCaller;
|
|
278
|
+
|
|
279
|
+
declare interface ICommandArgsInterface {
|
|
280
|
+
[key: string]: any;
|
|
281
|
+
}
|
|
4
282
|
|
|
283
|
+
declare interface ICommandOptionsInterface {
|
|
284
|
+
[key: string]: any;
|
|
285
|
+
}
|
|
5
286
|
|
|
6
|
-
|
|
287
|
+
declare interface ILogger {
|
|
288
|
+
log(caller: TCaller, message: string, ...params: any[]): void;
|
|
289
|
+
warn(caller: TCaller, message: string, ...params: any[]): void;
|
|
290
|
+
error(caller: TCaller, message: string, ...params: any[]): void;
|
|
291
|
+
info(caller: TCaller, message: string, ...params: any[]): void;
|
|
292
|
+
debug(caller: TCaller, message: string, ...params: any[]): void;
|
|
293
|
+
addMessagePrefix(prefix: string): void;
|
|
294
|
+
startsEmpty(caller: TCaller): void;
|
|
295
|
+
startsWith(caller: TCaller, params: object | string): void;
|
|
296
|
+
dump(caller: TCaller, params: {
|
|
297
|
+
[key: string]: object | string;
|
|
298
|
+
}, notice?: string): void;
|
|
299
|
+
drop(caller: TCaller, according: {
|
|
300
|
+
[key: string]: string;
|
|
301
|
+
}, data: any): void;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
declare function initialize(config?: Partial<interfaces.IAPIConfig>): void;
|
|
305
|
+
|
|
306
|
+
declare function initialize_2(config: IAPIConfig): void;
|
|
307
|
+
|
|
308
|
+
declare namespace interfaces {
|
|
309
|
+
export {
|
|
310
|
+
TCommandCallbackType,
|
|
311
|
+
ICommandArgsInterface,
|
|
312
|
+
ICommandOptionsInterface,
|
|
313
|
+
IOnHookAffectInterface,
|
|
314
|
+
IOnHookInterface,
|
|
315
|
+
IAPIConfig,
|
|
316
|
+
TCaller,
|
|
317
|
+
ILogger,
|
|
318
|
+
TErrorHandlerCallbackType,
|
|
319
|
+
TResponseFilterCallbackType,
|
|
320
|
+
TResponseHandlerCallbackType,
|
|
321
|
+
TPossibleHandlersType,
|
|
322
|
+
E_RESPONSE_HANDLER_TYPE,
|
|
323
|
+
E_HTTP_METHOD_TYPE
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
export { interfaces }
|
|
327
|
+
|
|
328
|
+
declare class Internal extends Commands {
|
|
329
|
+
static getName(): string;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
declare let internal: Internal;
|
|
333
|
+
|
|
334
|
+
declare interface IOnHookAffectInterface {
|
|
335
|
+
[key: string]: Array<string>;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
declare interface IOnHookInterface {
|
|
339
|
+
[key: string]: Array<TCommandCallbackType>;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
declare class Logger extends LoggerBrowserInfra implements interfaces.ILogger {
|
|
343
|
+
private static lastLogTime;
|
|
344
|
+
private readonly ownerName;
|
|
345
|
+
private messagePrefixes;
|
|
346
|
+
private config;
|
|
347
|
+
static getName(): string;
|
|
348
|
+
static getLogLevelString(): string;
|
|
349
|
+
static getLogLevel(): number;
|
|
350
|
+
static isDebugEnabled(): boolean;
|
|
351
|
+
constructor(owner: any, options?: LoggerOptions);
|
|
352
|
+
addMessagePrefix(prefix: string): void;
|
|
353
|
+
log(caller: ICaller, message: string, ...params: any[]): void;
|
|
354
|
+
info(caller: ICaller, message: string, ...params: any[]): void;
|
|
355
|
+
debug(caller: ICaller, message: string, ...params: any[]): void;
|
|
356
|
+
warn(caller: ICaller, message: string, ...params: any[]): void;
|
|
357
|
+
error(caller: ICaller, message: string, ...params: any[]): void;
|
|
358
|
+
admin(caller: ICaller, message: string, ...params: any[]): void;
|
|
359
|
+
startsEmpty(caller: interfaces.TCaller): void;
|
|
360
|
+
startsWith(caller: interfaces.TCaller, params: string | object): void;
|
|
361
|
+
dump(caller: interfaces.TCaller, params?: {
|
|
362
|
+
[key: string]: object | string;
|
|
363
|
+
}, notice?: string): void;
|
|
364
|
+
drop(caller: interfaces.TCaller, according: {
|
|
365
|
+
[key: string]: string;
|
|
366
|
+
}, data: any): void;
|
|
367
|
+
/**
|
|
368
|
+
* TODO: Should respect debug levels, when to throw...
|
|
369
|
+
*/
|
|
370
|
+
throw(caller: interfaces.TCaller, output: string, name?: string, params?: {}): void;
|
|
371
|
+
beep(): void;
|
|
372
|
+
clone(): any;
|
|
373
|
+
outputEvent(_prefix: string, _timeDiff: string, _source: string, _messagePrefix: string, _message: string, _params: any[]): void;
|
|
374
|
+
private static resolveOwnerName;
|
|
375
|
+
private disableLoggers;
|
|
376
|
+
private getStackTrace;
|
|
377
|
+
getPreviousSource(): string;
|
|
378
|
+
private writeLog;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
declare abstract class LoggerBrowserInfra extends ObjectBase {
|
|
382
|
+
static mappers: Function[];
|
|
383
|
+
static mapperDepth: number;
|
|
384
|
+
static colorsOwners: {
|
|
385
|
+
[key: string]: string;
|
|
386
|
+
};
|
|
387
|
+
static colorsUsed: string[];
|
|
388
|
+
defaultStyle: string[];
|
|
389
|
+
protected readonly owner: ObjectBase | typeof ObjectBase | string;
|
|
390
|
+
protected args: {
|
|
391
|
+
repeatedly: boolean;
|
|
392
|
+
};
|
|
393
|
+
protected color: string;
|
|
394
|
+
private outputHandler;
|
|
395
|
+
static getName(): string;
|
|
396
|
+
/**
|
|
397
|
+
* Reset logger globals.
|
|
398
|
+
*/
|
|
399
|
+
static reset(): void;
|
|
400
|
+
/**
|
|
401
|
+
* Creates a custom mapper for a specific class type.
|
|
402
|
+
*
|
|
403
|
+
* The mapper is a callback function that can modify or enhance objects mapping.
|
|
404
|
+
*/
|
|
405
|
+
static createObjectMapper(callback: Function): void;
|
|
406
|
+
/**
|
|
407
|
+
* Gets mapped version of the object by using custom created object mapper.
|
|
408
|
+
*/
|
|
409
|
+
static useObjectMapper(obj: object, shouldHandleChildren?: boolean): any[] | {
|
|
410
|
+
[key: string]: any;
|
|
411
|
+
};
|
|
412
|
+
constructor(owner: ObjectBase | typeof ObjectBase | string, args?: {});
|
|
413
|
+
protected getOwnerName(): string;
|
|
414
|
+
protected initialize(): void;
|
|
415
|
+
output(...args: any): void;
|
|
416
|
+
protected setOutputHandler(outputHandler: Function): void;
|
|
417
|
+
protected printFunctionNotify(prefix: string, caller: interfaces.TCaller, output: any): void;
|
|
418
|
+
protected printObjectEfficient(prefix: string, caller: interfaces.TCaller, params: string | object): void;
|
|
419
|
+
protected printInLineElement(prefix: string, caller: interfaces.TCaller, key: string, value: any, notice?: string): void;
|
|
420
|
+
protected printInLineFunction(prefix: string, caller: interfaces.TCaller, key: string, fn: string | Function): void;
|
|
421
|
+
protected printInLineString(prefix: string, caller: interfaces.TCaller, string: string): void;
|
|
422
|
+
protected printInNextLineObject(prefix: string, caller: interfaces.TCaller, key: string, obj: object): void;
|
|
423
|
+
protected printMultiLineObject(prefix: string, caller: interfaces.TCaller, obj: {
|
|
424
|
+
[key: string]: string | Function;
|
|
425
|
+
}): void;
|
|
426
|
+
private getRandomColor;
|
|
427
|
+
protected getCallerName(caller: interfaces.TCaller): string;
|
|
428
|
+
private getFunctionView;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
declare interface LoggerOptions {
|
|
432
|
+
skipEventBusHook?: boolean;
|
|
433
|
+
repeatedly?: boolean;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
declare namespace managers {
|
|
437
|
+
export {
|
|
438
|
+
initialize_2 as initialize,
|
|
439
|
+
destroy_2 as destroy,
|
|
440
|
+
afterInitializeCallbacks,
|
|
441
|
+
commands,
|
|
442
|
+
controllers,
|
|
443
|
+
restful,
|
|
444
|
+
internal
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
export { managers }
|
|
448
|
+
|
|
449
|
+
declare abstract class ObjectBase {
|
|
450
|
+
private readonly id;
|
|
451
|
+
private readonly name;
|
|
452
|
+
protected constructor();
|
|
453
|
+
static getName(): string;
|
|
454
|
+
static getSourcePath(): string;
|
|
455
|
+
getName(): string;
|
|
456
|
+
getUniqueId(): string;
|
|
457
|
+
getInitialName(): string;
|
|
458
|
+
getHierarchyNames(): string[];
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
declare function onAfterInitialize(callback: () => void): void;
|
|
462
|
+
|
|
463
|
+
declare class Restful extends Commands {
|
|
464
|
+
private static client;
|
|
465
|
+
currentHttpMethod: E_HTTP_METHOD_TYPE;
|
|
466
|
+
static getName(): string;
|
|
467
|
+
constructor(Config: IAPIConfig);
|
|
468
|
+
getClient(): Http;
|
|
469
|
+
get(command: string, args?: ICommandArgsInterface, options?: ICommandOptionsInterface): Promise<any>;
|
|
470
|
+
update(command: string, args?: ICommandArgsInterface, options?: {}): Promise<any>;
|
|
471
|
+
delete(command: string, args?: ICommandArgsInterface, options?: {}): Promise<any>;
|
|
472
|
+
create(command: string, args?: ICommandArgsInterface, options?: {}): Promise<any>;
|
|
473
|
+
protected runInstance(command: CommandRestful, args?: ICommandArgsInterface, options?: {}): Promise<any>;
|
|
474
|
+
/**
|
|
475
|
+
* Handlers on return true will swallow the request.
|
|
476
|
+
*/
|
|
477
|
+
setHandler(type: E_RESPONSE_HANDLER_TYPE, callback: TPossibleHandlersType): void;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
declare let restful: Restful;
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* @author Leonid Vinikov <leonidvinikov@gmail.com>
|
|
484
|
+
*/
|
|
485
|
+
declare type TCaller = string | Function;
|
|
486
|
+
|
|
487
|
+
declare type TCommandCallbackType = (args?: any, options?: any) => any;
|
|
488
|
+
|
|
489
|
+
declare type TErrorHandlerCallbackType = (data: any) => boolean;
|
|
490
|
+
|
|
491
|
+
declare type TPossibleHandlersType = TErrorHandlerCallbackType | TResponseFilterCallbackType | TResponseHandlerCallbackType;
|
|
492
|
+
|
|
493
|
+
declare type TResponseFilterCallbackType = (text: string) => string;
|
|
494
|
+
|
|
495
|
+
declare type TResponseHandlerCallbackType = (text: string) => boolean;
|
|
496
|
+
|
|
497
|
+
declare namespace ZenCore {
|
|
498
|
+
export {
|
|
499
|
+
initialize,
|
|
500
|
+
destroy,
|
|
501
|
+
onAfterInitialize,
|
|
502
|
+
classes,
|
|
503
|
+
config,
|
|
504
|
+
bases,
|
|
505
|
+
commandBases,
|
|
506
|
+
errors,
|
|
507
|
+
interfaces,
|
|
508
|
+
managers
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
export default ZenCore;
|
|
7
512
|
|
|
8
513
|
export { }
|