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