@graffiti-garden/api 0.6.4 → 1.0.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 +0 -7
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +3 -3
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +3 -3
- package/dist/src/1-api.d.ts +121 -177
- package/dist/src/1-api.d.ts.map +1 -1
- package/dist/src/2-types.d.ts +38 -151
- package/dist/src/2-types.d.ts.map +1 -1
- package/dist/src/3-errors.d.ts +2 -2
- package/dist/src/3-errors.d.ts.map +1 -1
- package/dist/tests/crud.d.ts +1 -1
- package/dist/tests/crud.d.ts.map +1 -1
- package/dist/tests/discover.d.ts +1 -1
- package/dist/tests/discover.d.ts.map +1 -1
- package/dist/tests/index.d.ts +0 -4
- package/dist/tests/index.d.ts.map +1 -1
- package/dist/tests/utils.d.ts +3 -3
- package/dist/tests/utils.d.ts.map +1 -1
- package/dist/tests.mjs +3 -1269
- package/dist/tests.mjs.map +4 -4
- package/package.json +4 -5
- package/src/1-api.ts +126 -185
- package/src/2-types.ts +39 -156
- package/src/3-errors.ts +6 -6
- package/tests/crud.ts +42 -320
- package/tests/discover.ts +51 -349
- package/tests/index.ts +2 -4
- package/tests/utils.ts +4 -4
- package/dist/tests/channel-stats.d.ts +0 -3
- package/dist/tests/channel-stats.d.ts.map +0 -1
- package/dist/tests/orphans.d.ts +0 -3
- package/dist/tests/orphans.d.ts.map +0 -1
- package/tests/channel-stats.ts +0 -129
- package/tests/orphans.ts +0 -128
package/dist/src/2-types.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import type { JSONSchema, FromSchema } from "json-schema-to-ts";
|
|
2
|
-
import type { Operation as JSONPatchOperation } from "fast-json-patch";
|
|
3
2
|
/**
|
|
4
3
|
* Objects are the atomic unit in Graffiti that can represent both data (*e.g.* a social media post or profile)
|
|
5
4
|
* and activities (*e.g.* a like or follow).
|
|
6
|
-
* Objects are created and modified by a single {@link actor | `actor`}.
|
|
7
5
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* Each object embeds the {@link actor | `actor`} that created it.
|
|
7
|
+
* Object content and metadata are static but an object may be deleted by
|
|
8
|
+
* its creating {@link actor | `actor`}.
|
|
9
|
+
*
|
|
10
|
+
* An object's content is stored in its {@link value | `value`} property, which can be any JSON
|
|
11
|
+
* object. However, it is recommended to use properties from the
|
|
10
12
|
* [Activity Vocabulary](https://www.w3.org/TR/activitystreams-vocabulary/)
|
|
11
13
|
* or properties that emerge in the Graffiti [folksonomy](https://en.wikipedia.org/wiki/Folksonomy)
|
|
12
14
|
* to promote interoperability.
|
|
13
15
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* The {@link channels | `channels`} and {@link allowed | `allowed`} properties
|
|
17
|
-
* enable the object's creator to shape the visibility of and access to their object.
|
|
16
|
+
* Each object is globally addressable via its {@link url | `url`}.
|
|
18
17
|
*
|
|
19
|
-
*
|
|
18
|
+
* An object's {@link channels | `channels`} and {@link allowed | `allowed`} properties
|
|
19
|
+
* are set by an objects creator to shape the visibility of and access to their object.
|
|
20
20
|
*/
|
|
21
21
|
export interface GraffitiObjectBase {
|
|
22
22
|
/**
|
|
@@ -32,11 +32,11 @@ export interface GraffitiObjectBase {
|
|
|
32
32
|
* {@link Graffiti.discover} method. This allows creators to express the intended audience of their object
|
|
33
33
|
* which helps to prevent [context collapse](https://en.wikipedia.org/wiki/Context_collapse) even
|
|
34
34
|
* in the highly interoperable ecosystem that Graffiti envisions. For example, channel URIs may be:
|
|
35
|
-
* - A actor's own {@link actor | `actor`} URI.
|
|
35
|
+
* - A actor's own {@link actor | `actor`} URI. Posting an object to this channel is a way to broadcast
|
|
36
36
|
* the object to the actor's followers, like posting a tweet.
|
|
37
|
-
* - The URL of a Graffiti post.
|
|
37
|
+
* - The URL of a Graffiti post. Posting an object to this channel is a way to broadcast to anyone viewing
|
|
38
38
|
* the post, like commenting on a tweet.
|
|
39
|
-
* - A URI representing a topic.
|
|
39
|
+
* - A URI representing a topic. Posting an object to this channel is a way to broadcast to anyone interested
|
|
40
40
|
* in that topic, like posting in a subreddit.
|
|
41
41
|
*/
|
|
42
42
|
channels: string[];
|
|
@@ -51,13 +51,14 @@ export interface GraffitiObjectBase {
|
|
|
51
51
|
* other recipients, however this is not enforced by Graffiti and may not accurately reflect the actual `allowed` array.
|
|
52
52
|
*
|
|
53
53
|
* `allowed` can be combined with {@link channels | `channels`}. For example, to send someone a direct message
|
|
54
|
-
* the sender should
|
|
54
|
+
* the sender should post their object to the channel of the recipient's {@link actor | `actor`} URI to notify them of the message and also add
|
|
55
55
|
* the recipient's {@link actor | `actor`} URI to the `allowed` array to prevent others from seeing the message.
|
|
56
56
|
*/
|
|
57
57
|
allowed?: string[] | null;
|
|
58
58
|
/**
|
|
59
|
-
* The URI of the `actor` that {@link Graffiti.
|
|
60
|
-
*
|
|
59
|
+
* The URI of the `actor` that {@link Graffiti.post | created } the object.
|
|
60
|
+
* This `actor` has the unique permission to
|
|
61
|
+
* {@link Graffiti.delete | delete} the object.
|
|
61
62
|
*
|
|
62
63
|
* We borrow the term actor from the ActivityPub because
|
|
63
64
|
* [like in ActivityPub](https://www.w3.org/TR/activitypub/#h-note-0)
|
|
@@ -72,8 +73,6 @@ export interface GraffitiObjectBase {
|
|
|
72
73
|
/**
|
|
73
74
|
* A globally unique identifier and locator for the object. It can be used to point to
|
|
74
75
|
* an object or to retrieve the object directly with {@link Graffiti.get}.
|
|
75
|
-
* If an object is {@link Graffiti.put | put} with the same URL
|
|
76
|
-
* as an existing object, the existing object will be replaced with the new object.
|
|
77
76
|
*
|
|
78
77
|
* An object's URL is generated when the object is first created and
|
|
79
78
|
* should include sufficient randomness to prevent collisions
|
|
@@ -87,24 +86,6 @@ export interface GraffitiObjectBase {
|
|
|
87
86
|
* or `graffiti:p2p:` for objects stored on a peer-to-peer network.
|
|
88
87
|
*/
|
|
89
88
|
url: string;
|
|
90
|
-
/**
|
|
91
|
-
* A number used to compare different versions of an object that has been
|
|
92
|
-
* updated via replacement (see {@link Graffiti.put}) or
|
|
93
|
-
* patch (see {@link Graffiti.patch}). Newer versions of
|
|
94
|
-
* an object have larger `revision` values than older versions.
|
|
95
|
-
* The `revision` can only
|
|
96
|
-
* be used to compare different versions of the same object,
|
|
97
|
-
* but cannot reliably be used to compare different objects.
|
|
98
|
-
* In cases where comparing different objects by time is useful,
|
|
99
|
-
* you could instead add `createdAt` or `lastModified` timestamp properties
|
|
100
|
-
* to an object's {@link value | `value`}.
|
|
101
|
-
*
|
|
102
|
-
* Depending on the implementation, the revision may be a timestamp,
|
|
103
|
-
* an incremental counter, may include randomness for obfuscation, and so on.
|
|
104
|
-
* Be careful not to rely on any of these specific `revision` instantiations
|
|
105
|
-
* as they may not be consistent across different implementations.
|
|
106
|
-
*/
|
|
107
|
-
lastModified: number;
|
|
108
89
|
}
|
|
109
90
|
/**
|
|
110
91
|
* This type constrains the {@link GraffitiObjectBase} type to adhere to a
|
|
@@ -145,42 +126,35 @@ export declare const GraffitiObjectJSONSchema: {
|
|
|
145
126
|
readonly actor: {
|
|
146
127
|
readonly type: "string";
|
|
147
128
|
};
|
|
148
|
-
readonly lastModified: {
|
|
149
|
-
readonly type: "number";
|
|
150
|
-
};
|
|
151
129
|
};
|
|
152
130
|
readonly additionalProperties: false;
|
|
153
|
-
readonly required: readonly ["value", "channels", "actor", "url"
|
|
131
|
+
readonly required: readonly ["value", "channels", "actor", "url"];
|
|
154
132
|
};
|
|
155
133
|
/**
|
|
156
134
|
* This is an object containing only the {@link GraffitiObjectBase.url | `url`}
|
|
157
135
|
* property of a {@link GraffitiObjectBase | GraffitiObject}.
|
|
158
|
-
* It is used as a utility type so that applications can call
|
|
159
|
-
* {@link Graffiti.
|
|
136
|
+
* It is used as a utility type so that applications can call
|
|
137
|
+
* {@link Graffiti.delete} directly on an object
|
|
160
138
|
* rather than on `object.url`.
|
|
161
139
|
*/
|
|
162
140
|
export type GraffitiObjectUrl = Pick<GraffitiObjectBase, "url">;
|
|
163
141
|
/**
|
|
164
|
-
* This object is a subset of {@link GraffitiObjectBase} that must be constructed locally before calling {@link Graffiti.
|
|
165
|
-
* This local copy
|
|
142
|
+
* This object is a subset of {@link GraffitiObjectBase} that must be constructed locally before calling {@link Graffiti.post}.
|
|
143
|
+
* This local copy ignores system-generated properties
|
|
144
|
+
* ({@link GraffitiObjectBase.url | `url`} and {@link GraffitiObjectBase.actor | `actor`}),
|
|
145
|
+
* and may be statically typed with
|
|
166
146
|
* a [JSON schema](https://json-schema.org/) to prevent the accidental creation of erroneous objects.
|
|
167
147
|
*
|
|
168
148
|
* This local object must have a {@link GraffitiObjectBase.value | `value`} and {@link GraffitiObjectBase.channels | `channels`}
|
|
169
149
|
* and may optionally have an {@link GraffitiObjectBase.allowed | `allowed`} property.
|
|
170
|
-
*
|
|
171
|
-
* It may also include a {@link GraffitiObjectBase.url | `url`} property to specify the
|
|
172
|
-
* URL of an existing object to replace. If no `url` is provided, one will be generated during object creation.
|
|
173
|
-
*
|
|
174
|
-
* This object does not need a {@link GraffitiObjectBase.lastModified | `lastModified`}
|
|
175
|
-
* property since it will be automatically generated by the Graffiti system.
|
|
176
150
|
*/
|
|
177
|
-
export type
|
|
151
|
+
export type GraffitiPostObject<Schema extends JSONSchema> = Pick<GraffitiObjectBase, "value" | "channels" | "allowed"> & Partial<GraffitiObjectBase> & FromSchema<Schema & typeof GraffitiPostObjectJSONSchema>;
|
|
178
152
|
/**
|
|
179
|
-
* A JSON Schema equivalent to the {@link
|
|
153
|
+
* A JSON Schema equivalent to the {@link GraffitiPostObject} type.
|
|
180
154
|
* Needed internally for type inference of JSON Schemas, but can
|
|
181
155
|
* be used by implementations to validate objects.
|
|
182
156
|
*/
|
|
183
|
-
export declare const
|
|
157
|
+
export declare const GraffitiPostObjectJSONSchema: {
|
|
184
158
|
readonly required: readonly ["value", "channels"];
|
|
185
159
|
readonly type: "object";
|
|
186
160
|
readonly properties: {
|
|
@@ -206,9 +180,6 @@ export declare const GraffitiPutObjectJSONSchema: {
|
|
|
206
180
|
readonly actor: {
|
|
207
181
|
readonly type: "string";
|
|
208
182
|
};
|
|
209
|
-
readonly lastModified: {
|
|
210
|
-
readonly type: "number";
|
|
211
|
-
};
|
|
212
183
|
};
|
|
213
184
|
readonly additionalProperties: false;
|
|
214
185
|
};
|
|
@@ -216,7 +187,7 @@ export declare const GraffitiPutObjectJSONSchema: {
|
|
|
216
187
|
* This object contains information that the underlying implementation can
|
|
217
188
|
* use to authenticate a particular {@link GraffitiObjectBase.actor | `actor`}.
|
|
218
189
|
* This object is required of all {@link Graffiti} methods
|
|
219
|
-
* that modify objects and is optional for methods that read objects.
|
|
190
|
+
* that modify objects or media and is optional for methods that read objects.
|
|
220
191
|
*
|
|
221
192
|
* At a minimum the `session` object must contain the
|
|
222
193
|
* {@link GraffitiSession.actor | `actor`} URI to authenticate with.
|
|
@@ -234,9 +205,6 @@ export declare const GraffitiPutObjectJSONSchema: {
|
|
|
234
205
|
* with {@link Graffiti.get} and {@link Graffiti.discover} but without type-checking
|
|
235
206
|
* the `session` it can be easy to forget to hide buttons that trigger
|
|
236
207
|
* other methods that require login.
|
|
237
|
-
* In the future, `session` object may be updated to include scope information
|
|
238
|
-
* and passing the `session` to each method can type-check whether the session provides the
|
|
239
|
-
* necessary permissions.
|
|
240
208
|
*
|
|
241
209
|
* Passing the `session` object per-method also allows for multiple sessions
|
|
242
210
|
* to be used within the same application, like an Email client fetching from
|
|
@@ -247,54 +215,16 @@ export interface GraffitiSession {
|
|
|
247
215
|
* The {@link GraffitiObjectBase.actor | `actor`} to authenticate with.
|
|
248
216
|
*/
|
|
249
217
|
actor: string;
|
|
250
|
-
/**
|
|
251
|
-
* A yet undefined property detailing what operations the session
|
|
252
|
-
* grants the actor to perform. For example, to allow a actor to
|
|
253
|
-
* read private messages from a particular set of channels or
|
|
254
|
-
* to allow the actor to write object matching a particular schema.
|
|
255
|
-
*/
|
|
256
|
-
scope?: {};
|
|
257
218
|
}
|
|
258
219
|
/**
|
|
259
|
-
*
|
|
260
|
-
* using the {@link Graffiti.patch} method. The patches must
|
|
261
|
-
* be an array of [JSON Patch](https://jsonpatch.com) operations.
|
|
262
|
-
* Patches can only be applied to the
|
|
263
|
-
* {@link GraffitiObjectBase.value | `value`}, {@link GraffitiObjectBase.channels | `channels`},
|
|
264
|
-
* and {@link GraffitiObjectBase.allowed | `allowed`} properties since the other
|
|
265
|
-
* properties either describe the object's location or are automatically generated.
|
|
266
|
-
* (See also {@link GraffitiPutObject}).
|
|
267
|
-
*/
|
|
268
|
-
export interface GraffitiPatch {
|
|
269
|
-
/**
|
|
270
|
-
* An array of [JSON Patch](https://jsonpatch.com) operations to
|
|
271
|
-
* modify the object's {@link GraffitiObjectBase.value | `value`}. The resulting
|
|
272
|
-
* `value` must still be a JSON object.
|
|
273
|
-
*/
|
|
274
|
-
value?: JSONPatchOperation[];
|
|
275
|
-
/**
|
|
276
|
-
* An array of [JSON Patch](https://jsonpatch.com) operations to
|
|
277
|
-
* modify the object's {@link GraffitiObjectBase.channels | `channels`}. The resulting
|
|
278
|
-
* `channels` must still be an array of strings.
|
|
279
|
-
*/
|
|
280
|
-
channels?: JSONPatchOperation[];
|
|
281
|
-
/**
|
|
282
|
-
* An array of [JSON Patch](https://jsonpatch.com) operations to
|
|
283
|
-
* modify the object's {@link GraffitiObjectBase.allowed | `allowed`} property. The resulting
|
|
284
|
-
* `allowed` property must still be an array of strings or `undefined`.
|
|
285
|
-
*/
|
|
286
|
-
allowed?: JSONPatchOperation[];
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* A stream of data that are returned by Graffiti's query-like operations
|
|
290
|
-
* {@link Graffiti.discover} and {@link Graffiti.recoverOrphans}.
|
|
220
|
+
* A stream of data that are returned by {@link Graffiti.discover}.
|
|
291
221
|
*
|
|
292
222
|
* Errors are returned within the stream rather than as
|
|
293
223
|
* exceptions that would halt the entire stream. This is because
|
|
294
224
|
* some implementations may pull data from multiple sources
|
|
295
225
|
* including some that may be unreliable. In many cases,
|
|
296
226
|
* these errors can be safely ignored.
|
|
297
|
-
* See {@link
|
|
227
|
+
* See {@link GraffitiObjectStreamError}.
|
|
298
228
|
*
|
|
299
229
|
* The stream is an [`AsyncGenerator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function)
|
|
300
230
|
* that can be iterated over using `for await` loops or calling `next` on the generator.
|
|
@@ -304,14 +234,13 @@ export interface GraffitiPatch {
|
|
|
304
234
|
* function and a {@link GraffitiObjectStreamReturn.cursor | `cursor`} string,
|
|
305
235
|
* each of which can be used to resume the stream from where it left off.
|
|
306
236
|
*/
|
|
307
|
-
export type GraffitiObjectStream<Schema extends JSONSchema> = AsyncGenerator<
|
|
237
|
+
export type GraffitiObjectStream<Schema extends JSONSchema> = AsyncGenerator<GraffitiObjectStreamError | GraffitiObjectStreamEntry<Schema>, GraffitiObjectStreamReturn<Schema>>;
|
|
308
238
|
/**
|
|
309
|
-
* An error that can occur in
|
|
310
|
-
* {@link GraffitiObjectStream} or {@link GraffitiChannelStatsStream}.
|
|
239
|
+
* An error that can occur in a {@link GraffitiObjectStream}.
|
|
311
240
|
*
|
|
312
241
|
* @internal
|
|
313
242
|
*/
|
|
314
|
-
export interface
|
|
243
|
+
export interface GraffitiObjectStreamError {
|
|
315
244
|
/**
|
|
316
245
|
* The error that occurred while streaming data.
|
|
317
246
|
*/
|
|
@@ -331,7 +260,7 @@ export interface GraffitiStreamError {
|
|
|
331
260
|
*/
|
|
332
261
|
export interface GraffitiObjectStreamEntry<Schema extends JSONSchema> {
|
|
333
262
|
/**
|
|
334
|
-
* Empty property for compatibility with {@link
|
|
263
|
+
* Empty property for compatibility with {@link GraffitiObjectStreamError}
|
|
335
264
|
*/
|
|
336
265
|
error?: undefined;
|
|
337
266
|
/**
|
|
@@ -353,7 +282,7 @@ export interface GraffitiObjectStreamEntry<Schema extends JSONSchema> {
|
|
|
353
282
|
*/
|
|
354
283
|
export interface GraffitiObjectStreamContinueTombstone {
|
|
355
284
|
/**
|
|
356
|
-
* Empty property for compatibility with {@link
|
|
285
|
+
* Empty property for compatibility with {@link GraffitiObjectStreamError}
|
|
357
286
|
*/
|
|
358
287
|
error?: undefined;
|
|
359
288
|
/**
|
|
@@ -363,25 +292,13 @@ export interface GraffitiObjectStreamContinueTombstone {
|
|
|
363
292
|
tombstone: true;
|
|
364
293
|
/**
|
|
365
294
|
* Sparse metadata about the deleted object. The full object is not returned
|
|
366
|
-
* to respect
|
|
295
|
+
* to respect an actor's privacy.
|
|
367
296
|
*/
|
|
368
297
|
object: {
|
|
369
298
|
/**
|
|
370
299
|
* The {@link GraffitiObjectBase.url | `url`} of the deleted object.
|
|
371
300
|
*/
|
|
372
301
|
url: string;
|
|
373
|
-
/**
|
|
374
|
-
* The time at which the object was deleted, comparable to
|
|
375
|
-
* {@link GraffitiObjectBase.lastModified | `lastModified`}.
|
|
376
|
-
*
|
|
377
|
-
* While it is not possible to re-{@link Graffiti.put | put} objects that have been
|
|
378
|
-
* {@link Graffiti.delete | deleted}, objects may appear deleted if
|
|
379
|
-
* an {@link GraffitiObjectBase.actor | `actor`} is no longer
|
|
380
|
-
* {@link GraffitiObjectBase.allowed | `allowed`} to access them.
|
|
381
|
-
* Therefore the {@link GraffitiObjectBase.lastModified | `lastModified`} property
|
|
382
|
-
* is necessary to compare object versions.
|
|
383
|
-
*/
|
|
384
|
-
lastModified: number;
|
|
385
302
|
};
|
|
386
303
|
}
|
|
387
304
|
/**
|
|
@@ -415,7 +332,7 @@ export interface GraffitiObjectStreamReturn<Schema extends JSONSchema> {
|
|
|
415
332
|
continue: () => GraffitiObjectStreamContinue<Schema>;
|
|
416
333
|
/**
|
|
417
334
|
* A string that can be serialized and stored to resume the stream later.
|
|
418
|
-
* It must be passed to the {@link Graffiti.
|
|
335
|
+
* It must be passed to the {@link Graffiti.continueDiscover} method
|
|
419
336
|
* to resume the stream.
|
|
420
337
|
*/
|
|
421
338
|
cursor: string;
|
|
@@ -423,44 +340,14 @@ export interface GraffitiObjectStreamReturn<Schema extends JSONSchema> {
|
|
|
423
340
|
/**
|
|
424
341
|
* A continutation of the {@link GraffitiObjectStream} type, as returned by
|
|
425
342
|
* the {@link GraffitiObjectStreamReturn.continue} or by using
|
|
426
|
-
* {@link GraffitiObjectStreamReturn.cursor} with {@link Graffiti.
|
|
343
|
+
* {@link GraffitiObjectStreamReturn.cursor} with {@link Graffiti.continueDiscover}.
|
|
427
344
|
*
|
|
428
345
|
* The continued stream may include `tombstone`s of objects that have been
|
|
429
346
|
* deleted since the original stream was run. See {@link GraffitiObjectStreamContinueTombstone}.
|
|
430
347
|
*
|
|
431
348
|
* @internal
|
|
432
349
|
*/
|
|
433
|
-
export type GraffitiObjectStreamContinue<Schema extends JSONSchema> = AsyncGenerator<
|
|
434
|
-
/**
|
|
435
|
-
* Statistic about single channel returned by {@link Graffiti.channelStats}.
|
|
436
|
-
* These statistics only account for contributions made by the
|
|
437
|
-
* querying actor.
|
|
438
|
-
*/
|
|
439
|
-
export type ChannelStats = {
|
|
440
|
-
/**
|
|
441
|
-
* The URI of the channel.
|
|
442
|
-
*/
|
|
443
|
-
channel: string;
|
|
444
|
-
/**
|
|
445
|
-
* The number of objects that the actor has {@link Graffiti.put | put}
|
|
446
|
-
* and not {@link Graffiti.delete | deleted} in the channel.
|
|
447
|
-
*/
|
|
448
|
-
count: number;
|
|
449
|
-
/**
|
|
450
|
-
* The time that the actor {@link GraffitiObjectBase.lastModified | last modified} an object in the channel,
|
|
451
|
-
* measured in milliseconds since January 1, 1970.
|
|
452
|
-
* {@link Graffiti.delete | Deleted} objects do not effect this modification time.
|
|
453
|
-
*/
|
|
454
|
-
lastModified: number;
|
|
455
|
-
};
|
|
456
|
-
/**
|
|
457
|
-
* A stream of data that are returned by Graffiti's {@link Graffiti.channelStats} method.
|
|
458
|
-
* See {@link GraffitiObjectStream} for more information on streams.
|
|
459
|
-
*/
|
|
460
|
-
export type GraffitiChannelStatsStream = AsyncGenerator<GraffitiStreamError | {
|
|
461
|
-
error?: undefined;
|
|
462
|
-
value: ChannelStats;
|
|
463
|
-
}>;
|
|
350
|
+
export type GraffitiObjectStreamContinue<Schema extends JSONSchema> = AsyncGenerator<GraffitiObjectStreamError | GraffitiObjectStreamContinueEntry<Schema>, GraffitiObjectStreamReturn<Schema>>;
|
|
464
351
|
/**
|
|
465
352
|
* The event type produced in {@link Graffiti.sessionEvents}
|
|
466
353
|
* when a actor 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;
|
|
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;AAEhE;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,KAAK,EAAE,EAAE,CAAC;IAEV;;;;;;;;;;;;OAYG;IACH,QAAQ,EAAE,MAAM,EAAE,CAAC;IAEnB;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAE1B;;;;;;;;;;;;;OAaG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;;;;;;;;;;OAcG;IACH,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,CAAC,MAAM,SAAS,UAAU,IAAI,kBAAkB,GACxE,UAAU,CAAC,MAAM,GAAG,OAAO,wBAAwB,CAAC,CAAC;AAEvD;;;;GAIG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWN,CAAC;AAE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rorInvalidSchema extends Error {
|
|
|
13
13
|
export declare class GraffitiErrorSchemaMismatch extends Error {
|
|
14
14
|
constructor(message?: string);
|
|
15
15
|
}
|
|
16
|
-
export declare class
|
|
16
|
+
export declare class GraffitiErrorTooLarge extends Error {
|
|
17
17
|
constructor(message?: string);
|
|
18
18
|
}
|
|
19
|
-
export declare class
|
|
19
|
+
export declare class GraffitiErrorNotAcceptable extends Error {
|
|
20
20
|
constructor(message?: string);
|
|
21
21
|
}
|
|
22
22
|
export declare class GraffitiErrorInvalidUrl extends Error {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"3-errors.d.ts","sourceRoot":"","sources":["../../src/3-errors.ts"],"names":[],"mappings":"AAAA,qBAAa,yBAA0B,SAAQ,KAAK;gBACtC,OAAO,CAAC,EAAE,MAAM;CAK7B;AAED,qBAAa,sBAAuB,SAAQ,KAAK;gBACnC,OAAO,CAAC,EAAE,MAAM;CAK7B;AAED,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,OAAO,CAAC,EAAE,MAAM;CAK7B;AAED,qBAAa,0BAA2B,SAAQ,KAAK;gBACvC,OAAO,CAAC,EAAE,MAAM;CAK7B;AAED,qBAAa,2BAA4B,SAAQ,KAAK;gBACxC,OAAO,CAAC,EAAE,MAAM;CAK7B;AAED,qBAAa,
|
|
1
|
+
{"version":3,"file":"3-errors.d.ts","sourceRoot":"","sources":["../../src/3-errors.ts"],"names":[],"mappings":"AAAA,qBAAa,yBAA0B,SAAQ,KAAK;gBACtC,OAAO,CAAC,EAAE,MAAM;CAK7B;AAED,qBAAa,sBAAuB,SAAQ,KAAK;gBACnC,OAAO,CAAC,EAAE,MAAM;CAK7B;AAED,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,OAAO,CAAC,EAAE,MAAM;CAK7B;AAED,qBAAa,0BAA2B,SAAQ,KAAK;gBACvC,OAAO,CAAC,EAAE,MAAM;CAK7B;AAED,qBAAa,2BAA4B,SAAQ,KAAK;gBACxC,OAAO,CAAC,EAAE,MAAM;CAK7B;AAED,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,OAAO,CAAC,EAAE,MAAM;CAK7B;AAED,qBAAa,0BAA2B,SAAQ,KAAK;gBACvC,OAAO,CAAC,EAAE,MAAM;CAK7B;AAED,qBAAa,uBAAwB,SAAQ,KAAK;gBACpC,OAAO,CAAC,EAAE,MAAM;CAK7B;AAED,qBAAa,kCAAmC,SAAQ,KAAK;gBAC/C,OAAO,CAAC,EAAE,MAAM;CAK7B"}
|
package/dist/tests/crud.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Graffiti, GraffitiSession } from "@graffiti-garden/api";
|
|
2
|
-
export declare const graffitiCRUDTests: (useGraffiti: () => Pick<Graffiti, "
|
|
2
|
+
export declare const graffitiCRUDTests: (useGraffiti: () => Pick<Graffiti, "post" | "get" | "delete">, useSession1: () => GraffitiSession | Promise<GraffitiSession>, useSession2: () => GraffitiSession | Promise<GraffitiSession>) => void;
|
|
3
3
|
//# sourceMappingURL=crud.d.ts.map
|
package/dist/tests/crud.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crud.d.ts","sourceRoot":"","sources":["../../tests/crud.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EACR,eAAe,
|
|
1
|
+
{"version":3,"file":"crud.d.ts","sourceRoot":"","sources":["../../tests/crud.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EACR,eAAe,EAEhB,MAAM,sBAAsB,CAAC;AAS9B,eAAO,MAAM,iBAAiB,GAC5B,aAAa,MAAM,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC,EAC5D,aAAa,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,EAC7D,aAAa,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,SAoP9D,CAAC"}
|
package/dist/tests/discover.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Graffiti, GraffitiSession } from "@graffiti-garden/api";
|
|
2
|
-
export declare const graffitiDiscoverTests: (useGraffiti: () => Pick<Graffiti, "discover" | "
|
|
2
|
+
export declare const graffitiDiscoverTests: (useGraffiti: () => Pick<Graffiti, "discover" | "post" | "delete" | "continueDiscover">, useSession1: () => GraffitiSession | Promise<GraffitiSession>, useSession2: () => GraffitiSession | Promise<GraffitiSession>) => void;
|
|
3
3
|
//# sourceMappingURL=discover.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../../tests/discover.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EAER,eAAe,EAEhB,MAAM,sBAAsB,CAAC;AAQ9B,eAAO,MAAM,qBAAqB,GAChC,aAAa,MAAM,IAAI,CACrB,QAAQ,EACR,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../../tests/discover.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EAER,eAAe,EAEhB,MAAM,sBAAsB,CAAC;AAQ9B,eAAO,MAAM,qBAAqB,GAChC,aAAa,MAAM,IAAI,CACrB,QAAQ,EACR,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,kBAAkB,CACpD,EACD,aAAa,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,EAC7D,aAAa,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,SAkY9D,CAAC"}
|
package/dist/tests/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../tests/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../tests/index.ts"],"names":[],"mappings":"AAEA,cAAc,SAAS,CAAC"}
|
package/dist/tests/utils.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { GraffitiPostObject, GraffitiObjectStream, JSONSchema, GraffitiObject, GraffitiObjectStreamReturn, GraffitiObjectStreamContinue, Graffiti, GraffitiSession } 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
|
-
export declare function
|
|
6
|
+
export declare function randomPostObject(): GraffitiPostObject<{}>;
|
|
7
7
|
export declare function nextStreamValue<Schema extends JSONSchema>(iterator: GraffitiObjectStream<Schema>): Promise<GraffitiObject<Schema>>;
|
|
8
|
-
export declare function continueStream<Schema extends JSONSchema>(graffiti: Pick<Graffiti, "
|
|
8
|
+
export declare function continueStream<Schema extends JSONSchema>(graffiti: Pick<Graffiti, "continueDiscover">, streamReturn: GraffitiObjectStreamReturn<Schema>, type: "cursor" | "continue", session?: GraffitiSession | null): GraffitiObjectStreamContinue<Schema>;
|
|
9
9
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../tests/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../tests/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,kBAAkB,EAClB,oBAAoB,EACpB,UAAU,EACV,cAAc,EACd,0BAA0B,EAC1B,4BAA4B,EAC5B,QAAQ,EACR,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAE9B,wBAAgB,YAAY,IAAI,MAAM,CASrC;AAED,wBAAgB,WAAW;;EAI1B;AAED,wBAAgB,gBAAgB,IAAI,kBAAkB,CAAC,EAAE,CAAC,CAKzD;AAED,wBAAsB,eAAe,CAAC,MAAM,SAAS,UAAU,EAC7D,QAAQ,EAAE,oBAAoB,CAAC,MAAM,CAAC,GACrC,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAKjC;AAED,wBAAgB,cAAc,CAAC,MAAM,SAAS,UAAU,EACtD,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,kBAAkB,CAAC,EAC5C,YAAY,EAAE,0BAA0B,CAAC,MAAM,CAAC,EAChD,IAAI,EAAE,QAAQ,GAAG,UAAU,EAC3B,OAAO,CAAC,EAAE,eAAe,GAAG,IAAI,GAC/B,4BAA4B,CAAC,MAAM,CAAC,CAStC"}
|