Socket
Socket
Sign inDemoInstall

@zenflux/core

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zenflux/core - npm Package Compare versions

Comparing version 0.0.0-alpha.0 to 0.0.0-alpha.1

1

dist/es/src/initializer.d.ts

@@ -1,2 +0,1 @@

import './globals';
import { IAPIConfig } from "./interfaces/config";

@@ -3,0 +2,0 @@ import * as exported from './exports';

@@ -9,3 +9,2 @@ /**

import { IAPIConfig } from "../interfaces/config";
import '../globals';
export declare const afterInitializeCallbacks: (() => void)[];

@@ -12,0 +11,0 @@ export declare function initialize(config: IAPIConfig): void;

@@ -1,12 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["@zenflux/core"]={})}(this,(function(t){"use strict";var e="0.0.0-abc.20";
/**
* Function getCircularReplacer() : Reduce circular references.
*
* @copyright https://stackoverflow.com/a/53731154
*/
const r=()=>{const t=new WeakSet;return(e,r)=>{if("object"==typeof r&&null!==r){if(t.has(r))return;t.add(r)}return r}},s=function(t,e){t=t.replace("#",""),e=e.replace("#","");const r=parseInt(t.substring(0,2),16),s=parseInt(t.substring(2,4),16),n=parseInt(t.substring(4,6),16),o=parseInt(e.substring(0,2),16),a=parseInt(e.substring(2,4),16),i=parseInt(e.substring(4,6),16);let c=255-Math.abs(r-o),l=255-Math.abs(s-a),h=255-Math.abs(n-i);return c/=255,l/=255,h/=255,(c+l+h)/3};
/**
* Function hexColorDelta() : Return color difference in ratio decimal point.
*
* @copyright http://jsfiddle.net/96sME/
*/var n=Object.freeze({__proto__:null,getCircularReplacer:r,hexColorDelta:s});class o{static wrappers={};static wrapperDepth=0;static sharedData={};static colorsInUse=[];defaultStyle;color;outputHandler;args={};name;state=!1;static getName(){return"Core/Modules/Logger"}static reset(){o.wrappers={},o.wrapperDepth=0,o.colorsInUse=[],o.sharedData={}}static createCustomWrapper(t,e){o.wrappers[t]||(o.wrappers[t.name]=[]),o.wrappers[t.name].push({classType:t,callback:e})}static getCallerName(){const t=Error(),e=t.stack?t.stack.split("\n")[3].trim():"_UNKNOWN_CALLER_NAME_";return e.startsWith("at new")?"constructor":e.split(".")[1].split(" ")[0]}static getFunctionView(t){let e="anonymous function()";return"string"!=typeof t&&0!==t.name.length&&(e=t.name.split(" ")[1]+"()"),e}constructor(t,e=!1,r={}){"off"!==globalThis.process?.env.flow_modules_logger&&(this.state=e,this.args=r,this.name="",this.name="string"==typeof t?t:t.constructor.name,e&&this.initialize())}initialize(){this.args.sameColor?(o.sharedData[this.name]||(o.sharedData[this.name]=this.getRandomColor()),this.color=o.sharedData[this.name]):(this.color=this.getRandomColor(),o.colorsInUse.push(this.color)),this.outputHandler=console.log,this.defaultStyle=["color: grey;font-size:7px","display: block","color: "+this.color,"color: grey","font-weight: bold","color: #607D8B","font-size: 16px;color: red;font-weight:800"]}setOutputHandler(t){this.outputHandler=t}useWrapper(t,e=!0){if(!t||"object"!=typeof t||Array.isArray(t))return t;o.wrapperDepth++;let r={...t};return Object.values(o.wrappers).forEach((([e])=>{t instanceof e.classType&&(r=e.callback(t)||r)})),4>o.wrapperDepth?(e&&r&&Object.entries(r).forEach((([t,e])=>{r[t]=this.useWrapper(e,!0)})),o.wrapperDepth--,r):(o.wrapperDepth--,r)}startEmpty(t=""){this.state&&this.printFunctionNotify("se",o.getCallerName(),t)}startWith(t){if(!this.state)return;t=Object.assign({},t);const e="se",r=o.getCallerName();if("string"==typeof t)this.printInLineString(e,r,t);else if(1===Object.keys(t).length){const s=Object.keys(t)[0];let n=Object.values(t)[0];"object"==typeof n?this.printNextLineObject(e,r,s,n||{}):"function"==typeof n?this.printInLineFunction(e,r,s,n):this.printInLineElement(e,r,s,n)}else this.printMultiLineObject(e,r,t)}object(t={},e=""){if(!this.state)return;const s=o.getCallerName();t=Object.create(t);for(let n in t)"object"==typeof t[n]&&(t[n]=JSON.stringify(this.useWrapper(t[n]),r())),this.out.apply(this,[`%c(ob)-> %c%c${this.name}%c::%c${s}%c() [${e}] ->> ${n}: '${t[n]}'%c`].concat(this.defaultStyle))}debug(t){this.state&&this.printFunctionNotify("db",o.getCallerName(),t)}drop(t,e){if(!this.state)return;const r=o.getCallerName();for(let e in t)this.out.apply(this,[`%c(dr)-> %c%c${this.name}%c::%c${r}%c() ->> corresponding ${e}: '${t[e]}' RESULT: %c↓`].concat(this.defaultStyle));this.out(e)}throw(t,e="null",r={}){throw this.printFunctionNotify("tw",o.getCallerName(),t),r&&this.printNextLineObject("tw",o.getCallerName(),e,r),Error().stack}clone(){return Object.assign(Object.create(Object.getPrototypeOf(this)),this)}printFunctionNotify(t,e,r){this.out.apply(this,[`%c(${t})-> %c%c${this.name}%c::%c${e}%c() ${r}%c`].concat(this.defaultStyle))}printInLineElement(t,e,r,s){this.out.apply(this,[`%c(${t})-> %c%c${this.name}%c::%c${e}%c() ->> ${r}: '${s}'%c`].concat(this.defaultStyle))}printInLineFunction(t,e,r,s){s=o.getFunctionView(s),this.printInLineElement(t,e,r,s)}printInLineString(t,e,r){this.printInLineElement(t,e,"(string)",r)}printNextLineObject(t,e,r,s){s=this.useWrapper(s),this.out.apply(this,[`%c(${t})-> %c%c${this.name}%c::%c${e}%c() ->> ${r} %c↓`].concat(this.defaultStyle)),this.out(s)}printMultiLineObject(t,e,s){this.out.apply(this,[`%c(${t})-> %c%c${this.name}%c::%c${e}%c(${Object.keys(s).join(", ")}) %c↓`].concat(this.defaultStyle));for(let t in s){let e=s[t];"object"==typeof e?e=JSON.stringify(this.useWrapper(e),r()):"function"==typeof s[t]&&(e=o.getFunctionView(e)),this.out.call(this,"%c"+t+": `"+this.useWrapper(e)+"`","color: #a3a3a3")}}getRandomColor(){let t="#";for(let e=0;6>e;e++)t+="0123456789ABCDEF"[Math.floor(16*Math.random())];return o.colorsInUse.some((e=>s(t,e)>=.8))?this.getRandomColor():t}out(...t){this.outputHandler.apply(this,t)}}var a=Object.freeze({__proto__:null,Logger:o});class i extends Error{constructor(t){super(`Command: '${t.getName()}' is already registered`)}}class c extends Error{constructor(t){super(`Command: '${t}' is not found`)}}class l extends Error{constructor(t){super(`Controller: '${t.getName()}' is already registered`)}}class h extends Error{constructor(t,e){super(`ForeMethod implementation: at '${t}' method: '${e}'`)}}class u extends Error{constructor(t,e){super(`ForeMethod implementation: at '${t.getName()}' method: '${e}'`)}}var p=Object.freeze({__proto__:null,CommandAlreadyRegistered:i,CommandNotFound:c,ControllerAlreadyRegistered:l,ForceMethod:u});let g=0;class m{virtualId=0;static getName(){throw new h("ObjectBase","getName")}constructor(){this.virtualId=g,g++}getName(){return this.constructor.getName()}}class d extends m{static trace=[];current={};currentArgs={};trace=[];commands={};onBeforeHooks={};onBeforeUIHooks={};onAfterHooks={};onAfterOnceHooks={};onAfterUIHooks={};onAfterAffectHooks={};logger;static getName(){return"Core/Managers/Commands"}static async runCallbacks(t,e={},r={}){const s=t?.length||0;for(let n=0;s>n;++n){const s=!0===r.pop?t.pop():t[n];if(!s)throw Error("Callback is not defined.");await s(e,r)}}static hookCommand(t,e,r){t[e]||(t[e]=[]),t[e].push(r)}constructor(){super(),this.logger=new o(this.getName(),!0),this.logger.startEmpty()}async run(t,e={},r={}){"string"==typeof t&&(t=this.getCommandInstance(t,e,r)),this.attachCurrent(t,e);const s=await this.runInstance(t,e,r);return this.detachCurrent(t),s}register(t,e){const r={};return Object.values(t).forEach((t=>{const e=t.getName();if(this.commands[e])throw new i(t);this.commands[e]=t,r[e]=t})),r}getAll(){return this.commands}getByName(t){return this.commands[t]}getLogger(){return this.logger}getCommandInstance(t,e={},r={}){const s=this.commands[t];if(!s)throw new c(t);return new s(e,r)}onBefore(t,e){d.hookCommand(this.onBeforeHooks,t,e)}onBeforeUI(t,e){d.hookCommand(this.onBeforeUIHooks,t,e)}onAfter(t,e){d.hookCommand(this.onAfterHooks,t,e)}onAfterUI(t,e){d.hookCommand(this.onAfterUIHooks,t,e)}onAfterOnce(t,e){d.hookCommand(this.onAfterOnceHooks,t,e)}onAfterAffect(t,e){d.hookCommand(this.onAfterAffectHooks,t,e)}onBeforeRun(t,e={},r={}){if(this.onBeforeHooks[t.getName()]){this.onBeforeHooks[t.getName()].forEach((t=>t(e,r)))}if(this.onBeforeUIHooks[t.getName()]){this.onBeforeUIHooks[t.getName()].forEach((t=>t(e,r)))}}async runInstance(t,e={},r={}){let s=null;return Object.keys(e).length?(this.logger.startWith({command:t.getName(),options:r,CommandArgs:"->"}),this.logger.debug("CommandArgs:"),this.logger.object(e)):this.logger.startWith({command:t.getName(),options:r,args:e}),this.onBeforeRun(t,e,r),s=await t.run(),await this.onAfterRun(t,e,r,s),s}async onAfterRun(t,e,r,s){return r=Object.assign({},r),this.onAfterAffectHooks[t.getName()]&&(this.onAfterAffectHooks[t.getName()].forEach((t=>{e.result=s,s=this.run(""+t,e,r)})),s=await s),this.onAfterHooks&&(e.result=s,await d.runCallbacks(Object.assign([],this.onAfterHooks[t.getName()]),e,r)),this.onAfterOnceHooks&&await d.runCallbacks(this.onAfterOnceHooks[t.getName()],e,{...r,pop:!0}),this.onAfterUIHooks&&d.runCallbacks(Object.assign([],this.onAfterUIHooks[t.getName()]),e,r),s}attachCurrent(t,e={}){this.current[t.getName()]=t,this.currentArgs[t.getName()]=e,this.trace.push(t.getName()),d.trace.push(t.getName())}detachCurrent(t){delete this.current[t.getName()],delete this.currentArgs[t.getName()],d.trace.pop(),this.trace.pop()}}class f extends m{controllers={};static getName(){return"Core/Managers/Controllers"}get(t){return this.controllers[t]}getAll(){return this.controllers}register(t){if(this.controllers[t.getName()])throw new l(t);return this.controllers[t.getName()]=t,t}}var C;!function(t){t.DELETE="DELETE",t.GET="GET",t.OPTIONS="OPTIONS",t.PATCH="PATCH",t.POST="POST",t.PUT="PUT",t.__EMPTY__=""}(C||(C={}));class y extends m{logger;apiBaseUrl;static getName(){return"Core/Clients/Http"}constructor(t="http://localhost"){super(),this.logger=new o(y.getName(),!0),this.logger.startWith({apiBaseUrl:t}),this.apiBaseUrl=t+"/"}async fetch(t,e,r=null){this.logger.startWith({path:t,method:e,body:r});const s={credentials:"include"},n={};[C.POST,C.PUT,C.PATCH].includes(e)?(Object.assign(n,{"Content-Type":"application/json"}),Object.assign(s,{method:e,headers:n,body:JSON.stringify(r)})):Object.assign(s,{headers:n});const o=await globalThis.fetch(this.apiBaseUrl+t,s);let a;try{a=await o.json()}catch(t){return console.error(t),!1}if(a?.error&&a?.global&&a?.message)throw Error(a.message);return this.logger.drop({path:t},a),a}}class b extends d{static client;currentHttpMethod;static getName(){return"Core/Managers/Data"}constructor(t){super(),b.client=new y(t.baseURL)}getClient(){return b.client}get(t,e={},r={}){return this.currentHttpMethod=C.GET,super.run(t,e,r)}update(t,e={},r={}){return this.currentHttpMethod=C.PATCH,super.run(t,e,r)}delete(t,e={},r={}){return this.currentHttpMethod=C.DELETE,super.run(t,e,r)}create(t,e={},r={}){return this.currentHttpMethod=C.POST,super.run(t,e,r)}async runInstance(t,e={},r={}){if(!this.currentHttpMethod)throw Error('Cannot run directly use one of the http methods: "get", "update", "delete, "create');const s={type:this.currentHttpMethod,args:{query:{},data:{}}};return C.GET===this.currentHttpMethod?s.args.query=e:s.args.data=e,e.result=await super.runInstance(t,s,r),this.currentHttpMethod=C.__EMPTY__,e.result}}class N extends d{static getName(){return"Core/Managers/Internal"}}const w=[];function O(t){k=new d,_=new f,j=new b(t),E=new N}function A(){k={},_={},j={},E={}}var k={},_={},j={},E={},H=Object.freeze({__proto__:null,afterInitializeCallbacks:w,get commands(){return k},get controllers(){return _},get data(){return j},destroy:A,initialize:O,get internal(){return E}});class I extends m{args={};options={};logger;constructor(t={},e={}){super();const r=this.constructor.getName();this.logger=new o(r,!0,{sameColor:!0}),this.logger.startWith({args:t,options:e}),this.initialize(t,e)}initialize(t,e){this.args=t,this.options=e}apply(t=this.args,e=this.options){throw new u(this,"apply")}async run(){this.onBeforeApply&&this.onBeforeApply();const t=await this.apply(this.args,this.options);return this.onAfterApply&&this.onAfterApply(),t}getArgs(){return this.args}getOptions(){return this.options}}var $=Object.freeze({__proto__:null,CommandBase:I,CommandData:class extends I{static getName(){return"Core/CommandBases/CommandData"}getEndpoint(){throw new u(this,"getEndpoint")}apply(t=this.args,e=this.options){const r=this.applyEndpointFormat(this.getEndpoint(),t);return j.getClient().fetch(r,j.currentHttpMethod,t||null)}applyEndpointFormat(t,e={}){return t.includes("{")&&(t=t.split("/").map((t=>{const r=t.match("\\{(.*?)\\}");return r?.length&&void 0!==e[r[1]]?e[r[1]]:t})).join("/")),t}},CommandInternal:class extends I{static getName(){return"Core/CommandBases/CommandInternal"}},CommandPublic:class extends I{static getName(){return"Core/CommandBases/CommandPublic"}}});var T=Object.freeze({__proto__:null,Controller:class extends m{commands;data;internal;static getName(){return"Core/Core/Controller"}constructor(){super(),this.initialize()}initialize(){this.register(),this.setupHooks&&this.setupHooks()}register(){this.commands=k.register(this.getCommands(),this),this.data=j.register(this.getData(),this),this.internal=E.register(this.getInternal(),this)}getCommands(){return{}}getData(){return{}}getInternal(){return{}}},ObjectBase:m}),B=Object.freeze({__proto__:null,Commands:d,Controllers:f,Data:b,Internal:N}),M=Object.freeze({__proto__:null,commandBases:$,core:T,errors:p,managerBases:B,managers:H,modules:a,utils:n});let x=!1;function U(){if(x)throw Error("ZenCore is already initialized.")}U();let D={version:e};const L={initialize:t=>{U(),D=t||D,O(D),x=!0},destroy:()=>{A(),x=!1},onAfterInitialize:t=>{w.push(t)},config:D,...M};globalThis?.ZenCore||(globalThis.ZenCore=L),t.commandBases=$,t.core=T,t.default=L,t.errors=p,t.managerBases=B,t.managers=H,t.modules=a,t.utils=n,Object.defineProperty(t,"__esModule",{value:!0})}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["@zenflux/core"]={})}(this,(function(t){"use strict";function e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function n(t){for(var n=1;arguments.length>n;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?e(Object(r),!0).forEach((function(e){l(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function r(){r=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=Object.create((e&&e.prototype instanceof p?e:p).prototype),a=new N(r||[]);return o(i,"_invoke",{value:O(t,n,a)}),i}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function p(){}function v(){}function y(){}var g={};s(g,a,(function(){return this}));var d=Object.getPrototypeOf,m=d&&d(d(_([])));m&&m!==e&&n.call(m,a)&&(g=m);var b=y.prototype=p.prototype=Object.create(g);function k(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function r(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function O(t,e,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return x()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var c=j(a,n);if(c){if(c===h)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=f(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function j(t,e){var n=e.method,r=t.iterator[n];if(void 0===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=void 0,j(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),h;var o=f(r,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,h;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function C(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function _(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:x}}function x(){return{value:void 0,done:!0}}return v.prototype=y,o(b,"constructor",{value:y,configurable:!0}),o(y,"constructor",{value:v,configurable:!0}),v.displayName=s(y,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,s(t,u,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},k(w.prototype),s(w.prototype,c,(function(){return this})),t.AsyncIterator=w,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new w(l(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},k(b),s(b,u,"Generator"),s(b,a,(function(){return this})),s(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},t.values=_,N.prototype={constructor:N,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(this.prev>=i.tryLoc){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(i.catchLoc>this.prev)return r(i.catchLoc,!0);if(i.finallyLoc>this.prev)return r(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return r(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(this.prev>=o.tryLoc&&n.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;E(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:_(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function i(t,e,n,r,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,o)}function a(t){return function(){var e=this,n=arguments;return new Promise((function(r,o){var a=t.apply(e,n);function c(t){i(a,r,o,c,u,"next",t)}function u(t){i(a,r,o,c,u,"throw",t)}c(void 0)}))}}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var n=0;e.length>n;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,C(r.key),r)}}function s(t,e,n){return e&&u(t.prototype,e),n&&u(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function l(t,e,n){return(e=C(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function f(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&p(t,e)}function h(t){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},h(t)}function p(t,e){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},p(t,e)}function v(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function y(t,e,n){return y=v()?Reflect.construct.bind():function(t,e,n){var r=[null];r.push.apply(r,e);var o=new(Function.bind.apply(t,r));return n&&p(o,n.prototype),o},y.apply(null,arguments)}function g(t){var e="function"==typeof Map?new Map:void 0;return g=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return y(t,arguments,h(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),p(n,t)},g(t)}function d(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function m(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return d(t)}function b(t){var e=v();return function(){var n,r=h(t);if(e){var o=h(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m(this,n)}}function k(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=h(t)););return t}function w(){return w="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=k(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(3>arguments.length?t:n):o.value}},w.apply(this,arguments)}function O(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,c=[],u=!0,s=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(c.push(r.value),c.length!==e);u=!0);}catch(t){s=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return j(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return j(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);e>n;n++)r[n]=t[n];return r}function C(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}var E="0.0.0-alpha.0",N=function(){var t=new WeakSet;return function(e,n){if("object"===o(n)&&null!==n){if(t.has(n))return;t.add(n)}return n}},_=function(t,e){t=t.replace("#",""),e=e.replace("#","");var n=parseInt(t.substring(0,2),16),r=parseInt(t.substring(2,4),16),o=parseInt(t.substring(4,6),16),i=parseInt(e.substring(0,2),16),a=parseInt(e.substring(2,4),16),c=parseInt(e.substring(4,6),16),u=255-Math.abs(n-i),s=255-Math.abs(r-a),l=255-Math.abs(o-c);return((u/=255)+(s/=255)+(l/=255))/3},x=Object.freeze({__proto__:null,getCircularReplacer:N,hexColorDelta:_}),A=function(){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};c(this,t),l(this,"args",{}),l(this,"state",!1),"off"!==(null===(n=globalThis.process)||void 0===n?void 0:n.env.flow_modules_logger)&&(this.state=r,this.args=o,this.name="",this.name="string"==typeof e?e:e.constructor.name,r&&this.initialize())}return s(t,[{key:"initialize",value:function(){this.args.sameColor?(t.sharedData[this.name]||(t.sharedData[this.name]=this.getRandomColor()),this.color=t.sharedData[this.name]):(this.color=this.getRandomColor(),t.colorsInUse.push(this.color)),this.outputHandler=console.log,this.defaultStyle=["color: grey;font-size:7px","display: block","color: ".concat(this.color),"color: grey","font-weight: bold","color: #607D8B","font-size: 16px;color: red;font-weight:800"]}},{key:"setOutputHandler",value:function(t){this.outputHandler=t}},{key:"useWrapper",value:function(e){var r=this,i=1>=arguments.length||void 0===arguments[1]||arguments[1];if(!e||"object"!==o(e)||Array.isArray(e))return e;t.wrapperDepth++;var a=n({},e);return Object.values(t.wrappers).forEach((function(t){var n=O(t,1)[0];e instanceof n.classType&&(a=n.callback(e)||a)})),4>t.wrapperDepth?(i&&a&&Object.entries(a).forEach((function(t){var e=O(t,2);a[e[0]]=r.useWrapper(e[1],!0)})),t.wrapperDepth--,a):(t.wrapperDepth--,a)}},{key:"startEmpty",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.state&&this.printFunctionNotify("se",t.getCallerName(),e)}},{key:"startWith",value:function(e){if(this.state){e=Object.assign({},e);var n="se",r=t.getCallerName();if("string"==typeof e)this.printInLineString(n,r,e);else if(1===Object.keys(e).length){var i=Object.keys(e)[0],a=Object.values(e)[0];"object"===o(a)?this.printNextLineObject(n,r,i,a||{}):"function"==typeof a?this.printInLineFunction(n,r,i,a):this.printInLineElement(n,r,i,a)}else this.printMultiLineObject(n,r,e)}}},{key:"object",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(this.state){var r=t.getCallerName();for(var i in e=Object.create(e))"object"===o(e[i])&&(e[i]=JSON.stringify(this.useWrapper(e[i]),N())),this.out.apply(this,["%c(ob)-> %c%c".concat(this.name,"%c::%c").concat(r,"%c() [").concat(n,"] ->> ").concat(i,": '").concat(e[i],"'%c")].concat(this.defaultStyle))}}},{key:"debug",value:function(e){this.state&&this.printFunctionNotify("db",t.getCallerName(),e)}},{key:"drop",value:function(e,n){if(this.state){var r=t.getCallerName();for(var o in e)this.out.apply(this,["%c(dr)-> %c%c".concat(this.name,"%c::%c").concat(r,"%c() ->> corresponding ").concat(o,": '").concat(e[o],"' RESULT: %c↓")].concat(this.defaultStyle));this.out(n)}}},{key:"throw",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"null",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};throw this.printFunctionNotify("tw",t.getCallerName(),e),r&&this.printNextLineObject("tw",t.getCallerName(),n,r),Error().stack}},{key:"clone",value:function(){return Object.assign(Object.create(Object.getPrototypeOf(this)),this)}},{key:"printFunctionNotify",value:function(t,e,n){this.out.apply(this,["%c(".concat(t,")-> %c%c").concat(this.name,"%c::%c").concat(e,"%c() ").concat(n,"%c")].concat(this.defaultStyle))}},{key:"printInLineElement",value:function(t,e,n,r){this.out.apply(this,["%c(".concat(t,")-> %c%c").concat(this.name,"%c::%c").concat(e,"%c() ->> ").concat(n,": '").concat(r,"'%c")].concat(this.defaultStyle))}},{key:"printInLineFunction",value:function(e,n,r,o){o=t.getFunctionView(o),this.printInLineElement(e,n,r,o)}},{key:"printInLineString",value:function(t,e,n){this.printInLineElement(t,e,"(string)",n)}},{key:"printNextLineObject",value:function(t,e,n,r){r=this.useWrapper(r),this.out.apply(this,["%c(".concat(t,")-> %c%c").concat(this.name,"%c::%c").concat(e,"%c() ->> ").concat(n," %c↓")].concat(this.defaultStyle)),this.out(r)}},{key:"printMultiLineObject",value:function(e,n,r){for(var i in this.out.apply(this,["%c(".concat(e,")-> %c%c").concat(this.name,"%c::%c").concat(n,"%c(").concat(Object.keys(r).join(", "),") %c↓")].concat(this.defaultStyle)),r){var a=r[i];"object"===o(a)?a=JSON.stringify(this.useWrapper(a),N()):"function"==typeof r[i]&&(a=t.getFunctionView(a)),this.out.call(this,"%c"+i+": `"+this.useWrapper(a)+"`","color: #a3a3a3")}}},{key:"getRandomColor",value:function(){for(var e="#",n=0;6>n;n++)e+="0123456789ABCDEF"[Math.floor(16*Math.random())];return t.colorsInUse.some((function(t){return _(e,t)>=.8}))?this.getRandomColor():e}},{key:"out",value:function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];this.outputHandler.apply(this,e)}}],[{key:"getName",value:function(){return"Core/Modules/Logger"}},{key:"reset",value:function(){t.wrappers={},t.wrapperDepth=0,t.colorsInUse=[],t.sharedData={}}},{key:"createCustomWrapper",value:function(e,n){t.wrappers[e]||(t.wrappers[e.name]=[]),t.wrappers[e.name].push({classType:e,callback:n})}},{key:"getCallerName",value:function(){var t=Error(),e=t.stack?t.stack.split("\n")[3].trim():"_UNKNOWN_CALLER_NAME_";return e.startsWith("at new")?"constructor":e.split(".")[1].split(" ")[0]}},{key:"getFunctionView",value:function(t){var e="anonymous function()";return"string"!=typeof t&&0!==t.name.length&&(e=t.name.split(" ")[1]+"()"),e}}]),t}();l(A,"wrappers",{}),l(A,"wrapperDepth",0),l(A,"sharedData",{}),l(A,"colorsInUse",[]);var I=Object.freeze({__proto__:null,Logger:A}),L=function(t){f(n,t);var e=b(n);function n(t){return c(this,n),e.call(this,"Command: '".concat(t.getName(),"' is already registered"))}return s(n)}(g(Error)),P=function(t){f(n,t);var e=b(n);function n(t){return c(this,n),e.call(this,"Command: '".concat(t,"' is not found"))}return s(n)}(g(Error)),T=function(t){f(n,t);var e=b(n);function n(t){return c(this,n),e.call(this,"Controller: '".concat(t.getName(),"' is already registered"))}return s(n)}(g(Error)),H=function(t){f(n,t);var e=b(n);function n(t,r){return c(this,n),e.call(this,"ForeMethod implementation: at '".concat(t,"' method: '").concat(r,"'"))}return s(n)}(g(Error)),S=function(t){f(n,t);var e=b(n);function n(t,r){return c(this,n),e.call(this,"ForeMethod implementation: at '".concat(t.getName(),"' method: '").concat(r,"'"))}return s(n)}(g(Error)),B=Object.freeze({__proto__:null,CommandAlreadyRegistered:L,CommandNotFound:P,ControllerAlreadyRegistered:T,ForceMethod:S}),M=0,D=function(){function t(){c(this,t),l(this,"virtualId",0),this.virtualId=M,M++}return s(t,[{key:"getName",value:function(){return this.constructor.getName()}}],[{key:"getName",value:function(){throw new H("ObjectBase","getName")}}]),t}();var R=function(t){f(p,t);var e,o,i,u,h=b(p);function p(){var t;return c(this,p),l(d(t=h.call(this)),"current",{}),l(d(t),"currentArgs",{}),l(d(t),"trace",[]),l(d(t),"commands",{}),l(d(t),"onBeforeHooks",{}),l(d(t),"onBeforeUIHooks",{}),l(d(t),"onAfterHooks",{}),l(d(t),"onAfterOnceHooks",{}),l(d(t),"onAfterUIHooks",{}),l(d(t),"onAfterAffectHooks",{}),t.logger=new A(t.getName(),!0),t.logger.startEmpty(),t}return s(p,[{key:"run",value:(u=a(r().mark((function t(e){var n,o,i,a=arguments;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=a.length>1&&void 0!==a[1]?a[1]:{},o=a.length>2&&void 0!==a[2]?a[2]:{},"string"==typeof e&&(e=this.getCommandInstance(e,n,o)),this.attachCurrent(e,n),t.next=6,this.runInstance(e,n,o);case 6:return i=t.sent,this.detachCurrent(e),t.abrupt("return",i);case 9:case"end":return t.stop()}}),t,this)}))),function(t){return u.apply(this,arguments)})},{key:"register",value:function(t,e){var n=this,r={};return Object.values(t).forEach((function(t){var e=t.getName();if(n.commands[e])throw new L(t);n.commands[e]=t,r[e]=t})),r}},{key:"getAll",value:function(){return this.commands}},{key:"getByName",value:function(t){return this.commands[t]}},{key:"getLogger",value:function(){return this.logger}},{key:"getCommandInstance",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.commands[t];if(!r)throw new P(t);return new r(e,n)}},{key:"onBefore",value:function(t,e){p.hookCommand(this.onBeforeHooks,t,e)}},{key:"onBeforeUI",value:function(t,e){p.hookCommand(this.onBeforeUIHooks,t,e)}},{key:"onAfter",value:function(t,e){p.hookCommand(this.onAfterHooks,t,e)}},{key:"onAfterUI",value:function(t,e){p.hookCommand(this.onAfterUIHooks,t,e)}},{key:"onAfterOnce",value:function(t,e){p.hookCommand(this.onAfterOnceHooks,t,e)}},{key:"onAfterAffect",value:function(t,e){p.hookCommand(this.onAfterAffectHooks,t,e)}},{key:"onBeforeRun",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(this.onBeforeHooks[t.getName()]){var r=this.onBeforeHooks[t.getName()];r.forEach((function(t){return t(e,n)}))}if(this.onBeforeUIHooks[t.getName()]){var o=this.onBeforeUIHooks[t.getName()];o.forEach((function(t){return t(e,n)}))}}},{key:"runInstance",value:(i=a(r().mark((function t(e){var n,o,i,a=arguments;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=a.length>2&&void 0!==a[2]?a[2]:{},i=null,Object.keys(n=a.length>1&&void 0!==a[1]?a[1]:{}).length?(this.logger.startWith({command:e.getName(),options:o,CommandArgs:"->"}),this.logger.debug("CommandArgs:"),this.logger.object(n)):this.logger.startWith({command:e.getName(),options:o,args:n}),this.onBeforeRun(e,n,o),t.next=7,e.run();case 7:return i=t.sent,t.next=10,this.onAfterRun(e,n,o,i);case 10:return t.abrupt("return",i);case 11:case"end":return t.stop()}}),t,this)}))),function(t){return i.apply(this,arguments)})},{key:"onAfterRun",value:(o=a(r().mark((function t(e,o,i,a){var c=this;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=Object.assign({},i),!this.onAfterAffectHooks[e.getName()]){t.next=6;break}return this.onAfterAffectHooks[e.getName()].forEach((function(t){o.result=a,a=c.run(""+t,o,i)})),t.next=5,a;case 5:a=t.sent;case 6:if(!this.onAfterHooks){t.next=10;break}return o.result=a,t.next=10,p.runCallbacks(Object.assign([],this.onAfterHooks[e.getName()]),o,i);case 10:if(!this.onAfterOnceHooks){t.next=13;break}return t.next=13,p.runCallbacks(this.onAfterOnceHooks[e.getName()],o,n(n({},i),{},{pop:!0}));case 13:return this.onAfterUIHooks&&p.runCallbacks(Object.assign([],this.onAfterUIHooks[e.getName()]),o,i),t.abrupt("return",a);case 15:case"end":return t.stop()}}),t,this)}))),function(t,e,n,r){return o.apply(this,arguments)})},{key:"attachCurrent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.current[t.getName()]=t,this.currentArgs[t.getName()]=e,this.trace.push(t.getName()),p.trace.push(t.getName())}},{key:"detachCurrent",value:function(t){delete this.current[t.getName()],delete this.currentArgs[t.getName()],p.trace.pop(),this.trace.pop()}}],[{key:"getName",value:function(){return"Core/Managers/Commands"}},{key:"runCallbacks",value:(e=a(r().mark((function t(e){var n,o,i,a,c,u=arguments;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=u.length>1&&void 0!==u[1]?u[1]:{},o=u.length>2&&void 0!==u[2]?u[2]:{},i=(null==e?void 0:e.length)||0,a=0;case 4:if(a>=i){t.next=13;break}if(c=!0===o.pop?e.pop():e[a]){t.next=8;break}throw Error("Callback is not defined.");case 8:return t.next=10,c(n,o);case 10:++a,t.next=4;break;case 13:case"end":return t.stop()}}),t)}))),function(t){return e.apply(this,arguments)})},{key:"hookCommand",value:function(t,e,n){t[e]||(t[e]=[]),t[e].push(n)}}]),p}(D);l(R,"trace",[]);var U,F=function(t){f(n,t);var e=b(n);function n(){var t;c(this,n);for(var r=arguments.length,o=Array(r),i=0;r>i;i++)o[i]=arguments[i];return l(d(t=e.call.apply(e,[this].concat(o))),"controllers",{}),t}return s(n,[{key:"get",value:function(t){return this.controllers[t]}},{key:"getAll",value:function(){return this.controllers}},{key:"register",value:function(t){if(this.controllers[t.getName()])throw new T(t);return this.controllers[t.getName()]=t,t}}],[{key:"getName",value:function(){return"Core/Managers/Controllers"}}]),n}(D);!function(t){t.DELETE="DELETE",t.GET="GET",t.OPTIONS="OPTIONS",t.PATCH="PATCH",t.POST="POST",t.PUT="PUT",t.__EMPTY__=""}(U||(U={}));var z=function(t){f(o,t);var e,n=b(o);function o(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"http://localhost";return c(this,o),(t=n.call(this)).logger=new A(o.getName(),!0),t.logger.startWith({apiBaseUrl:e}),t.apiBaseUrl=e+"/",t}return s(o,[{key:"fetch",value:(e=a(r().mark((function t(e,n){var o,i,a,c,u,s,l,f,h=arguments;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.logger.startWith({path:e,method:n,body:c=h.length>2&&void 0!==h[2]?h[2]:null}),u={credentials:"include"},s={},[U.POST,U.PUT,U.PATCH].includes(n)?(Object.assign(s,{"Content-Type":"application/json"}),Object.assign(u,{method:n,headers:s,body:JSON.stringify(c)})):Object.assign(u,{headers:s}),t.next=6,globalThis.fetch(this.apiBaseUrl+e,u);case 6:return l=t.sent,f=void 0,t.prev=8,t.next=11,l.json();case 11:f=t.sent,t.next=18;break;case 14:return t.prev=14,t.t0=t.catch(8),console.error(t.t0),t.abrupt("return",!1);case 18:if(!(null!==(o=f)&&void 0!==o&&o.error&&null!==(i=f)&&void 0!==i&&i.global&&null!==(a=f)&&void 0!==a&&a.message)){t.next=20;break}throw Error(f.message);case 20:return this.logger.drop({path:e},f),t.abrupt("return",f);case 22:case"end":return t.stop()}}),t,this,[[8,14]])}))),function(t,n){return e.apply(this,arguments)})}],[{key:"getName",value:function(){return"Core/Clients/Http"}}]),o}(D),W=function(t){f(o,t);var e,n=b(o);function o(t){var e;return c(this,o),e=n.call(this),o.client=new z(t.baseURL),e}return s(o,[{key:"getClient",value:function(){return o.client}},{key:"get",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.currentHttpMethod=U.GET,w(h(o.prototype),"run",this).call(this,t,e,n)}},{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.currentHttpMethod=U.PATCH,w(h(o.prototype),"run",this).call(this,t,e,n)}},{key:"delete",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.currentHttpMethod=U.DELETE,w(h(o.prototype),"run",this).call(this,t,e,n)}},{key:"create",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.currentHttpMethod=U.POST,w(h(o.prototype),"run",this).call(this,t,e,n)}},{key:"runInstance",value:(e=a(r().mark((function t(e){var n,i,a,c=arguments;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=c.length>1&&void 0!==c[1]?c[1]:{},i=c.length>2&&void 0!==c[2]?c[2]:{},this.currentHttpMethod){t.next=4;break}throw Error('Cannot run directly use one of the http methods: "get", "update", "delete, "create');case 4:return a={type:this.currentHttpMethod,args:{query:{},data:{}}},U.GET===this.currentHttpMethod?a.args.query=n:a.args.data=n,t.next=8,w(h(o.prototype),"runInstance",this).call(this,e,a,i);case 8:return n.result=t.sent,this.currentHttpMethod=U.__EMPTY__,t.abrupt("return",n.result);case 11:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})}],[{key:"getName",value:function(){return"Core/Managers/Data"}}]),o}(R),G=function(t){f(n,t);var e=b(n);function n(){return c(this,n),e.apply(this,arguments)}return s(n,null,[{key:"getName",value:function(){return"Core/Managers/Internal"}}]),n}(R),Y=[];function J(t){Z=new R,q=new F,K=new W(t),$=new G}function V(){Z={},q={},K={},$={}}var Z={},q={},K={},$={},Q=Object.freeze({__proto__:null,afterInitializeCallbacks:Y,get commands(){return Z},get controllers(){return q},get data(){return K},destroy:V,initialize:J,get internal(){return $}}),X=function(t){f(o,t);var e,n=b(o);function o(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};c(this,o),l(d(t=n.call(this)),"args",{}),l(d(t),"options",{});var i=t.constructor.getName();return t.logger=new A(i,!0,{sameColor:!0}),t.logger.startWith({args:e,options:r}),t.initialize(e,r),t}return s(o,[{key:"initialize",value:function(t,e){this.args=t,this.options=e}},{key:"apply",value:function(){throw new S(this,"apply")}},{key:"run",value:(e=a(r().mark((function t(){var e;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.onBeforeApply&&this.onBeforeApply(),t.next=3,this.apply(this.args,this.options);case 3:return e=t.sent,this.onAfterApply&&this.onAfterApply(),t.abrupt("return",e);case 6:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"getArgs",value:function(){return this.args}},{key:"getOptions",value:function(){return this.options}}]),o}(D),tt=function(t){f(n,t);var e=b(n);function n(){return c(this,n),e.apply(this,arguments)}return s(n,null,[{key:"getName",value:function(){return"Core/CommandBases/CommandPublic"}}]),n}(X),et=function(t){f(n,t);var e=b(n);function n(){return c(this,n),e.apply(this,arguments)}return s(n,[{key:"getEndpoint",value:function(){throw new S(this,"getEndpoint")}},{key:"apply",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.args,e=this.applyEndpointFormat(this.getEndpoint(),t);return K.getClient().fetch(e,K.currentHttpMethod,t||null)}},{key:"applyEndpointFormat",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.includes("{")&&(t=t.split("/").map((function(t){var n=t.match("\\{(.*?)\\}");return null!=n&&n.length&&void 0!==e[n[1]]?e[n[1]]:t})).join("/")),t}}],[{key:"getName",value:function(){return"Core/CommandBases/CommandData"}}]),n}(X),nt=function(t){f(n,t);var e=b(n);function n(){return c(this,n),e.apply(this,arguments)}return s(n,null,[{key:"getName",value:function(){return"Core/CommandBases/CommandInternal"}}]),n}(X),rt=Object.freeze({__proto__:null,CommandBase:X,CommandData:et,CommandInternal:nt,CommandPublic:tt}),ot=Object.freeze({__proto__:null,Controller:function(t){f(n,t);var e=b(n);function n(){var t;return c(this,n),(t=e.call(this)).initialize(),t}return s(n,[{key:"initialize",value:function(){this.register(),this.setupHooks&&this.setupHooks()}},{key:"register",value:function(){this.commands=Z.register(this.getCommands(),this),this.data=K.register(this.getData(),this),this.internal=$.register(this.getInternal(),this)}},{key:"getCommands",value:function(){return{}}},{key:"getData",value:function(){return{}}},{key:"getInternal",value:function(){return{}}}],[{key:"getName",value:function(){return"Core/Core/Controller"}}]),n}(D),ObjectBase:D}),it=Object.freeze({__proto__:null,Commands:R,Controllers:F,Data:W,Internal:G}),at=Object.freeze({__proto__:null,commandBases:rt,core:ot,errors:B,managerBases:it,managers:Q,modules:I,utils:x}),ct=!1;function ut(){if(ct)throw Error("ZenCore is already initialized.")}ut();var st={version:E},lt=n({initialize:function(t){ut(),J(st=t||st),ct=!0},destroy:function(){V(),ct=!1},onAfterInitialize:function(t){Y.push(t)},config:st},at);null!==globalThis&&void 0!==globalThis&&globalThis.ZenCore||(globalThis.ZenCore=lt),t.commandBases=rt,t.core=ot,t.default=lt,t.errors=B,t.managerBases=it,t.managers=Q,t.modules=I,t.utils=x,Object.defineProperty(t,"__esModule",{value:!0})}));

52

package.json
{
"name": "@zenflux/core",
"version": "0.0.0-alpha.0",
"version": "0.0.0-alpha.1",
"description": "ZenFlux core",
"author": "Leonid Vinikov <leonidvinikov@gmail.com> (https://github.com/iNewLegend)",
"scripts": {
"test": "export flow_modules_logger=off && jest",
"build": "rollup --config rollup.config.ts --configPlugin typescript",
"watch": "rollup --config rollup.config.ts --configPlugin typescript --watch"
},
"repository": {
"type": "git",
"url": "git+https://github.com/zenflux/core.git"
},
"keywords": [

@@ -21,4 +11,16 @@ "zenflux",

"manager",
"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": [

@@ -29,30 +31,20 @@ "dist",

],
"license": "MIT",
"main": "dist/cjs/zenflux-core.js",
"unpkg": "dist/umd/zenflux-core.js",
"module": "dist/es/zenflux-core.js",
"types": "types/index.d.ts",
"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/core": "^7.20.7",
"@babel/plugin-transform-runtime": "^7.19.6",
"@babel/preset-env": "^7.20.2",
"@babel/preset-typescript": "^7.18.6",
"@babel/runtime": "^7.20.7",
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-replace": "^5.0.2",
"@rollup/plugin-terser": "^0.2.1",
"@rollup/plugin-typescript": "^10.0.1",
"@types/jest": "^29.2.5",
"@typescript-eslint/eslint-plugin": "^5.48.0",
"@typescript-eslint/parser": "^5.48.0",
"@zenflux/rollup-toolkit": "^0.0.0-alpha.0",
"babel-jest": "^29.3.1",
"rollup": "^3.9.1",
"ts-jest": "^29.0.3",
"tslib": "^2.4.1"
},
"dependencies": {
"@babel/runtime": "^7.19.0"
}
}

@@ -9,3 +9,3 @@ /**

import * as managers from "../managers";
import * as managers from "../managers/";

@@ -12,0 +12,0 @@ export abstract class Controller extends ObjectBase {

import pkg from "../package.json";
import './globals'
import { IAPIConfig } from "./interfaces/config";

@@ -6,0 +4,0 @@

@@ -11,4 +11,2 @@ /**

import '../globals';
export const afterInitializeCallbacks: ( () => void )[] = [];

@@ -34,11 +32,1 @@

export var internal = {} as Internal;
/*
__ZEN_MANAGERS__.initialize = initialize;
__ZEN_MANAGERS__.destroy = destroy;
export var commands = __ZEN_MANAGERS__.commands;
export var controllers = __ZEN_MANAGERS__.controllers;
export var data = __ZEN_MANAGERS__.data;
export var internal = __ZEN_MANAGERS__.internal;
*/
export { initialize, destroy, onAfterInitialize } from "../dist/es/src/initializer";
export * from '../dist/es/src/exports';
export * as managers from "../dist/es/src/managers";

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc