@roc-db/test-utils 0.2.0-pre.97 → 0.2.0-pre.98

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/dist/index.js CHANGED
@@ -198,25 +198,38 @@ var BlockRow = new Entity5("BlockRow", {
198
198
  })
199
199
  });
200
200
 
201
- // src/entities/PostVersion.ts
201
+ // src/entities/OrgSettingsEntity.ts
202
202
  import { Entity as Entity6 } from "roc-db";
203
203
  import { z as z16 } from "zod";
204
- var PostVersion = new Entity6("PostVersion", {
204
+ var OrgSettingsEntity = new Entity6("OrgSettings", {
205
+ singleton: true,
205
206
  data: z16.object({
206
- version: z16.number(),
207
- snapshot: z16.array(z16.any())
207
+ name: z16.string(),
208
+ theme: z16.string().optional()
208
209
  }),
209
- parents: z16.object({ post: PostRefSchema }),
210
- indexedDataKeys: ["version"],
211
- uniqueDataKeys: ["slug"]
210
+ parents: z16.object({ primaryAdmin: UserRefSchema.optional() }),
211
+ children: z16.object({ featuredPosts: z16.array(z16.string()) })
212
212
  });
213
213
 
214
- // src/entities/UserEntity.ts
214
+ // src/entities/PostVersion.ts
215
215
  import { Entity as Entity7 } from "roc-db";
216
216
  import { z as z17 } from "zod";
217
- var UserEntity = new Entity7("User", {
217
+ var PostVersion = new Entity7("PostVersion", {
218
218
  data: z17.object({
219
- email: z17.string().email()
219
+ version: z17.number(),
220
+ snapshot: z17.array(z17.any())
221
+ }),
222
+ parents: z17.object({ post: PostRefSchema }),
223
+ indexedDataKeys: ["version"],
224
+ uniqueDataKeys: ["slug"]
225
+ });
226
+
227
+ // src/entities/UserEntity.ts
228
+ import { Entity as Entity8 } from "roc-db";
229
+ import { z as z18 } from "zod";
230
+ var UserEntity = new Entity8("User", {
231
+ data: z18.object({
232
+ email: z18.string().email()
220
233
  }),
221
234
  uniqueDataKeys: ["email"]
222
235
  });
@@ -227,6 +240,7 @@ var entities = [
227
240
  BlockParagraph,
228
241
  BlockRow,
229
242
  Draft,
243
+ OrgSettingsEntity,
230
244
  PostEntity,
231
245
  PostVersion,
232
246
  UserEntity
@@ -251,8 +265,8 @@ var applyDraft = writeOperation("applyDraft", DraftRefSchema, (txn) => {
251
265
 
252
266
  // src/operations/createBlockImage.ts
253
267
  import { Query as Query2, writeOperation as writeOperation2 } from "roc-db";
254
- import { z as z18 } from "zod";
255
- var createBlockImage = writeOperation2("createBlockImage", z18.object({ parentRef: PostRefSchema, url: z18.string().url() }).strict(), (txn) => {
268
+ import { z as z19 } from "zod";
269
+ var createBlockImage = writeOperation2("createBlockImage", z19.object({ parentRef: PostRefSchema, url: z19.string().url() }).strict(), (txn) => {
256
270
  const ref = txn.createRef("BlockImage");
257
271
  const { parentRef, url } = txn.payload;
258
272
  return Query2(() => txn.createEntity(ref, {
@@ -263,10 +277,10 @@ var createBlockImage = writeOperation2("createBlockImage", z18.object({ parentRe
263
277
 
264
278
  // src/operations/createBlockParagraph.ts
265
279
  import { Query as Query3, QueryChain as QueryChain2, writeOperation as writeOperation3 } from "roc-db";
266
- import { z as z19 } from "zod";
267
- var createBlockParagrah = writeOperation3("createBlockParagraph", z19.object({
268
- parentRef: z19.union([PostRefSchema, BlockRowRefSchema]),
269
- content: z19.string().optional()
280
+ import { z as z20 } from "zod";
281
+ var createBlockParagrah = writeOperation3("createBlockParagraph", z20.object({
282
+ parentRef: z20.union([PostRefSchema, BlockRowRefSchema]),
283
+ content: z20.string().optional()
270
284
  }).strict(), (txn) => {
271
285
  const ref = txn.createRef("BlockParagraph");
272
286
  const { parentRef, content } = txn.payload;
@@ -278,16 +292,16 @@ var createBlockParagrah = writeOperation3("createBlockParagraph", z19.object({
278
292
  })), Query3((block, updatedParent) => ({ block, updatedParent })));
279
293
  }, {
280
294
  changeSetOnly: true,
281
- outputSchema: z19.object({
282
- block: z19.any(),
283
- updatedParent: z19.any()
295
+ outputSchema: z20.object({
296
+ block: z20.any(),
297
+ updatedParent: z20.any()
284
298
  })
285
299
  });
286
300
 
287
301
  // src/operations/createBlockRow.ts
288
302
  import { Query as Query4, QueryChain as QueryChain3, writeOperation as writeOperation4 } from "roc-db";
289
- import { z as z20 } from "zod";
290
- var createBlockRow = writeOperation4("createBlockRow", z20.object({ parentRef: z20.union([PostRefSchema, BlockRowRefSchema]) }).strict(), (txn) => {
303
+ import { z as z21 } from "zod";
304
+ var createBlockRow = writeOperation4("createBlockRow", z21.object({ parentRef: z21.union([PostRefSchema, BlockRowRefSchema]) }).strict(), (txn) => {
291
305
  const ref = txn.createRef("BlockRow");
292
306
  const { parentRef } = txn.payload;
293
307
  return QueryChain3(Query4(() => txn.readEntity(parentRef)), Query4((parent) => {
@@ -300,16 +314,16 @@ var createBlockRow = writeOperation4("createBlockRow", z20.object({ parentRef: z
300
314
  })), Query4((block, updatedParent) => ({ block, updatedParent })));
301
315
  }, {
302
316
  changeSetOnly: true,
303
- outputSchema: z20.object({
304
- block: z20.any(),
305
- updatedParent: z20.any()
317
+ outputSchema: z21.object({
318
+ block: z21.any(),
319
+ updatedParent: z21.any()
306
320
  })
307
321
  });
308
322
 
309
323
  // src/operations/createBlockTitle.ts
310
324
  import { Query as Query5, writeOperation as writeOperation5 } from "roc-db";
311
- import { z as z21 } from "zod";
312
- var PayloadSchema = z21.object({ parentRef: z21.union([PostRefSchema, BlockRowRefSchema]) }).strict();
325
+ import { z as z22 } from "zod";
326
+ var PayloadSchema = z22.object({ parentRef: z22.union([PostRefSchema, BlockRowRefSchema]) }).strict();
313
327
  var createBlockTitle = writeOperation5("createBlockTitle", PayloadSchema, (txn) => {
314
328
  const ref = txn.createRef("BlockTitle");
315
329
  const { postRef } = txn.payload;
@@ -318,8 +332,8 @@ var createBlockTitle = writeOperation5("createBlockTitle", PayloadSchema, (txn)
318
332
 
319
333
  // src/operations/createDraft.ts
320
334
  import { Query as Query6, writeOperation as writeOperation6 } from "roc-db";
321
- import { z as z22 } from "zod";
322
- var createDraft = writeOperation6("createDraft", z22.object({ postRef: PostRefSchema }).strict(), (txn) => {
335
+ import { z as z23 } from "zod";
336
+ var createDraft = writeOperation6("createDraft", z23.object({ postRef: PostRefSchema }).strict(), (txn) => {
323
337
  const ref = txn.createRef("Draft");
324
338
  const { postRef } = txn.payload;
325
339
  return Query6(() => txn.createEntity(ref, {
@@ -329,47 +343,69 @@ var createDraft = writeOperation6("createDraft", z22.object({ postRef: PostRefSc
329
343
  }));
330
344
  }, { outputSchema: DraftSchema });
331
345
 
332
- // src/operations/createPost.ts
346
+ // src/operations/createOrgSettings.ts
333
347
  import { Query as Query7, writeOperation as writeOperation7 } from "roc-db";
334
- import { z as z23 } from "zod";
335
- var PayloadSchema2 = z23.object({
336
- title: z23.string(),
337
- slug: z23.string().optional(),
338
- tags: z23.array(z23.string()).default([])
348
+ import { z as z24 } from "zod";
349
+ var createOrgSettings = writeOperation7("createOrgSettings", z24.object({
350
+ name: z24.string(),
351
+ theme: z24.string().optional(),
352
+ primaryAdmin: UserRefSchema.optional()
353
+ }), (txn) => {
354
+ const ref = txn.createRef("OrgSettings");
355
+ const { name, theme, primaryAdmin } = txn.payload;
356
+ return Query7(() => txn.createEntity(ref, {
357
+ data: { name, theme },
358
+ parents: { primaryAdmin },
359
+ children: { featuredPosts: [] }
360
+ }));
361
+ });
362
+
363
+ // src/operations/createPost.ts
364
+ import { Query as Query8, writeOperation as writeOperation8 } from "roc-db";
365
+ import { z as z25 } from "zod";
366
+ var PayloadSchema2 = z25.object({
367
+ title: z25.string(),
368
+ slug: z25.string().optional(),
369
+ tags: z25.array(z25.string()).default([])
339
370
  }).strict();
340
- var createPost = writeOperation7("createPost", PayloadSchema2, (txn) => {
371
+ var createPost = writeOperation8("createPost", PayloadSchema2, (txn) => {
341
372
  const ref = txn.createRef("Post");
342
373
  const { title, slug, tags } = txn.payload;
343
- return Query7(() => txn.createEntity(ref, {
374
+ return Query8(() => txn.createEntity(ref, {
344
375
  data: { title, tags, slug },
345
376
  children: { blocks: [] }
346
377
  }));
347
378
  });
348
379
 
380
+ // src/operations/createUnknownRef.ts
381
+ import { Query as Query9, writeOperation as writeOperation9 } from "roc-db";
382
+ import { z as z26 } from "zod";
383
+ var createUnknownRef = writeOperation9("createUnknownRef", z26.object({}).optional(), (txn) => Query9(() => txn.createRef("NotARegisteredEntity")));
384
+
349
385
  // src/operations/createUser.ts
350
- import { Query as Query8, writeOperation as writeOperation8 } from "roc-db";
351
- import { z as z24 } from "zod";
352
- var createUser = writeOperation8("createUser", z24.object({ email: z24.string() }), (txn) => {
386
+ import { Query as Query10, writeOperation as writeOperation10 } from "roc-db";
387
+ import { z as z27 } from "zod";
388
+ var createUser = writeOperation10("createUser", z27.object({ email: z27.string() }), (txn) => {
353
389
  const ref = txn.createRef("User");
354
390
  const { email } = txn.payload;
355
- return Query8(() => txn.createEntity(ref, { data: { email } }));
391
+ return Query10(() => txn.createEntity(ref, { data: { email } }));
356
392
  });
357
393
 
358
394
  // src/operations/deleteBlocks.ts
359
- import { Query as Query9, QueryChain as QueryChain4, writeOperation as writeOperation9 } from "roc-db";
360
- import { z as z25 } from "zod";
395
+ import { Query as Query11, QueryChain as QueryChain4, writeOperation as writeOperation11 } from "roc-db";
396
+ import { z as z28 } from "zod";
361
397
  var DeleteBlockQuery = (txn, blockRef) => {
362
- return QueryChain4(Query9(() => txn.readEntity(blockRef)), Query9((block) => {
398
+ return QueryChain4(Query11(() => txn.readEntity(blockRef)), Query11((block) => {
363
399
  return txn.readEntity(block.parents.parent, true);
364
- }), Query9((post) => {
400
+ }), Query11((post) => {
365
401
  return txn.patchEntity(post.ref, {
366
402
  children: {
367
403
  blocks: post.children.blocks.filter((ref) => ref !== blockRef)
368
404
  }
369
405
  });
370
- }), Query9(() => txn.deleteEntity(blockRef)));
406
+ }), Query11(() => txn.deleteEntity(blockRef)));
371
407
  };
372
- var deleteBlocks = writeOperation9("deleteBlocks", z25.array(z25.union([
408
+ var deleteBlocks = writeOperation11("deleteBlocks", z28.array(z28.union([
373
409
  BlockParagraphRefSchema,
374
410
  BlockImageRefSchema,
375
411
  BlockRowRefSchema
@@ -379,42 +415,47 @@ var deleteBlocks = writeOperation9("deleteBlocks", z25.array(z25.union([
379
415
  }, { changeSetOnly: true });
380
416
 
381
417
  // src/operations/deleteDraft.ts
382
- import { Query as Query10, QueryChain as QueryChain5, writeOperation as writeOperation10 } from "roc-db";
383
- var deleteDraft = writeOperation10("deleteDraft", DraftRefSchema, (txn) => {
418
+ import { Query as Query12, QueryChain as QueryChain5, writeOperation as writeOperation12 } from "roc-db";
419
+ var deleteDraft = writeOperation12("deleteDraft", DraftRefSchema, (txn) => {
384
420
  const ref = txn.payload;
385
- return QueryChain5(Query10(() => txn.deleteEntity(ref, true)), Query10(() => txn.deleteChangeSet(ref)));
421
+ return QueryChain5(Query12(() => txn.deleteEntity(ref, true)), Query12(() => txn.deleteChangeSet(ref)));
386
422
  });
387
423
 
424
+ // src/operations/deleteOrgSettings.ts
425
+ import { Query as Query13, writeOperation as writeOperation13 } from "roc-db";
426
+ import { z as z29 } from "zod";
427
+ var deleteOrgSettings = writeOperation13("deleteOrgSettings", z29.object({}).optional(), (txn) => Query13(() => txn.deleteEntity("OrgSettings")));
428
+
388
429
  // src/operations/deletePost.ts
389
- import { Query as Query11, writeOperation as writeOperation11 } from "roc-db";
390
- var deletePost = writeOperation11("deletePost", PostRefSchema, (txn) => {
430
+ import { Query as Query14, writeOperation as writeOperation14 } from "roc-db";
431
+ var deletePost = writeOperation14("deletePost", PostRefSchema, (txn) => {
391
432
  const ref = txn.payload;
392
- return Query11(() => txn.deleteEntity(ref, true));
433
+ return Query14(() => txn.deleteEntity(ref, true));
393
434
  });
394
435
 
395
436
  // src/operations/moveBlocks.ts
396
- import { Query as Query12, QueryChain as QueryChain6, writeOperation as writeOperation12 } from "roc-db";
397
- import { z as z26 } from "zod";
398
- var PayloadSchema3 = z26.object({
399
- refs: z26.array(z26.union([BlockParagraphRefSchema, BlockRowRefSchema])),
400
- targetPosition: z26.number().min(0)
437
+ import { Query as Query15, QueryChain as QueryChain6, writeOperation as writeOperation15 } from "roc-db";
438
+ import { z as z30 } from "zod";
439
+ var PayloadSchema3 = z30.object({
440
+ refs: z30.array(z30.union([BlockParagraphRefSchema, BlockRowRefSchema])),
441
+ targetPosition: z30.number().min(0)
401
442
  }).strict();
402
- var moveBlocks = writeOperation12("moveBlocks", PayloadSchema3, (txn) => {
443
+ var moveBlocks = writeOperation15("moveBlocks", PayloadSchema3, (txn) => {
403
444
  const { refs } = txn.payload;
404
- return QueryChain6(Query12(() => txn.batchReadEntities(refs)), Query12((items) => {
445
+ return QueryChain6(Query15(() => txn.batchReadEntities(refs)), Query15((items) => {
405
446
  return "todo";
406
447
  }));
407
448
  });
408
449
 
409
450
  // src/operations/pageBlocks.ts
410
- import { Query as Query13, readOperation } from "roc-db";
411
- import { z as z27 } from "zod";
412
- var pageBlocks = readOperation("pageBlocks", z27.object({
413
- size: z27.number().default(100),
414
- parentRef: z27.string().optional()
451
+ import { Query as Query16, readOperation } from "roc-db";
452
+ import { z as z31 } from "zod";
453
+ var pageBlocks = readOperation("pageBlocks", z31.object({
454
+ size: z31.number().default(100),
455
+ parentRef: z31.string().optional()
415
456
  }), (txn) => {
416
457
  const { size, parentRef } = txn.payload;
417
- return Query13(() => txn.pageEntities({
458
+ return Query16(() => txn.pageEntities({
418
459
  entities: ["BlockImage", "BlockParagraph"],
419
460
  size,
420
461
  childrenOf: parentRef ? [parentRef] : []
@@ -422,50 +463,50 @@ var pageBlocks = readOperation("pageBlocks", z27.object({
422
463
  });
423
464
 
424
465
  // src/operations/pageEmptyEntitiesArray.ts
425
- import { Query as Query14, readOperation as readOperation2 } from "roc-db";
426
- import { z as z28 } from "zod";
427
- var pageEmptyEntitiesArray = readOperation2("pageEmptyEntitiesArray", z28.object({ size: z28.number().default(100) }), (txn) => {
466
+ import { Query as Query17, readOperation as readOperation2 } from "roc-db";
467
+ import { z as z32 } from "zod";
468
+ var pageEmptyEntitiesArray = readOperation2("pageEmptyEntitiesArray", z32.object({ size: z32.number().default(100) }), (txn) => {
428
469
  const { size } = txn.payload;
429
- return Query14(() => txn.pageEntities({ entities: [], size }));
470
+ return Query17(() => txn.pageEntities({ entities: [], size }));
430
471
  });
431
472
 
432
473
  // src/operations/pagePosts.ts
433
- import { Query as Query15, readOperation as readOperation3 } from "roc-db";
434
- import { z as z29 } from "zod";
435
- var pagePosts = readOperation3("pagePosts", z29.object({ size: z29.number().default(100) }).default({}), (txn) => {
474
+ import { Query as Query18, readOperation as readOperation3 } from "roc-db";
475
+ import { z as z33 } from "zod";
476
+ var pagePosts = readOperation3("pagePosts", z33.object({ size: z33.number().default(100) }).default({}), (txn) => {
436
477
  const { size } = txn.payload;
437
- return Query15(() => txn.pageEntities({ entities: ["Post"], size }));
478
+ return Query18(() => txn.pageEntities({ entities: ["Post"], size }));
438
479
  });
439
480
 
440
481
  // src/operations/pageSplat.ts
441
- import { Query as Query16, readOperation as readOperation4 } from "roc-db";
442
- import { z as z30 } from "zod";
443
- var pageSplat = readOperation4("pageSplat", z30.object({ size: z30.number().default(100) }), (txn) => {
482
+ import { Query as Query19, readOperation as readOperation4 } from "roc-db";
483
+ import { z as z34 } from "zod";
484
+ var pageSplat = readOperation4("pageSplat", z34.object({ size: z34.number().default(100) }), (txn) => {
444
485
  const { size } = txn.payload;
445
- return Query16(() => txn.pageEntities({ entities: "*", size }));
486
+ return Query19(() => txn.pageEntities({ entities: "*", size }));
446
487
  });
447
488
 
448
489
  // src/operations/pagePostsByTag.ts
449
- import { Query as Query17, readOperation as readOperation5 } from "roc-db";
450
- import { z as z31 } from "zod";
451
- var pagePostsByTag = readOperation5("pagePostsByTag", z31.string(), (txn) => {
490
+ import { Query as Query20, readOperation as readOperation5 } from "roc-db";
491
+ import { z as z35 } from "zod";
492
+ var pagePostsByTag = readOperation5("pagePostsByTag", z35.string(), (txn) => {
452
493
  const tag = txn.payload;
453
- return Query17(() => txn.pageEntitiesByIndex("Post", "tags", tag));
494
+ return Query20(() => txn.pageEntitiesByIndex("Post", "tags", tag));
454
495
  });
455
496
 
456
497
  // src/operations/readEntity.ts
457
- import { NotFoundError, Query as Query18, QueryChain as QueryChain7, readOperation as readOperation6 } from "roc-db";
458
- import { z as z32 } from "zod";
459
- var readEntity = readOperation6("readEntity", z32.string(), (txn) => {
498
+ import { NotFoundError, Query as Query21, QueryChain as QueryChain7, readOperation as readOperation6 } from "roc-db";
499
+ import { z as z36 } from "zod";
500
+ var readEntity = readOperation6("readEntity", z36.string(), (txn) => {
460
501
  const ref = txn.payload;
461
- return QueryChain7(Query18(() => txn.readEntity(ref)), Query18((entity) => {
502
+ return QueryChain7(Query21(() => txn.readEntity(ref)), Query21((entity) => {
462
503
  if (!entity) {
463
504
  throw new NotFoundError(ref);
464
505
  }
465
506
  return entity;
466
507
  }));
467
508
  }, {
468
- outputSchema: z32.union([
509
+ outputSchema: z36.union([
469
510
  PostSchema,
470
511
  BlockImageSchema,
471
512
  BlockParagraphSchema
@@ -473,11 +514,11 @@ var readEntity = readOperation6("readEntity", z32.string(), (txn) => {
473
514
  });
474
515
 
475
516
  // src/operations/readMutation.ts
476
- import { NotFoundError as NotFoundError2, Query as Query19, QueryChain as QueryChain8, readOperation as readOperation7 } from "roc-db";
477
- import { z as z33 } from "zod";
478
- var readMutation = readOperation7("readMutation", z33.string(), (txn) => {
517
+ import { NotFoundError as NotFoundError2, Query as Query22, QueryChain as QueryChain8, readOperation as readOperation7 } from "roc-db";
518
+ import { z as z37 } from "zod";
519
+ var readMutation = readOperation7("readMutation", z37.string(), (txn) => {
479
520
  const ref = txn.payload;
480
- return QueryChain8(Query19(() => txn.readMutation(ref)), Query19((entity) => {
521
+ return QueryChain8(Query22(() => txn.readMutation(ref)), Query22((entity) => {
481
522
  if (!entity) {
482
523
  throw new NotFoundError2(ref);
483
524
  }
@@ -485,53 +526,58 @@ var readMutation = readOperation7("readMutation", z33.string(), (txn) => {
485
526
  }));
486
527
  });
487
528
 
529
+ // src/operations/readOrgSettings.ts
530
+ import { Query as Query23, readOperation as readOperation8 } from "roc-db";
531
+ import { z as z38 } from "zod";
532
+ var readOrgSettings = readOperation8("readOrgSettings", z38.object({}).optional(), (txn) => Query23(() => txn.readEntity("OrgSettings", true)));
533
+
488
534
  // src/operations/readPost.ts
489
- import { Query as Query20, readOperation as readOperation8 } from "roc-db";
490
- var readPost = readOperation8("readPost", PostRefSchema, (txn) => {
535
+ import { Query as Query24, readOperation as readOperation9 } from "roc-db";
536
+ var readPost = readOperation9("readPost", PostRefSchema, (txn) => {
491
537
  const ref = txn.payload;
492
- return Query20(() => txn.readEntity(ref, true));
538
+ return Query24(() => txn.readEntity(ref, true));
493
539
  }, { outputSchema: PostSchema });
494
540
 
495
541
  // src/operations/readPostBySlug.ts
496
- import { Query as Query21, readOperation as readOperation9 } from "roc-db";
497
- import { z as z34 } from "zod";
498
- var readPostBySlug = readOperation9("readPostBySlug", z34.string(), (txn) => {
542
+ import { Query as Query25, readOperation as readOperation10 } from "roc-db";
543
+ import { z as z39 } from "zod";
544
+ var readPostBySlug = readOperation10("readPostBySlug", z39.string(), (txn) => {
499
545
  const slug = txn.payload;
500
- return Query21(() => txn.readEntityByUniqueField("Post", "slug", slug));
546
+ return Query25(() => txn.readEntityByUniqueField("Post", "slug", slug));
501
547
  }, { outputSchema: PostSchema });
502
548
 
503
549
  // src/operations/testTransactionalEdits.ts
504
550
  import { expect } from "bun:test";
505
- import { Query as Query22, QueryChain as QueryChain9, writeOperation as writeOperation13 } from "roc-db";
506
- import { z as z35 } from "zod";
551
+ import { Query as Query26, QueryChain as QueryChain9, writeOperation as writeOperation16 } from "roc-db";
552
+ import { z as z40 } from "zod";
507
553
  var TestCreatePatchDeleteInSameTransaction = (txn, title) => {
508
554
  const postRef = txn.createRef("Post");
509
- return QueryChain9(Query22(() => txn.createEntity(postRef, {
555
+ return QueryChain9(Query26(() => txn.createEntity(postRef, {
510
556
  data: { title, tags: [] },
511
557
  children: { blocks: [] }
512
- })), Query22(() => txn.patchEntity(postRef, { data: { foo: "bar" } })), Query22((post) => {
558
+ })), Query26(() => txn.patchEntity(postRef, { data: { foo: "bar" } })), Query26((post) => {
513
559
  expect(post.data.title).toBe(title);
514
560
  expect(post.data.foo).toBe("bar");
515
- }), Query22(() => txn.patchEntity(postRef, { data: { foo: null, bar: "foo" } })), Query22((post) => {
561
+ }), Query26(() => txn.patchEntity(postRef, { data: { foo: null, bar: "foo" } })), Query26((post) => {
516
562
  expect(post.data.title).toBe(title);
517
563
  expect(post.data.foo).toBeUndefined();
518
564
  expect(post.data.bar).toBe("foo");
519
565
  expect(txn.log).toHaveLength(1);
520
566
  expect(txn.log.get(postRef)[0]).toBe("create");
521
- }), Query22((post) => txn.deleteEntity(postRef)), Query22((res) => {
567
+ }), Query26((post) => txn.deleteEntity(postRef)), Query26((res) => {
522
568
  expect(res).toBe(1);
523
569
  expect(txn.log).toHaveLength(0);
524
570
  }));
525
571
  };
526
572
  var TestUpdateAndDeleteInSameTransaction = (txn, ref) => {
527
- return QueryChain9(Query22(() => txn.patchEntity(ref, { data: { foo: "bar" } })), Query22((post) => {
573
+ return QueryChain9(Query26(() => txn.patchEntity(ref, { data: { foo: "bar" } })), Query26((post) => {
528
574
  expect(post.data.foo).toBe("bar");
529
- }), Query22(() => txn.patchEntity(ref, { data: { foo: null, bar: "foo" } })), Query22((post) => {
575
+ }), Query26(() => txn.patchEntity(ref, { data: { foo: null, bar: "foo" } })), Query26((post) => {
530
576
  expect(post.data.foo).toBeUndefined();
531
577
  expect(post.data.bar).toBe("foo");
532
578
  expect(txn.log).toHaveLength(1);
533
579
  expect(txn.log.get(ref)[0]).toBe("update");
534
- }), Query22((post) => txn.deleteEntity(ref)), Query22((res) => {
580
+ }), Query26((post) => txn.deleteEntity(ref)), Query26((res) => {
535
581
  expect(res).toBe(1);
536
582
  expect(txn.log).toHaveLength(1);
537
583
  expect(txn.log.get(ref)[0]).toBe("delete");
@@ -539,14 +585,14 @@ var TestUpdateAndDeleteInSameTransaction = (txn, ref) => {
539
585
  };
540
586
  var TestCreateOnExistingRef = (txn) => {
541
587
  const ref = txn.createRef("Post");
542
- return QueryChain9(Query22(() => txn.createEntity(ref, { data: { foo: "bar" } })), Query22(() => txn.createEntity(ref, { data: { foo: "bar" } })));
588
+ return QueryChain9(Query26(() => txn.createEntity(ref, { data: { foo: "bar" } })), Query26(() => txn.createEntity(ref, { data: { foo: "bar" } })));
543
589
  };
544
- var PayloadSchema4 = z35.object({
545
- name: z35.string().optional(),
590
+ var PayloadSchema4 = z40.object({
591
+ name: z40.string().optional(),
546
592
  post1ref: PostRefSchema.optional(),
547
593
  post2ref: PostRefSchema.optional()
548
594
  }).strict();
549
- var testTransactionalEdits = writeOperation13("testTransactionalEdits", PayloadSchema4, (txn) => {
595
+ var testTransactionalEdits = writeOperation16("testTransactionalEdits", PayloadSchema4, (txn) => {
550
596
  const { name, post1ref, post2ref } = txn.payload;
551
597
  if (name)
552
598
  return TestCreatePatchDeleteInSameTransaction(txn, name);
@@ -557,30 +603,38 @@ var testTransactionalEdits = writeOperation13("testTransactionalEdits", PayloadS
557
603
  }, {});
558
604
 
559
605
  // src/operations/updateBlockParagraph.ts
560
- import { Query as Query23, writeOperation as writeOperation14 } from "roc-db";
561
- import { z as z36 } from "zod";
562
- var updateBlockParagraph = writeOperation14("updateBlockParagraph", z36.object({
606
+ import { Query as Query27, writeOperation as writeOperation17 } from "roc-db";
607
+ import { z as z41 } from "zod";
608
+ var updateBlockParagraph = writeOperation17("updateBlockParagraph", z41.object({
563
609
  ref: BlockParagraphRefSchema,
564
- content: z36.string()
610
+ content: z41.string()
565
611
  }), (txn) => {
566
612
  const { ref, content } = txn.payload;
567
- return Query23(() => txn.patchEntity(ref, {
613
+ return Query27(() => txn.patchEntity(ref, {
568
614
  data: { content }
569
615
  }));
570
616
  }, { outputSchema: BlockParagraphSchema });
571
617
 
618
+ // src/operations/updateOrgSettingsName.ts
619
+ import { Query as Query28, writeOperation as writeOperation18 } from "roc-db";
620
+ import { z as z42 } from "zod";
621
+ var updateOrgSettingsName = writeOperation18("updateOrgSettingsName", z42.object({ name: z42.string() }), (txn) => {
622
+ const { name } = txn.payload;
623
+ return Query28(() => txn.patchEntity("OrgSettings", { data: { name } }));
624
+ }, { debounce: 10 });
625
+
572
626
  // src/operations/updatePost.ts
573
- import { Query as Query24, writeOperation as writeOperation15 } from "roc-db";
574
- import { z as z37 } from "zod";
575
- var PayloadSchema5 = z37.object({
627
+ import { Query as Query29, writeOperation as writeOperation19 } from "roc-db";
628
+ import { z as z43 } from "zod";
629
+ var PayloadSchema5 = z43.object({
576
630
  ref: PostRefSchema,
577
- title: z37.string().optional(),
578
- tags: z37.array(z37.string()).optional().default([]),
631
+ title: z43.string().optional(),
632
+ tags: z43.array(z43.string()).optional().default([]),
579
633
  authorRef: UserRefSchema.optional()
580
634
  });
581
- var updatePost = writeOperation15("updatePost", PayloadSchema5, (txn) => {
635
+ var updatePost = writeOperation19("updatePost", PayloadSchema5, (txn) => {
582
636
  const { ref, authorRef, ...data } = txn.payload;
583
- return Query24(() => txn.updateEntity(ref, {
637
+ return Query29(() => txn.updateEntity(ref, {
584
638
  data,
585
639
  parents: { author: authorRef },
586
640
  children: { blocks: [] }
@@ -588,43 +642,43 @@ var updatePost = writeOperation15("updatePost", PayloadSchema5, (txn) => {
588
642
  }, { outputSchema: PostSchema });
589
643
 
590
644
  // src/operations/updatePostDescription.ts
591
- import { Query as Query25, writeOperation as writeOperation16 } from "roc-db";
592
- import { z as z38 } from "zod";
593
- var updatePostDescription = writeOperation16("updatePostDescription", z38.object({ ref: PostRefSchema, description: z38.string() }), (txn) => {
645
+ import { Query as Query30, writeOperation as writeOperation20 } from "roc-db";
646
+ import { z as z44 } from "zod";
647
+ var updatePostDescription = writeOperation20("updatePostDescription", z44.object({ ref: PostRefSchema, description: z44.string() }), (txn) => {
594
648
  const { ref, description } = txn.payload;
595
- return Query25(() => txn.patchEntity(ref, { data: { description } }));
649
+ return Query30(() => txn.patchEntity(ref, { data: { description } }));
596
650
  }, { debounce: 10, changeSetOnly: true, outputSchema: PostSchema });
597
651
 
598
652
  // src/operations/updatePostSlug.ts
599
- import { Query as Query26, writeOperation as writeOperation17 } from "roc-db";
600
- import { z as z39 } from "zod";
601
- var updatePostSlug = writeOperation17("updatePostSlug", z39.object({ ref: PostRefSchema, slug: z39.string() }), (txn) => {
653
+ import { Query as Query31, writeOperation as writeOperation21 } from "roc-db";
654
+ import { z as z45 } from "zod";
655
+ var updatePostSlug = writeOperation21("updatePostSlug", z45.object({ ref: PostRefSchema, slug: z45.string() }), (txn) => {
602
656
  const { ref, slug } = txn.payload;
603
- return Query26(() => txn.patchEntity(ref, { data: { slug } }));
657
+ return Query31(() => txn.patchEntity(ref, { data: { slug } }));
604
658
  }, { debounce: 10, outputSchema: PostSchema });
605
659
 
606
660
  // src/operations/updatePostTags.ts
607
- import { Query as Query27, writeOperation as writeOperation18 } from "roc-db";
608
- import { z as z40 } from "zod";
609
- var updatePostTags = writeOperation18("updatePostTags", z40.object({ ref: PostRefSchema, tags: z40.array(z40.string()) }), (txn) => {
661
+ import { Query as Query32, writeOperation as writeOperation22 } from "roc-db";
662
+ import { z as z46 } from "zod";
663
+ var updatePostTags = writeOperation22("updatePostTags", z46.object({ ref: PostRefSchema, tags: z46.array(z46.string()) }), (txn) => {
610
664
  const { ref, tags } = txn.payload;
611
- return Query27(() => txn.patchEntity(ref, { data: { tags } }));
665
+ return Query32(() => txn.patchEntity(ref, { data: { tags } }));
612
666
  }, { debounce: 10, outputSchema: PostSchema });
613
667
 
614
668
  // src/operations/updatePostTitle.ts
615
- import { Query as Query28, writeOperation as writeOperation19 } from "roc-db";
616
- import { z as z41 } from "zod";
617
- var updatePostTitle = writeOperation19("updatePostTitle", z41.object({ ref: PostRefSchema, title: z41.string() }), (txn) => {
669
+ import { Query as Query33, writeOperation as writeOperation23 } from "roc-db";
670
+ import { z as z47 } from "zod";
671
+ var updatePostTitle = writeOperation23("updatePostTitle", z47.object({ ref: PostRefSchema, title: z47.string() }), (txn) => {
618
672
  const { ref, title } = txn.payload;
619
- return Query28(() => txn.patchEntity(ref, { data: { title } }));
673
+ return Query33(() => txn.patchEntity(ref, { data: { title } }));
620
674
  }, { debounce: 10, outputSchema: PostSchema });
621
675
 
622
676
  // src/operations/crudBySlug.ts
623
- import { Query as Query29, QueryChain as QueryChain10, writeOperation as writeOperation20 } from "roc-db";
624
- import { z as z42 } from "zod";
625
- var crudBySlug = writeOperation20("crudBySlug", z42.object({ slug: z42.string(), newSlug: z42.string() }), (txn) => {
677
+ import { Query as Query34, QueryChain as QueryChain10, writeOperation as writeOperation24 } from "roc-db";
678
+ import { z as z48 } from "zod";
679
+ var crudBySlug = writeOperation24("crudBySlug", z48.object({ slug: z48.string(), newSlug: z48.string() }), (txn) => {
626
680
  const { slug, newSlug } = txn.payload;
627
- return QueryChain10(Query29(() => txn.readEntityByUniqueField("Post", "slug", slug)), Query29((post) => txn.patchEntity(post.ref, { data: { slug: newSlug } })), Query29(() => txn.readEntityByUniqueField("Post", "slug", newSlug)), Query29((post) => txn.deleteEntity(post.ref)), Query29(() => {
681
+ return QueryChain10(Query34(() => txn.readEntityByUniqueField("Post", "slug", slug)), Query34((post) => txn.patchEntity(post.ref, { data: { slug: newSlug } })), Query34(() => txn.readEntityByUniqueField("Post", "slug", newSlug)), Query34((post) => txn.deleteEntity(post.ref)), Query34(() => {
628
682
  return [
629
683
  txn.readEntityByUniqueField("Post", "slug", slug, false),
630
684
  txn.readEntityByUniqueField("Post", "slug", newSlug, false)
@@ -640,11 +694,14 @@ var operations = [
640
694
  createBlockParagrah,
641
695
  createBlockRow,
642
696
  createDraft,
697
+ createOrgSettings,
643
698
  createPost,
699
+ createUnknownRef,
644
700
  createUser,
645
701
  crudBySlug,
646
702
  deleteBlocks,
647
703
  deleteDraft,
704
+ deleteOrgSettings,
648
705
  deletePost,
649
706
  readPostBySlug,
650
707
  moveBlocks,
@@ -652,12 +709,14 @@ var operations = [
652
709
  pageBlocks,
653
710
  readEntity,
654
711
  readMutation,
712
+ readOrgSettings,
655
713
  readPost,
656
714
  pageEmptyEntitiesArray,
657
715
  pagePosts,
658
716
  pageSplat,
659
717
  testTransactionalEdits,
660
718
  updateBlockParagraph,
719
+ updateOrgSettingsName,
661
720
  updatePost,
662
721
  updatePostDescription,
663
722
  updatePostSlug,
@@ -669,9 +728,11 @@ import { beforeAll, describe, expect as expect2, test } from "bun:test";
669
728
  import {
670
729
  BadRequestError,
671
730
  ConflictError,
731
+ Entity as Entity9,
672
732
  NotFoundError as NotFoundError3,
673
733
  Snowflake
674
734
  } from "roc-db";
735
+ import { z as z49 } from "zod";
675
736
  import { faker } from "@faker-js/faker";
676
737
  var snowflake = new Snowflake(10, 10);
677
738
  var prepareChangeSetTest = async (adapter, adapter2) => {
@@ -720,14 +781,18 @@ var prepareChangeSetTest = async (adapter, adapter2) => {
720
781
  };
721
782
  };
722
783
  var testAdapterImplementation = async (adapterConstructor, generateArgs) => {
723
- let createAdapter = async ({ optimistic = false } = {}) => {
784
+ let createAdapter = async ({
785
+ optimistic = false,
786
+ session = { identityRef: "User/42" },
787
+ engineArgs
788
+ } = {}) => {
724
789
  return adapterConstructor({
725
790
  operations,
726
791
  entities,
727
- session: { identityRef: "User/42" },
792
+ session,
728
793
  snowflake,
729
794
  optimistic,
730
- ...await generateArgs()
795
+ ...engineArgs ?? await generateArgs()
731
796
  });
732
797
  };
733
798
  let adapter1, adapter2;
@@ -918,6 +983,87 @@ var testAdapterImplementation = async (adapterConstructor, generateArgs) => {
918
983
  })).toThrow(BadRequestError);
919
984
  });
920
985
  });
986
+ describe("OrgSettings singleton", () => {
987
+ let adapter;
988
+ beforeAll(async () => {
989
+ adapter = await createAdapter();
990
+ });
991
+ test("create returns bare-name ref", async () => {
992
+ const [orgSettings] = await adapter.createOrgSettings({
993
+ name: "Acme",
994
+ theme: "dark",
995
+ primaryAdmin: "User/42"
996
+ });
997
+ expect2(orgSettings.ref).toBe("OrgSettings");
998
+ expect2(orgSettings.entity).toBe("OrgSettings");
999
+ expect2(orgSettings.data.name).toBe("Acme");
1000
+ expect2(orgSettings.parents.primaryAdmin).toBe("User/42");
1001
+ expect2(orgSettings.children.featuredPosts).toStrictEqual([]);
1002
+ });
1003
+ test("read by bare-name ref", async () => {
1004
+ const orgSettings = await adapter.readOrgSettings();
1005
+ expect2(orgSettings.ref).toBe("OrgSettings");
1006
+ expect2(orgSettings.data.name).toBe("Acme");
1007
+ });
1008
+ test("second create throws ConflictError", async () => {
1009
+ expect2(() => adapter.createOrgSettings({ name: "Other" })).toThrow(ConflictError);
1010
+ });
1011
+ test("patch + debounce collapses mutations", async () => {
1012
+ const [, mutation1] = await adapter.updateOrgSettingsName({
1013
+ name: "Acme Co"
1014
+ });
1015
+ const [updated, mutation2] = await adapter.updateOrgSettingsName({
1016
+ name: "Acme Inc"
1017
+ });
1018
+ expect2(updated.data.name).toBe("Acme Inc");
1019
+ expect2(mutation1.ref).toBe(mutation2.ref);
1020
+ expect2(mutation2.debounceCount).toBeGreaterThanOrEqual(1);
1021
+ });
1022
+ test("debounce does not collapse across identities", async () => {
1023
+ const sharedEngineArgs = await generateArgs();
1024
+ const adapterA = await createAdapter({
1025
+ session: { identityRef: "User/A" },
1026
+ engineArgs: sharedEngineArgs
1027
+ });
1028
+ const adapterB = await createAdapter({
1029
+ session: { identityRef: "User/B" },
1030
+ engineArgs: sharedEngineArgs
1031
+ });
1032
+ await adapterA.createOrgSettings({ name: "Acme" });
1033
+ const [, mutationA] = await adapterA.updateOrgSettingsName({
1034
+ name: "From A"
1035
+ });
1036
+ const [, mutationB] = await adapterB.updateOrgSettingsName({
1037
+ name: "From B"
1038
+ });
1039
+ expect2(mutationA.ref).not.toBe(mutationB.ref);
1040
+ expect2(mutationA.identityRef).toBe("User/A");
1041
+ expect2(mutationB.identityRef).toBe("User/B");
1042
+ await adapterA.deleteOrgSettings();
1043
+ });
1044
+ test("delete removes the singleton", async () => {
1045
+ const [count] = await adapter.deleteOrgSettings();
1046
+ expect2(count).toBe(1);
1047
+ expect2(() => adapter.readOrgSettings()).toThrow(NotFoundError3);
1048
+ });
1049
+ test("recreate after delete works", async () => {
1050
+ const [orgSettings] = await adapter.createOrgSettings({
1051
+ name: "NewOrg"
1052
+ });
1053
+ expect2(orgSettings.ref).toBe("OrgSettings");
1054
+ expect2(orgSettings.data.name).toBe("NewOrg");
1055
+ });
1056
+ test("constructor rejects singleton + uniqueDataKeys", () => {
1057
+ expect2(() => new Entity9("Bad", {
1058
+ singleton: true,
1059
+ data: z49.object({ name: z49.string() }),
1060
+ uniqueDataKeys: ["name"]
1061
+ })).toThrow(/singleton/);
1062
+ });
1063
+ test("createRef throws on unregistered entity", async () => {
1064
+ expect2(() => adapter.createUnknownRef()).toThrow(BadRequestError);
1065
+ });
1066
+ });
921
1067
  describe("paging", () => {
922
1068
  let adapter;
923
1069
  let post1ref;
@@ -4,4 +4,4 @@ export declare const BlockImageEntity: Entity<"BlockImage", z.ZodObject<{
4
4
  url: z.ZodString;
5
5
  }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
6
6
  parent: z.ZodTemplateLiteral<`Post/${number}`>;
7
- }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>;
7
+ }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>, false>;
@@ -4,4 +4,4 @@ export declare const BlockParagraph: Entity<"BlockParagraph", z.ZodObject<{
4
4
  content: z.ZodOptional<z.ZodString>;
5
5
  }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
6
6
  parent: z.ZodUnion<readonly [z.ZodType<`Post/${number}`, `Post/${number}`, z.core.$ZodTypeInternals<`Post/${number}`, `Post/${number}`>>, z.ZodUnion<readonly [z.ZodTemplateLiteral<`BlockParagraph/${number}`>, z.ZodTemplateLiteral<`BlockRow/${number}`>]>]>;
7
- }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>;
7
+ }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>, false>;
@@ -4,4 +4,4 @@ export declare const BlockRow: Entity<"BlockRow", z.ZodObject<{}, z.core.$strip>
4
4
  blocks: z.ZodArray<z.ZodUnion<readonly [z.ZodTemplateLiteral<`BlockParagraph/${number}`>, z.ZodTemplateLiteral<`BlockRow/${number}`>]>>;
5
5
  }, z.core.$strip>, z.ZodObject<{
6
6
  parent: z.ZodUnion<readonly [z.ZodType<`Post/${number}`, `Post/${number}`, z.core.$ZodTypeInternals<`Post/${number}`, `Post/${number}`>>, z.ZodUnion<readonly [z.ZodTemplateLiteral<`BlockParagraph/${number}`>, z.ZodTemplateLiteral<`BlockRow/${number}`>]>]>;
7
- }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>;
7
+ }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>, false>;
@@ -4,4 +4,4 @@ export declare const Draft: Entity<"Draft", z.ZodObject<{
4
4
  appliedAt: z.ZodOptional<z.ZodString>;
5
5
  }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
6
6
  post: z.ZodTemplateLiteral<`Post/${number}`>;
7
- }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>;
7
+ }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>, false>;
@@ -0,0 +1,10 @@
1
+ import { Entity } from "roc-db";
2
+ import { z } from "zod";
3
+ export declare const OrgSettingsEntity: Entity<"OrgSettings", z.ZodObject<{
4
+ name: z.ZodString;
5
+ theme: z.ZodOptional<z.ZodString>;
6
+ }, z.core.$strip>, z.ZodObject<{
7
+ featuredPosts: z.ZodArray<z.ZodString>;
8
+ }, z.core.$strip>, z.ZodObject<{
9
+ primaryAdmin: z.ZodOptional<z.ZodTemplateLiteral<`User/${number}`>>;
10
+ }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>, true>;
@@ -9,4 +9,4 @@ export declare const PostEntity: Entity<"Post", z.ZodObject<{
9
9
  blocks: z.ZodArray<z.ZodString>;
10
10
  }, z.core.$strip>, z.ZodObject<{
11
11
  author: z.ZodOptional<z.ZodTemplateLiteral<`User/${number}`>>;
12
- }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>;
12
+ }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>, false>;
@@ -5,4 +5,4 @@ export declare const PostVersion: Entity<"PostVersion", z.ZodObject<{
5
5
  snapshot: z.ZodArray<z.ZodAny>;
6
6
  }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
7
7
  post: z.ZodTemplateLiteral<`Post/${number}`>;
8
- }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>;
8
+ }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>, false>;
@@ -2,4 +2,4 @@ import { Entity } from "roc-db";
2
2
  import { z } from "zod";
3
3
  export declare const UserEntity: Entity<"User", z.ZodObject<{
4
4
  email: z.ZodString;
5
- }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>, z.ZodObject<{}, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>;
5
+ }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>, z.ZodObject<{}, z.core.$strip>, z.ZodObject<{}, z.core.$strip>, false>;
@@ -2,11 +2,11 @@ export declare const entities: (import("roc-db").Entity<"Draft", import("zod").Z
2
2
  appliedAt: import("zod").ZodOptional<import("zod").ZodString>;
3
3
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
4
4
  post: import("zod").ZodTemplateLiteral<`Post/${number}`>;
5
- }, import("zod/v4/core").$strip>, import("zod").ZodObject<{}, import("zod/v4/core").$strip>> | import("roc-db").Entity<"BlockImage", import("zod").ZodObject<{
5
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{}, import("zod/v4/core").$strip>, false> | import("roc-db").Entity<"BlockImage", import("zod").ZodObject<{
6
6
  url: import("zod").ZodString;
7
7
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
8
8
  parent: import("zod").ZodTemplateLiteral<`Post/${number}`>;
9
- }, import("zod/v4/core").$strip>, import("zod").ZodObject<{}, import("zod/v4/core").$strip>> | import("roc-db").Entity<"Post", import("zod").ZodObject<{
9
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{}, import("zod/v4/core").$strip>, false> | import("roc-db").Entity<"Post", import("zod").ZodObject<{
10
10
  title: import("zod").ZodString;
11
11
  text: import("zod").ZodOptional<import("zod").ZodString>;
12
12
  tags: import("zod").ZodArray<import("zod").ZodString>;
@@ -15,19 +15,26 @@ export declare const entities: (import("roc-db").Entity<"Draft", import("zod").Z
15
15
  blocks: import("zod").ZodArray<import("zod").ZodString>;
16
16
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
17
17
  author: import("zod").ZodOptional<import("zod").ZodTemplateLiteral<`User/${number}`>>;
18
- }, import("zod/v4/core").$strip>, import("zod").ZodObject<{}, import("zod/v4/core").$strip>> | import("roc-db").Entity<"BlockParagraph", import("zod").ZodObject<{
18
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{}, import("zod/v4/core").$strip>, false> | import("roc-db").Entity<"BlockParagraph", import("zod").ZodObject<{
19
19
  content: import("zod").ZodOptional<import("zod").ZodString>;
20
20
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
21
21
  parent: import("zod").ZodUnion<readonly [import("zod").ZodType<`Post/${number}`, `Post/${number}`, import("zod/v4/core").$ZodTypeInternals<`Post/${number}`, `Post/${number}`>>, import("zod").ZodUnion<readonly [import("zod").ZodTemplateLiteral<`BlockParagraph/${number}`>, import("zod").ZodTemplateLiteral<`BlockRow/${number}`>]>]>;
22
- }, import("zod/v4/core").$strip>, import("zod").ZodObject<{}, import("zod/v4/core").$strip>> | import("roc-db").Entity<"BlockRow", import("zod").ZodObject<{}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
22
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{}, import("zod/v4/core").$strip>, false> | import("roc-db").Entity<"BlockRow", import("zod").ZodObject<{}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
23
23
  blocks: import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodTemplateLiteral<`BlockParagraph/${number}`>, import("zod").ZodTemplateLiteral<`BlockRow/${number}`>]>>;
24
24
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
25
25
  parent: import("zod").ZodUnion<readonly [import("zod").ZodType<`Post/${number}`, `Post/${number}`, import("zod/v4/core").$ZodTypeInternals<`Post/${number}`, `Post/${number}`>>, import("zod").ZodUnion<readonly [import("zod").ZodTemplateLiteral<`BlockParagraph/${number}`>, import("zod").ZodTemplateLiteral<`BlockRow/${number}`>]>]>;
26
- }, import("zod/v4/core").$strip>, import("zod").ZodObject<{}, import("zod/v4/core").$strip>> | import("roc-db").Entity<"PostVersion", import("zod").ZodObject<{
26
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{}, import("zod/v4/core").$strip>, false> | import("roc-db").Entity<"OrgSettings", import("zod").ZodObject<{
27
+ name: import("zod").ZodString;
28
+ theme: import("zod").ZodOptional<import("zod").ZodString>;
29
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
30
+ featuredPosts: import("zod").ZodArray<import("zod").ZodString>;
31
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
32
+ primaryAdmin: import("zod").ZodOptional<import("zod").ZodTemplateLiteral<`User/${number}`>>;
33
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{}, import("zod/v4/core").$strip>, true> | import("roc-db").Entity<"PostVersion", import("zod").ZodObject<{
27
34
  version: import("zod").ZodNumber;
28
35
  snapshot: import("zod").ZodArray<import("zod").ZodAny>;
29
36
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
30
37
  post: import("zod").ZodTemplateLiteral<`Post/${number}`>;
31
- }, import("zod/v4/core").$strip>, import("zod").ZodObject<{}, import("zod/v4/core").$strip>> | import("roc-db").Entity<"User", import("zod").ZodObject<{
38
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{}, import("zod/v4/core").$strip>, false> | import("roc-db").Entity<"User", import("zod").ZodObject<{
32
39
  email: import("zod").ZodString;
33
- }, import("zod/v4/core").$strip>, import("zod").ZodObject<{}, import("zod/v4/core").$strip>, import("zod").ZodObject<{}, import("zod/v4/core").$strip>, import("zod").ZodObject<{}, import("zod/v4/core").$strip>>)[];
40
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{}, import("zod/v4/core").$strip>, import("zod").ZodObject<{}, import("zod/v4/core").$strip>, import("zod").ZodObject<{}, import("zod/v4/core").$strip>, false>)[];
@@ -0,0 +1,6 @@
1
+ import { z } from "zod";
2
+ export declare const createOrgSettings: import("roc-db").WriteOperation<"createOrgSettings", z.ZodObject<{
3
+ name: z.ZodString;
4
+ theme: z.ZodOptional<z.ZodString>;
5
+ primaryAdmin: z.ZodOptional<z.ZodTemplateLiteral<`User/${number}`>>;
6
+ }, z.core.$strip>>;
@@ -0,0 +1,2 @@
1
+ import { z } from "zod";
2
+ export declare const createUnknownRef: import("roc-db").WriteOperation<"createUnknownRef", z.ZodOptional<z.ZodObject<{}, z.core.$strip>>>;
@@ -0,0 +1,2 @@
1
+ import { z } from "zod";
2
+ export declare const deleteOrgSettings: import("roc-db").WriteOperation<"deleteOrgSettings", z.ZodOptional<z.ZodObject<{}, z.core.$strip>>>;
@@ -0,0 +1,2 @@
1
+ import { z } from "zod";
2
+ export declare const readOrgSettings: import("roc-db").ReadOperation<"readOrgSettings", z.ZodOptional<z.ZodObject<{}, z.core.$strip>>>;
@@ -0,0 +1,4 @@
1
+ import { z } from "zod";
2
+ export declare const updateOrgSettingsName: import("roc-db").WriteOperation<"updateOrgSettingsName", z.ZodObject<{
3
+ name: z.ZodString;
4
+ }, z.core.$strip>>;
@@ -10,7 +10,7 @@ export declare const CreatePostMutationSchema: z.ZodObject<{
10
10
  name: z.ZodLiteral<"createPost">;
11
11
  version: z.ZodDefault<z.ZodNumber>;
12
12
  }, z.core.$strip>;
13
- changeSetRef: z.ZodTemplateLiteral<`${string}/${number}`> | z.ZodNullable<z.ZodTemplateLiteral<`${string}/${number}`>>;
13
+ changeSetRef: z.ZodUnion<readonly [z.ZodTemplateLiteral<`${string}/${number}`>, z.ZodString]> | z.ZodTemplateLiteral<never> | z.ZodNullable<z.ZodUnion<readonly [z.ZodTemplateLiteral<`${string}/${number}`>, z.ZodString]>> | z.ZodNullable<z.ZodTemplateLiteral<never>>;
14
14
  payload: z.ZodObject<{
15
15
  title: z.ZodString;
16
16
  slug: z.ZodOptional<z.ZodString>;
@@ -10,7 +10,7 @@ export declare const CreateUserMutationSchema: z.ZodObject<{
10
10
  name: z.ZodLiteral<"createUser">;
11
11
  version: z.ZodDefault<z.ZodNumber>;
12
12
  }, z.core.$strip>;
13
- changeSetRef: z.ZodTemplateLiteral<`${string}/${number}`> | z.ZodNullable<z.ZodTemplateLiteral<`${string}/${number}`>>;
13
+ changeSetRef: z.ZodUnion<readonly [z.ZodTemplateLiteral<`${string}/${number}`>, z.ZodString]> | z.ZodTemplateLiteral<never> | z.ZodNullable<z.ZodUnion<readonly [z.ZodTemplateLiteral<`${string}/${number}`>, z.ZodString]>> | z.ZodNullable<z.ZodTemplateLiteral<never>>;
14
14
  payload: z.ZodObject<{
15
15
  email: z.ZodString;
16
16
  }, z.core.$strip>;
@@ -10,7 +10,7 @@ export declare const UpdatePostMutationSchema: z.ZodObject<{
10
10
  name: z.ZodLiteral<"updatePost">;
11
11
  version: z.ZodDefault<z.ZodNumber>;
12
12
  }, z.core.$strip>;
13
- changeSetRef: z.ZodTemplateLiteral<`${string}/${number}`> | z.ZodNullable<z.ZodTemplateLiteral<`${string}/${number}`>>;
13
+ changeSetRef: z.ZodUnion<readonly [z.ZodTemplateLiteral<`${string}/${number}`>, z.ZodString]> | z.ZodTemplateLiteral<never> | z.ZodNullable<z.ZodUnion<readonly [z.ZodTemplateLiteral<`${string}/${number}`>, z.ZodString]>> | z.ZodNullable<z.ZodTemplateLiteral<never>>;
14
14
  payload: z.ZodObject<{
15
15
  ref: z.ZodTemplateLiteral<`Post/${number}`>;
16
16
  title: z.ZodOptional<z.ZodString>;
@@ -10,7 +10,7 @@ export declare const UpdatePostTitleMutationSchema: z.ZodObject<{
10
10
  name: z.ZodLiteral<"updatePostTitle">;
11
11
  version: z.ZodDefault<z.ZodNumber>;
12
12
  }, z.core.$strip>;
13
- changeSetRef: z.ZodTemplateLiteral<`${string}/${number}`> | z.ZodNullable<z.ZodTemplateLiteral<`${string}/${number}`>>;
13
+ changeSetRef: z.ZodUnion<readonly [z.ZodTemplateLiteral<`${string}/${number}`>, z.ZodString]> | z.ZodTemplateLiteral<never> | z.ZodNullable<z.ZodUnion<readonly [z.ZodTemplateLiteral<`${string}/${number}`>, z.ZodString]>> | z.ZodNullable<z.ZodTemplateLiteral<never>>;
14
14
  payload: z.ZodObject<{
15
15
  ref: z.ZodTemplateLiteral<`Post/${number}`>;
16
16
  title: z.ZodString;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roc-db/test-utils",
3
- "version": "0.2.0-pre.97",
3
+ "version": "0.2.0-pre.98",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -17,7 +17,7 @@
17
17
  ],
18
18
  "sideEffects": false,
19
19
  "peerDependencies": {
20
- "roc-db": "0.2.0-pre.97",
20
+ "roc-db": "0.2.0-pre.98",
21
21
  "zod": ">=4.0.0"
22
22
  },
23
23
  "keywords": [],