@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.
@@ -136,13 +136,13 @@ var baseFileSchema = z2.object({
136
136
  */
137
137
  id: uuidSchema.readonly(),
138
138
  /**
139
- * The timestamp of the file being created is set by the service of "objectType" while creating it
139
+ * The datetime of the file being created is set by the service of "objectType" while creating it
140
140
  */
141
- created: z2.number().readonly(),
141
+ created: z2.string().datetime().readonly(),
142
142
  /**
143
- * The timestamp of the file being updated is set by the service of "objectType" while updating it
143
+ * The datetime of the file being updated is set by the service of "objectType" while updating it
144
144
  */
145
- updated: z2.number().nullable()
145
+ updated: z2.string().datetime().nullable()
146
146
  });
147
147
  var baseFileWithLanguageSchema = baseFileSchema.extend({
148
148
  /**
@@ -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 z6 from "zod";
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
- definitionId: uuidSchema.readonly()
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
- definitionId: uuidSchema.readonly(),
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
- function getValueContentSchemaFromDefinition(definition) {
445
- switch (definition.valueType) {
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(definition);
490
+ return getNumberValueContentSchema(fieldDefinition);
450
491
  case ValueTypeSchema.Enum.string:
451
- return getStringValueContentSchema(definition);
492
+ return getStringValueContentSchema(fieldDefinition);
452
493
  case ValueTypeSchema.Enum.reference:
453
- return getReferenceValueContentSchema(definition);
494
+ return getReferenceValueContentSchema(fieldDefinition);
454
495
  default:
455
496
  throw new Error(
456
497
  // @ts-expect-error
457
- `Error generating schema for unsupported ValueType "${definition.valueType}"`
498
+ `Error generating schema for unsupported ValueType "${fieldDefinition.valueType}"`
458
499
  );
459
500
  }
460
501
  }
461
502
  function getBooleanValueContentSchema() {
462
- return z4.boolean();
503
+ return z6.boolean();
463
504
  }
464
505
  function getNumberValueContentSchema(definition) {
465
- let schema = z4.number();
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 = z4.string().trim();
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.inputType) {
486
- case ValueInputTypeSchema.Enum.email:
526
+ switch (definition.fieldType) {
527
+ case FieldTypeSchema.Enum.email:
487
528
  schema = schema.email();
488
529
  break;
489
- case ValueInputTypeSchema.Enum.url:
530
+ case FieldTypeSchema.Enum.url:
490
531
  schema = schema.url();
491
532
  break;
492
- case ValueInputTypeSchema.Enum.ip:
533
+ case FieldTypeSchema.Enum.ip:
493
534
  schema = schema.ip();
494
535
  break;
495
- case ValueInputTypeSchema.Enum.date:
536
+ case FieldTypeSchema.Enum.date:
496
537
  schema = schema.date();
497
538
  break;
498
- case ValueInputTypeSchema.Enum.time:
539
+ case FieldTypeSchema.Enum.time:
499
540
  schema = schema.time();
500
541
  break;
501
- case ValueInputTypeSchema.Enum.datetime:
542
+ case FieldTypeSchema.Enum.datetime:
502
543
  schema = schema.datetime();
503
544
  break;
504
- case ValueInputTypeSchema.Enum.telephone:
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.inputType) {
515
- case ValueInputTypeSchema.Enum.asset:
555
+ switch (definition.fieldType) {
556
+ case FieldTypeSchema.Enum.asset:
516
557
  {
517
- schema = z4.array(valueContentReferenceToAssetSchema);
558
+ schema = z6.array(valueContentReferenceToAssetSchema);
518
559
  }
519
560
  break;
520
- case ValueInputTypeSchema.Enum.entry:
561
+ case FieldTypeSchema.Enum.entry:
521
562
  {
522
- schema = z4.array(valueContentReferenceToEntrySchema);
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: z6.literal(objectTypeSchema.Enum.collection).readonly(),
579
- name: z6.object({
581
+ objectType: z7.literal(objectTypeSchema.Enum.collection).readonly(),
582
+ name: z7.object({
580
583
  singular: translatableStringSchema,
581
584
  plural: translatableStringSchema
582
585
  }),
583
- slug: z6.object({
584
- singular: z6.string(),
585
- plural: z6.string()
586
+ slug: z7.object({
587
+ singular: z7.string(),
588
+ plural: z7.string()
586
589
  }),
587
590
  description: translatableStringSchema,
588
591
  icon: supportedIconSchema,
589
- valueDefinitions: z6.array(valueDefinitionSchema)
592
+ fieldDefinitions: z7.array(fieldDefinitionSchema)
590
593
  });
591
594
  var collectionSchema = collectionFileSchema.extend({});
592
595
  var collectionExportSchema = collectionSchema.extend({
593
- entries: z6.array(entryExportSchema)
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 = z6.object({
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
- valueDefinitions: true
616
+ fieldDefinitions: true
614
617
  }).extend({
615
618
  projectId: uuidSchema.readonly()
616
619
  });
617
620
  var deleteCollectionSchema = readCollectionSchema.extend({});
618
- var countCollectionsSchema = z6.object({
621
+ var countCollectionsSchema = z7.object({
619
622
  projectId: uuidSchema.readonly()
620
623
  });
621
624
 
622
625
  // src/schema/coreSchema.ts
623
- import { z as z7 } from "zod";
624
- var elekIoCoreOptionsSchema = z7.object({
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: z7.object({
634
- json: z7.object({
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: z7.union([z7.number(), z7.string()])
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 z8 } from "zod";
653
- var gitRepositoryPathSchema = z8.string();
654
- var gitSignatureSchema = z8.object({
655
- name: z8.string(),
656
- email: z8.string()
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 = z8.object({
661
+ var gitCommitSchema = z9.object({
659
662
  /**
660
663
  * SHA-1 hash of the commit
661
664
  */
662
- hash: z8.string(),
663
- message: z8.string(),
665
+ hash: z9.string(),
666
+ message: z9.string(),
664
667
  author: gitSignatureSchema,
665
- timestamp: z8.number(),
666
- tag: z8.string().nullable()
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 = z8.nativeEnum(GitCommitIconNative);
676
- var gitInitOptionsSchema = z8.object({
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: z8.string()
683
+ initialBranch: z9.string()
681
684
  });
682
- var gitCloneOptionsSchema = z8.object({
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: z8.number(),
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: z8.boolean(),
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: z8.string()
697
+ branch: z9.string()
695
698
  });
696
- var gitSwitchOptionsSchema = z8.object({
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: z8.boolean().optional()
705
+ isNew: z9.boolean().optional()
703
706
  });
704
- var gitLogOptionsSchema = z8.object({
707
+ var gitLogOptionsSchema = z9.object({
705
708
  /**
706
709
  * Limit the result to given number of commits
707
710
  */
708
- limit: z8.number().optional(),
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: z8.object({
717
+ between: z9.object({
715
718
  /**
716
719
  * From the oldest commit
717
720
  */
718
- from: z8.string(),
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: z8.string().optional()
727
+ to: z9.string().optional()
725
728
  })
726
729
  });
727
730
 
728
731
  // src/schema/gitTagSchema.ts
729
- import { z as z9 } from "zod";
730
- var gitTagSchema = z9.object({
732
+ import { z as z10 } from "zod";
733
+ var gitTagSchema = z10.object({
731
734
  id: uuidSchema,
732
- message: z9.string(),
735
+ message: z10.string(),
733
736
  author: gitSignatureSchema,
734
- timestamp: z9.number()
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 = z9.object({
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 = z9.object({
750
+ var countGitTagsSchema = z10.object({
748
751
  path: gitRepositoryPathSchema
749
752
  });
750
753
 
751
754
  // src/schema/projectSchema.ts
752
- import { z as z10 } from "zod";
753
- var projectStatusSchema = z10.enum(["foo", "bar", "todo"]);
754
- var projectSettingsSchema = z10.object({
755
- language: z10.object({
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: z10.array(supportedLanguageSchema)
760
+ supported: z11.array(supportedLanguageSchema)
758
761
  })
759
762
  });
760
- var projectFolderSchema = z10.enum([
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: z10.literal(objectTypeSchema.Enum.project).readonly(),
773
+ objectType: z11.literal(objectTypeSchema.Enum.project).readonly(),
771
774
  coreVersion: versionSchema,
772
- name: z10.string().trim().min(1, "shared.projectNameRequired"),
773
- description: z10.string().trim().min(1, "shared.projectDescriptionRequired"),
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: z10.array(assetExportSchema),
781
- collections: z10.array(collectionExportSchema)
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 = z10.object({
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 = z10.object({
807
+ var upgradeProjectSchema = z11.object({
805
808
  id: uuidSchema.readonly()
806
809
  });
807
810
  var deleteProjectSchema = readProjectSchema.extend({});
808
- var projectUpgradeSchema = z10.object({
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: z10.function().args(projectFileSchema).returns(z10.promise(z10.void()))
819
+ run: z11.function().args(projectFileSchema).returns(z11.promise(z11.void()))
817
820
  });
818
- var cloneProjectSchema = z10.object({
819
- url: z10.string()
821
+ var cloneProjectSchema = z11.object({
822
+ url: z11.string()
820
823
  });
821
- var listBranchesProjectSchema = z10.object({
824
+ var listBranchesProjectSchema = z11.object({
822
825
  id: uuidSchema.readonly()
823
826
  });
824
- var currentBranchProjectSchema = z10.object({
827
+ var currentBranchProjectSchema = z11.object({
825
828
  id: uuidSchema.readonly()
826
829
  });
827
- var switchBranchProjectSchema = z10.object({
830
+ var switchBranchProjectSchema = z11.object({
828
831
  id: uuidSchema.readonly(),
829
- branch: z10.string(),
832
+ branch: z11.string(),
830
833
  options: gitSwitchOptionsSchema.optional()
831
834
  });
832
- var getRemoteOriginUrlProjectSchema = z10.object({
835
+ var getRemoteOriginUrlProjectSchema = z11.object({
833
836
  id: uuidSchema.readonly()
834
837
  });
835
- var setRemoteOriginUrlProjectSchema = z10.object({
838
+ var setRemoteOriginUrlProjectSchema = z11.object({
836
839
  id: uuidSchema.readonly(),
837
- url: z10.string()
840
+ url: z11.string()
838
841
  });
839
- var getChangesProjectSchema = z10.object({
842
+ var getChangesProjectSchema = z11.object({
840
843
  id: uuidSchema.readonly()
841
844
  });
842
- var synchronizeProjectSchema = z10.object({
845
+ var synchronizeProjectSchema = z11.object({
843
846
  id: uuidSchema.readonly()
844
847
  });
845
- var searchProjectSchema = z10.object({
848
+ var searchProjectSchema = z11.object({
846
849
  id: uuidSchema.readonly(),
847
- query: z10.string(),
850
+ query: z11.string(),
848
851
  language: supportedLanguageSchema,
849
- type: z10.array(objectTypeSchema).optional()
852
+ type: z11.array(objectTypeSchema).optional()
850
853
  });
851
854
 
852
855
  // src/schema/serviceSchema.ts
853
- import { z as z11 } from "zod";
854
- var serviceTypeSchema = z11.enum([
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 = z11.object({
869
+ var listSchema = z12.object({
867
870
  projectId: uuidSchema,
868
- limit: z11.number().optional(),
869
- offset: z11.number().optional()
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 = z11.object({
882
+ var listGitTagsSchema = z12.object({
880
883
  path: gitRepositoryPathSchema
881
884
  });
882
885
 
883
886
  // src/schema/userSchema.ts
884
- import z12 from "zod";
885
- var UserTypeSchema = z12.enum(["local", "cloud"]);
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: z12.literal(UserTypeSchema.Enum.local)
894
+ userType: z13.literal(UserTypeSchema.Enum.local)
892
895
  });
893
896
  var cloudUserSchema = baseUserSchema.extend({
894
- userType: z12.literal(UserTypeSchema.Enum.cloud),
897
+ userType: z13.literal(UserTypeSchema.Enum.cloud),
895
898
  id: uuidSchema
896
899
  });
897
- var userFileSchema = z12.union([localUserSchema, cloudUserSchema]);
900
+ var userFileSchema = z13.union([localUserSchema, cloudUserSchema]);
898
901
  var userSchema = userFileSchema;
899
902
  var setUserSchema = userSchema;
900
903
 
@@ -1188,24 +1191,22 @@ import Fs2 from "fs-extra";
1188
1191
  import isSvg from "is-svg";
1189
1192
 
1190
1193
  // src/util/shared.ts
1191
- import slugify from "slugify";
1194
+ import slugify from "@sindresorhus/slugify";
1192
1195
  import { v4 as generateUuid } from "uuid";
1193
- var Slugify = slugify.default || slugify;
1194
1196
  function uuid() {
1195
1197
  return generateUuid();
1196
1198
  }
1197
- function currentTimestamp() {
1198
- return Math.floor(Date.now() / 1e3);
1199
+ function datetime(value) {
1200
+ if (!value) {
1201
+ return (/* @__PURE__ */ new Date()).toISOString();
1202
+ }
1203
+ return new Date(value).toISOString();
1199
1204
  }
1200
1205
  function slug(string) {
1201
- return Slugify(string, {
1202
- replacement: "-",
1203
- // replace spaces with replacement character, defaults to `-`
1204
- // remove: undefined, // remove characters that match regex, defaults to `undefined`
1205
- lower: true,
1206
- // convert to lower case, defaults to `false`
1207
- strict: true
1208
- // strip special characters except replacement, defaults to `false`
1206
+ return slugify(string, {
1207
+ separator: "-",
1208
+ lowercase: true,
1209
+ decamelize: true
1209
1210
  });
1210
1211
  }
1211
1212
 
@@ -1238,7 +1239,7 @@ var AssetService = class extends AbstractCrudService {
1238
1239
  ...props,
1239
1240
  objectType: "asset",
1240
1241
  id,
1241
- created: currentTimestamp(),
1242
+ created: datetime(),
1242
1243
  updated: null,
1243
1244
  extension: fileType.extension,
1244
1245
  mimeType: fileType.mimeType,
@@ -1287,7 +1288,7 @@ var AssetService = class extends AbstractCrudService {
1287
1288
  const assetFile = {
1288
1289
  ...prevAssetFile,
1289
1290
  ...props,
1290
- updated: currentTimestamp()
1291
+ updated: datetime()
1291
1292
  };
1292
1293
  if (props.newFilePath) {
1293
1294
  const fileType = await this.getSupportedFileTypeOrThrow(
@@ -1462,7 +1463,7 @@ var CollectionService = class extends AbstractCrudService {
1462
1463
  singular: slug(props.slug.singular),
1463
1464
  plural: slug(props.slug.plural)
1464
1465
  },
1465
- created: currentTimestamp(),
1466
+ created: datetime(),
1466
1467
  updated: null
1467
1468
  };
1468
1469
  await Fs3.ensureDir(collectionPath);
@@ -1504,7 +1505,7 @@ var CollectionService = class extends AbstractCrudService {
1504
1505
  const collectionFile = {
1505
1506
  ...prevCollectionFile,
1506
1507
  ...props,
1507
- updated: currentTimestamp()
1508
+ updated: datetime()
1508
1509
  };
1509
1510
  await this.jsonFileService.update(
1510
1511
  collectionFile,
@@ -1606,7 +1607,7 @@ var EntryService = class extends AbstractCrudService {
1606
1607
  objectType: "entry",
1607
1608
  id,
1608
1609
  values: props.values,
1609
- created: currentTimestamp(),
1610
+ created: datetime(),
1610
1611
  updated: null
1611
1612
  };
1612
1613
  const entry = await this.toEntry({
@@ -1616,7 +1617,7 @@ var EntryService = class extends AbstractCrudService {
1616
1617
  });
1617
1618
  this.validateValues({
1618
1619
  collectionId: props.collectionId,
1619
- valueDefinitions: collection.valueDefinitions,
1620
+ fieldDefinitions: collection.fieldDefinitions,
1620
1621
  values: entry.values
1621
1622
  });
1622
1623
  await this.jsonFileService.create(
@@ -1666,7 +1667,7 @@ var EntryService = class extends AbstractCrudService {
1666
1667
  const entryFile = {
1667
1668
  ...prevEntryFile,
1668
1669
  values: props.values,
1669
- updated: currentTimestamp()
1670
+ updated: datetime()
1670
1671
  };
1671
1672
  const entry = await this.toEntry({
1672
1673
  projectId: props.projectId,
@@ -1675,7 +1676,7 @@ var EntryService = class extends AbstractCrudService {
1675
1676
  });
1676
1677
  this.validateValues({
1677
1678
  collectionId: props.collectionId,
1678
- valueDefinitions: collection.valueDefinitions,
1679
+ fieldDefinitions: collection.fieldDefinitions,
1679
1680
  values: entry.values
1680
1681
  });
1681
1682
  await this.jsonFileService.update(
@@ -1743,39 +1744,39 @@ var EntryService = class extends AbstractCrudService {
1743
1744
  return entrySchema.safeParse(obj).success;
1744
1745
  }
1745
1746
  /**
1746
- * Returns a Value definition by ID
1747
+ * Returns a Field definition by ID
1747
1748
  */
1748
- getValueDefinitionById(props) {
1749
- const definition = props.valueDefinitions.find((def) => {
1750
- if (def.id === props.id) {
1749
+ getFieldDefinitionById(props) {
1750
+ const fieldDefinition = props.fieldDefinitions.find((definition) => {
1751
+ if (definition.id === props.id) {
1751
1752
  return true;
1752
1753
  }
1753
1754
  return false;
1754
1755
  });
1755
- if (!definition) {
1756
+ if (!fieldDefinition) {
1756
1757
  throw new Error(
1757
- `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`
1758
1759
  );
1759
1760
  }
1760
- return definition;
1761
+ return fieldDefinition;
1761
1762
  }
1762
1763
  /**
1763
- * Validates given Values against it's Collections definitions
1764
+ * Validates given Values against their Collections Field definitions
1764
1765
  */
1765
1766
  validateValues(props) {
1766
1767
  props.values.map((value) => {
1767
- const definition = this.getValueDefinitionById({
1768
+ const fieldDefinition = this.getFieldDefinitionById({
1768
1769
  collectionId: props.collectionId,
1769
- valueDefinitions: props.valueDefinitions,
1770
- id: value.definitionId
1770
+ fieldDefinitions: props.fieldDefinitions,
1771
+ id: value.fieldDefinitionId
1771
1772
  });
1772
- const schema = getValueContentSchemaFromDefinition(definition);
1773
+ const contentSchema = getValueContentSchemaFromFieldDefinition(fieldDefinition);
1773
1774
  try {
1774
- for (const [, content] of Object.entries(value.content)) {
1775
- schema.parse(content);
1775
+ for (const [_language, content] of Object.entries(value.content)) {
1776
+ contentSchema.parse(content);
1776
1777
  }
1777
1778
  } catch (error) {
1778
- console.log("Definition:", definition);
1779
+ console.log("Definition:", fieldDefinition);
1779
1780
  console.log("Value:", value);
1780
1781
  throw error;
1781
1782
  }
@@ -1947,7 +1948,7 @@ var GitTagService = class extends AbstractCrudService {
1947
1948
  /**
1948
1949
  * Gets all local tags or filter them by pattern
1949
1950
  *
1950
- * They are sorted by authordate of the commit, not the timestamp the tag is created.
1951
+ * They are sorted by authordate of the commit, not when the tag is created.
1951
1952
  * This ensures tags are sorted correctly in the timeline of their commits.
1952
1953
  *
1953
1954
  * @see https://git-scm.com/docs/git-tag#Documentation/git-tag.txt---list
@@ -1958,7 +1959,7 @@ var GitTagService = class extends AbstractCrudService {
1958
1959
  args = [
1959
1960
  ...args,
1960
1961
  "--sort=-*authordate",
1961
- "--format=%(refname:short)|%(subject)|%(*authorname)|%(*authoremail)|%(*authordate:unix)"
1962
+ "--format=%(refname:short)|%(subject)|%(*authorname)|%(*authoremail)|%(*authordate:iso-strict)"
1962
1963
  ];
1963
1964
  const result = await this.git(props.path, args);
1964
1965
  const noEmptyLinesArr = result.stdout.split(EOL).filter((line) => {
@@ -1973,7 +1974,7 @@ var GitTagService = class extends AbstractCrudService {
1973
1974
  name: lineArray[2],
1974
1975
  email: lineArray[3]
1975
1976
  },
1976
- timestamp: parseInt(lineArray[4] || "")
1977
+ datetime: datetime(lineArray[4])
1977
1978
  };
1978
1979
  });
1979
1980
  const gitTags = lineObjArr.filter(this.isGitTag.bind(this));
@@ -2337,7 +2338,7 @@ var GitService = class {
2337
2338
  }
2338
2339
  const result = await this.git(path, [
2339
2340
  ...args,
2340
- "--format=%H|%s|%an|%ae|%at|%D"
2341
+ "--format=%H|%s|%an|%ae|%aI|%D"
2341
2342
  ]);
2342
2343
  const noEmptyLinesArr = result.stdout.split(EOL2).filter((line) => {
2343
2344
  return line.trim() !== "";
@@ -2351,7 +2352,7 @@ var GitService = class {
2351
2352
  name: lineArray[2],
2352
2353
  email: lineArray[3]
2353
2354
  },
2354
- timestamp: parseInt(lineArray[4] || ""),
2355
+ datetime: datetime(lineArray[4]),
2355
2356
  tag: this.refNameToTagName(lineArray[5] || "")
2356
2357
  };
2357
2358
  });
@@ -2364,62 +2365,6 @@ var GitService = class {
2364
2365
  }
2365
2366
  return tagName;
2366
2367
  }
2367
- /**
2368
- * Returns a timestamp of given files creation
2369
- *
2370
- * Git only returns the timestamp the file was added,
2371
- * which could be different from the file being created.
2372
- * But since file operations will always be committed
2373
- * immediately, this is practically the same.
2374
- *
2375
- * @param path Path to the repository
2376
- * @param file File to get timestamp from
2377
- */
2378
- async getFileCreatedTimestamp(path, file) {
2379
- const result = await this.git(path, [
2380
- "log",
2381
- "--diff-filter=A",
2382
- "--follow",
2383
- "--format=%at",
2384
- "--max-count=1",
2385
- "--",
2386
- file
2387
- ]);
2388
- return parseInt(result.stdout);
2389
- }
2390
- /**
2391
- * Returns a timestamp of the files last modification
2392
- *
2393
- * @param path Path to the repository
2394
- * @param file File to get timestamp from
2395
- */
2396
- async getFileLastUpdatedTimestamp(path, file) {
2397
- const result = await this.git(path, [
2398
- "log",
2399
- "--follow",
2400
- "--format=%at",
2401
- "--max-count=1",
2402
- "--",
2403
- file
2404
- ]);
2405
- return parseInt(result.stdout);
2406
- }
2407
- /**
2408
- * Returns created and updated timestamps from given file
2409
- *
2410
- * @param path Path to the project
2411
- * @param file Path to the file
2412
- */
2413
- async getFileCreatedUpdatedMeta(path, file) {
2414
- const meta = await Promise.all([
2415
- this.getFileCreatedTimestamp(path, file),
2416
- this.getFileLastUpdatedTimestamp(path, file)
2417
- ]);
2418
- return {
2419
- created: meta[0],
2420
- updated: meta[1]
2421
- };
2422
- }
2423
2368
  /**
2424
2369
  * Reads the currently used version of Git
2425
2370
  *
@@ -2643,7 +2588,7 @@ var ProjectService = class extends AbstractCrudService {
2643
2588
  id,
2644
2589
  description: props.description || "",
2645
2590
  settings: Object.assign({}, defaultSettings, props.settings),
2646
- created: currentTimestamp(),
2591
+ created: datetime(),
2647
2592
  updated: null,
2648
2593
  coreVersion: this.options.version,
2649
2594
  // @todo should be read from package.json to avoid duplicates
@@ -2735,7 +2680,7 @@ var ProjectService = class extends AbstractCrudService {
2735
2680
  default: props.settings?.language.default || prevProjectFile.settings.language.default
2736
2681
  }
2737
2682
  },
2738
- updated: currentTimestamp()
2683
+ updated: datetime()
2739
2684
  };
2740
2685
  await this.jsonFileService.update(projectFile, filePath, projectFileSchema);
2741
2686
  await this.gitService.add(projectPath, [filePath]);
@@ -3150,19 +3095,19 @@ var ElekIoCore = class {
3150
3095
  // }
3151
3096
  };
3152
3097
  export {
3153
- BooleanValueDefinitionBaseSchema,
3154
- NumberValueDefinitionBaseSchema,
3155
- ReferenceValueDefinitionBaseSchema,
3156
- StringValueDefinitionBaseSchema,
3098
+ BooleanFieldDefinitionBaseSchema,
3099
+ FieldDefinitionBaseSchema,
3100
+ FieldTypeSchema,
3101
+ FieldWidthSchema,
3102
+ NumberFieldDefinitionBaseSchema,
3103
+ ReferenceFieldDefinitionBaseSchema,
3104
+ StringFieldDefinitionBaseSchema,
3157
3105
  UserTypeSchema,
3158
- ValueDefinitionBaseSchema,
3159
- ValueInputTypeSchema,
3160
- ValueInputWidthSchema,
3161
3106
  ValueTypeSchema,
3162
3107
  assetExportSchema,
3108
+ assetFieldDefinitionSchema,
3163
3109
  assetFileSchema,
3164
3110
  assetSchema,
3165
- assetValueDefinitionSchema,
3166
3111
  baseFileSchema,
3167
3112
  baseFileWithLanguageSchema,
3168
3113
  baseUserSchema,
@@ -3182,9 +3127,9 @@ export {
3182
3127
  createGitTagSchema,
3183
3128
  createProjectSchema,
3184
3129
  currentBranchProjectSchema,
3185
- currentTimestamp,
3186
- dateValueDefinitionSchema,
3187
- datetimeValueDefinitionSchema,
3130
+ dateFieldDefinitionSchema,
3131
+ datetime,
3132
+ datetimeFieldDefinitionSchema,
3188
3133
  ElekIoCore as default,
3189
3134
  deleteAssetSchema,
3190
3135
  deleteCollectionSchema,
@@ -3197,16 +3142,17 @@ export {
3197
3142
  directValueBaseSchema,
3198
3143
  directValueSchema,
3199
3144
  elekIoCoreOptionsSchema,
3200
- emailValueDefinitionSchema,
3145
+ emailFieldDefinitionSchema,
3201
3146
  entryExportSchema,
3147
+ entryFieldDefinitionSchema,
3202
3148
  entryFileSchema,
3203
3149
  entrySchema,
3204
- entryValueDefinitionSchema,
3205
3150
  environmentSchema,
3151
+ fieldDefinitionSchema,
3206
3152
  fileReferenceSchema,
3207
3153
  getChangesProjectSchema,
3208
3154
  getRemoteOriginUrlProjectSchema,
3209
- getValueContentSchemaFromDefinition,
3155
+ getValueContentSchemaFromFieldDefinition,
3210
3156
  gitCloneOptionsSchema,
3211
3157
  gitCommitIconSchema,
3212
3158
  gitCommitSchema,
@@ -3216,7 +3162,7 @@ export {
3216
3162
  gitSignatureSchema,
3217
3163
  gitSwitchOptionsSchema,
3218
3164
  gitTagSchema,
3219
- ipValueDefinitionSchema,
3165
+ ipFieldDefinitionSchema,
3220
3166
  listAssetsSchema,
3221
3167
  listBranchesProjectSchema,
3222
3168
  listCollectionsSchema,
@@ -3224,7 +3170,7 @@ export {
3224
3170
  listGitTagsSchema,
3225
3171
  listProjectsSchema,
3226
3172
  localUserSchema,
3227
- numberValueDefinitionSchema,
3173
+ numberFieldDefinitionSchema,
3228
3174
  objectTypeSchema,
3229
3175
  projectExportSchema,
3230
3176
  projectFileSchema,
@@ -3233,7 +3179,7 @@ export {
3233
3179
  projectSettingsSchema,
3234
3180
  projectStatusSchema,
3235
3181
  projectUpgradeSchema,
3236
- rangeValueDefinitionSchema,
3182
+ rangeFieldDefinitionSchema,
3237
3183
  readAssetSchema,
3238
3184
  readCollectionSchema,
3239
3185
  readEntrySchema,
@@ -3248,7 +3194,7 @@ export {
3248
3194
  setRemoteOriginUrlProjectSchema,
3249
3195
  setUserSchema,
3250
3196
  slug,
3251
- stringValueDefinitionSchema,
3197
+ stringFieldDefinitionSchema,
3252
3198
  supportedAssetExtensionSchema,
3253
3199
  supportedAssetMimeTypeSchema,
3254
3200
  supportedAssetTypeSchema,
@@ -3256,11 +3202,11 @@ export {
3256
3202
  supportedLanguageSchema,
3257
3203
  switchBranchProjectSchema,
3258
3204
  synchronizeProjectSchema,
3259
- telephoneValueDefinitionSchema,
3260
- textValueDefinitionSchema,
3261
- textareaValueDefinitionSchema,
3262
- timeValueDefinitionSchema,
3263
- toggleValueDefinitionSchema,
3205
+ telephoneFieldDefinitionSchema,
3206
+ textFieldDefinitionSchema,
3207
+ textareaFieldDefinitionSchema,
3208
+ timeFieldDefinitionSchema,
3209
+ toggleFieldDefinitionSchema,
3264
3210
  translatableArrayOf,
3265
3211
  translatableBooleanSchema,
3266
3212
  translatableNumberSchema,
@@ -3270,7 +3216,7 @@ export {
3270
3216
  updateEntrySchema,
3271
3217
  updateProjectSchema,
3272
3218
  upgradeProjectSchema,
3273
- urlValueDefinitionSchema,
3219
+ urlFieldDefinitionSchema,
3274
3220
  userFileSchema,
3275
3221
  userSchema,
3276
3222
  uuid,
@@ -3281,7 +3227,6 @@ export {
3281
3227
  valueContentReferenceToCollectionSchema,
3282
3228
  valueContentReferenceToEntrySchema,
3283
3229
  valueContentReferenceWithLanguageBase,
3284
- valueDefinitionSchema,
3285
3230
  valueSchema,
3286
3231
  versionSchema
3287
3232
  };