@echovisionlab/geul-common 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -0
- package/package.json +3 -2
- package/src/collaboration/artist.ts +12 -14
- package/src/collaboration/campaign.ts +6 -8
- package/src/collaboration/document-layout.ts +6 -8
- package/src/collaboration/document.ts +7 -9
- package/src/collaboration/form.ts +5 -7
- package/src/collaboration/label.ts +9 -11
- package/src/collaboration/map-theme.ts +62 -67
- package/src/collaboration/member-id.ts +2 -2
- package/src/collaboration/metadata-ai.ts +21 -18
- package/src/collaboration/page.ts +2 -2
- package/src/collaboration/post.ts +8 -10
- package/src/collaboration/release.ts +85 -101
- package/src/collaboration/runtime-events.ts +259 -269
- package/src/collaboration/work.ts +33 -31
- package/src/page/types.ts +4 -6
- package/src/post/types.ts +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as z from "zod/mini";
|
|
2
2
|
|
|
3
3
|
export type RuntimeEntityType =
|
|
4
4
|
| "post"
|
|
@@ -237,156 +237,161 @@ export const ogGenerationRuntimeStatusSchema = z.enum([
|
|
|
237
237
|
]);
|
|
238
238
|
|
|
239
239
|
export const ogGenerationLifecycleRuntimePayloadSchema = z
|
|
240
|
-
.
|
|
241
|
-
generationId: z.string().
|
|
242
|
-
runId: z.string().
|
|
240
|
+
.strictObject({
|
|
241
|
+
generationId: z.string().check(z.minLength(1)),
|
|
242
|
+
runId: z.string().check(z.minLength(1)),
|
|
243
243
|
status: ogGenerationRuntimeStatusSchema,
|
|
244
|
-
assetId: z.string().
|
|
245
|
-
assetUrl: z.string().
|
|
246
|
-
errorCode: z.string().
|
|
247
|
-
error: z.string().
|
|
248
|
-
replacementGenerationId: z.string().
|
|
244
|
+
assetId: z.optional(z.string().check(z.minLength(1))),
|
|
245
|
+
assetUrl: z.optional(z.string().check(z.minLength(1))),
|
|
246
|
+
errorCode: z.optional(z.string().check(z.minLength(1))),
|
|
247
|
+
error: z.optional(z.string().check(z.minLength(1))),
|
|
248
|
+
replacementGenerationId: z.optional(z.string().check(z.minLength(1))),
|
|
249
249
|
})
|
|
250
|
-
.
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
.strict();
|
|
250
|
+
.check(
|
|
251
|
+
z.superRefine((payload, ctx) => {
|
|
252
|
+
if (payload.status === "ready" && !payload.assetId) {
|
|
253
|
+
ctx.addIssue({
|
|
254
|
+
code: "custom",
|
|
255
|
+
path: ["assetId"],
|
|
256
|
+
message: "ready OG lifecycle requires assetId",
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
if (payload.status === "failed" && !payload.error) {
|
|
260
|
+
ctx.addIssue({
|
|
261
|
+
code: "custom",
|
|
262
|
+
path: ["error"],
|
|
263
|
+
message: "failed OG lifecycle requires error",
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
if (payload.status === "superseded" && !payload.replacementGenerationId) {
|
|
267
|
+
ctx.addIssue({
|
|
268
|
+
code: "custom",
|
|
269
|
+
path: ["replacementGenerationId"],
|
|
270
|
+
message: "superseded OG lifecycle requires replacementGenerationId",
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
if (payload.status !== "ready" && (payload.assetId || payload.assetUrl)) {
|
|
274
|
+
ctx.addIssue({
|
|
275
|
+
code: "custom",
|
|
276
|
+
path: ["assetId"],
|
|
277
|
+
message: "only ready OG lifecycle may include an asset",
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
if (payload.status !== "superseded" && payload.replacementGenerationId) {
|
|
281
|
+
ctx.addIssue({
|
|
282
|
+
code: "custom",
|
|
283
|
+
path: ["replacementGenerationId"],
|
|
284
|
+
message: "only superseded OG lifecycle may include a replacement",
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
}),
|
|
288
|
+
);
|
|
289
|
+
|
|
290
|
+
export const mediaProcessingRuntimeOutputsSchema = z.strictObject({
|
|
291
|
+
spectrogramAssetId: z.optional(z.string()),
|
|
292
|
+
thumbnailAssetId: z.optional(z.string()),
|
|
293
|
+
hlsGenerationId: z.optional(z.string()),
|
|
294
|
+
durationSeconds: z.optional(z.int().check(z.nonnegative())),
|
|
295
|
+
waveformAssetId: z.optional(z.string()),
|
|
296
|
+
});
|
|
298
297
|
|
|
299
298
|
export const mediaProcessingLifecycleRuntimePayloadSchema = z
|
|
300
|
-
.
|
|
301
|
-
fileId: z.string().
|
|
302
|
-
slotId: z.
|
|
303
|
-
attemptId: z.
|
|
299
|
+
.strictObject({
|
|
300
|
+
fileId: z.string().check(z.minLength(1)),
|
|
301
|
+
slotId: z.optional(z.string()),
|
|
302
|
+
attemptId: z.optional(z.string()),
|
|
304
303
|
status: mediaProcessingRuntimeStatusSchema,
|
|
305
|
-
percentage: z.
|
|
306
|
-
outputs:
|
|
307
|
-
error: z.
|
|
308
|
-
trackId: z.
|
|
309
|
-
releaseId: z.
|
|
310
|
-
})
|
|
311
|
-
.strict()
|
|
312
|
-
.superRefine((payload, ctx) => {
|
|
313
|
-
if (
|
|
314
|
-
payload.status === "processing" &&
|
|
315
|
-
typeof payload.percentage !== "number"
|
|
316
|
-
) {
|
|
317
|
-
ctx.addIssue({
|
|
318
|
-
code: z.ZodIssueCode.custom,
|
|
319
|
-
path: ["percentage"],
|
|
320
|
-
message: "processing media lifecycle requires percentage",
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
if (payload.status === "processing" && payload.outputs) {
|
|
324
|
-
ctx.addIssue({
|
|
325
|
-
code: z.ZodIssueCode.custom,
|
|
326
|
-
path: ["outputs"],
|
|
327
|
-
message: "processing media lifecycle must not include ready outputs",
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
if (payload.status === "ready" && !payload.outputs) {
|
|
331
|
-
ctx.addIssue({
|
|
332
|
-
code: z.ZodIssueCode.custom,
|
|
333
|
-
path: ["outputs"],
|
|
334
|
-
message: "ready media lifecycle requires outputs",
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
if (payload.status === "ready" && typeof payload.percentage === "number") {
|
|
338
|
-
ctx.addIssue({
|
|
339
|
-
code: z.ZodIssueCode.custom,
|
|
340
|
-
path: ["percentage"],
|
|
341
|
-
message: "ready media lifecycle must not include processing percentage",
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
if (payload.status === "failed" && payload.outputs) {
|
|
345
|
-
ctx.addIssue({
|
|
346
|
-
code: z.ZodIssueCode.custom,
|
|
347
|
-
path: ["outputs"],
|
|
348
|
-
message: "failed media lifecycle must not include ready outputs",
|
|
349
|
-
});
|
|
350
|
-
}
|
|
351
|
-
if (payload.status === "failed" && typeof payload.percentage === "number") {
|
|
352
|
-
ctx.addIssue({
|
|
353
|
-
code: z.ZodIssueCode.custom,
|
|
354
|
-
path: ["percentage"],
|
|
355
|
-
message:
|
|
356
|
-
"failed media lifecycle must not include processing percentage",
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
});
|
|
360
|
-
|
|
361
|
-
export const fileIngestLifecycleRuntimePayloadSchema = z
|
|
362
|
-
.object({
|
|
363
|
-
fileId: z.string().min(1),
|
|
364
|
-
uploadId: z.string().optional(),
|
|
365
|
-
mediaKind: z.string().optional(),
|
|
366
|
-
slotId: z.string().optional(),
|
|
367
|
-
attemptId: z.string().optional(),
|
|
368
|
-
source: z.enum(["upload", "embed"]),
|
|
369
|
-
stage: z.enum([
|
|
370
|
-
"uploading",
|
|
371
|
-
"downloading",
|
|
372
|
-
"finalized",
|
|
373
|
-
"attached",
|
|
374
|
-
"completed",
|
|
375
|
-
"expired",
|
|
376
|
-
"failed",
|
|
377
|
-
"unknown",
|
|
378
|
-
]),
|
|
379
|
-
progress: z.number().int().min(0).max(100),
|
|
380
|
-
bytesCompleted: z.number().int().nonnegative().optional(),
|
|
381
|
-
bytesTotal: z.number().int().nonnegative().optional(),
|
|
382
|
-
fileName: z.string().optional(),
|
|
383
|
-
mimeType: z.string().optional(),
|
|
384
|
-
fileSize: z.number().int().nonnegative().optional(),
|
|
385
|
-
error: z.string().optional(),
|
|
386
|
-
trackId: z.string().optional(),
|
|
387
|
-
releaseId: z.string().optional(),
|
|
304
|
+
percentage: z.optional(z.int().check(z.minimum(0), z.maximum(100))),
|
|
305
|
+
outputs: z.optional(mediaProcessingRuntimeOutputsSchema),
|
|
306
|
+
error: z.optional(z.string()),
|
|
307
|
+
trackId: z.optional(z.string()),
|
|
308
|
+
releaseId: z.optional(z.string()),
|
|
388
309
|
})
|
|
389
|
-
.
|
|
310
|
+
.check(
|
|
311
|
+
z.superRefine((payload, ctx) => {
|
|
312
|
+
if (
|
|
313
|
+
payload.status === "processing" &&
|
|
314
|
+
typeof payload.percentage !== "number"
|
|
315
|
+
) {
|
|
316
|
+
ctx.addIssue({
|
|
317
|
+
code: "custom",
|
|
318
|
+
path: ["percentage"],
|
|
319
|
+
message: "processing media lifecycle requires percentage",
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
if (payload.status === "processing" && payload.outputs) {
|
|
323
|
+
ctx.addIssue({
|
|
324
|
+
code: "custom",
|
|
325
|
+
path: ["outputs"],
|
|
326
|
+
message: "processing media lifecycle must not include ready outputs",
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
if (payload.status === "ready" && !payload.outputs) {
|
|
330
|
+
ctx.addIssue({
|
|
331
|
+
code: "custom",
|
|
332
|
+
path: ["outputs"],
|
|
333
|
+
message: "ready media lifecycle requires outputs",
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
if (
|
|
337
|
+
payload.status === "ready" &&
|
|
338
|
+
typeof payload.percentage === "number"
|
|
339
|
+
) {
|
|
340
|
+
ctx.addIssue({
|
|
341
|
+
code: "custom",
|
|
342
|
+
path: ["percentage"],
|
|
343
|
+
message:
|
|
344
|
+
"ready media lifecycle must not include processing percentage",
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
if (payload.status === "failed" && payload.outputs) {
|
|
348
|
+
ctx.addIssue({
|
|
349
|
+
code: "custom",
|
|
350
|
+
path: ["outputs"],
|
|
351
|
+
message: "failed media lifecycle must not include ready outputs",
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
if (
|
|
355
|
+
payload.status === "failed" &&
|
|
356
|
+
typeof payload.percentage === "number"
|
|
357
|
+
) {
|
|
358
|
+
ctx.addIssue({
|
|
359
|
+
code: "custom",
|
|
360
|
+
path: ["percentage"],
|
|
361
|
+
message:
|
|
362
|
+
"failed media lifecycle must not include processing percentage",
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
}),
|
|
366
|
+
);
|
|
367
|
+
|
|
368
|
+
export const fileIngestLifecycleRuntimePayloadSchema = z.strictObject({
|
|
369
|
+
fileId: z.string().check(z.minLength(1)),
|
|
370
|
+
uploadId: z.optional(z.string()),
|
|
371
|
+
mediaKind: z.optional(z.string()),
|
|
372
|
+
slotId: z.optional(z.string()),
|
|
373
|
+
attemptId: z.optional(z.string()),
|
|
374
|
+
source: z.enum(["upload", "embed"]),
|
|
375
|
+
stage: z.enum([
|
|
376
|
+
"uploading",
|
|
377
|
+
"downloading",
|
|
378
|
+
"finalized",
|
|
379
|
+
"attached",
|
|
380
|
+
"completed",
|
|
381
|
+
"expired",
|
|
382
|
+
"failed",
|
|
383
|
+
"unknown",
|
|
384
|
+
]),
|
|
385
|
+
progress: z.int().check(z.minimum(0), z.maximum(100)),
|
|
386
|
+
bytesCompleted: z.optional(z.int().check(z.nonnegative())),
|
|
387
|
+
bytesTotal: z.optional(z.int().check(z.nonnegative())),
|
|
388
|
+
fileName: z.optional(z.string()),
|
|
389
|
+
mimeType: z.optional(z.string()),
|
|
390
|
+
fileSize: z.optional(z.int().check(z.nonnegative())),
|
|
391
|
+
error: z.optional(z.string()),
|
|
392
|
+
trackId: z.optional(z.string()),
|
|
393
|
+
releaseId: z.optional(z.string()),
|
|
394
|
+
});
|
|
390
395
|
|
|
391
396
|
const localeScopedOgEntityTypes = new Set<OgGenerationRuntimeEntityType>([
|
|
392
397
|
"post",
|
|
@@ -397,138 +402,123 @@ const localeScopedOgEntityTypes = new Set<OgGenerationRuntimeEntityType>([
|
|
|
397
402
|
]);
|
|
398
403
|
|
|
399
404
|
const ogGenerationLifecycleRuntimeEventSchema = z
|
|
400
|
-
.
|
|
405
|
+
.strictObject({
|
|
401
406
|
version: z.literal(1),
|
|
402
407
|
kind: z.literal("og.lifecycle"),
|
|
403
408
|
entityType: ogGenerationRuntimeEntityTypeSchema,
|
|
404
|
-
entityId: z.string().
|
|
405
|
-
locale: z.string().
|
|
406
|
-
correlationId: z.string().
|
|
407
|
-
sequence: z.
|
|
408
|
-
timestampMs: z.
|
|
409
|
+
entityId: z.string().check(z.minLength(1)),
|
|
410
|
+
locale: z.optional(z.string().check(z.minLength(1))),
|
|
411
|
+
correlationId: z.string().check(z.minLength(1)),
|
|
412
|
+
sequence: z.optional(z.int()),
|
|
413
|
+
timestampMs: z.int(),
|
|
409
414
|
payload: ogGenerationLifecycleRuntimePayloadSchema,
|
|
410
415
|
})
|
|
411
|
-
.
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
.strict();
|
|
416
|
+
.check(
|
|
417
|
+
z.superRefine((event, ctx) => {
|
|
418
|
+
const requiresLocale = localeScopedOgEntityTypes.has(event.entityType);
|
|
419
|
+
if (requiresLocale && !event.locale) {
|
|
420
|
+
ctx.addIssue({
|
|
421
|
+
code: "custom",
|
|
422
|
+
path: ["locale"],
|
|
423
|
+
message: `${event.entityType} OG lifecycle requires a locale target`,
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
if (!requiresLocale && event.locale) {
|
|
427
|
+
ctx.addIssue({
|
|
428
|
+
code: "custom",
|
|
429
|
+
path: ["locale"],
|
|
430
|
+
message: `${event.entityType} OG lifecycle requires an entity target`,
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
if (event.correlationId !== event.payload.generationId) {
|
|
434
|
+
ctx.addIssue({
|
|
435
|
+
code: "custom",
|
|
436
|
+
path: ["correlationId"],
|
|
437
|
+
message: "OG lifecycle correlationId must equal payload.generationId",
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
}),
|
|
441
|
+
);
|
|
442
|
+
|
|
443
|
+
export const translationLifecycleRuntimePayloadSchema = z.strictObject({
|
|
444
|
+
jobId: z.string().check(z.minLength(1)),
|
|
445
|
+
targetLocale: z.string().check(z.minLength(1)),
|
|
446
|
+
status: z.literal("failed"),
|
|
447
|
+
error: z.optional(z.string()),
|
|
448
|
+
});
|
|
445
449
|
|
|
446
450
|
export const editorRuntimeEventSchema = z.discriminatedUnion("kind", [
|
|
447
451
|
ogGenerationLifecycleRuntimeEventSchema,
|
|
448
|
-
z
|
|
449
|
-
.
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
.
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
.
|
|
480
|
-
|
|
481
|
-
.
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
.
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
.
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
code: z.string().min(1),
|
|
519
|
-
message: z.string(),
|
|
520
|
-
retryable: z.boolean().optional(),
|
|
521
|
-
source: z.enum(["backend", "collab", "worker"]).optional(),
|
|
522
|
-
details: z
|
|
523
|
-
.record(
|
|
524
|
-
z.string(),
|
|
525
|
-
z.union([z.string(), z.number(), z.boolean(), z.null()]),
|
|
526
|
-
)
|
|
527
|
-
.optional(),
|
|
528
|
-
})
|
|
529
|
-
.strict(),
|
|
530
|
-
})
|
|
531
|
-
.strict(),
|
|
452
|
+
z.strictObject({
|
|
453
|
+
version: z.literal(1),
|
|
454
|
+
kind: z.literal("render.complete"),
|
|
455
|
+
entityType: runtimeEntityTypeSchema,
|
|
456
|
+
entityId: z.string().check(z.minLength(1)),
|
|
457
|
+
locale: z.optional(z.string()),
|
|
458
|
+
correlationId: z.optional(z.string()),
|
|
459
|
+
sequence: z.optional(z.int()),
|
|
460
|
+
timestampMs: z.int(),
|
|
461
|
+
payload: z.strictObject({
|
|
462
|
+
contentHash: z.string(),
|
|
463
|
+
success: z.boolean(),
|
|
464
|
+
error: z.optional(z.string()),
|
|
465
|
+
}),
|
|
466
|
+
}),
|
|
467
|
+
z.strictObject({
|
|
468
|
+
version: z.literal(1),
|
|
469
|
+
kind: z.literal("media.processing.lifecycle"),
|
|
470
|
+
entityType: runtimeEntityTypeSchema,
|
|
471
|
+
entityId: z.string().check(z.minLength(1)),
|
|
472
|
+
locale: z.optional(z.string()),
|
|
473
|
+
correlationId: z.optional(z.string()),
|
|
474
|
+
sequence: z.optional(z.int()),
|
|
475
|
+
timestampMs: z.int(),
|
|
476
|
+
payload: mediaProcessingLifecycleRuntimePayloadSchema,
|
|
477
|
+
}),
|
|
478
|
+
z.strictObject({
|
|
479
|
+
version: z.literal(1),
|
|
480
|
+
kind: z.literal("file.ingest.lifecycle"),
|
|
481
|
+
entityType: runtimeEntityTypeSchema,
|
|
482
|
+
entityId: z.string().check(z.minLength(1)),
|
|
483
|
+
locale: z.optional(z.string()),
|
|
484
|
+
correlationId: z.optional(z.string()),
|
|
485
|
+
sequence: z.optional(z.int()),
|
|
486
|
+
timestampMs: z.int(),
|
|
487
|
+
payload: fileIngestLifecycleRuntimePayloadSchema,
|
|
488
|
+
}),
|
|
489
|
+
z.strictObject({
|
|
490
|
+
version: z.literal(1),
|
|
491
|
+
kind: z.literal("translation.lifecycle"),
|
|
492
|
+
entityType: runtimeEntityTypeSchema,
|
|
493
|
+
entityId: z.string().check(z.minLength(1)),
|
|
494
|
+
locale: z.optional(z.string()),
|
|
495
|
+
correlationId: z.optional(z.string()),
|
|
496
|
+
sequence: z.optional(z.int()),
|
|
497
|
+
timestampMs: z.int(),
|
|
498
|
+
payload: translationLifecycleRuntimePayloadSchema,
|
|
499
|
+
}),
|
|
500
|
+
z.strictObject({
|
|
501
|
+
version: z.literal(1),
|
|
502
|
+
kind: z.literal("runtime.error"),
|
|
503
|
+
entityType: runtimeEntityTypeSchema,
|
|
504
|
+
entityId: z.string().check(z.minLength(1)),
|
|
505
|
+
locale: z.optional(z.string()),
|
|
506
|
+
correlationId: z.optional(z.string()),
|
|
507
|
+
sequence: z.optional(z.int()),
|
|
508
|
+
timestampMs: z.int(),
|
|
509
|
+
payload: z.strictObject({
|
|
510
|
+
code: z.string().check(z.minLength(1)),
|
|
511
|
+
message: z.string(),
|
|
512
|
+
retryable: z.optional(z.boolean()),
|
|
513
|
+
source: z.optional(z.enum(["backend", "collab", "worker"])),
|
|
514
|
+
details: z.optional(
|
|
515
|
+
z.record(
|
|
516
|
+
z.string(),
|
|
517
|
+
z.union([z.string(), z.number(), z.boolean(), z.null()]),
|
|
518
|
+
),
|
|
519
|
+
),
|
|
520
|
+
}),
|
|
521
|
+
}),
|
|
532
522
|
]);
|
|
533
523
|
|
|
534
524
|
export function parseEditorRuntimeEventMessage(
|
|
@@ -1,35 +1,37 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as z from "zod/mini";
|
|
2
2
|
|
|
3
|
-
export const workCollabFieldsSchema = z
|
|
4
|
-
.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
3
|
+
export const workCollabFieldsSchema = z.strictObject({
|
|
4
|
+
title: z.optional(z.string()),
|
|
5
|
+
slug: z.optional(z.nullable(z.string())),
|
|
6
|
+
type: z.optional(z.string()),
|
|
7
|
+
summary: z.optional(z.string()),
|
|
8
|
+
featured: z.optional(z.boolean()),
|
|
9
|
+
year: z.optional(z.int().check(z.minimum(1), z.maximum(9999))),
|
|
10
|
+
month: z.optional(z.int().check(z.minimum(1), z.maximum(12))),
|
|
11
|
+
untilYear: z.optional(
|
|
12
|
+
z.nullable(z.int().check(z.minimum(1), z.maximum(9999))),
|
|
13
|
+
),
|
|
14
|
+
untilMonth: z.optional(
|
|
15
|
+
z.nullable(z.int().check(z.minimum(1), z.maximum(12))),
|
|
16
|
+
),
|
|
17
|
+
isPresent: z.optional(z.boolean()),
|
|
18
|
+
metadata: z.optional(z.record(z.string(), z.unknown())),
|
|
19
|
+
featuredImageFileId: z.optional(z.nullable(z.string())),
|
|
20
|
+
creditsVersion: z.optional(z.number()),
|
|
21
|
+
creditOrder: z.optional(
|
|
22
|
+
z.array(
|
|
23
|
+
z.discriminatedUnion("type", [
|
|
24
|
+
z.object({ type: z.literal("group"), id: z.string() }),
|
|
25
|
+
z.object({
|
|
26
|
+
type: z.literal("credit"),
|
|
27
|
+
id: z.string(),
|
|
28
|
+
creditType: z.enum(["artist", "member", "name"]),
|
|
29
|
+
}),
|
|
30
|
+
]),
|
|
31
|
+
),
|
|
32
|
+
),
|
|
33
|
+
clients: z.optional(z.array(z.string())), // Ordered list of client IDs
|
|
34
|
+
});
|
|
33
35
|
|
|
34
36
|
export const WORK_JSON_KEYS: ReadonlySet<
|
|
35
37
|
keyof z.infer<typeof workCollabFieldsSchema>
|
package/src/page/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as z from "zod/mini";
|
|
2
2
|
import type { PageBlockType } from "./block-fixtures.ts";
|
|
3
3
|
|
|
4
4
|
export interface InlineContent {
|
|
@@ -50,8 +50,6 @@ const pageContentSectionSchema = z.custom<Section>(
|
|
|
50
50
|
value !== null && typeof value === "object" && !Array.isArray(value),
|
|
51
51
|
);
|
|
52
52
|
|
|
53
|
-
export const pageContentSchema: z.
|
|
54
|
-
.
|
|
55
|
-
|
|
56
|
-
})
|
|
57
|
-
.strict();
|
|
53
|
+
export const pageContentSchema: z.ZodMiniType<PageContent> = z.strictObject({
|
|
54
|
+
sections: z.array(pageContentSectionSchema),
|
|
55
|
+
});
|
package/src/post/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as z from "zod/mini";
|
|
2
2
|
import type { Block } from "../page/types.ts";
|
|
3
3
|
|
|
4
4
|
export type PostContent = Block[];
|
|
@@ -8,6 +8,6 @@ const postContentBlockSchema = z.custom<Block>(
|
|
|
8
8
|
value !== null && typeof value === "object" && !Array.isArray(value),
|
|
9
9
|
);
|
|
10
10
|
|
|
11
|
-
export const postContentSchema: z.
|
|
11
|
+
export const postContentSchema: z.ZodMiniType<PostContent> = z.array(
|
|
12
12
|
postContentBlockSchema,
|
|
13
13
|
);
|