@roc-db/test-utils 0.2.0-pre.53 → 0.2.0-pre.54
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 +278 -137
- package/dist/types/entities/BlockImageEntity.d.ts +15 -0
- package/dist/types/entities/UserEntity.d.ts +9 -0
- package/dist/types/entities/index.d.ts +19 -1
- package/dist/types/operations/createBlockImage.d.ts +6 -3
- package/dist/types/operations/createUser.d.ts +8 -0
- package/dist/types/operations/index.d.ts +1 -124
- package/dist/types/operations/pageBlocks.d.ts +1 -0
- package/dist/types/operations/pageEmptyEntitiesArray.d.ts +1 -0
- package/dist/types/operations/pagePosts.d.ts +1 -0
- package/dist/types/operations/pageSplat.d.ts +1 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -131,81 +131,105 @@ var UpdatePostMutationSchema = mutationSchemaGenerator3("updatePost", z9.object(
|
|
|
131
131
|
import { mutationSchemaGenerator as mutationSchemaGenerator4 } from "roc-db";
|
|
132
132
|
import { z as z10 } from "zod";
|
|
133
133
|
var UpdatePostTitleMutationSchema = mutationSchemaGenerator4("updatePostTitle", z10.object({ ref: PostRefSchema, title: z10.string() }));
|
|
134
|
-
// src/entities/
|
|
135
|
-
import { Entity as Entity3 } from "roc-db";
|
|
136
|
-
import { z as z13 } from "zod";
|
|
137
|
-
|
|
138
|
-
// src/entities/PostEntity.ts
|
|
134
|
+
// src/entities/BlockImageEntity.ts
|
|
139
135
|
import { Entity as Entity2 } from "roc-db";
|
|
140
136
|
import { z as z11 } from "zod";
|
|
141
|
-
var
|
|
137
|
+
var BlockImageEntity = new Entity2("BlockImage", {
|
|
142
138
|
data: z11.object({
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
139
|
+
url: z11.string().url()
|
|
140
|
+
}),
|
|
141
|
+
parents: z11.object({
|
|
142
|
+
parent: PostRefSchema
|
|
143
|
+
})
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
// src/entities/BlockParagraph.ts
|
|
147
|
+
import { Entity as Entity4 } from "roc-db";
|
|
148
|
+
import { z as z14 } from "zod";
|
|
149
|
+
|
|
150
|
+
// src/entities/PostEntity.ts
|
|
151
|
+
import { Entity as Entity3 } from "roc-db";
|
|
152
|
+
import { z as z12 } from "zod";
|
|
153
|
+
var PostEntity = new Entity3("Post", {
|
|
154
|
+
data: z12.object({
|
|
155
|
+
title: z12.string(),
|
|
156
|
+
text: z12.string().optional(),
|
|
157
|
+
tags: z12.array(z12.string()),
|
|
158
|
+
slug: z12.string().optional()
|
|
147
159
|
}),
|
|
148
|
-
parents:
|
|
149
|
-
children:
|
|
160
|
+
parents: z12.object({ author: UserRefSchema.optional() }),
|
|
161
|
+
children: z12.object({ blocks: z12.array(z12.string()) }),
|
|
150
162
|
indexedDataKeys: ["tags", "slug"],
|
|
151
163
|
uniqueDataKeys: ["slug"]
|
|
152
164
|
});
|
|
153
165
|
|
|
154
166
|
// src/schemas/BlockRefSchema.ts
|
|
155
|
-
import { z as
|
|
167
|
+
import { z as z13 } from "zod";
|
|
156
168
|
|
|
157
169
|
// src/schemas/BlockRowRefSchema.ts
|
|
158
170
|
import { refSchemaGenerator as refSchemaGenerator6 } from "roc-db";
|
|
159
171
|
var BlockRowRefSchema = refSchemaGenerator6("BlockRow");
|
|
160
172
|
|
|
161
173
|
// src/schemas/BlockRefSchema.ts
|
|
162
|
-
var BlockRefSchema =
|
|
174
|
+
var BlockRefSchema = z13.union([
|
|
163
175
|
BlockParagraphRefSchema,
|
|
164
176
|
BlockRowRefSchema
|
|
165
177
|
]);
|
|
166
178
|
|
|
167
179
|
// src/entities/BlockParagraph.ts
|
|
168
|
-
var BlockParagraph = new
|
|
169
|
-
data:
|
|
170
|
-
content:
|
|
180
|
+
var BlockParagraph = new Entity4("BlockParagraph", {
|
|
181
|
+
data: z14.object({
|
|
182
|
+
content: z14.string().optional()
|
|
171
183
|
}),
|
|
172
|
-
parents:
|
|
173
|
-
parent:
|
|
184
|
+
parents: z14.object({
|
|
185
|
+
parent: z14.union([PostEntity.refSchema, BlockRefSchema])
|
|
174
186
|
})
|
|
175
187
|
});
|
|
176
188
|
|
|
177
189
|
// src/entities/BlockRow.ts
|
|
178
|
-
import { Entity as
|
|
179
|
-
import { z as
|
|
180
|
-
var BlockRow = new
|
|
181
|
-
children:
|
|
182
|
-
blocks:
|
|
190
|
+
import { Entity as Entity5 } from "roc-db";
|
|
191
|
+
import { z as z15 } from "zod";
|
|
192
|
+
var BlockRow = new Entity5("BlockRow", {
|
|
193
|
+
children: z15.object({
|
|
194
|
+
blocks: z15.array(BlockRefSchema)
|
|
183
195
|
}),
|
|
184
|
-
parents:
|
|
185
|
-
parent:
|
|
196
|
+
parents: z15.object({
|
|
197
|
+
parent: z15.union([PostEntity.refSchema, BlockRefSchema])
|
|
186
198
|
})
|
|
187
199
|
});
|
|
188
200
|
|
|
189
201
|
// src/entities/PostVersion.ts
|
|
190
|
-
import { Entity as
|
|
191
|
-
import { z as
|
|
192
|
-
var PostVersion = new
|
|
193
|
-
data:
|
|
194
|
-
version:
|
|
195
|
-
snapshot:
|
|
202
|
+
import { Entity as Entity6 } from "roc-db";
|
|
203
|
+
import { z as z16 } from "zod";
|
|
204
|
+
var PostVersion = new Entity6("PostVersion", {
|
|
205
|
+
data: z16.object({
|
|
206
|
+
version: z16.number(),
|
|
207
|
+
snapshot: z16.array(z16.any())
|
|
196
208
|
}),
|
|
197
|
-
parents:
|
|
209
|
+
parents: z16.object({ post: PostRefSchema }),
|
|
198
210
|
indexedDataKeys: ["version"],
|
|
199
211
|
uniqueDataKeys: ["slug"]
|
|
200
212
|
});
|
|
201
213
|
|
|
214
|
+
// src/entities/UserEntity.ts
|
|
215
|
+
import { Entity as Entity7 } from "roc-db";
|
|
216
|
+
import { z as z17 } from "zod";
|
|
217
|
+
var UserEntity = new Entity7("User", {
|
|
218
|
+
data: z17.object({
|
|
219
|
+
email: z17.string().email()
|
|
220
|
+
}),
|
|
221
|
+
uniqueDataKeys: ["email"]
|
|
222
|
+
});
|
|
223
|
+
|
|
202
224
|
// src/entities/index.ts
|
|
203
225
|
var entities = [
|
|
226
|
+
BlockImageEntity,
|
|
204
227
|
BlockParagraph,
|
|
205
228
|
BlockRow,
|
|
206
229
|
Draft,
|
|
207
230
|
PostEntity,
|
|
208
|
-
PostVersion
|
|
231
|
+
PostVersion,
|
|
232
|
+
UserEntity
|
|
209
233
|
];
|
|
210
234
|
// src/operations/applyDraft.ts
|
|
211
235
|
import { Query, QueryChain, writeOperation } from "roc-db";
|
|
@@ -227,17 +251,20 @@ var applyDraft = writeOperation("applyDraft", DraftRefSchema, (txn) => {
|
|
|
227
251
|
|
|
228
252
|
// src/operations/createBlockImage.ts
|
|
229
253
|
import { Query as Query2, writeOperation as writeOperation2 } from "roc-db";
|
|
230
|
-
import { z as
|
|
231
|
-
var createBlockImage = writeOperation2("createBlockImage",
|
|
254
|
+
import { z as z18 } from "zod";
|
|
255
|
+
var createBlockImage = writeOperation2("createBlockImage", z18.object({ parentRef: PostRefSchema, url: z18.string().url() }).strict(), (txn) => {
|
|
232
256
|
const ref = txn.createRef("BlockImage");
|
|
233
|
-
const {
|
|
234
|
-
return Query2(() => txn.createEntity(ref, {
|
|
235
|
-
|
|
257
|
+
const { parentRef, url } = txn.payload;
|
|
258
|
+
return Query2(() => txn.createEntity(ref, {
|
|
259
|
+
data: { url },
|
|
260
|
+
parents: { parent: parentRef }
|
|
261
|
+
}));
|
|
262
|
+
}, { changeSetOnly: true });
|
|
236
263
|
|
|
237
264
|
// src/operations/createBlockParagraph.ts
|
|
238
265
|
import { Query as Query3, QueryChain as QueryChain2, writeOperation as writeOperation3 } from "roc-db";
|
|
239
|
-
import { z as
|
|
240
|
-
var createBlockParagrah = writeOperation3("createBlockParagraph",
|
|
266
|
+
import { z as z19 } from "zod";
|
|
267
|
+
var createBlockParagrah = writeOperation3("createBlockParagraph", z19.object({ parentRef: z19.union([PostRefSchema, BlockRowRefSchema]) }).strict(), (txn) => {
|
|
241
268
|
const ref = txn.createRef("BlockParagraph");
|
|
242
269
|
const { parentRef } = txn.payload;
|
|
243
270
|
return QueryChain2(Query3(() => txn.readEntity(parentRef, true)), Query3((parent) => txn.patchEntity(parentRef, {
|
|
@@ -245,16 +272,16 @@ var createBlockParagrah = writeOperation3("createBlockParagraph", z17.object({ p
|
|
|
245
272
|
})), Query3(() => txn.createEntity(ref, { parents: { parent: parentRef } })), Query3((block, updatedParent) => ({ block, updatedParent })));
|
|
246
273
|
}, {
|
|
247
274
|
changeSetOnly: true,
|
|
248
|
-
outputSchema:
|
|
249
|
-
block:
|
|
250
|
-
updatedParent:
|
|
275
|
+
outputSchema: z19.object({
|
|
276
|
+
block: z19.any(),
|
|
277
|
+
updatedParent: z19.any()
|
|
251
278
|
})
|
|
252
279
|
});
|
|
253
280
|
|
|
254
281
|
// src/operations/createBlockRow.ts
|
|
255
282
|
import { Query as Query4, QueryChain as QueryChain3, writeOperation as writeOperation4 } from "roc-db";
|
|
256
|
-
import { z as
|
|
257
|
-
var createBlockRow = writeOperation4("createBlockRow",
|
|
283
|
+
import { z as z20 } from "zod";
|
|
284
|
+
var createBlockRow = writeOperation4("createBlockRow", z20.object({ parentRef: z20.union([PostRefSchema, BlockRowRefSchema]) }).strict(), (txn) => {
|
|
258
285
|
const ref = txn.createRef("BlockRow");
|
|
259
286
|
const { parentRef } = txn.payload;
|
|
260
287
|
return QueryChain3(Query4(() => txn.readEntity(parentRef)), Query4((parent) => {
|
|
@@ -267,16 +294,16 @@ var createBlockRow = writeOperation4("createBlockRow", z18.object({ parentRef: z
|
|
|
267
294
|
})), Query4((block, updatedParent) => ({ block, updatedParent })));
|
|
268
295
|
}, {
|
|
269
296
|
changeSetOnly: true,
|
|
270
|
-
outputSchema:
|
|
271
|
-
block:
|
|
272
|
-
updatedParent:
|
|
297
|
+
outputSchema: z20.object({
|
|
298
|
+
block: z20.any(),
|
|
299
|
+
updatedParent: z20.any()
|
|
273
300
|
})
|
|
274
301
|
});
|
|
275
302
|
|
|
276
303
|
// src/operations/createBlockTitle.ts
|
|
277
304
|
import { Query as Query5, writeOperation as writeOperation5 } from "roc-db";
|
|
278
|
-
import { z as
|
|
279
|
-
var PayloadSchema =
|
|
305
|
+
import { z as z21 } from "zod";
|
|
306
|
+
var PayloadSchema = z21.object({ parentRef: z21.union([PostRefSchema, BlockRowRefSchema]) }).strict();
|
|
280
307
|
var createBlockTitle = writeOperation5("createBlockTitle", PayloadSchema, (txn) => {
|
|
281
308
|
const ref = txn.createRef("BlockTitle");
|
|
282
309
|
const { postRef } = txn.payload;
|
|
@@ -285,8 +312,8 @@ var createBlockTitle = writeOperation5("createBlockTitle", PayloadSchema, (txn)
|
|
|
285
312
|
|
|
286
313
|
// src/operations/createDraft.ts
|
|
287
314
|
import { Query as Query6, writeOperation as writeOperation6 } from "roc-db";
|
|
288
|
-
import { z as
|
|
289
|
-
var createDraft = writeOperation6("createDraft",
|
|
315
|
+
import { z as z22 } from "zod";
|
|
316
|
+
var createDraft = writeOperation6("createDraft", z22.object({ postRef: PostRefSchema }).strict(), (txn) => {
|
|
290
317
|
const ref = txn.createRef("Draft");
|
|
291
318
|
const { postRef } = txn.payload;
|
|
292
319
|
return Query6(() => txn.createEntity(ref, {
|
|
@@ -298,11 +325,11 @@ var createDraft = writeOperation6("createDraft", z20.object({ postRef: PostRefSc
|
|
|
298
325
|
|
|
299
326
|
// src/operations/createPost.ts
|
|
300
327
|
import { Query as Query7, writeOperation as writeOperation7 } from "roc-db";
|
|
301
|
-
import { z as
|
|
302
|
-
var PayloadSchema2 =
|
|
303
|
-
title:
|
|
304
|
-
slug:
|
|
305
|
-
tags:
|
|
328
|
+
import { z as z23 } from "zod";
|
|
329
|
+
var PayloadSchema2 = z23.object({
|
|
330
|
+
title: z23.string(),
|
|
331
|
+
slug: z23.string().optional(),
|
|
332
|
+
tags: z23.array(z23.string()).default([])
|
|
306
333
|
}).strict();
|
|
307
334
|
var createPost = writeOperation7("createPost", PayloadSchema2, (txn) => {
|
|
308
335
|
const ref = txn.createRef("Post");
|
|
@@ -313,21 +340,30 @@ var createPost = writeOperation7("createPost", PayloadSchema2, (txn) => {
|
|
|
313
340
|
}));
|
|
314
341
|
});
|
|
315
342
|
|
|
343
|
+
// src/operations/createUser.ts
|
|
344
|
+
import { Query as Query8, writeOperation as writeOperation8 } from "roc-db";
|
|
345
|
+
import { z as z24 } from "zod";
|
|
346
|
+
var createUser = writeOperation8("createUser", z24.object({ email: z24.string() }), (txn) => {
|
|
347
|
+
const ref = txn.createRef("User");
|
|
348
|
+
const { email } = txn.payload;
|
|
349
|
+
return Query8(() => txn.createEntity(ref, { data: { email } }));
|
|
350
|
+
});
|
|
351
|
+
|
|
316
352
|
// src/operations/deleteBlocks.ts
|
|
317
|
-
import { Query as
|
|
318
|
-
import { z as
|
|
353
|
+
import { Query as Query9, QueryChain as QueryChain4, writeOperation as writeOperation9 } from "roc-db";
|
|
354
|
+
import { z as z25 } from "zod";
|
|
319
355
|
var DeleteBlockQuery = (txn, blockRef) => {
|
|
320
|
-
return QueryChain4(
|
|
356
|
+
return QueryChain4(Query9(() => txn.readEntity(blockRef)), Query9((block) => {
|
|
321
357
|
return txn.readEntity(block.parents.parent, true);
|
|
322
|
-
}),
|
|
358
|
+
}), Query9((post) => {
|
|
323
359
|
return txn.patchEntity(post.ref, {
|
|
324
360
|
children: {
|
|
325
361
|
blocks: post.children.blocks.filter((ref) => ref !== blockRef)
|
|
326
362
|
}
|
|
327
363
|
});
|
|
328
|
-
}),
|
|
364
|
+
}), Query9(() => txn.deleteEntity(blockRef)));
|
|
329
365
|
};
|
|
330
|
-
var deleteBlocks =
|
|
366
|
+
var deleteBlocks = writeOperation9("deleteBlocks", z25.array(z25.union([
|
|
331
367
|
BlockParagraphRefSchema,
|
|
332
368
|
BlockImageRefSchema,
|
|
333
369
|
BlockRowRefSchema
|
|
@@ -337,54 +373,93 @@ var deleteBlocks = writeOperation8("deleteBlocks", z22.array(z22.union([
|
|
|
337
373
|
}, { changeSetOnly: true });
|
|
338
374
|
|
|
339
375
|
// src/operations/deleteDraft.ts
|
|
340
|
-
import { Query as
|
|
341
|
-
var deleteDraft =
|
|
376
|
+
import { Query as Query10, QueryChain as QueryChain5, writeOperation as writeOperation10 } from "roc-db";
|
|
377
|
+
var deleteDraft = writeOperation10("deleteDraft", DraftRefSchema, (txn) => {
|
|
342
378
|
const ref = txn.payload;
|
|
343
|
-
return QueryChain5(
|
|
379
|
+
return QueryChain5(Query10(() => txn.deleteEntity(ref, true)), Query10(() => txn.deleteChangeSet(ref)));
|
|
344
380
|
});
|
|
345
381
|
|
|
346
382
|
// src/operations/deletePost.ts
|
|
347
|
-
import { Query as
|
|
348
|
-
var deletePost =
|
|
383
|
+
import { Query as Query11, writeOperation as writeOperation11 } from "roc-db";
|
|
384
|
+
var deletePost = writeOperation11("deletePost", PostRefSchema, (txn) => {
|
|
349
385
|
const ref = txn.payload;
|
|
350
|
-
return
|
|
386
|
+
return Query11(() => txn.deleteEntity(ref, true));
|
|
351
387
|
});
|
|
352
388
|
|
|
353
389
|
// src/operations/moveBlocks.ts
|
|
354
|
-
import { Query as
|
|
355
|
-
import { z as
|
|
356
|
-
var PayloadSchema3 =
|
|
357
|
-
refs:
|
|
358
|
-
targetPosition:
|
|
390
|
+
import { Query as Query12, QueryChain as QueryChain6, writeOperation as writeOperation12 } from "roc-db";
|
|
391
|
+
import { z as z26 } from "zod";
|
|
392
|
+
var PayloadSchema3 = z26.object({
|
|
393
|
+
refs: z26.array(z26.union([BlockParagraphRefSchema, BlockRowRefSchema])),
|
|
394
|
+
targetPosition: z26.number().min(0)
|
|
359
395
|
}).strict();
|
|
360
|
-
var moveBlocks =
|
|
396
|
+
var moveBlocks = writeOperation12("moveBlocks", PayloadSchema3, (txn) => {
|
|
361
397
|
const { refs } = txn.payload;
|
|
362
|
-
return QueryChain6(
|
|
398
|
+
return QueryChain6(Query12(() => txn.batchReadEntities(refs)), Query12((items) => {
|
|
363
399
|
return "todo";
|
|
364
400
|
}));
|
|
365
401
|
});
|
|
366
402
|
|
|
403
|
+
// src/operations/pageBlocks.ts
|
|
404
|
+
import { Query as Query13, readOperation } from "roc-db";
|
|
405
|
+
import { z as z27 } from "zod";
|
|
406
|
+
var pageBlocks = readOperation("pageBlocks", z27.object({
|
|
407
|
+
size: z27.number().default(100),
|
|
408
|
+
parentRef: z27.string().optional()
|
|
409
|
+
}), (txn) => {
|
|
410
|
+
const { size, parentRef } = txn.payload;
|
|
411
|
+
return Query13(() => txn.pageEntities({
|
|
412
|
+
entities: ["BlockImage", "BlockParagraph"],
|
|
413
|
+
size,
|
|
414
|
+
childrenOf: parentRef ? [parentRef] : []
|
|
415
|
+
}));
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
// src/operations/pageEmptyEntitiesArray.ts
|
|
419
|
+
import { Query as Query14, readOperation as readOperation2 } from "roc-db";
|
|
420
|
+
import { z as z28 } from "zod";
|
|
421
|
+
var pageEmptyEntitiesArray = readOperation2("pageEmptyEntitiesArray", z28.object({ size: z28.number().default(100) }), (txn) => {
|
|
422
|
+
const { size } = txn.payload;
|
|
423
|
+
return Query14(() => txn.pageEntities({ entities: [], size }));
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
// src/operations/pagePosts.ts
|
|
427
|
+
import { Query as Query15, readOperation as readOperation3 } from "roc-db";
|
|
428
|
+
import { z as z29 } from "zod";
|
|
429
|
+
var pagePosts = readOperation3("pagePosts", z29.object({ size: z29.number().default(100) }).default({}), (txn) => {
|
|
430
|
+
const { size } = txn.payload;
|
|
431
|
+
return Query15(() => txn.pageEntities({ entities: ["Post"], size }));
|
|
432
|
+
});
|
|
433
|
+
|
|
434
|
+
// src/operations/pageSplat.ts
|
|
435
|
+
import { Query as Query16, readOperation as readOperation4 } from "roc-db";
|
|
436
|
+
import { z as z30 } from "zod";
|
|
437
|
+
var pageSplat = readOperation4("pageSplat", z30.object({ size: z30.number().default(100) }), (txn) => {
|
|
438
|
+
const { size } = txn.payload;
|
|
439
|
+
return Query16(() => txn.pageEntities({ entities: "*", size }));
|
|
440
|
+
});
|
|
441
|
+
|
|
367
442
|
// src/operations/pagePostsByTag.ts
|
|
368
|
-
import { Query as
|
|
369
|
-
import { z as
|
|
370
|
-
var pagePostsByTag =
|
|
443
|
+
import { Query as Query17, readOperation as readOperation5 } from "roc-db";
|
|
444
|
+
import { z as z31 } from "zod";
|
|
445
|
+
var pagePostsByTag = readOperation5("pagePostsByTag", z31.string(), (txn) => {
|
|
371
446
|
const tag = txn.payload;
|
|
372
|
-
return
|
|
447
|
+
return Query17(() => txn.pageEntitiesByIndex("Post", "tags", tag));
|
|
373
448
|
});
|
|
374
449
|
|
|
375
450
|
// src/operations/readEntity.ts
|
|
376
|
-
import { NotFoundError, Query as
|
|
377
|
-
import { z as
|
|
378
|
-
var readEntity =
|
|
451
|
+
import { NotFoundError, Query as Query18, QueryChain as QueryChain7, readOperation as readOperation6 } from "roc-db";
|
|
452
|
+
import { z as z32 } from "zod";
|
|
453
|
+
var readEntity = readOperation6("readEntity", z32.string(), (txn) => {
|
|
379
454
|
const ref = txn.payload;
|
|
380
|
-
return QueryChain7(
|
|
455
|
+
return QueryChain7(Query18(() => txn.readEntity(ref)), Query18((entity) => {
|
|
381
456
|
if (!entity) {
|
|
382
457
|
throw new NotFoundError(ref);
|
|
383
458
|
}
|
|
384
459
|
return entity;
|
|
385
460
|
}));
|
|
386
461
|
}, {
|
|
387
|
-
outputSchema:
|
|
462
|
+
outputSchema: z32.union([
|
|
388
463
|
PostSchema,
|
|
389
464
|
BlockImageSchema,
|
|
390
465
|
BlockParagraphSchema
|
|
@@ -392,11 +467,11 @@ var readEntity = readOperation2("readEntity", z25.string(), (txn) => {
|
|
|
392
467
|
});
|
|
393
468
|
|
|
394
469
|
// src/operations/readMutation.ts
|
|
395
|
-
import { NotFoundError as NotFoundError2, Query as
|
|
396
|
-
import { z as
|
|
397
|
-
var readMutation =
|
|
470
|
+
import { NotFoundError as NotFoundError2, Query as Query19, QueryChain as QueryChain8, readOperation as readOperation7 } from "roc-db";
|
|
471
|
+
import { z as z33 } from "zod";
|
|
472
|
+
var readMutation = readOperation7("readMutation", z33.string(), (txn) => {
|
|
398
473
|
const ref = txn.payload;
|
|
399
|
-
return QueryChain8(
|
|
474
|
+
return QueryChain8(Query19(() => txn.readMutation(ref)), Query19((entity) => {
|
|
400
475
|
if (!entity) {
|
|
401
476
|
throw new NotFoundError2(ref);
|
|
402
477
|
}
|
|
@@ -405,49 +480,49 @@ var readMutation = readOperation3("readMutation", z26.string(), (txn) => {
|
|
|
405
480
|
});
|
|
406
481
|
|
|
407
482
|
// src/operations/readPost.ts
|
|
408
|
-
import { Query as
|
|
409
|
-
var readPost =
|
|
483
|
+
import { Query as Query20, readOperation as readOperation8 } from "roc-db";
|
|
484
|
+
var readPost = readOperation8("readPost", PostRefSchema, (txn) => {
|
|
410
485
|
const ref = txn.payload;
|
|
411
|
-
return
|
|
486
|
+
return Query20(() => txn.readEntity(ref, true));
|
|
412
487
|
}, { outputSchema: PostSchema });
|
|
413
488
|
|
|
414
489
|
// src/operations/readPostBySlug.ts
|
|
415
|
-
import { Query as
|
|
416
|
-
import { z as
|
|
417
|
-
var readPostBySlug =
|
|
490
|
+
import { Query as Query21, readOperation as readOperation9 } from "roc-db";
|
|
491
|
+
import { z as z34 } from "zod";
|
|
492
|
+
var readPostBySlug = readOperation9("readPostBySlug", z34.string(), (txn) => {
|
|
418
493
|
const slug = txn.payload;
|
|
419
|
-
return
|
|
494
|
+
return Query21(() => txn.readEntityByUniqueField("Post", "slug", slug));
|
|
420
495
|
}, { outputSchema: PostSchema });
|
|
421
496
|
|
|
422
497
|
// src/operations/testTransactionalEdits.ts
|
|
423
498
|
import { expect } from "bun:test";
|
|
424
|
-
import { Query as
|
|
425
|
-
import { z as
|
|
499
|
+
import { Query as Query22, QueryChain as QueryChain9, writeOperation as writeOperation13 } from "roc-db";
|
|
500
|
+
import { z as z35 } from "zod";
|
|
426
501
|
var TestCreatePatchDeleteInSameTransaction = (txn, name) => {
|
|
427
502
|
const postRef = txn.createRef("Post");
|
|
428
|
-
QueryChain9(
|
|
503
|
+
QueryChain9(Query22(() => txn.createEntity(postRef, { data: { name } })), Query22(() => txn.patchEntity(postRef, { data: { foo: "bar" } })), Query22((post) => {
|
|
429
504
|
expect(post.data.name).toBe(name);
|
|
430
505
|
expect(post.data.foo).toBe("bar");
|
|
431
|
-
}),
|
|
506
|
+
}), Query22(() => txn.patchEntity(postRef, { data: { foo: null, bar: "foo" } })), Query22((post) => {
|
|
432
507
|
expect(post.data.name).toBe(name);
|
|
433
508
|
expect(post.data.foo).toBeUndefined();
|
|
434
509
|
expect(post.data.bar).toBe("foo");
|
|
435
510
|
expect(txn.log).toHaveLength(1);
|
|
436
511
|
expect(txn.log.get(postRef)[0]).toBe("create");
|
|
437
|
-
}),
|
|
512
|
+
}), Query22((post) => txn.deleteEntity(postRef)), Query22((res) => {
|
|
438
513
|
expect(res).toBe(1);
|
|
439
514
|
expect(txn.log).toHaveLength(0);
|
|
440
515
|
}));
|
|
441
516
|
};
|
|
442
517
|
var TestUpdateAndDeleteInSameTransaction = (txn, ref) => {
|
|
443
|
-
return QueryChain9(
|
|
518
|
+
return QueryChain9(Query22(() => txn.patchEntity(ref, { data: { foo: "bar" } })), Query22((post) => {
|
|
444
519
|
expect(post.data.foo).toBe("bar");
|
|
445
|
-
}),
|
|
520
|
+
}), Query22(() => txn.patchEntity(ref, { data: { foo: null, bar: "foo" } })), Query22((post) => {
|
|
446
521
|
expect(post.data.foo).toBeUndefined();
|
|
447
522
|
expect(post.data.bar).toBe("foo");
|
|
448
523
|
expect(txn.log).toHaveLength(1);
|
|
449
524
|
expect(txn.log.get(ref)[0]).toBe("update");
|
|
450
|
-
}),
|
|
525
|
+
}), Query22((post) => txn.deleteEntity(ref)), Query22((res) => {
|
|
451
526
|
expect(res).toBe(1);
|
|
452
527
|
expect(txn.log).toHaveLength(1);
|
|
453
528
|
expect(txn.log.get(ref)[0]).toBe("delete");
|
|
@@ -455,14 +530,14 @@ var TestUpdateAndDeleteInSameTransaction = (txn, ref) => {
|
|
|
455
530
|
};
|
|
456
531
|
var TestCreateOnExistingRef = (txn) => {
|
|
457
532
|
const ref = txn.createRef("Post");
|
|
458
|
-
return QueryChain9(
|
|
533
|
+
return QueryChain9(Query22(() => txn.createEntity(ref, { data: { foo: "bar" } })), Query22(() => txn.createEntity(ref, { data: { foo: "bar" } })));
|
|
459
534
|
};
|
|
460
|
-
var PayloadSchema4 =
|
|
461
|
-
name:
|
|
535
|
+
var PayloadSchema4 = z35.object({
|
|
536
|
+
name: z35.string().optional(),
|
|
462
537
|
post1ref: PostRefSchema.optional(),
|
|
463
538
|
post2ref: PostRefSchema.optional()
|
|
464
539
|
}).strict();
|
|
465
|
-
var testTransactionalEdits =
|
|
540
|
+
var testTransactionalEdits = writeOperation13("testTransactionalEdits", PayloadSchema4, (txn) => {
|
|
466
541
|
const { name, post1ref, post2ref } = txn.payload;
|
|
467
542
|
if (name)
|
|
468
543
|
return TestCreatePatchDeleteInSameTransaction(txn, name);
|
|
@@ -473,30 +548,30 @@ var testTransactionalEdits = writeOperation12("testTransactionalEdits", PayloadS
|
|
|
473
548
|
}, {});
|
|
474
549
|
|
|
475
550
|
// src/operations/updateBlockParagraph.ts
|
|
476
|
-
import { Query as
|
|
477
|
-
import { z as
|
|
478
|
-
var updateBlockParagraph =
|
|
551
|
+
import { Query as Query23, writeOperation as writeOperation14 } from "roc-db";
|
|
552
|
+
import { z as z36 } from "zod";
|
|
553
|
+
var updateBlockParagraph = writeOperation14("updateBlockParagraph", z36.object({
|
|
479
554
|
ref: BlockParagraphRefSchema,
|
|
480
|
-
content:
|
|
555
|
+
content: z36.string()
|
|
481
556
|
}), (txn) => {
|
|
482
557
|
const { ref, content } = txn.payload;
|
|
483
|
-
return
|
|
558
|
+
return Query23(() => txn.patchEntity(ref, {
|
|
484
559
|
data: { content }
|
|
485
560
|
}));
|
|
486
561
|
}, { outputSchema: BlockParagraphSchema });
|
|
487
562
|
|
|
488
563
|
// src/operations/updatePost.ts
|
|
489
|
-
import { Query as
|
|
490
|
-
import { z as
|
|
491
|
-
var PayloadSchema5 =
|
|
564
|
+
import { Query as Query24, writeOperation as writeOperation15 } from "roc-db";
|
|
565
|
+
import { z as z37 } from "zod";
|
|
566
|
+
var PayloadSchema5 = z37.object({
|
|
492
567
|
ref: PostRefSchema,
|
|
493
|
-
title:
|
|
494
|
-
tags:
|
|
568
|
+
title: z37.string().optional(),
|
|
569
|
+
tags: z37.array(z37.string()).optional().default([]),
|
|
495
570
|
authorRef: UserRefSchema.optional()
|
|
496
571
|
});
|
|
497
|
-
var updatePost =
|
|
572
|
+
var updatePost = writeOperation15("updatePost", PayloadSchema5, (txn) => {
|
|
498
573
|
const { ref, authorRef, ...data } = txn.payload;
|
|
499
|
-
return
|
|
574
|
+
return Query24(() => txn.updateEntity(ref, {
|
|
500
575
|
data,
|
|
501
576
|
parents: { author: authorRef },
|
|
502
577
|
children: { blocks: [] }
|
|
@@ -504,35 +579,35 @@ var updatePost = writeOperation14("updatePost", PayloadSchema5, (txn) => {
|
|
|
504
579
|
}, { outputSchema: PostSchema });
|
|
505
580
|
|
|
506
581
|
// src/operations/updatePostDescription.ts
|
|
507
|
-
import { Query as
|
|
508
|
-
import { z as
|
|
509
|
-
var updatePostDescription =
|
|
582
|
+
import { Query as Query25, writeOperation as writeOperation16 } from "roc-db";
|
|
583
|
+
import { z as z38 } from "zod";
|
|
584
|
+
var updatePostDescription = writeOperation16("updatePostDescription", z38.object({ ref: PostRefSchema, description: z38.string() }), (txn) => {
|
|
510
585
|
const { ref, description } = txn.payload;
|
|
511
|
-
return
|
|
586
|
+
return Query25(() => txn.patchEntity(ref, { data: { description } }));
|
|
512
587
|
}, { debounce: 10, changeSetOnly: true, outputSchema: PostSchema });
|
|
513
588
|
|
|
514
589
|
// src/operations/updatePostSlug.ts
|
|
515
|
-
import { Query as
|
|
516
|
-
import { z as
|
|
517
|
-
var updatePostSlug =
|
|
590
|
+
import { Query as Query26, writeOperation as writeOperation17 } from "roc-db";
|
|
591
|
+
import { z as z39 } from "zod";
|
|
592
|
+
var updatePostSlug = writeOperation17("updatePostSlug", z39.object({ ref: PostRefSchema, slug: z39.string() }), (txn) => {
|
|
518
593
|
const { ref, slug } = txn.payload;
|
|
519
|
-
return
|
|
594
|
+
return Query26(() => txn.patchEntity(ref, { data: { slug } }));
|
|
520
595
|
}, { debounce: 10, outputSchema: PostSchema });
|
|
521
596
|
|
|
522
597
|
// src/operations/updatePostTags.ts
|
|
523
|
-
import { Query as
|
|
524
|
-
import { z as
|
|
525
|
-
var updatePostTags =
|
|
598
|
+
import { Query as Query27, writeOperation as writeOperation18 } from "roc-db";
|
|
599
|
+
import { z as z40 } from "zod";
|
|
600
|
+
var updatePostTags = writeOperation18("updatePostTags", z40.object({ ref: PostRefSchema, tags: z40.array(z40.string()) }), (txn) => {
|
|
526
601
|
const { ref, tags } = txn.payload;
|
|
527
|
-
return
|
|
602
|
+
return Query27(() => txn.patchEntity(ref, { data: { tags } }));
|
|
528
603
|
}, { debounce: 10, outputSchema: PostSchema });
|
|
529
604
|
|
|
530
605
|
// src/operations/updatePostTitle.ts
|
|
531
|
-
import { Query as
|
|
532
|
-
import { z as
|
|
533
|
-
var updatePostTitle =
|
|
606
|
+
import { Query as Query28, writeOperation as writeOperation19 } from "roc-db";
|
|
607
|
+
import { z as z41 } from "zod";
|
|
608
|
+
var updatePostTitle = writeOperation19("updatePostTitle", z41.object({ ref: PostRefSchema, title: z41.string() }), (txn) => {
|
|
534
609
|
const { ref, title } = txn.payload;
|
|
535
|
-
return
|
|
610
|
+
return Query28(() => txn.patchEntity(ref, { data: { title } }));
|
|
536
611
|
}, { debounce: 10, outputSchema: PostSchema });
|
|
537
612
|
|
|
538
613
|
// src/operations/index.ts
|
|
@@ -544,15 +619,20 @@ var operations = [
|
|
|
544
619
|
createBlockRow,
|
|
545
620
|
createDraft,
|
|
546
621
|
createPost,
|
|
622
|
+
createUser,
|
|
547
623
|
deleteBlocks,
|
|
548
624
|
deleteDraft,
|
|
549
625
|
deletePost,
|
|
550
626
|
readPostBySlug,
|
|
551
627
|
moveBlocks,
|
|
552
628
|
pagePostsByTag,
|
|
629
|
+
pageBlocks,
|
|
553
630
|
readEntity,
|
|
554
631
|
readMutation,
|
|
555
632
|
readPost,
|
|
633
|
+
pageEmptyEntitiesArray,
|
|
634
|
+
pagePosts,
|
|
635
|
+
pageSplat,
|
|
556
636
|
testTransactionalEdits,
|
|
557
637
|
updateBlockParagraph,
|
|
558
638
|
updatePost,
|
|
@@ -775,6 +855,67 @@ var testAdapterImplementation = async (adapterConstructor, generateArgs) => {
|
|
|
775
855
|
})).toThrow(BadRequestError);
|
|
776
856
|
});
|
|
777
857
|
});
|
|
858
|
+
describe("paging", () => {
|
|
859
|
+
let adapter;
|
|
860
|
+
let post1ref;
|
|
861
|
+
beforeAll(async () => {
|
|
862
|
+
adapter = await createAdapter();
|
|
863
|
+
const [post1] = await adapter.createPost({ title: "Post 1" });
|
|
864
|
+
post1ref = post1.ref;
|
|
865
|
+
const [user] = await adapter.createUser({ email: "foo@bar.com" });
|
|
866
|
+
const [draft1] = await adapter.createDraft({
|
|
867
|
+
postRef: post1.ref
|
|
868
|
+
});
|
|
869
|
+
const [post2] = await adapter.createPost({ title: "Post 2" });
|
|
870
|
+
const [draft2] = await adapter.createDraft({
|
|
871
|
+
postRef: post2.ref
|
|
872
|
+
});
|
|
873
|
+
const draft1adapter = adapter.changeSet(draft1.ref);
|
|
874
|
+
await draft1adapter.createBlockImage({
|
|
875
|
+
parentRef: post1.ref,
|
|
876
|
+
url: "https://example.com/image.png"
|
|
877
|
+
});
|
|
878
|
+
await draft1adapter.createBlockParagraph({
|
|
879
|
+
parentRef: post1.ref
|
|
880
|
+
});
|
|
881
|
+
await adapter.applyDraft(draft1.ref);
|
|
882
|
+
const draft2adapter = adapter.changeSet(draft2.ref);
|
|
883
|
+
await draft2adapter.createBlockImage({
|
|
884
|
+
parentRef: post2.ref,
|
|
885
|
+
url: "https://example.com/image.png"
|
|
886
|
+
});
|
|
887
|
+
await draft2adapter.createBlockParagraph({
|
|
888
|
+
parentRef: post2.ref
|
|
889
|
+
});
|
|
890
|
+
await adapter.applyDraft(draft2.ref);
|
|
891
|
+
});
|
|
892
|
+
test("limited to given collection", async () => {
|
|
893
|
+
const res = await adapter.pagePosts();
|
|
894
|
+
expect2(res).toHaveLength(2);
|
|
895
|
+
});
|
|
896
|
+
test("limit", async () => {
|
|
897
|
+
const res = await adapter.pagePosts({ size: 1 });
|
|
898
|
+
expect2(res).toHaveLength(1);
|
|
899
|
+
});
|
|
900
|
+
test("pageSplat", async () => {
|
|
901
|
+
const res = await adapter.pageSplat({});
|
|
902
|
+
expect2(res).toHaveLength(11);
|
|
903
|
+
});
|
|
904
|
+
test("pageEmptyEntitiesArray", async () => {
|
|
905
|
+
const res = await adapter.pageEmptyEntitiesArray({});
|
|
906
|
+
expect2(res).toHaveLength(0);
|
|
907
|
+
});
|
|
908
|
+
test("pageBlocks", async () => {
|
|
909
|
+
const res = await adapter.pageBlocks({});
|
|
910
|
+
expect2(res).toHaveLength(4);
|
|
911
|
+
});
|
|
912
|
+
test("pageBlocks with parent ref", async () => {
|
|
913
|
+
const res = await adapter.pageBlocks({ parentRef: post1ref });
|
|
914
|
+
expect2(res).toHaveLength(2);
|
|
915
|
+
expect2(res[0].parents.parent).toBe(post1ref);
|
|
916
|
+
expect2(res[1].parents.parent).toBe(post1ref);
|
|
917
|
+
});
|
|
918
|
+
});
|
|
778
919
|
describe("changeSet", () => {
|
|
779
920
|
let postRef, draftRef, changeSetAdapter, blockParagraph1, post, blockRow, blockParagraph2, draft;
|
|
780
921
|
beforeAll(async () => {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Entity } from "roc-db";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export declare const BlockImageEntity: Entity<"BlockImage", z.ZodObject<{
|
|
4
|
+
url: z.ZodString;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
url: string;
|
|
7
|
+
}, {
|
|
8
|
+
url: string;
|
|
9
|
+
}>, z.ZodObject<{}, z.UnknownKeysParam, z.ZodTypeAny, {}, {}>, z.ZodObject<{
|
|
10
|
+
parent: z.ZodType<`Post/${string}`, z.ZodTypeDef, `Post/${string}`>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
parent: `Post/${string}`;
|
|
13
|
+
}, {
|
|
14
|
+
parent: `Post/${string}`;
|
|
15
|
+
}>, z.ZodObject<{}, z.UnknownKeysParam, z.ZodTypeAny, {}, {}>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Entity } from "roc-db";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export declare const UserEntity: Entity<"User", z.ZodObject<{
|
|
4
|
+
email: z.ZodString;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
email: string;
|
|
7
|
+
}, {
|
|
8
|
+
email: string;
|
|
9
|
+
}>, z.ZodObject<{}, z.UnknownKeysParam, z.ZodTypeAny, {}, {}>, z.ZodObject<{}, z.UnknownKeysParam, z.ZodTypeAny, {}, {}>, z.ZodObject<{}, z.UnknownKeysParam, z.ZodTypeAny, {}, {}>>;
|
|
@@ -10,6 +10,18 @@ export declare const entities: (import("roc-db").Entity<"Draft", import("zod").Z
|
|
|
10
10
|
post: `Post/${string}`;
|
|
11
11
|
}, {
|
|
12
12
|
post: `Post/${string}`;
|
|
13
|
+
}>, import("zod").ZodObject<{}, import("zod").UnknownKeysParam, import("zod").ZodTypeAny, {}, {}>> | import("roc-db").Entity<"BlockImage", import("zod").ZodObject<{
|
|
14
|
+
url: import("zod").ZodString;
|
|
15
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
16
|
+
url: string;
|
|
17
|
+
}, {
|
|
18
|
+
url: string;
|
|
19
|
+
}>, import("zod").ZodObject<{}, import("zod").UnknownKeysParam, import("zod").ZodTypeAny, {}, {}>, import("zod").ZodObject<{
|
|
20
|
+
parent: import("zod").ZodType<`Post/${string}`, import("zod").ZodTypeDef, `Post/${string}`>;
|
|
21
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
22
|
+
parent: `Post/${string}`;
|
|
23
|
+
}, {
|
|
24
|
+
parent: `Post/${string}`;
|
|
13
25
|
}>, import("zod").ZodObject<{}, import("zod").UnknownKeysParam, import("zod").ZodTypeAny, {}, {}>> | import("roc-db").Entity<"Post", import("zod").ZodObject<{
|
|
14
26
|
title: import("zod").ZodString;
|
|
15
27
|
text: import("zod").ZodOptional<import("zod").ZodString>;
|
|
@@ -76,4 +88,10 @@ export declare const entities: (import("roc-db").Entity<"Draft", import("zod").Z
|
|
|
76
88
|
post: `Post/${string}`;
|
|
77
89
|
}, {
|
|
78
90
|
post: `Post/${string}`;
|
|
79
|
-
}>, import("zod").ZodObject<{}, import("zod").UnknownKeysParam, import("zod").ZodTypeAny, {}, {}>>)
|
|
91
|
+
}>, import("zod").ZodObject<{}, import("zod").UnknownKeysParam, import("zod").ZodTypeAny, {}, {}>> | import("roc-db").Entity<"User", import("zod").ZodObject<{
|
|
92
|
+
email: import("zod").ZodString;
|
|
93
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
94
|
+
email: string;
|
|
95
|
+
}, {
|
|
96
|
+
email: string;
|
|
97
|
+
}>, import("zod").ZodObject<{}, import("zod").UnknownKeysParam, import("zod").ZodTypeAny, {}, {}>, import("zod").ZodObject<{}, import("zod").UnknownKeysParam, import("zod").ZodTypeAny, {}, {}>, import("zod").ZodObject<{}, import("zod").UnknownKeysParam, import("zod").ZodTypeAny, {}, {}>>)[];
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const createBlockImage: import("roc-db").WriteOperation<"createBlockImage", z.ZodObject<{
|
|
3
|
-
|
|
3
|
+
parentRef: z.ZodType<`Post/${string}`, z.ZodTypeDef, `Post/${string}`>;
|
|
4
|
+
url: z.ZodString;
|
|
4
5
|
}, "strict", z.ZodTypeAny, {
|
|
5
|
-
|
|
6
|
+
url: string;
|
|
7
|
+
parentRef: `Post/${string}`;
|
|
6
8
|
}, {
|
|
7
|
-
|
|
9
|
+
url: string;
|
|
10
|
+
parentRef: `Post/${string}`;
|
|
8
11
|
}>>;
|
|
@@ -1,124 +1 @@
|
|
|
1
|
-
export declare const operations:
|
|
2
|
-
postRef: import("zod").ZodType<`Post/${string}`, import("zod").ZodTypeDef, `Post/${string}`>;
|
|
3
|
-
}, "strict", import("zod").ZodTypeAny, {
|
|
4
|
-
postRef: `Post/${string}`;
|
|
5
|
-
}, {
|
|
6
|
-
postRef: `Post/${string}`;
|
|
7
|
-
}>>, import("roc-db").WriteOperation<"createBlockTitle", import("zod").ZodObject<{
|
|
8
|
-
parentRef: import("zod").ZodUnion<[import("zod").ZodType<`Post/${string}`, import("zod").ZodTypeDef, `Post/${string}`>, import("zod").ZodType<`BlockRow/${string}`, import("zod").ZodTypeDef, `BlockRow/${string}`>]>;
|
|
9
|
-
}, "strict", import("zod").ZodTypeAny, {
|
|
10
|
-
parentRef: `Post/${string}` | `BlockRow/${string}`;
|
|
11
|
-
}, {
|
|
12
|
-
parentRef: `Post/${string}` | `BlockRow/${string}`;
|
|
13
|
-
}>>, import("roc-db").WriteOperation<"createBlockParagraph", import("zod").ZodObject<{
|
|
14
|
-
parentRef: import("zod").ZodUnion<[import("zod").ZodType<`Post/${string}`, import("zod").ZodTypeDef, `Post/${string}`>, import("zod").ZodType<`BlockRow/${string}`, import("zod").ZodTypeDef, `BlockRow/${string}`>]>;
|
|
15
|
-
}, "strict", import("zod").ZodTypeAny, {
|
|
16
|
-
parentRef: `Post/${string}` | `BlockRow/${string}`;
|
|
17
|
-
}, {
|
|
18
|
-
parentRef: `Post/${string}` | `BlockRow/${string}`;
|
|
19
|
-
}>>, import("roc-db").WriteOperation<"createBlockRow", import("zod").ZodObject<{
|
|
20
|
-
parentRef: import("zod").ZodUnion<[import("zod").ZodType<`Post/${string}`, import("zod").ZodTypeDef, `Post/${string}`>, import("zod").ZodType<`BlockRow/${string}`, import("zod").ZodTypeDef, `BlockRow/${string}`>]>;
|
|
21
|
-
}, "strict", import("zod").ZodTypeAny, {
|
|
22
|
-
parentRef: `Post/${string}` | `BlockRow/${string}`;
|
|
23
|
-
}, {
|
|
24
|
-
parentRef: `Post/${string}` | `BlockRow/${string}`;
|
|
25
|
-
}>>, import("roc-db").WriteOperation<"createDraft", import("zod").ZodObject<{
|
|
26
|
-
postRef: import("zod").ZodType<`Post/${string}`, import("zod").ZodTypeDef, `Post/${string}`>;
|
|
27
|
-
}, "strict", import("zod").ZodTypeAny, {
|
|
28
|
-
postRef: `Post/${string}`;
|
|
29
|
-
}, {
|
|
30
|
-
postRef: `Post/${string}`;
|
|
31
|
-
}>>, import("roc-db").WriteOperation<"createPost", import("zod").ZodObject<{
|
|
32
|
-
title: import("zod").ZodString;
|
|
33
|
-
slug: import("zod").ZodOptional<import("zod").ZodString>;
|
|
34
|
-
tags: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
35
|
-
}, "strict", import("zod").ZodTypeAny, {
|
|
36
|
-
title: string;
|
|
37
|
-
tags: string[];
|
|
38
|
-
slug?: string | undefined;
|
|
39
|
-
}, {
|
|
40
|
-
title: string;
|
|
41
|
-
tags?: string[] | undefined;
|
|
42
|
-
slug?: string | undefined;
|
|
43
|
-
}>>, import("roc-db").WriteOperation<"deleteBlocks", import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodType<`BlockParagraph/${string}`, import("zod").ZodTypeDef, `BlockParagraph/${string}`>, import("zod").ZodType<`BlockImage/${string}`, import("zod").ZodTypeDef, `BlockImage/${string}`>, import("zod").ZodType<`BlockRow/${string}`, import("zod").ZodTypeDef, `BlockRow/${string}`>]>, "many">>, import("roc-db").WriteOperation<"deleteDraft", import("zod").ZodType<`Draft/${string}`, import("zod").ZodTypeDef, `Draft/${string}`>>, import("roc-db").WriteOperation<"deletePost", import("zod").ZodType<`Post/${string}`, import("zod").ZodTypeDef, `Post/${string}`>>, any, import("roc-db").WriteOperation<"moveBlocks", import("zod").ZodObject<{
|
|
44
|
-
refs: import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodType<`BlockParagraph/${string}`, import("zod").ZodTypeDef, `BlockParagraph/${string}`>, import("zod").ZodType<`BlockRow/${string}`, import("zod").ZodTypeDef, `BlockRow/${string}`>]>, "many">;
|
|
45
|
-
targetPosition: import("zod").ZodNumber;
|
|
46
|
-
}, "strict", import("zod").ZodTypeAny, {
|
|
47
|
-
refs: (`BlockParagraph/${string}` | `BlockRow/${string}`)[];
|
|
48
|
-
targetPosition: number;
|
|
49
|
-
}, {
|
|
50
|
-
refs: (`BlockParagraph/${string}` | `BlockRow/${string}`)[];
|
|
51
|
-
targetPosition: number;
|
|
52
|
-
}>>, any, any, any, any, import("roc-db").WriteOperation<"testTransactionalEdits", import("zod").ZodObject<{
|
|
53
|
-
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
54
|
-
post1ref: import("zod").ZodOptional<import("zod").ZodType<`Post/${string}`, import("zod").ZodTypeDef, `Post/${string}`>>;
|
|
55
|
-
post2ref: import("zod").ZodOptional<import("zod").ZodType<`Post/${string}`, import("zod").ZodTypeDef, `Post/${string}`>>;
|
|
56
|
-
}, "strict", import("zod").ZodTypeAny, {
|
|
57
|
-
name?: string | undefined;
|
|
58
|
-
post1ref?: `Post/${string}` | undefined;
|
|
59
|
-
post2ref?: `Post/${string}` | undefined;
|
|
60
|
-
}, {
|
|
61
|
-
name?: string | undefined;
|
|
62
|
-
post1ref?: `Post/${string}` | undefined;
|
|
63
|
-
post2ref?: `Post/${string}` | undefined;
|
|
64
|
-
}>>, import("roc-db").WriteOperation<"updateBlockParagraph", import("zod").ZodObject<{
|
|
65
|
-
ref: import("zod").ZodType<`BlockParagraph/${string}`, import("zod").ZodTypeDef, `BlockParagraph/${string}`>;
|
|
66
|
-
content: import("zod").ZodString;
|
|
67
|
-
}, "strip", import("zod").ZodTypeAny, {
|
|
68
|
-
ref: `BlockParagraph/${string}`;
|
|
69
|
-
content: string;
|
|
70
|
-
}, {
|
|
71
|
-
ref: `BlockParagraph/${string}`;
|
|
72
|
-
content: string;
|
|
73
|
-
}>>, import("roc-db").WriteOperation<"updatePost", import("zod").ZodObject<{
|
|
74
|
-
ref: import("zod").ZodType<`Post/${string}`, import("zod").ZodTypeDef, `Post/${string}`>;
|
|
75
|
-
title: import("zod").ZodOptional<import("zod").ZodString>;
|
|
76
|
-
tags: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>>;
|
|
77
|
-
authorRef: import("zod").ZodOptional<import("zod").ZodType<`User/${string}`, import("zod").ZodTypeDef, `User/${string}`>>;
|
|
78
|
-
}, "strip", import("zod").ZodTypeAny, {
|
|
79
|
-
ref: `Post/${string}`;
|
|
80
|
-
tags: string[];
|
|
81
|
-
title?: string | undefined;
|
|
82
|
-
authorRef?: `User/${string}` | undefined;
|
|
83
|
-
}, {
|
|
84
|
-
ref: `Post/${string}`;
|
|
85
|
-
title?: string | undefined;
|
|
86
|
-
tags?: string[] | undefined;
|
|
87
|
-
authorRef?: `User/${string}` | undefined;
|
|
88
|
-
}>>, import("roc-db").WriteOperation<"updatePostDescription", import("zod").ZodObject<{
|
|
89
|
-
ref: import("zod").ZodType<`Post/${string}`, import("zod").ZodTypeDef, `Post/${string}`>;
|
|
90
|
-
description: import("zod").ZodString;
|
|
91
|
-
}, "strip", import("zod").ZodTypeAny, {
|
|
92
|
-
ref: `Post/${string}`;
|
|
93
|
-
description: string;
|
|
94
|
-
}, {
|
|
95
|
-
ref: `Post/${string}`;
|
|
96
|
-
description: string;
|
|
97
|
-
}>>, import("roc-db").WriteOperation<"updatePostSlug", import("zod").ZodObject<{
|
|
98
|
-
ref: import("zod").ZodType<`Post/${string}`, import("zod").ZodTypeDef, `Post/${string}`>;
|
|
99
|
-
slug: import("zod").ZodString;
|
|
100
|
-
}, "strip", import("zod").ZodTypeAny, {
|
|
101
|
-
ref: `Post/${string}`;
|
|
102
|
-
slug: string;
|
|
103
|
-
}, {
|
|
104
|
-
ref: `Post/${string}`;
|
|
105
|
-
slug: string;
|
|
106
|
-
}>>, import("roc-db").WriteOperation<"updatePostTags", import("zod").ZodObject<{
|
|
107
|
-
ref: import("zod").ZodType<`Post/${string}`, import("zod").ZodTypeDef, `Post/${string}`>;
|
|
108
|
-
tags: import("zod").ZodArray<import("zod").ZodString, "many">;
|
|
109
|
-
}, "strip", import("zod").ZodTypeAny, {
|
|
110
|
-
ref: `Post/${string}`;
|
|
111
|
-
tags: string[];
|
|
112
|
-
}, {
|
|
113
|
-
ref: `Post/${string}`;
|
|
114
|
-
tags: string[];
|
|
115
|
-
}>>, import("roc-db").WriteOperation<"updatePostTitle", import("zod").ZodObject<{
|
|
116
|
-
ref: import("zod").ZodType<`Post/${string}`, import("zod").ZodTypeDef, `Post/${string}`>;
|
|
117
|
-
title: import("zod").ZodString;
|
|
118
|
-
}, "strip", import("zod").ZodTypeAny, {
|
|
119
|
-
ref: `Post/${string}`;
|
|
120
|
-
title: string;
|
|
121
|
-
}, {
|
|
122
|
-
ref: `Post/${string}`;
|
|
123
|
-
title: string;
|
|
124
|
-
}>>];
|
|
1
|
+
export declare const operations: any[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pageBlocks: any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pageEmptyEntitiesArray: any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pagePosts: any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pageSplat: any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roc-db/test-utils",
|
|
3
|
-
"version": "0.2.0-pre.
|
|
3
|
+
"version": "0.2.0-pre.54",
|
|
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.
|
|
20
|
+
"roc-db": "0.2.0-pre.54",
|
|
21
21
|
"zod": "3.24.2"
|
|
22
22
|
},
|
|
23
23
|
"keywords": [],
|