Comparing version 1.0.1 to 1.0.2
@@ -77,3 +77,3 @@ "use strict"; | ||
const authHeaders = yield getAuthHeaders(); | ||
requestSettings.headers = headers ? Object.assign({}, headers, authHeaders) : authHeaders; | ||
requestSettings.headers = Object.assign({}, system_1.default.getHttpHeaders(), headers, authHeaders); | ||
try { | ||
@@ -80,0 +80,0 @@ const url = `${system_1.default.nexus.getUrl()}/${sanitizeUri(uri)}`; |
{ | ||
"name": "bf-lib", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "the standard client library for block-5 services", |
@@ -40,5 +40,12 @@ "use strict"; | ||
} | ||
const httpHeaders = {}; | ||
const libModuleMap = new Map(); | ||
const nexus = yield Nexus_1.default(system, settings.nexus, settings.auth); | ||
const liveSyncConnectionOptions = settings.livesync ? Object.freeze(Object.assign({}, settings.livesync)) : null; | ||
function getHttpHeaders() { | ||
return Object.assign({}, httpHeaders); | ||
} | ||
function setHttpHeader(key, value) { | ||
httpHeaders[key] = value; | ||
} | ||
function getLibModule(type) { | ||
@@ -64,3 +71,3 @@ const libModule = libModuleMap.get(type); | ||
libModuleMap.set(Types_2.LibModule.MODULE, require('../module/Module').default); | ||
const instanceMethods = { getLibModule, liveSyncOptions, nexus }; | ||
const instanceMethods = { getHttpHeaders, setHttpHeader, getLibModule, liveSyncOptions, nexus }; | ||
Object.assign(instance, instanceMethods); | ||
@@ -67,0 +74,0 @@ Object.freeze(instance); |
@@ -17,2 +17,4 @@ import { EnumLiteralsOf, IUserEntity } from 'bf-types'; | ||
export interface SystemInstance { | ||
getHttpHeaders(): Record<string, string>; | ||
setHttpHeader(key: string, value: string): void; | ||
getLibModule: <T>(type: LibModule) => T; | ||
@@ -19,0 +21,0 @@ liveSyncOptions: () => Nullable<LiveSyncConnectionOptions>; |
55236
1292