@flatfile/listener 0.3.6 → 0.3.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/README.md +49 -0
- package/dist/index.js +3 -3
- package/dist/index.mjs +3 -3
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# @flatfile/listener
|
|
2
|
+
|
|
3
|
+
`@flatfile/listener` is Flatfile's core library. It combines event handling capabilities with Flatfile-specific functionality, such as working with Flatfile records and sessions. Simply put, it receives events and it responds to events. Period.
|
|
4
|
+
|
|
5
|
+
The `AuthenticatedClient` class serves as a foundation for authenticated API communication, while the event-related classes enable event-driven workflows within the Flatfile ecosystem.
|
|
6
|
+
|
|
7
|
+
## Components
|
|
8
|
+
|
|
9
|
+
Here's an overview of the package and its components:
|
|
10
|
+
|
|
11
|
+
### `FlatfileRecord and FlatfileRecords`
|
|
12
|
+
|
|
13
|
+
- These classes represent records and collections of records in the Flatfile format.
|
|
14
|
+
- They provide methods for manipulating and retrieving record data.
|
|
15
|
+
|
|
16
|
+
### `FlatfileSession`
|
|
17
|
+
|
|
18
|
+
- This class represents a session in the Flatfile platform.
|
|
19
|
+
- It stores information about the workspace, workbook, schema, uploads, and other session-related data.
|
|
20
|
+
|
|
21
|
+
### `EventCache`
|
|
22
|
+
|
|
23
|
+
- This class implements an event caching mechanism.
|
|
24
|
+
- It allows for caching and retrieval of event data based on cache keys.
|
|
25
|
+
|
|
26
|
+
### `EventHandler`
|
|
27
|
+
|
|
28
|
+
This class is an event handler implementation that extends the AuthenticatedClient class.
|
|
29
|
+
|
|
30
|
+
- It provides methods for registering event listeners, dispatching events, and managing child event handlers.
|
|
31
|
+
- It supports filtering events based on topic and context.
|
|
32
|
+
- It can be used to handle and process events in the Flatfile platform.
|
|
33
|
+
|
|
34
|
+
### `AuthenticatedClient`
|
|
35
|
+
|
|
36
|
+
This class is a base class for authenticated HTTP clients.
|
|
37
|
+
|
|
38
|
+
- It provides functionality for making authenticated HTTP requests using Axios.
|
|
39
|
+
- It handles access tokens, API URLs, and HTTP headers.
|
|
40
|
+
|
|
41
|
+
### Various utility functions and types:
|
|
42
|
+
|
|
43
|
+
`@flatfile/listener` includes utility functions and types related to event handling, filtering, and data manipulation.
|
|
44
|
+
|
|
45
|
+
These utilities support the functionality of the event handling and data processing components.
|
|
46
|
+
|
|
47
|
+
## Get Started
|
|
48
|
+
|
|
49
|
+
To get started with @flatfile/listener, follow our [Quickstart guide](https://flatfile.com/docs/quickstart/meet-the-workbook).
|
package/dist/index.js
CHANGED
|
@@ -275,14 +275,14 @@ var FlatfileEvent = class extends AuthenticatedClient {
|
|
|
275
275
|
if (!this.src.dataUrl) {
|
|
276
276
|
throw new Error("Cannot set data on an event without a dataUrl");
|
|
277
277
|
}
|
|
278
|
-
|
|
278
|
+
records.map((record) => {
|
|
279
279
|
record.messages?.map((message) => {
|
|
280
280
|
delete message.source;
|
|
281
281
|
});
|
|
282
282
|
});
|
|
283
283
|
await this.fetch(this.src.dataUrl, {
|
|
284
|
-
method: "
|
|
285
|
-
data:
|
|
284
|
+
method: "PUT",
|
|
285
|
+
data: records
|
|
286
286
|
});
|
|
287
287
|
}
|
|
288
288
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -232,14 +232,14 @@ var FlatfileEvent = class extends AuthenticatedClient {
|
|
|
232
232
|
if (!this.src.dataUrl) {
|
|
233
233
|
throw new Error("Cannot set data on an event without a dataUrl");
|
|
234
234
|
}
|
|
235
|
-
|
|
235
|
+
records.map((record) => {
|
|
236
236
|
record.messages?.map((message) => {
|
|
237
237
|
delete message.source;
|
|
238
238
|
});
|
|
239
239
|
});
|
|
240
240
|
await this.fetch(this.src.dataUrl, {
|
|
241
|
-
method: "
|
|
242
|
-
data:
|
|
241
|
+
method: "PUT",
|
|
242
|
+
data: records
|
|
243
243
|
});
|
|
244
244
|
}
|
|
245
245
|
};
|