Adapting Arrow-Functions
This commit is contained in:
parent
7ba81c09b1
commit
4535821e8c
@ -117,4 +117,6 @@ const main = async function () {
|
||||
logger.info("Defined config in " + args.file);
|
||||
};
|
||||
|
||||
main().catch((e) => console.error(e));
|
||||
main().catch((e) => {
|
||||
console.error(e);
|
||||
});
|
||||
|
@ -23,13 +23,15 @@ export function defaultDecoratorFilter(
|
||||
): IDecoratorFilter {
|
||||
// Update the Decorators:
|
||||
if (!caseSensitive) {
|
||||
decorators.class = decorators.class.map((item) => item.toLocaleLowerCase());
|
||||
decorators.methods = decorators.methods.map((item) =>
|
||||
item.toLocaleLowerCase()
|
||||
);
|
||||
decorators.properties = decorators.properties.map((item) =>
|
||||
item.toLocaleLowerCase()
|
||||
);
|
||||
decorators.class = decorators.class.map((item) => {
|
||||
return item.toLocaleLowerCase();
|
||||
});
|
||||
decorators.methods = decorators.methods.map((item) => {
|
||||
return item.toLocaleLowerCase();
|
||||
});
|
||||
decorators.properties = decorators.properties.map((item) => {
|
||||
return item.toLocaleLowerCase();
|
||||
});
|
||||
}
|
||||
|
||||
return (declaration, decorator, mapping) => {
|
||||
|
@ -74,7 +74,10 @@ export function getDeclarationByName(
|
||||
}
|
||||
|
||||
if (hasImport) {
|
||||
type.typeImports.map(({ path, identifier }) => {
|
||||
type.typeImports.map((item) => {
|
||||
// We want to use our destructor in here
|
||||
const { path, identifier } = item;
|
||||
|
||||
if (!tested.has(identifier)) {
|
||||
// Push the Elements to the Reverse Test.
|
||||
recursiveTest.push({
|
||||
|
@ -37,11 +37,9 @@ export function getDecorators(
|
||||
decorators: [],
|
||||
};
|
||||
|
||||
ret.decorators = declaration
|
||||
.getDecorators()
|
||||
.filter((usedDecorator) =>
|
||||
decoratorFilter(declaration, usedDecorator, mapping)
|
||||
);
|
||||
ret.decorators = declaration.getDecorators().filter((usedDecorator) => {
|
||||
return decoratorFilter(declaration, usedDecorator, mapping);
|
||||
});
|
||||
|
||||
if (extractArgs) {
|
||||
ret.decorators.map((usedDecorator) => {
|
||||
|
@ -502,5 +502,7 @@ node {{{pathToFolder}}}\\index.js`),
|
||||
|
||||
// If requested As Main => Perform the Operation.
|
||||
if (require.main === module) {
|
||||
createService().catch((e) => console.error(e));
|
||||
createService().catch((e) => {
|
||||
console.error(e);
|
||||
});
|
||||
}
|
||||
|
@ -78,5 +78,7 @@ export const generateDefaultConfig = async function (
|
||||
};
|
||||
|
||||
if (require.main === module) {
|
||||
generateDefaultConfig().catch((e) => console.error(e));
|
||||
generateDefaultConfig().catch((e) => {
|
||||
console.error(e);
|
||||
});
|
||||
}
|
||||
|
@ -85,5 +85,7 @@ export const generateDefaultPackageConfig = async function (
|
||||
};
|
||||
|
||||
if (require.main === module) {
|
||||
generateDefaultPackageConfig().catch((e) => console.error(e));
|
||||
generateDefaultPackageConfig().catch((e) => {
|
||||
console.error(e);
|
||||
});
|
||||
}
|
||||
|
@ -9,7 +9,12 @@ const parser = new ArgumentParser({
|
||||
const validModes = ["install", "uninstall", "restart"];
|
||||
parser.add_argument(["-m", "--mode"], {
|
||||
help:
|
||||
"Valid Modes are: " + validModes.map((item) => '"' + item + '"').join(", "),
|
||||
"Valid Modes are: " +
|
||||
validModes
|
||||
.map((item) => {
|
||||
return '"' + item + '"';
|
||||
})
|
||||
.join(", "),
|
||||
default: "install",
|
||||
type: "str",
|
||||
dest: "mode",
|
||||
|
@ -125,7 +125,9 @@ export async function readInArgs(
|
||||
"The Communication Channel, which should be used. Possible Values are: " +
|
||||
// Display all Options:
|
||||
Object.getOwnPropertyNames(validLayers)
|
||||
.map((item) => '"' + item + '"')
|
||||
.map((item) => {
|
||||
return '"' + item + '"';
|
||||
})
|
||||
.join(", "),
|
||||
default: "event",
|
||||
type: "str",
|
||||
@ -153,7 +155,9 @@ export async function readInArgs(
|
||||
"The default-selector to select the service providers. Possible Values are: " +
|
||||
// Display all Options:
|
||||
Object.getOwnPropertyNames(ValidDefaultSelectors)
|
||||
.map((item) => '"' + item + '"')
|
||||
.map((item) => {
|
||||
return '"' + item + '"';
|
||||
})
|
||||
.join(", "),
|
||||
default: "first",
|
||||
type: "str",
|
||||
@ -307,14 +311,18 @@ export async function runNopeBackend(
|
||||
logger.error(
|
||||
"Invalid Channel. Please use the following values. " +
|
||||
Object.getOwnPropertyNames(validLayers)
|
||||
.map((item) => '"' + item + '"')
|
||||
.map((item) => {
|
||||
return '"' + item + '"';
|
||||
})
|
||||
.join(", ")
|
||||
);
|
||||
|
||||
const error = Error(
|
||||
"Invalid Channel. Please use the following values. " +
|
||||
Object.getOwnPropertyNames(validLayers)
|
||||
.map((item) => '"' + item + '"')
|
||||
.map((item) => {
|
||||
return '"' + item + '"';
|
||||
})
|
||||
.join(", ")
|
||||
);
|
||||
|
||||
|
@ -245,7 +245,7 @@ export class Bridge implements ICommunicationBridge {
|
||||
});
|
||||
|
||||
// Wait until the Layer is connected.
|
||||
await layer.connected.waitFor((value) => value);
|
||||
await layer.connected.waitFor();
|
||||
|
||||
// Register all know unspecific methods
|
||||
for (const [event, cbs] of this._callbacks.entries()) {
|
||||
|
@ -30,7 +30,9 @@ export function exportFunctionAsNopeService<T>(
|
||||
// Only add the element if it doesnt exists.
|
||||
if (!CONTAINER.methods.has(options.id)) {
|
||||
CONTAINER.methods.set(options.id, {
|
||||
callback: async (...args) => await (func as any)(...args),
|
||||
callback: async (...args) => {
|
||||
return await (func as any)(...args);
|
||||
},
|
||||
options,
|
||||
uri: options.id || (func as any).name,
|
||||
});
|
||||
|
@ -330,7 +330,9 @@ export class NopeConnectivityManager implements INopeConnectivityManager {
|
||||
*/
|
||||
public get master(): INopeStatusInfo {
|
||||
const candidates = this._getPossibleMasterCandidates();
|
||||
const masters = candidates.filter((item) => item.isMaster);
|
||||
const masters = candidates.filter((item) => {
|
||||
return item.isMaster;
|
||||
});
|
||||
|
||||
if (masters.length === 0) {
|
||||
const idx = minOfArray(candidates, "connectedSince").index;
|
||||
@ -397,12 +399,12 @@ export class NopeConnectivityManager implements INopeConnectivityManager {
|
||||
_this.dispatchers.update();
|
||||
});
|
||||
|
||||
await this._communicator.on("Bonjour", ({ dispatcherId }) => {
|
||||
if (_this.id !== dispatcherId) {
|
||||
await this._communicator.on("Bonjour", (opts) => {
|
||||
if (_this.id !== opts.dispatcherId) {
|
||||
if (_this._logger?.enabledFor(DEBUG)) {
|
||||
// If there is a Logger:
|
||||
_this._logger.debug(
|
||||
'Remote Dispatcher "' + dispatcherId + '" went online'
|
||||
'Remote Dispatcher "' + opts.dispatcherId + '" went online'
|
||||
);
|
||||
}
|
||||
|
||||
@ -411,9 +413,9 @@ export class NopeConnectivityManager implements INopeConnectivityManager {
|
||||
}
|
||||
});
|
||||
|
||||
await this._communicator.on("Aurevoir", ({ dispatcherId }) => {
|
||||
await this._communicator.on("Aurevoir", (msg) => {
|
||||
// Remove the Dispatcher.
|
||||
_this._externalDispatchers.delete(dispatcherId);
|
||||
_this._externalDispatchers.delete(msg.dispatcherId);
|
||||
_this.dispatchers.update();
|
||||
});
|
||||
|
||||
@ -652,19 +654,17 @@ export class NopeConnectivityManager implements INopeConnectivityManager {
|
||||
if (this._timeouts.checkInterval > 0) {
|
||||
// Define a Checker, which will test the status
|
||||
// of the external Dispatchers.
|
||||
this._checkInterval = setInterval(
|
||||
() => _this._checkDispatcherHealth(),
|
||||
this._timeouts.checkInterval
|
||||
);
|
||||
this._checkInterval = setInterval(() => {
|
||||
_this._checkDispatcherHealth();
|
||||
}, this._timeouts.checkInterval);
|
||||
}
|
||||
|
||||
if (this._timeouts.sendAliveInterval > 0) {
|
||||
// Define a Timer, which will emit Status updates with
|
||||
// the disered delay.
|
||||
this._sendInterval = setInterval(
|
||||
() => _this._sendStatus(),
|
||||
this._timeouts.sendAliveInterval
|
||||
);
|
||||
this._sendInterval = setInterval(() => {
|
||||
_this._sendStatus();
|
||||
}, this._timeouts.sendAliveInterval);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,9 @@ export class NopeInstanceManager implements INopeInstanceManager {
|
||||
`nope${SPLITCHAR}core${SPLITCHAR}constructor${SPLITCHAR}`
|
||||
)
|
||||
)
|
||||
.map((item) => item.id);
|
||||
.map((item) => {
|
||||
return item.id;
|
||||
});
|
||||
|
||||
// If the Dispatcher has a generator we will add it.
|
||||
if (generators.length) {
|
||||
@ -315,7 +317,9 @@ export class NopeInstanceManager implements INopeInstanceManager {
|
||||
}
|
||||
if (changes.removed.length) {
|
||||
// Remove the dispatchers.
|
||||
changes.removed.map((id) => _this.removeDispatcher(id));
|
||||
changes.removed.map((id) => {
|
||||
_this.removeDispatcher(id);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@ -917,8 +921,12 @@ export class NopeInstanceManager implements INopeInstanceManager {
|
||||
): Promise<I[]> {
|
||||
const indentifier = this.instances.data
|
||||
.getContent()
|
||||
.filter((item) => item.type == type)
|
||||
.map((item) => item.identifier);
|
||||
.filter((item) => {
|
||||
return item.type == type;
|
||||
})
|
||||
.map((item) => {
|
||||
return item.identifier;
|
||||
});
|
||||
|
||||
const promises: Promise<I>[] = [];
|
||||
|
||||
|
@ -230,14 +230,17 @@ export class NopeRpcManager<T extends IFunctionOptions = IFunctionOptions>
|
||||
const _this = this;
|
||||
const _handlerWithOptions = {
|
||||
get(target, name) {
|
||||
return (options: ICallOptions, ...args) =>
|
||||
_this.performCall(name, args, options);
|
||||
return (options: ICallOptions, ...args) => {
|
||||
return _this.performCall(name, args, options);
|
||||
};
|
||||
},
|
||||
};
|
||||
// Define the Proxy without the Options
|
||||
const _handlerWithoutOptions = {
|
||||
get(target, name) {
|
||||
return (...args) => _this.performCall(name, args);
|
||||
return (...args) => {
|
||||
return _this.performCall(name, args);
|
||||
};
|
||||
},
|
||||
};
|
||||
this.methodInterfaceWithOptions = new Proxy({}, _handlerWithOptions);
|
||||
@ -317,7 +320,9 @@ export class NopeRpcManager<T extends IFunctionOptions = IFunctionOptions>
|
||||
const observer = _this.onCancelTask.subscribe((cancelEvent) => {
|
||||
if (cancelEvent.taskId == data.taskId) {
|
||||
// Call Every Callback.
|
||||
cbs.map((cb) => cb(cancelEvent.reason));
|
||||
cbs.map((cb) => {
|
||||
return cb(cancelEvent.reason);
|
||||
});
|
||||
|
||||
// Although we are allowed to Cancel the Subscription
|
||||
observer.unsubscribe();
|
||||
@ -457,9 +462,9 @@ export class NopeRpcManager<T extends IFunctionOptions = IFunctionOptions>
|
||||
// Define the Message
|
||||
const message: IAvailableServicesMsg = {
|
||||
dispatcher: this._id,
|
||||
services: Array.from(this._registeredServices.values()).map(
|
||||
(item) => item.options
|
||||
),
|
||||
services: Array.from(this._registeredServices.values()).map((item) => {
|
||||
return item.options;
|
||||
}),
|
||||
};
|
||||
|
||||
if (this._logger?.enabledFor(DEBUG)) {
|
||||
@ -526,7 +531,9 @@ export class NopeRpcManager<T extends IFunctionOptions = IFunctionOptions>
|
||||
}
|
||||
if (changes.removed.length) {
|
||||
// Remove the dispatchers.
|
||||
changes.removed.map((item) => _this.removeDispatcher(item));
|
||||
changes.removed.map((item) => {
|
||||
return _this.removeDispatcher(item);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@ -806,7 +813,9 @@ export class NopeRpcManager<T extends IFunctionOptions = IFunctionOptions>
|
||||
(_func as any).id = _id;
|
||||
|
||||
// Define the callback.
|
||||
(_func as any).unregister = () => _this._unregisterService(_id);
|
||||
(_func as any).unregister = () => {
|
||||
return _this._unregisterService(_id);
|
||||
};
|
||||
|
||||
// Reister the Function
|
||||
this._registeredServices.set((_func as any).id, {
|
||||
|
@ -60,9 +60,7 @@ export function generateSelector(
|
||||
case "dispatcher":
|
||||
// Our selector compares the dispatcher - id
|
||||
return async (opts) => {
|
||||
const ids = core.connectivityManager.dispatchers.data
|
||||
.getContent()
|
||||
.map((item) => item);
|
||||
const ids = core.connectivityManager.dispatchers.data.getContent();
|
||||
|
||||
if (ids.includes(core.id)) {
|
||||
return core.id;
|
||||
|
@ -241,7 +241,9 @@ export async function generateDefineMaster(dispatcher: INopeDispatcher) {
|
||||
const targets = Array.from(relevantDispatchers);
|
||||
|
||||
await dispatcher.rpcManager.performCall(
|
||||
targets.map((_) => service),
|
||||
targets.map((_) => {
|
||||
return service;
|
||||
}),
|
||||
[false],
|
||||
targets.map((target) => {
|
||||
return { target, timeout: 200 };
|
||||
|
@ -37,21 +37,19 @@ export function getLinkedDispatcher(
|
||||
});
|
||||
|
||||
// If the Dispatcher has been connected, register all functions.
|
||||
dispatcher.ready
|
||||
.waitFor((value) => value === true)
|
||||
.then(() => {
|
||||
if (dispatcher.ready.getContent()) {
|
||||
// Iterate over the Functions
|
||||
for (const [uri, settings] of container.instance.entries()) {
|
||||
dispatcher.rpcManager.registerService(settings.callback, {
|
||||
...settings.options,
|
||||
id: uri,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// Failed to Setup the Container.
|
||||
dispatcher.ready.waitFor().then(() => {
|
||||
if (dispatcher.ready.getContent()) {
|
||||
// Iterate over the Functions
|
||||
for (const [uri, settings] of container.instance.entries()) {
|
||||
dispatcher.rpcManager.registerService(settings.callback, {
|
||||
...settings.options,
|
||||
id: uri,
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Failed to Setup the Container.
|
||||
}
|
||||
});
|
||||
|
||||
return dispatcher;
|
||||
}
|
||||
|
@ -68,9 +68,9 @@ export class NopeDispatcher extends NopeCore implements INopeDispatcher {
|
||||
let items: string[] = [];
|
||||
switch (type) {
|
||||
case "instances":
|
||||
items = this.instanceManager.instances.data
|
||||
.getContent()
|
||||
.map((item) => item.identifier);
|
||||
items = this.instanceManager.instances.data.getContent().map((item) => {
|
||||
return item.identifier;
|
||||
});
|
||||
break;
|
||||
case "services":
|
||||
items = Array.from(
|
||||
|
@ -299,7 +299,11 @@ export class NopeEventEmitter<
|
||||
if (options.pipe) {
|
||||
observable = options.pipe(
|
||||
options.scope,
|
||||
this._emitter.pipe(map((value) => value.value))
|
||||
this._emitter.pipe(
|
||||
map((value) => {
|
||||
return value.value;
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -378,15 +382,21 @@ export class NopeEventEmitter<
|
||||
const prom = Promise.resolve(testCallback(data, opts));
|
||||
|
||||
// Now we link the element
|
||||
prom.catch((e) => finish(e, false, data));
|
||||
prom.then((r) => finish(false, r, data));
|
||||
prom.catch((e) => {
|
||||
finish(e, false, data);
|
||||
});
|
||||
prom.then((r) => {
|
||||
finish(false, r, data);
|
||||
});
|
||||
}
|
||||
|
||||
first = false;
|
||||
};
|
||||
|
||||
try {
|
||||
subscription = _this.subscribe((data, opts) => checkData(data, opts));
|
||||
subscription = _this.subscribe((data, opts) => {
|
||||
checkData(data, opts);
|
||||
});
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
@ -402,7 +412,9 @@ export class NopeEventEmitter<
|
||||
const _this = this;
|
||||
return new Promise<G>((resolve, reject) => {
|
||||
try {
|
||||
_this.once((content) => resolve(content), options);
|
||||
_this.once((content) => {
|
||||
resolve(content);
|
||||
}, options);
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
|
@ -229,8 +229,12 @@ export function avgOfArray(arr: any[], path: string, defaultValue = 0): number {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
const arrOfValues = arr.map((item) => rgetattr(item, path, defaultValue));
|
||||
const added = arrOfValues.reduce((prev, curr) => prev + curr) as number;
|
||||
const arrOfValues = arr.map((item) => {
|
||||
return rgetattr(item, path, defaultValue);
|
||||
});
|
||||
const added = arrOfValues.reduce((prev, curr) => {
|
||||
return prev + curr;
|
||||
}) as number;
|
||||
return added / arr.length;
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,9 @@
|
||||
* @returns void
|
||||
*/
|
||||
export function sleep(delay: number): Promise<void> {
|
||||
return new Promise<void>((resolve) => setTimeout(resolve, delay));
|
||||
return new Promise<void>((resolve) => {
|
||||
setTimeout(resolve, delay);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -58,7 +60,9 @@ export function waitFor(
|
||||
|
||||
let _resolve: () => void;
|
||||
if (_options.additionalDelay) {
|
||||
_resolve = () => setTimeout(resolve, _options.additionalDelay);
|
||||
_resolve = () => {
|
||||
setTimeout(resolve, _options.additionalDelay);
|
||||
};
|
||||
} else {
|
||||
_resolve = resolve;
|
||||
}
|
||||
@ -125,7 +129,9 @@ export function waitFor(
|
||||
const _func = () => {
|
||||
let _resolve: () => void;
|
||||
if (_options.additionalDelay) {
|
||||
_resolve = () => setTimeout(resolve, _options.additionalDelay);
|
||||
_resolve = () => {
|
||||
setTimeout(resolve, _options.additionalDelay);
|
||||
};
|
||||
} else {
|
||||
_resolve = resolve;
|
||||
}
|
||||
|
@ -360,9 +360,24 @@ export function reduceSchema(
|
||||
const _isNopeDescriptor: Array<
|
||||
[keyof INopeDescriptor, (value: any) => boolean]
|
||||
> = [
|
||||
["type", (value) => value === "function"],
|
||||
["inputs", (value) => typeof value === "object"],
|
||||
["outputs", (value) => typeof value === "object"],
|
||||
[
|
||||
"type",
|
||||
(value) => {
|
||||
return value === "function";
|
||||
},
|
||||
],
|
||||
[
|
||||
"inputs",
|
||||
(value) => {
|
||||
return typeof value === "object";
|
||||
},
|
||||
],
|
||||
[
|
||||
"outputs",
|
||||
(value) => {
|
||||
return typeof value === "object";
|
||||
},
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -62,7 +62,9 @@ export function extractValues<D, K>(map: Map<K, any>, path = ""): Array<D> {
|
||||
const data: D | typeof __sentinal = rgetattr(v, path, __sentinal);
|
||||
if (data !== __sentinal) {
|
||||
if (Array.isArray(data)) {
|
||||
data.map((item) => s.push(item));
|
||||
data.map((item) => {
|
||||
return s.push(item);
|
||||
});
|
||||
} else {
|
||||
s.push(data as D);
|
||||
}
|
||||
|
@ -144,7 +144,9 @@ export function convertData<T>(
|
||||
} = {};
|
||||
|
||||
const commonPattern = getLeastCommonPathSegment(
|
||||
props.map((item) => item.query)
|
||||
props.map((item) => {
|
||||
return item.query;
|
||||
})
|
||||
);
|
||||
|
||||
if (!commonPattern) {
|
||||
|
@ -398,5 +398,7 @@ export function patternIsValid(str: string): boolean {
|
||||
}
|
||||
return false;
|
||||
})
|
||||
.reduce((prev, current) => prev && current, true);
|
||||
.reduce((prev, current) => {
|
||||
return prev && current;
|
||||
}, true);
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ export async function loadPackages(
|
||||
}
|
||||
}
|
||||
|
||||
await loader.dispatcher.ready.waitFor((value) => value === true);
|
||||
await loader.dispatcher.ready.waitFor();
|
||||
|
||||
// Iterate over the Packages
|
||||
for (const thePackageToLoad of packages) {
|
||||
|
@ -536,7 +536,9 @@ export class NopePackageLoader implements INopePackageLoader {
|
||||
|
||||
// Firstly add all Descriptors:
|
||||
await this.addDescription(
|
||||
element.providedClasses.map((item) => item.description)
|
||||
element.providedClasses.map((item) => {
|
||||
return item.description;
|
||||
})
|
||||
);
|
||||
// Load the Activation Handlers:
|
||||
await this.addActivationHandler(element.activationHandlers);
|
||||
@ -624,9 +626,9 @@ export class NopePackageLoader implements INopePackageLoader {
|
||||
const reuqiredPackages = Array.from(
|
||||
new Set(
|
||||
flatten(
|
||||
availablePackages.map(
|
||||
(name) => _this.packages[name].requiredPackages
|
||||
)
|
||||
availablePackages.map((name) => {
|
||||
return _this.packages[name].requiredPackages;
|
||||
})
|
||||
)
|
||||
)
|
||||
);
|
||||
@ -667,7 +669,9 @@ export class NopePackageLoader implements INopePackageLoader {
|
||||
}
|
||||
|
||||
// Store the Function, that the instance will be disposed on leaving.
|
||||
this._disposeDefaultInstance.push(() => instance.dispose());
|
||||
this._disposeDefaultInstance.push(() => {
|
||||
return instance.dispose();
|
||||
});
|
||||
|
||||
if (definition.options.identifier in this.packages[name].autostart) {
|
||||
// There are autostart Tasks in the Package for the considered Instance,
|
||||
@ -701,7 +705,9 @@ export class NopePackageLoader implements INopePackageLoader {
|
||||
|
||||
async dispose(): Promise<void> {
|
||||
// Start all dispose Values
|
||||
const promises = this._disposeDefaultInstance.map((cb) => cb());
|
||||
const promises = this._disposeDefaultInstance.map((cb) => {
|
||||
return cb();
|
||||
});
|
||||
|
||||
// Wait for all to finish!
|
||||
await Promise.all(promises);
|
||||
|
@ -140,14 +140,14 @@ const mapping: { [K in LoggerLevel]: any } = {
|
||||
};
|
||||
|
||||
const reverseOrder: { [index: number]: LoggerLevel } = {};
|
||||
Object.getOwnPropertyNames(order).map(
|
||||
(key: LoggerLevel) => (reverseOrder[order[key]] = key)
|
||||
);
|
||||
Object.getOwnPropertyNames(order).map((key: LoggerLevel) => {
|
||||
reverseOrder[order[key]] = key;
|
||||
});
|
||||
|
||||
const reverseMapping: any = {};
|
||||
Object.getOwnPropertyNames(mapping).map(
|
||||
(key: LoggerLevel) => (reverseMapping[mapping[key]] = key)
|
||||
);
|
||||
Object.getOwnPropertyNames(mapping).map((key: LoggerLevel) => {
|
||||
reverseMapping[mapping[key]] = key;
|
||||
});
|
||||
|
||||
function _selectLevel(master: LoggerLevel, slave: LoggerLevel) {
|
||||
const masterLevel = order[master];
|
||||
|
@ -106,7 +106,9 @@ export async function parseModuleToOpenAPI(
|
||||
(method as any).mode = method.schema.inputs.length > 0 ? "POST" : "GET";
|
||||
|
||||
(method as any).required = method.schema.inputs
|
||||
.filter((param) => !param.optional)
|
||||
.filter((param) => {
|
||||
return !param.optional;
|
||||
})
|
||||
.map((param) => param.name);
|
||||
(method as any).hasInput = method.schema.inputs.length > 0;
|
||||
|
||||
|
@ -363,7 +363,9 @@ export class PubSubSystemBase<
|
||||
} {
|
||||
return {
|
||||
publishers: Array.from(this._emitters.values())
|
||||
.filter((item) => item.pubTopic)
|
||||
.filter((item) => {
|
||||
return item.pubTopic;
|
||||
})
|
||||
.map((item) => {
|
||||
return {
|
||||
schema: item.options.schema as INopeDescriptor,
|
||||
@ -371,7 +373,9 @@ export class PubSubSystemBase<
|
||||
};
|
||||
}),
|
||||
subscribers: Array.from(this._emitters.values())
|
||||
.filter((item) => item.subTopic)
|
||||
.filter((item) => {
|
||||
return item.subTopic;
|
||||
})
|
||||
.map((item) => {
|
||||
return {
|
||||
schema: item.options.schema as INopeDescriptor,
|
||||
@ -551,7 +555,9 @@ export class PubSubSystemBase<
|
||||
public dispose(): void {
|
||||
this._disposing = true;
|
||||
const emitters = Array.from(this._emitters.keys());
|
||||
emitters.map((emitter) => this.unregister(emitter as unknown as I));
|
||||
emitters.map((emitter) => {
|
||||
this.unregister(emitter as unknown as I);
|
||||
});
|
||||
|
||||
this.onIncrementalDataChange.dispose();
|
||||
this.publishers.dispose();
|
||||
|
@ -11,6 +11,7 @@
|
||||
"test": "mocha",
|
||||
"compile-nodejs": "tsc -p ./tsconfig.json",
|
||||
"compile-browser": "tsc -p ./tsconfig.browser.json",
|
||||
"compile-py": "tsc -p ./tsconfig.py.json",
|
||||
"build": "npx webpack -c webpack-typescript.config.js",
|
||||
"doc": "npx typedoc",
|
||||
"start": "node ./dist/cli/repl.js",
|
||||
@ -97,5 +98,9 @@
|
||||
"bin": {
|
||||
"nope-js": "./bin/nope"
|
||||
},
|
||||
"main": "dist-nodejs/index.nodejs.js"
|
||||
"main": "dist-nodejs/index.nodejs.js",
|
||||
"prettier": {
|
||||
"arrowParens": "always"
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user