@zenflux/core 0.0.0-alpha.4 → 0.0.0-alpha.6
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/cjs/zenflux-core.js +44 -6
- package/dist/es/zenflux-core.js +44 -6
- package/dist/es/zenflux-core.mjs +1 -1
- package/dist/umd/zenflux-core.js +2227 -1
- package/package.json +2 -2
- package/src/modules/logger.ts +53 -7
- package/dist/es/rollup.config.d.ts +0 -23
- package/dist/es/src/clients/http.d.ts +0 -20
- package/dist/es/src/command-bases/command-base.d.ts +0 -22
- package/dist/es/src/command-bases/command-data.d.ts +0 -17
- package/dist/es/src/command-bases/command-internal.d.ts +0 -9
- package/dist/es/src/command-bases/command-public.d.ts +0 -9
- package/dist/es/src/command-bases/index.d.ts +0 -7
- package/dist/es/src/core/controller.d.ts +0 -35
- package/dist/es/src/core/index.d.ts +0 -2
- package/dist/es/src/core/object-base.d.ts +0 -14
- package/dist/es/src/enums/http.d.ts +0 -12
- package/dist/es/src/errors/command-already-registered.d.ts +0 -8
- package/dist/es/src/errors/command-not-found.d.ts +0 -7
- package/dist/es/src/errors/controller-already-registered.d.ts +0 -8
- package/dist/es/src/errors/force-method.d.ts +0 -11
- package/dist/es/src/errors/index.d.ts +0 -4
- package/dist/es/src/exports.d.ts +0 -10
- package/dist/es/src/globals.d.ts +0 -3
- package/dist/es/src/index.d.ts +0 -5
- package/dist/es/src/initializer.d.ts +0 -19
- package/dist/es/src/interfaces/commands.d.ts +0 -13
- package/dist/es/src/interfaces/config.d.ts +0 -10
- package/dist/es/src/interfaces/managers.d.ts +0 -13
- package/dist/es/src/interfaces/object-base.d.ts +0 -10
- package/dist/es/src/manager-bases/commands.d.ts +0 -75
- package/dist/es/src/manager-bases/controllers.d.ts +0 -18
- package/dist/es/src/manager-bases/data.d.ts +0 -23
- package/dist/es/src/manager-bases/index.d.ts +0 -7
- package/dist/es/src/manager-bases/internal.d.ts +0 -9
- package/dist/es/src/managers/index.d.ts +0 -15
- package/dist/es/src/modules/index.d.ts +0 -1
- package/dist/es/src/modules/logger.d.ts +0 -117
- package/dist/es/src/utils/index.d.ts +0 -2
- package/dist/es/src/utils/object.d.ts +0 -6
- package/dist/es/src/utils/rgb.d.ts +0 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenflux/core",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.6",
|
|
4
4
|
"description": "ZenFlux core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"zenflux",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@types/jest": "^29.2.5",
|
|
41
41
|
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
|
42
42
|
"@typescript-eslint/parser": "^5.48.0",
|
|
43
|
-
"@zenflux/rollup-toolkit": "^0.0.0-alpha.
|
|
43
|
+
"@zenflux/rollup-toolkit": "^0.0.0-alpha.4",
|
|
44
44
|
"babel-jest": "^29.3.1",
|
|
45
45
|
"ts-jest": "^29.0.3",
|
|
46
46
|
"tslib": "^2.4.1"
|
package/src/modules/logger.ts
CHANGED
|
@@ -8,7 +8,20 @@
|
|
|
8
8
|
import { hexColorDelta, getCircularReplacer } from "../utils";
|
|
9
9
|
|
|
10
10
|
// TODO: Should by dynamic/configure-able.
|
|
11
|
-
const MAX_WRAPPING_RECURSIVE_DEPTH = 4
|
|
11
|
+
const MAX_WRAPPING_RECURSIVE_DEPTH = 4,
|
|
12
|
+
STACK_BACKWARD_CALLER_INDEX = 3,
|
|
13
|
+
UNKNOWN_CALLER_NAME = 'anonymous function',
|
|
14
|
+
BABEL_EXCLUDE_FUNCTIONS_NAMES = [
|
|
15
|
+
'_callee',
|
|
16
|
+
'tryCatch',
|
|
17
|
+
'<anonymous>',
|
|
18
|
+
'Generator.next',
|
|
19
|
+
'asyncGeneratorStep',
|
|
20
|
+
'_next',
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
// TODO: Should by dynamic/configure-able.
|
|
24
|
+
Error.stackTraceLimit = 50;
|
|
12
25
|
|
|
13
26
|
export class Logger {
|
|
14
27
|
static wrappers = {};
|
|
@@ -53,7 +66,6 @@ export class Logger {
|
|
|
53
66
|
}
|
|
54
67
|
// @ts-ignore
|
|
55
68
|
Logger.wrappers[ classType.name ].push( { classType, callback } );
|
|
56
|
-
|
|
57
69
|
}
|
|
58
70
|
|
|
59
71
|
/**
|
|
@@ -61,20 +73,54 @@ export class Logger {
|
|
|
61
73
|
*/
|
|
62
74
|
private static getCallerName() {
|
|
63
75
|
const error = new Error(),
|
|
64
|
-
|
|
76
|
+
errorsPerLine = error.stack?.split( "\n" ) || [],
|
|
77
|
+
caller = errorsPerLine.length ? errorsPerLine[ STACK_BACKWARD_CALLER_INDEX ].trim() : UNKNOWN_CALLER_NAME;
|
|
65
78
|
|
|
66
79
|
if ( caller.startsWith( "at new" ) ) {
|
|
67
80
|
return "constructor";
|
|
68
81
|
}
|
|
69
82
|
|
|
70
|
-
|
|
83
|
+
let extractName = caller.split( "." )[ 1 ].split( " " )[ 0 ],
|
|
84
|
+
isBabelAsyncRuntime = false;
|
|
85
|
+
|
|
86
|
+
// Babel compatibility.
|
|
87
|
+
if ( extractName.includes( '_callee' ) ) {
|
|
88
|
+
|
|
89
|
+
// Run till find reliable function name.
|
|
90
|
+
for ( let i = STACK_BACKWARD_CALLER_INDEX; i < errorsPerLine.length; i++ ) {
|
|
91
|
+
const line = errorsPerLine[ i ];
|
|
92
|
+
|
|
93
|
+
const isExcluded = BABEL_EXCLUDE_FUNCTIONS_NAMES.some( ( excludeName ) => {
|
|
94
|
+
return line.includes( excludeName );
|
|
95
|
+
} );
|
|
96
|
+
|
|
97
|
+
if ( ! isExcluded ) {
|
|
98
|
+
const format = line.trim().split(' ');
|
|
99
|
+
|
|
100
|
+
if ( format.length <= 2 ) {
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
extractName = format[ 1 ].split( "." )[ 1 ];
|
|
105
|
+
isBabelAsyncRuntime = true;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if ( ! isBabelAsyncRuntime ) {
|
|
111
|
+
extractName = UNKNOWN_CALLER_NAME;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return extractName;
|
|
71
117
|
}
|
|
72
118
|
|
|
73
119
|
/**
|
|
74
120
|
* Function functionView() : Return function preview.
|
|
75
121
|
*/
|
|
76
122
|
private static getFunctionView( fn: string | Function ): ( string | Function ) {
|
|
77
|
-
let fReturn =
|
|
123
|
+
let fReturn = UNKNOWN_CALLER_NAME;
|
|
78
124
|
|
|
79
125
|
// TODO: Check if works.
|
|
80
126
|
if ( typeof fn !== "string" && fn.name.length !== 0 ) {
|
|
@@ -157,7 +203,7 @@ export class Logger {
|
|
|
157
203
|
Logger.wrapperDepth++;
|
|
158
204
|
|
|
159
205
|
// Result will lose classType (instanceOf will not work), now based on obj.
|
|
160
|
-
let result = { ...
|
|
206
|
+
let result = { ...obj };
|
|
161
207
|
|
|
162
208
|
// @ts-ignore
|
|
163
209
|
Object.values( Logger.wrappers ).forEach( ( [ wrapper ] ) => {
|
|
@@ -405,7 +451,7 @@ export class Logger {
|
|
|
405
451
|
/**
|
|
406
452
|
* Function out() : Print console log with style
|
|
407
453
|
*/
|
|
408
|
-
private out( ...
|
|
454
|
+
private out( ...args: any ) {
|
|
409
455
|
this.outputHandler.apply( this, args );
|
|
410
456
|
}
|
|
411
457
|
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { RollupOptions, OutputPlugin, ModuleFormat, OutputOptions } from 'rollup';
|
|
2
|
-
export interface ICommonPluginArgs {
|
|
3
|
-
babelExcludeNodeModules?: boolean;
|
|
4
|
-
babelHelpers?: 'bundled' | 'runtime' | 'inline' | 'external';
|
|
5
|
-
babelRuntimeVersion?: string;
|
|
6
|
-
babelUseESModules?: boolean;
|
|
7
|
-
createDeclaration?: boolean;
|
|
8
|
-
development?: boolean;
|
|
9
|
-
production?: boolean;
|
|
10
|
-
minify?: boolean;
|
|
11
|
-
sourceMap?: boolean;
|
|
12
|
-
}
|
|
13
|
-
export type FormatType = 'cjs' | 'es' | 'esm' | 'umd-dev' | 'umd-prod';
|
|
14
|
-
export interface IMakeConfArgs {
|
|
15
|
-
format: FormatType;
|
|
16
|
-
inputName: string;
|
|
17
|
-
outputName?: string;
|
|
18
|
-
outputFileName: string;
|
|
19
|
-
external?: string[] | RegExp[];
|
|
20
|
-
}
|
|
21
|
-
export declare const makePlugins: (args?: ICommonPluginArgs) => OutputPlugin[];
|
|
22
|
-
export declare const makeOutput: (name: string, format: ModuleFormat, ext?: string) => OutputOptions;
|
|
23
|
-
export default function rollup(command: Record<string, unknown>): Promise<RollupOptions | RollupOptions[]>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author: Leonid Vinikov <leonidvinikov@gmail.com>
|
|
3
|
-
* @description: Providing a simple wrapper for fetch API.
|
|
4
|
-
*/
|
|
5
|
-
import ObjectBase from "../core/object-base";
|
|
6
|
-
import { HTTPMethodEnum } from "../enums/http";
|
|
7
|
-
export declare class Http extends ObjectBase {
|
|
8
|
-
private readonly logger;
|
|
9
|
-
private readonly apiBaseUrl;
|
|
10
|
-
static getName(): string;
|
|
11
|
-
/**
|
|
12
|
-
* Function constructor() : Create the http.
|
|
13
|
-
*/
|
|
14
|
-
constructor(apiBaseUrl?: string);
|
|
15
|
-
/**
|
|
16
|
-
* Function fetch() : Fetch api.
|
|
17
|
-
*/
|
|
18
|
-
fetch(path: string, method: HTTPMethodEnum, body?: {} | null): Promise<any>;
|
|
19
|
-
}
|
|
20
|
-
export default Http;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author: Leonid Vinikov <leonidvinikov@gmail.com>
|
|
3
|
-
* @description: Base for all commands, they are all will be managed by the `Commands` managers.
|
|
4
|
-
* @TODO
|
|
5
|
-
* - Add validateArgs method or find something better.
|
|
6
|
-
*/
|
|
7
|
-
import ObjectBase from "../core/object-base";
|
|
8
|
-
import { ICommandArgsInterface, ICommandOptionsInterface } from "../interfaces/commands";
|
|
9
|
-
export declare abstract class CommandBase extends ObjectBase {
|
|
10
|
-
protected args: ICommandArgsInterface;
|
|
11
|
-
protected options: ICommandOptionsInterface;
|
|
12
|
-
private readonly logger;
|
|
13
|
-
constructor(args?: ICommandArgsInterface, options?: {});
|
|
14
|
-
initialize(args: ICommandArgsInterface, options: ICommandOptionsInterface): void;
|
|
15
|
-
apply(args?: ICommandArgsInterface, options?: ICommandOptionsInterface): any;
|
|
16
|
-
run(): Promise<any>;
|
|
17
|
-
getArgs(): ICommandArgsInterface;
|
|
18
|
-
getOptions(): ICommandOptionsInterface;
|
|
19
|
-
onBeforeApply?(): void;
|
|
20
|
-
onAfterApply?(): void;
|
|
21
|
-
}
|
|
22
|
-
export default CommandBase;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { CommandBase } from './command-base';
|
|
2
|
-
export declare abstract class CommandData extends CommandBase {
|
|
3
|
-
static getName(): string;
|
|
4
|
-
/**
|
|
5
|
-
* Function getEndpoint() : Override this method is required to determine endpoint and magic query params.
|
|
6
|
-
* @example
|
|
7
|
-
* ```
|
|
8
|
-
* args = { query: { id: 1 } };
|
|
9
|
-
* getEndpoint() = '/api/v1/users/{id}';
|
|
10
|
-
* result = '/api/v1/users/1';
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
|
-
getEndpoint(): string;
|
|
14
|
-
apply(args?: import("../interfaces/commands").ICommandArgsInterface, options?: import("../interfaces/commands").ICommandOptionsInterface): Promise<any>;
|
|
15
|
-
private applyEndpointFormat;
|
|
16
|
-
}
|
|
17
|
-
export default CommandData;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author: Leonid Vinikov <leonidvinikov@gmail.com>
|
|
3
|
-
* @description: CommandInternal, is used when part of the logic needed to be in the command but not represent a user action.
|
|
4
|
-
*/
|
|
5
|
-
import CommandBase from "./command-base";
|
|
6
|
-
export declare class CommandInternal extends CommandBase {
|
|
7
|
-
static getName(): string;
|
|
8
|
-
}
|
|
9
|
-
export default CommandInternal;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author: Leonid Vinikov <leonidvinikov@gmail.com>
|
|
3
|
-
* @description: CommandPublic represents a USER action, every class which inherit from this class will USER action.
|
|
4
|
-
* */
|
|
5
|
-
import CommandBase from "./command-base";
|
|
6
|
-
export declare class CommandPublic extends CommandBase {
|
|
7
|
-
static getName(): string;
|
|
8
|
-
}
|
|
9
|
-
export default CommandPublic;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author: Leonid Vinikov <leonidvinikov@gmail.com>
|
|
3
|
-
* @description: Responsible for commands, Aka ( CommandsSpace ).
|
|
4
|
-
*/
|
|
5
|
-
import ObjectBase from "./object-base";
|
|
6
|
-
import { CommandData, CommandInternal, CommandPublic } from "../command-bases";
|
|
7
|
-
export declare abstract class Controller extends ObjectBase {
|
|
8
|
-
commands: {
|
|
9
|
-
[key: string]: typeof CommandPublic;
|
|
10
|
-
};
|
|
11
|
-
data: {
|
|
12
|
-
[key: string]: typeof CommandData;
|
|
13
|
-
};
|
|
14
|
-
internal: {
|
|
15
|
-
[key: string]: typeof CommandInternal;
|
|
16
|
-
};
|
|
17
|
-
static getName(): string;
|
|
18
|
-
constructor();
|
|
19
|
-
initialize(): void;
|
|
20
|
-
register(): void;
|
|
21
|
-
getCommands(): {
|
|
22
|
-
[key: string]: typeof CommandPublic;
|
|
23
|
-
};
|
|
24
|
-
getData(): {
|
|
25
|
-
[key: string]: typeof CommandData;
|
|
26
|
-
};
|
|
27
|
-
getInternal(): {
|
|
28
|
-
[key: string]: typeof CommandInternal;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Function setupHooks() : Override this method to setup hooks.
|
|
32
|
-
*/
|
|
33
|
-
setupHooks?(): void;
|
|
34
|
-
}
|
|
35
|
-
export default Controller;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { IObjectBaseInterface } from "../interfaces/object-base";
|
|
2
|
-
/**
|
|
3
|
-
* Base class 4 *
|
|
4
|
-
*/
|
|
5
|
-
export declare abstract class ObjectBase implements IObjectBaseInterface {
|
|
6
|
-
virtualId: number;
|
|
7
|
-
static getName(): string;
|
|
8
|
-
constructor();
|
|
9
|
-
getName(): string;
|
|
10
|
-
}
|
|
11
|
-
export declare function APIResetIdCounter(): number;
|
|
12
|
-
export declare function APIIncreaseIdCounter(): number;
|
|
13
|
-
export declare function APIGetIdCounter(): number;
|
|
14
|
-
export default ObjectBase;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author: Leonid Vinikov <leonidvinikov@gmail.com>
|
|
3
|
-
*/
|
|
4
|
-
import CommandBase from "../command-bases/command-base";
|
|
5
|
-
export declare class CommandAlreadyRegistered extends Error {
|
|
6
|
-
constructor(command: typeof CommandBase);
|
|
7
|
-
}
|
|
8
|
-
export default CommandAlreadyRegistered;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author: Leonid Vinikov <leonidvinikov@gmail.com>
|
|
3
|
-
*/
|
|
4
|
-
import ObjectBase from "../core/object-base";
|
|
5
|
-
export declare class ForceMethodBase extends Error {
|
|
6
|
-
constructor(className: string, methodName: string);
|
|
7
|
-
}
|
|
8
|
-
export declare class ForceMethod extends Error {
|
|
9
|
-
constructor(context: ObjectBase | typeof ObjectBase, methodName: string);
|
|
10
|
-
}
|
|
11
|
-
export default ForceMethod;
|
package/dist/es/src/exports.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author: Leonid Vinikov <leonidvinikov@gmail.com>
|
|
3
|
-
*/
|
|
4
|
-
export * as commandBases from "./command-bases";
|
|
5
|
-
export * as core from "./core";
|
|
6
|
-
export * as errors from "./errors";
|
|
7
|
-
export * as managers from "./managers";
|
|
8
|
-
export * as managerBases from "./manager-bases";
|
|
9
|
-
export * as modules from "./modules";
|
|
10
|
-
export * as utils from "./utils";
|
package/dist/es/src/globals.d.ts
DELETED
package/dist/es/src/index.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { IAPIConfig } from "./interfaces/config";
|
|
2
|
-
import * as exported from './exports';
|
|
3
|
-
declare global {
|
|
4
|
-
var ZenCore: any;
|
|
5
|
-
}
|
|
6
|
-
export declare let config: IAPIConfig;
|
|
7
|
-
export declare const CoreAPI: {
|
|
8
|
-
commandBases: typeof exported.commandBases;
|
|
9
|
-
core: typeof exported.core;
|
|
10
|
-
errors: typeof exported.errors;
|
|
11
|
-
managers: typeof exported.managers;
|
|
12
|
-
managerBases: typeof exported.managerBases;
|
|
13
|
-
modules: typeof exported.modules;
|
|
14
|
-
utils: typeof exported.utils;
|
|
15
|
-
initialize: (configuration?: IAPIConfig) => void;
|
|
16
|
-
destroy: () => void;
|
|
17
|
-
onAfterInitialize: (callback: () => void) => void;
|
|
18
|
-
config: IAPIConfig;
|
|
19
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export type CommandCallbackType = (args?: any, options?: any) => any;
|
|
2
|
-
export interface ICommandArgsInterface {
|
|
3
|
-
[key: string]: any;
|
|
4
|
-
}
|
|
5
|
-
export interface ICommandOptionsInterface {
|
|
6
|
-
[key: string]: any;
|
|
7
|
-
}
|
|
8
|
-
export interface IOnHookAffectInterface {
|
|
9
|
-
[key: string]: Array<String>;
|
|
10
|
-
}
|
|
11
|
-
export interface IOnHookInterface {
|
|
12
|
-
[key: string]: Array<CommandCallbackType>;
|
|
13
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import Commands from "../manager-bases/commands";
|
|
2
|
-
import Controllers from "../manager-bases/controllers";
|
|
3
|
-
import Data from "../manager-bases/data";
|
|
4
|
-
import Internal from "../manager-bases/internal";
|
|
5
|
-
import { IAPIConfig } from "./config";
|
|
6
|
-
export interface IManagers {
|
|
7
|
-
initialize: (config: IAPIConfig) => void;
|
|
8
|
-
destroy: () => void;
|
|
9
|
-
commands: Commands;
|
|
10
|
-
controllers: Controllers;
|
|
11
|
-
data: Data;
|
|
12
|
-
internal: Internal;
|
|
13
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author: Leonid Vinikov <leonidvinikov@gmail.com>
|
|
3
|
-
* @description: Responsible for manging/running/hooking commands.
|
|
4
|
-
*/
|
|
5
|
-
import { Logger } from "../modules/";
|
|
6
|
-
import { CommandBase } from "../command-bases";
|
|
7
|
-
import ObjectBase from "../core/object-base";
|
|
8
|
-
import Controller from "../core/controller";
|
|
9
|
-
import { ICommandArgsInterface, CommandCallbackType, IOnHookAffectInterface, IOnHookInterface } from "../interfaces/commands";
|
|
10
|
-
export declare class Commands extends ObjectBase {
|
|
11
|
-
static readonly trace: string[];
|
|
12
|
-
current: {
|
|
13
|
-
[key: string]: CommandBase;
|
|
14
|
-
};
|
|
15
|
-
currentArgs: {
|
|
16
|
-
[key: string]: ICommandArgsInterface;
|
|
17
|
-
};
|
|
18
|
-
trace: string[];
|
|
19
|
-
commands: {
|
|
20
|
-
[key: string]: typeof CommandBase;
|
|
21
|
-
};
|
|
22
|
-
onBeforeHooks: IOnHookInterface;
|
|
23
|
-
onBeforeUIHooks: IOnHookInterface;
|
|
24
|
-
onAfterHooks: IOnHookInterface;
|
|
25
|
-
onAfterOnceHooks: IOnHookInterface;
|
|
26
|
-
onAfterUIHooks: IOnHookInterface;
|
|
27
|
-
onAfterAffectHooks: IOnHookAffectInterface;
|
|
28
|
-
private readonly logger;
|
|
29
|
-
static getName(): string;
|
|
30
|
-
private static runCallbacks;
|
|
31
|
-
private static hookCommand;
|
|
32
|
-
constructor();
|
|
33
|
-
run(command: string | CommandBase, args?: ICommandArgsInterface, options?: any): Promise<any>;
|
|
34
|
-
register(commands: {
|
|
35
|
-
[key: string]: typeof CommandBase;
|
|
36
|
-
}, controller: Controller): {
|
|
37
|
-
[key: string]: typeof CommandBase;
|
|
38
|
-
};
|
|
39
|
-
getAll(): {
|
|
40
|
-
[key: string]: typeof CommandBase;
|
|
41
|
-
};
|
|
42
|
-
getByName(name: string): typeof CommandBase;
|
|
43
|
-
getLogger(): Logger;
|
|
44
|
-
getCommandInstance(name: string, args?: ICommandArgsInterface, options?: {}): CommandBase;
|
|
45
|
-
/**
|
|
46
|
-
* Function onBefore() : Used to set hooks that effects only data and not UI.
|
|
47
|
-
*/
|
|
48
|
-
onBefore(hookCommand: string, callback: CommandCallbackType): void;
|
|
49
|
-
/**
|
|
50
|
-
* Function onBeforeUI() : Used to set hooks that effects only UI.
|
|
51
|
-
*/
|
|
52
|
-
onBeforeUI(hookCommand: string, callback: CommandCallbackType): void;
|
|
53
|
-
/**
|
|
54
|
-
* Function onAfter() : Used to set hooks that effects only data and not UI.
|
|
55
|
-
*/
|
|
56
|
-
onAfter(hookCommand: string, callback: CommandCallbackType): void;
|
|
57
|
-
/**
|
|
58
|
-
* Function onAfterUI() : Used to set hooks that effects only UI.
|
|
59
|
-
*/
|
|
60
|
-
onAfterUI(command: string, callback: CommandCallbackType): void;
|
|
61
|
-
/**
|
|
62
|
-
* Function onAfterOnce() : Used to set hooks that effects only data and not UI.
|
|
63
|
-
*/
|
|
64
|
-
onAfterOnce(command: string, callback: CommandCallbackType): void;
|
|
65
|
-
/**
|
|
66
|
-
* Function onAfterAffect() : Used to register a trigger that runs command after `hookCommand` run's.
|
|
67
|
-
*/
|
|
68
|
-
onAfterAffect(hookCommand: string, affectCommand: string): void;
|
|
69
|
-
protected onBeforeRun(command: CommandBase, args?: ICommandArgsInterface, options?: {}): void;
|
|
70
|
-
protected runInstance(command: CommandBase, args?: ICommandArgsInterface, options?: {}): Promise<any>;
|
|
71
|
-
protected onAfterRun(command: CommandBase, args: ICommandArgsInterface, options: {}, result: any): Promise<any>;
|
|
72
|
-
protected attachCurrent(command: CommandBase, args?: any): void;
|
|
73
|
-
protected detachCurrent(command: CommandBase): void;
|
|
74
|
-
}
|
|
75
|
-
export default Commands;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author: Leonid Vinikov <leonidvinikov@gmail.com>
|
|
3
|
-
* @description: Responsible for manging controllers, each controller is global singleton instance.
|
|
4
|
-
*/
|
|
5
|
-
import ObjectBase from "../core/object-base";
|
|
6
|
-
import Controller from "../core/controller";
|
|
7
|
-
export declare class Controllers extends ObjectBase {
|
|
8
|
-
controllers: {
|
|
9
|
-
[key: string]: Controller;
|
|
10
|
-
};
|
|
11
|
-
static getName(): string;
|
|
12
|
-
get(name: string): Controller;
|
|
13
|
-
getAll(): {
|
|
14
|
-
[key: string]: Controller;
|
|
15
|
-
};
|
|
16
|
-
register(controller: Controller): Controller;
|
|
17
|
-
}
|
|
18
|
-
export default Controllers;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author: Leonid Vinikov <leonidvinikov@gmail.com>
|
|
3
|
-
* @description: Responsible for manging data commands which are wrappers for HTTP requests.
|
|
4
|
-
*/
|
|
5
|
-
import Commands from "./commands";
|
|
6
|
-
import { CommandData } from '../command-bases/';
|
|
7
|
-
import Http from '../clients/http';
|
|
8
|
-
import { HTTPMethodEnum } from "../enums/http";
|
|
9
|
-
import { IAPIConfig } from "../interfaces/config";
|
|
10
|
-
import { ICommandArgsInterface, ICommandOptionsInterface } from '../interfaces/commands';
|
|
11
|
-
export declare class Data extends Commands {
|
|
12
|
-
private static client;
|
|
13
|
-
currentHttpMethod: HTTPMethodEnum;
|
|
14
|
-
static getName(): string;
|
|
15
|
-
constructor(Config: IAPIConfig);
|
|
16
|
-
getClient(): Http;
|
|
17
|
-
get(command: string, args?: ICommandArgsInterface, options?: ICommandOptionsInterface): Promise<any>;
|
|
18
|
-
update(command: string, args?: ICommandArgsInterface, options?: {}): Promise<any>;
|
|
19
|
-
delete(command: string, args?: ICommandArgsInterface, options?: {}): Promise<any>;
|
|
20
|
-
create(command: string, args?: ICommandArgsInterface, options?: {}): Promise<any>;
|
|
21
|
-
protected runInstance(command: CommandData, args?: ICommandArgsInterface, options?: {}): Promise<any>;
|
|
22
|
-
}
|
|
23
|
-
export default Data;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author: Leonid Vinikov <leonidvinikov@gmail.com>
|
|
3
|
-
* @description: Responsible for manging internal commands, To serve commands that are not triggered by user.
|
|
4
|
-
*/
|
|
5
|
-
import { Commands } from "./commands";
|
|
6
|
-
export declare class Internal extends Commands {
|
|
7
|
-
static getName(): string;
|
|
8
|
-
}
|
|
9
|
-
export default Internal;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author: Leonid Vinikov <leonidvinikov@gmail.com>
|
|
3
|
-
*/
|
|
4
|
-
import Commands from "../manager-bases/commands";
|
|
5
|
-
import Controllers from "../manager-bases/controllers";
|
|
6
|
-
import Data from "../manager-bases/data";
|
|
7
|
-
import Internal from "../manager-bases/internal";
|
|
8
|
-
import { IAPIConfig } from "../interfaces/config";
|
|
9
|
-
export declare const afterInitializeCallbacks: (() => void)[];
|
|
10
|
-
export declare function initialize(config: IAPIConfig): void;
|
|
11
|
-
export declare function destroy(): void;
|
|
12
|
-
export declare var commands: Commands;
|
|
13
|
-
export declare var controllers: Controllers;
|
|
14
|
-
export declare var data: Data;
|
|
15
|
-
export declare var internal: Internal;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Logger } from "./logger";
|