Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@withonevision/omnihive-core

Package Overview
Dependencies
Maintainers
2
Versions
219
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@withonevision/omnihive-core - npm Package Compare versions

Comparing version 4.0.3-dev.43 to 4.0.3-dev.44

13

helpers/AwaitHelper.js
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -16,3 +7,3 @@ exports.AwaitHelper = void 0;

exports.AwaitHelper = AwaitHelper;
AwaitHelper.execute = (promise) => __awaiter(void 0, void 0, void 0, function* () {
AwaitHelper.execute = async (promise) => {
return promise

@@ -23,3 +14,3 @@ .then((data) => data)

});
});
};
//# sourceMappingURL=AwaitHelper.js.map

27

models/HiveWorkerBase.js
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -27,14 +18,10 @@ exports.HiveWorkerBase = void 0;

}
afterInit() {
return __awaiter(this, void 0, void 0, function* () {
return;
});
async afterInit() {
return;
}
init(config) {
return __awaiter(this, void 0, void 0, function* () {
if (!config || Object.keys(config).length <= 0) {
throw new Error("Configuration not specified");
}
this.config = config;
});
async init(config) {
if (!config || Object.keys(config).length <= 0) {
throw new Error("Configuration not specified");
}
this.config = config;
}

@@ -41,0 +28,0 @@ }

{
"name": "@withonevision/omnihive-core",
"version": "4.0.3-dev.43",
"version": "4.0.3-dev.44",
"description": "OmniHive Core",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -21,11 +21,2 @@ "use strict";

};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -45,3 +36,3 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

this.registeredWorkers = [];
this.initWorkers = (configs) => __awaiter(this, void 0, void 0, function* () {
this.initWorkers = async (configs) => {
try {

@@ -63,10 +54,10 @@ for (const hiveWorker of configs) {

}
const newWorker = yield AwaitHelper_1.AwaitHelper.execute(Promise.resolve().then(() => __importStar(require(hiveWorker.importPath))));
const newWorker = await AwaitHelper_1.AwaitHelper.execute(Promise.resolve().then(() => __importStar(require(hiveWorker.importPath))));
const newWorkerInstance = new newWorker.default();
yield AwaitHelper_1.AwaitHelper.execute(newWorkerInstance.init(hiveWorker));
const registeredWorker = Object.assign(Object.assign({}, hiveWorker), { instance: newWorkerInstance });
await AwaitHelper_1.AwaitHelper.execute(newWorkerInstance.init(hiveWorker));
const registeredWorker = { ...hiveWorker, instance: newWorkerInstance };
this.registeredWorkers.push(registeredWorker);
}
for (const worker of this.registeredWorkers) {
yield AwaitHelper_1.AwaitHelper.execute(worker.instance.afterInit());
await AwaitHelper_1.AwaitHelper.execute(worker.instance.afterInit());
}

@@ -77,7 +68,7 @@ }

}
});
};
this.clearWorkers = () => {
this.registeredWorkers = [];
};
this.getWorker = (type, name) => __awaiter(this, void 0, void 0, function* () {
this.getWorker = async (type, name) => {
if (this.registeredWorkers.length === 0) {

@@ -112,17 +103,17 @@ return undefined;

return hiveWorker.instance;
});
};
this.getWorkersByType = (type) => {
return this.registeredWorkers.filter((rw) => rw.type === type && rw.enabled === true);
};
this.pushWorker = (hiveWorker) => __awaiter(this, void 0, void 0, function* () {
this.pushWorker = async (hiveWorker) => {
if (!hiveWorker.importPath || hiveWorker.importPath === "") {
throw new Error(`Hive worker type ${hiveWorker.type} with name ${hiveWorker.name} has no import path`);
}
const newWorker = yield AwaitHelper_1.AwaitHelper.execute(Promise.resolve().then(() => __importStar(require(hiveWorker.importPath))));
const newWorker = await AwaitHelper_1.AwaitHelper.execute(Promise.resolve().then(() => __importStar(require(hiveWorker.importPath))));
const newWorkerInstance = new newWorker.default();
yield AwaitHelper_1.AwaitHelper.execute(newWorkerInstance.init(hiveWorker));
yield AwaitHelper_1.AwaitHelper.execute(newWorkerInstance.afterInit());
const registeredWorker = Object.assign(Object.assign({}, hiveWorker), { instance: newWorkerInstance });
await AwaitHelper_1.AwaitHelper.execute(newWorkerInstance.init(hiveWorker));
await AwaitHelper_1.AwaitHelper.execute(newWorkerInstance.afterInit());
const registeredWorker = { ...hiveWorker, instance: newWorkerInstance };
this.registeredWorkers.push(registeredWorker);
});
};
}

@@ -129,0 +120,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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