@elek-io/core 0.7.0 → 0.8.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 +18 -10
- package/dist/browser/index.browser.d.ts +5881 -5883
- package/dist/browser/index.browser.js +322 -319
- package/dist/browser/index.browser.js.map +1 -1
- package/dist/node/index.node.d.ts +5881 -5883
- package/dist/node/index.node.js +339 -336
- package/dist/node/index.node.js.map +1 -1
- package/package.json +1 -1
package/dist/node/index.node.js
CHANGED
|
@@ -219,7 +219,7 @@ var deleteAssetSchema = assetFileSchema.pick({
|
|
|
219
219
|
var countAssetsSchema = z3.object({ projectId: uuidSchema.readonly() });
|
|
220
220
|
|
|
221
221
|
// src/schema/collectionSchema.ts
|
|
222
|
-
import
|
|
222
|
+
import z7 from "zod";
|
|
223
223
|
|
|
224
224
|
// src/schema/entrySchema.ts
|
|
225
225
|
import z5 from "zod";
|
|
@@ -232,153 +232,6 @@ var ValueTypeSchema = z4.enum([
|
|
|
232
232
|
"boolean",
|
|
233
233
|
"reference"
|
|
234
234
|
]);
|
|
235
|
-
var ValueInputTypeSchema = z4.enum([
|
|
236
|
-
// String
|
|
237
|
-
"text",
|
|
238
|
-
"textarea",
|
|
239
|
-
"email",
|
|
240
|
-
// 'password', @todo maybe if there is a usecase
|
|
241
|
-
"url",
|
|
242
|
-
"ip",
|
|
243
|
-
"date",
|
|
244
|
-
"time",
|
|
245
|
-
"datetime",
|
|
246
|
-
"telephone",
|
|
247
|
-
// Number
|
|
248
|
-
"number",
|
|
249
|
-
"range",
|
|
250
|
-
// Boolean
|
|
251
|
-
"toggle",
|
|
252
|
-
// Reference
|
|
253
|
-
"asset",
|
|
254
|
-
"entry"
|
|
255
|
-
// 'sharedValue', // @todo
|
|
256
|
-
]);
|
|
257
|
-
var ValueInputWidthSchema = z4.enum(["12", "6", "4", "3"]);
|
|
258
|
-
var ValueDefinitionBaseSchema = z4.object({
|
|
259
|
-
id: uuidSchema.readonly(),
|
|
260
|
-
label: translatableStringSchema,
|
|
261
|
-
description: translatableStringSchema,
|
|
262
|
-
isRequired: z4.boolean(),
|
|
263
|
-
isDisabled: z4.boolean(),
|
|
264
|
-
isUnique: z4.boolean(),
|
|
265
|
-
inputWidth: ValueInputWidthSchema
|
|
266
|
-
});
|
|
267
|
-
var StringValueDefinitionBaseSchema = ValueDefinitionBaseSchema.extend(
|
|
268
|
-
{
|
|
269
|
-
valueType: z4.literal(ValueTypeSchema.Enum.string),
|
|
270
|
-
defaultValue: z4.string().nullable()
|
|
271
|
-
}
|
|
272
|
-
);
|
|
273
|
-
var textValueDefinitionSchema = StringValueDefinitionBaseSchema.extend(
|
|
274
|
-
{
|
|
275
|
-
inputType: z4.literal(ValueInputTypeSchema.Enum.text),
|
|
276
|
-
min: z4.number().nullable(),
|
|
277
|
-
max: z4.number().nullable()
|
|
278
|
-
}
|
|
279
|
-
);
|
|
280
|
-
var textareaValueDefinitionSchema = StringValueDefinitionBaseSchema.extend({
|
|
281
|
-
inputType: z4.literal(ValueInputTypeSchema.Enum.textarea),
|
|
282
|
-
min: z4.number().nullable(),
|
|
283
|
-
max: z4.number().nullable()
|
|
284
|
-
});
|
|
285
|
-
var emailValueDefinitionSchema = StringValueDefinitionBaseSchema.extend({
|
|
286
|
-
inputType: z4.literal(ValueInputTypeSchema.Enum.email),
|
|
287
|
-
defaultValue: z4.string().email().nullable()
|
|
288
|
-
});
|
|
289
|
-
var urlValueDefinitionSchema = StringValueDefinitionBaseSchema.extend({
|
|
290
|
-
inputType: z4.literal(ValueInputTypeSchema.Enum.url),
|
|
291
|
-
defaultValue: z4.string().url().nullable()
|
|
292
|
-
});
|
|
293
|
-
var ipValueDefinitionSchema = StringValueDefinitionBaseSchema.extend({
|
|
294
|
-
inputType: z4.literal(ValueInputTypeSchema.Enum.ip),
|
|
295
|
-
defaultValue: z4.string().ip().nullable()
|
|
296
|
-
});
|
|
297
|
-
var dateValueDefinitionSchema = StringValueDefinitionBaseSchema.extend(
|
|
298
|
-
{
|
|
299
|
-
inputType: z4.literal(ValueInputTypeSchema.Enum.date),
|
|
300
|
-
defaultValue: z4.string().date().nullable()
|
|
301
|
-
}
|
|
302
|
-
);
|
|
303
|
-
var timeValueDefinitionSchema = StringValueDefinitionBaseSchema.extend(
|
|
304
|
-
{
|
|
305
|
-
inputType: z4.literal(ValueInputTypeSchema.Enum.time),
|
|
306
|
-
defaultValue: z4.string().time().nullable()
|
|
307
|
-
}
|
|
308
|
-
);
|
|
309
|
-
var datetimeValueDefinitionSchema = StringValueDefinitionBaseSchema.extend({
|
|
310
|
-
inputType: z4.literal(ValueInputTypeSchema.Enum.datetime),
|
|
311
|
-
defaultValue: z4.string().datetime().nullable()
|
|
312
|
-
});
|
|
313
|
-
var telephoneValueDefinitionSchema = StringValueDefinitionBaseSchema.extend({
|
|
314
|
-
inputType: z4.literal(ValueInputTypeSchema.Enum.telephone)
|
|
315
|
-
// defaultValue: z.string().e164(), @todo when zod v4 releases @see https://github.com/colinhacks/zod/pull/3476
|
|
316
|
-
});
|
|
317
|
-
var stringValueDefinitionSchema = z4.union([
|
|
318
|
-
textValueDefinitionSchema,
|
|
319
|
-
textareaValueDefinitionSchema,
|
|
320
|
-
emailValueDefinitionSchema,
|
|
321
|
-
urlValueDefinitionSchema,
|
|
322
|
-
ipValueDefinitionSchema,
|
|
323
|
-
dateValueDefinitionSchema,
|
|
324
|
-
timeValueDefinitionSchema,
|
|
325
|
-
datetimeValueDefinitionSchema,
|
|
326
|
-
telephoneValueDefinitionSchema
|
|
327
|
-
]);
|
|
328
|
-
var NumberValueDefinitionBaseSchema = ValueDefinitionBaseSchema.extend(
|
|
329
|
-
{
|
|
330
|
-
valueType: z4.literal(ValueTypeSchema.Enum.number),
|
|
331
|
-
min: z4.number().nullable(),
|
|
332
|
-
max: z4.number().nullable(),
|
|
333
|
-
isUnique: z4.literal(false),
|
|
334
|
-
defaultValue: z4.number().nullable()
|
|
335
|
-
}
|
|
336
|
-
);
|
|
337
|
-
var numberValueDefinitionSchema = NumberValueDefinitionBaseSchema.extend({
|
|
338
|
-
inputType: z4.literal(ValueInputTypeSchema.Enum.number)
|
|
339
|
-
});
|
|
340
|
-
var rangeValueDefinitionSchema = NumberValueDefinitionBaseSchema.extend({
|
|
341
|
-
inputType: z4.literal(ValueInputTypeSchema.Enum.range),
|
|
342
|
-
// Overwrite from nullable to required because a range needs min, max and default to work and is required, since it always returns a number
|
|
343
|
-
isRequired: z4.literal(true),
|
|
344
|
-
min: z4.number(),
|
|
345
|
-
max: z4.number(),
|
|
346
|
-
defaultValue: z4.number()
|
|
347
|
-
});
|
|
348
|
-
var BooleanValueDefinitionBaseSchema = ValueDefinitionBaseSchema.extend({
|
|
349
|
-
valueType: z4.literal(ValueTypeSchema.Enum.boolean),
|
|
350
|
-
// Overwrite from nullable to required because a boolean needs a default to work and is required, since it always is either true or false
|
|
351
|
-
isRequired: z4.literal(true),
|
|
352
|
-
defaultValue: z4.boolean(),
|
|
353
|
-
isUnique: z4.literal(false)
|
|
354
|
-
});
|
|
355
|
-
var toggleValueDefinitionSchema = BooleanValueDefinitionBaseSchema.extend({
|
|
356
|
-
inputType: z4.literal(ValueInputTypeSchema.Enum.toggle)
|
|
357
|
-
});
|
|
358
|
-
var ReferenceValueDefinitionBaseSchema = ValueDefinitionBaseSchema.extend({
|
|
359
|
-
valueType: z4.literal(ValueTypeSchema.Enum.reference)
|
|
360
|
-
});
|
|
361
|
-
var assetValueDefinitionSchema = ReferenceValueDefinitionBaseSchema.extend({
|
|
362
|
-
inputType: z4.literal(ValueInputTypeSchema.Enum.asset),
|
|
363
|
-
allowedMimeTypes: z4.array(supportedAssetMimeTypeSchema).min(1),
|
|
364
|
-
min: z4.number().nullable(),
|
|
365
|
-
max: z4.number().nullable()
|
|
366
|
-
});
|
|
367
|
-
var entryValueDefinitionSchema = ReferenceValueDefinitionBaseSchema.extend({
|
|
368
|
-
inputType: z4.literal(ValueInputTypeSchema.Enum.entry),
|
|
369
|
-
ofCollections: z4.array(uuidSchema),
|
|
370
|
-
min: z4.number().nullable(),
|
|
371
|
-
max: z4.number().nullable()
|
|
372
|
-
});
|
|
373
|
-
var valueDefinitionSchema = z4.union([
|
|
374
|
-
stringValueDefinitionSchema,
|
|
375
|
-
numberValueDefinitionSchema,
|
|
376
|
-
rangeValueDefinitionSchema,
|
|
377
|
-
toggleValueDefinitionSchema,
|
|
378
|
-
assetValueDefinitionSchema,
|
|
379
|
-
entryValueDefinitionSchema
|
|
380
|
-
// sharedValueDefinitionSchema,
|
|
381
|
-
]);
|
|
382
235
|
var valueContentReferenceBase = z4.object({
|
|
383
236
|
id: uuidSchema
|
|
384
237
|
});
|
|
@@ -408,7 +261,7 @@ var resolvedValueContentReferenceSchema = z4.union([
|
|
|
408
261
|
]);
|
|
409
262
|
var directValueBaseSchema = z4.object({
|
|
410
263
|
objectType: z4.literal(objectTypeSchema.Enum.value).readonly(),
|
|
411
|
-
|
|
264
|
+
fieldDefinitionId: uuidSchema.readonly()
|
|
412
265
|
});
|
|
413
266
|
var directStringValueSchema = directValueBaseSchema.extend({
|
|
414
267
|
valueType: z4.literal(ValueTypeSchema.Enum.string).readonly(),
|
|
@@ -429,7 +282,7 @@ var directValueSchema = z4.union([
|
|
|
429
282
|
]);
|
|
430
283
|
var referencedValueSchema = z4.object({
|
|
431
284
|
objectType: z4.literal(objectTypeSchema.Enum.value).readonly(),
|
|
432
|
-
|
|
285
|
+
fieldDefinitionId: uuidSchema.readonly(),
|
|
433
286
|
valueType: z4.literal(ValueTypeSchema.Enum.reference).readonly(),
|
|
434
287
|
content: translatableArrayOf(valueContentReferenceSchema)
|
|
435
288
|
});
|
|
@@ -441,28 +294,216 @@ var resolvedValueSchema = z4.union([
|
|
|
441
294
|
directValueSchema,
|
|
442
295
|
resolvedReferencedValueSchema
|
|
443
296
|
]);
|
|
444
|
-
|
|
445
|
-
|
|
297
|
+
|
|
298
|
+
// src/schema/entrySchema.ts
|
|
299
|
+
var entryFileSchema = baseFileSchema.extend({
|
|
300
|
+
objectType: z5.literal(objectTypeSchema.Enum.entry).readonly(),
|
|
301
|
+
values: z5.array(valueSchema)
|
|
302
|
+
});
|
|
303
|
+
var entrySchema = entryFileSchema.extend({
|
|
304
|
+
values: z5.array(z5.lazy(() => resolvedValueSchema))
|
|
305
|
+
});
|
|
306
|
+
var entryExportSchema = entrySchema.extend({});
|
|
307
|
+
var createEntrySchema = entryFileSchema.omit({
|
|
308
|
+
id: true,
|
|
309
|
+
objectType: true,
|
|
310
|
+
created: true,
|
|
311
|
+
updated: true
|
|
312
|
+
}).extend({
|
|
313
|
+
projectId: uuidSchema.readonly(),
|
|
314
|
+
collectionId: uuidSchema.readonly(),
|
|
315
|
+
values: z5.array(valueSchema)
|
|
316
|
+
});
|
|
317
|
+
var readEntrySchema = z5.object({
|
|
318
|
+
id: uuidSchema.readonly(),
|
|
319
|
+
projectId: uuidSchema.readonly(),
|
|
320
|
+
collectionId: uuidSchema.readonly()
|
|
321
|
+
});
|
|
322
|
+
var updateEntrySchema = entrySchema.omit({
|
|
323
|
+
objectType: true,
|
|
324
|
+
created: true,
|
|
325
|
+
updated: true
|
|
326
|
+
}).extend({
|
|
327
|
+
projectId: uuidSchema.readonly(),
|
|
328
|
+
collectionId: uuidSchema.readonly()
|
|
329
|
+
});
|
|
330
|
+
var deleteEntrySchema = readEntrySchema.extend({});
|
|
331
|
+
var countEntriesSchema = z5.object({
|
|
332
|
+
projectId: uuidSchema.readonly(),
|
|
333
|
+
collectionId: uuidSchema.readonly()
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
// src/schema/fieldSchema.ts
|
|
337
|
+
import { z as z6 } from "zod";
|
|
338
|
+
var FieldTypeSchema = z6.enum([
|
|
339
|
+
// String Values
|
|
340
|
+
"text",
|
|
341
|
+
"textarea",
|
|
342
|
+
"email",
|
|
343
|
+
// 'password', @todo maybe if there is a usecase
|
|
344
|
+
"url",
|
|
345
|
+
"ip",
|
|
346
|
+
"date",
|
|
347
|
+
"time",
|
|
348
|
+
"datetime",
|
|
349
|
+
"telephone",
|
|
350
|
+
// Number Values
|
|
351
|
+
"number",
|
|
352
|
+
"range",
|
|
353
|
+
// Boolean Values
|
|
354
|
+
"toggle",
|
|
355
|
+
// Reference Values
|
|
356
|
+
"asset",
|
|
357
|
+
"entry"
|
|
358
|
+
// 'sharedValue', // @todo
|
|
359
|
+
]);
|
|
360
|
+
var FieldWidthSchema = z6.enum(["12", "6", "4", "3"]);
|
|
361
|
+
var FieldDefinitionBaseSchema = z6.object({
|
|
362
|
+
id: uuidSchema.readonly(),
|
|
363
|
+
label: translatableStringSchema,
|
|
364
|
+
description: translatableStringSchema,
|
|
365
|
+
isRequired: z6.boolean(),
|
|
366
|
+
isDisabled: z6.boolean(),
|
|
367
|
+
isUnique: z6.boolean(),
|
|
368
|
+
inputWidth: FieldWidthSchema
|
|
369
|
+
});
|
|
370
|
+
var StringFieldDefinitionBaseSchema = FieldDefinitionBaseSchema.extend(
|
|
371
|
+
{
|
|
372
|
+
valueType: z6.literal(ValueTypeSchema.Enum.string),
|
|
373
|
+
defaultValue: z6.string().nullable()
|
|
374
|
+
}
|
|
375
|
+
);
|
|
376
|
+
var textFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend(
|
|
377
|
+
{
|
|
378
|
+
fieldType: z6.literal(FieldTypeSchema.Enum.text),
|
|
379
|
+
min: z6.number().nullable(),
|
|
380
|
+
max: z6.number().nullable()
|
|
381
|
+
}
|
|
382
|
+
);
|
|
383
|
+
var textareaFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
|
|
384
|
+
fieldType: z6.literal(FieldTypeSchema.Enum.textarea),
|
|
385
|
+
min: z6.number().nullable(),
|
|
386
|
+
max: z6.number().nullable()
|
|
387
|
+
});
|
|
388
|
+
var emailFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
|
|
389
|
+
fieldType: z6.literal(FieldTypeSchema.Enum.email),
|
|
390
|
+
defaultValue: z6.string().email().nullable()
|
|
391
|
+
});
|
|
392
|
+
var urlFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
|
|
393
|
+
fieldType: z6.literal(FieldTypeSchema.Enum.url),
|
|
394
|
+
defaultValue: z6.string().url().nullable()
|
|
395
|
+
});
|
|
396
|
+
var ipFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
|
|
397
|
+
fieldType: z6.literal(FieldTypeSchema.Enum.ip),
|
|
398
|
+
defaultValue: z6.string().ip().nullable()
|
|
399
|
+
});
|
|
400
|
+
var dateFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend(
|
|
401
|
+
{
|
|
402
|
+
fieldType: z6.literal(FieldTypeSchema.Enum.date),
|
|
403
|
+
defaultValue: z6.string().date().nullable()
|
|
404
|
+
}
|
|
405
|
+
);
|
|
406
|
+
var timeFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend(
|
|
407
|
+
{
|
|
408
|
+
fieldType: z6.literal(FieldTypeSchema.Enum.time),
|
|
409
|
+
defaultValue: z6.string().time().nullable()
|
|
410
|
+
}
|
|
411
|
+
);
|
|
412
|
+
var datetimeFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
|
|
413
|
+
fieldType: z6.literal(FieldTypeSchema.Enum.datetime),
|
|
414
|
+
defaultValue: z6.string().datetime().nullable()
|
|
415
|
+
});
|
|
416
|
+
var telephoneFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
|
|
417
|
+
fieldType: z6.literal(FieldTypeSchema.Enum.telephone)
|
|
418
|
+
// defaultValue: z.string().e164(), @todo when zod v4 releases @see https://github.com/colinhacks/zod/pull/3476
|
|
419
|
+
});
|
|
420
|
+
var stringFieldDefinitionSchema = z6.union([
|
|
421
|
+
textFieldDefinitionSchema,
|
|
422
|
+
textareaFieldDefinitionSchema,
|
|
423
|
+
emailFieldDefinitionSchema,
|
|
424
|
+
urlFieldDefinitionSchema,
|
|
425
|
+
ipFieldDefinitionSchema,
|
|
426
|
+
dateFieldDefinitionSchema,
|
|
427
|
+
timeFieldDefinitionSchema,
|
|
428
|
+
datetimeFieldDefinitionSchema,
|
|
429
|
+
telephoneFieldDefinitionSchema
|
|
430
|
+
]);
|
|
431
|
+
var NumberFieldDefinitionBaseSchema = FieldDefinitionBaseSchema.extend(
|
|
432
|
+
{
|
|
433
|
+
valueType: z6.literal(ValueTypeSchema.Enum.number),
|
|
434
|
+
min: z6.number().nullable(),
|
|
435
|
+
max: z6.number().nullable(),
|
|
436
|
+
isUnique: z6.literal(false),
|
|
437
|
+
defaultValue: z6.number().nullable()
|
|
438
|
+
}
|
|
439
|
+
);
|
|
440
|
+
var numberFieldDefinitionSchema = NumberFieldDefinitionBaseSchema.extend({
|
|
441
|
+
fieldType: z6.literal(FieldTypeSchema.Enum.number)
|
|
442
|
+
});
|
|
443
|
+
var rangeFieldDefinitionSchema = NumberFieldDefinitionBaseSchema.extend({
|
|
444
|
+
fieldType: z6.literal(FieldTypeSchema.Enum.range),
|
|
445
|
+
// Overwrite from nullable to required because a range needs min, max and default to work and is required, since it always returns a number
|
|
446
|
+
isRequired: z6.literal(true),
|
|
447
|
+
min: z6.number(),
|
|
448
|
+
max: z6.number(),
|
|
449
|
+
defaultValue: z6.number()
|
|
450
|
+
});
|
|
451
|
+
var BooleanFieldDefinitionBaseSchema = FieldDefinitionBaseSchema.extend({
|
|
452
|
+
valueType: z6.literal(ValueTypeSchema.Enum.boolean),
|
|
453
|
+
// Overwrite from nullable to required because a boolean needs a default to work and is required, since it always is either true or false
|
|
454
|
+
isRequired: z6.literal(true),
|
|
455
|
+
defaultValue: z6.boolean(),
|
|
456
|
+
isUnique: z6.literal(false)
|
|
457
|
+
});
|
|
458
|
+
var toggleFieldDefinitionSchema = BooleanFieldDefinitionBaseSchema.extend({
|
|
459
|
+
fieldType: z6.literal(FieldTypeSchema.Enum.toggle)
|
|
460
|
+
});
|
|
461
|
+
var ReferenceFieldDefinitionBaseSchema = FieldDefinitionBaseSchema.extend({
|
|
462
|
+
valueType: z6.literal(ValueTypeSchema.Enum.reference)
|
|
463
|
+
});
|
|
464
|
+
var assetFieldDefinitionSchema = ReferenceFieldDefinitionBaseSchema.extend({
|
|
465
|
+
fieldType: z6.literal(FieldTypeSchema.Enum.asset),
|
|
466
|
+
allowedMimeTypes: z6.array(supportedAssetMimeTypeSchema).min(1),
|
|
467
|
+
min: z6.number().nullable(),
|
|
468
|
+
max: z6.number().nullable()
|
|
469
|
+
});
|
|
470
|
+
var entryFieldDefinitionSchema = ReferenceFieldDefinitionBaseSchema.extend({
|
|
471
|
+
fieldType: z6.literal(FieldTypeSchema.Enum.entry),
|
|
472
|
+
ofCollections: z6.array(uuidSchema),
|
|
473
|
+
min: z6.number().nullable(),
|
|
474
|
+
max: z6.number().nullable()
|
|
475
|
+
});
|
|
476
|
+
var fieldDefinitionSchema = z6.union([
|
|
477
|
+
stringFieldDefinitionSchema,
|
|
478
|
+
numberFieldDefinitionSchema,
|
|
479
|
+
rangeFieldDefinitionSchema,
|
|
480
|
+
toggleFieldDefinitionSchema,
|
|
481
|
+
assetFieldDefinitionSchema,
|
|
482
|
+
entryFieldDefinitionSchema
|
|
483
|
+
// sharedValueDefinitionSchema,
|
|
484
|
+
]);
|
|
485
|
+
function getValueContentSchemaFromFieldDefinition(fieldDefinition) {
|
|
486
|
+
switch (fieldDefinition.valueType) {
|
|
446
487
|
case ValueTypeSchema.Enum.boolean:
|
|
447
488
|
return getBooleanValueContentSchema();
|
|
448
489
|
case ValueTypeSchema.Enum.number:
|
|
449
|
-
return getNumberValueContentSchema(
|
|
490
|
+
return getNumberValueContentSchema(fieldDefinition);
|
|
450
491
|
case ValueTypeSchema.Enum.string:
|
|
451
|
-
return getStringValueContentSchema(
|
|
492
|
+
return getStringValueContentSchema(fieldDefinition);
|
|
452
493
|
case ValueTypeSchema.Enum.reference:
|
|
453
|
-
return getReferenceValueContentSchema(
|
|
494
|
+
return getReferenceValueContentSchema(fieldDefinition);
|
|
454
495
|
default:
|
|
455
496
|
throw new Error(
|
|
456
497
|
// @ts-expect-error
|
|
457
|
-
`Error generating schema for unsupported ValueType "${
|
|
498
|
+
`Error generating schema for unsupported ValueType "${fieldDefinition.valueType}"`
|
|
458
499
|
);
|
|
459
500
|
}
|
|
460
501
|
}
|
|
461
502
|
function getBooleanValueContentSchema() {
|
|
462
|
-
return
|
|
503
|
+
return z6.boolean();
|
|
463
504
|
}
|
|
464
505
|
function getNumberValueContentSchema(definition) {
|
|
465
|
-
let schema =
|
|
506
|
+
let schema = z6.number();
|
|
466
507
|
if (definition.min) {
|
|
467
508
|
schema = schema.min(definition.min);
|
|
468
509
|
}
|
|
@@ -475,33 +516,33 @@ function getNumberValueContentSchema(definition) {
|
|
|
475
516
|
return schema;
|
|
476
517
|
}
|
|
477
518
|
function getStringValueContentSchema(definition) {
|
|
478
|
-
let schema =
|
|
519
|
+
let schema = z6.string().trim();
|
|
479
520
|
if ("min" in definition && definition.min) {
|
|
480
521
|
schema = schema.min(definition.min);
|
|
481
522
|
}
|
|
482
523
|
if ("max" in definition && definition.max) {
|
|
483
524
|
schema = schema.max(definition.max);
|
|
484
525
|
}
|
|
485
|
-
switch (definition.
|
|
486
|
-
case
|
|
526
|
+
switch (definition.fieldType) {
|
|
527
|
+
case FieldTypeSchema.Enum.email:
|
|
487
528
|
schema = schema.email();
|
|
488
529
|
break;
|
|
489
|
-
case
|
|
530
|
+
case FieldTypeSchema.Enum.url:
|
|
490
531
|
schema = schema.url();
|
|
491
532
|
break;
|
|
492
|
-
case
|
|
533
|
+
case FieldTypeSchema.Enum.ip:
|
|
493
534
|
schema = schema.ip();
|
|
494
535
|
break;
|
|
495
|
-
case
|
|
536
|
+
case FieldTypeSchema.Enum.date:
|
|
496
537
|
schema = schema.date();
|
|
497
538
|
break;
|
|
498
|
-
case
|
|
539
|
+
case FieldTypeSchema.Enum.time:
|
|
499
540
|
schema = schema.time();
|
|
500
541
|
break;
|
|
501
|
-
case
|
|
542
|
+
case FieldTypeSchema.Enum.datetime:
|
|
502
543
|
schema = schema.datetime();
|
|
503
544
|
break;
|
|
504
|
-
case
|
|
545
|
+
case FieldTypeSchema.Enum.telephone:
|
|
505
546
|
break;
|
|
506
547
|
}
|
|
507
548
|
if (definition.isRequired === false) {
|
|
@@ -511,15 +552,15 @@ function getStringValueContentSchema(definition) {
|
|
|
511
552
|
}
|
|
512
553
|
function getReferenceValueContentSchema(definition) {
|
|
513
554
|
let schema;
|
|
514
|
-
switch (definition.
|
|
515
|
-
case
|
|
555
|
+
switch (definition.fieldType) {
|
|
556
|
+
case FieldTypeSchema.Enum.asset:
|
|
516
557
|
{
|
|
517
|
-
schema =
|
|
558
|
+
schema = z6.array(valueContentReferenceToAssetSchema);
|
|
518
559
|
}
|
|
519
560
|
break;
|
|
520
|
-
case
|
|
561
|
+
case FieldTypeSchema.Enum.entry:
|
|
521
562
|
{
|
|
522
|
-
schema =
|
|
563
|
+
schema = z6.array(valueContentReferenceToEntrySchema);
|
|
523
564
|
}
|
|
524
565
|
break;
|
|
525
566
|
}
|
|
@@ -535,62 +576,24 @@ function getReferenceValueContentSchema(definition) {
|
|
|
535
576
|
return schema;
|
|
536
577
|
}
|
|
537
578
|
|
|
538
|
-
// src/schema/entrySchema.ts
|
|
539
|
-
var entryFileSchema = baseFileSchema.extend({
|
|
540
|
-
objectType: z5.literal(objectTypeSchema.Enum.entry).readonly(),
|
|
541
|
-
values: z5.array(valueSchema)
|
|
542
|
-
});
|
|
543
|
-
var entrySchema = entryFileSchema.extend({
|
|
544
|
-
values: z5.array(z5.lazy(() => resolvedValueSchema))
|
|
545
|
-
});
|
|
546
|
-
var entryExportSchema = entrySchema.extend({});
|
|
547
|
-
var createEntrySchema = entryFileSchema.omit({
|
|
548
|
-
id: true,
|
|
549
|
-
objectType: true,
|
|
550
|
-
created: true,
|
|
551
|
-
updated: true
|
|
552
|
-
}).extend({
|
|
553
|
-
projectId: uuidSchema.readonly(),
|
|
554
|
-
collectionId: uuidSchema.readonly(),
|
|
555
|
-
values: z5.array(valueSchema)
|
|
556
|
-
});
|
|
557
|
-
var readEntrySchema = z5.object({
|
|
558
|
-
id: uuidSchema.readonly(),
|
|
559
|
-
projectId: uuidSchema.readonly(),
|
|
560
|
-
collectionId: uuidSchema.readonly()
|
|
561
|
-
});
|
|
562
|
-
var updateEntrySchema = entrySchema.omit({
|
|
563
|
-
objectType: true,
|
|
564
|
-
created: true,
|
|
565
|
-
updated: true
|
|
566
|
-
}).extend({
|
|
567
|
-
projectId: uuidSchema.readonly(),
|
|
568
|
-
collectionId: uuidSchema.readonly()
|
|
569
|
-
});
|
|
570
|
-
var deleteEntrySchema = readEntrySchema.extend({});
|
|
571
|
-
var countEntriesSchema = z5.object({
|
|
572
|
-
projectId: uuidSchema.readonly(),
|
|
573
|
-
collectionId: uuidSchema.readonly()
|
|
574
|
-
});
|
|
575
|
-
|
|
576
579
|
// src/schema/collectionSchema.ts
|
|
577
580
|
var collectionFileSchema = baseFileSchema.extend({
|
|
578
|
-
objectType:
|
|
579
|
-
name:
|
|
581
|
+
objectType: z7.literal(objectTypeSchema.Enum.collection).readonly(),
|
|
582
|
+
name: z7.object({
|
|
580
583
|
singular: translatableStringSchema,
|
|
581
584
|
plural: translatableStringSchema
|
|
582
585
|
}),
|
|
583
|
-
slug:
|
|
584
|
-
singular:
|
|
585
|
-
plural:
|
|
586
|
+
slug: z7.object({
|
|
587
|
+
singular: z7.string(),
|
|
588
|
+
plural: z7.string()
|
|
586
589
|
}),
|
|
587
590
|
description: translatableStringSchema,
|
|
588
591
|
icon: supportedIconSchema,
|
|
589
|
-
|
|
592
|
+
fieldDefinitions: z7.array(fieldDefinitionSchema)
|
|
590
593
|
});
|
|
591
594
|
var collectionSchema = collectionFileSchema.extend({});
|
|
592
595
|
var collectionExportSchema = collectionSchema.extend({
|
|
593
|
-
entries:
|
|
596
|
+
entries: z7.array(entryExportSchema)
|
|
594
597
|
});
|
|
595
598
|
var createCollectionSchema = collectionSchema.omit({
|
|
596
599
|
id: true,
|
|
@@ -600,7 +603,7 @@ var createCollectionSchema = collectionSchema.omit({
|
|
|
600
603
|
}).extend({
|
|
601
604
|
projectId: uuidSchema.readonly()
|
|
602
605
|
});
|
|
603
|
-
var readCollectionSchema =
|
|
606
|
+
var readCollectionSchema = z7.object({
|
|
604
607
|
id: uuidSchema.readonly(),
|
|
605
608
|
projectId: uuidSchema.readonly()
|
|
606
609
|
});
|
|
@@ -610,18 +613,18 @@ var updateCollectionSchema = collectionFileSchema.pick({
|
|
|
610
613
|
slug: true,
|
|
611
614
|
description: true,
|
|
612
615
|
icon: true,
|
|
613
|
-
|
|
616
|
+
fieldDefinitions: true
|
|
614
617
|
}).extend({
|
|
615
618
|
projectId: uuidSchema.readonly()
|
|
616
619
|
});
|
|
617
620
|
var deleteCollectionSchema = readCollectionSchema.extend({});
|
|
618
|
-
var countCollectionsSchema =
|
|
621
|
+
var countCollectionsSchema = z7.object({
|
|
619
622
|
projectId: uuidSchema.readonly()
|
|
620
623
|
});
|
|
621
624
|
|
|
622
625
|
// src/schema/coreSchema.ts
|
|
623
|
-
import { z as
|
|
624
|
-
var elekIoCoreOptionsSchema =
|
|
626
|
+
import { z as z8 } from "zod";
|
|
627
|
+
var elekIoCoreOptionsSchema = z8.object({
|
|
625
628
|
/**
|
|
626
629
|
* The environment elek.io Core is currently running in
|
|
627
630
|
*/
|
|
@@ -630,14 +633,14 @@ var elekIoCoreOptionsSchema = z7.object({
|
|
|
630
633
|
* The current version of elek.io Core
|
|
631
634
|
*/
|
|
632
635
|
version: versionSchema,
|
|
633
|
-
file:
|
|
634
|
-
json:
|
|
636
|
+
file: z8.object({
|
|
637
|
+
json: z8.object({
|
|
635
638
|
/**
|
|
636
639
|
* If set, adds indentation with spaces (number) or escape character (string)
|
|
637
640
|
* and line break characters to saved JSON files on disk, to make them easier to read.
|
|
638
641
|
* Defaults to 2 spaces of indentation.
|
|
639
642
|
*/
|
|
640
|
-
indentation:
|
|
643
|
+
indentation: z8.union([z8.number(), z8.string()])
|
|
641
644
|
})
|
|
642
645
|
})
|
|
643
646
|
});
|
|
@@ -649,21 +652,21 @@ var constructorElekIoCoreSchema = elekIoCoreOptionsSchema.omit({
|
|
|
649
652
|
}).optional();
|
|
650
653
|
|
|
651
654
|
// src/schema/gitSchema.ts
|
|
652
|
-
import { z as
|
|
653
|
-
var gitRepositoryPathSchema =
|
|
654
|
-
var gitSignatureSchema =
|
|
655
|
-
name:
|
|
656
|
-
email:
|
|
655
|
+
import { z as z9 } from "zod";
|
|
656
|
+
var gitRepositoryPathSchema = z9.string();
|
|
657
|
+
var gitSignatureSchema = z9.object({
|
|
658
|
+
name: z9.string(),
|
|
659
|
+
email: z9.string()
|
|
657
660
|
});
|
|
658
|
-
var gitCommitSchema =
|
|
661
|
+
var gitCommitSchema = z9.object({
|
|
659
662
|
/**
|
|
660
663
|
* SHA-1 hash of the commit
|
|
661
664
|
*/
|
|
662
|
-
hash:
|
|
663
|
-
message:
|
|
665
|
+
hash: z9.string(),
|
|
666
|
+
message: z9.string(),
|
|
664
667
|
author: gitSignatureSchema,
|
|
665
|
-
datetime:
|
|
666
|
-
tag:
|
|
668
|
+
datetime: z9.string().datetime(),
|
|
669
|
+
tag: z9.string().nullable()
|
|
667
670
|
});
|
|
668
671
|
var GitCommitIconNative = /* @__PURE__ */ ((GitCommitIconNative2) => {
|
|
669
672
|
GitCommitIconNative2["INIT"] = ":tada:";
|
|
@@ -672,66 +675,66 @@ var GitCommitIconNative = /* @__PURE__ */ ((GitCommitIconNative2) => {
|
|
|
672
675
|
GitCommitIconNative2["DELETE"] = ":fire:";
|
|
673
676
|
return GitCommitIconNative2;
|
|
674
677
|
})(GitCommitIconNative || {});
|
|
675
|
-
var gitCommitIconSchema =
|
|
676
|
-
var gitInitOptionsSchema =
|
|
678
|
+
var gitCommitIconSchema = z9.nativeEnum(GitCommitIconNative);
|
|
679
|
+
var gitInitOptionsSchema = z9.object({
|
|
677
680
|
/**
|
|
678
681
|
* Use the specified name for the initial branch in the newly created repository. If not specified, fall back to the default name (currently master, but this is subject to change in the future; the name can be customized via the init.defaultBranch configuration variable).
|
|
679
682
|
*/
|
|
680
|
-
initialBranch:
|
|
683
|
+
initialBranch: z9.string()
|
|
681
684
|
});
|
|
682
|
-
var gitCloneOptionsSchema =
|
|
685
|
+
var gitCloneOptionsSchema = z9.object({
|
|
683
686
|
/**
|
|
684
687
|
* Create a shallow clone with a history truncated to the specified number of commits. Implies --single-branch unless --no-single-branch is given to fetch the histories near the tips of all branches. If you want to clone submodules shallowly, also pass --shallow-submodules.
|
|
685
688
|
*/
|
|
686
|
-
depth:
|
|
689
|
+
depth: z9.number(),
|
|
687
690
|
/**
|
|
688
691
|
* Clone only the history leading to the tip of a single branch, either specified by the --branch option or the primary branch remote’s HEAD points at. Further fetches into the resulting repository will only update the remote-tracking branch for the branch this option was used for the initial cloning. If the HEAD at the remote did not point at any branch when --single-branch clone was made, no remote-tracking branch is created.
|
|
689
692
|
*/
|
|
690
|
-
singleBranch:
|
|
693
|
+
singleBranch: z9.boolean(),
|
|
691
694
|
/**
|
|
692
695
|
* Instead of pointing the newly created HEAD to the branch pointed to by the cloned repository’s HEAD, point to <name> branch instead. In a non-bare repository, this is the branch that will be checked out. --branch can also take tags and detaches the HEAD at that commit in the resulting repository.
|
|
693
696
|
*/
|
|
694
|
-
branch:
|
|
697
|
+
branch: z9.string()
|
|
695
698
|
});
|
|
696
|
-
var gitSwitchOptionsSchema =
|
|
699
|
+
var gitSwitchOptionsSchema = z9.object({
|
|
697
700
|
/**
|
|
698
701
|
* If true, creates a new local branch and then switches to it
|
|
699
702
|
*
|
|
700
703
|
* @see https://git-scm.com/docs/git-switch#Documentation/git-switch.txt---createltnew-branchgt
|
|
701
704
|
*/
|
|
702
|
-
isNew:
|
|
705
|
+
isNew: z9.boolean().optional()
|
|
703
706
|
});
|
|
704
|
-
var gitLogOptionsSchema =
|
|
707
|
+
var gitLogOptionsSchema = z9.object({
|
|
705
708
|
/**
|
|
706
709
|
* Limit the result to given number of commits
|
|
707
710
|
*/
|
|
708
|
-
limit:
|
|
711
|
+
limit: z9.number().optional(),
|
|
709
712
|
/**
|
|
710
713
|
* Only list commits that are between given SHAs or tag names
|
|
711
714
|
*
|
|
712
715
|
* Note that the commits of from and to are not included in the result
|
|
713
716
|
*/
|
|
714
|
-
between:
|
|
717
|
+
between: z9.object({
|
|
715
718
|
/**
|
|
716
719
|
* From the oldest commit
|
|
717
720
|
*/
|
|
718
|
-
from:
|
|
721
|
+
from: z9.string(),
|
|
719
722
|
/**
|
|
720
723
|
* To the newest commit
|
|
721
724
|
*
|
|
722
725
|
* Defaults to the current HEAD
|
|
723
726
|
*/
|
|
724
|
-
to:
|
|
727
|
+
to: z9.string().optional()
|
|
725
728
|
})
|
|
726
729
|
});
|
|
727
730
|
|
|
728
731
|
// src/schema/gitTagSchema.ts
|
|
729
|
-
import { z as
|
|
730
|
-
var gitTagSchema =
|
|
732
|
+
import { z as z10 } from "zod";
|
|
733
|
+
var gitTagSchema = z10.object({
|
|
731
734
|
id: uuidSchema,
|
|
732
|
-
message:
|
|
735
|
+
message: z10.string(),
|
|
733
736
|
author: gitSignatureSchema,
|
|
734
|
-
datetime:
|
|
737
|
+
datetime: z10.string().datetime()
|
|
735
738
|
});
|
|
736
739
|
var createGitTagSchema = gitTagSchema.pick({
|
|
737
740
|
message: true
|
|
@@ -739,25 +742,25 @@ var createGitTagSchema = gitTagSchema.pick({
|
|
|
739
742
|
path: gitRepositoryPathSchema,
|
|
740
743
|
hash: gitCommitSchema.shape.hash.optional()
|
|
741
744
|
});
|
|
742
|
-
var readGitTagSchema =
|
|
745
|
+
var readGitTagSchema = z10.object({
|
|
743
746
|
path: gitRepositoryPathSchema,
|
|
744
747
|
id: uuidSchema.readonly()
|
|
745
748
|
});
|
|
746
749
|
var deleteGitTagSchema = readGitTagSchema.extend({});
|
|
747
|
-
var countGitTagsSchema =
|
|
750
|
+
var countGitTagsSchema = z10.object({
|
|
748
751
|
path: gitRepositoryPathSchema
|
|
749
752
|
});
|
|
750
753
|
|
|
751
754
|
// src/schema/projectSchema.ts
|
|
752
|
-
import { z as
|
|
753
|
-
var projectStatusSchema =
|
|
754
|
-
var projectSettingsSchema =
|
|
755
|
-
language:
|
|
755
|
+
import { z as z11 } from "zod";
|
|
756
|
+
var projectStatusSchema = z11.enum(["foo", "bar", "todo"]);
|
|
757
|
+
var projectSettingsSchema = z11.object({
|
|
758
|
+
language: z11.object({
|
|
756
759
|
default: supportedLanguageSchema,
|
|
757
|
-
supported:
|
|
760
|
+
supported: z11.array(supportedLanguageSchema)
|
|
758
761
|
})
|
|
759
762
|
});
|
|
760
|
-
var projectFolderSchema =
|
|
763
|
+
var projectFolderSchema = z11.enum([
|
|
761
764
|
"assets",
|
|
762
765
|
"collections",
|
|
763
766
|
"shared-values",
|
|
@@ -767,18 +770,18 @@ var projectFolderSchema = z10.enum([
|
|
|
767
770
|
// 'theme',
|
|
768
771
|
]);
|
|
769
772
|
var projectFileSchema = baseFileSchema.extend({
|
|
770
|
-
objectType:
|
|
773
|
+
objectType: z11.literal(objectTypeSchema.Enum.project).readonly(),
|
|
771
774
|
coreVersion: versionSchema,
|
|
772
|
-
name:
|
|
773
|
-
description:
|
|
775
|
+
name: z11.string().trim().min(1, "shared.projectNameRequired"),
|
|
776
|
+
description: z11.string().trim().min(1, "shared.projectDescriptionRequired"),
|
|
774
777
|
version: versionSchema,
|
|
775
778
|
status: projectStatusSchema,
|
|
776
779
|
settings: projectSettingsSchema
|
|
777
780
|
});
|
|
778
781
|
var projectSchema = projectFileSchema.extend({});
|
|
779
782
|
var projectExportSchema = projectSchema.extend({
|
|
780
|
-
assets:
|
|
781
|
-
collections:
|
|
783
|
+
assets: z11.array(assetExportSchema),
|
|
784
|
+
collections: z11.array(collectionExportSchema)
|
|
782
785
|
});
|
|
783
786
|
var createProjectSchema = projectSchema.pick({
|
|
784
787
|
name: true,
|
|
@@ -788,7 +791,7 @@ var createProjectSchema = projectSchema.pick({
|
|
|
788
791
|
description: true,
|
|
789
792
|
settings: true
|
|
790
793
|
});
|
|
791
|
-
var readProjectSchema =
|
|
794
|
+
var readProjectSchema = z11.object({
|
|
792
795
|
id: uuidSchema.readonly()
|
|
793
796
|
});
|
|
794
797
|
var updateProjectSchema = projectSchema.pick({
|
|
@@ -801,11 +804,11 @@ var updateProjectSchema = projectSchema.pick({
|
|
|
801
804
|
description: true,
|
|
802
805
|
settings: true
|
|
803
806
|
});
|
|
804
|
-
var upgradeProjectSchema =
|
|
807
|
+
var upgradeProjectSchema = z11.object({
|
|
805
808
|
id: uuidSchema.readonly()
|
|
806
809
|
});
|
|
807
810
|
var deleteProjectSchema = readProjectSchema.extend({});
|
|
808
|
-
var projectUpgradeSchema =
|
|
811
|
+
var projectUpgradeSchema = z11.object({
|
|
809
812
|
/**
|
|
810
813
|
* The Core version the Project will be upgraded to
|
|
811
814
|
*/
|
|
@@ -813,45 +816,45 @@ var projectUpgradeSchema = z10.object({
|
|
|
813
816
|
/**
|
|
814
817
|
* Function that will be executed in the process of upgrading a Project
|
|
815
818
|
*/
|
|
816
|
-
run:
|
|
819
|
+
run: z11.function().args(projectFileSchema).returns(z11.promise(z11.void()))
|
|
817
820
|
});
|
|
818
|
-
var cloneProjectSchema =
|
|
819
|
-
url:
|
|
821
|
+
var cloneProjectSchema = z11.object({
|
|
822
|
+
url: z11.string()
|
|
820
823
|
});
|
|
821
|
-
var listBranchesProjectSchema =
|
|
824
|
+
var listBranchesProjectSchema = z11.object({
|
|
822
825
|
id: uuidSchema.readonly()
|
|
823
826
|
});
|
|
824
|
-
var currentBranchProjectSchema =
|
|
827
|
+
var currentBranchProjectSchema = z11.object({
|
|
825
828
|
id: uuidSchema.readonly()
|
|
826
829
|
});
|
|
827
|
-
var switchBranchProjectSchema =
|
|
830
|
+
var switchBranchProjectSchema = z11.object({
|
|
828
831
|
id: uuidSchema.readonly(),
|
|
829
|
-
branch:
|
|
832
|
+
branch: z11.string(),
|
|
830
833
|
options: gitSwitchOptionsSchema.optional()
|
|
831
834
|
});
|
|
832
|
-
var getRemoteOriginUrlProjectSchema =
|
|
835
|
+
var getRemoteOriginUrlProjectSchema = z11.object({
|
|
833
836
|
id: uuidSchema.readonly()
|
|
834
837
|
});
|
|
835
|
-
var setRemoteOriginUrlProjectSchema =
|
|
838
|
+
var setRemoteOriginUrlProjectSchema = z11.object({
|
|
836
839
|
id: uuidSchema.readonly(),
|
|
837
|
-
url:
|
|
840
|
+
url: z11.string()
|
|
838
841
|
});
|
|
839
|
-
var getChangesProjectSchema =
|
|
842
|
+
var getChangesProjectSchema = z11.object({
|
|
840
843
|
id: uuidSchema.readonly()
|
|
841
844
|
});
|
|
842
|
-
var synchronizeProjectSchema =
|
|
845
|
+
var synchronizeProjectSchema = z11.object({
|
|
843
846
|
id: uuidSchema.readonly()
|
|
844
847
|
});
|
|
845
|
-
var searchProjectSchema =
|
|
848
|
+
var searchProjectSchema = z11.object({
|
|
846
849
|
id: uuidSchema.readonly(),
|
|
847
|
-
query:
|
|
850
|
+
query: z11.string(),
|
|
848
851
|
language: supportedLanguageSchema,
|
|
849
|
-
type:
|
|
852
|
+
type: z11.array(objectTypeSchema).optional()
|
|
850
853
|
});
|
|
851
854
|
|
|
852
855
|
// src/schema/serviceSchema.ts
|
|
853
|
-
import { z as
|
|
854
|
-
var serviceTypeSchema =
|
|
856
|
+
import { z as z12 } from "zod";
|
|
857
|
+
var serviceTypeSchema = z12.enum([
|
|
855
858
|
"Git",
|
|
856
859
|
"GitTag",
|
|
857
860
|
"User",
|
|
@@ -863,10 +866,10 @@ var serviceTypeSchema = z11.enum([
|
|
|
863
866
|
"Entry",
|
|
864
867
|
"Value"
|
|
865
868
|
]);
|
|
866
|
-
var listSchema =
|
|
869
|
+
var listSchema = z12.object({
|
|
867
870
|
projectId: uuidSchema,
|
|
868
|
-
limit:
|
|
869
|
-
offset:
|
|
871
|
+
limit: z12.number().optional(),
|
|
872
|
+
offset: z12.number().optional()
|
|
870
873
|
});
|
|
871
874
|
var listCollectionsSchema = listSchema;
|
|
872
875
|
var listEntriesSchema = listSchema.extend({
|
|
@@ -876,25 +879,25 @@ var listAssetsSchema = listSchema;
|
|
|
876
879
|
var listProjectsSchema = listSchema.omit({
|
|
877
880
|
projectId: true
|
|
878
881
|
});
|
|
879
|
-
var listGitTagsSchema =
|
|
882
|
+
var listGitTagsSchema = z12.object({
|
|
880
883
|
path: gitRepositoryPathSchema
|
|
881
884
|
});
|
|
882
885
|
|
|
883
886
|
// src/schema/userSchema.ts
|
|
884
|
-
import
|
|
885
|
-
var UserTypeSchema =
|
|
887
|
+
import z13 from "zod";
|
|
888
|
+
var UserTypeSchema = z13.enum(["local", "cloud"]);
|
|
886
889
|
var baseUserSchema = gitSignatureSchema.extend({
|
|
887
890
|
userType: UserTypeSchema,
|
|
888
891
|
language: supportedLanguageSchema
|
|
889
892
|
});
|
|
890
893
|
var localUserSchema = baseUserSchema.extend({
|
|
891
|
-
userType:
|
|
894
|
+
userType: z13.literal(UserTypeSchema.Enum.local)
|
|
892
895
|
});
|
|
893
896
|
var cloudUserSchema = baseUserSchema.extend({
|
|
894
|
-
userType:
|
|
897
|
+
userType: z13.literal(UserTypeSchema.Enum.cloud),
|
|
895
898
|
id: uuidSchema
|
|
896
899
|
});
|
|
897
|
-
var userFileSchema =
|
|
900
|
+
var userFileSchema = z13.union([localUserSchema, cloudUserSchema]);
|
|
898
901
|
var userSchema = userFileSchema;
|
|
899
902
|
var setUserSchema = userSchema;
|
|
900
903
|
|
|
@@ -1614,7 +1617,7 @@ var EntryService = class extends AbstractCrudService {
|
|
|
1614
1617
|
});
|
|
1615
1618
|
this.validateValues({
|
|
1616
1619
|
collectionId: props.collectionId,
|
|
1617
|
-
|
|
1620
|
+
fieldDefinitions: collection.fieldDefinitions,
|
|
1618
1621
|
values: entry.values
|
|
1619
1622
|
});
|
|
1620
1623
|
await this.jsonFileService.create(
|
|
@@ -1673,7 +1676,7 @@ var EntryService = class extends AbstractCrudService {
|
|
|
1673
1676
|
});
|
|
1674
1677
|
this.validateValues({
|
|
1675
1678
|
collectionId: props.collectionId,
|
|
1676
|
-
|
|
1679
|
+
fieldDefinitions: collection.fieldDefinitions,
|
|
1677
1680
|
values: entry.values
|
|
1678
1681
|
});
|
|
1679
1682
|
await this.jsonFileService.update(
|
|
@@ -1741,39 +1744,39 @@ var EntryService = class extends AbstractCrudService {
|
|
|
1741
1744
|
return entrySchema.safeParse(obj).success;
|
|
1742
1745
|
}
|
|
1743
1746
|
/**
|
|
1744
|
-
* Returns a
|
|
1747
|
+
* Returns a Field definition by ID
|
|
1745
1748
|
*/
|
|
1746
|
-
|
|
1747
|
-
const
|
|
1748
|
-
if (
|
|
1749
|
+
getFieldDefinitionById(props) {
|
|
1750
|
+
const fieldDefinition = props.fieldDefinitions.find((definition) => {
|
|
1751
|
+
if (definition.id === props.id) {
|
|
1749
1752
|
return true;
|
|
1750
1753
|
}
|
|
1751
1754
|
return false;
|
|
1752
1755
|
});
|
|
1753
|
-
if (!
|
|
1756
|
+
if (!fieldDefinition) {
|
|
1754
1757
|
throw new Error(
|
|
1755
|
-
`No definition with ID "${props.id}" found in Collection "${props.collectionId}" for given Value reference`
|
|
1758
|
+
`No Field definition with ID "${props.id}" found in Collection "${props.collectionId}" for given Value reference`
|
|
1756
1759
|
);
|
|
1757
1760
|
}
|
|
1758
|
-
return
|
|
1761
|
+
return fieldDefinition;
|
|
1759
1762
|
}
|
|
1760
1763
|
/**
|
|
1761
|
-
* Validates given Values against
|
|
1764
|
+
* Validates given Values against their Collections Field definitions
|
|
1762
1765
|
*/
|
|
1763
1766
|
validateValues(props) {
|
|
1764
1767
|
props.values.map((value) => {
|
|
1765
|
-
const
|
|
1768
|
+
const fieldDefinition = this.getFieldDefinitionById({
|
|
1766
1769
|
collectionId: props.collectionId,
|
|
1767
|
-
|
|
1768
|
-
id: value.
|
|
1770
|
+
fieldDefinitions: props.fieldDefinitions,
|
|
1771
|
+
id: value.fieldDefinitionId
|
|
1769
1772
|
});
|
|
1770
|
-
const
|
|
1773
|
+
const contentSchema = getValueContentSchemaFromFieldDefinition(fieldDefinition);
|
|
1771
1774
|
try {
|
|
1772
|
-
for (const [, content] of Object.entries(value.content)) {
|
|
1773
|
-
|
|
1775
|
+
for (const [_language, content] of Object.entries(value.content)) {
|
|
1776
|
+
contentSchema.parse(content);
|
|
1774
1777
|
}
|
|
1775
1778
|
} catch (error) {
|
|
1776
|
-
console.log("Definition:",
|
|
1779
|
+
console.log("Definition:", fieldDefinition);
|
|
1777
1780
|
console.log("Value:", value);
|
|
1778
1781
|
throw error;
|
|
1779
1782
|
}
|
|
@@ -3092,19 +3095,19 @@ var ElekIoCore = class {
|
|
|
3092
3095
|
// }
|
|
3093
3096
|
};
|
|
3094
3097
|
export {
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3098
|
+
BooleanFieldDefinitionBaseSchema,
|
|
3099
|
+
FieldDefinitionBaseSchema,
|
|
3100
|
+
FieldTypeSchema,
|
|
3101
|
+
FieldWidthSchema,
|
|
3102
|
+
NumberFieldDefinitionBaseSchema,
|
|
3103
|
+
ReferenceFieldDefinitionBaseSchema,
|
|
3104
|
+
StringFieldDefinitionBaseSchema,
|
|
3099
3105
|
UserTypeSchema,
|
|
3100
|
-
ValueDefinitionBaseSchema,
|
|
3101
|
-
ValueInputTypeSchema,
|
|
3102
|
-
ValueInputWidthSchema,
|
|
3103
3106
|
ValueTypeSchema,
|
|
3104
3107
|
assetExportSchema,
|
|
3108
|
+
assetFieldDefinitionSchema,
|
|
3105
3109
|
assetFileSchema,
|
|
3106
3110
|
assetSchema,
|
|
3107
|
-
assetValueDefinitionSchema,
|
|
3108
3111
|
baseFileSchema,
|
|
3109
3112
|
baseFileWithLanguageSchema,
|
|
3110
3113
|
baseUserSchema,
|
|
@@ -3124,9 +3127,9 @@ export {
|
|
|
3124
3127
|
createGitTagSchema,
|
|
3125
3128
|
createProjectSchema,
|
|
3126
3129
|
currentBranchProjectSchema,
|
|
3127
|
-
|
|
3130
|
+
dateFieldDefinitionSchema,
|
|
3128
3131
|
datetime,
|
|
3129
|
-
|
|
3132
|
+
datetimeFieldDefinitionSchema,
|
|
3130
3133
|
ElekIoCore as default,
|
|
3131
3134
|
deleteAssetSchema,
|
|
3132
3135
|
deleteCollectionSchema,
|
|
@@ -3139,16 +3142,17 @@ export {
|
|
|
3139
3142
|
directValueBaseSchema,
|
|
3140
3143
|
directValueSchema,
|
|
3141
3144
|
elekIoCoreOptionsSchema,
|
|
3142
|
-
|
|
3145
|
+
emailFieldDefinitionSchema,
|
|
3143
3146
|
entryExportSchema,
|
|
3147
|
+
entryFieldDefinitionSchema,
|
|
3144
3148
|
entryFileSchema,
|
|
3145
3149
|
entrySchema,
|
|
3146
|
-
entryValueDefinitionSchema,
|
|
3147
3150
|
environmentSchema,
|
|
3151
|
+
fieldDefinitionSchema,
|
|
3148
3152
|
fileReferenceSchema,
|
|
3149
3153
|
getChangesProjectSchema,
|
|
3150
3154
|
getRemoteOriginUrlProjectSchema,
|
|
3151
|
-
|
|
3155
|
+
getValueContentSchemaFromFieldDefinition,
|
|
3152
3156
|
gitCloneOptionsSchema,
|
|
3153
3157
|
gitCommitIconSchema,
|
|
3154
3158
|
gitCommitSchema,
|
|
@@ -3158,7 +3162,7 @@ export {
|
|
|
3158
3162
|
gitSignatureSchema,
|
|
3159
3163
|
gitSwitchOptionsSchema,
|
|
3160
3164
|
gitTagSchema,
|
|
3161
|
-
|
|
3165
|
+
ipFieldDefinitionSchema,
|
|
3162
3166
|
listAssetsSchema,
|
|
3163
3167
|
listBranchesProjectSchema,
|
|
3164
3168
|
listCollectionsSchema,
|
|
@@ -3166,7 +3170,7 @@ export {
|
|
|
3166
3170
|
listGitTagsSchema,
|
|
3167
3171
|
listProjectsSchema,
|
|
3168
3172
|
localUserSchema,
|
|
3169
|
-
|
|
3173
|
+
numberFieldDefinitionSchema,
|
|
3170
3174
|
objectTypeSchema,
|
|
3171
3175
|
projectExportSchema,
|
|
3172
3176
|
projectFileSchema,
|
|
@@ -3175,7 +3179,7 @@ export {
|
|
|
3175
3179
|
projectSettingsSchema,
|
|
3176
3180
|
projectStatusSchema,
|
|
3177
3181
|
projectUpgradeSchema,
|
|
3178
|
-
|
|
3182
|
+
rangeFieldDefinitionSchema,
|
|
3179
3183
|
readAssetSchema,
|
|
3180
3184
|
readCollectionSchema,
|
|
3181
3185
|
readEntrySchema,
|
|
@@ -3190,7 +3194,7 @@ export {
|
|
|
3190
3194
|
setRemoteOriginUrlProjectSchema,
|
|
3191
3195
|
setUserSchema,
|
|
3192
3196
|
slug,
|
|
3193
|
-
|
|
3197
|
+
stringFieldDefinitionSchema,
|
|
3194
3198
|
supportedAssetExtensionSchema,
|
|
3195
3199
|
supportedAssetMimeTypeSchema,
|
|
3196
3200
|
supportedAssetTypeSchema,
|
|
@@ -3198,11 +3202,11 @@ export {
|
|
|
3198
3202
|
supportedLanguageSchema,
|
|
3199
3203
|
switchBranchProjectSchema,
|
|
3200
3204
|
synchronizeProjectSchema,
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3205
|
+
telephoneFieldDefinitionSchema,
|
|
3206
|
+
textFieldDefinitionSchema,
|
|
3207
|
+
textareaFieldDefinitionSchema,
|
|
3208
|
+
timeFieldDefinitionSchema,
|
|
3209
|
+
toggleFieldDefinitionSchema,
|
|
3206
3210
|
translatableArrayOf,
|
|
3207
3211
|
translatableBooleanSchema,
|
|
3208
3212
|
translatableNumberSchema,
|
|
@@ -3212,7 +3216,7 @@ export {
|
|
|
3212
3216
|
updateEntrySchema,
|
|
3213
3217
|
updateProjectSchema,
|
|
3214
3218
|
upgradeProjectSchema,
|
|
3215
|
-
|
|
3219
|
+
urlFieldDefinitionSchema,
|
|
3216
3220
|
userFileSchema,
|
|
3217
3221
|
userSchema,
|
|
3218
3222
|
uuid,
|
|
@@ -3223,7 +3227,6 @@ export {
|
|
|
3223
3227
|
valueContentReferenceToCollectionSchema,
|
|
3224
3228
|
valueContentReferenceToEntrySchema,
|
|
3225
3229
|
valueContentReferenceWithLanguageBase,
|
|
3226
|
-
valueDefinitionSchema,
|
|
3227
3230
|
valueSchema,
|
|
3228
3231
|
versionSchema
|
|
3229
3232
|
};
|