@zenflux/core
Advanced tools
Comparing version 0.0.1-dev.2 to 0.0.1-dev.3
{ | ||
"name": "@zenflux/core", | ||
"version": "0.0.1-dev.2", | ||
"description": "ZenFlux core", | ||
"keywords": [ | ||
"zenflux", | ||
"zen", | ||
"flux", | ||
"commands", | ||
"manager", | ||
"commands manager", | ||
"core", | ||
"zenflux-core" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/zenflux/core.git" | ||
}, | ||
"license": "MIT", | ||
"author": "Leonid Vinikov <leonidvinikov@gmail.com> (https://github.com/iNewLegend)", | ||
"main": "dist/cjs/zenflux-core.js", | ||
"unpkg": "dist/umd/zenflux-core.js", | ||
"module": "dist/es/zenflux-core.js", | ||
"types": "types/index.d.ts", | ||
"files": [ | ||
"dist", | ||
"src", | ||
"types" | ||
], | ||
"scripts": { | ||
"test": "export flow_modules_logger=off && jest", | ||
"toolkit-build": "node_modules/@zenflux/rollup-toolkit/bin/run @build", | ||
"toolkit-build-dev": "node_modules/@zenflux/rollup-toolkit/bin/dev @build", | ||
"toolkit-watch": "node_modules/@zenflux/rollup-toolkit/bin/run @watch", | ||
"toolkit-watch-dev": "node_modules/@zenflux/rollup-toolkit/bin/dev @watch" | ||
}, | ||
"devDependencies": { | ||
"@babel/plugin-syntax-import-assertions": "^7.20.0", | ||
"@babel/preset-env": "^7.20.2", | ||
"@babel/preset-typescript": "^7.18.6", | ||
"@types/jest": "^29.4.0", | ||
"@typescript-eslint/eslint-plugin": "^5.50.0", | ||
"@typescript-eslint/parser": "^5.50.0", | ||
"@zenflux/rollup-toolkit": "^0.0.0-alpha.15", | ||
"babel-jest": "^29.4.1", | ||
"ts-jest": "^29.0.5", | ||
"tslib": "^2.5.0" | ||
} | ||
"name": "@zenflux/core", | ||
"version": "0.0.1-dev.3", | ||
"module": "dist/es/zenflux-core.js", | ||
"types": "dist/es/zenflux-core.d.ts", | ||
"type": "module", | ||
"files": [ | ||
"dist", | ||
"src", | ||
"types" | ||
], | ||
"scripts": { | ||
"@z-core--test": "jest", | ||
"@z-core--build": "@zenflux-cli @build", | ||
"@z-core--dev": "@zenflux-cli:dev @watch", | ||
"@z-core--d-rollup": "api-extractor run --local" | ||
}, | ||
"devDependencies": { | ||
"@zenflux/cli": "workspace:*" | ||
}, | ||
"exports": { | ||
".": { | ||
"import": "./dist/es/zenflux-core.js", | ||
"default": "./dist/es/zenflux-core.js" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
/** | ||
* @author: Leonid Vinikov <leonidvinikov@gmail.com> | ||
* @description: Providing a simple wrapper for fetch API. | ||
* The `Http` class provides a simple wrapper for the Fetch API. | ||
* | ||
* @author Leonid Vinikov <leonidvinikov@gmail.com> | ||
*/ | ||
import ObjectBase from "../core/object-base"; | ||
import Logger from '../modules/logger'; | ||
import { | ||
E_HTTP_METHOD_TYPE, | ||
ILogger, | ||
TErrorHandlerCallbackType, | ||
TResponseFilterCallbackType, | ||
TResponseHandlerCallbackType, | ||
} from "../interfaces/"; | ||
} from "@z-core/interfaces"; | ||
import { ObjectBase } from "@z-core/bases/object-base"; | ||
// noinspection ExceptionCaughtLocallyJS | ||
export class Http extends ObjectBase { | ||
private readonly logger: Logger; | ||
private readonly logger: ILogger; | ||
private readonly apiBaseUrl: string; | ||
private readonly requestInit: RequestInit; | ||
@@ -29,18 +30,17 @@ | ||
static getName() { | ||
return 'Core/Clients/Http'; | ||
public static getName(): string { | ||
return "ZenFlux/Core/Clients/Http"; | ||
} | ||
/** | ||
* Function constructor() : Create the http. | ||
* Initializes the base class and sets up configuration parameters. | ||
*/ | ||
constructor( apiBaseUrl = 'http://localhost', requestInit: RequestInit = { 'credentials': 'include' } ) { | ||
public constructor( apiBaseUrl = "http://localhost", requestInit: RequestInit = { "credentials": "include" } ) { | ||
super(); | ||
this.logger = new Logger( Http.getName(), true ); | ||
this.logger = new ZenCore.classes.Logger( Http ); | ||
this.logger.startWith( { apiBaseUrl } ); | ||
this.logger.startsWith( this.constructor, { apiBaseUrl } ); | ||
this.apiBaseUrl = apiBaseUrl + '/'; | ||
this.apiBaseUrl = apiBaseUrl + "/"; | ||
this.requestInit = requestInit; | ||
@@ -50,9 +50,9 @@ } | ||
/** | ||
* Function fetch() : Fetch api. | ||
* Fetches data from the specified path using the given HTTP method and optional request body. | ||
*/ | ||
async fetch( path: string, method: E_HTTP_METHOD_TYPE, body: any = {} ) { | ||
this.logger.startWith( { path, method, body } ); | ||
public async fetch( path: string, method: E_HTTP_METHOD_TYPE, body: any = {} ) { | ||
this.logger.startsWith( this.constructor, { path, method, body } ); | ||
const params = Object.assign( {}, this.requestInit ), | ||
headers = {}; | ||
const params = Object.assign( {}, this.requestInit ); | ||
const headers = {}; | ||
@@ -62,12 +62,18 @@ if ( method === E_HTTP_METHOD_TYPE.GET ) { | ||
} else { | ||
Object.assign( headers, { 'Content-Type': 'application/json' } ); | ||
Object.assign( headers, { "Content-Type": "application/json" } ); | ||
Object.assign( params, { | ||
method, | ||
headers: headers, | ||
body: JSON.stringify( body ) | ||
body: JSON.stringify( body ), | ||
} ); | ||
} | ||
const response = await globalThis.fetch( this.apiBaseUrl + path, params ); | ||
const fetchPromise = globalThis.fetch( this.apiBaseUrl + path, params ); | ||
let response = await fetchPromise; | ||
if ( ! response ) { | ||
return false; | ||
} | ||
let data = undefined; | ||
@@ -77,3 +83,3 @@ | ||
if ( ! response.ok ) { | ||
throw response; | ||
throw new Error( response.statusText ); | ||
} | ||
@@ -86,3 +92,3 @@ | ||
// TODO: Currently support JSON and plain text. | ||
if ( response.headers?.get( 'Content-Type' )?.includes( 'application/json' ) ) { | ||
if ( response.headers?.get( "Content-Type" )?.includes( "application/json" ) ) { | ||
data = JSON.parse( responseText ); | ||
@@ -104,3 +110,3 @@ } else { | ||
this.logger.drop( { path }, data ); | ||
this.logger.drop( this.fetch, { path }, data ); | ||
@@ -110,5 +116,8 @@ return data; | ||
/** | ||
* Sets the error handler callback for handling errors during fetch requests. | ||
*/ | ||
public setErrorHandler( callback: TErrorHandlerCallbackType ) { | ||
if ( this.errorHandler ) { | ||
throw new Error( 'Error handler already set.' ); | ||
throw new Error( "Error handler already set." ); | ||
} | ||
@@ -119,5 +128,8 @@ | ||
/** | ||
* Sets the response filter callback for filtering the response text. | ||
*/ | ||
public setResponseFilter( callback: TResponseFilterCallbackType ) { | ||
if ( this.responseFilter ) { | ||
throw new Error( 'Response filter already set.' ); | ||
throw new Error( "Response filter already set." ); | ||
} | ||
@@ -128,5 +140,8 @@ | ||
/** | ||
* Sets the response handler callback for handling the response data. | ||
*/ | ||
public setResponseHandler( callback: TResponseHandlerCallbackType ) { | ||
if ( this.responseHandler ) { | ||
throw new Error( 'Response handler already set.' ); | ||
throw new Error( "Response handler already set." ); | ||
} | ||
@@ -138,3 +153,3 @@ | ||
private applyErrorHandler( error: any ) { | ||
return this.errorHandler && this.errorHandler( error ); | ||
return !! this.errorHandler && this.errorHandler( error ); | ||
} | ||
@@ -147,6 +162,4 @@ | ||
private applyResponseHandler( text: string ) { | ||
return this.responseHandler && this.responseHandler( text ); | ||
return !! this.responseHandler && this.responseHandler( text ); | ||
} | ||
} | ||
export default Http; |
/** | ||
* @author: Leonid Vinikov <leonidvinikov@gmail.com> | ||
* @description: Base for all commands, they are all will be managed by the `Commands` managers. | ||
* @TODO | ||
* @author Leonid Vinikov <leonidvinikov@gmail.com> | ||
* @description Base for all commands, they are all will be managed by the `Commands` managers. | ||
* | ||
* TODO | ||
* - Add validateArgs method or find something better. | ||
*/ | ||
import ObjectBase from "../core/object-base"; | ||
import Controller from "../core/controller"; | ||
import { ControllerBase, ObjectBase } from "@z-core/bases"; | ||
import { ControllerAlreadySet, ForceMethodImplementation } from "@z-core/errors"; | ||
import ForceMethod from "../errors/force-method"; | ||
import { ICommandArgsInterface, ICommandOptionsInterface, ILogger } from "@z-core/interfaces"; | ||
import Logger from "../modules/logger"; | ||
import { ControllerAlreadySet } from "../errors"; | ||
import { ICommandArgsInterface, ICommandOptionsInterface } from "../interfaces/"; | ||
export abstract class CommandBase extends ObjectBase { | ||
private static controller: Controller; | ||
private static controller: ControllerBase; | ||
@@ -24,7 +19,11 @@ protected args: ICommandArgsInterface = {}; | ||
private readonly logger: Logger; | ||
private readonly logger: ILogger; | ||
public static setController( controller: Controller ) { | ||
public static getName() { | ||
return "ZenFlux/Core/CommandBases/CommandBase"; | ||
} | ||
public static setController( controller: ControllerBase ) { | ||
if ( this.controller ) { | ||
throw new ControllerAlreadySet(); | ||
throw new ControllerAlreadySet( this.controller ); | ||
} | ||
@@ -39,12 +38,13 @@ | ||
constructor( args: ICommandArgsInterface = {}, options = {} ) { | ||
public constructor( args: ICommandArgsInterface = {}, options = {} ) { | ||
super(); | ||
const name = ( this.constructor as typeof CommandBase ).getName(); | ||
const type = ( this.constructor as typeof CommandBase ); | ||
this.logger = new Logger( name, true, { | ||
sameColor: true, | ||
this.logger = new ZenCore.classes.Logger( type, { | ||
// Happens or occurs many times, often in a similar or identical manner. | ||
repeatedly: true, | ||
} ); | ||
this.logger.startWith( { args, options } ); | ||
this.logger.startsWith( this.constructor, { args, options } ); | ||
@@ -54,3 +54,3 @@ this.initialize( args, options ); | ||
public initialize( args: ICommandArgsInterface, options: ICommandOptionsInterface ) { | ||
protected initialize( args: ICommandArgsInterface, options: ICommandOptionsInterface ) { | ||
this.args = args; | ||
@@ -60,7 +60,17 @@ this.options = options; | ||
public apply( args = this.args, options = this.options ): any {// eslint-disable-line @typescript-eslint/no-unused-vars | ||
throw new ForceMethod( this, "apply" ); | ||
/** | ||
* TODO: Maybe abstract, currently not sure about parameters initialization. | ||
*/ | ||
protected apply( args = this.args, options = this.options ): any {// eslint-disable-line @typescript-eslint/no-unused-vars | ||
throw new ForceMethodImplementation( this, "apply" ); | ||
} | ||
protected onBeforeApply?():void; | ||
protected onAfterApply?():void; | ||
public async run() { | ||
return this.runInternal(); | ||
} | ||
private async runInternal() { | ||
this.onBeforeApply && this.onBeforeApply(); | ||
@@ -74,16 +84,2 @@ | ||
} | ||
public getArgs() { | ||
return this.args; | ||
} | ||
public getOptions() { | ||
return this.options; | ||
} | ||
public onBeforeApply?():void; | ||
public onAfterApply?():void; | ||
} | ||
export default CommandBase; |
/** | ||
* @author: Leonid Vinikov <leonidvinikov@gmail.com> | ||
* @description: CommandInternal, is used when part of the logic needed to be in the command but not represent a user action. | ||
* @author Leonid Vinikov <leonidvinikov@gmail.com> | ||
* @description CommandInternal, is used when part of the logic needed to be in the command but not represent a user action. | ||
*/ | ||
import CommandBase from "./command-base"; | ||
import { CommandBase } from "@z-core/command-bases/command-base"; | ||
export class CommandInternal extends CommandBase { | ||
static getName() { | ||
return 'Core/CommandBases/CommandInternal'; | ||
public static getName() { | ||
return "ZenFlux/Core/CommandBases/CommandInternal"; | ||
} | ||
} | ||
export default CommandInternal; |
/** | ||
* @author: Leonid Vinikov <leonidvinikov@gmail.com> | ||
* @description: CommandPublic represents a USER action, every class which inherit from this class will USER action. | ||
* @author Leonid Vinikov <leonidvinikov@gmail.com> | ||
* @description CommandPublic represents a USER action, every class which inherit from this class will USER action. | ||
* */ | ||
import CommandBase from "./command-base"; | ||
import { CommandBase } from "@z-core/command-bases/command-base"; | ||
export class CommandPublic extends CommandBase { | ||
static getName() { | ||
return 'Core/CommandBases/CommandPublic'; | ||
public static getName() { | ||
return "ZenFlux/Core/CommandBases/CommandPublic"; | ||
} | ||
} | ||
export default CommandPublic; |
/** | ||
* @author: Leonid Vinikov <leonidvinikov@gmail.com> | ||
* @author Leonid Vinikov <leonidvinikov@gmail.com> | ||
*/ | ||
export { CommandPublic } from "./command-public"; | ||
export { CommandData } from "./command-data"; | ||
export { CommandBase } from "./command-base"; | ||
export { CommandInternal } from "./command-internal"; | ||
export { CommandPublic } from "@z-core/command-bases/command-public"; | ||
export { CommandRestful } from "@z-core/command-bases/command-restful"; | ||
export { CommandBase } from "@z-core/command-bases/command-base"; | ||
export { CommandInternal } from "@z-core/command-bases/command-internal"; |
/** | ||
* @author: Leonid Vinikov <leonidvinikov@gmail.com> | ||
* @author Leonid Vinikov <leonidvinikov@gmail.com> | ||
*/ | ||
import CommandBase from "../command-bases/command-base"; | ||
import { CommandBase } from "@z-core/command-bases/command-base"; | ||
/** | ||
* @internal | ||
*/ | ||
export class CommandAlreadyRegistered extends Error { | ||
constructor( command: typeof CommandBase ) { | ||
public constructor( command: typeof CommandBase ) { | ||
super( `Command: '${ command.getName() }' is already registered` ); | ||
} | ||
} | ||
export default CommandAlreadyRegistered; |
/** | ||
* @author: Leonid Vinikov <leonidvinikov@gmail.com> | ||
* @author Leonid Vinikov <leonidvinikov@gmail.com> | ||
*/ | ||
/** | ||
* @internal | ||
*/ | ||
export class CommandNotFound extends Error { | ||
constructor( command: string ) { | ||
public constructor( command: string ) { | ||
super( `Command: '${ command }' is not found` ); | ||
} | ||
} | ||
export default CommandNotFound; |
/** | ||
* @author: Leonid Vinikov <leonidvinikov@gmail.com> | ||
* @author Leonid Vinikov <leonidvinikov@gmail.com> | ||
*/ | ||
import Controller from "../core/controller"; | ||
import { ControllerBase } from "@z-core/bases"; | ||
/** | ||
* @internal | ||
*/ | ||
export class ControllerAlreadyRegistered extends Error { | ||
constructor( controller: Controller ) { | ||
public constructor( controller: ControllerBase ) { | ||
super( `Controller: '${ controller.getName() }' is already registered` ); | ||
} | ||
} | ||
export default ControllerAlreadyRegistered; |
/** | ||
* @author: Leonid Vinikov <leonidvinikov@gmail.com> | ||
* @author Leonid Vinikov <leonidvinikov@gmail.com> | ||
*/ | ||
import { ControllerBase } from "@z-core/bases"; | ||
/** | ||
* @internal | ||
*/ | ||
export class ControllerAlreadySet extends Error { | ||
constructor() { | ||
super( 'Controller already set.' ); | ||
public constructor( controller: ControllerBase ) { | ||
super( `Controller: '${ controller.getName() }' is already set` ); | ||
} | ||
} | ||
export default ControllerAlreadySet; |
@@ -1,5 +0,5 @@ | ||
export { CommandAlreadyRegistered } from "./command-already-registered"; | ||
export { CommandNotFound } from "./command-not-found"; | ||
export { ControllerAlreadyRegistered } from "./controller-already-registered"; | ||
export { ControllerAlreadySet } from './controller-already-set'; | ||
export { ForceMethod } from "./force-method"; | ||
export { CommandAlreadyRegistered } from "@z-core/errors/command-already-registered"; | ||
export { CommandNotFound } from "@z-core/errors/command-not-found"; | ||
export { ControllerAlreadyRegistered } from "@z-core/errors/controller-already-registered"; | ||
export { ControllerAlreadySet } from "@z-core/errors/controller-already-set"; | ||
export { ForceMethodImplementation } from "@z-core/errors/force-method-implementation"; |
/** | ||
* @author: Leonid Vinikov <leonidvinikov@gmail.com> | ||
* @author Leonid Vinikov <leonidvinikov@gmail.com> | ||
*/ | ||
export * as commandBases from "./command-bases"; | ||
export * as core from "./core"; | ||
export * as errors from "./errors"; | ||
export * as interfaces from "./interfaces"; | ||
export * as managers from "./managers"; | ||
export * as managerBases from "./manager-bases"; | ||
export * as modules from "./modules"; | ||
export * as utils from "./utils"; | ||
/** | ||
* api-extractor 7.97.1: ERROR: The "export * as ___" syntax is not supported yet; as a workaround, use "import * as ___" with a separate "export { ___ }" declaration | ||
* | ||
* export * as bases from "./bases"; | ||
* export * as commandBases from "./command-bases"; | ||
* export * as errors from "./errors"; | ||
* export * as interfaces from "./interfaces"; | ||
* export * as managers from "./managers/export"; | ||
*/ | ||
import * as bases from "@z-core/bases"; | ||
import * as commandBases from "@z-core/command-bases"; | ||
import * as errors from "@z-core/errors/index-public"; | ||
import * as interfaces from "@z-core/interfaces"; | ||
import * as managers from "@z-core/managers/export"; | ||
import { ILogger, TCaller } from "@z-core/interfaces"; | ||
export const classes = { | ||
/* eslint-disable @typescript-eslint/no-unused-vars */ | ||
/* eslint-disable @typescript-eslint/explicit-member-accessibility */ | ||
Logger: class NullLogger implements ILogger { | ||
constructor(owner: typeof bases.ObjectBase, params: any = {} ) {} | ||
log( caller: TCaller, message: string, ... params: any[] ) {} | ||
warn( caller: TCaller, message: string, ... params: any[] ) {} | ||
error( caller: TCaller, message: string, ... params: any[] ) {} | ||
info( caller: TCaller, message: string, ... params: any[] ) {} | ||
debug( caller: TCaller, message: string, ... params: any[] ) {} | ||
startsEmpty( caller: TCaller ) {} | ||
startsWith( caller: TCaller, params: object ) {} | ||
dump( caller: TCaller, data: any ) {} | ||
drop( caller: TCaller, according: { [ key: string ]: string }, data: any ) {} | ||
} | ||
/* eslint-enable */ | ||
}; | ||
export { | ||
bases, | ||
commandBases, | ||
errors, | ||
interfaces, | ||
managers | ||
}; |
/** | ||
* @author: Leonid Vinikov <leonidvinikov@gmail.com> | ||
* @author Leonid Vinikov <leonidvinikov@gmail.com> | ||
*/ | ||
export { CoreAPI as default } from "./initializer"; | ||
export { CoreAPI as default } from "@z-core/initializer"; | ||
export * from './exports'; | ||
export * from "@z-core/exports"; | ||
// @ts-ignore | ||
import * as pkg from "../package.json" assert { type: "json" }; | ||
import { IAPIConfig } from "./interfaces/config"; | ||
import { IAPIConfig } from "@z-core/interfaces"; | ||
import { destroy, initialize, afterInitializeCallbacks } from "./managers"; | ||
import { destroy, initialize, afterInitializeCallbacks } from "@z-core/managers/export"; | ||
import * as exported from './exports'; | ||
import * as exported from "@z-core/exports"; | ||
declare global { | ||
var ZenCore: any; | ||
var __ZEN_CORE__IS_INITIALIZED__: boolean; | ||
} | ||
function errorInitTwice() { | ||
if ( 'undefined' !== typeof __ZEN_CORE__IS_INITIALIZED__ && __ZEN_CORE__IS_INITIALIZED__) { | ||
throw new Error( 'ZenCore is already initialized.' ); | ||
if ( "undefined" !== typeof __ZEN_CORE__IS_INITIALIZED__ && __ZEN_CORE__IS_INITIALIZED__) { | ||
throw new Error( "ZenCore is already initialized." ); | ||
} | ||
@@ -28,6 +23,6 @@ } | ||
export const CoreAPI = { | ||
initialize: ( configuration?: IAPIConfig ) => { | ||
initialize: ( configuration?: Partial<IAPIConfig> ) => { | ||
errorInitTwice(); | ||
config = configuration || config; | ||
config = (configuration || config) as IAPIConfig; | ||
@@ -55,4 +50,9 @@ initialize( config ); | ||
// TODO: Make it available only for development. | ||
if ( ! globalThis?.ZenCore ) globalThis.ZenCore = CoreAPI; | ||
declare global { | ||
var ZenCore: typeof CoreAPI; | ||
var __ZEN_CORE__IS_INITIALIZED__: boolean; | ||
} | ||
// console.log( `ZenCore initialized, version: ${pkg.version}` ); |
@@ -1,2 +0,2 @@ | ||
export type CommandCallbackType = ( args?: any, options?: any ) => any; | ||
export type TCommandCallbackType = ( args?: any, options?: any ) => any; | ||
@@ -12,7 +12,7 @@ export interface ICommandArgsInterface { | ||
export interface IOnHookAffectInterface { | ||
[ key: string ]: Array<String>; | ||
[ key: string ]: Array<string>; | ||
} | ||
export interface IOnHookInterface { | ||
[ key: string ]: Array<CommandCallbackType>; | ||
[ key: string ]: Array<TCommandCallbackType>; | ||
} |
@@ -0,4 +1,11 @@ | ||
/** | ||
* @author Leonid Vinikov <leonidvinikov@gmail.com> | ||
*/ | ||
/** | ||
* | ||
*/ | ||
export interface IAPIConfig { | ||
/** | ||
* @description: API version, from `package.json` | ||
* @description API version, from `package.json` | ||
*/ | ||
@@ -8,3 +15,3 @@ version: string; | ||
/** | ||
* @description: API base url for http requests. | ||
* @description API base url for http requests. | ||
*/ | ||
@@ -14,5 +21,5 @@ baseURL?: string; | ||
/** | ||
* @description: Request Init for fetch API. | ||
* @description Request Init for fetch API. | ||
*/ | ||
requestInit?: RequestInit; | ||
} |
/** | ||
* @author: Leonid Vinikov <leonidvinikov@gmail.com> | ||
* @author Leonid Vinikov <leonidvinikov@gmail.com> | ||
*/ | ||
export * from './commands'; | ||
export * from './config'; | ||
export * from './data'; | ||
export * from './managers'; | ||
export * from './object-base'; | ||
export * from "@z-core/interfaces/commands"; | ||
export * from "@z-core/interfaces/config"; | ||
export * from "@z-core/interfaces/logger"; | ||
export * from "@z-core/interfaces/restful"; |
/** | ||
* @author: Leonid Vinikov <leonidvinikov@gmail.com> | ||
* @author Leonid Vinikov <leonidvinikov@gmail.com> | ||
*/ | ||
import Commands from "../manager-bases/commands"; | ||
import Controllers from "../manager-bases/controllers"; | ||
import Data from "../manager-bases/data"; | ||
import Internal from "../manager-bases/internal"; | ||
import { IAPIConfig } from "../interfaces/"; | ||
export const afterInitializeCallbacks: ( () => void )[] = []; | ||
export function initialize( config: IAPIConfig ) { | ||
commands = new Commands(); | ||
controllers = new Controllers(); | ||
data = new Data( config ); | ||
internal = new Internal(); | ||
} | ||
export function destroy() { | ||
commands = {} as Commands; | ||
controllers = {} as Controllers; | ||
data = {} as Data; | ||
internal = {} as Internal; | ||
} | ||
export var commands = {} as Commands; | ||
export var controllers = {} as Controllers; | ||
export var data = {} as Data; | ||
export var internal = {} as Internal; | ||
export { Commands } from "@z-core/managers/commands"; | ||
export { Controllers } from "@z-core/managers/controllers"; | ||
export { Restful } from "@z-core/managers/restful"; | ||
export { Internal } from "@z-core/managers/internal"; |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1
Yes
153420
94
1
3810
2
2
0
1