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.32 to 4.0.3-dev.33

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 });

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

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

@@ -14,3 +23,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 });

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

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

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

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

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

@@ -21,2 +21,11 @@ "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) {

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

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

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

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

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

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

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

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

@@ -120,0 +129,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