@zenflux/core 0.1.29 → 0.1.30

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 (59) hide show
  1. package/dist/.tsconfig.probe.tsbuildinfo +1 -0
  2. package/dist/src/exports.d.ts +0 -3
  3. package/dist/src/index.d.ts +0 -5
  4. package/dist/src/modules/logger/implementation.d.ts +1 -0
  5. package/dist/zenflux-core.cjs +37 -119
  6. package/dist/zenflux-core.d.ts +3 -32
  7. package/dist/zenflux-core.mjs +38 -117
  8. package/package.json +2 -2
  9. package/src/bases/cache-base.ts +64 -0
  10. package/src/bases/controller-base.ts +96 -0
  11. package/src/bases/index.ts +9 -0
  12. package/src/bases/initialize-base.ts +32 -0
  13. package/src/bases/object-base.ts +55 -0
  14. package/src/bases/singleton-base.ts +18 -0
  15. package/src/clients/http.ts +152 -0
  16. package/src/command-bases/command-base.ts +80 -0
  17. package/src/command-bases/command-internal.ts +11 -0
  18. package/src/command-bases/command-public.ts +12 -0
  19. package/src/command-bases/command-restful.ts +55 -0
  20. package/src/command-bases/index.ts +8 -0
  21. package/src/errors/command-already-registered.ts +13 -0
  22. package/src/errors/command-not-found.ts +12 -0
  23. package/src/errors/controller-already-registered.ts +13 -0
  24. package/src/errors/controller-already-set.ts +13 -0
  25. package/src/errors/error-with-metadata.ts +29 -0
  26. package/src/errors/force-method-implementation.ts +15 -0
  27. package/src/errors/index-public.ts +1 -0
  28. package/src/errors/index.ts +10 -0
  29. package/src/exports-index.ts +15 -0
  30. package/src/exports.ts +55 -0
  31. package/src/index.ts +18 -0
  32. package/src/interfaces/commands.ts +17 -0
  33. package/src/interfaces/config.ts +23 -0
  34. package/src/interfaces/index.ts +8 -0
  35. package/src/interfaces/logger.ts +19 -0
  36. package/src/interfaces/restful.ts +23 -0
  37. package/src/managers/commands.ts +269 -0
  38. package/src/managers/controllers.ts +40 -0
  39. package/src/managers/export.ts +30 -0
  40. package/src/managers/index.ts +8 -0
  41. package/src/managers/internal.ts +11 -0
  42. package/src/managers/restful.ts +117 -0
  43. package/src/modules/debugger.ts +86 -0
  44. package/src/modules/event-bus/event-bus.ts +238 -0
  45. package/src/modules/export.ts +6 -0
  46. package/src/modules/logger/config.ts +66 -0
  47. package/src/modules/logger/create-logger.ts +38 -0
  48. package/src/modules/logger/implementation.ts +371 -0
  49. package/src/modules/logger/index.ts +3 -0
  50. package/src/modules/logger/logger-browser-infra.ts +364 -0
  51. package/src/modules/logger/types/picocolors.d.ts +15 -0
  52. package/src/modules/logger/utils/index.ts +3 -0
  53. package/src/modules/logger/utils/object.ts +19 -0
  54. package/src/modules/logger/utils/rgb.ts +34 -0
  55. package/src/modules/mcp-server/mcp-server.ts +139 -0
  56. package/src/modules/mcp-server/mcp-service.ts +80 -0
  57. package/src/modules/service/service-base.ts +55 -0
  58. package/src/modules/service/service-locator.ts +205 -0
  59. package/src/modules/service/service-with-dependencies-base.ts +51 -0
@@ -0,0 +1,152 @@
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 "../interfaces";
7
+
8
+ import { ObjectBase } from "../bases/object-base";
9
+
10
+ import type {
11
+ ILogger,
12
+ TErrorHandlerCallbackType,
13
+ TResponseFilterCallbackType,
14
+ TResponseHandlerCallbackType
15
+ } from "../interfaces";
16
+
17
+ // noinspection ExceptionCaughtLocallyJS
18
+
19
+ export class Http extends ObjectBase {
20
+ private readonly logger: ILogger;
21
+ private readonly apiBaseUrl: string;
22
+ private readonly requestInit: RequestInit;
23
+
24
+ private errorHandler?: TErrorHandlerCallbackType = undefined;
25
+ private responseFilter?: TResponseFilterCallbackType = undefined;
26
+ private responseHandler?: TResponseHandlerCallbackType = undefined;
27
+
28
+ public static getName(): string {
29
+ return "ZenFlux/Core/Clients/Http";
30
+ }
31
+
32
+ /**
33
+ * Initializes the base class and sets up configuration parameters.
34
+ */
35
+ public constructor( apiBaseUrl = "http://localhost", requestInit: RequestInit = { "credentials": "include" } ) {
36
+ super();
37
+
38
+ this.logger = new zCore.classes.Logger( Http );
39
+
40
+ this.logger.startsWith( this.constructor, { apiBaseUrl } );
41
+
42
+ this.apiBaseUrl = apiBaseUrl + "/";
43
+ this.requestInit = requestInit;
44
+ }
45
+
46
+ /**
47
+ * Fetches data from the specified path using the given HTTP method and optional request body.
48
+ */
49
+ public async fetch( path: string, method: E_HTTP_METHOD_TYPE, body: any = {} ) {
50
+ this.logger.startsWith( this.constructor, { path, method, body } );
51
+
52
+ const params = Object.assign( {}, this.requestInit );
53
+ const headers = {};
54
+
55
+ if ( method === E_HTTP_METHOD_TYPE.GET ) {
56
+ Object.assign( params, { headers } );
57
+ } else {
58
+ Object.assign( headers, { "Content-Type": "application/json" } );
59
+ Object.assign( params, {
60
+ method,
61
+ headers: headers,
62
+ body: JSON.stringify( body ),
63
+ } );
64
+ }
65
+
66
+ const fetchPromise = globalThis.fetch( this.apiBaseUrl + path, params );
67
+
68
+ let response = await fetchPromise;
69
+
70
+ if ( ! response ) {
71
+ return false;
72
+ }
73
+
74
+ let data = undefined;
75
+
76
+ try {
77
+ if ( ! response.ok ) {
78
+ throw new Error( response.statusText );
79
+ }
80
+
81
+ let responseText = await response.text();
82
+
83
+ responseText = this.applyResponseFilter( responseText );
84
+
85
+ // TODO: Currently support JSON and plain text.
86
+ if ( response.headers?.get( "Content-Type" )?.includes( "application/json" ) ) {
87
+ data = JSON.parse( responseText );
88
+ } else {
89
+ data = responseText;
90
+ }
91
+
92
+ if ( this.applyResponseHandler( data ) ) {
93
+ return false;
94
+ }
95
+ } catch( e ) {
96
+ if ( this.applyErrorHandler( e ) ) {
97
+ return false;
98
+ }
99
+
100
+ await Promise.reject( e );
101
+ }
102
+
103
+ this.logger.drop( this.fetch, { path }, data );
104
+
105
+ return data;
106
+ }
107
+
108
+ /**
109
+ * Sets the error handler callback for handling errors during fetch requests.
110
+ */
111
+ public setErrorHandler( callback: TErrorHandlerCallbackType ) {
112
+ if ( this.errorHandler ) {
113
+ throw new Error( "Error handler already set." );
114
+ }
115
+
116
+ this.errorHandler = callback;
117
+ }
118
+
119
+ /**
120
+ * Sets the response filter callback for filtering the response text.
121
+ */
122
+ public setResponseFilter( callback: TResponseFilterCallbackType ) {
123
+ if ( this.responseFilter ) {
124
+ throw new Error( "Response filter already set." );
125
+ }
126
+
127
+ this.responseFilter = callback;
128
+ }
129
+
130
+ /**
131
+ * Sets the response handler callback for handling the response data.
132
+ */
133
+ public setResponseHandler( callback: TResponseHandlerCallbackType ) {
134
+ if ( this.responseHandler ) {
135
+ throw new Error( "Response handler already set." );
136
+ }
137
+
138
+ this.responseHandler = callback;
139
+ }
140
+
141
+ private applyErrorHandler( error: any ) {
142
+ return !! this.errorHandler && this.errorHandler( error );
143
+ }
144
+
145
+ private applyResponseFilter( text: string ) {
146
+ return ( this.responseFilter && this.responseFilter( text ) ) || text;
147
+ }
148
+
149
+ private applyResponseHandler( text: string ) {
150
+ return !! this.responseHandler && this.responseHandler( text );
151
+ }
152
+ }
@@ -0,0 +1,80 @@
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 "../bases";
9
+ import { ControllerAlreadySet, ForceMethodImplementation } from "../errors";
10
+ import { createLogger } from "../modules/logger/create-logger";
11
+
12
+ import type { ControllerBase } from "../bases";
13
+
14
+ import type { ICommandArgsInterface, ICommandOptionsInterface, ILogger } from "../interfaces";
15
+
16
+ export abstract class CommandBase extends ObjectBase {
17
+ private static controller: ControllerBase;
18
+
19
+ protected args: ICommandArgsInterface = {};
20
+ protected options: ICommandOptionsInterface = {};
21
+
22
+ private readonly logger: ILogger;
23
+
24
+ public static getName() {
25
+ return "ZenFlux/Core/CommandBases/CommandBase";
26
+ }
27
+
28
+ public static setController( controller: ControllerBase ) {
29
+ if ( this.controller ) {
30
+ throw new ControllerAlreadySet( this.controller );
31
+ }
32
+
33
+ this.controller = controller;
34
+ }
35
+
36
+ public static getController() {
37
+ return this.controller;
38
+ }
39
+
40
+ public constructor( args: ICommandArgsInterface = {}, options = {} ) {
41
+ super();
42
+
43
+ const type = ( this.constructor as typeof CommandBase );
44
+
45
+ this.logger = createLogger( type );
46
+
47
+ this.logger.startsWith( this.constructor, { args, options } );
48
+
49
+ this.initialize( args, options );
50
+ }
51
+
52
+ protected initialize( args: ICommandArgsInterface, options: ICommandOptionsInterface ) {
53
+ this.args = args;
54
+ this.options = options;
55
+ }
56
+
57
+ /**
58
+ * TODO: Maybe abstract, currently not sure about parameters initialization.
59
+ */
60
+ protected apply( args = this.args, options = this.options ): any {// eslint-disable-line @typescript-eslint/no-unused-vars
61
+ throw new ForceMethodImplementation( this, "apply" );
62
+ }
63
+
64
+ protected onBeforeApply?():void;
65
+ protected onAfterApply?():void;
66
+
67
+ public async run() {
68
+ return this.runInternal();
69
+ }
70
+
71
+ private async runInternal() {
72
+ this.onBeforeApply && this.onBeforeApply();
73
+
74
+ const result = await this.apply( this.args, this.options );
75
+
76
+ this.onAfterApply && this.onAfterApply();
77
+
78
+ return result;
79
+ }
80
+ }
@@ -0,0 +1,11 @@
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
+
7
+ export class CommandInternal extends CommandBase {
8
+ public static getName() {
9
+ return "ZenFlux/Core/CommandBases/CommandInternal";
10
+ }
11
+ }
@@ -0,0 +1,12 @@
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
+
7
+ export class CommandPublic extends CommandBase {
8
+ public static getName() {
9
+ return "ZenFlux/Core/CommandBases/CommandPublic";
10
+ }
11
+ }
12
+
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @author Leonid Vinikov <leonidvinikov@gmail.com>
3
+ * @description Each rest command should represent a final REST endpoint.
4
+ */
5
+ import { CommandBase } from "./command-base";
6
+
7
+ import { ForceMethodImplementation } from "../errors";
8
+
9
+ import * as managers from "../managers/export";
10
+
11
+ export abstract class CommandRestful extends CommandBase {
12
+ public static getName() {
13
+ return "ZenFlux/Core/CommandBases/CommandRestful";
14
+ }
15
+
16
+ /**
17
+ * Override this method is required to determine endpoint and magic query params.
18
+ *
19
+ * @example
20
+ * ```
21
+ * args = { query: { id: 1 } };
22
+ * getEndpoint() = '/api/v1/users/{id}';
23
+ * result = '/api/v1/users/1';
24
+ * ```
25
+ */
26
+ public getEndpoint(): string {
27
+ throw new ForceMethodImplementation( this, "getEndpoint" );
28
+ }
29
+
30
+ protected apply( args = this.args, options = this.options ) {// eslint-disable-line @typescript-eslint/no-unused-vars
31
+ const endpoint = this.applyEndpointFormat( this.getEndpoint(), args );
32
+
33
+ return managers.restful.getClient().fetch(
34
+ endpoint, managers.restful.currentHttpMethod,
35
+ args || null
36
+ );
37
+ }
38
+
39
+ private applyEndpointFormat( endpoint: string, data: any = {} ): string {
40
+ // Replace query with `magic` placeholders.
41
+ if ( endpoint.includes( "{" ) ) {
42
+ endpoint = endpoint.split( "/" ).map( ( endpointPart ) => {
43
+ const match = endpointPart.match( "\\{(.*?)\\}" );
44
+
45
+ if ( match?.length && "undefined" !== typeof data[ match[ 1 ] ] ) {
46
+ return data[ match[ 1 ] ];
47
+ }
48
+
49
+ return endpointPart;
50
+ } ).join( "/" );
51
+ }
52
+
53
+ return endpoint;
54
+ }
55
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @author Leonid Vinikov <leonidvinikov@gmail.com>
3
+ */
4
+
5
+ export { CommandPublic } from "./command-public";
6
+ export { CommandRestful } from "./command-restful";
7
+ export { CommandBase } from "./command-base";
8
+ export { CommandInternal } from "./command-internal";
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @author Leonid Vinikov <leonidvinikov@gmail.com>
3
+ */
4
+ import type { CommandBase } from "../command-bases/command-base";
5
+
6
+ /**
7
+ * @internal
8
+ */
9
+ export class CommandAlreadyRegistered extends Error {
10
+ public constructor( command: typeof CommandBase ) {
11
+ super( `Command: '${ command.getName() }' is already registered` );
12
+ }
13
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @author Leonid Vinikov <leonidvinikov@gmail.com>
3
+ */
4
+
5
+ /**
6
+ * @internal
7
+ */
8
+ export class CommandNotFound extends Error {
9
+ public constructor( command: string ) {
10
+ super( `Command: '${ command }' is not found` );
11
+ }
12
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @author Leonid Vinikov <leonidvinikov@gmail.com>
3
+ */
4
+ import type { ControllerBase } from "../bases";
5
+
6
+ /**
7
+ * @internal
8
+ */
9
+ export class ControllerAlreadyRegistered extends Error {
10
+ public constructor( controller: ControllerBase ) {
11
+ super( `Controller: '${ controller.getName() }' is already registered` );
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @author Leonid Vinikov <leonidvinikov@gmail.com>
3
+ */
4
+ import type { ControllerBase } from "../bases";
5
+
6
+ /**
7
+ * @internal
8
+ */
9
+ export class ControllerAlreadySet extends Error {
10
+ public constructor( controller: ControllerBase ) {
11
+ super( `Controller: '${ controller.getName() }' is already set` );
12
+ }
13
+ }
@@ -0,0 +1,29 @@
1
+ export class ErrorWithMetadata extends Error {
2
+ public metadata: any;
3
+
4
+ public constructor( message: string, metadata: any | null = null ) {
5
+ super( message );
6
+ this.metadata = metadata;
7
+ const metaView = null !== metadata ? formatMetadata( metadata ) : null;
8
+
9
+ this.message = null !== metaView ? `${ message } - Metadata: ${ metaView }` : message;
10
+
11
+ Object.setPrototypeOf( this, new.target.prototype );
12
+ }
13
+ }
14
+
15
+ function formatMetadata( metadata: any ) {
16
+ try {
17
+ if ( metadata === null || metadata === undefined ) {
18
+ return String( metadata );
19
+ }
20
+
21
+ if ( typeof metadata === "object" ) {
22
+ return JSON.stringify( metadata );
23
+ }
24
+
25
+ return String( metadata );
26
+ } catch {
27
+ return "[unserializable metadata]";
28
+ }
29
+ }
@@ -0,0 +1,15 @@
1
+ import type { ObjectBase } from "../bases";
2
+
3
+ export class ForceMethodBase extends Error {
4
+ public constructor( className: string, methodName: string ) {
5
+ super( `ForceMethod implementation: at '${ className }' method: '${ methodName }'` );
6
+ }
7
+ }
8
+
9
+ export class ForceMethodImplementation extends Error {
10
+ public constructor( context: ObjectBase | typeof ObjectBase | string, methodName: string ) {
11
+ super(
12
+ `ForceMethod implementation: at '${ "string" === typeof context ? context : context.getName() }' method: '${ methodName }'`
13
+ );
14
+ }
15
+ }
@@ -0,0 +1 @@
1
+ export { ForceMethodImplementation } from "./force-method-implementation";
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @author Leonid Vinikov <leonidvinikov@gmail.com>
3
+ */
4
+
5
+ export { CommandAlreadyRegistered } from "./command-already-registered";
6
+ export { CommandNotFound } from "./command-not-found";
7
+ export { ControllerAlreadyRegistered } from "./controller-already-registered";
8
+ export { ControllerAlreadySet } from "./controller-already-set";
9
+ export { ForceMethodImplementation, ForceMethodBase } from "./force-method-implementation";
10
+ export { ErrorWithMetadata } from "./error-with-metadata";
@@ -0,0 +1,15 @@
1
+ import * as bases from "./bases";
2
+ import * as commandBases from "./command-bases";
3
+ import * as errors from "./errors/index-public";
4
+ import * as interfaces from "./interfaces";
5
+ import * as managers from "./managers/export";
6
+ import * as modules from "./modules/export";
7
+
8
+ export {
9
+ bases,
10
+ commandBases,
11
+ errors,
12
+ interfaces,
13
+ managers,
14
+ modules,
15
+ };
package/src/exports.ts ADDED
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @author Leonid Vinikov <leonidvinikov@gmail.com>
3
+ */
4
+ // @ts-ignore - TODO handle error in jest
5
+ import { bases, commandBases, errors, interfaces, managers, modules } from "./exports-index";
6
+
7
+ import { Logger } from "./modules/logger";
8
+
9
+ import * as pkg from "../package.json" assert { type: "json" };
10
+
11
+ declare global {
12
+ var __ZEN_CORE__IS_INITIALIZED__: boolean;
13
+ }
14
+
15
+ // @deprecated
16
+ export const classes = {
17
+ Logger,
18
+ };
19
+
20
+ let exportedConfig: interfaces.IAPIConfig = {
21
+ version: pkg.version,
22
+ };
23
+
24
+ export function initialize( config?: Partial<interfaces.IAPIConfig> ) {
25
+ if ( "undefined" !== typeof __ZEN_CORE__IS_INITIALIZED__ && __ZEN_CORE__IS_INITIALIZED__ ) {
26
+ throw new Error( "ZenCore is already initialized." );
27
+ }
28
+
29
+ exportedConfig = ( config || exportedConfig ) as interfaces.IAPIConfig;
30
+
31
+ managers.initialize( exportedConfig );
32
+
33
+ globalThis.__ZEN_CORE__IS_INITIALIZED__ = true;
34
+ }
35
+
36
+ export function destroy() {
37
+ managers.destroy();
38
+
39
+ globalThis.__ZEN_CORE__IS_INITIALIZED__ = false;
40
+ }
41
+
42
+ export function onAfterInitialize( callback: () => void ) {
43
+ managers.afterInitializeCallbacks.push( callback );
44
+ }
45
+
46
+ export const config = exportedConfig;
47
+
48
+ export {
49
+ bases,
50
+ commandBases,
51
+ errors,
52
+ interfaces,
53
+ managers,
54
+ modules
55
+ };
package/src/index.ts ADDED
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @author Leonid Vinikov <leonidvinikov@gmail.com>
3
+ */
4
+
5
+ import * as ZenCore from "./exports";
6
+
7
+ // TODO: Only in development mode
8
+ if ( ! globalThis?.zCore ) {
9
+ globalThis.zCore = ZenCore;
10
+ }
11
+
12
+ declare global {
13
+ var zCore: typeof ZenCore;
14
+ }
15
+
16
+ export * from "./exports-index";
17
+
18
+ export default ZenCore;
@@ -0,0 +1,17 @@
1
+ export type TCommandCallbackType = ( args?: any, options?: any ) => any;
2
+
3
+ export interface ICommandArgsInterface {
4
+ [ key: string ]: any;
5
+ }
6
+
7
+ export interface ICommandOptionsInterface {
8
+ [ key: string ]: any;
9
+ }
10
+
11
+ export interface IOnHookAffectInterface {
12
+ [ key: string ]: Array<string>;
13
+ }
14
+
15
+ export interface IOnHookInterface {
16
+ [ key: string ]: Array<TCommandCallbackType>;
17
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @author Leonid Vinikov <leonidvinikov@gmail.com>
3
+ */
4
+
5
+ /**
6
+ *
7
+ */
8
+ export interface IAPIConfig {
9
+ /**
10
+ * @description API version, from `package.json`
11
+ */
12
+ version: string;
13
+
14
+ /**
15
+ * @description API base url for http requests.
16
+ */
17
+ baseURL?: string;
18
+
19
+ /**
20
+ * @description Request Init for fetch API.
21
+ */
22
+ requestInit?: RequestInit;
23
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @author Leonid Vinikov <leonidvinikov@gmail.com>
3
+ */
4
+
5
+ export type * from "./commands";
6
+ export type * from "./config";
7
+ export type * from "./logger";
8
+ export * from "./restful";
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @author Leonid Vinikov <leonidvinikov@gmail.com>
3
+ */
4
+ export type TCaller = string | Function;
5
+
6
+ export interface ILogger {
7
+ log( caller: TCaller, message: string, ...params: any[] ): void;
8
+ warn( caller: TCaller, message: string, ...params: any[] ): void;
9
+ error( caller: TCaller, message: string, ...params: any[] ): void;
10
+ info( caller: TCaller, message: string, ...params: any[] ): void;
11
+ debug( caller: TCaller, message: string, ...params: any[] ): void;
12
+ addMessagePrefix( prefix: string ): void;
13
+
14
+ startsEmpty( caller: TCaller ): void;
15
+ startsWith( caller: TCaller, params: object | string ): void;
16
+
17
+ dump( caller: TCaller, params: { [ key: string ]: object|string }, notice?: string ): void;
18
+ drop( caller: TCaller, according: { [ key: string ]: string }, data: any ): void;
19
+ }
@@ -0,0 +1,23 @@
1
+ export type TErrorHandlerCallbackType = ( data: any ) => boolean;
2
+
3
+ export type TResponseFilterCallbackType = ( text: string ) => string;
4
+
5
+ export type TResponseHandlerCallbackType = ( text: string ) => boolean;
6
+
7
+ export type TPossibleHandlersType = TErrorHandlerCallbackType | TResponseFilterCallbackType | TResponseHandlerCallbackType;
8
+
9
+ export enum E_RESPONSE_HANDLER_TYPE {
10
+ ERROR_HANDLER = "error_handler",
11
+ RESPONSE_FILTER = "response_filter",
12
+ RESPONSE_HANDLER = "response_handler",
13
+ };
14
+
15
+ export enum E_HTTP_METHOD_TYPE {
16
+ DELETE = "DELETE", // Delete.
17
+ GET = "GET", // Read.
18
+ OPTIONS = "OPTIONS",// Options about the request
19
+ PATCH = "PATCH", // Update/Modify.
20
+ POST = "POST", // Create.
21
+ PUT = "PUT", // Update/Replace.
22
+ "__EMPTY__" = ""
23
+ };