@roc-db/test-utils 0.2.0-pre.46 → 0.2.0-pre.48

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.
Files changed (32) hide show
  1. package/dist/index.js +72 -130
  2. package/dist/types/operations/applyDraft.d.ts +1 -5
  3. package/dist/types/operations/createBlockImage.d.ts +8 -24
  4. package/dist/types/operations/createBlockParagraph.d.ts +8 -24
  5. package/dist/types/operations/createBlockRow.d.ts +8 -24
  6. package/dist/types/operations/createBlockTitle.d.ts +8 -24
  7. package/dist/types/operations/createDraft.d.ts +8 -22
  8. package/dist/types/operations/createPost.d.ts +14 -29
  9. package/dist/types/operations/deleteBlocks.d.ts +2 -29
  10. package/dist/types/operations/deleteDraft.d.ts +1 -5
  11. package/dist/types/operations/deletePost.d.ts +1 -5
  12. package/dist/types/operations/index.d.ts +98 -294
  13. package/dist/types/operations/moveBlocks.d.ts +11 -5
  14. package/dist/types/operations/testTransactionalEdits.d.ts +14 -29
  15. package/dist/types/operations/updateBlockParagraph.d.ts +11 -5
  16. package/dist/types/operations/updatePost.d.ts +16 -28
  17. package/dist/types/operations/updatePostDescription.d.ts +10 -28
  18. package/dist/types/operations/updatePostTitle.d.ts +10 -28
  19. package/package.json +2 -2
  20. package/dist/types/schemas/ApplyDraftMutationSchema.d.ts +0 -64
  21. package/dist/types/schemas/CreateBlockImageMutationSchema.d.ts +0 -64
  22. package/dist/types/schemas/CreateBlockParagraphMutationSchema.d.ts +0 -64
  23. package/dist/types/schemas/CreateBlockRowMutationSchema.d.ts +0 -64
  24. package/dist/types/schemas/CreateBlockTitleMutationSchema.d.ts +0 -64
  25. package/dist/types/schemas/CreateDraftMutationSchema.d.ts +0 -64
  26. package/dist/types/schemas/DeleteBlocksMutationSchema.d.ts +0 -54
  27. package/dist/types/schemas/DeleteDraftMutationSchema.d.ts +0 -53
  28. package/dist/types/schemas/DeletePostMutationSchema.d.ts +0 -53
  29. package/dist/types/schemas/MoveBlocksMutationSchema.d.ts +0 -69
  30. package/dist/types/schemas/TestTransactionalEditsMutationSchema.d.ts +0 -74
  31. package/dist/types/schemas/UpdateBlockParagraphMutationSchema.d.ts +0 -69
  32. package/dist/types/schemas/UpdatePostDescriptionMutationSchema.d.ts +0 -69
package/dist/index.js CHANGED
@@ -177,15 +177,8 @@ var entities = [
177
177
  ];
178
178
  // src/operations/applyDraft.ts
179
179
  import { Query, QueryChain, writeOperation } from "roc-db";
180
-
181
- // src/schemas/ApplyDraftMutationSchema.ts
182
- import { mutationSchemaGenerator as mutationSchemaGenerator5 } from "roc-db";
183
- import { z as z13 } from "zod";
184
- var ApplyDraftMutationSchema = mutationSchemaGenerator5("applyDraft", z13.object({ ref: DraftRefSchema }).strict());
185
-
186
- // src/operations/applyDraft.ts
187
- var applyDraft = writeOperation(ApplyDraftMutationSchema, undefined, (txn) => {
188
- const { ref } = txn.payload;
180
+ var applyDraft = writeOperation("applyDraft", DraftRefSchema, (txn) => {
181
+ const ref = txn.payload;
189
182
  const versionRef = txn.createRef("PostVersion");
190
183
  return QueryChain(Query(() => txn.applyChangeSet(ref)), Query(() => txn.patchEntity(ref, {
191
184
  data: { appliedAt: txn.timestamp }
@@ -198,46 +191,28 @@ var applyDraft = writeOperation(ApplyDraftMutationSchema, undefined, (txn) => {
198
191
 
199
192
  // src/operations/createBlockImage.ts
200
193
  import { Query as Query2, writeOperation as writeOperation2 } from "roc-db";
201
-
202
- // src/schemas/CreateBlockImageMutationSchema.ts
203
- import { mutationSchemaGenerator as mutationSchemaGenerator6 } from "roc-db";
204
- import { z as z14 } from "zod";
205
- var CreateBlockImageMutationSchema = mutationSchemaGenerator6("createBlockImage", z14.object({ postRef: PostRefSchema }).strict(), undefined, true);
206
-
207
- // src/operations/createBlockImage.ts
208
- var createBlockImage = writeOperation2(CreateBlockImageMutationSchema, BlockImageSchema, (txn) => {
194
+ import { z as z13 } from "zod";
195
+ var createBlockImage = writeOperation2("createBlockImage", z13.object({ postRef: PostRefSchema }).strict(), (txn) => {
209
196
  const ref = txn.createRef("BlockImage");
210
197
  const { postRef } = txn.payload;
211
198
  return Query2(() => txn.createEntity(ref, { parents: { post: postRef } }));
212
- }, { changeSetOnly: true });
199
+ }, { changeSetOnly: true, outputSchema: BlockImageSchema });
213
200
 
214
201
  // src/operations/createBlockParagraph.ts
215
202
  import { Query as Query3, QueryChain as QueryChain2, writeOperation as writeOperation3 } from "roc-db";
216
-
217
- // src/schemas/CreateBlockParagraphMutationSchema.ts
218
- import { mutationSchemaGenerator as mutationSchemaGenerator7 } from "roc-db";
219
- import { z as z15 } from "zod";
220
- var CreateBlockParagraphMutationSchema = mutationSchemaGenerator7("createBlockParagraph", z15.object({ parentRef: z15.union([PostRefSchema, BlockRowRefSchema]) }).strict(), undefined, true);
221
-
222
- // src/operations/createBlockParagraph.ts
223
- var createBlockParagrah = writeOperation3(CreateBlockParagraphMutationSchema, BlockParagraphSchema, (txn) => {
203
+ import { z as z14 } from "zod";
204
+ var createBlockParagrah = writeOperation3("createBlockParagraph", z14.object({ parentRef: z14.union([PostRefSchema, BlockRowRefSchema]) }).strict(), (txn) => {
224
205
  const ref = txn.createRef("BlockParagraph");
225
206
  const { parentRef } = txn.payload;
226
207
  return QueryChain2(Query3(() => txn.readEntity(parentRef, true)), Query3((parent) => txn.patchEntity(parentRef, {
227
208
  children: { blocks: [...parent.children.blocks, ref] }
228
209
  })), Query3(() => txn.createEntity(ref, { parents: { parent: parentRef } })), Query3((block, updatedParent) => ({ block, updatedParent })));
229
- }, { changeSetOnly: true });
210
+ }, { changeSetOnly: true, outputSchema: BlockParagraphSchema });
230
211
 
231
212
  // src/operations/createBlockRow.ts
232
213
  import { Query as Query4, QueryChain as QueryChain3, writeOperation as writeOperation4 } from "roc-db";
233
-
234
- // src/schemas/CreateBlockRowMutationSchema.ts
235
- import { mutationSchemaGenerator as mutationSchemaGenerator8 } from "roc-db";
236
- import { z as z16 } from "zod";
237
- var CreateBlockRowMutationSchema = mutationSchemaGenerator8("createBlockRow", z16.object({ parentRef: z16.union([PostRefSchema, BlockRowRefSchema]) }).strict(), undefined, true);
238
-
239
- // src/operations/createBlockRow.ts
240
- var createBlockRow = writeOperation4(CreateBlockRowMutationSchema, BlockParagraphSchema, (txn) => {
214
+ import { z as z15 } from "zod";
215
+ var createBlockRow = writeOperation4("createBlockRow", z15.object({ parentRef: z15.union([PostRefSchema, BlockRowRefSchema]) }).strict(), (txn) => {
241
216
  const ref = txn.createRef("BlockRow");
242
217
  const { parentRef } = txn.payload;
243
218
  return QueryChain3(Query4(() => txn.readEntity(parentRef)), Query4((parent) => {
@@ -248,33 +223,22 @@ var createBlockRow = writeOperation4(CreateBlockRowMutationSchema, BlockParagrap
248
223
  children: { blocks: [] },
249
224
  parents: { parent: parentRef }
250
225
  })), Query4((block, updatedParent) => ({ block, updatedParent })));
251
- }, { changeSetOnly: true });
226
+ }, { changeSetOnly: true, outputSchema: BlockParagraphSchema });
252
227
 
253
228
  // src/operations/createBlockTitle.ts
254
229
  import { Query as Query5, writeOperation as writeOperation5 } from "roc-db";
255
-
256
- // src/schemas/CreateBlockTitleMutationSchema.ts
257
- import { mutationSchemaGenerator as mutationSchemaGenerator9 } from "roc-db";
258
- import { z as z17 } from "zod";
259
- var CreateBlockTitleMutationSchema = mutationSchemaGenerator9("createBlockTitle", z17.object({ parentRef: z17.union([PostRefSchema, BlockRowRefSchema]) }).strict(), undefined, true);
260
-
261
- // src/operations/createBlockTitle.ts
262
- var createBlockTitle = writeOperation5(CreateBlockTitleMutationSchema, BlockTitleSchema, (txn) => {
230
+ import { z as z16 } from "zod";
231
+ var PayloadSchema = z16.object({ parentRef: z16.union([PostRefSchema, BlockRowRefSchema]) }).strict();
232
+ var createBlockTitle = writeOperation5("createBlockTitle", PayloadSchema, (txn) => {
263
233
  const ref = txn.createRef("BlockTitle");
264
234
  const { postRef } = txn.payload;
265
235
  return Query5(() => txn.createEntity(ref, { parents: { post: postRef } }));
266
- }, { changeSetOnly: true });
236
+ }, { changeSetOnly: true, outputSchema: BlockTitleSchema });
267
237
 
268
238
  // src/operations/createDraft.ts
269
239
  import { Query as Query6, writeOperation as writeOperation6 } from "roc-db";
270
-
271
- // src/schemas/CreateDraftMutationSchema.ts
272
- import { mutationSchemaGenerator as mutationSchemaGenerator10 } from "roc-db";
273
- import { z as z18 } from "zod";
274
- var CreateDraftMutationSchema = mutationSchemaGenerator10("createDraft", z18.object({ postRef: PostRefSchema }).strict());
275
-
276
- // src/operations/createDraft.ts
277
- var createDraft = writeOperation6(CreateDraftMutationSchema, DraftSchema, (txn) => {
240
+ import { z as z17 } from "zod";
241
+ var createDraft = writeOperation6("createDraft", z17.object({ postRef: PostRefSchema }).strict(), (txn) => {
278
242
  const ref = txn.createRef("Draft");
279
243
  const { postRef } = txn.payload;
280
244
  return Query6(() => txn.createEntity(ref, {
@@ -282,11 +246,17 @@ var createDraft = writeOperation6(CreateDraftMutationSchema, DraftSchema, (txn)
282
246
  post: postRef
283
247
  }
284
248
  }));
285
- });
249
+ }, { outputSchema: DraftSchema });
286
250
 
287
251
  // src/operations/createPost.ts
288
252
  import { Query as Query7, writeOperation as writeOperation7 } from "roc-db";
289
- var createPost = writeOperation7(CreatePostMutationSchema, PostSchema, (txn) => {
253
+ import { z as z18 } from "zod";
254
+ var PayloadSchema2 = z18.object({
255
+ title: z18.string(),
256
+ slug: z18.string().optional(),
257
+ tags: z18.array(z18.string()).default([])
258
+ }).strict();
259
+ var createPost = writeOperation7("createPost", PayloadSchema2, (txn) => {
290
260
  const ref = txn.createRef("Post");
291
261
  const { title, slug, tags } = txn.payload;
292
262
  return Query7(() => txn.createEntity(ref, {
@@ -297,17 +267,7 @@ var createPost = writeOperation7(CreatePostMutationSchema, PostSchema, (txn) =>
297
267
 
298
268
  // src/operations/deleteBlocks.ts
299
269
  import { Query as Query8, QueryChain as QueryChain4, writeOperation as writeOperation8 } from "roc-db";
300
-
301
- // src/schemas/DeleteBlocksMutationSchema.ts
302
- import { mutationSchemaGenerator as mutationSchemaGenerator11 } from "roc-db";
303
270
  import { z as z19 } from "zod";
304
- var DeleteBlocksMutationSchema = mutationSchemaGenerator11("deleteBlocks", z19.array(z19.union([
305
- BlockParagraphRefSchema,
306
- BlockImageRefSchema,
307
- BlockRowRefSchema
308
- ])));
309
-
310
- // src/operations/deleteBlocks.ts
311
271
  var DeleteBlockQuery = (txn, blockRef) => {
312
272
  return QueryChain4(Query8(() => txn.readEntity(blockRef)), Query8((block) => {
313
273
  return txn.readEntity(block.parents.parent, true);
@@ -319,50 +279,37 @@ var DeleteBlockQuery = (txn, blockRef) => {
319
279
  });
320
280
  }), Query8(() => txn.deleteEntity(blockRef)));
321
281
  };
322
- var deleteBlocks = writeOperation8(DeleteBlocksMutationSchema, PostSchema, (txn) => {
282
+ var deleteBlocks = writeOperation8("deleteBlocks", z19.array(z19.union([
283
+ BlockParagraphRefSchema,
284
+ BlockImageRefSchema,
285
+ BlockRowRefSchema
286
+ ])), (txn) => {
323
287
  const refs = txn.payload;
324
288
  return QueryChain4(...refs.map((ref) => DeleteBlockQuery(txn, ref)));
325
- }, { changeSetOnly: true });
289
+ }, { changeSetOnly: true, outputSchema: PostSchema });
326
290
 
327
291
  // src/operations/deleteDraft.ts
328
292
  import { Query as Query9, QueryChain as QueryChain5, writeOperation as writeOperation9 } from "roc-db";
329
-
330
- // src/schemas/DeleteDraftMutationSchema.ts
331
- import { mutationSchemaGenerator as mutationSchemaGenerator12 } from "roc-db";
332
- var DeleteDraftMutationSchema = mutationSchemaGenerator12("deleteDraft", DraftRefSchema);
333
-
334
- // src/operations/deleteDraft.ts
335
- var deleteDraft = writeOperation9(DeleteDraftMutationSchema, undefined, (txn) => {
293
+ var deleteDraft = writeOperation9("deleteDraft", DraftRefSchema, (txn) => {
336
294
  const ref = txn.payload;
337
295
  return QueryChain5(Query9(() => txn.deleteEntity(ref, true)), Query9(() => txn.deleteChangeSet(ref)));
338
296
  });
339
297
 
340
298
  // src/operations/deletePost.ts
341
299
  import { Query as Query10, writeOperation as writeOperation10 } from "roc-db";
342
-
343
- // src/schemas/DeletePostMutationSchema.ts
344
- import { mutationSchemaGenerator as mutationSchemaGenerator13 } from "roc-db";
345
- var DeletePostMutationSchema = mutationSchemaGenerator13("deletePost", PostRefSchema);
346
-
347
- // src/operations/deletePost.ts
348
- var deletePost = writeOperation10(DeletePostMutationSchema, undefined, (txn) => {
300
+ var deletePost = writeOperation10("deletePost", PostRefSchema, (txn) => {
349
301
  const ref = txn.payload;
350
302
  return Query10(() => txn.deleteEntity(ref, true));
351
303
  });
352
304
 
353
305
  // src/operations/moveBlocks.ts
354
306
  import { Query as Query11, QueryChain as QueryChain6, writeOperation as writeOperation11 } from "roc-db";
355
-
356
- // src/schemas/MoveBlocksMutationSchema.ts
357
- import { mutationSchemaGenerator as mutationSchemaGenerator14 } from "roc-db";
358
307
  import { z as z20 } from "zod";
359
- var MoveBlocksMutationSchema = mutationSchemaGenerator14("moveBlocks", z20.object({
308
+ var PayloadSchema3 = z20.object({
360
309
  refs: z20.array(z20.union([BlockParagraphRefSchema, BlockRowRefSchema])),
361
310
  targetPosition: z20.number().min(0)
362
- }).strict(), undefined, true);
363
-
364
- // src/operations/moveBlocks.ts
365
- var moveBlocks = writeOperation11(MoveBlocksMutationSchema, undefined, (txn) => {
311
+ }).strict();
312
+ var moveBlocks = writeOperation11("moveBlocks", PayloadSchema3, (txn) => {
366
313
  const { refs } = txn.payload;
367
314
  return QueryChain6(Query11(() => txn.batchReadEntities(refs)), Query11((items) => {
368
315
  return "todo";
@@ -372,7 +319,7 @@ var moveBlocks = writeOperation11(MoveBlocksMutationSchema, undefined, (txn) =>
372
319
  // src/operations/readEntity.ts
373
320
  import { NotFoundError, Query as Query12, QueryChain as QueryChain7, readOperation } from "roc-db";
374
321
  import { z as z21 } from "zod";
375
- var readEntity = readOperation("readEntity", z21.string(), z21.union([PostSchema, BlockImageSchema, BlockParagraphSchema]), (txn) => {
322
+ var readEntity = readOperation("readEntity", z21.string(), (txn) => {
376
323
  const ref = txn.payload;
377
324
  return QueryChain7(Query12(() => txn.readEntity(ref)), Query12((entity) => {
378
325
  if (!entity) {
@@ -380,12 +327,18 @@ var readEntity = readOperation("readEntity", z21.string(), z21.union([PostSchema
380
327
  }
381
328
  return entity;
382
329
  }));
330
+ }, {
331
+ outputSchema: z21.union([
332
+ PostSchema,
333
+ BlockImageSchema,
334
+ BlockParagraphSchema
335
+ ])
383
336
  });
384
337
 
385
338
  // src/operations/readMutation.ts
386
339
  import { NotFoundError as NotFoundError2, Query as Query13, QueryChain as QueryChain8, readOperation as readOperation2 } from "roc-db";
387
340
  import { z as z22 } from "zod";
388
- var readMutation = readOperation2("readMutation", z22.string(), z22.any(), (txn) => {
341
+ var readMutation = readOperation2("readMutation", z22.string(), (txn) => {
389
342
  const ref = txn.payload;
390
343
  return QueryChain8(Query13(() => txn.readMutation(ref)), Query13((entity) => {
391
344
  if (!entity) {
@@ -397,25 +350,15 @@ var readMutation = readOperation2("readMutation", z22.string(), z22.any(), (txn)
397
350
 
398
351
  // src/operations/readPost.ts
399
352
  import { Query as Query14, readOperation as readOperation3 } from "roc-db";
400
- var readPost = readOperation3("readPost", PostRefSchema, PostSchema, (txn) => {
353
+ var readPost = readOperation3("readPost", PostRefSchema, (txn) => {
401
354
  const ref = txn.payload;
402
355
  return Query14(() => txn.readEntity(ref, true));
403
- });
356
+ }, { outputSchema: PostSchema });
404
357
 
405
358
  // src/operations/testTransactionalEdits.ts
359
+ import { expect } from "bun:test";
406
360
  import { Query as Query15, QueryChain as QueryChain9, writeOperation as writeOperation12 } from "roc-db";
407
-
408
- // src/schemas/TestTransactionalEditsMutationSchema.ts
409
- import { mutationSchemaGenerator as mutationSchemaGenerator15 } from "roc-db";
410
361
  import { z as z23 } from "zod";
411
- var TestTransactionalEditsMutationSchema = mutationSchemaGenerator15("testTransactionalEdits", z23.object({
412
- name: z23.string().optional(),
413
- post1ref: PostRefSchema.optional(),
414
- post2ref: PostRefSchema.optional()
415
- }).strict());
416
-
417
- // src/operations/testTransactionalEdits.ts
418
- import { expect } from "bun:test";
419
362
  var TestCreatePatchDeleteInSameTransaction = (txn, name) => {
420
363
  const postRef = txn.createRef("Post");
421
364
  QueryChain9(Query15(() => txn.createEntity(postRef, { data: { name } })), Query15(() => txn.patchEntity(postRef, { data: { foo: "bar" } })), Query15((post) => {
@@ -450,7 +393,12 @@ var TestCreateOnExistingRef = (txn) => {
450
393
  const ref = txn.createRef("Post");
451
394
  return QueryChain9(Query15(() => txn.createEntity(ref, { data: { foo: "bar" } })), Query15(() => txn.createEntity(ref, { data: { foo: "bar" } })));
452
395
  };
453
- var testTransactionalEdits = writeOperation12(TestTransactionalEditsMutationSchema, PostSchema, (txn) => {
396
+ var PayloadSchema4 = z23.object({
397
+ name: z23.string().optional(),
398
+ post1ref: PostRefSchema.optional(),
399
+ post2ref: PostRefSchema.optional()
400
+ }).strict();
401
+ var testTransactionalEdits = writeOperation12("testTransactionalEdits", PayloadSchema4, (txn) => {
454
402
  const { name, post1ref, post2ref } = txn.payload;
455
403
  if (name)
456
404
  return TestCreatePatchDeleteInSameTransaction(txn, name);
@@ -462,54 +410,50 @@ var testTransactionalEdits = writeOperation12(TestTransactionalEditsMutationSche
462
410
 
463
411
  // src/operations/updateBlockParagraph.ts
464
412
  import { Query as Query16, writeOperation as writeOperation13 } from "roc-db";
465
-
466
- // src/schemas/UpdateBlockParagraphMutationSchema.ts
467
- import { mutationSchemaGenerator as mutationSchemaGenerator16 } from "roc-db";
468
413
  import { z as z24 } from "zod";
469
- var UpdateBlockParagraphMutationSchema = mutationSchemaGenerator16("updateBlockParagraph", z24.object({
414
+ var updateBlockParagraph = writeOperation13("updateBlockParagraph", z24.object({
470
415
  ref: BlockParagraphRefSchema,
471
416
  content: z24.string()
472
- }));
473
-
474
- // src/operations/updateBlockParagraph.ts
475
- var updateBlockParagraph = writeOperation13(UpdateBlockParagraphMutationSchema, BlockParagraphRefSchema, (txn) => {
417
+ }), (txn) => {
476
418
  const { ref, content } = txn.payload;
477
419
  return Query16(() => txn.patchEntity(ref, {
478
420
  data: { content }
479
421
  }));
480
- });
422
+ }, { outputSchema: BlockParagraphSchema });
481
423
 
482
424
  // src/operations/updatePost.ts
483
425
  import { Query as Query17, writeOperation as writeOperation14 } from "roc-db";
484
- var updatePost = writeOperation14(UpdatePostMutationSchema, PostSchema, (txn) => {
426
+ import { z as z25 } from "zod";
427
+ var PayloadSchema5 = z25.object({
428
+ ref: PostRefSchema,
429
+ title: z25.string().optional(),
430
+ tags: z25.array(z25.string()).optional().default([]),
431
+ authorRef: UserRefSchema.optional()
432
+ });
433
+ var updatePost = writeOperation14("updatePost", PayloadSchema5, (txn) => {
485
434
  const { ref, authorRef, ...data } = txn.payload;
486
435
  return Query17(() => txn.updateEntity(ref, {
487
436
  data,
488
437
  parents: { author: authorRef },
489
438
  children: { blocks: [] }
490
439
  }));
491
- });
440
+ }, { outputSchema: PostSchema });
492
441
 
493
442
  // src/operations/updatePostDescription.ts
494
443
  import { Query as Query18, writeOperation as writeOperation15 } from "roc-db";
495
-
496
- // src/schemas/UpdatePostDescriptionMutationSchema.ts
497
- import { mutationSchemaGenerator as mutationSchemaGenerator17 } from "roc-db";
498
- import { z as z25 } from "zod";
499
- var UpdatePostDescriptionMutationSchema = mutationSchemaGenerator17("updatePostDescription", z25.object({ ref: PostRefSchema, description: z25.string() }));
500
-
501
- // src/operations/updatePostDescription.ts
502
- var updatePostDescription = writeOperation15(UpdatePostDescriptionMutationSchema, PostSchema, (txn) => {
444
+ import { z as z26 } from "zod";
445
+ var updatePostDescription = writeOperation15("updatePostDescription", z26.object({ ref: PostRefSchema, description: z26.string() }), (txn) => {
503
446
  const { ref, description } = txn.payload;
504
447
  return Query18(() => txn.patchEntity(ref, { data: { description } }));
505
- }, { debounce: 10, changeSetOnly: true });
448
+ }, { debounce: 10, changeSetOnly: true, outputSchema: PostSchema });
506
449
 
507
450
  // src/operations/updatePostTitle.ts
508
451
  import { Query as Query19, writeOperation as writeOperation16 } from "roc-db";
509
- var updatePostTitle = writeOperation16(UpdatePostTitleMutationSchema, PostSchema, (txn) => {
452
+ import { z as z27 } from "zod";
453
+ var updatePostTitle = writeOperation16("updatePostTitle", z27.object({ ref: PostRefSchema, title: z27.string() }), (txn) => {
510
454
  const { ref, title } = txn.payload;
511
455
  return Query19(() => txn.patchEntity(ref, { data: { title } }));
512
- }, { debounce: 10 });
456
+ }, { debounce: 10, outputSchema: PostSchema });
513
457
 
514
458
  // src/operations/index.ts
515
459
  var operations = [
@@ -796,9 +740,7 @@ var testAdapterImplementation = async (adapterConstructor, generateArgs) => {
796
740
  });
797
741
  test("applyDraft", async () => {
798
742
  const { draftRef: draftRef2 } = await prepareChangeSetTest(adapter1);
799
- const [version, mutation] = await adapter1.applyDraft({
800
- ref: draftRef2
801
- });
743
+ const [version, mutation] = await adapter1.applyDraft(draftRef2);
802
744
  });
803
745
  test("deleteDraft", async () => {
804
746
  const { draftRef: draftRef2 } = await prepareChangeSetTest(adapter1);
@@ -1,5 +1 @@
1
- export declare const applyDraft: import("roc-db").WriteOperation<string, {
2
- debounceCount: number;
3
- name: string;
4
- payload?: any;
5
- }, any, any>;
1
+ export declare const applyDraft: import("roc-db").WriteOperation<"applyDraft", import("zod").ZodType<`Draft/${string}`, import("zod").ZodTypeDef, `Draft/${string}`>>;
@@ -1,24 +1,8 @@
1
- export declare const createBlockImage: import("roc-db").WriteOperation<string, {
2
- debounceCount: number;
3
- name: string;
4
- payload?: any;
5
- }, any, {
6
- ref: `BlockImage/${string}`;
7
- data: {
8
- url: string;
9
- };
10
- parents: {
11
- post: `Post/${string}`;
12
- };
13
- entity: "BlockImage";
14
- created: {
15
- mutationRef: `Mutation/${string}`;
16
- timestamp: string;
17
- };
18
- updated: {
19
- mutationRef: `Mutation/${string}`;
20
- timestamp: string;
21
- };
22
- children: {};
23
- ancestors: {};
24
- }>;
1
+ import { z } from "zod";
2
+ export declare const createBlockImage: import("roc-db").WriteOperation<"createBlockImage", z.ZodObject<{
3
+ postRef: z.ZodType<`Post/${string}`, z.ZodTypeDef, `Post/${string}`>;
4
+ }, "strict", z.ZodTypeAny, {
5
+ postRef: `Post/${string}`;
6
+ }, {
7
+ postRef: `Post/${string}`;
8
+ }>>;
@@ -1,24 +1,8 @@
1
- export declare const createBlockParagrah: import("roc-db").WriteOperation<string, {
2
- debounceCount: number;
3
- name: string;
4
- payload?: any;
5
- }, any, {
6
- ref: `BlockParagraph/${string}`;
7
- data: {
8
- content?: string | undefined;
9
- };
10
- parents: {
11
- parent: `Post/${string}`;
12
- };
13
- entity: "BlockParagraph";
14
- created: {
15
- mutationRef: `Mutation/${string}`;
16
- timestamp: string;
17
- };
18
- updated: {
19
- mutationRef: `Mutation/${string}`;
20
- timestamp: string;
21
- };
22
- children: {};
23
- ancestors: {};
24
- }>;
1
+ import { z } from "zod";
2
+ export declare const createBlockParagrah: import("roc-db").WriteOperation<"createBlockParagraph", z.ZodObject<{
3
+ parentRef: z.ZodUnion<[z.ZodType<`Post/${string}`, z.ZodTypeDef, `Post/${string}`>, z.ZodType<`BlockRow/${string}`, z.ZodTypeDef, `BlockRow/${string}`>]>;
4
+ }, "strict", z.ZodTypeAny, {
5
+ parentRef: `Post/${string}` | `BlockRow/${string}`;
6
+ }, {
7
+ parentRef: `Post/${string}` | `BlockRow/${string}`;
8
+ }>>;
@@ -1,24 +1,8 @@
1
- export declare const createBlockRow: import("roc-db").WriteOperation<string, {
2
- debounceCount: number;
3
- name: string;
4
- payload?: any;
5
- }, any, {
6
- ref: `BlockParagraph/${string}`;
7
- data: {
8
- content?: string | undefined;
9
- };
10
- parents: {
11
- parent: `Post/${string}`;
12
- };
13
- entity: "BlockParagraph";
14
- created: {
15
- mutationRef: `Mutation/${string}`;
16
- timestamp: string;
17
- };
18
- updated: {
19
- mutationRef: `Mutation/${string}`;
20
- timestamp: string;
21
- };
22
- children: {};
23
- ancestors: {};
24
- }>;
1
+ import { z } from "zod";
2
+ export declare const createBlockRow: import("roc-db").WriteOperation<"createBlockRow", z.ZodObject<{
3
+ parentRef: z.ZodUnion<[z.ZodType<`Post/${string}`, z.ZodTypeDef, `Post/${string}`>, z.ZodType<`BlockRow/${string}`, z.ZodTypeDef, `BlockRow/${string}`>]>;
4
+ }, "strict", z.ZodTypeAny, {
5
+ parentRef: `Post/${string}` | `BlockRow/${string}`;
6
+ }, {
7
+ parentRef: `Post/${string}` | `BlockRow/${string}`;
8
+ }>>;
@@ -1,24 +1,8 @@
1
- export declare const createBlockTitle: import("roc-db").WriteOperation<string, {
2
- debounceCount: number;
3
- name: string;
4
- payload?: any;
5
- }, any, {
6
- ref: `BlockTitle/${string}`;
7
- data: {
8
- content: string;
9
- };
10
- parents: {
11
- post: `Post/${string}`;
12
- };
13
- entity: "BlockTitle";
14
- created: {
15
- mutationRef: `Mutation/${string}`;
16
- timestamp: string;
17
- };
18
- updated: {
19
- mutationRef: `Mutation/${string}`;
20
- timestamp: string;
21
- };
22
- children: {};
23
- ancestors: {};
24
- }>;
1
+ import { z } from "zod";
2
+ export declare const createBlockTitle: import("roc-db").WriteOperation<"createBlockTitle", z.ZodObject<{
3
+ parentRef: z.ZodUnion<[z.ZodType<`Post/${string}`, z.ZodTypeDef, `Post/${string}`>, z.ZodType<`BlockRow/${string}`, z.ZodTypeDef, `BlockRow/${string}`>]>;
4
+ }, "strict", z.ZodTypeAny, {
5
+ parentRef: `Post/${string}` | `BlockRow/${string}`;
6
+ }, {
7
+ parentRef: `Post/${string}` | `BlockRow/${string}`;
8
+ }>>;
@@ -1,22 +1,8 @@
1
- export declare const createDraft: import("roc-db").WriteOperation<string, {
2
- debounceCount: number;
3
- name: string;
4
- payload?: any;
5
- }, any, {
6
- ref: `Draft/${string}`;
7
- data: {
8
- postRef: `Post/${string}`;
9
- };
10
- parents: {};
11
- entity: "Draft";
12
- created: {
13
- mutationRef: `Mutation/${string}`;
14
- timestamp: string;
15
- };
16
- updated: {
17
- mutationRef: `Mutation/${string}`;
18
- timestamp: string;
19
- };
20
- children: {};
21
- ancestors: {};
22
- }>;
1
+ import { z } from "zod";
2
+ export declare const createDraft: import("roc-db").WriteOperation<"createDraft", z.ZodObject<{
3
+ postRef: z.ZodType<`Post/${string}`, z.ZodTypeDef, `Post/${string}`>;
4
+ }, "strict", z.ZodTypeAny, {
5
+ postRef: `Post/${string}`;
6
+ }, {
7
+ postRef: `Post/${string}`;
8
+ }>>;
@@ -1,29 +1,14 @@
1
- export declare const createPost: import("roc-db").WriteOperation<string, {
2
- debounceCount: number;
3
- name: string;
4
- payload?: any;
5
- }, any, {
6
- ref: `Post/${string}`;
7
- data: {
8
- title: string;
9
- tags: string[];
10
- text?: string | undefined;
11
- slug?: string | undefined;
12
- };
13
- parents: {
14
- author?: `User/${string}` | undefined;
15
- };
16
- entity: "Post";
17
- created: {
18
- mutationRef: `Mutation/${string}`;
19
- timestamp: string;
20
- };
21
- updated: {
22
- mutationRef: `Mutation/${string}`;
23
- timestamp: string;
24
- };
25
- children: {
26
- blocks: string[];
27
- };
28
- ancestors: {};
29
- }>;
1
+ import { z } from "zod";
2
+ export declare const createPost: import("roc-db").WriteOperation<"createPost", z.ZodObject<{
3
+ title: z.ZodString;
4
+ slug: z.ZodOptional<z.ZodString>;
5
+ tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
6
+ }, "strict", z.ZodTypeAny, {
7
+ title: string;
8
+ tags: string[];
9
+ slug?: string | undefined;
10
+ }, {
11
+ title: string;
12
+ tags?: string[] | undefined;
13
+ slug?: string | undefined;
14
+ }>>;
@@ -1,29 +1,2 @@
1
- export declare const deleteBlocks: import("roc-db").WriteOperation<string, {
2
- debounceCount: number;
3
- name: string;
4
- payload?: any;
5
- }, any, {
6
- ref: `Post/${string}`;
7
- data: {
8
- title: string;
9
- tags: string[];
10
- text?: string | undefined;
11
- slug?: string | undefined;
12
- };
13
- parents: {
14
- author?: `User/${string}` | undefined;
15
- };
16
- entity: "Post";
17
- created: {
18
- mutationRef: `Mutation/${string}`;
19
- timestamp: string;
20
- };
21
- updated: {
22
- mutationRef: `Mutation/${string}`;
23
- timestamp: string;
24
- };
25
- children: {
26
- blocks: string[];
27
- };
28
- ancestors: {};
29
- }>;
1
+ import { z } from "zod";
2
+ export declare const deleteBlocks: import("roc-db").WriteOperation<"deleteBlocks", z.ZodArray<z.ZodUnion<[z.ZodType<`BlockParagraph/${string}`, z.ZodTypeDef, `BlockParagraph/${string}`>, z.ZodType<`BlockImage/${string}`, z.ZodTypeDef, `BlockImage/${string}`>, z.ZodType<`BlockRow/${string}`, z.ZodTypeDef, `BlockRow/${string}`>]>, "many">>;
@@ -1,5 +1 @@
1
- export declare const deleteDraft: import("roc-db").WriteOperation<string, {
2
- debounceCount: number;
3
- name: string;
4
- payload?: any;
5
- }, any, any>;
1
+ export declare const deleteDraft: import("roc-db").WriteOperation<"deleteDraft", import("zod").ZodType<`Draft/${string}`, import("zod").ZodTypeDef, `Draft/${string}`>>;
@@ -1,5 +1 @@
1
- export declare const deletePost: import("roc-db").WriteOperation<string, {
2
- debounceCount: number;
3
- name: string;
4
- payload?: any;
5
- }, any, any>;
1
+ export declare const deletePost: import("roc-db").WriteOperation<"deletePost", import("zod").ZodType<`Post/${string}`, import("zod").ZodTypeDef, `Post/${string}`>>;