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

@metrichor/epi2me-web

Package Overview
Dependencies
Maintainers
3
Versions
202
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@metrichor/epi2me-web - npm Package Compare versions

Comparing version 4.0.4331484 to 4.0.4366893

36

cjs/epi2me.js

@@ -22,3 +22,3 @@ "use strict";

const utils_1 = require("./utils");
const runtime_typecast_1 = require("./runtime-typecast");
const ts_runtime_typecheck_1 = require("ts-runtime-typecheck");
const epi2me_state_1 = require("./epi2me-state");

@@ -53,3 +53,3 @@ const timers_1 = require("./timers");

if (typeof optstring === 'string') {
const json = runtime_typecast_1.asRecord(JSON.parse(optstring));
const json = ts_runtime_typecheck_1.asRecord(JSON.parse(optstring));
// WARN maybe we should put a depreciation warning here

@@ -78,3 +78,3 @@ // it's not particularly useful accepting a json string

get id() {
return runtime_typecast_1.asIndex(this.config.instance.id_workflow_instance);
return ts_runtime_typecheck_1.asIndex(this.config.instance.id_workflow_instance);
}

@@ -85,9 +85,9 @@ // apikey?: string;

static parseOptObject(opt) {
const options = Object.assign(Object.assign({}, parseCoreOpts_1.parseCoreOpts(opt)), { region: runtime_typecast_1.asString(opt.region, default_options_json_1.default.region), sessionGrace: runtime_typecast_1.asNumber(opt.sessionGrace, default_options_json_1.default.sessionGrace), uploadTimeout: runtime_typecast_1.asNumber(opt.uploadTimeout, default_options_json_1.default.uploadTimeout), downloadTimeout: runtime_typecast_1.asNumber(opt.downloadTimeout, default_options_json_1.default.downloadTimeout), fileCheckInterval: runtime_typecast_1.asNumber(opt.fileCheckInterval, default_options_json_1.default.fileCheckInterval), downloadCheckInterval: runtime_typecast_1.asNumber(opt.downloadCheckInterval, default_options_json_1.default.downloadCheckInterval), stateCheckInterval: runtime_typecast_1.asNumber(opt.stateCheckInterval, default_options_json_1.default.stateCheckInterval), inFlightDelay: runtime_typecast_1.asNumber(opt.inFlightDelay, default_options_json_1.default.inFlightDelay), waitTimeSeconds: runtime_typecast_1.asNumber(opt.waitTimeSeconds, default_options_json_1.default.waitTimeSeconds), waitTokenError: runtime_typecast_1.asNumber(opt.waitTokenError, default_options_json_1.default.waitTokenError), transferPoolSize: runtime_typecast_1.asNumber(opt.transferPoolSize, default_options_json_1.default.transferPoolSize), downloadMode: runtime_typecast_1.asString(opt.downloadMode, default_options_json_1.default.downloadMode), filetype: runtime_typecast_1.asArrayRecursive(opt.filetype, runtime_typecast_1.asString, default_options_json_1.default.filetype), sampleDirectory: runtime_typecast_1.asString(opt.sampleDirectory, default_options_json_1.default.sampleDirectory),
const options = Object.assign(Object.assign({}, parseCoreOpts_1.parseCoreOpts(opt)), { region: ts_runtime_typecheck_1.asString(opt.region, default_options_json_1.default.region), sessionGrace: ts_runtime_typecheck_1.asNumber(opt.sessionGrace, default_options_json_1.default.sessionGrace), uploadTimeout: ts_runtime_typecheck_1.asNumber(opt.uploadTimeout, default_options_json_1.default.uploadTimeout), downloadTimeout: ts_runtime_typecheck_1.asNumber(opt.downloadTimeout, default_options_json_1.default.downloadTimeout), fileCheckInterval: ts_runtime_typecheck_1.asNumber(opt.fileCheckInterval, default_options_json_1.default.fileCheckInterval), downloadCheckInterval: ts_runtime_typecheck_1.asNumber(opt.downloadCheckInterval, default_options_json_1.default.downloadCheckInterval), stateCheckInterval: ts_runtime_typecheck_1.asNumber(opt.stateCheckInterval, default_options_json_1.default.stateCheckInterval), inFlightDelay: ts_runtime_typecheck_1.asNumber(opt.inFlightDelay, default_options_json_1.default.inFlightDelay), waitTimeSeconds: ts_runtime_typecheck_1.asNumber(opt.waitTimeSeconds, default_options_json_1.default.waitTimeSeconds), waitTokenError: ts_runtime_typecheck_1.asNumber(opt.waitTokenError, default_options_json_1.default.waitTokenError), transferPoolSize: ts_runtime_typecheck_1.asNumber(opt.transferPoolSize, default_options_json_1.default.transferPoolSize), downloadMode: ts_runtime_typecheck_1.asString(opt.downloadMode, default_options_json_1.default.downloadMode), filetype: ts_runtime_typecheck_1.asArrayRecursive(ts_runtime_typecheck_1.asString)(opt.filetype, default_options_json_1.default.filetype), sampleDirectory: ts_runtime_typecheck_1.asString(opt.sampleDirectory, default_options_json_1.default.sampleDirectory),
// optional values
useGraphQL: runtime_typecast_1.asOptBoolean(opt.useGraphQL), id_workflow_instance: runtime_typecast_1.asOptIndex(opt.id_workflow_instance), debounceWindow: runtime_typecast_1.asOptNumber(opt.debounceWindow), proxy: runtime_typecast_1.asOptString(opt.proxy),
useGraphQL: ts_runtime_typecheck_1.asOptBoolean(opt.useGraphQL), id_workflow_instance: ts_runtime_typecheck_1.asOptIndex(opt.id_workflow_instance), debounceWindow: ts_runtime_typecheck_1.asOptNumber(opt.debounceWindow), proxy: ts_runtime_typecheck_1.asOptString(opt.proxy),
// EPI2ME-FS options
inputFolders: runtime_typecast_1.asArrayRecursive(opt.inputFolders, runtime_typecast_1.asString, []), outputFolder: runtime_typecast_1.asOptString(opt.outputFolder), awsAcceleration: runtime_typecast_1.asOptString(opt.awsAcceleration), agent_address: runtime_typecast_1.asOptString(opt.agent_address), telemetryCb: runtime_typecast_1.asOptFunction(opt.telemetryCb), dataCb: runtime_typecast_1.asOptFunction(opt.dataCb), remoteShutdownCb: runtime_typecast_1.asOptFunction(opt.remoteShutdownCb) });
inputFolders: ts_runtime_typecheck_1.asArrayRecursive(ts_runtime_typecheck_1.asString)(opt.inputFolders, []), outputFolder: ts_runtime_typecheck_1.asOptString(opt.outputFolder), awsAcceleration: ts_runtime_typecheck_1.asOptString(opt.awsAcceleration), agent_address: ts_runtime_typecheck_1.asOptString(opt.agent_address), telemetryCb: ts_runtime_typecheck_1.asOptFunction(opt.telemetryCb), dataCb: ts_runtime_typecheck_1.asOptFunction(opt.dataCb), remoteShutdownCb: ts_runtime_typecheck_1.asOptFunction(opt.remoteShutdownCb) });
if (opt.inputFolder) {
options.inputFolders.push(runtime_typecast_1.asString(opt.inputFolder));
options.inputFolders.push(ts_runtime_typecheck_1.asString(opt.inputFolder));
}

@@ -106,7 +106,7 @@ return options;

const { instance: instanceConfig } = this.config;
const components = runtime_typecast_1.asOptRecord((_a = instanceConfig.chain) === null || _a === void 0 ? void 0 : _a.components);
const components = ts_runtime_typecheck_1.asOptRecord((_a = instanceConfig.chain) === null || _a === void 0 ? void 0 : _a.components);
if (components) {
const summaryTelemetry = runtime_typecast_1.asRecord(instanceConfig.summaryTelemetry);
const summaryTelemetry = ts_runtime_typecheck_1.asRecord(instanceConfig.summaryTelemetry);
const workerStatus = Object.entries(components).sort((a, b) => parseInt(a[0], 10) - parseInt(b[0], 10));
const indexableNewWorkerStatus = runtime_typecast_1.asIndexable(newWorkerStatus);
const indexableNewWorkerStatus = ts_runtime_typecheck_1.asIndexable(newWorkerStatus);
const results = [];

@@ -118,6 +118,6 @@ for (const [key, value] of workerStatus) {

if (step !== 0) {
const wid = runtime_typecast_1.asIndex(runtime_typecast_1.asRecord(value).wid);
name = (_b = Object.keys(runtime_typecast_1.asRecord(summaryTelemetry[wid]))[0]) !== null && _b !== void 0 ? _b : 'ROOT';
const wid = ts_runtime_typecheck_1.asIndex(ts_runtime_typecheck_1.asRecord(value).wid);
name = (_b = Object.keys(ts_runtime_typecheck_1.asRecord(summaryTelemetry[wid]))[0]) !== null && _b !== void 0 ? _b : 'ROOT';
}
const [running, complete, error] = runtime_typecast_1.asString(indexableNewWorkerStatus[key])
const [running, complete, error] = ts_runtime_typecheck_1.asString(indexableNewWorkerStatus[key])
.split(',')

@@ -348,3 +348,3 @@ .map((componentID) => Math.max(0, +componentID)); // It's dodgy but assuming the componentID is a number happens all over the place

const delta = sign * ((_a = newData[key]) !== null && _a !== void 0 ? _a : 0);
state[key] = runtime_typecast_1.asNumber(state[key], 0) + delta;
state[key] = ts_runtime_typecheck_1.asNumber(state[key], 0) + delta;
}

@@ -385,3 +385,3 @@ }

case 'apisecret':
this.config.options[key] = runtime_typecast_1.asString(value);
this.config.options[key] = ts_runtime_typecheck_1.asString(value);
break;

@@ -399,3 +399,3 @@ case 'id_workflow_instance':

case 'debounceWindow':
this.config.options[key] = runtime_typecast_1.asNumber(value);
this.config.options[key] = ts_runtime_typecheck_1.asNumber(value);
break;

@@ -405,6 +405,6 @@ case 'signing':

case 'local':
this.config.options[key] = runtime_typecast_1.asBoolean(value);
this.config.options[key] = ts_runtime_typecheck_1.asBoolean(value);
break;
case 'filetype':
this.config.options[key] = runtime_typecast_1.asArrayRecursive(value, runtime_typecast_1.asString);
this.config.options[key] = ts_runtime_typecheck_1.asArrayRecursive(ts_runtime_typecheck_1.asString)(value);
break;

@@ -411,0 +411,0 @@ default:

@@ -11,3 +11,3 @@ "use strict";

const fastqgz_1 = __importDefault(require("./filestats/fastqgz"));
const runtime_typecast_1 = require("./runtime-typecast");
const ts_runtime_typecheck_1 = require("ts-runtime-typecheck");
const mapping = new Map([

@@ -25,3 +25,3 @@ ['fastq', fastq_1.default],

async function filestats(filePath) {
if (runtime_typecast_1.isUndefined(filePath)) {
if (ts_runtime_typecheck_1.isUndefined(filePath)) {
// WARN the existing implementation requires that a null object is returned when

@@ -28,0 +28,0 @@ // no path is given. The null object did not match the type signature so a more

@@ -30,3 +30,3 @@ "use strict";

const fetch_1 = require("./network/fetch");
const runtime_typecast_1 = require("./runtime-typecast");
const ts_runtime_typecheck_1 = require("ts-runtime-typecheck");
const network_2 = require("./network");

@@ -313,3 +313,3 @@ const parseCoreOpts_1 = require("./parseCoreOpts");

return {
status: runtime_typecast_1.asBoolean(result.status),
status: ts_runtime_typecheck_1.asBoolean(result.status),
};

@@ -316,0 +316,0 @@ }

@@ -10,3 +10,3 @@ "use strict";

const workflow_pb_service_1 = require("../../../protos/workflow_pb_service");
const runtime_typecast_1 = require("../../runtime-typecast");
const ts_runtime_typecheck_1 = require("ts-runtime-typecheck");
const utils_1 = require("../utils");

@@ -36,7 +36,7 @@ class WorkflowApi {

const { idWorkflow, computeAccountId, storageAccountId, isConsentedHuman, idDataset, storeResults, region, userDefined = {}, instanceAttributes = [], } = workflowConfig;
request.setIdworkflow(runtime_typecast_1.asString(idWorkflow));
request.setComputeaccountid(runtime_typecast_1.asString(computeAccountId));
storageAccountId && request.setStorageaccountid(runtime_typecast_1.asString(storageAccountId));
request.setIdworkflow(ts_runtime_typecheck_1.asString(idWorkflow));
request.setComputeaccountid(ts_runtime_typecheck_1.asString(computeAccountId));
storageAccountId && request.setStorageaccountid(ts_runtime_typecheck_1.asString(storageAccountId));
isConsentedHuman && request.setIsconsentedhuman(isConsentedHuman);
idDataset && request.setIddataset(runtime_typecast_1.asString(idDataset));
idDataset && request.setIddataset(ts_runtime_typecheck_1.asString(idDataset));
storeResults && request.setStoreresults(storeResults);

@@ -49,3 +49,3 @@ region && request.setRegion(region);

const newInstanceAttr = new workflow_pb_1.StartRequest.InstanceAttribute();
newInstanceAttr.setIdAttribute(runtime_typecast_1.asNumber(attr.id_attribute));
newInstanceAttr.setIdAttribute(ts_runtime_typecheck_1.asNumber(attr.id_attribute));
newInstanceAttr.setValue(attr.value);

@@ -52,0 +52,0 @@ request.addInstanceattributes(newInstanceAttr);

@@ -6,3 +6,3 @@ "use strict";

const package_json_1 = require("../../package.json");
const runtime_typecast_1 = require("../runtime-typecast");
const ts_runtime_typecheck_1 = require("ts-runtime-typecheck");
let fetchMethod = fetch_1.fetch;

@@ -27,3 +27,3 @@ function stubFetch(replacement) {

const jsonResponse = await (allowNull ? tryReadAsJson(response) : response.json());
if (runtime_typecast_1.isRecord(jsonResponse) && runtime_typecast_1.isString(jsonResponse.error)) {
if (ts_runtime_typecheck_1.isRecord(jsonResponse) && ts_runtime_typecheck_1.isString(jsonResponse.error)) {
throw new Error(jsonResponse.error);

@@ -82,3 +82,3 @@ }

function encodeBody(rawBody, encoding) {
if (runtime_typecast_1.isRecord(rawBody)) {
if (ts_runtime_typecheck_1.isRecord(rawBody)) {
if (encoding === 'json') {

@@ -85,0 +85,0 @@ return JSON.stringify(rawBody);

@@ -15,3 +15,3 @@ "use strict";

const crypto_1 = __importDefault(require("crypto"));
const runtime_typecast_1 = require("../runtime-typecast");
const ts_runtime_typecheck_1 = require("ts-runtime-typecheck");
function signMessage(headers, createMessage, { apikey, apisecret }, forceUppercaseHeaders = false) {

@@ -22,3 +22,3 @@ headers.set('X-EPI2ME-ApiKey', apikey);

.sort()
.filter((o) => runtime_typecast_1.asString(o).match(/^x-epi2me/i));
.filter((o) => ts_runtime_typecheck_1.asString(o).match(/^x-epi2me/i));
// Case matters. Uppercase for gql. Else for portal.

@@ -25,0 +25,0 @@ const message = createMessage(keys.map((key) => `${forceUppercaseHeaders ? key.toUpperCase() : key}:${headers.get(key)}`)).join('\n');

@@ -7,14 +7,14 @@ "use strict";

exports.parseCoreOpts = void 0;
const runtime_typecast_1 = require("./runtime-typecast");
const Logger_1 = require("./Logger");
const package_json_1 = require("../package.json");
const default_options_json_1 = __importDefault(require("./default_options.json"));
const ts_runtime_typecheck_1 = require("ts-runtime-typecheck");
function resolveLogger(log) {
if (runtime_typecast_1.isRecord(log)) {
if (ts_runtime_typecheck_1.isRecord(log)) {
try {
return {
info: runtime_typecast_1.asFunction(log.info),
debug: runtime_typecast_1.asFunction(log.debug),
warn: runtime_typecast_1.asFunction(log.warn),
error: runtime_typecast_1.asFunction(log.error),
info: ts_runtime_typecheck_1.asFunction(log.info),
debug: ts_runtime_typecheck_1.asFunction(log.debug),
warn: ts_runtime_typecheck_1.asFunction(log.warn),
error: ts_runtime_typecheck_1.asFunction(log.error),
};

@@ -32,17 +32,17 @@ }

// URL preference is opt.endpoint > opt.url > DEFAULT.url
const legacyURL = runtime_typecast_1.asString(opt.url, default_options_json_1.default.url);
const legacyURL = ts_runtime_typecheck_1.asString(opt.url, default_options_json_1.default.url);
return {
// Return to calling utils.version when utils no longer signs
agent_version: runtime_typecast_1.asString(opt.agent_version, package_json_1.version),
agent_version: ts_runtime_typecheck_1.asString(opt.agent_version, package_json_1.version),
log: resolveLogger(opt.log),
local: runtime_typecast_1.asBoolean(opt.local, default_options_json_1.default.local),
url: runtime_typecast_1.asString(opt.endpoint, legacyURL),
user_agent: runtime_typecast_1.asString(opt.user_agent, default_options_json_1.default.user_agent),
signing: runtime_typecast_1.asBoolean(opt.signing, default_options_json_1.default.signing),
local: ts_runtime_typecheck_1.asBoolean(opt.local, default_options_json_1.default.local),
url: ts_runtime_typecheck_1.asString(opt.endpoint, legacyURL),
user_agent: ts_runtime_typecheck_1.asString(opt.user_agent, default_options_json_1.default.user_agent),
signing: ts_runtime_typecheck_1.asBoolean(opt.signing, default_options_json_1.default.signing),
// Optional Values
apikey: runtime_typecast_1.asOptString(opt.apikey),
apisecret: runtime_typecast_1.asOptString(opt.apisecret),
jwt: runtime_typecast_1.asOptString(opt.jwt),
apikey: ts_runtime_typecheck_1.asOptString(opt.apikey),
apisecret: ts_runtime_typecheck_1.asOptString(opt.apisecret),
jwt: ts_runtime_typecheck_1.asOptString(opt.jwt),
};
}
exports.parseCoreOpts = parseCoreOpts;

@@ -13,5 +13,5 @@ "use strict";

const path_1 = __importDefault(require("path"));
const ts_runtime_typecheck_1 = require("ts-runtime-typecheck");
const rest_1 = require("./rest");
const utils_fs_1 = require("./utils-fs");
const runtime_typecast_1 = require("./runtime-typecast");
class REST_FS extends rest_1.REST {

@@ -58,6 +58,6 @@ async workflows(cb) {

if (!this.options.local) {
if (runtime_typecast_1.isFunction(first) || second) {
if (ts_runtime_typecheck_1.isFunction(first) || second) {
throw new Error('Local workflows cannot accept a callback');
}
return super.workflowInstances(runtime_typecast_1.asOptRecord(first));
return super.workflowInstances(ts_runtime_typecheck_1.asOptRecord(first));
}

@@ -71,3 +71,3 @@ let cb;

else {
cb = runtime_typecast_1.asOptFunction(first);
cb = ts_runtime_typecheck_1.asOptFunction(first);
query = second;

@@ -114,3 +114,3 @@ }

else {
cb = runtime_typecast_1.asFunction(first);
cb = ts_runtime_typecheck_1.asFunction(first);
query = second !== null && second !== void 0 ? second : {};

@@ -125,3 +125,3 @@ }

}
return super.datasets(runtime_typecast_1.asRecord(first));
return super.datasets(ts_runtime_typecheck_1.asRecord(first));
}

@@ -128,0 +128,0 @@ if (query.show !== 'mine') {

@@ -14,3 +14,3 @@ "use strict";

const utils_1 = require("./utils");
const runtime_typecast_1 = require("./runtime-typecast");
const ts_runtime_typecheck_1 = require("ts-runtime-typecheck");
class REST {

@@ -28,3 +28,3 @@ constructor(options) {

const json = await utils_1.utils.get(entity, this.options);
return runtime_typecast_1.asArray(json[`${entityName[0]}s`]);
return ts_runtime_typecheck_1.asArray(json[`${entityName[0]}s`]);
}

@@ -51,9 +51,9 @@ read(entity, id) {

return {
agent_url: runtime_typecast_1.asString(res.agent_url),
agent_version: runtime_typecast_1.asString(res.agent_version),
db_version: runtime_typecast_1.asString(res.db_version),
minimum_agent: runtime_typecast_1.asString(res.minimum_agent),
portal_version: runtime_typecast_1.asString(res.portal_version),
remote_addr: runtime_typecast_1.asString(res.remote_addr),
server_time: runtime_typecast_1.asString(res.server_time),
agent_url: ts_runtime_typecheck_1.asString(res.agent_url),
agent_version: ts_runtime_typecheck_1.asString(res.agent_version),
db_version: ts_runtime_typecheck_1.asString(res.db_version),
minimum_agent: ts_runtime_typecheck_1.asString(res.minimum_agent),
portal_version: ts_runtime_typecheck_1.asString(res.portal_version),
remote_addr: ts_runtime_typecheck_1.asString(res.remote_addr),
server_time: ts_runtime_typecheck_1.asString(res.server_time),
};

@@ -69,3 +69,3 @@ }

const result = await utils_1.utils.post('authenticate', {}, Object.assign(Object.assign({}, this.options), { handler: customJWTHandler }));
return runtime_typecast_1.asString(result);
return ts_runtime_typecheck_1.asString(result);
}

@@ -121,11 +121,11 @@ async instanceToken(id, opts) {

if (second instanceof Object) {
return this.updateAmiImage(runtime_typecast_1.asString(first), runtime_typecast_1.asRecord(second));
return this.updateAmiImage(ts_runtime_typecheck_1.asString(first), ts_runtime_typecheck_1.asRecord(second));
// if we have 1 object argument then perform create
}
else if (first instanceof Object) {
return utils_1.utils.post('ami_image', runtime_typecast_1.asRecord(first), this.options);
return utils_1.utils.post('ami_image', ts_runtime_typecheck_1.asRecord(first), this.options);
// otherwise we should have 1 string argument
}
else {
return this.read('ami_image', runtime_typecast_1.asString(first));
return this.read('ami_image', ts_runtime_typecheck_1.asString(first));
}

@@ -144,16 +144,16 @@ }

if (first && second && third instanceof Function) {
return this.updateWorkflow(runtime_typecast_1.asString(first), runtime_typecast_1.asRecord(second), third);
return this.updateWorkflow(ts_runtime_typecheck_1.asString(first), ts_runtime_typecheck_1.asRecord(second), third);
}
else if (first && second instanceof Object && !(second instanceof Function)) {
return this.updateWorkflow(runtime_typecast_1.asString(first), runtime_typecast_1.asRecord(second));
return this.updateWorkflow(ts_runtime_typecheck_1.asString(first), ts_runtime_typecheck_1.asRecord(second));
}
else if (first instanceof Object && second instanceof Function) {
return this.createWorkflow(runtime_typecast_1.asRecord(first), second);
return this.createWorkflow(ts_runtime_typecheck_1.asRecord(first), second);
}
else if (first instanceof Object && !second) {
return this.createWorkflow(runtime_typecast_1.asRecord(first));
return this.createWorkflow(ts_runtime_typecheck_1.asRecord(first));
}
// read with callback or promise
const id = runtime_typecast_1.asOptString(first);
const cb = runtime_typecast_1.asOptFunction(second);
const id = ts_runtime_typecheck_1.asOptString(first);
const cb = ts_runtime_typecheck_1.asOptFunction(second);
// two args: get object: (123, func)

@@ -200,16 +200,16 @@ if (!id) {

// NOTE it would appear that params can be either an array or an object, the tests are not consistent
const params = runtime_typecast_1.isArray(workflow.params) ? runtime_typecast_1.asArray(workflow.params) : runtime_typecast_1.asRecord(workflow.params);
const params = ts_runtime_typecheck_1.isArray(workflow.params) ? ts_runtime_typecheck_1.asArray(workflow.params) : ts_runtime_typecheck_1.asRecord(workflow.params);
// MC-6483 - fetch ajax options for "AJAX drop down widget"
const toFetch = Object.values(params)
.map((value) => runtime_typecast_1.asRecord(value))
.map((value) => ts_runtime_typecheck_1.asRecord(value))
.filter((obj) => obj.widget === 'ajax_dropdown');
const promises = [
...toFetch.map(async (param) => {
if (runtime_typecast_1.isUndefined(param)) {
if (ts_runtime_typecheck_1.isUndefined(param)) {
// NOTE should be unreachable
throw new Error('parameter is undefined');
}
const values = runtime_typecast_1.asRecord(param.values);
const items = runtime_typecast_1.asRecord(values.items);
const uri = runtime_typecast_1.asString(values.source)
const values = ts_runtime_typecheck_1.asRecord(param.values);
const items = ts_runtime_typecheck_1.asRecord(values.items);
const uri = ts_runtime_typecheck_1.asString(values.source)
.replace('{{EPI2ME_HOST}}', '')

@@ -231,10 +231,10 @@ .replace(/&?apikey=\{\{EPI2ME_API_KEY\}\}/, '');

// NOTE unclear if data_root is number | string
const index = runtime_typecast_1.asOptIndex(values.data_root);
const index = ts_runtime_typecheck_1.asOptIndex(values.data_root);
// NOTE dataRoot appears to be an array of object/arrays
const dataRoot = runtime_typecast_1.asOptArrayRecursive(runtime_typecast_1.isUndefined(index) ? index : workflowParam[index], runtime_typecast_1.asIndexable); // e.g. [{dataset},{dataset}]
const dataRoot = ts_runtime_typecheck_1.isDefined(index) && ts_runtime_typecheck_1.asOptArrayRecursive(ts_runtime_typecheck_1.asIndexable)(workflowParam[index]); // e.g. [{dataset},{dataset}]
if (dataRoot) {
param.values = dataRoot.map((o) => ({
// does this really end up back in workflow object?
label: o[runtime_typecast_1.asIndex(items.label_key)],
value: o[runtime_typecast_1.asIndex(items.value_key)],
label: o[ts_runtime_typecheck_1.asIndex(items.label_key)],
value: o[ts_runtime_typecheck_1.asIndex(items.value_key)],
}));

@@ -297,3 +297,3 @@ }

const json = await utils_1.utils.get(`workflow_instance/wi?show=all&columns[0][name]=run_id;columns[0][searchable]=true;columns[0][search][regex]=true;columns[0][search][value]=${query.run_id};`, this.options);
const data = runtime_typecast_1.asArrayRecursive(json.data, runtime_typecast_1.asRecord);
const data = ts_runtime_typecheck_1.asArrayRecursive(ts_runtime_typecheck_1.asRecord)(json.data);
return data.map((o) => ({

@@ -326,3 +326,3 @@ id_workflow_instance: o.id_ins,

async datasets(query = {}) {
if (runtime_typecast_1.isFunction(query)) {
if (ts_runtime_typecheck_1.isFunction(query)) {
throw new Error('Unexpected callback instead of query');

@@ -335,3 +335,3 @@ }

const sets = await this.list(`dataset?show=${query.show}`);
return runtime_typecast_1.asArrayRecursive(sets, runtime_typecast_1.asRecord);
return ts_runtime_typecheck_1.asArrayRecursive(ts_runtime_typecheck_1.asRecord)(sets);
}

@@ -342,3 +342,3 @@ async dataset(id) {

}
const datasets = runtime_typecast_1.asArrayRecursive(await this.datasets(), runtime_typecast_1.asRecord);
const datasets = ts_runtime_typecheck_1.asArrayRecursive(ts_runtime_typecheck_1.asRecord)(await this.datasets());
return datasets.find((o) => o.id_dataset === id);

@@ -345,0 +345,0 @@ }

@@ -8,3 +8,3 @@ "use strict";

const proxy_agent_1 = __importDefault(require("proxy-agent")); // odd one out
const runtime_typecast_1 = require("./runtime-typecast");
const ts_runtime_typecheck_1 = require("ts-runtime-typecheck");
class SessionManager {

@@ -34,3 +34,3 @@ constructor(idWorkflowInstance, REST, children, opts, graphQL) {

const result = await this.graphQL.instanceToken(instanceTokenOptions);
token = runtime_typecast_1.asRecord((_a = result.data) === null || _a === void 0 ? void 0 : _a.token);
token = ts_runtime_typecheck_1.asRecord((_a = result.data) === null || _a === void 0 ? void 0 : _a.token);
}

@@ -40,3 +40,3 @@ else {

}
if (!runtime_typecast_1.isIndex(token.expiration) && !(token.expiration instanceof Date)) {
if (!ts_runtime_typecheck_1.isIndex(token.expiration) && !(token.expiration instanceof Date)) {
throw new Error('Invalid token expiration type');

@@ -43,0 +43,0 @@ }

@@ -33,6 +33,6 @@ "use strict";

const crypto_1 = __importDefault(require("crypto"));
const ts_runtime_typecheck_1 = require("ts-runtime-typecheck");
const tunnel = __importStar(require("tunnel"));
const package_json_1 = require("../package.json");
const Logger_1 = require("./Logger");
const runtime_typecast_1 = require("./runtime-typecast");
axios_1.default.defaults.validateStatus = (status) => status <= 504; // Reject only if the status code is greater than or equal to 500

@@ -82,3 +82,3 @@ exports.utils = (function magic() {

responseHandler(r) {
const json = r && runtime_typecast_1.isRecord(r.data) ? r.data : null;
const json = r && ts_runtime_typecheck_1.isRecord(r.data) ? r.data : null;
if (r && r.status >= 400) {

@@ -85,0 +85,0 @@ let msg = `Network error ${r.status}`;

@@ -16,3 +16,3 @@ /* eslint no-console: ["error", { allow: ["log", "info", "debug", "warn", "error"] }] */

import { utils } from './utils';
import { asRecord, asOptString, asOptBoolean, asString, asNumber, asArrayRecursive, asBoolean, asOptNumber, asIndexable, asIndex, asOptFunction, asOptRecord, asOptIndex, } from './runtime-typecast';
import { asRecord, asOptString, asOptBoolean, asString, asNumber, asArrayRecursive, asBoolean, asOptNumber, asIndexable, asIndex, asOptFunction, asOptRecord, asOptIndex, } from 'ts-runtime-typecheck';
import { createUploadState, createDownloadState, } from './epi2me-state';

@@ -77,7 +77,7 @@ import { createInterval } from './timers';

static parseOptObject(opt) {
const options = Object.assign(Object.assign({}, parseCoreOpts(opt)), { region: asString(opt.region, DEFAULTS.region), sessionGrace: asNumber(opt.sessionGrace, DEFAULTS.sessionGrace), uploadTimeout: asNumber(opt.uploadTimeout, DEFAULTS.uploadTimeout), downloadTimeout: asNumber(opt.downloadTimeout, DEFAULTS.downloadTimeout), fileCheckInterval: asNumber(opt.fileCheckInterval, DEFAULTS.fileCheckInterval), downloadCheckInterval: asNumber(opt.downloadCheckInterval, DEFAULTS.downloadCheckInterval), stateCheckInterval: asNumber(opt.stateCheckInterval, DEFAULTS.stateCheckInterval), inFlightDelay: asNumber(opt.inFlightDelay, DEFAULTS.inFlightDelay), waitTimeSeconds: asNumber(opt.waitTimeSeconds, DEFAULTS.waitTimeSeconds), waitTokenError: asNumber(opt.waitTokenError, DEFAULTS.waitTokenError), transferPoolSize: asNumber(opt.transferPoolSize, DEFAULTS.transferPoolSize), downloadMode: asString(opt.downloadMode, DEFAULTS.downloadMode), filetype: asArrayRecursive(opt.filetype, asString, DEFAULTS.filetype), sampleDirectory: asString(opt.sampleDirectory, DEFAULTS.sampleDirectory),
const options = Object.assign(Object.assign({}, parseCoreOpts(opt)), { region: asString(opt.region, DEFAULTS.region), sessionGrace: asNumber(opt.sessionGrace, DEFAULTS.sessionGrace), uploadTimeout: asNumber(opt.uploadTimeout, DEFAULTS.uploadTimeout), downloadTimeout: asNumber(opt.downloadTimeout, DEFAULTS.downloadTimeout), fileCheckInterval: asNumber(opt.fileCheckInterval, DEFAULTS.fileCheckInterval), downloadCheckInterval: asNumber(opt.downloadCheckInterval, DEFAULTS.downloadCheckInterval), stateCheckInterval: asNumber(opt.stateCheckInterval, DEFAULTS.stateCheckInterval), inFlightDelay: asNumber(opt.inFlightDelay, DEFAULTS.inFlightDelay), waitTimeSeconds: asNumber(opt.waitTimeSeconds, DEFAULTS.waitTimeSeconds), waitTokenError: asNumber(opt.waitTokenError, DEFAULTS.waitTokenError), transferPoolSize: asNumber(opt.transferPoolSize, DEFAULTS.transferPoolSize), downloadMode: asString(opt.downloadMode, DEFAULTS.downloadMode), filetype: asArrayRecursive(asString)(opt.filetype, DEFAULTS.filetype), sampleDirectory: asString(opt.sampleDirectory, DEFAULTS.sampleDirectory),
// optional values
useGraphQL: asOptBoolean(opt.useGraphQL), id_workflow_instance: asOptIndex(opt.id_workflow_instance), debounceWindow: asOptNumber(opt.debounceWindow), proxy: asOptString(opt.proxy),
// EPI2ME-FS options
inputFolders: asArrayRecursive(opt.inputFolders, asString, []), outputFolder: asOptString(opt.outputFolder), awsAcceleration: asOptString(opt.awsAcceleration), agent_address: asOptString(opt.agent_address), telemetryCb: asOptFunction(opt.telemetryCb), dataCb: asOptFunction(opt.dataCb), remoteShutdownCb: asOptFunction(opt.remoteShutdownCb) });
inputFolders: asArrayRecursive(asString)(opt.inputFolders, []), outputFolder: asOptString(opt.outputFolder), awsAcceleration: asOptString(opt.awsAcceleration), agent_address: asOptString(opt.agent_address), telemetryCb: asOptFunction(opt.telemetryCb), dataCb: asOptFunction(opt.dataCb), remoteShutdownCb: asOptFunction(opt.remoteShutdownCb) });
if (opt.inputFolder) {

@@ -395,3 +395,3 @@ options.inputFolders.push(asString(opt.inputFolder));

case 'filetype':
this.config.options[key] = asArrayRecursive(value, asString);
this.config.options[key] = asArrayRecursive(asString)(value);
break;

@@ -398,0 +398,0 @@ default:

@@ -6,3 +6,3 @@ import path from 'path';

import fastqgz from './filestats/fastqgz';
import { isUndefined } from './runtime-typecast';
import { isUndefined } from 'ts-runtime-typecheck';
const mapping = new Map([

@@ -9,0 +9,0 @@ ['fastq', fastq],

@@ -24,3 +24,3 @@ /*

import { fetch, Headers } from './network/fetch';
import { asBoolean } from './runtime-typecast';
import { asBoolean } from 'ts-runtime-typecheck';
import { writeCommonHeaders } from './network';

@@ -27,0 +27,0 @@ import { parseCoreOpts } from './parseCoreOpts';

@@ -7,3 +7,3 @@ import { Empty } from 'google-protobuf/google/protobuf/empty_pb';

import { Workflow } from '../../../protos/workflow_pb_service';
import { asNumber, asString } from '../../runtime-typecast';
import { asNumber, asString } from 'ts-runtime-typecheck';
import { createGrpcRequest$ } from '../utils';

@@ -10,0 +10,0 @@ export class WorkflowApi {

import { fetch, Request, Headers } from './fetch';
import { version as API_VERSION } from '../../package.json';
import { isRecord, isString } from '../runtime-typecast';
import { isRecord, isString } from 'ts-runtime-typecheck';
let fetchMethod = fetch;

@@ -5,0 +5,0 @@ export function stubFetch(replacement) {

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

import crypto from 'crypto';
import { asString } from '../runtime-typecast';
import { asString } from 'ts-runtime-typecheck';
export function signMessage(headers, createMessage, { apikey, apisecret }, forceUppercaseHeaders = false) {

@@ -12,0 +12,0 @@ headers.set('X-EPI2ME-ApiKey', apikey);

@@ -1,5 +0,5 @@

import { asString, isRecord, asBoolean, asOptString, asFunction } from './runtime-typecast';
import { FallbackLogger } from './Logger';
import { version as VERSION } from '../package.json';
import DEFAULTS from './default_options.json';
import { isRecord, asFunction, asString, asBoolean, asOptString } from 'ts-runtime-typecheck';
function resolveLogger(log) {

@@ -6,0 +6,0 @@ if (isRecord(log)) {

@@ -7,5 +7,5 @@ /*

import path from 'path';
import { asOptRecord, asOptFunction, asFunction, asRecord, isFunction } from 'ts-runtime-typecheck';
import { REST } from './rest';
import { utilsFS as utils } from './utils-fs';
import { isFunction, asFunction, asRecord, asOptFunction, asOptRecord } from './runtime-typecast';
export class REST_FS extends REST {

@@ -12,0 +12,0 @@ async workflows(cb) {

@@ -8,3 +8,3 @@ /*

import { utils } from './utils';
import { asArray, asRecord, asString, asArrayRecursive, isUndefined, isFunction, isArray, asIndex, asIndexable, asOptArrayRecursive, asOptIndex, asOptString, asOptFunction, } from './runtime-typecast';
import { asArray, asArrayRecursive, asIndex, asIndexable, asOptArrayRecursive, asOptFunction, asOptIndex, asOptString, asRecord, asString, isArray, isFunction, isUndefined, isDefined, } from 'ts-runtime-typecheck';
export class REST {

@@ -221,3 +221,3 @@ constructor(options) {

// NOTE dataRoot appears to be an array of object/arrays
const dataRoot = asOptArrayRecursive(isUndefined(index) ? index : workflowParam[index], asIndexable); // e.g. [{dataset},{dataset}]
const dataRoot = isDefined(index) && asOptArrayRecursive(asIndexable)(workflowParam[index]); // e.g. [{dataset},{dataset}]
if (dataRoot) {

@@ -285,3 +285,3 @@ param.values = dataRoot.map((o) => ({

const json = await utils.get(`workflow_instance/wi?show=all&columns[0][name]=run_id;columns[0][searchable]=true;columns[0][search][regex]=true;columns[0][search][value]=${query.run_id};`, this.options);
const data = asArrayRecursive(json.data, asRecord);
const data = asArrayRecursive(asRecord)(json.data);
return data.map((o) => ({

@@ -322,3 +322,3 @@ id_workflow_instance: o.id_ins,

const sets = await this.list(`dataset?show=${query.show}`);
return asArrayRecursive(sets, asRecord);
return asArrayRecursive(asRecord)(sets);
}

@@ -329,3 +329,3 @@ async dataset(id) {

}
const datasets = asArrayRecursive(await this.datasets(), asRecord);
const datasets = asArrayRecursive(asRecord)(await this.datasets());
return datasets.find((o) => o.id_dataset === id);

@@ -332,0 +332,0 @@ }

import { merge } from 'lodash';
import proxy from 'proxy-agent'; // odd one out
import { isIndex, asRecord } from './runtime-typecast';
import { asRecord, isIndex } from 'ts-runtime-typecheck';
export default class SessionManager {

@@ -5,0 +5,0 @@ constructor(idWorkflowInstance, REST, children, opts, graphQL) {

@@ -8,6 +8,6 @@ /*

import crypto from 'crypto';
import { isRecord } from 'ts-runtime-typecheck';
import * as tunnel from 'tunnel';
import { version as VERSION } from '../package.json';
import { NoopLogger } from './Logger';
import { isRecord } from './runtime-typecast';
axios.defaults.validateStatus = (status) => status <= 504; // Reject only if the status code is greater than or equal to 500

@@ -14,0 +14,0 @@ export const utils = (function magic() {

@@ -12,3 +12,3 @@ {

"private": false,
"version": "4.0.4331484",
"version": "4.0.4366893",
"main": "cjs/index-web.js",

@@ -25,4 +25,5 @@ "module": "esm/index-web.js",

"graphql-tag": "^2.11.0",
"rxjs": "^6.3.1"
"rxjs": "^6.3.1",
"ts-runtime-typecheck": "^1.1.1"
}
}

@@ -1,3 +0,3 @@

import { Logger } from './Logger';
import { Index } from './runtime-typecast';
import type { Logger } from './Logger';
import type { Index } from 'ts-runtime-typecheck';
export interface EPI2ME_OPTIONS {

@@ -4,0 +4,0 @@ agent_version: string;

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

import { ObjectDict } from './ObjectDict';
import { Index } from './runtime-typecast';
import type { Index, Dictionary } from 'ts-runtime-typecheck';
export interface InstanceAttribute {

@@ -15,4 +14,4 @@ id_attribute: Index;

region?: string;
userDefined?: ObjectDict<ObjectDict>;
userDefined?: Dictionary<Dictionary>;
instanceAttributes?: InstanceAttribute[];
}

@@ -1,5 +0,5 @@

import { Index } from './runtime-typecast';
import { Index } from 'ts-runtime-typecheck';
import type { Logger } from './Logger';
import type { DocumentNode } from 'graphql';
import type { ObjectDict } from './ObjectDict';
import type { Dictionary } from 'ts-runtime-typecheck';
import type { ApolloQueryResult, FetchResult, NormalizedCacheObject, ApolloClient } from '@apollo/client/core';

@@ -26,3 +26,3 @@ import type { EPI2ME_OPTIONS } from './epi2me-options';

}
export interface QueryOptions<Var = ObjectDict, Ctx = ObjectDict, Opt = ObjectDict> {
export interface QueryOptions<Var = Dictionary, Ctx = Dictionary, Opt = Dictionary> {
context?: Ctx;

@@ -44,3 +44,3 @@ variables?: Var;

initClient: () => ApolloClient<NormalizedCacheObject>;
createContext: (contextIn: ObjectDict) => RequestContext;
createContext: (contextIn: Dictionary) => RequestContext;
query<T = unknown, Var extends {} = {}>(queryString: ((str: string) => DocumentNode) | string | DocumentNode): (opt?: QueryOptions<Var>) => AsyncAQR<T>;

@@ -84,3 +84,3 @@ mutate<T = unknown, Var extends {} = {}>(queryString: string | DocumentNode): (opt?: QueryOptions<Var>) => Promise<FetchResult<T>>;

region?: string | undefined;
userDefined?: Record<string, Record<string, unknown> | undefined> | undefined;
userDefined?: Record<string, Record<string, unknown>> | undefined;
instanceAttributes?: InstanceAttribute[] | undefined;

@@ -87,0 +87,0 @@ }, Record<string, unknown>, Record<string, unknown>> | undefined) => Promise<FetchResult<ResponseStartWorkflow, Record<string, any>, Record<string, any>>>;

@@ -1,5 +0,4 @@

import { ObjectDict } from './ObjectDict';
import { Index } from './runtime-typecast';
import type { Dictionary, Index } from 'ts-runtime-typecheck';
import type { InstanceAttribute } from './factory.type';
export declare function buildNestedUserDefined(flatUserDefined: ObjectDict): ObjectDict<ObjectDict>;
export declare function buildNestedUserDefined(flatUserDefined: Dictionary): Dictionary<Dictionary>;
export declare function validateAndAddAttribute(attributeValue: string, instanceAttributes: InstanceAttribute[], attributeDef: {

@@ -6,0 +5,0 @@ idAttribute: Index;

import type { RequestOptions } from './RequestOptions';
import type { Body } from './Body';
import type { ObjectDict } from '../ObjectDict';
import type { Dictionary } from 'ts-runtime-typecheck';
export interface NetworkInterface {
head(uri: string, options: RequestOptions): Promise<Response>;
get(uri: string, options: RequestOptions): Promise<unknown>;
put(uri: string, body: Body | ObjectDict, options: RequestOptions): Promise<unknown>;
post(uri: string, body: Body | ObjectDict, options: RequestOptions): Promise<unknown>;
put(uri: string, body: Body | Dictionary, options: RequestOptions): Promise<unknown>;
post(uri: string, body: Body | Dictionary, options: RequestOptions): Promise<unknown>;
}

@@ -1,5 +0,5 @@

import { ObjectDict } from './ObjectDict';
import { EPI2ME_OPTIONS } from './epi2me-options';
import type { EPI2ME_OPTIONS } from './epi2me-options';
import type { Dictionary } from 'ts-runtime-typecheck';
import { Logger } from './Logger';
export declare function parseCoreOpts(opt: ObjectDict | Partial<EPI2ME_OPTIONS>): {
export declare function parseCoreOpts(opt: Dictionary | Partial<EPI2ME_OPTIONS>): {
url: string;

@@ -6,0 +6,0 @@ apikey?: string;

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

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

Sorry, the diff of this file is not supported yet

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

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