@basementuniverse/jsonpad-realtime-sdk 1.3.1 → 1.5.0

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 CHANGED
@@ -90,6 +90,8 @@ A connection that drops without closing cleanly keeps its slot on the server unt
90
90
  const jsonpadRealtime = new JSONPadRealtime('your-api-token', { retry: false });
91
91
  ```
92
92
 
93
+ The same happens if you subscribe to items by alias while one of your alias indexes is still being built: the connection is refused with `INDEX_BUILDING` (code 16006), and retried once the server's suggested delay has passed. Subscribing by item id always works.
94
+
93
95
  ## `listen()` method
94
96
 
95
97
  The `listen()` method takes an array of event types to listen for. You can pass in any of the following event types:
@@ -6,12 +6,20 @@ type EventDetail<T extends object> = {
6
6
 
7
7
  type EventType = 'list-created' | 'list-updated' | 'list-deleted' | 'item-created' | 'item-updated' | 'item-restored' | 'item-deleted';
8
8
 
9
+ /**
10
+ * An item, as it arrives in a realtime event
11
+ *
12
+ * Realtime clients authenticate with an API token and never with an identity,
13
+ * so any value covered by a guard index in the item's list has already been
14
+ * removed from `data` before the event was published
15
+ */
9
16
  type Item = {
10
17
  id: string;
11
18
  createdAt: Date;
12
19
  updatedAt: Date;
13
20
  data: any;
14
21
  description: string;
22
+ tags: string[];
15
23
  version: string;
16
24
  readonly: boolean;
17
25
  activated: boolean;
@@ -49,6 +57,7 @@ type List = {
49
57
  };
50
58
  name: string;
51
59
  description: string;
60
+ tags: string[];
52
61
  pathName: string;
53
62
  schema: any;
54
63
  pinned: boolean;
@@ -101,7 +110,8 @@ declare class ListEvent extends CustomEvent<any> {
101
110
  */
102
111
  declare class RealtimeErrorEvent extends CustomEvent<string> {
103
112
  /**
104
- * The jsonpad error code, e.g. 10015, or null if the error didn't come from
113
+ * The jsonpad error code, e.g. 10015 (too many connections) or 16006 (an
114
+ * alias index is still being built), or null if the error didn't come from
105
115
  * the server
106
116
  */
107
117
  readonly code: number | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basementuniverse/jsonpad-realtime-sdk",
3
- "version": "1.3.1",
3
+ "version": "1.5.0",
4
4
  "description": "JSONPad Realtime SDK for Node and browser",
5
5
  "author": "Gordon Larrigan <gordonlarrigan@gmail.com> (https://gordonlarrigan.com)",
6
6
  "license": "MIT",
@@ -9,7 +9,8 @@ import { RealtimeErrorData } from '../types';
9
9
  */
10
10
  export class RealtimeErrorEvent extends CustomEvent<string> {
11
11
  /**
12
- * The jsonpad error code, e.g. 10015, or null if the error didn't come from
12
+ * The jsonpad error code, e.g. 10015 (too many connections) or 16006 (an
13
+ * alias index is still being built), or null if the error didn't come from
13
14
  * the server
14
15
  */
15
16
  public readonly code: number | null;
package/src/types/item.ts CHANGED
@@ -11,6 +11,7 @@ export type Item = {
11
11
  updatedAt: Date;
12
12
  data: any;
13
13
  description: string;
14
+ tags: string[];
14
15
  version: string;
15
16
  readonly: boolean;
16
17
  activated: boolean;
package/src/types/list.ts CHANGED
@@ -13,6 +13,7 @@ export type List = {
13
13
  };
14
14
  name: string;
15
15
  description: string;
16
+ tags: string[];
16
17
  pathName: string;
17
18
  schema: any;
18
19
  pinned: boolean;