@metrichor/epi2me-web
Advanced tools
Comparing version 5.1.6058802 to 5.1.6089492
@@ -984,3 +984,2 @@ "use strict"; | ||
exports.EPI2ME_FS = EPI2ME_FS; | ||
EPI2ME_FS.version = utils_fs_1.utilsFS.version; | ||
EPI2ME_FS.REST = rest_fs_1.REST_FS; | ||
@@ -987,0 +986,0 @@ EPI2ME_FS.utils = utils_fs_1.utilsFS; |
@@ -19,2 +19,3 @@ "use strict"; | ||
const NodeError_1 = require("./NodeError"); | ||
const default_options_1 = require("./default_options"); | ||
class EPI2ME { | ||
@@ -340,3 +341,3 @@ constructor(optstring = {}) { | ||
exports.EPI2ME = EPI2ME; | ||
EPI2ME.version = utils_1.utils.version; | ||
EPI2ME.version = default_options_1.DEFAULT_OPTIONS.agent_version; | ||
EPI2ME.utils = utils_1.utils; |
@@ -227,3 +227,3 @@ "use strict"; | ||
// GraphQLFS | ||
const { apikey, apisecret, jwt, log, local, signing, url: originalUrl, agent_version: agentVersion, user_agent: userAgent, } = (0, parseOptions_1.parseCoreOptions)(opts); | ||
const { apikey, apisecret, jwt, log, local, signing, url: originalUrl, agent_version: agentVersion, } = (0, parseOptions_1.parseCoreOptions)(opts); | ||
// https://epi2me-dev.bla => https://graphql.epi2me-dev.bla | ||
@@ -236,3 +236,2 @@ const url = originalUrl.replace(/:\/\//, '://graphql.'); | ||
local, | ||
user_agent: userAgent, | ||
signing, | ||
@@ -239,0 +238,0 @@ apikey, |
@@ -27,2 +27,3 @@ "use strict"; | ||
__exportStar(require("./index.type"), exports); | ||
const default_options_1 = require("./default_options"); | ||
const epi2me_fs_1 = require("./epi2me-fs"); | ||
@@ -48,3 +49,3 @@ Object.defineProperty(exports, "EPI2ME", { enumerable: true, get: function () { return epi2me_fs_1.EPI2ME_FS; } }); | ||
exports.FileExtension = __importStar(require("./file_extensions")); | ||
exports.version = utils_fs_1.utilsFS.version; | ||
exports.version = default_options_1.DEFAULT_OPTIONS.agent_version; | ||
exports.EPI2ME_HOME = epi2me_fs_1.EPI2ME_FS.EPI2ME_HOME; |
@@ -6,3 +6,3 @@ "use strict"; | ||
const ProfileManager_1 = require("./ProfileManager"); | ||
const default_options_json_1 = require("./default_options.json"); | ||
const default_options_1 = require("./default_options"); | ||
// WARN uses Node.js stuff here | ||
@@ -15,3 +15,3 @@ const fs_1 = require("fs"); | ||
function getDefaultEndpoint() { | ||
return process.env.METRICHOR || default_options_json_1.url; | ||
return process.env.METRICHOR || default_options_1.DEFAULT_OPTIONS.url; | ||
} | ||
@@ -18,0 +18,0 @@ function getDefaultProfilePath() { |
@@ -5,4 +5,5 @@ "use strict"; | ||
const fetch_1 = require("./fetch"); | ||
const package_json_1 = require("../../package.json"); | ||
const ts_runtime_typecheck_1 = require("ts-runtime-typecheck"); | ||
const default_options_1 = require("../default_options"); | ||
const UserAgent_constants_1 = require("../UserAgent.constants"); | ||
let fetchMethod = fetch_1.fetch; | ||
@@ -45,8 +46,8 @@ function stubFetch(replacement) { | ||
function writeCommonHeaders(options = {}) { | ||
var _a, _b; | ||
var _a; | ||
const headers = new fetch_1.Headers(); | ||
headers.set('Accept', 'application/json'); | ||
headers.set('Content-Type', 'application/json'); | ||
headers.set('X-EPI2ME-Client', (_a = options.user_agent) !== null && _a !== void 0 ? _a : 'api'); | ||
headers.set('X-EPI2ME-Version', (_b = options.agent_version) !== null && _b !== void 0 ? _b : package_json_1.version); | ||
headers.set('X-EPI2ME-Client', UserAgent_constants_1.USER_AGENT); | ||
headers.set('X-EPI2ME-Version', (_a = options.agent_version) !== null && _a !== void 0 ? _a : default_options_1.DEFAULT_OPTIONS.agent_version); | ||
if (options.headers) { | ||
@@ -53,0 +54,0 @@ for (const [key, value] of Object.entries(options.headers)) { |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parseOptions = exports.parseCoreOptions = exports.trimTrailingSlash = void 0; | ||
const Logger_1 = require("./Logger"); | ||
const package_json_1 = require("../package.json"); | ||
const default_options_json_1 = __importDefault(require("./default_options.json")); | ||
const default_options_1 = require("./default_options"); | ||
const ts_runtime_typecheck_1 = require("ts-runtime-typecheck"); | ||
@@ -38,11 +34,9 @@ const Duration_1 = require("./Duration"); | ||
var _a, _b; | ||
const url = (_b = (_a = opt.endpoint) !== null && _a !== void 0 ? _a : opt.url) !== null && _b !== void 0 ? _b : default_options_json_1.default.url; | ||
const url = (_b = (_a = opt.endpoint) !== null && _a !== void 0 ? _a : opt.url) !== null && _b !== void 0 ? _b : default_options_1.DEFAULT_OPTIONS.url; | ||
return { | ||
url: url.endsWith('/') ? url.slice(0, -1) : url, | ||
// Return to calling utils.version when utils no longer signs | ||
agent_version: (0, ts_runtime_typecheck_1.asString)(opt.agent_version, package_json_1.version), | ||
agent_version: (0, ts_runtime_typecheck_1.asString)(opt.agent_version, default_options_1.DEFAULT_OPTIONS.agent_version), | ||
log: resolveLogger(opt.log), | ||
local: (0, ts_runtime_typecheck_1.asBoolean)(opt.local, default_options_json_1.default.local), | ||
user_agent: (0, ts_runtime_typecheck_1.asString)(opt.user_agent, default_options_json_1.default.user_agent), | ||
signing: (0, ts_runtime_typecheck_1.asBoolean)(opt.signing, default_options_json_1.default.signing), | ||
local: (0, ts_runtime_typecheck_1.asBoolean)(opt.local, default_options_1.DEFAULT_OPTIONS.local), | ||
signing: (0, ts_runtime_typecheck_1.asBoolean)(opt.signing, default_options_1.DEFAULT_OPTIONS.signing), | ||
// Optional Values | ||
@@ -56,3 +50,3 @@ apikey: (0, ts_runtime_typecheck_1.asOptString)(opt.apikey), | ||
function parseOptions(opt) { | ||
const downloadMode = (0, ts_runtime_typecheck_1.asString)(opt.downloadMode, default_options_json_1.default.downloadMode); | ||
const downloadMode = (0, ts_runtime_typecheck_1.asString)(opt.downloadMode, default_options_1.DEFAULT_OPTIONS.downloadMode); | ||
switch (downloadMode) { | ||
@@ -67,5 +61,5 @@ case 'data': | ||
} | ||
const options = Object.assign(Object.assign({}, parseCoreOptions(opt)), { region: (0, ts_runtime_typecheck_1.asString)(opt.region, default_options_json_1.default.region), sessionGrace: Duration_1.Duration.Seconds((0, ts_runtime_typecheck_1.asNumber)(opt.sessionGrace, default_options_json_1.default.sessionGrace)), uploadTimeout: Duration_1.Duration.Seconds((0, ts_runtime_typecheck_1.asNumber)(opt.uploadTimeout, default_options_json_1.default.uploadTimeout)), uploadRetries: (0, ts_runtime_typecheck_1.asNumber)(opt.uploadRetries, default_options_json_1.default.uploadRetries), downloadTimeout: Duration_1.Duration.Seconds((0, ts_runtime_typecheck_1.asNumber)(opt.downloadTimeout, default_options_json_1.default.downloadTimeout)), fileCheckInterval: Duration_1.Duration.Seconds((0, ts_runtime_typecheck_1.asNumber)(opt.fileCheckInterval, default_options_json_1.default.fileCheckInterval)), downloadCheckInterval: Duration_1.Duration.Seconds((0, ts_runtime_typecheck_1.asNumber)(opt.downloadCheckInterval, default_options_json_1.default.downloadCheckInterval)), stateCheckInterval: Duration_1.Duration.Seconds((0, ts_runtime_typecheck_1.asNumber)(opt.stateCheckInterval, default_options_json_1.default.stateCheckInterval)), inFlightDelay: Duration_1.Duration.Seconds((0, ts_runtime_typecheck_1.asNumber)(opt.inFlightDelay, default_options_json_1.default.inFlightDelay)), waitTimeSeconds: Duration_1.Duration.Seconds((0, ts_runtime_typecheck_1.asNumber)(opt.waitTimeSeconds, default_options_json_1.default.waitTimeSeconds)), waitTokenError: (0, ts_runtime_typecheck_1.asNumber)(opt.waitTokenError, default_options_json_1.default.waitTokenError), transferPoolSize: (0, ts_runtime_typecheck_1.asNumber)(opt.transferPoolSize, default_options_json_1.default.transferPoolSize), downloadMode, filetype: (0, ts_runtime_typecheck_1.asArrayOf)(ts_runtime_typecheck_1.isString)(opt.filetype, default_options_json_1.default.filetype), sampleDirectory: (0, ts_runtime_typecheck_1.asString)(opt.sampleDirectory, default_options_json_1.default.sampleDirectory), | ||
const options = Object.assign(Object.assign({}, parseCoreOptions(opt)), { region: (0, ts_runtime_typecheck_1.asString)(opt.region, default_options_1.DEFAULT_OPTIONS.region), sessionGrace: Duration_1.Duration.Seconds((0, ts_runtime_typecheck_1.asNumber)(opt.sessionGrace, default_options_1.DEFAULT_OPTIONS.sessionGrace)), uploadTimeout: Duration_1.Duration.Seconds((0, ts_runtime_typecheck_1.asNumber)(opt.uploadTimeout, default_options_1.DEFAULT_OPTIONS.uploadTimeout)), uploadRetries: (0, ts_runtime_typecheck_1.asNumber)(opt.uploadRetries, default_options_1.DEFAULT_OPTIONS.uploadRetries), downloadTimeout: Duration_1.Duration.Seconds((0, ts_runtime_typecheck_1.asNumber)(opt.downloadTimeout, default_options_1.DEFAULT_OPTIONS.downloadTimeout)), fileCheckInterval: Duration_1.Duration.Seconds((0, ts_runtime_typecheck_1.asNumber)(opt.fileCheckInterval, default_options_1.DEFAULT_OPTIONS.fileCheckInterval)), downloadCheckInterval: Duration_1.Duration.Seconds((0, ts_runtime_typecheck_1.asNumber)(opt.downloadCheckInterval, default_options_1.DEFAULT_OPTIONS.downloadCheckInterval)), stateCheckInterval: Duration_1.Duration.Seconds((0, ts_runtime_typecheck_1.asNumber)(opt.stateCheckInterval, default_options_1.DEFAULT_OPTIONS.stateCheckInterval)), inFlightDelay: Duration_1.Duration.Seconds((0, ts_runtime_typecheck_1.asNumber)(opt.inFlightDelay, default_options_1.DEFAULT_OPTIONS.inFlightDelay)), waitTimeSeconds: Duration_1.Duration.Seconds((0, ts_runtime_typecheck_1.asNumber)(opt.waitTimeSeconds, default_options_1.DEFAULT_OPTIONS.waitTimeSeconds)), waitTokenError: (0, ts_runtime_typecheck_1.asNumber)(opt.waitTokenError, default_options_1.DEFAULT_OPTIONS.waitTokenError), transferPoolSize: (0, ts_runtime_typecheck_1.asNumber)(opt.transferPoolSize, default_options_1.DEFAULT_OPTIONS.transferPoolSize), downloadMode, filetype: (0, ts_runtime_typecheck_1.asArrayOf)(ts_runtime_typecheck_1.isString)(opt.filetype, default_options_1.DEFAULT_OPTIONS.filetype), sampleDirectory: (0, ts_runtime_typecheck_1.asString)(opt.sampleDirectory, default_options_1.DEFAULT_OPTIONS.sampleDirectory), | ||
// optional values | ||
useGraphQL: (0, ts_runtime_typecheck_1.asBoolean)(opt.useGraphQL, false), idWorkflowInstance: (0, ts_runtime_typecheck_1.asOptIndex)(opt.id_workflow_instance), idDataset: (0, ts_runtime_typecheck_1.asOptIndex)(opt.id_dataset), debounceWindow: Duration_1.Duration.Seconds((0, ts_runtime_typecheck_1.asNumber)(opt.debounceWindow, default_options_json_1.default.debounceWindow)), proxy: (0, ts_runtime_typecheck_1.asOptString)(opt.proxy), | ||
useGraphQL: (0, ts_runtime_typecheck_1.asBoolean)(opt.useGraphQL, false), idWorkflowInstance: (0, ts_runtime_typecheck_1.asOptIndex)(opt.id_workflow_instance), idDataset: (0, ts_runtime_typecheck_1.asOptIndex)(opt.id_dataset), debounceWindow: Duration_1.Duration.Seconds((0, ts_runtime_typecheck_1.asNumber)(opt.debounceWindow, default_options_1.DEFAULT_OPTIONS.debounceWindow)), proxy: (0, ts_runtime_typecheck_1.asOptString)(opt.proxy), | ||
// EPI2ME-FS options | ||
@@ -72,0 +66,0 @@ inputFolders: (0, ts_runtime_typecheck_1.asOptArrayOf)(ts_runtime_typecheck_1.isString)(opt.inputFolders), outputFolder: (0, ts_runtime_typecheck_1.asOptString)(opt.outputFolder), awsAcceleration: (0, ts_runtime_typecheck_1.asOptString)(opt.awsAcceleration), agent_address: (0, ts_runtime_typecheck_1.asOptString)(opt.agent_address), telemetryCb: (0, ts_runtime_typecheck_1.asOptFunction)(opt.telemetryCb), dataCb: (0, ts_runtime_typecheck_1.asOptFunction)(opt.dataCb), remoteShutdownCb: (0, ts_runtime_typecheck_1.asOptFunction)(opt.remoteShutdownCb) }); |
@@ -9,3 +9,3 @@ "use strict"; | ||
const path_1 = __importDefault(require("path")); | ||
const default_options_json_1 = __importDefault(require("./default_options.json")); | ||
const default_options_1 = require("./default_options"); | ||
class SampleReader { | ||
@@ -34,9 +34,9 @@ constructor() { | ||
} | ||
async getExperiments({ sourceDir = default_options_json_1.default.sampleDirectory, refresh = false }) { | ||
if (!Object.keys(this.experiments).length || refresh) { | ||
await this.updateExperiments(sourceDir); | ||
async getExperiments({ sourceDir, refresh }) { | ||
if (Object.keys(this.experiments).length === 0 || refresh) { | ||
await this.updateExperiments(sourceDir !== null && sourceDir !== void 0 ? sourceDir : default_options_1.DEFAULT_OPTIONS.sampleDirectory); | ||
} | ||
return this.experiments; | ||
} | ||
async updateExperiments(sourceDir = default_options_json_1.default.sampleDirectory) { | ||
async updateExperiments(sourceDir = default_options_1.DEFAULT_OPTIONS.sampleDirectory) { | ||
var _a; | ||
@@ -43,0 +43,0 @@ const fileToCheck = 'fastq_pass'; // Actually a dir now |
@@ -11,5 +11,6 @@ "use strict"; | ||
const proxy_agent_1 = __importDefault(require("proxy-agent")); | ||
const package_json_1 = require("../package.json"); | ||
const Logger_1 = require("./Logger"); | ||
const NodeError_1 = require("./NodeError"); | ||
const default_options_1 = require("./default_options"); | ||
const UserAgent_constants_1 = require("./UserAgent.constants"); | ||
axios_1.default.defaults.validateStatus = (status) => status <= 504; // Reject only if the status code is greater than or equal to 500 | ||
@@ -81,8 +82,7 @@ exports.utils = (function magic() { | ||
return { | ||
version: package_json_1.version, | ||
headers(req, options) { | ||
var _a, _b; | ||
var _a, _b, _c; | ||
// common headers required for everything | ||
req.headers = Object.assign(Object.assign({ Accept: 'application/json', 'Content-Type': 'application/json', 'X-EPI2ME-Client': options.user_agent || 'api', 'X-EPI2ME-Version': options.agent_version || exports.utils.version }, req.headers), options.headers); | ||
if ((_a = options.signing) !== null && _a !== void 0 ? _a : true) { | ||
req.headers = Object.assign(Object.assign({ Accept: 'application/json', 'Content-Type': 'application/json', 'X-EPI2ME-Client': UserAgent_constants_1.USER_AGENT, 'X-EPI2ME-Version': (_a = options.agent_version) !== null && _a !== void 0 ? _a : default_options_1.DEFAULT_OPTIONS.agent_version }, req.headers), options.headers); | ||
if ((_b = options.signing) !== null && _b !== void 0 ? _b : true) { | ||
// if not present: sign | ||
@@ -94,3 +94,3 @@ // if present and true: sign | ||
const proxy = (0, proxy_agent_1.default)(options.proxy); | ||
const log = (_b = options.log) !== null && _b !== void 0 ? _b : Logger_1.NoopLogger; | ||
const log = (_c = options.log) !== null && _c !== void 0 ? _c : Logger_1.NoopLogger; | ||
log.debug(`Using proxy for request`); | ||
@@ -97,0 +97,0 @@ req.httpsAgent = proxy; |
@@ -977,3 +977,2 @@ import { isDefined } from 'ts-runtime-typecheck'; | ||
} | ||
EPI2ME_FS.version = utils.version; | ||
EPI2ME_FS.REST = REST_FS; | ||
@@ -980,0 +979,0 @@ EPI2ME_FS.utils = utils; |
@@ -13,2 +13,3 @@ import { BehaviorSubject, combineLatest } from 'rxjs'; | ||
import { wrapAndLogError } from './NodeError'; | ||
import { DEFAULT_OPTIONS } from './default_options'; | ||
export class EPI2ME { | ||
@@ -333,3 +334,3 @@ constructor(optstring = {}) { | ||
} | ||
EPI2ME.version = utils.version; | ||
EPI2ME.version = DEFAULT_OPTIONS.agent_version; | ||
EPI2ME.utils = utils; |
@@ -221,3 +221,3 @@ /* | ||
// GraphQLFS | ||
const { apikey, apisecret, jwt, log, local, signing, url: originalUrl, agent_version: agentVersion, user_agent: userAgent, } = parseCoreOptions(opts); | ||
const { apikey, apisecret, jwt, log, local, signing, url: originalUrl, agent_version: agentVersion, } = parseCoreOptions(opts); | ||
// https://epi2me-dev.bla => https://graphql.epi2me-dev.bla | ||
@@ -230,3 +230,2 @@ const url = originalUrl.replace(/:\/\//, '://graphql.'); | ||
local, | ||
user_agent: userAgent, | ||
signing, | ||
@@ -233,0 +232,0 @@ apikey, |
export * from './index.type'; | ||
import { DEFAULT_OPTIONS } from './default_options'; | ||
import { EPI2ME_FS as EPI2ME } from './epi2me-fs'; | ||
@@ -14,3 +15,3 @@ import { utilsFS as utils } from './utils-fs'; | ||
export * as FileExtension from './file_extensions'; | ||
export const version = utils.version; | ||
export const version = DEFAULT_OPTIONS.agent_version; | ||
export const EPI2ME_HOME = EPI2ME.EPI2ME_HOME; |
import { asStruct, isOptDictionaryOf, isOptIndex, isOptString, isStruct } from 'ts-runtime-typecheck'; | ||
import { ProfileManager } from './ProfileManager'; | ||
import { url as DEFAULT_ENDPOINT } from './default_options.json'; | ||
import { DEFAULT_OPTIONS } from './default_options'; | ||
// WARN uses Node.js stuff here | ||
@@ -11,3 +11,3 @@ import { promises as fs } from 'fs'; | ||
function getDefaultEndpoint() { | ||
return process.env.METRICHOR || DEFAULT_ENDPOINT; | ||
return process.env.METRICHOR || DEFAULT_OPTIONS.url; | ||
} | ||
@@ -14,0 +14,0 @@ function getDefaultProfilePath() { |
import { fetch, Request, Headers } from './fetch'; | ||
import { version as API_VERSION } from '../../package.json'; | ||
import { isDictionary, isString, isStruct } from 'ts-runtime-typecheck'; | ||
import { DEFAULT_OPTIONS } from '../default_options'; | ||
import { USER_AGENT } from '../UserAgent.constants'; | ||
let fetchMethod = fetch; | ||
@@ -40,8 +41,8 @@ export function stubFetch(replacement) { | ||
export function writeCommonHeaders(options = {}) { | ||
var _a, _b; | ||
var _a; | ||
const headers = new Headers(); | ||
headers.set('Accept', 'application/json'); | ||
headers.set('Content-Type', 'application/json'); | ||
headers.set('X-EPI2ME-Client', (_a = options.user_agent) !== null && _a !== void 0 ? _a : 'api'); | ||
headers.set('X-EPI2ME-Version', (_b = options.agent_version) !== null && _b !== void 0 ? _b : API_VERSION); | ||
headers.set('X-EPI2ME-Client', USER_AGENT); | ||
headers.set('X-EPI2ME-Version', (_a = options.agent_version) !== null && _a !== void 0 ? _a : DEFAULT_OPTIONS.agent_version); | ||
if (options.headers) { | ||
@@ -48,0 +49,0 @@ for (const [key, value] of Object.entries(options.headers)) { |
import { FallbackLogger } from './Logger'; | ||
import { version as VERSION } from '../package.json'; | ||
import DEFAULTS from './default_options.json'; | ||
import { DEFAULT_OPTIONS } from './default_options'; | ||
import { isDictionary, asFunction, asString, asBoolean, asOptString, asNumber, asArrayOf, isString, asOptIndex, asOptFunction, asOptArrayOf, } from 'ts-runtime-typecheck'; | ||
@@ -31,11 +30,9 @@ import { Duration } from './Duration'; | ||
var _a, _b; | ||
const url = (_b = (_a = opt.endpoint) !== null && _a !== void 0 ? _a : opt.url) !== null && _b !== void 0 ? _b : DEFAULTS.url; | ||
const url = (_b = (_a = opt.endpoint) !== null && _a !== void 0 ? _a : opt.url) !== null && _b !== void 0 ? _b : DEFAULT_OPTIONS.url; | ||
return { | ||
url: url.endsWith('/') ? url.slice(0, -1) : url, | ||
// Return to calling utils.version when utils no longer signs | ||
agent_version: asString(opt.agent_version, VERSION), | ||
agent_version: asString(opt.agent_version, DEFAULT_OPTIONS.agent_version), | ||
log: resolveLogger(opt.log), | ||
local: asBoolean(opt.local, DEFAULTS.local), | ||
user_agent: asString(opt.user_agent, DEFAULTS.user_agent), | ||
signing: asBoolean(opt.signing, DEFAULTS.signing), | ||
local: asBoolean(opt.local, DEFAULT_OPTIONS.local), | ||
signing: asBoolean(opt.signing, DEFAULT_OPTIONS.signing), | ||
// Optional Values | ||
@@ -48,3 +45,3 @@ apikey: asOptString(opt.apikey), | ||
export function parseOptions(opt) { | ||
const downloadMode = asString(opt.downloadMode, DEFAULTS.downloadMode); | ||
const downloadMode = asString(opt.downloadMode, DEFAULT_OPTIONS.downloadMode); | ||
switch (downloadMode) { | ||
@@ -59,5 +56,5 @@ case 'data': | ||
} | ||
const options = Object.assign(Object.assign({}, parseCoreOptions(opt)), { region: asString(opt.region, DEFAULTS.region), sessionGrace: Duration.Seconds(asNumber(opt.sessionGrace, DEFAULTS.sessionGrace)), uploadTimeout: Duration.Seconds(asNumber(opt.uploadTimeout, DEFAULTS.uploadTimeout)), uploadRetries: asNumber(opt.uploadRetries, DEFAULTS.uploadRetries), downloadTimeout: Duration.Seconds(asNumber(opt.downloadTimeout, DEFAULTS.downloadTimeout)), fileCheckInterval: Duration.Seconds(asNumber(opt.fileCheckInterval, DEFAULTS.fileCheckInterval)), downloadCheckInterval: Duration.Seconds(asNumber(opt.downloadCheckInterval, DEFAULTS.downloadCheckInterval)), stateCheckInterval: Duration.Seconds(asNumber(opt.stateCheckInterval, DEFAULTS.stateCheckInterval)), inFlightDelay: Duration.Seconds(asNumber(opt.inFlightDelay, DEFAULTS.inFlightDelay)), waitTimeSeconds: Duration.Seconds(asNumber(opt.waitTimeSeconds, DEFAULTS.waitTimeSeconds)), waitTokenError: asNumber(opt.waitTokenError, DEFAULTS.waitTokenError), transferPoolSize: asNumber(opt.transferPoolSize, DEFAULTS.transferPoolSize), downloadMode, filetype: asArrayOf(isString)(opt.filetype, DEFAULTS.filetype), sampleDirectory: asString(opt.sampleDirectory, DEFAULTS.sampleDirectory), | ||
const options = Object.assign(Object.assign({}, parseCoreOptions(opt)), { region: asString(opt.region, DEFAULT_OPTIONS.region), sessionGrace: Duration.Seconds(asNumber(opt.sessionGrace, DEFAULT_OPTIONS.sessionGrace)), uploadTimeout: Duration.Seconds(asNumber(opt.uploadTimeout, DEFAULT_OPTIONS.uploadTimeout)), uploadRetries: asNumber(opt.uploadRetries, DEFAULT_OPTIONS.uploadRetries), downloadTimeout: Duration.Seconds(asNumber(opt.downloadTimeout, DEFAULT_OPTIONS.downloadTimeout)), fileCheckInterval: Duration.Seconds(asNumber(opt.fileCheckInterval, DEFAULT_OPTIONS.fileCheckInterval)), downloadCheckInterval: Duration.Seconds(asNumber(opt.downloadCheckInterval, DEFAULT_OPTIONS.downloadCheckInterval)), stateCheckInterval: Duration.Seconds(asNumber(opt.stateCheckInterval, DEFAULT_OPTIONS.stateCheckInterval)), inFlightDelay: Duration.Seconds(asNumber(opt.inFlightDelay, DEFAULT_OPTIONS.inFlightDelay)), waitTimeSeconds: Duration.Seconds(asNumber(opt.waitTimeSeconds, DEFAULT_OPTIONS.waitTimeSeconds)), waitTokenError: asNumber(opt.waitTokenError, DEFAULT_OPTIONS.waitTokenError), transferPoolSize: asNumber(opt.transferPoolSize, DEFAULT_OPTIONS.transferPoolSize), downloadMode, filetype: asArrayOf(isString)(opt.filetype, DEFAULT_OPTIONS.filetype), sampleDirectory: asString(opt.sampleDirectory, DEFAULT_OPTIONS.sampleDirectory), | ||
// optional values | ||
useGraphQL: asBoolean(opt.useGraphQL, false), idWorkflowInstance: asOptIndex(opt.id_workflow_instance), idDataset: asOptIndex(opt.id_dataset), debounceWindow: Duration.Seconds(asNumber(opt.debounceWindow, DEFAULTS.debounceWindow)), proxy: asOptString(opt.proxy), | ||
useGraphQL: asBoolean(opt.useGraphQL, false), idWorkflowInstance: asOptIndex(opt.id_workflow_instance), idDataset: asOptIndex(opt.id_dataset), debounceWindow: Duration.Seconds(asNumber(opt.debounceWindow, DEFAULT_OPTIONS.debounceWindow)), proxy: asOptString(opt.proxy), | ||
// EPI2ME-FS options | ||
@@ -64,0 +61,0 @@ inputFolders: asOptArrayOf(isString)(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) }); |
import { fdir } from 'fdir'; | ||
import path from 'path'; | ||
import DEFAULTS from './default_options.json'; | ||
import { DEFAULT_OPTIONS } from './default_options'; | ||
export class SampleReader { | ||
@@ -27,9 +27,9 @@ constructor() { | ||
} | ||
async getExperiments({ sourceDir = DEFAULTS.sampleDirectory, refresh = false }) { | ||
if (!Object.keys(this.experiments).length || refresh) { | ||
await this.updateExperiments(sourceDir); | ||
async getExperiments({ sourceDir, refresh }) { | ||
if (Object.keys(this.experiments).length === 0 || refresh) { | ||
await this.updateExperiments(sourceDir !== null && sourceDir !== void 0 ? sourceDir : DEFAULT_OPTIONS.sampleDirectory); | ||
} | ||
return this.experiments; | ||
} | ||
async updateExperiments(sourceDir = DEFAULTS.sampleDirectory) { | ||
async updateExperiments(sourceDir = DEFAULT_OPTIONS.sampleDirectory) { | ||
var _a; | ||
@@ -36,0 +36,0 @@ const fileToCheck = 'fastq_pass'; // Actually a dir now |
@@ -5,5 +5,6 @@ import axios from 'axios'; | ||
import ProxyAgent from 'proxy-agent'; | ||
import { version as VERSION } from '../package.json'; | ||
import { NoopLogger } from './Logger'; | ||
import { NestedError } from './NodeError'; | ||
import { DEFAULT_OPTIONS } from './default_options'; | ||
import { USER_AGENT } from './UserAgent.constants'; | ||
axios.defaults.validateStatus = (status) => status <= 504; // Reject only if the status code is greater than or equal to 500 | ||
@@ -75,8 +76,7 @@ export const utils = (function magic() { | ||
return { | ||
version: VERSION, | ||
headers(req, options) { | ||
var _a, _b; | ||
var _a, _b, _c; | ||
// common headers required for everything | ||
req.headers = Object.assign(Object.assign({ Accept: 'application/json', 'Content-Type': 'application/json', 'X-EPI2ME-Client': options.user_agent || 'api', 'X-EPI2ME-Version': options.agent_version || utils.version }, req.headers), options.headers); | ||
if ((_a = options.signing) !== null && _a !== void 0 ? _a : true) { | ||
req.headers = Object.assign(Object.assign({ Accept: 'application/json', 'Content-Type': 'application/json', 'X-EPI2ME-Client': USER_AGENT, 'X-EPI2ME-Version': (_a = options.agent_version) !== null && _a !== void 0 ? _a : DEFAULT_OPTIONS.agent_version }, req.headers), options.headers); | ||
if ((_b = options.signing) !== null && _b !== void 0 ? _b : true) { | ||
// if not present: sign | ||
@@ -88,3 +88,3 @@ // if present and true: sign | ||
const proxy = ProxyAgent(options.proxy); | ||
const log = (_b = options.log) !== null && _b !== void 0 ? _b : NoopLogger; | ||
const log = (_c = options.log) !== null && _c !== void 0 ? _c : NoopLogger; | ||
log.debug(`Using proxy for request`); | ||
@@ -91,0 +91,0 @@ req.httpsAgent = proxy; |
@@ -12,3 +12,3 @@ { | ||
"private": false, | ||
"version": "5.1.6058802", | ||
"version": "5.1.6089492", | ||
"main": "cjs/index-web.js", | ||
@@ -15,0 +15,0 @@ "module": "esm/index-web.js", |
@@ -14,3 +14,2 @@ <a href="http://metrichor.com"><img src="https://epi2me.nanoporetech.com/gfx/logo_print.png" height="74" align="right"></a> | ||
}); | ||
// list of all options: ./lib/default_options.json | ||
@@ -45,3 +44,2 @@ // list all workflows | ||
url | ||
user_agent | ||
region | ||
@@ -48,0 +46,0 @@ retention |
@@ -10,4 +10,3 @@ import type { Logger } from './Logger.type'; | ||
log: Logger; | ||
user_agent: string; | ||
signing: boolean; | ||
} |
import type { Logger } from './Logger.type'; | ||
import type { Index, UnknownFunction } from 'ts-runtime-typecheck'; | ||
export declare type DownloadMode = 'data' | 'telemetry' | 'none' | 'data+telemetry'; | ||
export interface EPI2ME_OPTIONS { | ||
@@ -10,3 +11,2 @@ agent_version: string; | ||
region: string; | ||
user_agent: string; | ||
sessionGrace: number; | ||
@@ -23,3 +23,3 @@ uploadTimeout: number; | ||
transferPoolSize: number; | ||
downloadMode: 'data' | 'telemetry' | 'none' | 'data+telemetry'; | ||
downloadMode: DownloadMode; | ||
filetype: string[]; | ||
@@ -26,0 +26,0 @@ signing: boolean; |
@@ -49,3 +49,2 @@ import type { PaginatedWorkflowType, PaginatedWorkflowInstanceType, WorkflowInstanceType, WorkflowInstanceMutation, StopWorkflowInstanceMutation, InstanceTokenMutation, UserObjectType, UpdateUserMutation, RegisterTokenMutation, RegionType, WorkflowType, StatusType } from './generated/graphql.type'; | ||
local: boolean; | ||
user_agent: string; | ||
signing: boolean; | ||
@@ -52,0 +51,0 @@ } |
@@ -8,3 +8,2 @@ /// <reference types="node" /> | ||
base_url?: string; | ||
user_agent?: string; | ||
agent_version?: string; | ||
@@ -11,0 +10,0 @@ method?: 'head' | 'get' | 'put' | 'post'; |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3058460
218
28310
176