@flatfile/listener
Advanced tools
Comparing version 0.1.2 to 0.2.0
# @flatfile/listener | ||
## 0.2.0 | ||
### Minor Changes | ||
- 637342b: Remove @flatfile/api from listener | ||
## 0.1.2 | ||
@@ -4,0 +10,0 @@ |
@@ -1,16 +0,15 @@ | ||
import { FetchAPI, DefaultApi, Event } from '@flatfile/api'; | ||
import { Flatfile } from '@flatfile/api'; | ||
declare class AuthenticatedClient { | ||
private _api?; | ||
private _fetchApi?; | ||
_accessToken?: string; | ||
_apiUrl?: string; | ||
fetchApi: FetchAPI; | ||
constructor(accessToken?: string, apiUrl?: string); | ||
get api(): DefaultApi; | ||
fetch(url: string): any; | ||
setVariables({ accessToken, apiUrl, fetchApi, }: { | ||
fetch(url: string): Promise<any>; | ||
/** | ||
* | ||
* @deprecated use @flatfile/cross-env-config instead | ||
*/ | ||
setVariables({ accessToken, apiUrl, }: { | ||
accessToken?: string; | ||
apiUrl?: string; | ||
fetchApi?: any; | ||
}): void; | ||
@@ -50,3 +49,3 @@ } | ||
readonly cache: EventCache; | ||
constructor(src: Event, accessToken?: string, apiUrl?: string); | ||
constructor(src: Flatfile.Event, accessToken?: string, apiUrl?: string); | ||
/** | ||
@@ -105,3 +104,3 @@ * Should return either event body if expanded already or fetch data from the | ||
*/ | ||
dispatchEvent(event: FlatfileEvent | Event | any): Promise<void>; | ||
dispatchEvent(event: FlatfileEvent | Flatfile.Event | any): Promise<void>; | ||
/** | ||
@@ -112,3 +111,3 @@ * @deprecated legacy shim for receiving events from the VM layer | ||
*/ | ||
routeEvent(event: Event): Promise<void>; | ||
routeEvent(event: Flatfile.Event): Promise<void>; | ||
/** | ||
@@ -226,8 +225,10 @@ * Actually trigger the event listeners on this particular target | ||
_environmentId?: string; | ||
_fetchApi: FetchAPI; | ||
constructor({ apiUrl, accessToken, environmentId, fetchApi, }: { | ||
constructor({ apiUrl, accessToken, environmentId, }: { | ||
apiUrl: string; | ||
accessToken: string; | ||
environmentId?: string; | ||
fetchApi: FetchAPI; | ||
/** | ||
* @deprecated | ||
*/ | ||
fetchApi: any; | ||
}); | ||
@@ -237,15 +238,2 @@ mountEventHandler(handler: EventHandler): this; | ||
declare class PollingEventDriver extends EventDriver { | ||
environmentId?: string; | ||
apiUrl: string; | ||
accessToken: string; | ||
constructor({ environmentId, apiUrl, accessToken, }: { | ||
environmentId?: string; | ||
apiUrl?: string; | ||
accessToken?: string; | ||
}); | ||
start(): void; | ||
shutdown(): void; | ||
} | ||
/** | ||
@@ -273,2 +261,2 @@ * Flatfile's Virtual Machine is stateless / serverless. So when a new event | ||
export { Arrayable, AuthenticatedClient, Browser, Client, EventCallback, EventFilter, EventHandler, FlatfileEvent, FlatfileListener, FlatfileVirtualMachine, PollingEventDriver }; | ||
export { Arrayable, AuthenticatedClient, Browser, Client, EventCallback, EventDriver, EventFilter, EventHandler, FlatfileEvent, FlatfileListener, FlatfileVirtualMachine }; |
@@ -8,5 +8,2 @@ "use strict"; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __commonJS = (cb, mod) => function __require() { | ||
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; | ||
}; | ||
var __export = (target, all) => { | ||
@@ -34,239 +31,2 @@ for (var name in all) | ||
// ../../node_modules/ansi-colors/symbols.js | ||
var require_symbols = __commonJS({ | ||
"../../node_modules/ansi-colors/symbols.js"(exports, module2) { | ||
"use strict"; | ||
var isHyper = typeof process !== "undefined" && process.env.TERM_PROGRAM === "Hyper"; | ||
var isWindows = typeof process !== "undefined" && process.platform === "win32"; | ||
var isLinux = typeof process !== "undefined" && process.platform === "linux"; | ||
var common = { | ||
ballotDisabled: "\u2612", | ||
ballotOff: "\u2610", | ||
ballotOn: "\u2611", | ||
bullet: "\u2022", | ||
bulletWhite: "\u25E6", | ||
fullBlock: "\u2588", | ||
heart: "\u2764", | ||
identicalTo: "\u2261", | ||
line: "\u2500", | ||
mark: "\u203B", | ||
middot: "\xB7", | ||
minus: "\uFF0D", | ||
multiplication: "\xD7", | ||
obelus: "\xF7", | ||
pencilDownRight: "\u270E", | ||
pencilRight: "\u270F", | ||
pencilUpRight: "\u2710", | ||
percent: "%", | ||
pilcrow2: "\u2761", | ||
pilcrow: "\xB6", | ||
plusMinus: "\xB1", | ||
question: "?", | ||
section: "\xA7", | ||
starsOff: "\u2606", | ||
starsOn: "\u2605", | ||
upDownArrow: "\u2195" | ||
}; | ||
var windows = Object.assign({}, common, { | ||
check: "\u221A", | ||
cross: "\xD7", | ||
ellipsisLarge: "...", | ||
ellipsis: "...", | ||
info: "i", | ||
questionSmall: "?", | ||
pointer: ">", | ||
pointerSmall: "\xBB", | ||
radioOff: "( )", | ||
radioOn: "(*)", | ||
warning: "\u203C" | ||
}); | ||
var other = Object.assign({}, common, { | ||
ballotCross: "\u2718", | ||
check: "\u2714", | ||
cross: "\u2716", | ||
ellipsisLarge: "\u22EF", | ||
ellipsis: "\u2026", | ||
info: "\u2139", | ||
questionFull: "\uFF1F", | ||
questionSmall: "\uFE56", | ||
pointer: isLinux ? "\u25B8" : "\u276F", | ||
pointerSmall: isLinux ? "\u2023" : "\u203A", | ||
radioOff: "\u25EF", | ||
radioOn: "\u25C9", | ||
warning: "\u26A0" | ||
}); | ||
module2.exports = isWindows && !isHyper ? windows : other; | ||
Reflect.defineProperty(module2.exports, "common", { enumerable: false, value: common }); | ||
Reflect.defineProperty(module2.exports, "windows", { enumerable: false, value: windows }); | ||
Reflect.defineProperty(module2.exports, "other", { enumerable: false, value: other }); | ||
} | ||
}); | ||
// ../../node_modules/ansi-colors/index.js | ||
var require_ansi_colors = __commonJS({ | ||
"../../node_modules/ansi-colors/index.js"(exports, module2) { | ||
"use strict"; | ||
var isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val); | ||
var ANSI_REGEX = /[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g; | ||
var hasColor = () => { | ||
if (typeof process !== "undefined") { | ||
return process.env.FORCE_COLOR !== "0"; | ||
} | ||
return false; | ||
}; | ||
var create = () => { | ||
const colors = { | ||
enabled: hasColor(), | ||
visible: true, | ||
styles: {}, | ||
keys: {} | ||
}; | ||
const ansi = (style2) => { | ||
let open = style2.open = `\x1B[${style2.codes[0]}m`; | ||
let close = style2.close = `\x1B[${style2.codes[1]}m`; | ||
let regex = style2.regex = new RegExp(`\\u001b\\[${style2.codes[1]}m`, "g"); | ||
style2.wrap = (input, newline) => { | ||
if (input.includes(close)) | ||
input = input.replace(regex, close + open); | ||
let output = open + input + close; | ||
return newline ? output.replace(/\r*\n/g, `${close}$&${open}`) : output; | ||
}; | ||
return style2; | ||
}; | ||
const wrap = (style2, input, newline) => { | ||
return typeof style2 === "function" ? style2(input) : style2.wrap(input, newline); | ||
}; | ||
const style = (input, stack) => { | ||
if (input === "" || input == null) | ||
return ""; | ||
if (colors.enabled === false) | ||
return input; | ||
if (colors.visible === false) | ||
return ""; | ||
let str = "" + input; | ||
let nl = str.includes("\n"); | ||
let n = stack.length; | ||
if (n > 0 && stack.includes("unstyle")) { | ||
stack = [.../* @__PURE__ */ new Set(["unstyle", ...stack])].reverse(); | ||
} | ||
while (n-- > 0) | ||
str = wrap(colors.styles[stack[n]], str, nl); | ||
return str; | ||
}; | ||
const define = (name, codes, type) => { | ||
colors.styles[name] = ansi({ name, codes }); | ||
let keys = colors.keys[type] || (colors.keys[type] = []); | ||
keys.push(name); | ||
Reflect.defineProperty(colors, name, { | ||
configurable: true, | ||
enumerable: true, | ||
set(value) { | ||
colors.alias(name, value); | ||
}, | ||
get() { | ||
let color = (input) => style(input, color.stack); | ||
Reflect.setPrototypeOf(color, colors); | ||
color.stack = this.stack ? this.stack.concat(name) : [name]; | ||
return color; | ||
} | ||
}); | ||
}; | ||
define("reset", [0, 0], "modifier"); | ||
define("bold", [1, 22], "modifier"); | ||
define("dim", [2, 22], "modifier"); | ||
define("italic", [3, 23], "modifier"); | ||
define("underline", [4, 24], "modifier"); | ||
define("inverse", [7, 27], "modifier"); | ||
define("hidden", [8, 28], "modifier"); | ||
define("strikethrough", [9, 29], "modifier"); | ||
define("black", [30, 39], "color"); | ||
define("red", [31, 39], "color"); | ||
define("green", [32, 39], "color"); | ||
define("yellow", [33, 39], "color"); | ||
define("blue", [34, 39], "color"); | ||
define("magenta", [35, 39], "color"); | ||
define("cyan", [36, 39], "color"); | ||
define("white", [37, 39], "color"); | ||
define("gray", [90, 39], "color"); | ||
define("grey", [90, 39], "color"); | ||
define("bgBlack", [40, 49], "bg"); | ||
define("bgRed", [41, 49], "bg"); | ||
define("bgGreen", [42, 49], "bg"); | ||
define("bgYellow", [43, 49], "bg"); | ||
define("bgBlue", [44, 49], "bg"); | ||
define("bgMagenta", [45, 49], "bg"); | ||
define("bgCyan", [46, 49], "bg"); | ||
define("bgWhite", [47, 49], "bg"); | ||
define("blackBright", [90, 39], "bright"); | ||
define("redBright", [91, 39], "bright"); | ||
define("greenBright", [92, 39], "bright"); | ||
define("yellowBright", [93, 39], "bright"); | ||
define("blueBright", [94, 39], "bright"); | ||
define("magentaBright", [95, 39], "bright"); | ||
define("cyanBright", [96, 39], "bright"); | ||
define("whiteBright", [97, 39], "bright"); | ||
define("bgBlackBright", [100, 49], "bgBright"); | ||
define("bgRedBright", [101, 49], "bgBright"); | ||
define("bgGreenBright", [102, 49], "bgBright"); | ||
define("bgYellowBright", [103, 49], "bgBright"); | ||
define("bgBlueBright", [104, 49], "bgBright"); | ||
define("bgMagentaBright", [105, 49], "bgBright"); | ||
define("bgCyanBright", [106, 49], "bgBright"); | ||
define("bgWhiteBright", [107, 49], "bgBright"); | ||
colors.ansiRegex = ANSI_REGEX; | ||
colors.hasColor = colors.hasAnsi = (str) => { | ||
colors.ansiRegex.lastIndex = 0; | ||
return typeof str === "string" && str !== "" && colors.ansiRegex.test(str); | ||
}; | ||
colors.alias = (name, color) => { | ||
let fn = typeof color === "string" ? colors[color] : color; | ||
if (typeof fn !== "function") { | ||
throw new TypeError("Expected alias to be the name of an existing color (string) or a function"); | ||
} | ||
if (!fn.stack) { | ||
Reflect.defineProperty(fn, "name", { value: name }); | ||
colors.styles[name] = fn; | ||
fn.stack = [name]; | ||
} | ||
Reflect.defineProperty(colors, name, { | ||
configurable: true, | ||
enumerable: true, | ||
set(value) { | ||
colors.alias(name, value); | ||
}, | ||
get() { | ||
let color2 = (input) => style(input, color2.stack); | ||
Reflect.setPrototypeOf(color2, colors); | ||
color2.stack = this.stack ? this.stack.concat(fn.stack) : fn.stack; | ||
return color2; | ||
} | ||
}); | ||
}; | ||
colors.theme = (custom) => { | ||
if (!isObject(custom)) | ||
throw new TypeError("Expected theme to be an object"); | ||
for (let name of Object.keys(custom)) { | ||
colors.alias(name, custom[name]); | ||
} | ||
return colors; | ||
}; | ||
colors.alias("unstyle", (str) => { | ||
if (typeof str === "string" && str !== "") { | ||
colors.ansiRegex.lastIndex = 0; | ||
return str.replace(colors.ansiRegex, ""); | ||
} | ||
return ""; | ||
}); | ||
colors.alias("noop", (str) => str); | ||
colors.none = colors.clear = colors.noop; | ||
colors.stripColor = colors.unstyle; | ||
colors.symbols = require_symbols(); | ||
colors.define = define; | ||
return colors; | ||
}; | ||
module2.exports = create(); | ||
module2.exports.create = create; | ||
} | ||
}); | ||
// src/index.ts | ||
@@ -278,7 +38,7 @@ var src_exports = {}; | ||
Client: () => Client, | ||
EventDriver: () => EventDriver, | ||
EventHandler: () => EventHandler, | ||
FlatfileEvent: () => FlatfileEvent, | ||
FlatfileListener: () => FlatfileListener, | ||
FlatfileVirtualMachine: () => FlatfileVirtualMachine, | ||
PollingEventDriver: () => PollingEventDriver | ||
FlatfileVirtualMachine: () => FlatfileVirtualMachine | ||
}); | ||
@@ -288,32 +48,10 @@ module.exports = __toCommonJS(src_exports); | ||
// src/events/authenticated.client.ts | ||
var import_api = require("@flatfile/api"); | ||
var import_node_fetch = __toESM(require("node-fetch")); | ||
var FLATFILE_API_URL = process.env.AGENT_INTERNAL_URL || "http://localhost:3000"; | ||
var import_axios = __toESM(require("axios")); | ||
var AuthenticatedClient = class { | ||
constructor(accessToken, apiUrl) { | ||
const FLATFILE_API_URL = process.env.AGENT_INTERNAL_URL || "http://localhost:3000"; | ||
this._accessToken = accessToken || process.env.FLATFILE_BEARER_TOKEN || "..."; | ||
this._apiUrl = apiUrl || FLATFILE_API_URL; | ||
} | ||
get api() { | ||
if (this._api) { | ||
return this._api; | ||
} | ||
const accessToken = this._accessToken; | ||
const apiUrl = this._apiUrl; | ||
const ClientConfig = new import_api.Configuration({ | ||
basePath: `${apiUrl}/v1`, | ||
fetchApi: import_node_fetch.default, | ||
accessToken, | ||
headers: { | ||
Authorization: `Bearer ${accessToken || "..."}`, | ||
"x-disable-hooks": "true" | ||
} | ||
}); | ||
this._api = new import_api.DefaultApi(ClientConfig); | ||
return this._api; | ||
} | ||
fetch(url) { | ||
if (this._fetchApi) { | ||
return this._fetchApi; | ||
} | ||
const headers = { | ||
@@ -324,15 +62,16 @@ Authorization: `Bearer ${this._accessToken}`, | ||
const fetchUrl = this._apiUrl + "/" + url; | ||
this._fetchApi = (0, import_node_fetch.default)(fetchUrl, { | ||
headers | ||
}).then((resp) => resp.json()).then((resp) => resp.data); | ||
return this._fetchApi; | ||
console.log({ fetchUrl }); | ||
return import_axios.default.get(fetchUrl, { headers }).then((resp) => resp.data.data).catch((err) => { | ||
}); | ||
} | ||
/** | ||
* | ||
* @deprecated use @flatfile/cross-env-config instead | ||
*/ | ||
setVariables({ | ||
accessToken, | ||
apiUrl, | ||
fetchApi | ||
apiUrl | ||
}) { | ||
this._accessToken = accessToken; | ||
this._apiUrl = apiUrl; | ||
this.fetchApi = fetchApi; | ||
} | ||
@@ -493,8 +232,8 @@ }; | ||
} | ||
for (var c2 = 0; c2 < segment.length; c2++) { | ||
var char = segment[c2]; | ||
for (var c = 0; c < segment.length; c++) { | ||
var char = segment[c]; | ||
if (char === "\\") { | ||
if (c2 < segment.length - 1) { | ||
result += escapeRegExpChar(segment[c2 + 1]); | ||
c2++; | ||
if (c < segment.length - 1) { | ||
result += escapeRegExpChar(segment[c + 1]); | ||
c++; | ||
} | ||
@@ -784,4 +523,3 @@ } else if (char === "?") { | ||
accessToken, | ||
environmentId, | ||
fetchApi | ||
environmentId | ||
}) { | ||
@@ -792,3 +530,2 @@ super(); | ||
this._environmentId = environmentId || ""; | ||
this._fetchApi = fetchApi || void 0; | ||
} | ||
@@ -798,4 +535,3 @@ mountEventHandler(handler) { | ||
accessToken: this._accessToken, | ||
apiUrl: this._apiUrl, | ||
fetchApi: this._fetchApi | ||
apiUrl: this._apiUrl | ||
}); | ||
@@ -807,60 +543,2 @@ this._handler = handler; | ||
// src/event-drivers/Polling.ts | ||
var import_ansi_colors = __toESM(require_ansi_colors()); | ||
var events = /* @__PURE__ */ new Map(); | ||
var PollingEventDriver = class extends EventDriver { | ||
constructor({ | ||
environmentId, | ||
apiUrl, | ||
accessToken | ||
}) { | ||
super(); | ||
this.apiUrl = apiUrl || process.env.AGENT_INTERNAL_URL || "https://platform.flatfile.com/api/"; | ||
this.accessToken = accessToken || process.env.FLATFILE_API_KEY || process.env.FLATFILE_BEARER_TOKEN || "..."; | ||
this.environmentId = environmentId || process.env.FLATFILE_ENVIRONMENT_ID; | ||
} | ||
start() { | ||
this.handler.setVariables({ | ||
accessToken: this.accessToken, | ||
apiUrl: this.apiUrl | ||
}); | ||
let lastTimestamp = new Date(Date.now() - 5e3); | ||
if (!this.environmentId) { | ||
throw new Error("environmentId is required"); | ||
} | ||
setInterval(() => { | ||
this.handler.api.getEvents({ | ||
since: lastTimestamp, | ||
includeAcknowledged: false, | ||
environmentId: this.environmentId | ||
}).then((res) => { | ||
process.stdout.cursorTo(0); | ||
process.stdout.clearLine(1); | ||
if (!res.data?.length) { | ||
process.stdout.write( | ||
`${import_ansi_colors.default.white.bgMagentaBright( | ||
"listening for events" | ||
)} at ${lastTimestamp.toLocaleString()}` | ||
); | ||
} | ||
res.data?.forEach((e) => { | ||
if (!events.get(e.id)) { | ||
process.stdout.write( | ||
`${import_ansi_colors.default.white.bgBlue(e.topic)} ${import_ansi_colors.default.white.bgYellow( | ||
e.id | ||
)} ${e.createdAt?.toLocaleString()} | ||
` | ||
); | ||
events.set(e.id, true); | ||
this.dispatchEvent(e); | ||
} | ||
}); | ||
}).catch(console.error); | ||
lastTimestamp = new Date(Date.now() - 5e3); | ||
}, 500); | ||
} | ||
shutdown() { | ||
} | ||
}; | ||
// src/event-drivers/FlatfileVirtualMachine.ts | ||
@@ -892,7 +570,7 @@ var FlatfileVirtualMachine = class extends EventDriver { | ||
Client, | ||
EventDriver, | ||
EventHandler, | ||
FlatfileEvent, | ||
FlatfileListener, | ||
FlatfileVirtualMachine, | ||
PollingEventDriver | ||
FlatfileVirtualMachine | ||
}); |
{ | ||
"name": "@flatfile/listener", | ||
"version": "0.1.2", | ||
"version": "0.2.0", | ||
"description": "A PubSub Listener for configuring and using Flatfile", | ||
@@ -30,6 +30,9 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@flatfile/api": "^0.0.19", | ||
"flat": "^5.0.2", | ||
"node-fetch": "^2.6.7" | ||
"ansi-colors": "^4.1.3", | ||
"flat": "^5.0.2" | ||
}, | ||
"peerDependencies": { | ||
"@flatfile/api": "^1.4.5", | ||
"axios": "^1.4.0" | ||
} | ||
} |
import { EventDriver } from './_EventDriver' | ||
import { EventHandler } from '../events' | ||
import { FetchAPI } from '@flatfile/api' | ||
@@ -9,3 +8,2 @@ export class Browser extends EventDriver { | ||
public _environmentId?: string | ||
public _fetchApi: FetchAPI | ||
@@ -16,3 +14,2 @@ constructor({ | ||
environmentId, | ||
fetchApi, | ||
}: { | ||
@@ -22,3 +19,6 @@ apiUrl: string | ||
environmentId?: string | ||
fetchApi: FetchAPI | ||
/** | ||
* @deprecated | ||
*/ | ||
fetchApi: any | ||
}) { | ||
@@ -29,3 +29,2 @@ super() | ||
this._environmentId = environmentId || '' | ||
this._fetchApi = fetchApi || undefined | ||
} | ||
@@ -37,3 +36,2 @@ | ||
apiUrl: this._apiUrl, | ||
fetchApi: this._fetchApi, | ||
}) | ||
@@ -40,0 +38,0 @@ |
export * from './Browser' | ||
export * from './Polling' | ||
export * from './FlatfileVirtualMachine' | ||
export * from './_EventDriver' |
@@ -1,46 +0,18 @@ | ||
import { Configuration, DefaultApi, FetchAPI } from '@flatfile/api' | ||
import fetch from 'node-fetch' | ||
import axios from 'axios' | ||
const FLATFILE_API_URL = | ||
process.env.AGENT_INTERNAL_URL || 'http://localhost:3000' | ||
export class AuthenticatedClient { | ||
private _api?: DefaultApi | ||
private _fetchApi?: FetchAPI | ||
public _accessToken?: string | ||
public _apiUrl?: string | ||
public fetchApi: FetchAPI | ||
constructor(accessToken?: string, apiUrl?: string) { | ||
const FLATFILE_API_URL = | ||
process.env.AGENT_INTERNAL_URL || 'http://localhost:3000' | ||
this._accessToken = | ||
accessToken || process.env.FLATFILE_BEARER_TOKEN || '...' | ||
this._apiUrl = apiUrl || FLATFILE_API_URL | ||
} | ||
get api(): DefaultApi { | ||
if (this._api) { | ||
return this._api | ||
} | ||
const accessToken = this._accessToken | ||
const apiUrl = this._apiUrl | ||
const ClientConfig = new Configuration({ | ||
basePath: `${apiUrl}/v1`, | ||
fetchApi: fetch, | ||
accessToken, | ||
headers: { | ||
Authorization: `Bearer ${accessToken || '...'}`, | ||
'x-disable-hooks': 'true', | ||
}, | ||
}) | ||
this._api = new DefaultApi(ClientConfig) | ||
return this._api | ||
} | ||
fetch(url: string) { | ||
if (this._fetchApi) { | ||
return this._fetchApi | ||
} | ||
const headers = { | ||
@@ -51,25 +23,20 @@ Authorization: `Bearer ${this._accessToken}`, | ||
const fetchUrl = this._apiUrl + '/' + url | ||
this._fetchApi = fetch(fetchUrl, { | ||
headers, | ||
}) | ||
.then((resp: any) => resp.json()) | ||
.then((resp: any) => resp.data) | ||
return this._fetchApi | ||
console.log({ fetchUrl }) | ||
return axios.get(fetchUrl, { headers }).then((resp: any) => resp.data.data).catch((err: any) => {}) | ||
} | ||
/** | ||
* | ||
* @deprecated use @flatfile/cross-env-config instead | ||
*/ | ||
public setVariables({ | ||
accessToken, | ||
apiUrl, | ||
fetchApi, | ||
}: { | ||
accessToken?: string | ||
apiUrl?: string | ||
fetchApi?: any | ||
}) { | ||
this._accessToken = accessToken | ||
this._apiUrl = apiUrl | ||
this.fetchApi = fetchApi | ||
} | ||
} |
import { AuthenticatedClient } from './authenticated.client' | ||
import { EventCallback, FlatfileEvent } from './flatfile.event' | ||
import { glob, objectMatches } from './glob.match' | ||
import { Event as ApiEvent } from '@flatfile/api' | ||
import type { Flatfile } from '@flatfile/api' | ||
@@ -80,3 +80,3 @@ /** | ||
*/ | ||
async dispatchEvent(event: FlatfileEvent | ApiEvent | any): Promise<void> { | ||
async dispatchEvent(event: FlatfileEvent | Flatfile.Event | any): Promise<void> { | ||
if (!(event instanceof FlatfileEvent)) { | ||
@@ -111,3 +111,3 @@ event = new FlatfileEvent(event, this._accessToken, this._apiUrl) | ||
*/ | ||
async routeEvent(event: ApiEvent) { | ||
async routeEvent(event: Flatfile.Event) { | ||
return this.dispatchEvent(event) | ||
@@ -114,0 +114,0 @@ } |
import { AuthenticatedClient } from './authenticated.client' | ||
import { Event } from '@flatfile/api' | ||
import type { Flatfile } from '@flatfile/api' | ||
import { EventCache } from './cache' | ||
@@ -29,3 +29,3 @@ export class FlatfileEvent extends AuthenticatedClient { | ||
constructor( | ||
private readonly src: Event, | ||
private readonly src: Flatfile.Event, | ||
accessToken?: string, | ||
@@ -32,0 +32,0 @@ apiUrl?: string |
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
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
5
0
73101
4
29
2323
+ Addedansi-colors@^4.1.3
+ Added@flatfile/api@1.9.16(transitive)
+ Added@flatfile/cross-env-config@0.0.4(transitive)
+ Added@types/pako@2.0.1(transitive)
+ Addedansi-colors@4.1.3(transitive)
+ Addedasynckit@0.4.0(transitive)
+ Addedaxios@1.7.7(transitive)
+ Addedcall-bind@1.0.7(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedes-define-property@1.0.0(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedfollow-redirects@1.15.9(transitive)
+ Addedform-data@4.0.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-intrinsic@1.2.4(transitive)
+ Addedgopd@1.0.1(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.0.3(transitive)
+ Addedhas-symbols@1.0.3(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedjs-base64@3.7.2(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedobject-inspect@1.13.2(transitive)
+ Addedpako@2.0.1(transitive)
+ Addedproxy-from-env@1.1.0(transitive)
+ Addedqs@6.11.2(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedside-channel@1.0.6(transitive)
+ Addedurl-join@4.0.1(transitive)
- Removed@flatfile/api@^0.0.19
- Removednode-fetch@^2.6.7
- Removed@flatfile/api@0.0.19(transitive)