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.4492990 to 4.0.4564472

5

cjs/epi2me.js

@@ -18,3 +18,2 @@ "use strict";

const niceSize_1 = __importDefault(require("./niceSize"));
const profile_1 = require("./profile");
const rest_1 = require("./rest");

@@ -38,2 +37,4 @@ const socket_1 = __importDefault(require("./socket"));

this.uploadStopped$ = this.uploadState$.pipe(operators_1.skipWhile((state) => !state), operators_1.takeWhile((state) => state, true), operators_1.filter((state) => !state), operators_1.mapTo(true));
// NOTE emits a signal exactly once, after analyseState changes from true, to false
this.analysisStopped$ = this.analyseState$.pipe(operators_1.skipWhile((state) => !state), operators_1.takeWhile((state) => state, true), operators_1.filter((state) => !state), operators_1.mapTo(true));
this.instanceTelemetry$ = new rxjs_1.BehaviorSubject([]);

@@ -418,4 +419,2 @@ this.experimentalWorkerStatus$ = new rxjs_1.BehaviorSubject([]);

EPI2ME.version = utils_1.utils.version;
EPI2ME.Profile = profile_1.Profile;
EPI2ME.REST = rest_1.REST; // to allow import { REST } from '@metrichor/epi2me-api'
EPI2ME.utils = utils_1.utils;

2

cjs/factory.js

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

// NOTE ensure the 'complete' message from uploadStopped$ is not passed to removeRunningInstanceById$
inst.uploadStopped$.pipe(operators_1.mapTo(inst.id)).subscribe((id) => this.removeRunningInstanceById$.next(id));
inst.analysisStopped$.pipe(operators_1.mapTo(inst.id)).subscribe((id) => this.removeRunningInstanceById$.next(id));
}

@@ -78,0 +78,0 @@ async startRun(options, workflowConfig) {

@@ -7,3 +7,2 @@ "use strict";

const operators_1 = require("rxjs/operators");
const rxjs_2 = require("rxjs");
const ts_runtime_typecheck_1 = require("ts-runtime-typecheck");

@@ -37,7 +36,7 @@ const graphql_1 = require("./graphql");

// get the sources for the telemetry reports on this instance ( automatically updates when the sources expire )
this.sources$ = this.getSources$(graphql, id, telemetryNames);
this.sources = this.getSources$(graphql, id, telemetryNames);
// for updates to actually trigger on the first interval the timer MUST be a BehaviourSubject
const intervalSubject$ = rxjs_1.interval(TELEMETRY_INTERVAL).pipe(operators_1.multicast(new rxjs_1.BehaviorSubject(0)), operators_1.refCount());
// poll the sources to see if any have changed, emits all the sources if any have
this.updates$ = rxjs_1.combineLatest([intervalSubject$, this.sources$]).pipe(operators_1.switchMap(() => this.sources$), operators_1.switchMap(async (sources) => {
this.updates$ = intervalSubject$.pipe(operators_1.switchMap(() => this.sources()), operators_1.switchMap(async (sources) => {
return Promise.all(sources.map(async (source) => {

@@ -66,5 +65,15 @@ const response = await fetch_1.fetch(source.headUrl, { method: 'head' });

const aggregatedReports$ = cacheSubject$();
const updateSourceList = async (existing) => {
const newSources = await this.sources();
return existing.map(({ etag, hasReport }, i) => {
const newSource = newSources[i];
return Object.assign(Object.assign({}, newSource), { etag,
hasReport });
});
};
this.reports$ = this.updates$.pipe(operators_1.withLatestFrom(previousSourceList$, aggregatedReports$), operators_1.switchMap(async ([sources, previous, reports]) => {
const previousSources = previous !== null && previous !== void 0 ? previous : [];
const results = await Promise.all(sources.map(async (current, index) => {
// NOTE this checks for expired sources
const updatedSources = await updateSourceList(sources);
const results = await Promise.all(updatedSources.map(async (current, index) => {
var _a;

@@ -89,3 +98,3 @@ // if there is no report we shouldn't try to get it

// update the "previous value" subjects
previousSourceList$.next(sources);
previousSourceList$.next(updatedSources);
aggregatedReports$.next(results);

@@ -138,23 +147,12 @@ // emit as an array as so not to reorder the components

}));
return new rxjs_2.Observable((subscriber) => {
return async () => {
const startTime = Date.now();
if (startTime < expires && sources) {
subscriber.next(sources);
subscriber.complete();
return;
return sources;
}
(async () => {
const startTime = Date.now();
try {
sources = await this.getTelemetrySources(graphql, id, reportNames);
subscriber.next(sources);
subscriber.complete();
const expiresIn = sources.reduce((acc, source) => Math.min(acc, source.expiresIn), Infinity) * 1000;
expires = startTime + expiresIn - EXPIRY_GRACE_PERIOD;
}
catch (e) {
subscriber.error(e);
}
})();
});
sources = await this.getTelemetrySources(graphql, id, reportNames);
const expiresIn = sources.reduce((acc, source) => Math.min(acc, source.expiresIn), Infinity) * 1000;
expires = startTime + expiresIn - EXPIRY_GRACE_PERIOD;
return sources;
};
}

@@ -161,0 +159,0 @@ // ensures we don't get more than 1 instance of telemetry for a epi2me instance

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

import niceSize from './niceSize';
import { Profile } from './profile';
import { REST } from './rest';

@@ -32,2 +31,4 @@ import Socket from './socket';

this.uploadStopped$ = this.uploadState$.pipe(skipWhile((state) => !state), takeWhile((state) => state, true), filter((state) => !state), mapTo(true));
// NOTE emits a signal exactly once, after analyseState changes from true, to false
this.analysisStopped$ = this.analyseState$.pipe(skipWhile((state) => !state), takeWhile((state) => state, true), filter((state) => !state), mapTo(true));
this.instanceTelemetry$ = new BehaviorSubject([]);

@@ -411,4 +412,2 @@ this.experimentalWorkerStatus$ = new BehaviorSubject([]);

EPI2ME.version = utils.version;
EPI2ME.Profile = Profile;
EPI2ME.REST = REST; // to allow import { REST } from '@metrichor/epi2me-api'
EPI2ME.utils = utils;

@@ -72,3 +72,3 @@ import { BehaviorSubject, Subject, merge } from 'rxjs';

// NOTE ensure the 'complete' message from uploadStopped$ is not passed to removeRunningInstanceById$
inst.uploadStopped$.pipe(mapTo(inst.id)).subscribe((id) => this.removeRunningInstanceById$.next(id));
inst.analysisStopped$.pipe(mapTo(inst.id)).subscribe((id) => this.removeRunningInstanceById$.next(id));
}

@@ -75,0 +75,0 @@ async startRun(options, workflowConfig) {

import { fetch } from './network/fetch';
import { BehaviorSubject, combineLatest, interval, timer } from 'rxjs';
import { BehaviorSubject, interval, timer } from 'rxjs';
import { delayWhen, distinctUntilChanged, filter, map, multicast, refCount, retryWhen, switchMap, withLatestFrom, } from 'rxjs/operators';
import { Observable } from 'rxjs';
import { isDefined } from 'ts-runtime-typecheck';

@@ -33,7 +32,7 @@ import { GraphQL } from './graphql';

// get the sources for the telemetry reports on this instance ( automatically updates when the sources expire )
this.sources$ = this.getSources$(graphql, id, telemetryNames);
this.sources = this.getSources$(graphql, id, telemetryNames);
// for updates to actually trigger on the first interval the timer MUST be a BehaviourSubject
const intervalSubject$ = interval(TELEMETRY_INTERVAL).pipe(multicast(new BehaviorSubject(0)), refCount());
// poll the sources to see if any have changed, emits all the sources if any have
this.updates$ = combineLatest([intervalSubject$, this.sources$]).pipe(switchMap(() => this.sources$), switchMap(async (sources) => {
this.updates$ = intervalSubject$.pipe(switchMap(() => this.sources()), switchMap(async (sources) => {
return Promise.all(sources.map(async (source) => {

@@ -62,5 +61,15 @@ const response = await fetch(source.headUrl, { method: 'head' });

const aggregatedReports$ = cacheSubject$();
const updateSourceList = async (existing) => {
const newSources = await this.sources();
return existing.map(({ etag, hasReport }, i) => {
const newSource = newSources[i];
return Object.assign(Object.assign({}, newSource), { etag,
hasReport });
});
};
this.reports$ = this.updates$.pipe(withLatestFrom(previousSourceList$, aggregatedReports$), switchMap(async ([sources, previous, reports]) => {
const previousSources = previous !== null && previous !== void 0 ? previous : [];
const results = await Promise.all(sources.map(async (current, index) => {
// NOTE this checks for expired sources
const updatedSources = await updateSourceList(sources);
const results = await Promise.all(updatedSources.map(async (current, index) => {
var _a;

@@ -85,3 +94,3 @@ // if there is no report we shouldn't try to get it

// update the "previous value" subjects
previousSourceList$.next(sources);
previousSourceList$.next(updatedSources);
aggregatedReports$.next(results);

@@ -134,23 +143,12 @@ // emit as an array as so not to reorder the components

}));
return new Observable((subscriber) => {
return async () => {
const startTime = Date.now();
if (startTime < expires && sources) {
subscriber.next(sources);
subscriber.complete();
return;
return sources;
}
(async () => {
const startTime = Date.now();
try {
sources = await this.getTelemetrySources(graphql, id, reportNames);
subscriber.next(sources);
subscriber.complete();
const expiresIn = sources.reduce((acc, source) => Math.min(acc, source.expiresIn), Infinity) * 1000;
expires = startTime + expiresIn - EXPIRY_GRACE_PERIOD;
}
catch (e) {
subscriber.error(e);
}
})();
});
sources = await this.getTelemetrySources(graphql, id, reportNames);
const expiresIn = sources.reduce((acc, source) => Math.min(acc, source.expiresIn), Infinity) * 1000;
expires = startTime + expiresIn - EXPIRY_GRACE_PERIOD;
return sources;
};
}

@@ -157,0 +155,0 @@ // ensures we don't get more than 1 instance of telemetry for a epi2me instance

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

"private": false,
"version": "4.0.4492990",
"version": "4.0.4564472",
"main": "cjs/index-web.js",

@@ -15,0 +15,0 @@ "module": "esm/index-web.js",

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

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