@metrichor/epi2me-api
Advanced tools
Comparing version 6.0.7174788 to 6.0.7176693
@@ -16,2 +16,3 @@ /// <reference types="node" /> | ||
import type { StartWorkflowMutation, StartWorkflowMutationVariables } from './generated/graphql'; | ||
import Socket from './socket'; | ||
declare const asChain: import("ts-runtime-typecheck/mjs/TypeCast.type").OptionalTypeCast<{ | ||
@@ -81,3 +82,5 @@ components: Dictionary<Dictionary<unknown>>; | ||
fetchTelemetry(): Promise<void>; | ||
realtimeFeedback(channel: string, object: unknown): void; | ||
getSocket(): Socket; | ||
} | ||
export {}; |
@@ -33,2 +33,3 @@ /** | ||
var default_options = require('./default_options.js'); | ||
var socket = require('./socket.js'); | ||
@@ -976,2 +977,17 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
} | ||
realtimeFeedback(channel, object) { | ||
this.getSocket().emit(channel, object); | ||
} | ||
getSocket() { | ||
if (this.socket) { | ||
return this.socket; | ||
} | ||
const socket$1 = new socket["default"](this.REST, this.config.options, this.proxyAgent); | ||
const { id_workflow_instance: id } = this.config.instance; | ||
if (id) { | ||
socket$1.watch(`workflow_instance:state:${id}`, this.updateWorkerStatus); | ||
} | ||
this.socket = socket$1; | ||
return socket$1; | ||
} | ||
} | ||
@@ -978,0 +994,0 @@ EPI2ME_FS.REST = restFs.REST_FS; |
@@ -12,3 +12,3 @@ import type { Logger } from './Logger.type'; | ||
import { REST } from './rest'; | ||
import Socket from './socket'; | ||
import type Socket from './socket'; | ||
export declare class EPI2ME { | ||
@@ -51,5 +51,3 @@ static version: string; | ||
get id(): Index; | ||
getSocket(): Socket; | ||
updateWorkerStatus: (newWorkerStatus: unknown) => void; | ||
realtimeFeedback(channel: string, object: unknown): void; | ||
setTimer(intervalName: 'downloadCheckInterval' | 'stateCheckInterval' | 'fileCheckInterval' | 'summaryTelemetryInterval', intervalDuration: Duration, cb: UnknownFunction): void; | ||
@@ -56,0 +54,0 @@ stopTimer(intervalGroupName: 'downloadCheckInterval' | 'stateCheckInterval' | 'fileCheckInterval' | 'summaryTelemetryInterval'): void; |
@@ -13,3 +13,2 @@ /** | ||
var rest = require('./rest.js'); | ||
var socket = require('./socket.js'); | ||
var utils = require('./utils.js'); | ||
@@ -98,17 +97,2 @@ var tsRuntimeTypecheck = require('ts-runtime-typecheck'); | ||
} | ||
getSocket() { | ||
if (this.socket) { | ||
return this.socket; | ||
} | ||
const socket$1 = new socket["default"](this.REST, this.config.options); | ||
const { id_workflow_instance: id } = this.config.instance; | ||
if (id) { | ||
socket$1.watch(`workflow_instance:state:${id}`, this.updateWorkerStatus); | ||
} | ||
this.socket = socket$1; | ||
return socket$1; | ||
} | ||
realtimeFeedback(channel, object) { | ||
this.getSocket().emit(channel, object); | ||
} | ||
setTimer(intervalName, intervalDuration, cb) { | ||
@@ -115,0 +99,0 @@ if (this.timers[intervalName]) { |
@@ -0,1 +1,2 @@ | ||
/// <reference types="node" /> | ||
import type { Logger } from './Logger.type'; | ||
@@ -5,2 +6,3 @@ import type { REST } from './rest'; | ||
import type { Duration } from './Duration'; | ||
import type { Agent } from 'http'; | ||
import io from 'socket.io-client'; | ||
@@ -12,3 +14,3 @@ export default class Socket { | ||
socket?: ReturnType<typeof io>; | ||
constructor(rest: REST, opts: SocketOptions); | ||
constructor(rest: REST, opts: SocketOptions, agent?: Agent); | ||
destroy(): void; | ||
@@ -15,0 +17,0 @@ private initialise; |
@@ -19,7 +19,7 @@ /** | ||
class Socket { | ||
constructor(rest, opts) { | ||
constructor(rest, opts, agent) { | ||
this.debounces = new Set(); | ||
this.debounceWindow = opts.debounceWindow; | ||
this.log = opts.log; | ||
this.initialise(rest, opts.url); | ||
this.initialise(rest, opts.url, agent); | ||
} | ||
@@ -30,6 +30,7 @@ destroy() { | ||
} | ||
async initialise(rest, url) { | ||
async initialise(rest, url, agent) { | ||
try { | ||
const jwt = await rest.jwt(); | ||
this.socket = io__default["default"](url, { | ||
agent: agent, | ||
transportOptions: { | ||
@@ -36,0 +37,0 @@ polling: { |
@@ -16,2 +16,3 @@ /// <reference types="node" /> | ||
import type { StartWorkflowMutation, StartWorkflowMutationVariables } from './generated/graphql'; | ||
import Socket from './socket'; | ||
declare const asChain: import("ts-runtime-typecheck/mjs/TypeCast.type").OptionalTypeCast<{ | ||
@@ -81,3 +82,5 @@ components: Dictionary<Dictionary<unknown>>; | ||
fetchTelemetry(): Promise<void>; | ||
realtimeFeedback(channel: string, object: unknown): void; | ||
getSocket(): Socket; | ||
} | ||
export {}; |
@@ -12,3 +12,3 @@ import type { Logger } from './Logger.type'; | ||
import { REST } from './rest'; | ||
import Socket from './socket'; | ||
import type Socket from './socket'; | ||
export declare class EPI2ME { | ||
@@ -51,5 +51,3 @@ static version: string; | ||
get id(): Index; | ||
getSocket(): Socket; | ||
updateWorkerStatus: (newWorkerStatus: unknown) => void; | ||
realtimeFeedback(channel: string, object: unknown): void; | ||
setTimer(intervalName: 'downloadCheckInterval' | 'stateCheckInterval' | 'fileCheckInterval' | 'summaryTelemetryInterval', intervalDuration: Duration, cb: UnknownFunction): void; | ||
@@ -56,0 +54,0 @@ stopTimer(intervalGroupName: 'downloadCheckInterval' | 'stateCheckInterval' | 'fileCheckInterval' | 'summaryTelemetryInterval'): void; |
@@ -0,1 +1,2 @@ | ||
/// <reference types="node" /> | ||
import type { Logger } from './Logger.type'; | ||
@@ -5,2 +6,3 @@ import type { REST } from './rest'; | ||
import type { Duration } from './Duration'; | ||
import type { Agent } from 'http'; | ||
import io from 'socket.io-client'; | ||
@@ -12,3 +14,3 @@ export default class Socket { | ||
socket?: ReturnType<typeof io>; | ||
constructor(rest: REST, opts: SocketOptions); | ||
constructor(rest: REST, opts: SocketOptions, agent?: Agent); | ||
destroy(): void; | ||
@@ -15,0 +17,0 @@ private initialise; |
{ | ||
"name": "@metrichor/epi2me-api", | ||
"version": "6.0.7174788", | ||
"version": "6.0.7176693", | ||
"license": "MPL-2.0", | ||
@@ -5,0 +5,0 @@ "repository": "git@github.com:nanoporetech/epi2me-api.git", |
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
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
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
825040
18018