@adobe/aio-lib-events
Advanced tools
Comparing version 1.1.3 to 1.1.4
{ | ||
"name": "@adobe/aio-lib-events", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "Adobe I/O Events", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/adobe/aio-lib-events", |
@@ -513,2 +513,4 @@ <!-- | ||
| [retries] | <code>number</code> | Number of retries in case of 5xx errors. Default 0 (optional) | | ||
| [eventsBaseURL] | <code>string</code> | Base URL for Events Default https://api.adobe.io (optional) | | ||
| [eventsIngressURL] | <code>string</code> | Ingress URL for Events. Default https://eventsingress.adobe.io (optional) | | ||
@@ -515,0 +517,0 @@ <a name="EventsJournalOptions"></a> |
@@ -31,4 +31,2 @@ /* | ||
const EVENTS_BASE_URL = process.env.EVENTS_BASE_URL || 'https://api.adobe.io' | ||
const EVENTS_INGRESS_URL = process.env.EVENTS_INGRESS_URL || 'https://eventsingress.adobe.io' | ||
/** | ||
@@ -38,2 +36,4 @@ * @typedef {object} EventsCoreAPIOptions | ||
* @property {number} [retries] Number of retries in case of 5xx errors. Default 0 (optional) | ||
* @property {string} [eventsBaseURL] Base URL for Events Default https://api.adobe.io (optional) | ||
* @property {string} [eventsIngressURL] Ingress URL for Events. Default https://eventsingress.adobe.io (optional) | ||
*/ | ||
@@ -105,2 +105,5 @@ /** | ||
this.accessToken = accessToken | ||
/** Initialise base and Ingress URLs */ | ||
this.__initLibURLs() | ||
return this | ||
@@ -395,3 +398,3 @@ } | ||
const retries = (this.httpOptions && this.httpOptions.retries) || 0 | ||
const url = EVENTS_INGRESS_URL | ||
const url = this.httpOptions.eventsIngressURL | ||
const sdkDetails = { requestOptions: requestOptions, url: url } | ||
@@ -641,4 +644,10 @@ return new Promise((resolve, reject) => { | ||
__getUrl (path) { | ||
return EVENTS_BASE_URL + path | ||
return this.httpOptions.eventsBaseURL + path | ||
} | ||
__initLibURLs () { | ||
this.httpOptions = this.httpOptions || {} | ||
this.httpOptions.eventsBaseURL = this.httpOptions.eventsBaseURL || 'https://api.adobe.io' | ||
this.httpOptions.eventsIngressURL = this.httpOptions.eventsIngressURL || 'https://eventsingress.adobe.io' | ||
} | ||
} | ||
@@ -645,0 +654,0 @@ |
@@ -37,2 +37,4 @@ /* | ||
const journalUrl = 'http://journal-url/events/organizations/orgId/integrations/integId/regId' | ||
const EVENTS_BASE_URL = 'fakebaseurl' | ||
const EVENTS_INGRESS_URL = 'fakeingressurl' | ||
@@ -55,2 +57,14 @@ // ///////////////////////////////////////////// | ||
it('sdk init test', async () => { | ||
const options = { | ||
eventsBaseURL: EVENTS_BASE_URL, | ||
eventsIngressURL: EVENTS_INGRESS_URL | ||
} | ||
const sdkClient = await sdk.init(gOrganizationId, gApiKey, gAccessToken, options) | ||
expect(sdkClient.organizationId).toBe(gOrganizationId) | ||
expect(sdkClient.apiKey).toBe(gApiKey) | ||
expect(sdkClient.accessToken).toBe(gAccessToken) | ||
expect(sdkClient.httpOptions.eventsBaseURL).toBe(EVENTS_BASE_URL) | ||
expect(sdkClient.httpOptions.eventsIngressURL).toBe(EVENTS_INGRESS_URL) | ||
}) | ||
it('sdk init test with URL options', async () => { | ||
const sdkClient = await createSdkClient() | ||
@@ -57,0 +71,0 @@ expect(sdkClient.organizationId).toBe(gOrganizationId) |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
200209
3315
566
13