@zenflux/core 0.1.0 → 0.1.1

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.
Files changed (62) hide show
  1. package/dist/src/bases/controller-base.d.ts +54 -0
  2. package/dist/src/bases/index.d.ts +2 -0
  3. package/dist/src/bases/object-base.d.ts +31 -0
  4. package/dist/src/clients/http.d.ts +40 -0
  5. package/dist/src/command-bases/command-base.d.ts +29 -0
  6. package/dist/src/command-bases/command-internal.d.ts +8 -0
  7. package/dist/src/command-bases/command-public.d.ts +8 -0
  8. package/dist/src/command-bases/command-restful.d.ts +21 -0
  9. package/dist/src/command-bases/index.d.ts +7 -0
  10. package/dist/src/errors/command-already-registered.d.ts +10 -0
  11. package/dist/src/errors/command-not-found.d.ts +9 -0
  12. package/dist/src/errors/controller-already-registered.d.ts +10 -0
  13. package/dist/src/errors/controller-already-set.d.ts +10 -0
  14. package/dist/src/errors/force-method-implementation.d.ts +13 -0
  15. package/dist/src/errors/index-public.d.ts +1 -0
  16. package/dist/src/errors/index.d.ts +5 -0
  17. package/dist/src/exports-index.d.ts +6 -0
  18. package/dist/src/exports.d.ts +29 -0
  19. package/dist/src/index.d.ts +9 -0
  20. package/dist/src/interfaces/commands.d.ts +13 -0
  21. package/dist/src/interfaces/config.d.ts +20 -0
  22. package/dist/src/interfaces/index.d.ts +7 -0
  23. package/dist/src/interfaces/logger.d.ts +19 -0
  24. package/dist/src/interfaces/restful.d.ts +18 -0
  25. package/dist/src/managers/commands.d.ts +67 -0
  26. package/dist/src/managers/controllers.d.ts +12 -0
  27. package/dist/src/managers/export.d.ts +15 -0
  28. package/dist/src/managers/index.d.ts +7 -0
  29. package/dist/src/managers/internal.d.ts +8 -0
  30. package/dist/src/managers/restful.d.ts +25 -0
  31. package/dist/tsconfig.tsbuildinfo +1 -0
  32. package/dist/zenflux-core.cjs +154 -0
  33. package/dist/zenflux-core.d.ts +8 -0
  34. package/dist/zenflux-core.mjs +145 -0
  35. package/dist/zenflux.config.d.ts +3 -0
  36. package/package.json +12 -5
  37. package/src/bases/controller-base.ts +5 -5
  38. package/src/bases/index.ts +2 -2
  39. package/src/bases/object-base.ts +1 -1
  40. package/src/clients/http.ts +3 -3
  41. package/src/command-bases/command-base.ts +4 -4
  42. package/src/command-bases/command-internal.ts +1 -1
  43. package/src/command-bases/command-public.ts +1 -1
  44. package/src/command-bases/command-restful.ts +3 -3
  45. package/src/command-bases/index.ts +4 -4
  46. package/src/errors/command-already-registered.ts +1 -1
  47. package/src/errors/controller-already-registered.ts +1 -1
  48. package/src/errors/controller-already-set.ts +1 -1
  49. package/src/errors/force-method-implementation.ts +1 -1
  50. package/src/errors/index-public.ts +1 -1
  51. package/src/errors/index.ts +5 -5
  52. package/src/exports-index.ts +5 -5
  53. package/src/exports.ts +2 -2
  54. package/src/index.ts +2 -2
  55. package/src/interfaces/index.ts +4 -4
  56. package/src/interfaces/restful.ts +1 -1
  57. package/src/managers/commands.ts +7 -7
  58. package/src/managers/controllers.ts +3 -3
  59. package/src/managers/export.ts +5 -5
  60. package/src/managers/index.ts +4 -4
  61. package/src/managers/internal.ts +1 -1
  62. package/src/managers/restful.ts +5 -5
@@ -0,0 +1,54 @@
1
+ /**
2
+ * The `ControllerBase` class is an abstract base class responsible for managing commands and providing a structure
3
+ * for controllers or command spaces.
4
+ *
5
+ * @author Leonid Vinikov <leonidvinikov@gmail.com>
6
+ */
7
+ import { ObjectBase } from "@zenflux/core/dist/src/bases/object-base";
8
+ import type { CommandPublic } from "@zenflux/core/dist/src/command-bases/command-public";
9
+ import type { CommandRestful } from "@zenflux/core/dist/src/command-bases/command-restful";
10
+ import type { CommandInternal } from "@zenflux/core/dist/src/command-bases/command-internal";
11
+ export declare abstract class ControllerBase extends ObjectBase {
12
+ private commands;
13
+ private restful;
14
+ private internal;
15
+ static getName(): string;
16
+ /**
17
+ * Constructor for `ControllerBase` instances.
18
+ * Initializes the base class and invokes the `initialize()` method.
19
+ */
20
+ constructor();
21
+ /**
22
+ * Initializes the controller by calling the `register()` method and optionally the `setupHooks()` method.
23
+ */
24
+ protected initialize(): void;
25
+ /**
26
+ * Registers commands and command types by calling manager functions.
27
+ */
28
+ protected register(): void;
29
+ /**
30
+ * Retrieve the public commands associated with this controller.
31
+ * Derived classes can override this method to specify their own commands.
32
+ */
33
+ protected getCommands(): {
34
+ [key: string]: typeof CommandPublic;
35
+ };
36
+ /**
37
+ * Retrieve the RESTful commands associated with this controller.
38
+ * Derived classes can override this method to specify their own RESTful commands.
39
+ */
40
+ protected getRestful(): {
41
+ [key: string]: typeof CommandRestful;
42
+ };
43
+ /**
44
+ * Retrieve the internal commands associated with this controller.
45
+ * Derived classes can override this method to specify their own internal commands.
46
+ */
47
+ protected getInternal(): {
48
+ [key: string]: typeof CommandInternal;
49
+ };
50
+ /**
51
+ * A hook method that can be optionally overridden in derived classes to set up hooks or event listeners.
52
+ */
53
+ protected setupHooks?(): void;
54
+ }
@@ -0,0 +1,2 @@
1
+ export { ControllerBase } from "@zenflux/core/dist/src/bases/controller-base";
2
+ export { ObjectBase } from "@zenflux/core/dist/src/bases/object-base";
@@ -0,0 +1,31 @@
1
+ export declare abstract class ObjectBase {
2
+ private readonly _id;
3
+ private readonly name;
4
+ /**
5
+ * Initializes the name and unique identifier for the instance.
6
+ */
7
+ protected constructor();
8
+ /**
9
+ * Static method to retrieve the name of the class. This method is abstract and must be implemented
10
+ * by derived classes.
11
+ */
12
+ static getName(): string;
13
+ /**
14
+ * Retrieves the name of the current instance by calling the static `getName()` method of the
15
+ * constructor (derived class).
16
+ */
17
+ getName(): string;
18
+ /**
19
+ * Retrieves the unique identifier of the current instance.
20
+ */
21
+ getUniqueId(): string;
22
+ /**
23
+ * Retrieves the initial name that was set during construction. This name may be "__UNDEFINED_NAME__"
24
+ * if the `getName()` method of the derived class does not provide a valid name.
25
+ */
26
+ getInitialName(): string;
27
+ /**
28
+ * Retrieves an array of hierarchical class names from the current instance up to the `ObjectBase` class.
29
+ */
30
+ getHierarchyNames(): string[];
31
+ }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * The `Http` class provides a simple wrapper for the Fetch API.
3
+ *
4
+ * @author Leonid Vinikov <leonidvinikov@gmail.com>
5
+ */
6
+ import { E_HTTP_METHOD_TYPE } from "@zenflux/core/dist/src/interfaces";
7
+ import { ObjectBase } from "@zenflux/core/dist/src/bases/object-base";
8
+ import type { TErrorHandlerCallbackType, TResponseFilterCallbackType, TResponseHandlerCallbackType } from "@zenflux/core/dist/src/interfaces";
9
+ export declare class Http extends ObjectBase {
10
+ private readonly logger;
11
+ private readonly apiBaseUrl;
12
+ private readonly requestInit;
13
+ private errorHandler?;
14
+ private responseFilter?;
15
+ private responseHandler?;
16
+ static getName(): string;
17
+ /**
18
+ * Initializes the base class and sets up configuration parameters.
19
+ */
20
+ constructor(apiBaseUrl?: string, requestInit?: RequestInit);
21
+ /**
22
+ * Fetches data from the specified path using the given HTTP method and optional request body.
23
+ */
24
+ fetch(path: string, method: E_HTTP_METHOD_TYPE, body?: any): Promise<any>;
25
+ /**
26
+ * Sets the error handler callback for handling errors during fetch requests.
27
+ */
28
+ setErrorHandler(callback: TErrorHandlerCallbackType): void;
29
+ /**
30
+ * Sets the response filter callback for filtering the response text.
31
+ */
32
+ setResponseFilter(callback: TResponseFilterCallbackType): void;
33
+ /**
34
+ * Sets the response handler callback for handling the response data.
35
+ */
36
+ setResponseHandler(callback: TResponseHandlerCallbackType): void;
37
+ private applyErrorHandler;
38
+ private applyResponseFilter;
39
+ private applyResponseHandler;
40
+ }
@@ -0,0 +1,29 @@
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
+ *
5
+ * TODO
6
+ * - Add validateArgs method or find something better.
7
+ */
8
+ import { ObjectBase } from "@zenflux/core/dist/src/bases";
9
+ import type { ControllerBase } from "@zenflux/core/dist/src/bases";
10
+ import type { ICommandArgsInterface, ICommandOptionsInterface } from "@zenflux/core/dist/src/interfaces";
11
+ export declare abstract class CommandBase extends ObjectBase {
12
+ private static controller;
13
+ protected args: ICommandArgsInterface;
14
+ protected options: ICommandOptionsInterface;
15
+ private readonly logger;
16
+ static getName(): string;
17
+ static setController(controller: ControllerBase): void;
18
+ static getController(): ControllerBase;
19
+ constructor(args?: ICommandArgsInterface, options?: {});
20
+ protected initialize(args: ICommandArgsInterface, options: ICommandOptionsInterface): void;
21
+ /**
22
+ * TODO: Maybe abstract, currently not sure about parameters initialization.
23
+ */
24
+ protected apply(args?: ICommandArgsInterface, options?: ICommandOptionsInterface): any;
25
+ protected onBeforeApply?(): void;
26
+ protected onAfterApply?(): void;
27
+ run(): Promise<any>;
28
+ private runInternal;
29
+ }
@@ -0,0 +1,8 @@
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 "@zenflux/core/dist/src/command-bases/command-base";
6
+ export declare class CommandInternal extends CommandBase {
7
+ static getName(): string;
8
+ }
@@ -0,0 +1,8 @@
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 "@zenflux/core/dist/src/command-bases/command-base";
6
+ export declare class CommandPublic extends CommandBase {
7
+ static getName(): string;
8
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @author Leonid Vinikov <leonidvinikov@gmail.com>
3
+ * @description Each rest command should represent a final REST endpoint.
4
+ */
5
+ import { CommandBase } from "@zenflux/core/dist/src/command-bases/command-base";
6
+ export declare abstract class CommandRestful extends CommandBase {
7
+ static getName(): string;
8
+ /**
9
+ * Override this method is required to determine endpoint and magic query params.
10
+ *
11
+ * @example
12
+ * ```
13
+ * args = { query: { id: 1 } };
14
+ * getEndpoint() = '/api/v1/users/{id}';
15
+ * result = '/api/v1/users/1';
16
+ * ```
17
+ */
18
+ getEndpoint(): string;
19
+ protected apply(args?: import("../interfaces").ICommandArgsInterface, options?: import("../interfaces").ICommandOptionsInterface): Promise<any>;
20
+ private applyEndpointFormat;
21
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @author Leonid Vinikov <leonidvinikov@gmail.com>
3
+ */
4
+ export { CommandPublic } from "@zenflux/core/dist/src/command-bases/command-public";
5
+ export { CommandRestful } from "@zenflux/core/dist/src/command-bases/command-restful";
6
+ export { CommandBase } from "@zenflux/core/dist/src/command-bases/command-base";
7
+ export { CommandInternal } from "@zenflux/core/dist/src/command-bases/command-internal";
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @author Leonid Vinikov <leonidvinikov@gmail.com>
3
+ */
4
+ import type { CommandBase } from "@zenflux/core/dist/src/command-bases/command-base";
5
+ /**
6
+ * @internal
7
+ */
8
+ export declare class CommandAlreadyRegistered extends Error {
9
+ constructor(command: typeof CommandBase);
10
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @author Leonid Vinikov <leonidvinikov@gmail.com>
3
+ */
4
+ /**
5
+ * @internal
6
+ */
7
+ export declare class CommandNotFound extends Error {
8
+ constructor(command: string);
9
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @author Leonid Vinikov <leonidvinikov@gmail.com>
3
+ */
4
+ import type { ControllerBase } from "@zenflux/core/dist/src/bases";
5
+ /**
6
+ * @internal
7
+ */
8
+ export declare class ControllerAlreadyRegistered extends Error {
9
+ constructor(controller: ControllerBase);
10
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @author Leonid Vinikov <leonidvinikov@gmail.com>
3
+ */
4
+ import type { ControllerBase } from "@zenflux/core/dist/src/bases";
5
+ /**
6
+ * @internal
7
+ */
8
+ export declare class ControllerAlreadySet extends Error {
9
+ constructor(controller: ControllerBase);
10
+ }
@@ -0,0 +1,13 @@
1
+ import type { ObjectBase } from "@zenflux/core/dist/src/bases";
2
+ /**
3
+ * @internal
4
+ */
5
+ export declare class ForceMethodBase extends Error {
6
+ constructor(className: string, methodName: string);
7
+ }
8
+ /**
9
+ * @public
10
+ */
11
+ export declare class ForceMethodImplementation extends Error {
12
+ constructor(context: ObjectBase | typeof ObjectBase | string, methodName: string);
13
+ }
@@ -0,0 +1 @@
1
+ export { ForceMethodImplementation } from "@zenflux/core/dist/src/errors/force-method-implementation";
@@ -0,0 +1,5 @@
1
+ export { CommandAlreadyRegistered } from "@zenflux/core/dist/src/errors/command-already-registered";
2
+ export { CommandNotFound } from "@zenflux/core/dist/src/errors/command-not-found";
3
+ export { ControllerAlreadyRegistered } from "@zenflux/core/dist/src/errors/controller-already-registered";
4
+ export { ControllerAlreadySet } from "@zenflux/core/dist/src/errors/controller-already-set";
5
+ export { ForceMethodImplementation } from "@zenflux/core/dist/src/errors/force-method-implementation";
@@ -0,0 +1,6 @@
1
+ import * as bases from "@zenflux/core/dist/src/bases";
2
+ import * as commandBases from "@zenflux/core/dist/src/command-bases";
3
+ import * as errors from "@zenflux/core/dist/src/errors/index-public";
4
+ import * as interfaces from "@zenflux/core/dist/src/interfaces";
5
+ import * as managers from "@zenflux/core/dist/src/managers/export";
6
+ export { bases, commandBases, errors, interfaces, managers, };
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @author Leonid Vinikov <leonidvinikov@gmail.com>
3
+ */
4
+ import { bases, commandBases, errors, interfaces, managers } from "@zenflux/core/dist/src/exports-index";
5
+ declare global {
6
+ var __ZEN_CORE__IS_INITIALIZED__: boolean;
7
+ }
8
+ export declare const classes: {
9
+ Logger: {
10
+ new (owner: typeof bases.ObjectBase, params?: any): {
11
+ log(caller: interfaces.TCaller, message: string, ...params: any[]): void;
12
+ warn(caller: interfaces.TCaller, message: string, ...params: any[]): void;
13
+ error(caller: interfaces.TCaller, message: string, ...params: any[]): void;
14
+ info(caller: interfaces.TCaller, message: string, ...params: any[]): void;
15
+ debug(caller: interfaces.TCaller, message: string, ...params: any[]): void;
16
+ startsEmpty(caller: interfaces.TCaller): void;
17
+ startsWith(caller: interfaces.TCaller, params: object): void;
18
+ dump(caller: interfaces.TCaller, data: any): void;
19
+ drop(caller: interfaces.TCaller, according: {
20
+ [key: string]: string;
21
+ }, data: any): void;
22
+ };
23
+ };
24
+ };
25
+ export declare function initialize(config?: Partial<interfaces.IAPIConfig>): void;
26
+ export declare function destroy(): void;
27
+ export declare function onAfterInitialize(callback: () => void): void;
28
+ export declare const config: interfaces.IAPIConfig;
29
+ export { bases, commandBases, errors, interfaces, managers };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @author Leonid Vinikov <leonidvinikov@gmail.com>
3
+ */
4
+ import * as ZenCore from "@zenflux/core/dist/src/exports";
5
+ declare global {
6
+ var zCore: typeof ZenCore;
7
+ }
8
+ export * from "@zenflux/core/dist/src/exports-index";
9
+ export default ZenCore;
@@ -0,0 +1,13 @@
1
+ export type TCommandCallbackType = (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<TCommandCallbackType>;
13
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @author Leonid Vinikov <leonidvinikov@gmail.com>
3
+ */
4
+ /**
5
+ *
6
+ */
7
+ export interface IAPIConfig {
8
+ /**
9
+ * @description API version, from `package.json`
10
+ */
11
+ version: string;
12
+ /**
13
+ * @description API base url for http requests.
14
+ */
15
+ baseURL?: string;
16
+ /**
17
+ * @description Request Init for fetch API.
18
+ */
19
+ requestInit?: RequestInit;
20
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @author Leonid Vinikov <leonidvinikov@gmail.com>
3
+ */
4
+ export type * from "@zenflux/core/dist/src/interfaces/commands";
5
+ export type * from "@zenflux/core/dist/src/interfaces/config";
6
+ export type * from "@zenflux/core/dist/src/interfaces/logger";
7
+ export * from "@zenflux/core/dist/src/interfaces/restful";
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @author Leonid Vinikov <leonidvinikov@gmail.com>
3
+ */
4
+ export type TCaller = string | Function;
5
+ export interface ILogger {
6
+ log(caller: TCaller, message: string, ...params: any[]): void;
7
+ warn(caller: TCaller, message: string, ...params: any[]): void;
8
+ error(caller: TCaller, message: string, ...params: any[]): void;
9
+ info(caller: TCaller, message: string, ...params: any[]): void;
10
+ debug(caller: TCaller, message: string, ...params: any[]): void;
11
+ startsEmpty(caller: TCaller): void;
12
+ startsWith(caller: TCaller, params: object): void;
13
+ dump(caller: TCaller, params: {
14
+ [key: string]: object | string;
15
+ }): void;
16
+ drop(caller: TCaller, according: {
17
+ [key: string]: string;
18
+ }, data: any): void;
19
+ }
@@ -0,0 +1,18 @@
1
+ export type TErrorHandlerCallbackType = (data: any) => boolean;
2
+ export type TResponseFilterCallbackType = (text: string) => string;
3
+ export type TResponseHandlerCallbackType = (text: string) => boolean;
4
+ export type TPossibleHandlersType = TErrorHandlerCallbackType | TResponseFilterCallbackType | TResponseHandlerCallbackType;
5
+ export declare enum E_RESPONSE_HANDLER_TYPE {
6
+ ERROR_HANDLER = "error_handler",
7
+ RESPONSE_FILTER = "response_filter",
8
+ RESPONSE_HANDLER = "response_handler"
9
+ }
10
+ export declare enum E_HTTP_METHOD_TYPE {
11
+ DELETE = "DELETE",// Delete.
12
+ GET = "GET",// Read.
13
+ OPTIONS = "OPTIONS",// Options about the request
14
+ PATCH = "PATCH",// Update/Modify.
15
+ POST = "POST",// Create.
16
+ PUT = "PUT",// Update/Replace.
17
+ "__EMPTY__" = ""
18
+ }
@@ -0,0 +1,67 @@
1
+ /**
2
+ * @author Leonid Vinikov <leonidvinikov@gmail.com>
3
+ * @description Responsible for manging/running/hooking commands.
4
+ */
5
+ import { ObjectBase } from "@zenflux/core/dist/src/bases/object-base";
6
+ import type { TCommandCallbackType, ICommandArgsInterface, ILogger } from "@zenflux/core/dist/src/interfaces";
7
+ import type { ControllerBase } from "@zenflux/core/dist/src/bases/controller-base";
8
+ import type { CommandBase } from "@zenflux/core/dist/src/command-bases/command-base";
9
+ export declare class Commands extends ObjectBase {
10
+ static readonly trace: string[];
11
+ private current;
12
+ private currentArgs;
13
+ private trace;
14
+ private commands;
15
+ private onBeforeHooks;
16
+ private onBeforeUIHooks;
17
+ private onAfterHooks;
18
+ private onAfterOnceHooks;
19
+ private onAfterUIHooks;
20
+ private onAfterAffectHooks;
21
+ private readonly logger;
22
+ static getName(): string;
23
+ private static runCallbacks;
24
+ private static hookCommand;
25
+ constructor();
26
+ run(command: string | CommandBase, args?: ICommandArgsInterface, options?: any): Promise<any>;
27
+ register(commands: {
28
+ [key: string]: typeof CommandBase;
29
+ }, controller: ControllerBase): {
30
+ [key: string]: typeof CommandBase;
31
+ };
32
+ getAll(): {
33
+ [key: string]: typeof CommandBase;
34
+ };
35
+ getByName(name: string): typeof CommandBase;
36
+ getLogger(): ILogger;
37
+ getCommandInstance(name: string, args?: ICommandArgsInterface, options?: {}): CommandBase;
38
+ /**
39
+ * Used to set hooks that effects only data and not UI.
40
+ */
41
+ onBefore(hookCommand: string, callback: TCommandCallbackType): void;
42
+ /**
43
+ * Used to set hooks that effects only UI.
44
+ */
45
+ onBeforeUI(hookCommand: string, callback: TCommandCallbackType): void;
46
+ /**
47
+ * Used to set hooks that effects only data and not UI.
48
+ */
49
+ onAfter(hookCommand: string, callback: TCommandCallbackType): void;
50
+ /**
51
+ * Used to set hooks that effects only UI.
52
+ */
53
+ onAfterUI(command: string, callback: TCommandCallbackType): void;
54
+ /**
55
+ * Used to set hooks that effects only data and not UI.
56
+ */
57
+ onAfterOnce(command: string, callback: TCommandCallbackType): void;
58
+ /**
59
+ * Used to register a trigger that runs command after `hookCommand` run's.
60
+ */
61
+ onAfterAffect(hookCommand: string, affectCommand: string): void;
62
+ protected onBeforeRun(command: CommandBase, args?: ICommandArgsInterface, options?: {}): void;
63
+ protected runInstance(command: CommandBase, args?: ICommandArgsInterface, options?: {}): Promise<any>;
64
+ protected onAfterRun(command: CommandBase, args: ICommandArgsInterface, options: {}, result: any): Promise<any>;
65
+ protected attachCurrent(command: CommandBase, args?: any): void;
66
+ protected detachCurrent(command: CommandBase): void;
67
+ }
@@ -0,0 +1,12 @@
1
+ import { ObjectBase } from "@zenflux/core/dist/src/bases/object-base";
2
+ import type { ControllerBase } from "@zenflux/core/dist/src/bases/controller-base";
3
+ export declare class Controllers extends ObjectBase {
4
+ private controllers;
5
+ constructor();
6
+ static getName(): string;
7
+ get(name: string): ControllerBase;
8
+ getAll(): {
9
+ [key: string]: ControllerBase;
10
+ };
11
+ register(controller: ControllerBase): ControllerBase;
12
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @author Leonid Vinikov <leonidvinikov@gmail.com>
3
+ */
4
+ import { Commands } from "@zenflux/core/dist/src/managers/commands";
5
+ import { Controllers } from "@zenflux/core/dist/src/managers/controllers";
6
+ import { Restful } from "@zenflux/core/dist/src/managers/restful";
7
+ import { Internal } from "@zenflux/core/dist/src/managers/internal";
8
+ import type { IAPIConfig } from "@zenflux/core/dist/src/interfaces";
9
+ export declare const afterInitializeCallbacks: (() => void)[];
10
+ export declare function initialize(config: IAPIConfig): void;
11
+ export declare function destroy(): void;
12
+ export declare let commands: Commands;
13
+ export declare let controllers: Controllers;
14
+ export declare let restful: Restful;
15
+ export declare let internal: Internal;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @author Leonid Vinikov <leonidvinikov@gmail.com>
3
+ */
4
+ export { Commands } from "@zenflux/core/dist/src/managers/commands";
5
+ export { Controllers } from "@zenflux/core/dist/src/managers/controllers";
6
+ export { Restful } from "@zenflux/core/dist/src/managers/restful";
7
+ export { Internal } from "@zenflux/core/dist/src/managers/internal";
@@ -0,0 +1,8 @@
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 "@zenflux/core/dist/src/managers/commands";
6
+ export declare class Internal extends Commands {
7
+ static getName(): string;
8
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @author Leonid Vinikov <leonidvinikov@gmail.com>
3
+ * @description Responsible for manging restful commands which are wrappers for HTTP requests.
4
+ */
5
+ import { Commands } from "@zenflux/core/dist/src/managers/commands";
6
+ import { Http } from "@zenflux/core/dist/src/clients/http";
7
+ import { E_RESPONSE_HANDLER_TYPE, E_HTTP_METHOD_TYPE } from "@zenflux/core/dist/src/interfaces";
8
+ import type { CommandRestful } from "@zenflux/core/dist/src/command-bases";
9
+ import type { IAPIConfig, ICommandArgsInterface, ICommandOptionsInterface, TPossibleHandlersType } from "@zenflux/core/dist/src/interfaces";
10
+ export declare class Restful extends Commands {
11
+ private static client;
12
+ currentHttpMethod: E_HTTP_METHOD_TYPE;
13
+ static getName(): string;
14
+ constructor(Config: IAPIConfig);
15
+ getClient(): Http;
16
+ get(command: string, args?: ICommandArgsInterface, options?: ICommandOptionsInterface): Promise<any>;
17
+ update(command: string, args?: ICommandArgsInterface, options?: {}): Promise<any>;
18
+ delete(command: string, args?: ICommandArgsInterface, options?: {}): Promise<any>;
19
+ create(command: string, args?: ICommandArgsInterface, options?: {}): Promise<any>;
20
+ protected runInstance(command: CommandRestful, args?: ICommandArgsInterface, options?: {}): Promise<any>;
21
+ /**
22
+ * Handlers on return true will swallow the request.
23
+ */
24
+ setHandler(type: E_RESPONSE_HANDLER_TYPE, callback: TPossibleHandlersType): void;
25
+ }
@@ -0,0 +1 @@
1
+ {"version":"5.9.3"}