@elek-io/core 0.6.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.
@@ -127,13 +127,13 @@ var baseFileSchema = z2.object({
127
127
  */
128
128
  id: uuidSchema.readonly(),
129
129
  /**
130
- * The timestamp of the file being created is set by the service of "objectType" while creating it
130
+ * The datetime of the file being created is set by the service of "objectType" while creating it
131
131
  */
132
- created: z2.number().readonly(),
132
+ created: z2.string().datetime().readonly(),
133
133
  /**
134
- * The timestamp of the file being updated is set by the service of "objectType" while updating it
134
+ * The datetime of the file being updated is set by the service of "objectType" while updating it
135
135
  */
136
- updated: z2.number().nullable()
136
+ updated: z2.string().datetime().nullable()
137
137
  });
138
138
  var baseFileWithLanguageSchema = baseFileSchema.extend({
139
139
  /**
@@ -210,7 +210,7 @@ var deleteAssetSchema = assetFileSchema.pick({
210
210
  var countAssetsSchema = z3.object({ projectId: uuidSchema.readonly() });
211
211
 
212
212
  // src/schema/collectionSchema.ts
213
- import z6 from "zod";
213
+ import z7 from "zod";
214
214
 
215
215
  // src/schema/entrySchema.ts
216
216
  import z5 from "zod";
@@ -223,153 +223,6 @@ var ValueTypeSchema = z4.enum([
223
223
  "boolean",
224
224
  "reference"
225
225
  ]);
226
- var ValueInputTypeSchema = z4.enum([
227
- // String
228
- "text",
229
- "textarea",
230
- "email",
231
- // 'password', @todo maybe if there is a usecase
232
- "url",
233
- "ip",
234
- "date",
235
- "time",
236
- "datetime",
237
- "telephone",
238
- // Number
239
- "number",
240
- "range",
241
- // Boolean
242
- "toggle",
243
- // Reference
244
- "asset",
245
- "entry"
246
- // 'sharedValue', // @todo
247
- ]);
248
- var ValueInputWidthSchema = z4.enum(["12", "6", "4", "3"]);
249
- var ValueDefinitionBaseSchema = z4.object({
250
- id: uuidSchema.readonly(),
251
- label: translatableStringSchema,
252
- description: translatableStringSchema,
253
- isRequired: z4.boolean(),
254
- isDisabled: z4.boolean(),
255
- isUnique: z4.boolean(),
256
- inputWidth: ValueInputWidthSchema
257
- });
258
- var StringValueDefinitionBaseSchema = ValueDefinitionBaseSchema.extend(
259
- {
260
- valueType: z4.literal(ValueTypeSchema.Enum.string),
261
- defaultValue: z4.string().nullable()
262
- }
263
- );
264
- var textValueDefinitionSchema = StringValueDefinitionBaseSchema.extend(
265
- {
266
- inputType: z4.literal(ValueInputTypeSchema.Enum.text),
267
- min: z4.number().nullable(),
268
- max: z4.number().nullable()
269
- }
270
- );
271
- var textareaValueDefinitionSchema = StringValueDefinitionBaseSchema.extend({
272
- inputType: z4.literal(ValueInputTypeSchema.Enum.textarea),
273
- min: z4.number().nullable(),
274
- max: z4.number().nullable()
275
- });
276
- var emailValueDefinitionSchema = StringValueDefinitionBaseSchema.extend({
277
- inputType: z4.literal(ValueInputTypeSchema.Enum.email),
278
- defaultValue: z4.string().email().nullable()
279
- });
280
- var urlValueDefinitionSchema = StringValueDefinitionBaseSchema.extend({
281
- inputType: z4.literal(ValueInputTypeSchema.Enum.url),
282
- defaultValue: z4.string().url().nullable()
283
- });
284
- var ipValueDefinitionSchema = StringValueDefinitionBaseSchema.extend({
285
- inputType: z4.literal(ValueInputTypeSchema.Enum.ip),
286
- defaultValue: z4.string().ip().nullable()
287
- });
288
- var dateValueDefinitionSchema = StringValueDefinitionBaseSchema.extend(
289
- {
290
- inputType: z4.literal(ValueInputTypeSchema.Enum.date),
291
- defaultValue: z4.string().date().nullable()
292
- }
293
- );
294
- var timeValueDefinitionSchema = StringValueDefinitionBaseSchema.extend(
295
- {
296
- inputType: z4.literal(ValueInputTypeSchema.Enum.time),
297
- defaultValue: z4.string().time().nullable()
298
- }
299
- );
300
- var datetimeValueDefinitionSchema = StringValueDefinitionBaseSchema.extend({
301
- inputType: z4.literal(ValueInputTypeSchema.Enum.datetime),
302
- defaultValue: z4.string().datetime().nullable()
303
- });
304
- var telephoneValueDefinitionSchema = StringValueDefinitionBaseSchema.extend({
305
- inputType: z4.literal(ValueInputTypeSchema.Enum.telephone)
306
- // defaultValue: z.string().e164(), @todo when zod v4 releases @see https://github.com/colinhacks/zod/pull/3476
307
- });
308
- var stringValueDefinitionSchema = z4.union([
309
- textValueDefinitionSchema,
310
- textareaValueDefinitionSchema,
311
- emailValueDefinitionSchema,
312
- urlValueDefinitionSchema,
313
- ipValueDefinitionSchema,
314
- dateValueDefinitionSchema,
315
- timeValueDefinitionSchema,
316
- datetimeValueDefinitionSchema,
317
- telephoneValueDefinitionSchema
318
- ]);
319
- var NumberValueDefinitionBaseSchema = ValueDefinitionBaseSchema.extend(
320
- {
321
- valueType: z4.literal(ValueTypeSchema.Enum.number),
322
- min: z4.number().nullable(),
323
- max: z4.number().nullable(),
324
- isUnique: z4.literal(false),
325
- defaultValue: z4.number().nullable()
326
- }
327
- );
328
- var numberValueDefinitionSchema = NumberValueDefinitionBaseSchema.extend({
329
- inputType: z4.literal(ValueInputTypeSchema.Enum.number)
330
- });
331
- var rangeValueDefinitionSchema = NumberValueDefinitionBaseSchema.extend({
332
- inputType: z4.literal(ValueInputTypeSchema.Enum.range),
333
- // Overwrite from nullable to required because a range needs min, max and default to work and is required, since it always returns a number
334
- isRequired: z4.literal(true),
335
- min: z4.number(),
336
- max: z4.number(),
337
- defaultValue: z4.number()
338
- });
339
- var BooleanValueDefinitionBaseSchema = ValueDefinitionBaseSchema.extend({
340
- valueType: z4.literal(ValueTypeSchema.Enum.boolean),
341
- // Overwrite from nullable to required because a boolean needs a default to work and is required, since it always is either true or false
342
- isRequired: z4.literal(true),
343
- defaultValue: z4.boolean(),
344
- isUnique: z4.literal(false)
345
- });
346
- var toggleValueDefinitionSchema = BooleanValueDefinitionBaseSchema.extend({
347
- inputType: z4.literal(ValueInputTypeSchema.Enum.toggle)
348
- });
349
- var ReferenceValueDefinitionBaseSchema = ValueDefinitionBaseSchema.extend({
350
- valueType: z4.literal(ValueTypeSchema.Enum.reference)
351
- });
352
- var assetValueDefinitionSchema = ReferenceValueDefinitionBaseSchema.extend({
353
- inputType: z4.literal(ValueInputTypeSchema.Enum.asset),
354
- allowedMimeTypes: z4.array(supportedAssetMimeTypeSchema).min(1),
355
- min: z4.number().nullable(),
356
- max: z4.number().nullable()
357
- });
358
- var entryValueDefinitionSchema = ReferenceValueDefinitionBaseSchema.extend({
359
- inputType: z4.literal(ValueInputTypeSchema.Enum.entry),
360
- ofCollections: z4.array(uuidSchema),
361
- min: z4.number().nullable(),
362
- max: z4.number().nullable()
363
- });
364
- var valueDefinitionSchema = z4.union([
365
- stringValueDefinitionSchema,
366
- numberValueDefinitionSchema,
367
- rangeValueDefinitionSchema,
368
- toggleValueDefinitionSchema,
369
- assetValueDefinitionSchema,
370
- entryValueDefinitionSchema
371
- // sharedValueDefinitionSchema,
372
- ]);
373
226
  var valueContentReferenceBase = z4.object({
374
227
  id: uuidSchema
375
228
  });
@@ -399,7 +252,7 @@ var resolvedValueContentReferenceSchema = z4.union([
399
252
  ]);
400
253
  var directValueBaseSchema = z4.object({
401
254
  objectType: z4.literal(objectTypeSchema.Enum.value).readonly(),
402
- definitionId: uuidSchema.readonly()
255
+ fieldDefinitionId: uuidSchema.readonly()
403
256
  });
404
257
  var directStringValueSchema = directValueBaseSchema.extend({
405
258
  valueType: z4.literal(ValueTypeSchema.Enum.string).readonly(),
@@ -420,7 +273,7 @@ var directValueSchema = z4.union([
420
273
  ]);
421
274
  var referencedValueSchema = z4.object({
422
275
  objectType: z4.literal(objectTypeSchema.Enum.value).readonly(),
423
- definitionId: uuidSchema.readonly(),
276
+ fieldDefinitionId: uuidSchema.readonly(),
424
277
  valueType: z4.literal(ValueTypeSchema.Enum.reference).readonly(),
425
278
  content: translatableArrayOf(valueContentReferenceSchema)
426
279
  });
@@ -432,28 +285,216 @@ var resolvedValueSchema = z4.union([
432
285
  directValueSchema,
433
286
  resolvedReferencedValueSchema
434
287
  ]);
435
- function getValueContentSchemaFromDefinition(definition) {
436
- switch (definition.valueType) {
288
+
289
+ // src/schema/entrySchema.ts
290
+ var entryFileSchema = baseFileSchema.extend({
291
+ objectType: z5.literal(objectTypeSchema.Enum.entry).readonly(),
292
+ values: z5.array(valueSchema)
293
+ });
294
+ var entrySchema = entryFileSchema.extend({
295
+ values: z5.array(z5.lazy(() => resolvedValueSchema))
296
+ });
297
+ var entryExportSchema = entrySchema.extend({});
298
+ var createEntrySchema = entryFileSchema.omit({
299
+ id: true,
300
+ objectType: true,
301
+ created: true,
302
+ updated: true
303
+ }).extend({
304
+ projectId: uuidSchema.readonly(),
305
+ collectionId: uuidSchema.readonly(),
306
+ values: z5.array(valueSchema)
307
+ });
308
+ var readEntrySchema = z5.object({
309
+ id: uuidSchema.readonly(),
310
+ projectId: uuidSchema.readonly(),
311
+ collectionId: uuidSchema.readonly()
312
+ });
313
+ var updateEntrySchema = entrySchema.omit({
314
+ objectType: true,
315
+ created: true,
316
+ updated: true
317
+ }).extend({
318
+ projectId: uuidSchema.readonly(),
319
+ collectionId: uuidSchema.readonly()
320
+ });
321
+ var deleteEntrySchema = readEntrySchema.extend({});
322
+ var countEntriesSchema = z5.object({
323
+ projectId: uuidSchema.readonly(),
324
+ collectionId: uuidSchema.readonly()
325
+ });
326
+
327
+ // src/schema/fieldSchema.ts
328
+ import { z as z6 } from "zod";
329
+ var FieldTypeSchema = z6.enum([
330
+ // String Values
331
+ "text",
332
+ "textarea",
333
+ "email",
334
+ // 'password', @todo maybe if there is a usecase
335
+ "url",
336
+ "ip",
337
+ "date",
338
+ "time",
339
+ "datetime",
340
+ "telephone",
341
+ // Number Values
342
+ "number",
343
+ "range",
344
+ // Boolean Values
345
+ "toggle",
346
+ // Reference Values
347
+ "asset",
348
+ "entry"
349
+ // 'sharedValue', // @todo
350
+ ]);
351
+ var FieldWidthSchema = z6.enum(["12", "6", "4", "3"]);
352
+ var FieldDefinitionBaseSchema = z6.object({
353
+ id: uuidSchema.readonly(),
354
+ label: translatableStringSchema,
355
+ description: translatableStringSchema,
356
+ isRequired: z6.boolean(),
357
+ isDisabled: z6.boolean(),
358
+ isUnique: z6.boolean(),
359
+ inputWidth: FieldWidthSchema
360
+ });
361
+ var StringFieldDefinitionBaseSchema = FieldDefinitionBaseSchema.extend(
362
+ {
363
+ valueType: z6.literal(ValueTypeSchema.Enum.string),
364
+ defaultValue: z6.string().nullable()
365
+ }
366
+ );
367
+ var textFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend(
368
+ {
369
+ fieldType: z6.literal(FieldTypeSchema.Enum.text),
370
+ min: z6.number().nullable(),
371
+ max: z6.number().nullable()
372
+ }
373
+ );
374
+ var textareaFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
375
+ fieldType: z6.literal(FieldTypeSchema.Enum.textarea),
376
+ min: z6.number().nullable(),
377
+ max: z6.number().nullable()
378
+ });
379
+ var emailFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
380
+ fieldType: z6.literal(FieldTypeSchema.Enum.email),
381
+ defaultValue: z6.string().email().nullable()
382
+ });
383
+ var urlFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
384
+ fieldType: z6.literal(FieldTypeSchema.Enum.url),
385
+ defaultValue: z6.string().url().nullable()
386
+ });
387
+ var ipFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
388
+ fieldType: z6.literal(FieldTypeSchema.Enum.ip),
389
+ defaultValue: z6.string().ip().nullable()
390
+ });
391
+ var dateFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend(
392
+ {
393
+ fieldType: z6.literal(FieldTypeSchema.Enum.date),
394
+ defaultValue: z6.string().date().nullable()
395
+ }
396
+ );
397
+ var timeFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend(
398
+ {
399
+ fieldType: z6.literal(FieldTypeSchema.Enum.time),
400
+ defaultValue: z6.string().time().nullable()
401
+ }
402
+ );
403
+ var datetimeFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
404
+ fieldType: z6.literal(FieldTypeSchema.Enum.datetime),
405
+ defaultValue: z6.string().datetime().nullable()
406
+ });
407
+ var telephoneFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
408
+ fieldType: z6.literal(FieldTypeSchema.Enum.telephone)
409
+ // defaultValue: z.string().e164(), @todo when zod v4 releases @see https://github.com/colinhacks/zod/pull/3476
410
+ });
411
+ var stringFieldDefinitionSchema = z6.union([
412
+ textFieldDefinitionSchema,
413
+ textareaFieldDefinitionSchema,
414
+ emailFieldDefinitionSchema,
415
+ urlFieldDefinitionSchema,
416
+ ipFieldDefinitionSchema,
417
+ dateFieldDefinitionSchema,
418
+ timeFieldDefinitionSchema,
419
+ datetimeFieldDefinitionSchema,
420
+ telephoneFieldDefinitionSchema
421
+ ]);
422
+ var NumberFieldDefinitionBaseSchema = FieldDefinitionBaseSchema.extend(
423
+ {
424
+ valueType: z6.literal(ValueTypeSchema.Enum.number),
425
+ min: z6.number().nullable(),
426
+ max: z6.number().nullable(),
427
+ isUnique: z6.literal(false),
428
+ defaultValue: z6.number().nullable()
429
+ }
430
+ );
431
+ var numberFieldDefinitionSchema = NumberFieldDefinitionBaseSchema.extend({
432
+ fieldType: z6.literal(FieldTypeSchema.Enum.number)
433
+ });
434
+ var rangeFieldDefinitionSchema = NumberFieldDefinitionBaseSchema.extend({
435
+ fieldType: z6.literal(FieldTypeSchema.Enum.range),
436
+ // Overwrite from nullable to required because a range needs min, max and default to work and is required, since it always returns a number
437
+ isRequired: z6.literal(true),
438
+ min: z6.number(),
439
+ max: z6.number(),
440
+ defaultValue: z6.number()
441
+ });
442
+ var BooleanFieldDefinitionBaseSchema = FieldDefinitionBaseSchema.extend({
443
+ valueType: z6.literal(ValueTypeSchema.Enum.boolean),
444
+ // Overwrite from nullable to required because a boolean needs a default to work and is required, since it always is either true or false
445
+ isRequired: z6.literal(true),
446
+ defaultValue: z6.boolean(),
447
+ isUnique: z6.literal(false)
448
+ });
449
+ var toggleFieldDefinitionSchema = BooleanFieldDefinitionBaseSchema.extend({
450
+ fieldType: z6.literal(FieldTypeSchema.Enum.toggle)
451
+ });
452
+ var ReferenceFieldDefinitionBaseSchema = FieldDefinitionBaseSchema.extend({
453
+ valueType: z6.literal(ValueTypeSchema.Enum.reference)
454
+ });
455
+ var assetFieldDefinitionSchema = ReferenceFieldDefinitionBaseSchema.extend({
456
+ fieldType: z6.literal(FieldTypeSchema.Enum.asset),
457
+ allowedMimeTypes: z6.array(supportedAssetMimeTypeSchema).min(1),
458
+ min: z6.number().nullable(),
459
+ max: z6.number().nullable()
460
+ });
461
+ var entryFieldDefinitionSchema = ReferenceFieldDefinitionBaseSchema.extend({
462
+ fieldType: z6.literal(FieldTypeSchema.Enum.entry),
463
+ ofCollections: z6.array(uuidSchema),
464
+ min: z6.number().nullable(),
465
+ max: z6.number().nullable()
466
+ });
467
+ var fieldDefinitionSchema = z6.union([
468
+ stringFieldDefinitionSchema,
469
+ numberFieldDefinitionSchema,
470
+ rangeFieldDefinitionSchema,
471
+ toggleFieldDefinitionSchema,
472
+ assetFieldDefinitionSchema,
473
+ entryFieldDefinitionSchema
474
+ // sharedValueDefinitionSchema,
475
+ ]);
476
+ function getValueContentSchemaFromFieldDefinition(fieldDefinition) {
477
+ switch (fieldDefinition.valueType) {
437
478
  case ValueTypeSchema.Enum.boolean:
438
479
  return getBooleanValueContentSchema();
439
480
  case ValueTypeSchema.Enum.number:
440
- return getNumberValueContentSchema(definition);
481
+ return getNumberValueContentSchema(fieldDefinition);
441
482
  case ValueTypeSchema.Enum.string:
442
- return getStringValueContentSchema(definition);
483
+ return getStringValueContentSchema(fieldDefinition);
443
484
  case ValueTypeSchema.Enum.reference:
444
- return getReferenceValueContentSchema(definition);
485
+ return getReferenceValueContentSchema(fieldDefinition);
445
486
  default:
446
487
  throw new Error(
447
488
  // @ts-expect-error
448
- `Error generating schema for unsupported ValueType "${definition.valueType}"`
489
+ `Error generating schema for unsupported ValueType "${fieldDefinition.valueType}"`
449
490
  );
450
491
  }
451
492
  }
452
493
  function getBooleanValueContentSchema() {
453
- return z4.boolean();
494
+ return z6.boolean();
454
495
  }
455
496
  function getNumberValueContentSchema(definition) {
456
- let schema = z4.number();
497
+ let schema = z6.number();
457
498
  if (definition.min) {
458
499
  schema = schema.min(definition.min);
459
500
  }
@@ -466,33 +507,33 @@ function getNumberValueContentSchema(definition) {
466
507
  return schema;
467
508
  }
468
509
  function getStringValueContentSchema(definition) {
469
- let schema = z4.string().trim();
510
+ let schema = z6.string().trim();
470
511
  if ("min" in definition && definition.min) {
471
512
  schema = schema.min(definition.min);
472
513
  }
473
514
  if ("max" in definition && definition.max) {
474
515
  schema = schema.max(definition.max);
475
516
  }
476
- switch (definition.inputType) {
477
- case ValueInputTypeSchema.Enum.email:
517
+ switch (definition.fieldType) {
518
+ case FieldTypeSchema.Enum.email:
478
519
  schema = schema.email();
479
520
  break;
480
- case ValueInputTypeSchema.Enum.url:
521
+ case FieldTypeSchema.Enum.url:
481
522
  schema = schema.url();
482
523
  break;
483
- case ValueInputTypeSchema.Enum.ip:
524
+ case FieldTypeSchema.Enum.ip:
484
525
  schema = schema.ip();
485
526
  break;
486
- case ValueInputTypeSchema.Enum.date:
527
+ case FieldTypeSchema.Enum.date:
487
528
  schema = schema.date();
488
529
  break;
489
- case ValueInputTypeSchema.Enum.time:
530
+ case FieldTypeSchema.Enum.time:
490
531
  schema = schema.time();
491
532
  break;
492
- case ValueInputTypeSchema.Enum.datetime:
533
+ case FieldTypeSchema.Enum.datetime:
493
534
  schema = schema.datetime();
494
535
  break;
495
- case ValueInputTypeSchema.Enum.telephone:
536
+ case FieldTypeSchema.Enum.telephone:
496
537
  break;
497
538
  }
498
539
  if (definition.isRequired === false) {
@@ -502,15 +543,15 @@ function getStringValueContentSchema(definition) {
502
543
  }
503
544
  function getReferenceValueContentSchema(definition) {
504
545
  let schema;
505
- switch (definition.inputType) {
506
- case ValueInputTypeSchema.Enum.asset:
546
+ switch (definition.fieldType) {
547
+ case FieldTypeSchema.Enum.asset:
507
548
  {
508
- schema = z4.array(valueContentReferenceToAssetSchema);
549
+ schema = z6.array(valueContentReferenceToAssetSchema);
509
550
  }
510
551
  break;
511
- case ValueInputTypeSchema.Enum.entry:
552
+ case FieldTypeSchema.Enum.entry:
512
553
  {
513
- schema = z4.array(valueContentReferenceToEntrySchema);
554
+ schema = z6.array(valueContentReferenceToEntrySchema);
514
555
  }
515
556
  break;
516
557
  }
@@ -526,62 +567,24 @@ function getReferenceValueContentSchema(definition) {
526
567
  return schema;
527
568
  }
528
569
 
529
- // src/schema/entrySchema.ts
530
- var entryFileSchema = baseFileSchema.extend({
531
- objectType: z5.literal(objectTypeSchema.Enum.entry).readonly(),
532
- values: z5.array(valueSchema)
533
- });
534
- var entrySchema = entryFileSchema.extend({
535
- values: z5.array(z5.lazy(() => resolvedValueSchema))
536
- });
537
- var entryExportSchema = entrySchema.extend({});
538
- var createEntrySchema = entryFileSchema.omit({
539
- id: true,
540
- objectType: true,
541
- created: true,
542
- updated: true
543
- }).extend({
544
- projectId: uuidSchema.readonly(),
545
- collectionId: uuidSchema.readonly(),
546
- values: z5.array(valueSchema)
547
- });
548
- var readEntrySchema = z5.object({
549
- id: uuidSchema.readonly(),
550
- projectId: uuidSchema.readonly(),
551
- collectionId: uuidSchema.readonly()
552
- });
553
- var updateEntrySchema = entrySchema.omit({
554
- objectType: true,
555
- created: true,
556
- updated: true
557
- }).extend({
558
- projectId: uuidSchema.readonly(),
559
- collectionId: uuidSchema.readonly()
560
- });
561
- var deleteEntrySchema = readEntrySchema.extend({});
562
- var countEntriesSchema = z5.object({
563
- projectId: uuidSchema.readonly(),
564
- collectionId: uuidSchema.readonly()
565
- });
566
-
567
570
  // src/schema/collectionSchema.ts
568
571
  var collectionFileSchema = baseFileSchema.extend({
569
- objectType: z6.literal(objectTypeSchema.Enum.collection).readonly(),
570
- name: z6.object({
572
+ objectType: z7.literal(objectTypeSchema.Enum.collection).readonly(),
573
+ name: z7.object({
571
574
  singular: translatableStringSchema,
572
575
  plural: translatableStringSchema
573
576
  }),
574
- slug: z6.object({
575
- singular: z6.string(),
576
- plural: z6.string()
577
+ slug: z7.object({
578
+ singular: z7.string(),
579
+ plural: z7.string()
577
580
  }),
578
581
  description: translatableStringSchema,
579
582
  icon: supportedIconSchema,
580
- valueDefinitions: z6.array(valueDefinitionSchema)
583
+ fieldDefinitions: z7.array(fieldDefinitionSchema)
581
584
  });
582
585
  var collectionSchema = collectionFileSchema.extend({});
583
586
  var collectionExportSchema = collectionSchema.extend({
584
- entries: z6.array(entryExportSchema)
587
+ entries: z7.array(entryExportSchema)
585
588
  });
586
589
  var createCollectionSchema = collectionSchema.omit({
587
590
  id: true,
@@ -591,7 +594,7 @@ var createCollectionSchema = collectionSchema.omit({
591
594
  }).extend({
592
595
  projectId: uuidSchema.readonly()
593
596
  });
594
- var readCollectionSchema = z6.object({
597
+ var readCollectionSchema = z7.object({
595
598
  id: uuidSchema.readonly(),
596
599
  projectId: uuidSchema.readonly()
597
600
  });
@@ -601,18 +604,18 @@ var updateCollectionSchema = collectionFileSchema.pick({
601
604
  slug: true,
602
605
  description: true,
603
606
  icon: true,
604
- valueDefinitions: true
607
+ fieldDefinitions: true
605
608
  }).extend({
606
609
  projectId: uuidSchema.readonly()
607
610
  });
608
611
  var deleteCollectionSchema = readCollectionSchema.extend({});
609
- var countCollectionsSchema = z6.object({
612
+ var countCollectionsSchema = z7.object({
610
613
  projectId: uuidSchema.readonly()
611
614
  });
612
615
 
613
616
  // src/schema/coreSchema.ts
614
- import { z as z7 } from "zod";
615
- var elekIoCoreOptionsSchema = z7.object({
617
+ import { z as z8 } from "zod";
618
+ var elekIoCoreOptionsSchema = z8.object({
616
619
  /**
617
620
  * The environment elek.io Core is currently running in
618
621
  */
@@ -621,14 +624,14 @@ var elekIoCoreOptionsSchema = z7.object({
621
624
  * The current version of elek.io Core
622
625
  */
623
626
  version: versionSchema,
624
- file: z7.object({
625
- json: z7.object({
627
+ file: z8.object({
628
+ json: z8.object({
626
629
  /**
627
630
  * If set, adds indentation with spaces (number) or escape character (string)
628
631
  * and line break characters to saved JSON files on disk, to make them easier to read.
629
632
  * Defaults to 2 spaces of indentation.
630
633
  */
631
- indentation: z7.union([z7.number(), z7.string()])
634
+ indentation: z8.union([z8.number(), z8.string()])
632
635
  })
633
636
  })
634
637
  });
@@ -640,21 +643,21 @@ var constructorElekIoCoreSchema = elekIoCoreOptionsSchema.omit({
640
643
  }).optional();
641
644
 
642
645
  // src/schema/gitSchema.ts
643
- import { z as z8 } from "zod";
644
- var gitRepositoryPathSchema = z8.string();
645
- var gitSignatureSchema = z8.object({
646
- name: z8.string(),
647
- email: z8.string()
646
+ import { z as z9 } from "zod";
647
+ var gitRepositoryPathSchema = z9.string();
648
+ var gitSignatureSchema = z9.object({
649
+ name: z9.string(),
650
+ email: z9.string()
648
651
  });
649
- var gitCommitSchema = z8.object({
652
+ var gitCommitSchema = z9.object({
650
653
  /**
651
654
  * SHA-1 hash of the commit
652
655
  */
653
- hash: z8.string(),
654
- message: z8.string(),
656
+ hash: z9.string(),
657
+ message: z9.string(),
655
658
  author: gitSignatureSchema,
656
- timestamp: z8.number(),
657
- tag: z8.string().nullable()
659
+ datetime: z9.string().datetime(),
660
+ tag: z9.string().nullable()
658
661
  });
659
662
  var GitCommitIconNative = /* @__PURE__ */ ((GitCommitIconNative2) => {
660
663
  GitCommitIconNative2["INIT"] = ":tada:";
@@ -663,66 +666,66 @@ var GitCommitIconNative = /* @__PURE__ */ ((GitCommitIconNative2) => {
663
666
  GitCommitIconNative2["DELETE"] = ":fire:";
664
667
  return GitCommitIconNative2;
665
668
  })(GitCommitIconNative || {});
666
- var gitCommitIconSchema = z8.nativeEnum(GitCommitIconNative);
667
- var gitInitOptionsSchema = z8.object({
669
+ var gitCommitIconSchema = z9.nativeEnum(GitCommitIconNative);
670
+ var gitInitOptionsSchema = z9.object({
668
671
  /**
669
672
  * 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).
670
673
  */
671
- initialBranch: z8.string()
674
+ initialBranch: z9.string()
672
675
  });
673
- var gitCloneOptionsSchema = z8.object({
676
+ var gitCloneOptionsSchema = z9.object({
674
677
  /**
675
678
  * 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.
676
679
  */
677
- depth: z8.number(),
680
+ depth: z9.number(),
678
681
  /**
679
682
  * 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.
680
683
  */
681
- singleBranch: z8.boolean(),
684
+ singleBranch: z9.boolean(),
682
685
  /**
683
686
  * 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.
684
687
  */
685
- branch: z8.string()
688
+ branch: z9.string()
686
689
  });
687
- var gitSwitchOptionsSchema = z8.object({
690
+ var gitSwitchOptionsSchema = z9.object({
688
691
  /**
689
692
  * If true, creates a new local branch and then switches to it
690
693
  *
691
694
  * @see https://git-scm.com/docs/git-switch#Documentation/git-switch.txt---createltnew-branchgt
692
695
  */
693
- isNew: z8.boolean().optional()
696
+ isNew: z9.boolean().optional()
694
697
  });
695
- var gitLogOptionsSchema = z8.object({
698
+ var gitLogOptionsSchema = z9.object({
696
699
  /**
697
700
  * Limit the result to given number of commits
698
701
  */
699
- limit: z8.number().optional(),
702
+ limit: z9.number().optional(),
700
703
  /**
701
704
  * Only list commits that are between given SHAs or tag names
702
705
  *
703
706
  * Note that the commits of from and to are not included in the result
704
707
  */
705
- between: z8.object({
708
+ between: z9.object({
706
709
  /**
707
710
  * From the oldest commit
708
711
  */
709
- from: z8.string(),
712
+ from: z9.string(),
710
713
  /**
711
714
  * To the newest commit
712
715
  *
713
716
  * Defaults to the current HEAD
714
717
  */
715
- to: z8.string().optional()
718
+ to: z9.string().optional()
716
719
  })
717
720
  });
718
721
 
719
722
  // src/schema/gitTagSchema.ts
720
- import { z as z9 } from "zod";
721
- var gitTagSchema = z9.object({
723
+ import { z as z10 } from "zod";
724
+ var gitTagSchema = z10.object({
722
725
  id: uuidSchema,
723
- message: z9.string(),
726
+ message: z10.string(),
724
727
  author: gitSignatureSchema,
725
- timestamp: z9.number()
728
+ datetime: z10.string().datetime()
726
729
  });
727
730
  var createGitTagSchema = gitTagSchema.pick({
728
731
  message: true
@@ -730,25 +733,25 @@ var createGitTagSchema = gitTagSchema.pick({
730
733
  path: gitRepositoryPathSchema,
731
734
  hash: gitCommitSchema.shape.hash.optional()
732
735
  });
733
- var readGitTagSchema = z9.object({
736
+ var readGitTagSchema = z10.object({
734
737
  path: gitRepositoryPathSchema,
735
738
  id: uuidSchema.readonly()
736
739
  });
737
740
  var deleteGitTagSchema = readGitTagSchema.extend({});
738
- var countGitTagsSchema = z9.object({
741
+ var countGitTagsSchema = z10.object({
739
742
  path: gitRepositoryPathSchema
740
743
  });
741
744
 
742
745
  // src/schema/projectSchema.ts
743
- import { z as z10 } from "zod";
744
- var projectStatusSchema = z10.enum(["foo", "bar", "todo"]);
745
- var projectSettingsSchema = z10.object({
746
- language: z10.object({
746
+ import { z as z11 } from "zod";
747
+ var projectStatusSchema = z11.enum(["foo", "bar", "todo"]);
748
+ var projectSettingsSchema = z11.object({
749
+ language: z11.object({
747
750
  default: supportedLanguageSchema,
748
- supported: z10.array(supportedLanguageSchema)
751
+ supported: z11.array(supportedLanguageSchema)
749
752
  })
750
753
  });
751
- var projectFolderSchema = z10.enum([
754
+ var projectFolderSchema = z11.enum([
752
755
  "assets",
753
756
  "collections",
754
757
  "shared-values",
@@ -758,18 +761,18 @@ var projectFolderSchema = z10.enum([
758
761
  // 'theme',
759
762
  ]);
760
763
  var projectFileSchema = baseFileSchema.extend({
761
- objectType: z10.literal(objectTypeSchema.Enum.project).readonly(),
764
+ objectType: z11.literal(objectTypeSchema.Enum.project).readonly(),
762
765
  coreVersion: versionSchema,
763
- name: z10.string().trim().min(1, "shared.projectNameRequired"),
764
- description: z10.string().trim().min(1, "shared.projectDescriptionRequired"),
766
+ name: z11.string().trim().min(1, "shared.projectNameRequired"),
767
+ description: z11.string().trim().min(1, "shared.projectDescriptionRequired"),
765
768
  version: versionSchema,
766
769
  status: projectStatusSchema,
767
770
  settings: projectSettingsSchema
768
771
  });
769
772
  var projectSchema = projectFileSchema.extend({});
770
773
  var projectExportSchema = projectSchema.extend({
771
- assets: z10.array(assetExportSchema),
772
- collections: z10.array(collectionExportSchema)
774
+ assets: z11.array(assetExportSchema),
775
+ collections: z11.array(collectionExportSchema)
773
776
  });
774
777
  var createProjectSchema = projectSchema.pick({
775
778
  name: true,
@@ -779,7 +782,7 @@ var createProjectSchema = projectSchema.pick({
779
782
  description: true,
780
783
  settings: true
781
784
  });
782
- var readProjectSchema = z10.object({
785
+ var readProjectSchema = z11.object({
783
786
  id: uuidSchema.readonly()
784
787
  });
785
788
  var updateProjectSchema = projectSchema.pick({
@@ -792,11 +795,11 @@ var updateProjectSchema = projectSchema.pick({
792
795
  description: true,
793
796
  settings: true
794
797
  });
795
- var upgradeProjectSchema = z10.object({
798
+ var upgradeProjectSchema = z11.object({
796
799
  id: uuidSchema.readonly()
797
800
  });
798
801
  var deleteProjectSchema = readProjectSchema.extend({});
799
- var projectUpgradeSchema = z10.object({
802
+ var projectUpgradeSchema = z11.object({
800
803
  /**
801
804
  * The Core version the Project will be upgraded to
802
805
  */
@@ -804,45 +807,45 @@ var projectUpgradeSchema = z10.object({
804
807
  /**
805
808
  * Function that will be executed in the process of upgrading a Project
806
809
  */
807
- run: z10.function().args(projectFileSchema).returns(z10.promise(z10.void()))
810
+ run: z11.function().args(projectFileSchema).returns(z11.promise(z11.void()))
808
811
  });
809
- var cloneProjectSchema = z10.object({
810
- url: z10.string()
812
+ var cloneProjectSchema = z11.object({
813
+ url: z11.string()
811
814
  });
812
- var listBranchesProjectSchema = z10.object({
815
+ var listBranchesProjectSchema = z11.object({
813
816
  id: uuidSchema.readonly()
814
817
  });
815
- var currentBranchProjectSchema = z10.object({
818
+ var currentBranchProjectSchema = z11.object({
816
819
  id: uuidSchema.readonly()
817
820
  });
818
- var switchBranchProjectSchema = z10.object({
821
+ var switchBranchProjectSchema = z11.object({
819
822
  id: uuidSchema.readonly(),
820
- branch: z10.string(),
823
+ branch: z11.string(),
821
824
  options: gitSwitchOptionsSchema.optional()
822
825
  });
823
- var getRemoteOriginUrlProjectSchema = z10.object({
826
+ var getRemoteOriginUrlProjectSchema = z11.object({
824
827
  id: uuidSchema.readonly()
825
828
  });
826
- var setRemoteOriginUrlProjectSchema = z10.object({
829
+ var setRemoteOriginUrlProjectSchema = z11.object({
827
830
  id: uuidSchema.readonly(),
828
- url: z10.string()
831
+ url: z11.string()
829
832
  });
830
- var getChangesProjectSchema = z10.object({
833
+ var getChangesProjectSchema = z11.object({
831
834
  id: uuidSchema.readonly()
832
835
  });
833
- var synchronizeProjectSchema = z10.object({
836
+ var synchronizeProjectSchema = z11.object({
834
837
  id: uuidSchema.readonly()
835
838
  });
836
- var searchProjectSchema = z10.object({
839
+ var searchProjectSchema = z11.object({
837
840
  id: uuidSchema.readonly(),
838
- query: z10.string(),
841
+ query: z11.string(),
839
842
  language: supportedLanguageSchema,
840
- type: z10.array(objectTypeSchema).optional()
843
+ type: z11.array(objectTypeSchema).optional()
841
844
  });
842
845
 
843
846
  // src/schema/serviceSchema.ts
844
- import { z as z11 } from "zod";
845
- var serviceTypeSchema = z11.enum([
847
+ import { z as z12 } from "zod";
848
+ var serviceTypeSchema = z12.enum([
846
849
  "Git",
847
850
  "GitTag",
848
851
  "User",
@@ -854,10 +857,10 @@ var serviceTypeSchema = z11.enum([
854
857
  "Entry",
855
858
  "Value"
856
859
  ]);
857
- var listSchema = z11.object({
860
+ var listSchema = z12.object({
858
861
  projectId: uuidSchema,
859
- limit: z11.number().optional(),
860
- offset: z11.number().optional()
862
+ limit: z12.number().optional(),
863
+ offset: z12.number().optional()
861
864
  });
862
865
  var listCollectionsSchema = listSchema;
863
866
  var listEntriesSchema = listSchema.extend({
@@ -867,63 +870,61 @@ var listAssetsSchema = listSchema;
867
870
  var listProjectsSchema = listSchema.omit({
868
871
  projectId: true
869
872
  });
870
- var listGitTagsSchema = z11.object({
873
+ var listGitTagsSchema = z12.object({
871
874
  path: gitRepositoryPathSchema
872
875
  });
873
876
 
874
877
  // src/schema/userSchema.ts
875
- import z12 from "zod";
876
- var UserTypeSchema = z12.enum(["local", "cloud"]);
878
+ import z13 from "zod";
879
+ var UserTypeSchema = z13.enum(["local", "cloud"]);
877
880
  var baseUserSchema = gitSignatureSchema.extend({
878
881
  userType: UserTypeSchema,
879
882
  language: supportedLanguageSchema
880
883
  });
881
884
  var localUserSchema = baseUserSchema.extend({
882
- userType: z12.literal(UserTypeSchema.Enum.local)
885
+ userType: z13.literal(UserTypeSchema.Enum.local)
883
886
  });
884
887
  var cloudUserSchema = baseUserSchema.extend({
885
- userType: z12.literal(UserTypeSchema.Enum.cloud),
888
+ userType: z13.literal(UserTypeSchema.Enum.cloud),
886
889
  id: uuidSchema
887
890
  });
888
- var userFileSchema = z12.union([localUserSchema, cloudUserSchema]);
891
+ var userFileSchema = z13.union([localUserSchema, cloudUserSchema]);
889
892
  var userSchema = userFileSchema;
890
893
  var setUserSchema = userSchema;
891
894
 
892
895
  // src/util/shared.ts
893
- import slugify from "slugify";
896
+ import slugify from "@sindresorhus/slugify";
894
897
  import { v4 as generateUuid } from "uuid";
895
- var Slugify = slugify.default || slugify;
896
898
  function uuid() {
897
899
  return generateUuid();
898
900
  }
899
- function currentTimestamp() {
900
- return Math.floor(Date.now() / 1e3);
901
+ function datetime(value) {
902
+ if (!value) {
903
+ return (/* @__PURE__ */ new Date()).toISOString();
904
+ }
905
+ return new Date(value).toISOString();
901
906
  }
902
907
  function slug(string) {
903
- return Slugify(string, {
904
- replacement: "-",
905
- // replace spaces with replacement character, defaults to `-`
906
- // remove: undefined, // remove characters that match regex, defaults to `undefined`
907
- lower: true,
908
- // convert to lower case, defaults to `false`
909
- strict: true
910
- // strip special characters except replacement, defaults to `false`
908
+ return slugify(string, {
909
+ separator: "-",
910
+ lowercase: true,
911
+ decamelize: true
911
912
  });
912
913
  }
913
914
  export {
914
- BooleanValueDefinitionBaseSchema,
915
- NumberValueDefinitionBaseSchema,
916
- ReferenceValueDefinitionBaseSchema,
917
- StringValueDefinitionBaseSchema,
915
+ BooleanFieldDefinitionBaseSchema,
916
+ FieldDefinitionBaseSchema,
917
+ FieldTypeSchema,
918
+ FieldWidthSchema,
919
+ NumberFieldDefinitionBaseSchema,
920
+ ReferenceFieldDefinitionBaseSchema,
921
+ StringFieldDefinitionBaseSchema,
918
922
  UserTypeSchema,
919
- ValueDefinitionBaseSchema,
920
- ValueInputTypeSchema,
921
- ValueInputWidthSchema,
922
923
  ValueTypeSchema,
923
924
  assetExportSchema,
925
+ assetFieldDefinitionSchema,
924
926
  assetFileSchema,
925
927
  assetSchema,
926
- assetValueDefinitionSchema,
927
928
  baseFileSchema,
928
929
  baseFileWithLanguageSchema,
929
930
  baseUserSchema,
@@ -943,9 +944,9 @@ export {
943
944
  createGitTagSchema,
944
945
  createProjectSchema,
945
946
  currentBranchProjectSchema,
946
- currentTimestamp,
947
- dateValueDefinitionSchema,
948
- datetimeValueDefinitionSchema,
947
+ dateFieldDefinitionSchema,
948
+ datetime,
949
+ datetimeFieldDefinitionSchema,
949
950
  deleteAssetSchema,
950
951
  deleteCollectionSchema,
951
952
  deleteEntrySchema,
@@ -957,16 +958,17 @@ export {
957
958
  directValueBaseSchema,
958
959
  directValueSchema,
959
960
  elekIoCoreOptionsSchema,
960
- emailValueDefinitionSchema,
961
+ emailFieldDefinitionSchema,
961
962
  entryExportSchema,
963
+ entryFieldDefinitionSchema,
962
964
  entryFileSchema,
963
965
  entrySchema,
964
- entryValueDefinitionSchema,
965
966
  environmentSchema,
967
+ fieldDefinitionSchema,
966
968
  fileReferenceSchema,
967
969
  getChangesProjectSchema,
968
970
  getRemoteOriginUrlProjectSchema,
969
- getValueContentSchemaFromDefinition,
971
+ getValueContentSchemaFromFieldDefinition,
970
972
  gitCloneOptionsSchema,
971
973
  gitCommitIconSchema,
972
974
  gitCommitSchema,
@@ -976,7 +978,7 @@ export {
976
978
  gitSignatureSchema,
977
979
  gitSwitchOptionsSchema,
978
980
  gitTagSchema,
979
- ipValueDefinitionSchema,
981
+ ipFieldDefinitionSchema,
980
982
  listAssetsSchema,
981
983
  listBranchesProjectSchema,
982
984
  listCollectionsSchema,
@@ -984,7 +986,7 @@ export {
984
986
  listGitTagsSchema,
985
987
  listProjectsSchema,
986
988
  localUserSchema,
987
- numberValueDefinitionSchema,
989
+ numberFieldDefinitionSchema,
988
990
  objectTypeSchema,
989
991
  projectExportSchema,
990
992
  projectFileSchema,
@@ -993,7 +995,7 @@ export {
993
995
  projectSettingsSchema,
994
996
  projectStatusSchema,
995
997
  projectUpgradeSchema,
996
- rangeValueDefinitionSchema,
998
+ rangeFieldDefinitionSchema,
997
999
  readAssetSchema,
998
1000
  readCollectionSchema,
999
1001
  readEntrySchema,
@@ -1008,7 +1010,7 @@ export {
1008
1010
  setRemoteOriginUrlProjectSchema,
1009
1011
  setUserSchema,
1010
1012
  slug,
1011
- stringValueDefinitionSchema,
1013
+ stringFieldDefinitionSchema,
1012
1014
  supportedAssetExtensionSchema,
1013
1015
  supportedAssetMimeTypeSchema,
1014
1016
  supportedAssetTypeSchema,
@@ -1016,11 +1018,11 @@ export {
1016
1018
  supportedLanguageSchema,
1017
1019
  switchBranchProjectSchema,
1018
1020
  synchronizeProjectSchema,
1019
- telephoneValueDefinitionSchema,
1020
- textValueDefinitionSchema,
1021
- textareaValueDefinitionSchema,
1022
- timeValueDefinitionSchema,
1023
- toggleValueDefinitionSchema,
1021
+ telephoneFieldDefinitionSchema,
1022
+ textFieldDefinitionSchema,
1023
+ textareaFieldDefinitionSchema,
1024
+ timeFieldDefinitionSchema,
1025
+ toggleFieldDefinitionSchema,
1024
1026
  translatableArrayOf,
1025
1027
  translatableBooleanSchema,
1026
1028
  translatableNumberSchema,
@@ -1030,7 +1032,7 @@ export {
1030
1032
  updateEntrySchema,
1031
1033
  updateProjectSchema,
1032
1034
  upgradeProjectSchema,
1033
- urlValueDefinitionSchema,
1035
+ urlFieldDefinitionSchema,
1034
1036
  userFileSchema,
1035
1037
  userSchema,
1036
1038
  uuid,
@@ -1041,7 +1043,6 @@ export {
1041
1043
  valueContentReferenceToCollectionSchema,
1042
1044
  valueContentReferenceToEntrySchema,
1043
1045
  valueContentReferenceWithLanguageBase,
1044
- valueDefinitionSchema,
1045
1046
  valueSchema,
1046
1047
  versionSchema
1047
1048
  };