@zenflux/core
Advanced tools
Comparing version 0.0.1-dev.3 to 0.1.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" | ||
"name": "@zenflux/core", | ||
"version": "0.1.0", | ||
"types": "dist/zenflux-core.d.ts", | ||
"type": "module", | ||
"files": [ | ||
"dist", | ||
"src", | ||
"types" | ||
], | ||
"scripts": { | ||
"@z-core--test": "jest", | ||
"@z-core--build": "@z-cli @build", | ||
"@z-core--dev": "@z-cli @watch --dev" | ||
}, | ||
"exports": { | ||
".": { | ||
"import": "./dist/zenflux-core.es.js", | ||
"default": "./dist/zenflux-core.es.js", | ||
"require": "./dist/zenflux-core.cjs.js", | ||
"types": "./dist/zenflux-core.d.ts" | ||
}, | ||
"devDependencies": { | ||
"@zenflux/cli": "workspace:*" | ||
}, | ||
"exports": { | ||
".": { | ||
"import": "./dist/es/zenflux-core.js", | ||
"default": "./dist/es/zenflux-core.js" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} | ||
"./package.json": "./package.json" | ||
}, | ||
"devDependencies": { | ||
"@zenflux/cli": "0.1.0" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
@@ -9,8 +9,8 @@ /** | ||
import { CommandPublic } from "@z-core/command-bases/command-public"; | ||
import { CommandRestful } from "@z-core/command-bases/command-restful"; | ||
import { CommandInternal } from "@z-core/command-bases/command-internal"; | ||
import * as managers from "@z-core/managers/export"; | ||
import type { CommandPublic } from "@z-core/command-bases/command-public"; | ||
import type { CommandRestful } from "@z-core/command-bases/command-restful"; | ||
import type { CommandInternal } from "@z-core/command-bases/command-internal"; | ||
// noinspection TypeScriptAbstractClassConstructorCanBeMadeProtected | ||
@@ -17,0 +17,0 @@ |
@@ -6,15 +6,13 @@ /** | ||
*/ | ||
import { E_HTTP_METHOD_TYPE } from "@z-core/interfaces"; | ||
import { | ||
E_HTTP_METHOD_TYPE, | ||
import { ObjectBase } from "@z-core/bases/object-base"; | ||
import type { | ||
ILogger, | ||
TErrorHandlerCallbackType, | ||
TResponseFilterCallbackType, | ||
TResponseHandlerCallbackType, | ||
TResponseHandlerCallbackType | ||
} from "@z-core/interfaces"; | ||
import { ObjectBase } from "@z-core/bases/object-base"; | ||
// noinspection ExceptionCaughtLocallyJS | ||
@@ -41,3 +39,3 @@ | ||
this.logger = new ZenCore.classes.Logger( Http ); | ||
this.logger = new zCore.classes.Logger( Http ); | ||
@@ -44,0 +42,0 @@ this.logger.startsWith( this.constructor, { apiBaseUrl } ); |
@@ -8,7 +8,9 @@ /** | ||
*/ | ||
import { ControllerBase, ObjectBase } from "@z-core/bases"; | ||
import { ObjectBase } from "@z-core/bases"; | ||
import { ControllerAlreadySet, ForceMethodImplementation } from "@z-core/errors"; | ||
import { ICommandArgsInterface, ICommandOptionsInterface, ILogger } from "@z-core/interfaces"; | ||
import type { ControllerBase} from "@z-core/bases"; | ||
import type { ICommandArgsInterface, ICommandOptionsInterface, ILogger } from "@z-core/interfaces"; | ||
export abstract class CommandBase extends ObjectBase { | ||
@@ -43,3 +45,3 @@ private static controller: ControllerBase; | ||
this.logger = new ZenCore.classes.Logger( type, { | ||
this.logger = new zCore.classes.Logger( type, { | ||
// Happens or occurs many times, often in a similar or identical manner. | ||
@@ -46,0 +48,0 @@ repeatedly: true, |
/** | ||
* @author Leonid Vinikov <leonidvinikov@gmail.com> | ||
*/ | ||
import { CommandBase } from "@z-core/command-bases/command-base"; | ||
import type { CommandBase } from "@z-core/command-bases/command-base"; | ||
@@ -6,0 +6,0 @@ /** |
/** | ||
* @author Leonid Vinikov <leonidvinikov@gmail.com> | ||
*/ | ||
import { ControllerBase } from "@z-core/bases"; | ||
import type { ControllerBase } from "@z-core/bases"; | ||
@@ -6,0 +6,0 @@ /** |
/** | ||
* @author Leonid Vinikov <leonidvinikov@gmail.com> | ||
*/ | ||
import { ControllerBase } from "@z-core/bases"; | ||
import type { ControllerBase } from "@z-core/bases"; | ||
@@ -6,0 +6,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
import { ObjectBase } from "@z-core/bases"; | ||
import type { ObjectBase } from "@z-core/bases"; | ||
@@ -3,0 +3,0 @@ /** |
/** | ||
* @author Leonid Vinikov <leonidvinikov@gmail.com> | ||
*/ | ||
// @ts-ignore - TODO handle error in jest | ||
import * as pkg from "../package.json" assert { type: "json" }; | ||
/** | ||
* 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 { bases, commandBases, errors, interfaces, managers, } from "@z-core/exports-index"; | ||
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"; | ||
declare global { | ||
var __ZEN_CORE__IS_INITIALIZED__: boolean; | ||
} | ||
import { ILogger, TCaller } from "@z-core/interfaces"; | ||
export const classes = { | ||
@@ -27,13 +17,15 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ | ||
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 ) {} | ||
Logger: class NullLogger implements interfaces.ILogger { | ||
constructor( owner: typeof bases.ObjectBase, params: any = {} ) { | ||
} | ||
log( caller: interfaces.TCaller, message: string, ... params: any[] ) {} | ||
warn( caller: interfaces.TCaller, message: string, ... params: any[] ) {} | ||
error( caller: interfaces.TCaller, message: string, ... params: any[] ) {} | ||
info( caller: interfaces.TCaller, message: string, ... params: any[] ) {} | ||
debug( caller: interfaces.TCaller, message: string, ... params: any[] ) {} | ||
startsEmpty( caller: interfaces.TCaller ) {} | ||
startsWith( caller: interfaces.TCaller, params: object ) {} | ||
dump( caller: interfaces.TCaller, data: any ) {} | ||
drop( caller: interfaces.TCaller, according: { [ key: string ]: string }, data: any ) {} | ||
} | ||
@@ -44,2 +36,30 @@ | ||
let exportedConfig: interfaces.IAPIConfig = { | ||
version: pkg.version, | ||
}; | ||
export function initialize( config?: Partial<interfaces.IAPIConfig> ) { | ||
if ( "undefined" !== typeof __ZEN_CORE__IS_INITIALIZED__ && __ZEN_CORE__IS_INITIALIZED__ ) { | ||
throw new Error( "ZenCore is already initialized." ); | ||
} | ||
exportedConfig = ( config || exportedConfig ) as interfaces.IAPIConfig; | ||
managers.initialize( exportedConfig ); | ||
globalThis.__ZEN_CORE__IS_INITIALIZED__ = true; | ||
} | ||
export function destroy() { | ||
managers.destroy(); | ||
globalThis.__ZEN_CORE__IS_INITIALIZED__ = false; | ||
} | ||
export function onAfterInitialize( callback: () => void ) { | ||
managers.afterInitializeCallbacks.push( callback ); | ||
} | ||
export const config = exportedConfig; | ||
export { | ||
@@ -46,0 +66,0 @@ bases, |
/** | ||
* @author Leonid Vinikov <leonidvinikov@gmail.com> | ||
*/ | ||
export { CoreAPI as default } from "@z-core/initializer"; | ||
import * as ZenCore from "@z-core/exports"; | ||
export * from "@z-core/exports"; | ||
// TODO: Only in development mode | ||
if ( ! globalThis?.zCore ) { | ||
globalThis.zCore = ZenCore; | ||
} | ||
declare global { | ||
var zCore: typeof ZenCore; | ||
} | ||
export * from "@z-core/exports-index"; | ||
export default ZenCore; |
@@ -5,12 +5,8 @@ /** | ||
*/ | ||
// import ZenCore from "@zenflux/core"; | ||
import { ObjectBase } from "@z-core/bases/object-base"; | ||
import { ControllerBase } from "@z-core/bases/controller-base"; | ||
import { CommandBase } from "@z-core/command-bases"; | ||
import { CommandNotFound } from "@z-core/errors/command-not-found"; | ||
import { CommandAlreadyRegistered } from "@z-core/errors/command-already-registered"; | ||
import { CommandAlreadyRegistered, CommandNotFound } from "@z-core/errors"; | ||
import { | ||
import type { | ||
TCommandCallbackType, | ||
@@ -27,2 +23,5 @@ | ||
import type { ControllerBase } from "@z-core/bases/controller-base"; | ||
import type { CommandBase } from "@z-core/command-bases/command-base"; | ||
export class Commands extends ObjectBase { | ||
@@ -79,3 +78,3 @@ public static readonly trace:string[] = []; | ||
this.logger = new ZenCore.classes.Logger( type ); | ||
this.logger = new zCore.classes.Logger( type ); | ||
this.logger.startsEmpty( this.constructor ); | ||
@@ -82,0 +81,0 @@ } |
@@ -5,6 +5,7 @@ /** | ||
*/ | ||
import { ControllerAlreadyRegistered } from "@z-core/errors/controller-already-registered"; | ||
import { ObjectBase } from "@z-core/bases/object-base"; | ||
import { ControllerBase } from "@z-core/bases/controller-base"; | ||
import { ControllerAlreadyRegistered } from "@z-core/errors/controller-already-registered"; | ||
import type { ControllerBase } from "@z-core/bases/controller-base"; | ||
@@ -11,0 +12,0 @@ export class Controllers extends ObjectBase { |
@@ -9,3 +9,3 @@ /** | ||
import { IAPIConfig } from "@z-core/interfaces"; | ||
import type { IAPIConfig } from "@z-core/interfaces"; | ||
@@ -12,0 +12,0 @@ export const afterInitializeCallbacks: ( () => void )[] = []; |
@@ -7,7 +7,12 @@ /** | ||
import { CommandRestful } from "@z-core/command-bases"; | ||
import { Http } from "@z-core/clients/http"; | ||
import { | ||
E_RESPONSE_HANDLER_TYPE, | ||
E_HTTP_METHOD_TYPE | ||
} from "@z-core/interfaces"; | ||
import type { CommandRestful } from "@z-core/command-bases"; | ||
import type { | ||
IAPIConfig, | ||
@@ -20,6 +25,3 @@ ICommandArgsInterface, | ||
TResponseFilterCallbackType, | ||
TResponseHandlerCallbackType, | ||
E_RESPONSE_HANDLER_TYPE, | ||
E_HTTP_METHOD_TYPE | ||
TResponseHandlerCallbackType | ||
} from "@z-core/interfaces"; | ||
@@ -26,0 +28,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
39011
31
990