@graffiti-garden/api 0.5.1 → 0.6.1

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.
@@ -1,4 +1,4 @@
1
- import type { GraffitiObjectUrl, GraffitiObject, GraffitiObjectBase, GraffitiPatch, GraffitiSession, GraffitiPutObject, GraffitiStream, ChannelStats } from "./2-types";
1
+ import type { GraffitiObjectUrl, GraffitiObject, GraffitiObjectBase, GraffitiPatch, GraffitiSession, GraffitiPutObject, GraffitiObjectStream, GraffitiChannelStatsStream, GraffitiObjectStreamContinue } from "./2-types";
2
2
  import type { JSONSchema } from "json-schema-to-ts";
3
3
  /**
4
4
  * This API describes a small but powerful set of methods that
@@ -185,13 +185,19 @@ export declare abstract class Graffiti {
185
185
  * Replacement occurs when the {@link GraffitiObjectBase.url | `url`} of
186
186
  * the replaced object exactly matches an existing object's URL.
187
187
  *
188
- * @returns The object that was replaced if one exists or an object with
188
+ * @throws {@link GraffitiErrorNotFound} if a {@link GraffitiObjectBase.url | `url`}
189
+ * is provided that has not been created yet or the {@link GraffitiObjectBase.actor | `actor`}
190
+ * is not {@link GraffitiObjectBase.allowed | `allowed`} to see it.
191
+ *
192
+ * @throws {@link GraffitiErrorForbidden} if the {@link GraffitiObjectBase.actor | `actor`}
193
+ * is not the same `actor` as the one who created the object.
194
+ *
195
+ * @returns The object that was replaced if one one exists, otherwise an object with
189
196
  * with an empty {@link GraffitiObjectBase.value | `value`},
190
197
  * {@link GraffitiObjectBase.channels | `channels`}, and {@link GraffitiObjectBase.allowed | `allowed`}
191
- * list if the method created a new object.
192
- * In either case, the object will have a {@link GraffitiObjectBase.tombstone | `tombstone`}
193
- * field set to `true` and a {@link GraffitiObjectBase.lastModified | `lastModified`}
194
- * field updated to the time of replacement/creation.
198
+ * list.
199
+ * The {@link GraffitiObjectBase.lastModified | `lastModified`} property of the returned object
200
+ * will be updated to the time of replacement/creation.
195
201
  *
196
202
  * @group CRUD Methods
197
203
  */
@@ -209,7 +215,7 @@ export declare abstract class Graffiti {
209
215
  */
210
216
  session: GraffitiSession): Promise<GraffitiObjectBase>;
211
217
  /**
212
- * Retrieves an object from a given location.
218
+ * Retrieves an object from a given {@link GraffitiObjectBase.url | `url`}.
213
219
  *
214
220
  * The retrieved object is type-checked against the provided [JSON schema](https://json-schema.org/)
215
221
  * otherwise a {@link GraffitiErrorSchemaMismatch} is thrown.
@@ -220,22 +226,10 @@ export declare abstract class Graffiti {
220
226
  * {@link GraffitiObjectBase.channels | `channels`} properties are
221
227
  * not revealed, similar to a BCC.
222
228
  *
223
- * If the object existed but has since been deleted,
224
- * or the retrieving {@link GraffitiObjectBase.actor | `actor`}
225
- * was {@link GraffitiObjectBase.allowed | `allowed`} to access
226
- * the object but now isn't, this method may return the latest
227
- * version of the object that the {@link GraffitiObjectBase.actor | `actor`}
228
- * was allowed to access with its {@link GraffitiObjectBase.tombstone | `tombstone`}
229
- * set to `true`. This allows for the invalidation of the object
230
- * in a client-side cache.
231
- *
232
- * Otherwise, if the object never existed, or the
233
- * retrieving {@link GraffitiObjectBase.actor | `actor`} was never
234
- * {@link GraffitiObjectBase.allowed | `allowed`} to access it, or if
235
- * the object was changed long enough ago that it has been permanently deleted,
236
- * a {@link GraffitiErrorNotFound} is thrown.
237
- * The rate at which permanent deletions happen is implementation dependent.
238
- * See the `tombstoneRetention` property returned by {@link discover}.
229
+ * @throws {@link GraffitiErrorNotFound} if the object does not exist, has been deleted, or the user is not
230
+ * {@link GraffitiObjectBase.allowed | `allowed`} to access it.
231
+ *
232
+ * @throws {@link GraffitiErrorSchemaMismatch} if the retrieved object does not match the provided schema.
239
233
  *
240
234
  * @group CRUD Methods
241
235
  */
@@ -256,16 +250,19 @@ export declare abstract class Graffiti {
256
250
  */
257
251
  session?: GraffitiSession | null): Promise<GraffitiObject<Schema>>;
258
252
  /**
259
- * Patches an existing object at a given location.
253
+ * Patches an existing object at a given {@link GraffitiObjectBase.url | `url`}.
260
254
  * The patching {@link GraffitiObjectBase.actor | `actor`} must be the same as the
261
255
  * `actor` that created the object.
262
256
  *
263
- * @returns The original object prior to the patch
264
- * The object will have a {@link GraffitiObjectBase.tombstone | `tombstone`}
265
- * field set to `true` and a {@link GraffitiObjectBase.lastModified | `lastModified`}
266
- * field updated to the time of deletion.
257
+ * @returns The original object prior to the patch with its
258
+ * {@link GraffitiObjectBase.lastModified | `lastModified`}
259
+ * property updated to the time of deletion.
260
+ *
261
+ * @throws {@link GraffitiErrorNotFound} if the object does not exist, has already been deleted,
262
+ * or the user is not {@link GraffitiObjectBase.allowed | `allowed`} to access it.
267
263
  *
268
- * @throws {@link GraffitiErrorNotFound} if the object does not exist or has already been deleted.
264
+ * @throws {@link GraffitiErrorForbidden} if the {@link GraffitiObjectBase.actor | `actor`}
265
+ * is not the same `actor` as the one who created the object.
269
266
  *
270
267
  * @group CRUD Methods
271
268
  */
@@ -285,16 +282,25 @@ export declare abstract class Graffiti {
285
282
  */
286
283
  session: GraffitiSession): Promise<GraffitiObjectBase>;
287
284
  /**
288
- * Deletes an object from a given location.
285
+ * Deletes an object from a given {@link GraffitiObjectBase.url | `url`}.
289
286
  * The deleting {@link GraffitiObjectBase.actor | `actor`} must be the same as the
290
287
  * `actor` that created the object.
291
288
  *
292
- * @returns The object that was deleted if one exists.
293
- * The object will have a {@link GraffitiObjectBase.tombstone | `tombstone`}
294
- * field set to `true` and a {@link GraffitiObjectBase.lastModified | `lastModified`}
295
- * field updated to the time of deletion.
289
+ * It is not possible to re-{@link put} an object that has been deleted
290
+ * to ensure a user's [right to be forgotten](https://en.wikipedia.org/wiki/Right_to_be_forgotten).
291
+ * In cases where deleting and restoring an object is useful, an object's
292
+ * {@link GraffitiObjectBase.allowed | `allowed`} property can be set to
293
+ * an empty list to hide it from all users except the creator.
296
294
  *
297
- * @throws {@link GraffitiErrorNotFound} if the object does not exist or has already been deleted.
295
+ * @returns The object that was deleted with its
296
+ * {@link GraffitiObjectBase.lastModified | `lastModified`}
297
+ * property updated to the time of deletion.
298
+ *
299
+ * @throws {@link GraffitiErrorNotFound} if the object does not exist, has already been deleted,
300
+ * or the user is not {@link GraffitiObjectBase.allowed | `allowed`} to access it.
301
+ *
302
+ * @throws {@link GraffitiErrorForbidden} if the {@link GraffitiObjectBase.actor | `actor`}
303
+ * is not the same `actor` as the one who created the object.
298
304
  *
299
305
  * @group CRUD Methods
300
306
  */
@@ -315,54 +321,27 @@ export declare abstract class Graffiti {
315
321
  *
316
322
  * Objects are returned asynchronously as they are discovered but the stream
317
323
  * will end once all leads have been exhausted.
318
- * The method must be polled again for new objects.
324
+ * The {@link GraffitiObjectStream} ends by returning a `continue`
325
+ * method and a `cursor` string, each of which can be be used to poll for new objects.
326
+ * The `continue` method preserves the type safety of the stream and the `cursor`
327
+ * string can be serialized to continue the stream after an application is closed
328
+ * and reopened.
329
+ * See the {@link continueObjectStream} method for more information.
319
330
  *
320
331
  * `discover` will not return objects that the {@link GraffitiObjectBase.actor | `actor`}
321
332
  * is not {@link GraffitiObjectBase.allowed | `allowed`} to access.
322
- * If the actor is not the creator of a discovered object,
333
+ * If the `actor` is not the creator of a discovered object,
323
334
  * the allowed list will be masked to only contain the querying actor if the
324
335
  * allowed list is not `undefined` (public). Additionally, if the actor is not the
325
336
  * creator of a discovered object, any {@link GraffitiObjectBase.channels | `channels`}
326
337
  * not specified by the `discover` method will not be revealed. This masking happens
327
- * before the supplied schema is applied.
338
+ * before the object is validated against the supplied `schema`.
328
339
  *
329
340
  * Since different implementations may fetch data from multiple sources there is
330
- * no guarentee on the order that objects are returned in. Additionally, the method
331
- * will return objects that have been deleted but with a
332
- * {@link GraffitiObjectBase.tombstone | `tombstone`} field set to `true` for
333
- * client-side cache invalidation purposes.
334
- * The final `return()` value of the stream includes a `tombstoneRetention`
335
- * property that represents the minimum amount of time,
336
- * in milliseconds, that an application will retain and return tombstones for objects that
337
- * have been deleted.
338
- *
339
- * When repolling, the {@link GraffitiObjectBase.lastModified | `lastModified`}
340
- * field can be queried via the schema to
341
- * only fetch objects that have been modified since the last poll.
342
- * Such queries should only be done if the time since the last poll
343
- * is less than the `tombstoneRetention` value of that poll, otherwise the tombstones
344
- * for objects that have been deleted may not be returned.
345
- *
346
- * ```json
347
- * {
348
- * "properties": {
349
- * "lastModified": {
350
- * "minimum": LAST_RETRIEVED_TIME
351
- * }
352
- * }
353
- * }
354
- * ```
355
- *
356
- * `discover` needs to be polled for new data because live updates to
357
- * an application can be visually distracting or lead to toxic engagement.
358
- * If and when an application wants real-time updates, such as in a chat
359
- * application, application authors must be intentional about their polling.
360
- *
361
- * Implementers should be aware that some users may applications may try to poll
362
- * {@link discover} repetitively. They can deal with this by rate limiting or
363
- * preemptively fetching data via a bidirectional channel, like a WebSocket.
364
- * Additionally, implementers should probably index the `lastModified` field
365
- * to speed up responses to schemas like the one above.
341
+ * no guarentee on the order that objects are returned in.
342
+ * It is also possible that duplicate objects are returned and their
343
+ * {@link GraffitiObjectBase.lastModified | `lastModified`} fields must be used
344
+ * to determine which object is the most recent.
366
345
  *
367
346
  * @returns A stream of objects that match the given {@link GraffitiObjectBase.channels | `channels`}
368
347
  * and [JSON Schema](https://json-schema.org).
@@ -384,9 +363,7 @@ export declare abstract class Graffiti {
384
363
  * only objects that have no {@link GraffitiObjectBase.allowed | `allowed`}
385
364
  * property will be returned.
386
365
  */
387
- session?: GraffitiSession | null): GraffitiStream<GraffitiObject<Schema>, {
388
- tombstoneRetention: number;
389
- }>;
366
+ session?: GraffitiSession | null): GraffitiObjectStream<Schema>;
390
367
  /**
391
368
  * Discovers objects **not** contained in any
392
369
  * {@link GraffitiObjectBase.channels | `channels`}
@@ -398,7 +375,13 @@ export declare abstract class Graffiti {
398
375
  * getting a global view of all a user's Graffiti data or debugging
399
376
  * channel usage.
400
377
  *
401
- * It's return value is the same as {@link discover}.
378
+ * Like {@link discover}, objects are returned asynchronously as they are discovered,
379
+ * the stream will end once all leads have been exhausted, and the stream
380
+ * can be continued using the `continue` method or `cursor` string.
381
+ *
382
+ * @returns A stream of objects created by the querying {@link GraffitiObjectBase.actor | `actor`}
383
+ * that do not belong to any {@link GraffitiObjectBase.channels | `channels`}
384
+ * and match the given [JSON Schema](https://json-schema.org).
402
385
  *
403
386
  * @group Query Methods
404
387
  */
@@ -411,9 +394,7 @@ export declare abstract class Graffiti {
411
394
  * An implementation-specific object with information to authenticate the
412
395
  * {@link GraffitiObjectBase.actor | `actor`}.
413
396
  */
414
- session: GraffitiSession): GraffitiStream<GraffitiObject<Schema>, {
415
- tombstoneRetention: number;
416
- }>;
397
+ session: GraffitiSession): GraffitiObjectStream<Schema>;
417
398
  /**
418
399
  * Returns statistics about all the {@link GraffitiObjectBase.channels | `channels`}
419
400
  * that an {@link GraffitiObjectBase.actor | `actor`} has posted to.
@@ -422,6 +403,9 @@ export declare abstract class Graffiti {
422
403
  * global view of all their Graffiti data or to debug
423
404
  * channel usage.
424
405
  *
406
+ * Like {@link discover}, objects are returned asynchronously as they are discovered,
407
+ * the stream will end once all leads have been exhausted.
408
+ *
425
409
  * @group Query Methods
426
410
  *
427
411
  * @returns A stream of statistics for each {@link GraffitiObjectBase.channels | `channel`}
@@ -432,7 +416,33 @@ export declare abstract class Graffiti {
432
416
  * An implementation-specific object with information to authenticate the
433
417
  * {@link GraffitiObjectBase.actor | `actor`}.
434
418
  */
435
- session: GraffitiSession): GraffitiStream<ChannelStats>;
419
+ session: GraffitiSession): GraffitiChannelStatsStream;
420
+ /**
421
+ * Continues a {@link GraffitiObjectStream} from a given `cursor` string.
422
+ * The continuation will return new objects that have been created
423
+ * that match the original stream, and also returns the
424
+ * {@link GraffitiObjectBase.url | `url`}s of objects that
425
+ * have been deleted, as marked by a `tombstone`.
426
+ *
427
+ * The continuation may also include duplicates of objects that
428
+ * were already returned by the original stream. This is dependent
429
+ * on how much state the underlying implementation maintains.
430
+ *
431
+ * The `cursor` allows the client to
432
+ * serialize the state of the stream and continue it later.
433
+ * However this method loses any typing information that was
434
+ * present in the original stream. For better type safety
435
+ * and when serializing is not necessary, use the `continue`
436
+ * method instead, returned along with the `cursor` at the
437
+ * end of the original stream.
438
+ *
439
+ * @throws {@link GraffitiErrorForbidden} if the {@link GraffitiObjectBase.actor | `actor`}
440
+ * provided in the `session` is not the same as the `actor`
441
+ * that initiated the original stream.
442
+ *
443
+ * @group Query Methods
444
+ */
445
+ abstract continueObjectStream(cursor: string, session?: GraffitiSession | null): GraffitiObjectStreamContinue<{}>;
436
446
  /**
437
447
  * Begins the login process. Depending on the implementation, this may
438
448
  * involve redirecting the user to a login page or opening a popup,
@@ -1 +1 @@
1
- {"version":3,"file":"1-api.d.ts","sourceRoot":"","sources":["../../src/1-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,YAAY,EACb,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+KG;AACH,8BAAsB,QAAQ;IAC5B;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,GAAG,CAAC,MAAM,SAAS,UAAU;IACpC;;;;;OAKG;IACH,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC;IACjC;;;OAGG;IACH,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,kBAAkB,CAAC;IAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,QAAQ,CAAC,GAAG,CAAC,MAAM,SAAS,UAAU;IACpC;;OAEG;IACH,GAAG,EAAE,MAAM,GAAG,iBAAiB;IAC/B;;OAEG;IACH,MAAM,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AQ,CAAC,oBAAoB,CAC3B,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,eAAe,GAAG,IAAI,GAC/B,4BAA4B,CAAC,EAAE,CAAC;IAEnC;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,KAAK;IACZ;;;;OAIG;IACH,QAAQ,CAAC,EAAE;QACT;;;;;;;;WAQG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;QACf;;;;;;;;;;WAUG;QACH,KAAK,CAAC,EAAE,EAAE,CAAC;KACZ,GACA,OAAO,CAAC,IAAI,CAAC;IAEhB;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,MAAM;IACb;;OAEG;IACH,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,IAAI,CAAC;IAEhB;;;;;;;;OAQG;IACH,QAAQ,CAAC,QAAQ,CAAC,aAAa,EAAE,WAAW,CAAC;CAC9C"}
@@ -16,8 +16,7 @@ import type { Operation as JSONPatchOperation } from "fast-json-patch";
16
16
  * The {@link channels | `channels`} and {@link allowed | `allowed`} properties
17
17
  * enable the object's creator to shape the visibility of and access to their object.
18
18
  *
19
- * The {@link tombstone | `tombstone`} and {@link lastModified | `lastModified`} properties are for
20
- * caching and synchronization.
19
+ * The {@link lastModified | `lastModified`} property can be used to compare object versions.
21
20
  */
22
21
  export interface GraffitiObjectBase {
23
22
  /**
@@ -76,9 +75,9 @@ export interface GraffitiObjectBase {
76
75
  * If an object is {@link Graffiti.put | put} with the same URL
77
76
  * as an existing object, the existing object will be replaced with the new object.
78
77
  *
79
- * An object's URL is generated when the object is first creation and
78
+ * An object's URL is generated when the object is first created and
80
79
  * should include sufficient randomness to prevent collisions
81
- * and guessing. The URL starts with a "scheme", just like web URLs start with `http` or `https`, to indicate
80
+ * and guessing. The URL starts with a "scheme," just like web URLs start with `http` or `https`, to indicate
82
81
  * to indicate the particular Graffiti implementation. This allows for applications
83
82
  * to pull from multiple coexisting Graffiti implementations without collision.
84
83
  * Existing schemes include `graffiti:local:` for objects stored locally
@@ -91,7 +90,7 @@ export interface GraffitiObjectBase {
91
90
  url: string;
92
91
  /**
93
92
  * The time the object was last modified, measured in milliseconds since January 1, 1970.
94
- * This is used for client-side caching and synchronization.
93
+ * It can be used to compare object versions.
95
94
  * A number, rather than an ISO string or Date object, is used for easy comparison, sorting,
96
95
  * and JSON Schema [range queries](https://json-schema.org/understanding-json-schema/reference/numeric#range).
97
96
  *
@@ -101,12 +100,6 @@ export interface GraffitiObjectBase {
101
100
  * rather than when it was modified.
102
101
  */
103
102
  lastModified: number;
104
- /**
105
- * A boolean indicating whether the object has been deleted.
106
- * Depending on implementation, objects stay available for some time
107
- * after deletion to allow for synchronization and client-side caching
108
- */
109
- tombstone: boolean;
110
103
  }
111
104
  /**
112
105
  * This type constrains the {@link GraffitiObjectBase} type to adhere to a
@@ -150,12 +143,9 @@ export declare const GraffitiObjectJSONSchema: {
150
143
  readonly lastModified: {
151
144
  readonly type: "number";
152
145
  };
153
- readonly tombstone: {
154
- readonly type: "boolean";
155
- };
156
146
  };
157
147
  readonly additionalProperties: false;
158
- readonly required: readonly ["value", "channels", "actor", "url", "lastModified", "tombstone"];
148
+ readonly required: readonly ["value", "channels", "actor", "url", "lastModified"];
159
149
  };
160
150
  /**
161
151
  * This is an object containing only the {@link GraffitiObjectBase.url | `url`}
@@ -176,8 +166,8 @@ export type GraffitiObjectUrl = Pick<GraffitiObjectBase, "url">;
176
166
  * It may also include a {@link GraffitiObjectBase.url | `url`} property to specify the
177
167
  * URL of an existing object to replace. If no `url` is provided, one will be generated during object creation.
178
168
  *
179
- * This object does not need a {@link GraffitiObjectBase.lastModified | `lastModified`} or {@link GraffitiObjectBase.tombstone | `tombstone`}
180
- * property since these are automatically generated by the Graffiti system.
169
+ * This object does not need a {@link GraffitiObjectBase.lastModified | `lastModified`}
170
+ * property since it will be automatically generated by the Graffiti system.
181
171
  */
182
172
  export type GraffitiPutObject<Schema extends JSONSchema> = Pick<GraffitiObjectBase, "value" | "channels" | "allowed"> & Partial<GraffitiObjectBase> & FromSchema<Schema & typeof GraffitiPutObjectJSONSchema>;
183
173
  /**
@@ -214,9 +204,6 @@ export declare const GraffitiPutObjectJSONSchema: {
214
204
  readonly lastModified: {
215
205
  readonly type: "number";
216
206
  };
217
- readonly tombstone: {
218
- readonly type: "boolean";
219
- };
220
207
  };
221
208
  readonly additionalProperties: false;
222
209
  };
@@ -295,8 +282,7 @@ export interface GraffitiPatch {
295
282
  allowed?: JSONPatchOperation[];
296
283
  }
297
284
  /**
298
- * This type represents a stream of data that are
299
- * returned by Graffiti's query-like operations such as
285
+ * A stream of data that are returned by Graffiti's query-like operations
300
286
  * {@link Graffiti.discover} and {@link Graffiti.recoverOrphans}.
301
287
  *
302
288
  * Errors are returned within the stream rather than as
@@ -304,21 +290,143 @@ export interface GraffitiPatch {
304
290
  * some implementations may pull data from multiple sources
305
291
  * including some that may be unreliable. In many cases,
306
292
  * these errors can be safely ignored.
307
- * The `origin` property of the error object indicates the
308
- * source of the error including its scheme and other
309
- * implementation-specific details (e.g. domain name).
293
+ * See {@link GraffitiStreamError}.
310
294
  *
311
295
  * The stream is an [`AsyncGenerator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function)
312
296
  * that can be iterated over using `for await` loops or calling `next` on the generator.
313
297
  * The stream can be terminated by breaking out of a loop calling `return` on the generator.
298
+ *
299
+ * The stream ends by returning a {@link GraffitiObjectStreamReturn.continue | `continue`}
300
+ * function and a {@link GraffitiObjectStreamReturn.cursor | `cursor`} string,
301
+ * each of which can be used to resume the stream from where it left off.
314
302
  */
315
- export type GraffitiStream<TValue, TReturn = void> = AsyncGenerator<{
316
- error?: undefined;
317
- value: TValue;
318
- } | {
303
+ export type GraffitiObjectStream<Schema extends JSONSchema> = AsyncGenerator<GraffitiStreamError | GraffitiObjectStreamEntry<Schema>, GraffitiObjectStreamReturn<Schema>>;
304
+ /**
305
+ * An error that can occur in either the
306
+ * {@link GraffitiObjectStream} or {@link GraffitiChannelStatsStream}.
307
+ *
308
+ * @internal
309
+ */
310
+ export interface GraffitiStreamError {
311
+ /**
312
+ * The error that occurred while streaming data.
313
+ */
319
314
  error: Error;
315
+ /**
316
+ * The origin that the error occurred. It will include
317
+ * the scheme of the Graffiti implementation used and other
318
+ * implementation-specific information like a hostname.
319
+ */
320
320
  origin: string;
321
- }, TReturn>;
321
+ }
322
+ /**
323
+ * A successful result from a {@link GraffitiObjectStream} or
324
+ * {@link GraffitiObjectStreamContinue} that includes an object.
325
+ *
326
+ * @internal
327
+ */
328
+ export interface GraffitiObjectStreamEntry<Schema extends JSONSchema> {
329
+ /**
330
+ * Empty property for compatibility with {@link GraffitiStreamError}
331
+ */
332
+ error?: undefined;
333
+ /**
334
+ * Empty property for compatibility with {@link GraffitiObjectStreamContinueTombstone}
335
+ */
336
+ tombstone?: undefined;
337
+ /**
338
+ * The object returned by the stream.
339
+ */
340
+ object: GraffitiObject<Schema>;
341
+ }
342
+ /**
343
+ * A result from a {@link GraffitiObjectStreamContinue} that indicated
344
+ * an object has been deleted since the original stream was run.
345
+ * Only sparse metadata about the deleted object is returned to respect
346
+ * the deleting user's privacy.
347
+ *
348
+ * @internal
349
+ */
350
+ export interface GraffitiObjectStreamContinueTombstone {
351
+ /**
352
+ * Empty property for compatibility with {@link GraffitiStreamError}
353
+ */
354
+ error?: undefined;
355
+ /**
356
+ * Use this property to differentiate a tombstone from a
357
+ * {@link GraffitiObjectStreamEntry}.
358
+ */
359
+ tombstone: true;
360
+ /**
361
+ * Sparse metadata about the deleted object. The full object is not returned
362
+ * to respect a user's privacy.
363
+ */
364
+ object: {
365
+ /**
366
+ * The {@link GraffitiObjectBase.url | `url`} of the deleted object.
367
+ */
368
+ url: string;
369
+ /**
370
+ * The time at which the object was deleted, comparable to
371
+ * {@link GraffitiObjectBase.lastModified | `lastModified`}.
372
+ *
373
+ * While it is not possible to re-{@link Graffiti.put | put} objects that have been
374
+ * {@link Graffiti.delete | deleted}, objects may appear deleted if
375
+ * an {@link GraffitiObjectBase.actor | `actor`} is no longer
376
+ * {@link GraffitiObjectBase.allowed | `allowed`} to access them.
377
+ * Therefore the {@link GraffitiObjectBase.lastModified | `lastModified`} property
378
+ * is necessary to compare object versions.
379
+ */
380
+ lastModified: number;
381
+ };
382
+ }
383
+ /**
384
+ * A continuation of the {@link GraffitiObjectStream} type can include
385
+ * both objects and tombstones of deleted objects.
386
+ *
387
+ * @internal
388
+ */
389
+ export type GraffitiObjectStreamContinueEntry<Schema extends JSONSchema> = GraffitiObjectStreamEntry<Schema> | GraffitiObjectStreamContinueTombstone;
390
+ /**
391
+ * The output of a {@link GraffitiObjectStream} or a {@link GraffitiObjectStreamContinue}
392
+ * that allows the stream to be continued from where it left off.
393
+ *
394
+ * The {@link continue} function preserves the typing of the original stream,
395
+ * where as the {@link cursor} string can be serialized for use after a user
396
+ * has closed and reopened an application.
397
+ *
398
+ * The continued stream may include `tombstone`s of objects that have been
399
+ * deleted since the original stream was run. See {@link GraffitiObjectStreamContinueTombstone}.
400
+ * The continued stream may also return some objects that were already
401
+ * returned by the original stream, depending on how much state the
402
+ * underlying implementation is able to preserve.
403
+ *
404
+ * @internal
405
+ */
406
+ export interface GraffitiObjectStreamReturn<Schema extends JSONSchema> {
407
+ /**
408
+ * @returns A function that creates new stream that continues from where the original stream left off.
409
+ * It preserves the typing of the original stream.
410
+ */
411
+ continue: () => GraffitiObjectStreamContinue<Schema>;
412
+ /**
413
+ * A string that can be serialized and stored to resume the stream later.
414
+ * It must be passed to the {@link Graffiti.continueObjectStream} method
415
+ * to resume the stream.
416
+ */
417
+ cursor: string;
418
+ }
419
+ /**
420
+ * A continutation of the {@link GraffitiObjectStream} type, as returned by
421
+ * the {@link GraffitiObjectStreamReturn.continue} or by using
422
+ * {@link GraffitiObjectStreamReturn.cursor} with {@link Graffiti.continueObjectStream}.
423
+ *
424
+ * The continued stream may include `tombstone`s of objects that have been
425
+ * deleted since the original stream was run. See {@link GraffitiObjectStreamContinueTombstone}.
426
+ *
427
+ * @internal
428
+ */
429
+ export type GraffitiObjectStreamContinue<Schema extends JSONSchema> = AsyncGenerator<GraffitiStreamError | GraffitiObjectStreamContinueEntry<Schema>, GraffitiObjectStreamReturn<Schema>>;
322
430
  /**
323
431
  * Statistic about single channel returned by {@link Graffiti.channelStats}.
324
432
  * These statistics only account for contributions made by the
@@ -330,17 +438,25 @@ export type ChannelStats = {
330
438
  */
331
439
  channel: string;
332
440
  /**
333
- * The number of non-{@link GraffitiObjectBase.tombstone | `tombstone`}d objects
334
- * that the actor has posted to the channel.
441
+ * The number of objects that the actor has {@link Graffiti.put | put}
442
+ * and not {@link Graffiti.delete | deleted} in the channel.
335
443
  */
336
444
  count: number;
337
445
  /**
338
446
  * The time that the actor {@link GraffitiObjectBase.lastModified | last modified} an object in the channel,
339
447
  * measured in milliseconds since January 1, 1970.
340
- * {@link GraffitiObjectBase.tombstone | Tombstone}d objects do not effect this modification time.
448
+ * {@link Graffiti.delete | Deleted} objects do not effect this modification time.
341
449
  */
342
450
  lastModified: number;
343
451
  };
452
+ /**
453
+ * A stream of data that are returned by Graffiti's {@link Graffiti.channelStats} method.
454
+ * See {@link GraffitiObjectStream} for more information on streams.
455
+ */
456
+ export type GraffitiChannelStatsStream = AsyncGenerator<GraffitiStreamError | {
457
+ error?: undefined;
458
+ value: ChannelStats;
459
+ }>;
344
460
  /**
345
461
  * The event type produced in {@link Graffiti.sessionEvents}
346
462
  * when a user logs in manually from {@link Graffiti.login}
@@ -1 +1 @@
1
- {"version":3,"file":"2-types.d.ts","sourceRoot":"","sources":["../../src/2-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,IAAI,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAEvE;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,KAAK,EAAE,EAAE,CAAC;IAEV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CAAC;CAChB,GACD;IACE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf,CACJ,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,+BAA+B,GAAG,WAAW,CACrD;IACE,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GACD,IAAI,GACJ,SAAS,CACZ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"crud.d.ts","sourceRoot":"","sources":["../../tests/crud.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EACR,eAAe,EAGhB,MAAM,sBAAsB,CAAC;AAW9B,eAAO,MAAM,iBAAiB,GAC5B,aAAa,MAAM,IAAI,CAAC,QAAQ,EAAE,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC,EACrE,aAAa,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,EAC7D,aAAa,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,SAkgB9D,CAAC"}
1
+ {"version":3,"file":"crud.d.ts","sourceRoot":"","sources":["../../tests/crud.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EACR,eAAe,EAGhB,MAAM,sBAAsB,CAAC;AAW9B,eAAO,MAAM,iBAAiB,GAC5B,aAAa,MAAM,IAAI,CAAC,QAAQ,EAAE,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC,EACrE,aAAa,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,EAC7D,aAAa,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,SAugB9D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../../tests/discover.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EACR,eAAe,EAEhB,MAAM,sBAAsB,CAAC;AAG9B,eAAO,MAAM,qBAAqB,GAChC,aAAa,MAAM,IAAI,CAAC,QAAQ,EAAE,UAAU,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC,EAC1E,aAAa,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,EAC7D,aAAa,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,SA8iB9D,CAAC"}
1
+ {"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../../tests/discover.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EAGR,eAAe,EAEhB,MAAM,sBAAsB,CAAC;AAG9B,eAAO,MAAM,qBAAqB,GAChC,aAAa,MAAM,IAAI,CAAC,QAAQ,EAAE,UAAU,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC,EAC1E,aAAa,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,EAC7D,aAAa,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,SA2oB9D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"orphans.d.ts","sourceRoot":"","sources":["../../tests/orphans.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGtE,eAAO,MAAM,mBAAmB,GAC9B,aAAa,MAAM,IAAI,CACrB,QAAQ,EACR,gBAAgB,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAC9C,EACD,aAAa,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,EAC7D,aAAa,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,SAsE9D,CAAC"}
1
+ {"version":3,"file":"orphans.d.ts","sourceRoot":"","sources":["../../tests/orphans.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGtE,eAAO,MAAM,mBAAmB,GAC9B,aAAa,MAAM,IAAI,CACrB,QAAQ,EACR,gBAAgB,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAC9C,EACD,aAAa,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,EAC7D,aAAa,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,SAqG9D,CAAC"}
@@ -1,8 +1,8 @@
1
- import type { GraffitiPutObject, GraffitiStream } from "@graffiti-garden/api";
1
+ import type { GraffitiPutObject, GraffitiObjectStream, JSONSchema, GraffitiObject } from "@graffiti-garden/api";
2
2
  export declare function randomString(): string;
3
3
  export declare function randomValue(): {
4
4
  [x: string]: string;
5
5
  };
6
6
  export declare function randomPutObject(): GraffitiPutObject<{}>;
7
- export declare function nextStreamValue<S, T>(iterator: GraffitiStream<S, T>): Promise<S>;
7
+ export declare function nextStreamValue<Schema extends JSONSchema>(iterator: GraffitiObjectStream<Schema>): Promise<GraffitiObject<Schema>>;
8
8
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../tests/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE9E,wBAAgB,YAAY,IAAI,MAAM,CASrC;AAED,wBAAgB,WAAW;;EAI1B;AAED,wBAAgB,eAAe,IAAI,iBAAiB,CAAC,EAAE,CAAC,CAKvD;AAED,wBAAsB,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,cAIzE"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../tests/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,iBAAiB,EACjB,oBAAoB,EACpB,UAAU,EACV,cAAc,EACf,MAAM,sBAAsB,CAAC;AAE9B,wBAAgB,YAAY,IAAI,MAAM,CASrC;AAED,wBAAgB,WAAW;;EAI1B;AAED,wBAAgB,eAAe,IAAI,iBAAiB,CAAC,EAAE,CAAC,CAKvD;AAED,wBAAsB,eAAe,CAAC,MAAM,SAAS,UAAU,EAC7D,QAAQ,EAAE,oBAAoB,CAAC,MAAM,CAAC,GACrC,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAKjC"}