@metrichor/epi2me-web
Advanced tools
Comparing version 6.0.7339081 to 6.0.7346771
@@ -10,2 +10,3 @@ /// <reference types="node" /> | ||
constructor(opts: Partial<CoreOptions>, proxyAgent?: Agent); | ||
private get credentials(); | ||
initClient: () => ApolloClient<NormalizedCacheObject>; | ||
@@ -12,0 +13,0 @@ register(code: string, description: string): Promise<CredentialsResponse>; |
@@ -11,7 +11,6 @@ /** | ||
var gqlClient = require('./gql-client.js'); | ||
var index = require('./network/index.js'); | ||
var Logger = require('./Logger.js'); | ||
var fetch = require('./network/fetch.js'); | ||
var parseOptions = require('./parseOptions.js'); | ||
var graphql = require('./generated/graphql.js'); | ||
var common = require('./network/common.js'); | ||
var UserAgent_constants = require('./UserAgent.constants.js'); | ||
@@ -32,12 +31,9 @@ /* | ||
return gqlClient.createClient(this.log, () => { | ||
const client = { name: UserAgent_constants.USER_AGENT, version: this.options.agent_version }; | ||
const { jwt } = this.options; | ||
tsRuntimeTypecheck.invariant(tsRuntimeTypecheck.isString(jwt), 'A JWT is required to use this GraphQL client'); | ||
return (uri, init = {}) => { | ||
tsRuntimeTypecheck.invariant(tsRuntimeTypecheck.isString(this.options.jwt), 'A JWT is required to use this GraphQL client'); | ||
const { jwt } = this.options; | ||
const headers = index.writeCommonHeaders({ headers: new fetch.Headers(init.headers) }); | ||
headers.set('Authorization', `Bearer ${jwt}`); | ||
init.headers = headers; | ||
// NOTE we don't do anything proxy related here | ||
// it would be nice to offer the option but this is primarily used in the "web" | ||
// version which cannot reference a HTTPAgent that's required | ||
return fetch.fetch(uri, init); | ||
var _a; | ||
tsRuntimeTypecheck.invariant(tsRuntimeTypecheck.isString(uri), ``); | ||
return common.commonFetch(uri, Object.assign(Object.assign({}, init), { headers: Object.assign(Object.assign({}, ((_a = init.headers) !== null && _a !== void 0 ? _a : {})), { Authorization: `Bearer ${jwt}` }) }), { client }); | ||
}; | ||
@@ -102,9 +98,20 @@ }); | ||
} | ||
return index.Network.post('convert-ont', requestData, Object.assign(Object.assign({}, this.options), { log: Logger.NoopLogMethod, headers: { 'X-ONT-JWT': jwt } })); | ||
const client = { name: UserAgent_constants.USER_AGENT, version: this.options.agent_version }; | ||
const response = await common.commonFetch(new URL('convert-ont', this.context.url), { | ||
headers: { 'X-ONT-JWT': jwt }, | ||
}, { client }); | ||
if (!response.ok) { | ||
throw new Error(response.statusText); | ||
} | ||
const data = await response.json(); | ||
return data; | ||
} | ||
async healthCheck() { | ||
const result = (await index.Network.get('/status', Object.assign(Object.assign({}, this.options), { log: Logger.NoopLogMethod }))); | ||
return { | ||
status: tsRuntimeTypecheck.asBoolean(result.status), | ||
}; | ||
const client = { name: UserAgent_constants.USER_AGENT, version: this.options.agent_version }; | ||
const response = await common.commonFetch(new URL('status', this.context.url), {}, { client }); | ||
if (!response.ok) { | ||
throw new Error(response.statusText); | ||
} | ||
const data = await response.json(); | ||
return data; | ||
} | ||
@@ -111,0 +118,0 @@ } |
@@ -9,3 +9,2 @@ /** | ||
const NoopLogMethod = () => { }; | ||
const FallbackLogger = { | ||
@@ -30,3 +29,2 @@ info(...args) { | ||
exports.FallbackLogger = FallbackLogger; | ||
exports.NoopLogMethod = NoopLogMethod; | ||
//# sourceMappingURL=Logger.js.map |
@@ -16,10 +16,7 @@ /** | ||
/// <reference lib="dom" /> | ||
var _a, _b, _c, _e; | ||
const fetch = (_b = (_a = globalThis.fetch) === null || _a === void 0 ? void 0 : _a.bind(globalThis)) !== null && _b !== void 0 ? _b : crossFetch__default["default"]; | ||
const Request = (_c = globalThis.Request) !== null && _c !== void 0 ? _c : crossFetch.Request; | ||
var _a, _b, _e; | ||
(_b = (_a = globalThis.fetch) === null || _a === void 0 ? void 0 : _a.bind(globalThis)) !== null && _b !== void 0 ? _b : crossFetch__default["default"]; | ||
const Headers = (_e = globalThis.Headers) !== null && _e !== void 0 ? _e : crossFetch.Headers; | ||
exports.Headers = Headers; | ||
exports.Request = Request; | ||
exports.fetch = fetch; | ||
//# sourceMappingURL=fetch.js.map |
@@ -0,6 +1,12 @@ | ||
/// <reference types="node" /> | ||
/// <reference lib="dom" /> | ||
import type { Agent } from 'http'; | ||
import type { Credentials } from './Credentials.type'; | ||
import type { NetworkInterface } from './NetworkInterface.type'; | ||
export declare function signMessage(headers: Headers, createMessage: (headers: string[]) => string[], { apikey, apisecret }: Credentials, forceUppercaseHeaders?: boolean): void; | ||
export declare function sign(request: Request, credentials: Credentials): Request; | ||
export declare const SignedNetwork: NetworkInterface; | ||
import type { Client } from './Client.type'; | ||
export interface SignedFetchOptions { | ||
client: Client; | ||
credentials?: Credentials; | ||
agent?: Agent; | ||
} | ||
export declare function signMessage(init: RequestInit, client: Client, credentials?: Credentials): Headers; | ||
export declare function signedFetch(uri: string | URL, init: RequestInit, options: SignedFetchOptions): Promise<Response>; |
@@ -10,2 +10,3 @@ /// <reference types="node" /> | ||
constructor(opts: Partial<CoreOptions>, proxyAgent?: Agent); | ||
private get credentials(); | ||
initClient: () => ApolloClient<NormalizedCacheObject>; | ||
@@ -12,0 +13,0 @@ register(code: string, description: string): Promise<CredentialsResponse>; |
@@ -0,6 +1,12 @@ | ||
/// <reference types="node" /> | ||
/// <reference lib="dom" /> | ||
import type { Agent } from 'http'; | ||
import type { Credentials } from './Credentials.type'; | ||
import type { NetworkInterface } from './NetworkInterface.type'; | ||
export declare function signMessage(headers: Headers, createMessage: (headers: string[]) => string[], { apikey, apisecret }: Credentials, forceUppercaseHeaders?: boolean): void; | ||
export declare function sign(request: Request, credentials: Credentials): Request; | ||
export declare const SignedNetwork: NetworkInterface; | ||
import type { Client } from './Client.type'; | ||
export interface SignedFetchOptions { | ||
client: Client; | ||
credentials?: Credentials; | ||
agent?: Agent; | ||
} | ||
export declare function signMessage(init: RequestInit, client: Client, credentials?: Credentials): Headers; | ||
export declare function signedFetch(uri: string | URL, init: RequestInit, options: SignedFetchOptions): Promise<Response>; |
{ | ||
"name": "@metrichor/epi2me-web", | ||
"version": "6.0.7339081", | ||
"version": "6.0.7346771", | ||
"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
207
2
299156
5817