@graffiti-garden/api 0.2.8 → 0.2.10

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,3 +1,3 @@
1
1
  import type { Graffiti, GraffitiSession } from "@graffiti-garden/api";
2
- export declare const graffitiChannelStatsTests: (useGraffiti: () => Pick<Graffiti, "channelStats" | "put" | "delete" | "patch">, useSession1: () => GraffitiSession, useSession2: () => GraffitiSession) => void;
2
+ export declare const graffitiChannelStatsTests: (useGraffiti: () => Pick<Graffiti, "channelStats" | "put" | "delete" | "patch">, useSession1: () => GraffitiSession | Promise<GraffitiSession>, useSession2: () => GraffitiSession | Promise<GraffitiSession>) => void;
3
3
  //# sourceMappingURL=channel-stats.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"channel-stats.d.ts","sourceRoot":"","sources":["../../tests/channel-stats.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGtE,eAAO,MAAM,yBAAyB,gBACvB,MAAM,IAAI,CACrB,QAAQ,EACR,cAAc,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAC5C,eACY,MAAM,eAAe,eACrB,MAAM,eAAe,SAiHnC,CAAC"}
1
+ {"version":3,"file":"channel-stats.d.ts","sourceRoot":"","sources":["../../tests/channel-stats.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGtE,eAAO,MAAM,yBAAyB,gBACvB,MAAM,IAAI,CACrB,QAAQ,EACR,cAAc,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAC5C,eACY,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,eAChD,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,SAsH9D,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import type { Graffiti, GraffitiSession } from "@graffiti-garden/api";
2
- export declare const graffitiCRUDTests: (useGraffiti: () => Pick<Graffiti, "put" | "get" | "delete" | "patch">, useSession1: () => GraffitiSession, useSession2: () => GraffitiSession) => void;
2
+ export declare const graffitiCRUDTests: (useGraffiti: () => Pick<Graffiti, "put" | "get" | "delete" | "patch">, useSession1: () => GraffitiSession | Promise<GraffitiSession>, useSession2: () => GraffitiSession | Promise<GraffitiSession>) => void;
3
3
  //# sourceMappingURL=crud.d.ts.map
@@ -1 +1 @@
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;AAW9B,eAAO,MAAM,iBAAiB,gBACf,MAAM,IAAI,CAAC,QAAQ,EAAE,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC,eACxD,MAAM,eAAe,eACrB,MAAM,eAAe,SA4enC,CAAC"}
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;AAW9B,eAAO,MAAM,iBAAiB,gBACf,MAAM,IAAI,CAAC,QAAQ,EAAE,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC,eACxD,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,eAChD,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,SA0c9D,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import type { Graffiti, GraffitiSession } from "@graffiti-garden/api";
2
- export declare const graffitiDiscoverTests: (useGraffiti: () => Pick<Graffiti, "discover" | "put" | "delete" | "patch">, useSession1: () => GraffitiSession, useSession2: () => GraffitiSession) => void;
2
+ export declare const graffitiDiscoverTests: (useGraffiti: () => Pick<Graffiti, "discover" | "put" | "delete" | "patch">, 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,EACR,eAAe,EAEhB,MAAM,sBAAsB,CAAC;AAG9B,eAAO,MAAM,qBAAqB,gBACnB,MAAM,IAAI,CAAC,QAAQ,EAAE,UAAU,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC,eAC7D,MAAM,eAAe,eACrB,MAAM,eAAe,SA0kBnC,CAAC"}
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,gBACnB,MAAM,IAAI,CAAC,QAAQ,EAAE,UAAU,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC,eAC7D,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,eAChD,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,SAwiB9D,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import type { Graffiti, GraffitiSession } from "@graffiti-garden/api";
2
- export declare const graffitiOrphanTests: (useGraffiti: () => Pick<Graffiti, "recoverOrphans" | "put" | "delete" | "patch">, useSession1: () => GraffitiSession, useSession2: () => GraffitiSession) => void;
2
+ export declare const graffitiOrphanTests: (useGraffiti: () => Pick<Graffiti, "recoverOrphans" | "put" | "delete" | "patch">, useSession1: () => GraffitiSession | Promise<GraffitiSession>, useSession2: () => GraffitiSession | Promise<GraffitiSession>) => void;
3
3
  //# sourceMappingURL=orphans.d.ts.map
@@ -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,gBACjB,MAAM,IAAI,CACrB,QAAQ,EACR,gBAAgB,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAC9C,eACY,MAAM,eAAe,eACrB,MAAM,eAAe,SAkEnC,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,gBACjB,MAAM,IAAI,CACrB,QAAQ,EACR,gBAAgB,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAC9C,eACY,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,eAChD,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,SAuE9D,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import type { GraffitiFactory, GraffitiSession } from "@graffiti-garden/api";
2
- export declare const graffitiSynchronizeTests: (useGraffiti: GraffitiFactory, useSession1: () => GraffitiSession, useSession2: () => GraffitiSession) => void;
2
+ export declare const graffitiSynchronizeTests: (useGraffiti: GraffitiFactory, useSession1: () => GraffitiSession | Promise<GraffitiSession>, useSession2: () => GraffitiSession | Promise<GraffitiSession>) => void;
3
3
  //# sourceMappingURL=synchronize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"synchronize.d.ts","sourceRoot":"","sources":["../../tests/synchronize.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG7E,eAAO,MAAM,wBAAwB,gBACtB,eAAe,eACf,MAAM,eAAe,eACrB,MAAM,eAAe,SAyVnC,CAAC"}
1
+ {"version":3,"file":"synchronize.d.ts","sourceRoot":"","sources":["../../tests/synchronize.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG7E,eAAO,MAAM,wBAAwB,gBACtB,eAAe,eACf,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,eAChD,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,SA0V9D,CAAC"}
package/dist/tests.mjs CHANGED
@@ -63,7 +63,7 @@ var graffitiLocationTests = (useGraffiti) => {
63
63
  };
64
64
 
65
65
  // tests/crud.ts
66
- import { it as it2, expect as expect2, describe as describe2 } from "vitest";
66
+ import { it as it2, expect as expect2, describe as describe2, beforeAll } from "vitest";
67
67
  import {
68
68
  GraffitiErrorNotFound,
69
69
  GraffitiErrorSchemaMismatch,
@@ -79,9 +79,17 @@ var graffitiCRUDTests = (useGraffiti, useSession1, useSession2) => {
79
79
  timeout: 2e4
80
80
  },
81
81
  () => {
82
+ let graffiti;
83
+ let session;
84
+ let session1;
85
+ let session2;
86
+ beforeAll(async () => {
87
+ graffiti = useGraffiti();
88
+ session1 = await useSession1();
89
+ session = session1;
90
+ session2 = await useSession2();
91
+ });
82
92
  it2("put, get, delete", async () => {
83
- const graffiti = useGraffiti();
84
- const session = useSession1();
85
93
  const value = {
86
94
  something: "hello, world~ c:"
87
95
  };
@@ -128,8 +136,6 @@ var graffitiCRUDTests = (useGraffiti, useSession1, useSession2) => {
128
136
  expect2(final).toEqual(beforeDeleted);
129
137
  });
130
138
  it2("get non-existant", async () => {
131
- const graffiti = useGraffiti();
132
- const session = useSession1();
133
139
  const putted = await graffiti.put(randomPutObject(), session);
134
140
  await expect2(
135
141
  graffiti.get(
@@ -142,9 +148,6 @@ var graffitiCRUDTests = (useGraffiti, useSession1, useSession2) => {
142
148
  ).rejects.toBeInstanceOf(GraffitiErrorNotFound);
143
149
  });
144
150
  it2("put, get, delete with wrong actor", async () => {
145
- const graffiti = useGraffiti();
146
- const session1 = useSession1();
147
- const session2 = useSession2();
148
151
  await expect2(
149
152
  graffiti.put(
150
153
  { value: {}, channels: [], actor: session2.actor },
@@ -163,8 +166,6 @@ var graffitiCRUDTests = (useGraffiti, useSession1, useSession2) => {
163
166
  );
164
167
  });
165
168
  it2("put and get with schema", async () => {
166
- const graffiti = useGraffiti();
167
- const session = useSession1();
168
169
  const schema = {
169
170
  properties: {
170
171
  value: {
@@ -195,8 +196,6 @@ var graffitiCRUDTests = (useGraffiti, useSession1, useSession2) => {
195
196
  expect2(gotten.value.another).toEqual(goodValue.another);
196
197
  });
197
198
  it2("put and get with invalid schema", async () => {
198
- const graffiti = useGraffiti();
199
- const session = useSession1();
200
199
  const putted = await graffiti.put({ value: {}, channels: [] }, session);
201
200
  await expect2(
202
201
  graffiti.get(putted, {
@@ -210,8 +209,6 @@ var graffitiCRUDTests = (useGraffiti, useSession1, useSession2) => {
210
209
  ).rejects.toThrow(GraffitiErrorInvalidSchema);
211
210
  });
212
211
  it2("put and get with wrong schema", async () => {
213
- const graffiti = useGraffiti();
214
- const session = useSession1();
215
212
  const putted = await graffiti.put(
216
213
  {
217
214
  value: {
@@ -236,9 +233,6 @@ var graffitiCRUDTests = (useGraffiti, useSession1, useSession2) => {
236
233
  ).rejects.toThrow(GraffitiErrorSchemaMismatch);
237
234
  });
238
235
  it2("put and get with empty access control", async () => {
239
- const graffiti = useGraffiti();
240
- const session1 = useSession1();
241
- const session2 = useSession2();
242
236
  const value = {
243
237
  um: "hi"
244
238
  };
@@ -260,9 +254,6 @@ var graffitiCRUDTests = (useGraffiti, useSession1, useSession2) => {
260
254
  );
261
255
  });
262
256
  it2("put and get with specific access control", async () => {
263
- const graffiti = useGraffiti();
264
- const session1 = useSession1();
265
- const session2 = useSession2();
266
257
  const value = {
267
258
  um: "hi"
268
259
  };
@@ -289,8 +280,6 @@ var graffitiCRUDTests = (useGraffiti, useSession1, useSession2) => {
289
280
  expect2(gotten2.channels).toEqual([]);
290
281
  });
291
282
  it2("patch value", async () => {
292
- const graffiti = useGraffiti();
293
- const session = useSession1();
294
283
  const value = {
295
284
  something: "hello, world~ c:"
296
285
  };
@@ -313,8 +302,6 @@ var graffitiCRUDTests = (useGraffiti, useSession1, useSession2) => {
313
302
  await graffiti.delete(putted, session);
314
303
  });
315
304
  it2("patch deleted object", async () => {
316
- const graffiti = useGraffiti();
317
- const session = useSession1();
318
305
  const putted = await graffiti.put(randomPutObject(), session);
319
306
  const deleted = await graffiti.delete(putted, session);
320
307
  await expect2(
@@ -322,8 +309,6 @@ var graffitiCRUDTests = (useGraffiti, useSession1, useSession2) => {
322
309
  ).rejects.toBeInstanceOf(GraffitiErrorNotFound);
323
310
  });
324
311
  it2("deep patch", async () => {
325
- const graffiti = useGraffiti();
326
- const session = useSession1();
327
312
  const value = {
328
313
  something: {
329
314
  another: {
@@ -359,8 +344,6 @@ var graffitiCRUDTests = (useGraffiti, useSession1, useSession2) => {
359
344
  });
360
345
  });
361
346
  it2("patch channels", async () => {
362
- const graffiti = useGraffiti();
363
- const session = useSession1();
364
347
  const channelsBefore = [randomString()];
365
348
  const channelsAfter = [randomString()];
366
349
  const putted = await graffiti.put(
@@ -377,8 +360,6 @@ var graffitiCRUDTests = (useGraffiti, useSession1, useSession2) => {
377
360
  await graffiti.delete(putted, session);
378
361
  });
379
362
  it2("patch 'increment' with test", async () => {
380
- const graffiti = useGraffiti();
381
- const session = useSession1();
382
363
  const putted = await graffiti.put(
383
364
  {
384
365
  value: {
@@ -425,8 +406,6 @@ var graffitiCRUDTests = (useGraffiti, useSession1, useSession2) => {
425
406
  ).rejects.toThrow(GraffitiErrorPatchTestFailed);
426
407
  });
427
408
  it2("invalid patch", async () => {
428
- const graffiti = useGraffiti();
429
- const session = useSession1();
430
409
  const object = randomPutObject();
431
410
  const putted = await graffiti.put(object, session);
432
411
  await expect2(
@@ -444,8 +423,6 @@ var graffitiCRUDTests = (useGraffiti, useSession1, useSession2) => {
444
423
  ).rejects.toThrow(GraffitiErrorPatchError);
445
424
  });
446
425
  it2("patch channels to be wrong", async () => {
447
- const graffiti = useGraffiti();
448
- const session = useSession1();
449
426
  const object = randomPutObject();
450
427
  object.allowed = [randomString()];
451
428
  const putted = await graffiti.put(object, session);
@@ -494,12 +471,21 @@ var graffitiCRUDTests = (useGraffiti, useSession1, useSession2) => {
494
471
  };
495
472
 
496
473
  // tests/synchronize.ts
497
- import { it as it3, expect as expect3, describe as describe3, assert as assert2 } from "vitest";
474
+ import { it as it3, expect as expect3, describe as describe3, assert as assert2, beforeAll as beforeAll2 } from "vitest";
498
475
  var graffitiSynchronizeTests = (useGraffiti, useSession1, useSession2) => {
499
476
  describe3.concurrent("synchronizeDiscover", () => {
477
+ let graffiti;
478
+ let session;
479
+ let session1;
480
+ let session2;
481
+ beforeAll2(async () => {
482
+ graffiti = useGraffiti();
483
+ session1 = await useSession1();
484
+ session = session1;
485
+ session2 = await useSession2();
486
+ });
500
487
  it3("get", async () => {
501
488
  const graffiti1 = useGraffiti();
502
- const session = useSession1();
503
489
  const object = randomPutObject();
504
490
  const channels = object.channels.slice(1);
505
491
  const putted = await graffiti1.put(object, session);
@@ -516,8 +502,6 @@ var graffitiSynchronizeTests = (useGraffiti, useSession1, useSession2) => {
516
502
  expect3(result.value.lastModified).toEqual(gotten.lastModified);
517
503
  });
518
504
  it3("put", async () => {
519
- const graffiti = useGraffiti();
520
- const session = useSession1();
521
505
  const beforeChannel = randomString();
522
506
  const afterChannel = randomString();
523
507
  const sharedChannel = randomString();
@@ -566,8 +550,6 @@ var graffitiSynchronizeTests = (useGraffiti, useSession1, useSession2) => {
566
550
  );
567
551
  });
568
552
  it3("patch", async () => {
569
- const graffiti = useGraffiti();
570
- const session = useSession1();
571
553
  const beforeChannel = randomString();
572
554
  const afterChannel = randomString();
573
555
  const sharedChannel = randomString();
@@ -632,8 +614,6 @@ var graffitiSynchronizeTests = (useGraffiti, useSession1, useSession2) => {
632
614
  );
633
615
  });
634
616
  it3("delete", async () => {
635
- const graffiti = useGraffiti();
636
- const session = useSession1();
637
617
  const channels = [randomString(), randomString(), randomString()];
638
618
  const oldValue = { hello: "world" };
639
619
  const oldChannels = [randomString(), ...channels.slice(1)];
@@ -657,9 +637,6 @@ var graffitiSynchronizeTests = (useGraffiti, useSession1, useSession2) => {
657
637
  );
658
638
  });
659
639
  it3("not allowed", async () => {
660
- const graffiti = useGraffiti();
661
- const session1 = useSession1();
662
- const session2 = useSession2();
663
640
  const allChannels = [randomString(), randomString(), randomString()];
664
641
  const channels = allChannels.slice(1);
665
642
  const creatorNext = graffiti.synchronizeDiscover(channels, {}, session1).next();
@@ -691,10 +668,18 @@ var graffitiSynchronizeTests = (useGraffiti, useSession1, useSession2) => {
691
668
  expect3(allowedResult.value.channels).toEqual(channels);
692
669
  });
693
670
  });
694
- describe3("synchronizeGet", () => {
671
+ describe3.concurrent("synchronizeGet", () => {
672
+ let graffiti;
673
+ let session;
674
+ let session1;
675
+ let session2;
676
+ beforeAll2(async () => {
677
+ graffiti = useGraffiti();
678
+ session1 = await useSession1();
679
+ session = session1;
680
+ session2 = await useSession2();
681
+ });
695
682
  it3("replace, delete", async () => {
696
- const graffiti = useGraffiti();
697
- const session = useSession1();
698
683
  const object = randomPutObject();
699
684
  const putted = await graffiti.put(object, session);
700
685
  const iterator = graffiti.synchronizeGet(putted, {});
@@ -729,9 +714,6 @@ var graffitiSynchronizeTests = (useGraffiti, useSession1, useSession2) => {
729
714
  ).rejects.toThrow("Timeout");
730
715
  });
731
716
  it3("not allowed", async () => {
732
- const graffiti = useGraffiti();
733
- const session1 = useSession1();
734
- const session2 = useSession2();
735
717
  const object = randomPutObject();
736
718
  const putted = await graffiti.put(object, session1);
737
719
  const iterator1 = graffiti.synchronizeGet(putted, {}, session1);
@@ -767,17 +749,24 @@ var graffitiSynchronizeTests = (useGraffiti, useSession1, useSession2) => {
767
749
  };
768
750
 
769
751
  // tests/discover.ts
770
- import { it as it4, expect as expect4, describe as describe4, assert as assert3 } from "vitest";
752
+ import { it as it4, expect as expect4, describe as describe4, assert as assert3, beforeAll as beforeAll3 } from "vitest";
771
753
  var graffitiDiscoverTests = (useGraffiti, useSession1, useSession2) => {
772
754
  describe4.concurrent("discover", { timeout: 2e4 }, () => {
755
+ let graffiti;
756
+ let session;
757
+ let session1;
758
+ let session2;
759
+ beforeAll3(async () => {
760
+ graffiti = useGraffiti();
761
+ session1 = await useSession1();
762
+ session = session1;
763
+ session2 = await useSession2();
764
+ });
773
765
  it4("discover nothing", async () => {
774
- const graffiti = useGraffiti();
775
766
  const iterator = graffiti.discover([], {});
776
767
  expect4(await iterator.next()).toHaveProperty("done", true);
777
768
  });
778
769
  it4("discover single", async () => {
779
- const graffiti = useGraffiti();
780
- const session = useSession1();
781
770
  const object = randomPutObject();
782
771
  const putted = await graffiti.put(object, session);
783
772
  const queryChannels = [randomString(), object.channels[0]];
@@ -793,17 +782,12 @@ var graffitiDiscoverTests = (useGraffiti, useSession1, useSession2) => {
793
782
  expect4(result2.done).toBe(true);
794
783
  });
795
784
  it4("discover wrong channel", async () => {
796
- const graffiti = useGraffiti();
797
- const session = useSession1();
798
785
  const object = randomPutObject();
799
786
  await graffiti.put(object, session);
800
787
  const iterator = graffiti.discover([randomString()], {});
801
788
  await expect4(iterator.next()).resolves.toHaveProperty("done", true);
802
789
  });
803
790
  it4("discover not allowed", async () => {
804
- const graffiti = useGraffiti();
805
- const session1 = useSession1();
806
- const session2 = useSession2();
807
791
  const object = randomPutObject();
808
792
  object.allowed = [randomString(), randomString()];
809
793
  const putted = await graffiti.put(object, session1);
@@ -821,9 +805,6 @@ var graffitiDiscoverTests = (useGraffiti, useSession1, useSession2) => {
821
805
  expect4(await iteratorNoSession.next()).toHaveProperty("done", true);
822
806
  });
823
807
  it4("discover allowed", async () => {
824
- const graffiti = useGraffiti();
825
- const session1 = useSession1();
826
- const session2 = useSession2();
827
808
  const object = randomPutObject();
828
809
  object.allowed = [randomString(), session2.actor, randomString()];
829
810
  const putted = await graffiti.put(object, session1);
@@ -838,9 +819,6 @@ var graffitiDiscoverTests = (useGraffiti, useSession1, useSession2) => {
838
819
  });
839
820
  for (const prop of ["name", "actor", "lastModified"]) {
840
821
  it4(`discover for ${prop}`, async () => {
841
- const graffiti = useGraffiti();
842
- const session1 = useSession1();
843
- const session2 = useSession2();
844
822
  const object1 = randomPutObject();
845
823
  const putted1 = await graffiti.put(object1, session1);
846
824
  const object2 = randomPutObject();
@@ -862,8 +840,6 @@ var graffitiDiscoverTests = (useGraffiti, useSession1, useSession2) => {
862
840
  });
863
841
  }
864
842
  it4("discover with lastModified range", async () => {
865
- const graffiti = useGraffiti();
866
- const session = useSession1();
867
843
  const object = randomPutObject();
868
844
  const putted1 = await graffiti.put(object, session);
869
845
  await new Promise((r) => setTimeout(r, 20));
@@ -949,9 +925,6 @@ var graffitiDiscoverTests = (useGraffiti, useSession1, useSession2) => {
949
925
  expect4(await lteIteratorEpsilon.next()).toHaveProperty("done", true);
950
926
  });
951
927
  it4("discover schema allowed, as and not as owner", async () => {
952
- const graffiti = useGraffiti();
953
- const session1 = useSession1();
954
- const session2 = useSession2();
955
928
  const object = randomPutObject();
956
929
  object.allowed = [randomString(), session2.actor, randomString()];
957
930
  await graffiti.put(object, session1);
@@ -1041,9 +1014,6 @@ var graffitiDiscoverTests = (useGraffiti, useSession1, useSession2) => {
1041
1014
  ).resolves.toHaveProperty("done", true);
1042
1015
  });
1043
1016
  it4("discover schema channels, as and not as owner", async () => {
1044
- const graffiti = useGraffiti();
1045
- const session1 = useSession1();
1046
- const session2 = useSession2();
1047
1017
  const object = randomPutObject();
1048
1018
  object.channels = [randomString(), randomString(), randomString()];
1049
1019
  await graffiti.put(object, session1);
@@ -1133,8 +1103,6 @@ var graffitiDiscoverTests = (useGraffiti, useSession1, useSession2) => {
1133
1103
  ).resolves.toHaveProperty("done", true);
1134
1104
  });
1135
1105
  it4("discover query for empty allowed", async () => {
1136
- const graffiti = useGraffiti();
1137
- const session1 = useSession1();
1138
1106
  const publicO = randomPutObject();
1139
1107
  const publicSchema = {
1140
1108
  not: {
@@ -1162,8 +1130,6 @@ var graffitiDiscoverTests = (useGraffiti, useSession1, useSession2) => {
1162
1130
  await expect4(iterator2.next()).resolves.toHaveProperty("done", true);
1163
1131
  });
1164
1132
  it4("discover query for values", async () => {
1165
- const graffiti = useGraffiti();
1166
- const session = useSession1();
1167
1133
  const object1 = randomPutObject();
1168
1134
  object1.value = { test: randomString() };
1169
1135
  await graffiti.put(object1, session);
@@ -1197,8 +1163,6 @@ var graffitiDiscoverTests = (useGraffiti, useSession1, useSession2) => {
1197
1163
  expect4(counts.get("other")).toBe(1);
1198
1164
  });
1199
1165
  it4("discover for deleted content", async () => {
1200
- const graffiti = useGraffiti();
1201
- const session = useSession1();
1202
1166
  const object = randomPutObject();
1203
1167
  const putted = await graffiti.put(object, session);
1204
1168
  const deleted = await graffiti.delete(putted, session);
@@ -1213,8 +1177,6 @@ var graffitiDiscoverTests = (useGraffiti, useSession1, useSession2) => {
1213
1177
  });
1214
1178
  it4("discover for replaced channels", async () => {
1215
1179
  for (let i = 0; i < 10; i++) {
1216
- const graffiti = useGraffiti();
1217
- const session = useSession1();
1218
1180
  const object1 = randomPutObject();
1219
1181
  const putted = await graffiti.put(object1, session);
1220
1182
  const object2 = randomPutObject();
@@ -1247,8 +1209,6 @@ var graffitiDiscoverTests = (useGraffiti, useSession1, useSession2) => {
1247
1209
  }
1248
1210
  });
1249
1211
  it4("discover for patched allowed", async () => {
1250
- const graffiti = useGraffiti();
1251
- const session = useSession1();
1252
1212
  const object = randomPutObject();
1253
1213
  const putted = await graffiti.put(object, session);
1254
1214
  await graffiti.patch(
@@ -1267,8 +1227,6 @@ var graffitiDiscoverTests = (useGraffiti, useSession1, useSession2) => {
1267
1227
  await expect4(iterator.next()).resolves.toHaveProperty("done", true);
1268
1228
  });
1269
1229
  it4("put concurrently and discover one", async () => {
1270
- const graffiti = useGraffiti();
1271
- const session = useSession1();
1272
1230
  const object = randomPutObject();
1273
1231
  object.name = randomString();
1274
1232
  const putPromises = Array(100).fill(0).map(() => graffiti.put(object, session));
@@ -1291,12 +1249,20 @@ var graffitiDiscoverTests = (useGraffiti, useSession1, useSession2) => {
1291
1249
  };
1292
1250
 
1293
1251
  // tests/orphans.ts
1294
- import { it as it5, expect as expect5, describe as describe5 } from "vitest";
1252
+ import { it as it5, expect as expect5, describe as describe5, beforeAll as beforeAll4 } from "vitest";
1295
1253
  var graffitiOrphanTests = (useGraffiti, useSession1, useSession2) => {
1296
- describe5("recoverOrphans", () => {
1254
+ describe5("recoverOrphans", { timeout: 2e4 }, () => {
1255
+ let graffiti;
1256
+ let session;
1257
+ let session1;
1258
+ let session2;
1259
+ beforeAll4(async () => {
1260
+ graffiti = useGraffiti();
1261
+ session1 = await useSession1();
1262
+ session = session1;
1263
+ session2 = await useSession2();
1264
+ });
1297
1265
  it5("list orphans", async () => {
1298
- const graffiti = useGraffiti();
1299
- const session = useSession1();
1300
1266
  const existingOrphans = [];
1301
1267
  const orphanIterator1 = graffiti.recoverOrphans({}, session);
1302
1268
  for await (const orphan of orphanIterator1) {
@@ -1319,8 +1285,6 @@ var graffitiOrphanTests = (useGraffiti, useSession1, useSession2) => {
1319
1285
  expect5(numResults).toBe(1);
1320
1286
  });
1321
1287
  it5("replaced orphan, no longer", async () => {
1322
- const graffiti = useGraffiti();
1323
- const session = useSession1();
1324
1288
  const object = randomPutObject();
1325
1289
  object.channels = [];
1326
1290
  const putOrphan = await graffiti.put(object, session);
@@ -1352,12 +1316,20 @@ var graffitiOrphanTests = (useGraffiti, useSession1, useSession2) => {
1352
1316
  };
1353
1317
 
1354
1318
  // tests/channel-stats.ts
1355
- import { it as it6, expect as expect6, describe as describe6, assert as assert5 } from "vitest";
1319
+ import { it as it6, expect as expect6, describe as describe6, assert as assert5, beforeAll as beforeAll5 } from "vitest";
1356
1320
  var graffitiChannelStatsTests = (useGraffiti, useSession1, useSession2) => {
1357
- describe6("channel stats", () => {
1321
+ describe6("channel stats", { timeout: 2e4 }, () => {
1322
+ let graffiti;
1323
+ let session;
1324
+ let session1;
1325
+ let session2;
1326
+ beforeAll5(async () => {
1327
+ graffiti = useGraffiti();
1328
+ session1 = await useSession1();
1329
+ session = session1;
1330
+ session2 = await useSession2();
1331
+ });
1358
1332
  it6("list channels", async () => {
1359
- const graffiti = useGraffiti();
1360
- const session = useSession1();
1361
1333
  const existingChannels = /* @__PURE__ */ new Map();
1362
1334
  const channelIterator1 = graffiti.channelStats(session);
1363
1335
  for await (const channel of channelIterator1) {
@@ -1399,8 +1371,6 @@ var graffitiChannelStatsTests = (useGraffiti, useSession1, useSession2) => {
1399
1371
  expect6(newChannels.get(channels[2])).toBe(4);
1400
1372
  });
1401
1373
  it6("list channels with deleted channel", async () => {
1402
- const graffiti = useGraffiti();
1403
- const session = useSession1();
1404
1374
  const channels = [randomString(), randomString(), randomString()];
1405
1375
  const before = await graffiti.put(
1406
1376
  {