@flatfile/listener 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +14 -0
- package/dist/index.d.ts +36 -3
- package/dist/index.js +5059 -4940
- package/dist/index.mjs +5070 -4947
- package/package.json +2 -2
- package/src/event-drivers/Browser.ts +39 -0
- package/src/event-drivers/FlatfileVirtualMachine.ts +20 -1
- package/src/event-drivers/index.ts +1 -0
- package/src/events/authenticated.client.ts +32 -16
- package/src/events/cache.ts +48 -0
- package/src/events/event.handler.ts +10 -4
- package/src/events/flatfile.event.ts +10 -20
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @flatfile/listener@0.0.
|
|
2
|
+
> @flatfile/listener@0.0.8 build
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --dts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
[34mCLI[39m Target: es6
|
|
9
9
|
[34mESM[39m Build start
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
|
-
[32mESM[39m [1mdist/index.mjs [22m[
|
|
12
|
-
[32mESM[39m ⚡️ Build success in
|
|
13
|
-
[32mCJS[39m [1mdist/index.js [22m[
|
|
14
|
-
[32mCJS[39m ⚡️ Build success in
|
|
11
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m638.80 KB[39m
|
|
12
|
+
[32mESM[39m ⚡️ Build success in 339ms
|
|
13
|
+
[32mCJS[39m [1mdist/index.js [22m[32m639.47 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 346ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 1683ms
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m7.14 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @flatfile/listener
|
|
2
2
|
|
|
3
|
+
## 0.0.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 74852f3: Adds Event Cache
|
|
8
|
+
- 65aea7a: Adds conditional fetchApi variable to authenticated client to allow for client-side use
|
|
9
|
+
|
|
10
|
+
## 0.0.7
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [72447b1]
|
|
15
|
+
- @flatfile/hooks@1.3.0
|
|
16
|
+
|
|
3
17
|
## 0.0.6
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,25 @@
|
|
|
1
|
-
import { DefaultApi, Event } from '@flatfile/api';
|
|
1
|
+
import { FetchAPI, DefaultApi, Event } from '@flatfile/api';
|
|
2
2
|
|
|
3
3
|
declare class AuthenticatedClient {
|
|
4
|
+
private _accessToken?;
|
|
5
|
+
private _apiUrl?;
|
|
4
6
|
private _api?;
|
|
7
|
+
fetchApi: FetchAPI;
|
|
5
8
|
get api(): DefaultApi;
|
|
6
|
-
private _fetch?;
|
|
7
9
|
fetch(url: string): any;
|
|
10
|
+
setVariables({ accessToken, apiUrl, fetchApi, }: {
|
|
11
|
+
accessToken?: string;
|
|
12
|
+
apiUrl?: string;
|
|
13
|
+
fetchApi?: any;
|
|
14
|
+
}): void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare class EventCache {
|
|
18
|
+
private eventCache;
|
|
19
|
+
init<T>(key: string, callback: () => Promise<T>): Promise<T>;
|
|
20
|
+
set<T>(key: string, callback: () => Promise<T>): Promise<T>;
|
|
21
|
+
get<T>(key: string): T;
|
|
22
|
+
delete(key?: string | string[]): void;
|
|
8
23
|
}
|
|
9
24
|
|
|
10
25
|
declare class FlatfileEvent extends AuthenticatedClient {
|
|
@@ -29,6 +44,7 @@ declare class FlatfileEvent extends AuthenticatedClient {
|
|
|
29
44
|
readonly action: string;
|
|
30
45
|
readonly context: any;
|
|
31
46
|
readonly payload: any;
|
|
47
|
+
readonly cache: EventCache;
|
|
32
48
|
constructor(src: Event);
|
|
33
49
|
/**
|
|
34
50
|
* Should return either event body if expanded already or fetch data from the
|
|
@@ -37,6 +53,8 @@ declare class FlatfileEvent extends AuthenticatedClient {
|
|
|
37
53
|
* @todo this should work with the included callback URL
|
|
38
54
|
*/
|
|
39
55
|
get data(): Promise<any>;
|
|
56
|
+
private afterAllCallbacks;
|
|
57
|
+
afterAll<T>(callback: () => T, cacheKey?: string): void;
|
|
40
58
|
}
|
|
41
59
|
type EventCallback = (evt: FlatfileEvent) => void;
|
|
42
60
|
|
|
@@ -198,6 +216,20 @@ declare class Client extends EventHandler {
|
|
|
198
216
|
}
|
|
199
217
|
type SubFn = (client: Client) => void;
|
|
200
218
|
|
|
219
|
+
declare class Browser extends EventDriver {
|
|
220
|
+
_accessToken?: string;
|
|
221
|
+
_apiUrl?: string;
|
|
222
|
+
_environmentId?: string;
|
|
223
|
+
_fetchApi: FetchAPI;
|
|
224
|
+
constructor({ apiUrl, accessToken, environmentId, fetchApi, }: {
|
|
225
|
+
apiUrl: string;
|
|
226
|
+
accessToken: string;
|
|
227
|
+
environmentId?: string;
|
|
228
|
+
fetchApi: FetchAPI;
|
|
229
|
+
});
|
|
230
|
+
mountEventHandler(handler: EventHandler): this;
|
|
231
|
+
}
|
|
232
|
+
|
|
201
233
|
declare class PollingEventDriver extends EventDriver {
|
|
202
234
|
private options;
|
|
203
235
|
constructor(options: {
|
|
@@ -221,6 +253,7 @@ declare class FlatfileVirtualMachine extends EventDriver {
|
|
|
221
253
|
* @param event
|
|
222
254
|
*/
|
|
223
255
|
handle(event: FlatfileEvent): void;
|
|
256
|
+
mountEventHandler(handler: EventHandler): this;
|
|
224
257
|
}
|
|
225
258
|
|
|
226
|
-
export { Arrayable, AuthenticatedClient, Client, EventCallback, EventFilter, EventHandler, FlatfileEvent, FlatfileVirtualMachine, PollingEventDriver };
|
|
259
|
+
export { Arrayable, AuthenticatedClient, Browser, Client, EventCallback, EventFilter, EventHandler, FlatfileEvent, FlatfileVirtualMachine, PollingEventDriver };
|