@ajustee/cc-frontoffice-browser
Advanced tools
Comparing version 0.1.9 to 0.2.0
@@ -15,7 +15,7 @@ export declare const enum CcDataType { | ||
private readonly url; | ||
private headers?; | ||
appId?: string; | ||
constructor(url: string, headers?: Record<string, string> | undefined); | ||
getConfigKeys(path?: string, headers?: Record<string, string>): Promise<CcKey[]>; | ||
appId?: string | undefined; | ||
defaultParams?: Record<string, string> | undefined; | ||
constructor(url: string, appId?: string | undefined, defaultParams?: Record<string, string> | undefined); | ||
getConfigKeys(path?: string, additionalParams?: Record<string, string>): Promise<CcKey[]>; | ||
private getConfigKeys2; | ||
} |
@@ -6,15 +6,16 @@ "use strict"; | ||
class CcFrontOffice { | ||
constructor(url, headers) { | ||
constructor(url, appId, defaultParams) { | ||
this.url = url; | ||
this.headers = headers; | ||
this.appId = appId; | ||
this.defaultParams = defaultParams; | ||
} | ||
; | ||
async getConfigKeys(path, headers) { | ||
async getConfigKeys(path, additionalParams) { | ||
if (!this.appId) | ||
throw new Error('App id is not defined.'); | ||
const requestHeaders = { [appIdHeader]: this.appId }; | ||
if (this.headers) | ||
Object.assign(requestHeaders, this.headers); | ||
if (headers) | ||
Object.assign(requestHeaders, headers); | ||
if (this.defaultParams) | ||
Object.assign(requestHeaders, this.defaultParams); | ||
if (additionalParams) | ||
Object.assign(requestHeaders, additionalParams); | ||
const response = await fetch(`${this.url}/${path ? `configurationKeys?path=${path}` : 'configurationKeys'}`, { | ||
@@ -30,10 +31,10 @@ method: CcLambdaMethod, | ||
} | ||
async getConfigKeys2(path, headers) { | ||
async getConfigKeys2(path, additionalParams) { | ||
if (!this.appId) | ||
throw new Error('App id is not defined.'); | ||
const requestHeaders = { [appIdHeader]: this.appId }; | ||
if (this.headers) | ||
Object.assign(requestHeaders, this.headers); | ||
if (headers) | ||
Object.assign(requestHeaders, headers); | ||
if (this.defaultParams) | ||
Object.assign(requestHeaders, this.defaultParams); | ||
if (additionalParams) | ||
Object.assign(requestHeaders, additionalParams); | ||
const response = await fetch(`${this.url}/${path ? `config/${path}` : 'config'}`, { | ||
@@ -40,0 +41,0 @@ method: CcLambdaMethod, |
{ | ||
"name": "@ajustee/cc-frontoffice-browser", | ||
"version": "0.1.9", | ||
"version": "0.2.0", | ||
"description": "Ajustee Config Center FrontOffice Browser API", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
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
2911
69