@flatfile/listener
Advanced tools
Comparing version 0.3.14 to 0.3.15
@@ -35,3 +35,3 @@ import { Event, RecordsWithLinks } from '@flatfile/api/api'; | ||
declare class FlatfileEvent extends AuthenticatedClient { | ||
private readonly src; | ||
readonly src: Event; | ||
/** | ||
@@ -60,2 +60,3 @@ * Event ID from the API | ||
readonly namespace: string[]; | ||
readonly createdAt?: Date; | ||
/** | ||
@@ -62,0 +63,0 @@ * Fetch record data from Flatfile API via the event's dataUrl |
@@ -155,2 +155,12 @@ "use strict"; | ||
var import_axios = __toESM(require("axios")); | ||
// src/utils/helpers.ts | ||
var ensureSingleTrailingSlash = (url) => { | ||
while (url.endsWith("/")) { | ||
url = url.slice(0, -1); | ||
} | ||
return url + "/"; | ||
}; | ||
// src/events/authenticated.client.ts | ||
var AuthenticatedClient = class { | ||
@@ -161,3 +171,3 @@ constructor(accessToken, apiUrl) { | ||
this._accessToken = accessToken || bearerToken || "..."; | ||
this._apiUrl = apiUrl || FLATFILE_API_URL; | ||
this._apiUrl = apiUrl || FLATFILE_API_URL ? ensureSingleTrailingSlash(apiUrl || FLATFILE_API_URL) : void 0; | ||
} | ||
@@ -170,5 +180,8 @@ async fetch(url, options) { | ||
const axiosInstance = import_axios.default.create({ | ||
headers | ||
headers, | ||
validateStatus: (status) => { | ||
return status >= 200 && status <= 399; | ||
} | ||
}); | ||
const fetchUrl = this._apiUrl + "/" + url; | ||
const fetchUrl = this._apiUrl + url; | ||
const config = { | ||
@@ -259,2 +272,3 @@ url: fetchUrl, | ||
this.namespace = src.namespaces || []; | ||
this.createdAt = src.createdAt || void 0; | ||
const data = async (options) => this.fetchData(options); | ||
@@ -328,6 +342,7 @@ data.then = (onfulfilled, onrejected) => { | ||
} | ||
const secrets = await this.cache.init("secrets", async () => { | ||
const secretCacheKey = `secrets:${environmentId}${spaceId && `:${spaceId}`}`; | ||
const secrets = await this.cache.init(secretCacheKey, async () => { | ||
const secretsResponse = await this.fetch(getSecrets); | ||
const SecretMap = /* @__PURE__ */ new Map(); | ||
secretsResponse.forEach((secret) => { | ||
secretsResponse?.forEach((secret) => { | ||
SecretMap.set(secret.name, secret.value); | ||
@@ -334,0 +349,0 @@ }); |
{ | ||
"name": "@flatfile/listener", | ||
"version": "0.3.14", | ||
"version": "0.3.15", | ||
"description": "A PubSub Listener for configuring and using Flatfile", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
53569
1737