@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.
- package/README.md +18 -10
- package/dist/browser/index.browser.d.ts +7288 -7031
- package/dist/browser/index.browser.js +337 -329
- package/dist/browser/index.browser.js.map +1 -1
- package/dist/node/index.node.d.ts +6548 -6291
- package/dist/node/index.node.js +367 -385
- package/dist/node/index.node.js.map +1 -1
- package/package.json +1 -1
package/dist/node/index.node.js
CHANGED
|
@@ -162,7 +162,7 @@ var fileReferenceSchema = z2.object({
|
|
|
162
162
|
});
|
|
163
163
|
|
|
164
164
|
// src/schema/assetSchema.ts
|
|
165
|
-
var assetFileSchema =
|
|
165
|
+
var assetFileSchema = baseFileSchema.extend({
|
|
166
166
|
objectType: z3.literal(objectTypeSchema.Enum.asset).readonly(),
|
|
167
167
|
name: z3.string(),
|
|
168
168
|
description: z3.string(),
|
|
@@ -182,8 +182,7 @@ var assetSchema = assetFileSchema.extend({
|
|
|
182
182
|
var assetExportSchema = assetSchema.extend({});
|
|
183
183
|
var createAssetSchema = assetFileSchema.pick({
|
|
184
184
|
name: true,
|
|
185
|
-
description: true
|
|
186
|
-
language: true
|
|
185
|
+
description: true
|
|
187
186
|
}).extend({
|
|
188
187
|
projectId: uuidSchema.readonly(),
|
|
189
188
|
/**
|
|
@@ -192,16 +191,14 @@ var createAssetSchema = assetFileSchema.pick({
|
|
|
192
191
|
filePath: z3.string().readonly()
|
|
193
192
|
});
|
|
194
193
|
var readAssetSchema = assetFileSchema.pick({
|
|
195
|
-
id: true
|
|
196
|
-
language: true
|
|
194
|
+
id: true
|
|
197
195
|
}).extend({
|
|
198
196
|
projectId: uuidSchema.readonly()
|
|
199
197
|
});
|
|
200
198
|
var updateAssetSchema = assetFileSchema.pick({
|
|
201
199
|
id: true,
|
|
202
200
|
name: true,
|
|
203
|
-
description: true
|
|
204
|
-
language: true
|
|
201
|
+
description: true
|
|
205
202
|
}).extend({
|
|
206
203
|
projectId: uuidSchema.readonly(),
|
|
207
204
|
/**
|
|
@@ -211,7 +208,6 @@ var updateAssetSchema = assetFileSchema.pick({
|
|
|
211
208
|
});
|
|
212
209
|
var deleteAssetSchema = assetFileSchema.pick({
|
|
213
210
|
id: true,
|
|
214
|
-
language: true,
|
|
215
211
|
extension: true
|
|
216
212
|
}).extend({
|
|
217
213
|
projectId: uuidSchema.readonly()
|
|
@@ -219,7 +215,7 @@ var deleteAssetSchema = assetFileSchema.pick({
|
|
|
219
215
|
var countAssetsSchema = z3.object({ projectId: uuidSchema.readonly() });
|
|
220
216
|
|
|
221
217
|
// src/schema/collectionSchema.ts
|
|
222
|
-
import
|
|
218
|
+
import z7 from "zod";
|
|
223
219
|
|
|
224
220
|
// src/schema/entrySchema.ts
|
|
225
221
|
import z5 from "zod";
|
|
@@ -232,160 +228,13 @@ var ValueTypeSchema = z4.enum([
|
|
|
232
228
|
"boolean",
|
|
233
229
|
"reference"
|
|
234
230
|
]);
|
|
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
231
|
var valueContentReferenceBase = z4.object({
|
|
383
232
|
id: uuidSchema
|
|
384
233
|
});
|
|
385
234
|
var valueContentReferenceWithLanguageBase = valueContentReferenceBase.extend({
|
|
386
235
|
language: supportedLanguageSchema
|
|
387
236
|
});
|
|
388
|
-
var valueContentReferenceToAssetSchema =
|
|
237
|
+
var valueContentReferenceToAssetSchema = valueContentReferenceBase.extend({
|
|
389
238
|
objectType: z4.literal(objectTypeSchema.Enum.asset)
|
|
390
239
|
});
|
|
391
240
|
var valueContentReferenceToCollectionSchema = valueContentReferenceBase.extend({
|
|
@@ -408,7 +257,7 @@ var resolvedValueContentReferenceSchema = z4.union([
|
|
|
408
257
|
]);
|
|
409
258
|
var directValueBaseSchema = z4.object({
|
|
410
259
|
objectType: z4.literal(objectTypeSchema.Enum.value).readonly(),
|
|
411
|
-
|
|
260
|
+
fieldDefinitionId: uuidSchema.readonly()
|
|
412
261
|
});
|
|
413
262
|
var directStringValueSchema = directValueBaseSchema.extend({
|
|
414
263
|
valueType: z4.literal(ValueTypeSchema.Enum.string).readonly(),
|
|
@@ -429,7 +278,7 @@ var directValueSchema = z4.union([
|
|
|
429
278
|
]);
|
|
430
279
|
var referencedValueSchema = z4.object({
|
|
431
280
|
objectType: z4.literal(objectTypeSchema.Enum.value).readonly(),
|
|
432
|
-
|
|
281
|
+
fieldDefinitionId: uuidSchema.readonly(),
|
|
433
282
|
valueType: z4.literal(ValueTypeSchema.Enum.reference).readonly(),
|
|
434
283
|
content: translatableArrayOf(valueContentReferenceSchema)
|
|
435
284
|
});
|
|
@@ -441,28 +290,216 @@ var resolvedValueSchema = z4.union([
|
|
|
441
290
|
directValueSchema,
|
|
442
291
|
resolvedReferencedValueSchema
|
|
443
292
|
]);
|
|
444
|
-
|
|
445
|
-
|
|
293
|
+
|
|
294
|
+
// src/schema/entrySchema.ts
|
|
295
|
+
var entryFileSchema = baseFileSchema.extend({
|
|
296
|
+
objectType: z5.literal(objectTypeSchema.Enum.entry).readonly(),
|
|
297
|
+
values: z5.array(valueSchema)
|
|
298
|
+
});
|
|
299
|
+
var entrySchema = entryFileSchema.extend({
|
|
300
|
+
values: z5.array(z5.lazy(() => resolvedValueSchema))
|
|
301
|
+
});
|
|
302
|
+
var entryExportSchema = entrySchema.extend({});
|
|
303
|
+
var createEntrySchema = entryFileSchema.omit({
|
|
304
|
+
id: true,
|
|
305
|
+
objectType: true,
|
|
306
|
+
created: true,
|
|
307
|
+
updated: true
|
|
308
|
+
}).extend({
|
|
309
|
+
projectId: uuidSchema.readonly(),
|
|
310
|
+
collectionId: uuidSchema.readonly(),
|
|
311
|
+
values: z5.array(valueSchema)
|
|
312
|
+
});
|
|
313
|
+
var readEntrySchema = z5.object({
|
|
314
|
+
id: uuidSchema.readonly(),
|
|
315
|
+
projectId: uuidSchema.readonly(),
|
|
316
|
+
collectionId: uuidSchema.readonly()
|
|
317
|
+
});
|
|
318
|
+
var updateEntrySchema = entrySchema.omit({
|
|
319
|
+
objectType: true,
|
|
320
|
+
created: true,
|
|
321
|
+
updated: true
|
|
322
|
+
}).extend({
|
|
323
|
+
projectId: uuidSchema.readonly(),
|
|
324
|
+
collectionId: uuidSchema.readonly()
|
|
325
|
+
});
|
|
326
|
+
var deleteEntrySchema = readEntrySchema.extend({});
|
|
327
|
+
var countEntriesSchema = z5.object({
|
|
328
|
+
projectId: uuidSchema.readonly(),
|
|
329
|
+
collectionId: uuidSchema.readonly()
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
// src/schema/fieldSchema.ts
|
|
333
|
+
import { z as z6 } from "zod";
|
|
334
|
+
var FieldTypeSchema = z6.enum([
|
|
335
|
+
// String Values
|
|
336
|
+
"text",
|
|
337
|
+
"textarea",
|
|
338
|
+
"email",
|
|
339
|
+
// 'password', @todo maybe if there is a usecase
|
|
340
|
+
"url",
|
|
341
|
+
"ip",
|
|
342
|
+
"date",
|
|
343
|
+
"time",
|
|
344
|
+
"datetime",
|
|
345
|
+
"telephone",
|
|
346
|
+
// Number Values
|
|
347
|
+
"number",
|
|
348
|
+
"range",
|
|
349
|
+
// Boolean Values
|
|
350
|
+
"toggle",
|
|
351
|
+
// Reference Values
|
|
352
|
+
"asset",
|
|
353
|
+
"entry"
|
|
354
|
+
// 'sharedValue', // @todo
|
|
355
|
+
]);
|
|
356
|
+
var FieldWidthSchema = z6.enum(["12", "6", "4", "3"]);
|
|
357
|
+
var FieldDefinitionBaseSchema = z6.object({
|
|
358
|
+
id: uuidSchema.readonly(),
|
|
359
|
+
label: translatableStringSchema,
|
|
360
|
+
description: translatableStringSchema,
|
|
361
|
+
isRequired: z6.boolean(),
|
|
362
|
+
isDisabled: z6.boolean(),
|
|
363
|
+
isUnique: z6.boolean(),
|
|
364
|
+
inputWidth: FieldWidthSchema
|
|
365
|
+
});
|
|
366
|
+
var StringFieldDefinitionBaseSchema = FieldDefinitionBaseSchema.extend(
|
|
367
|
+
{
|
|
368
|
+
valueType: z6.literal(ValueTypeSchema.Enum.string),
|
|
369
|
+
defaultValue: z6.string().nullable()
|
|
370
|
+
}
|
|
371
|
+
);
|
|
372
|
+
var textFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend(
|
|
373
|
+
{
|
|
374
|
+
fieldType: z6.literal(FieldTypeSchema.Enum.text),
|
|
375
|
+
min: z6.number().nullable(),
|
|
376
|
+
max: z6.number().nullable()
|
|
377
|
+
}
|
|
378
|
+
);
|
|
379
|
+
var textareaFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
|
|
380
|
+
fieldType: z6.literal(FieldTypeSchema.Enum.textarea),
|
|
381
|
+
min: z6.number().nullable(),
|
|
382
|
+
max: z6.number().nullable()
|
|
383
|
+
});
|
|
384
|
+
var emailFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
|
|
385
|
+
fieldType: z6.literal(FieldTypeSchema.Enum.email),
|
|
386
|
+
defaultValue: z6.string().email().nullable()
|
|
387
|
+
});
|
|
388
|
+
var urlFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
|
|
389
|
+
fieldType: z6.literal(FieldTypeSchema.Enum.url),
|
|
390
|
+
defaultValue: z6.string().url().nullable()
|
|
391
|
+
});
|
|
392
|
+
var ipFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
|
|
393
|
+
fieldType: z6.literal(FieldTypeSchema.Enum.ip),
|
|
394
|
+
defaultValue: z6.string().ip().nullable()
|
|
395
|
+
});
|
|
396
|
+
var dateFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend(
|
|
397
|
+
{
|
|
398
|
+
fieldType: z6.literal(FieldTypeSchema.Enum.date),
|
|
399
|
+
defaultValue: z6.string().date().nullable()
|
|
400
|
+
}
|
|
401
|
+
);
|
|
402
|
+
var timeFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend(
|
|
403
|
+
{
|
|
404
|
+
fieldType: z6.literal(FieldTypeSchema.Enum.time),
|
|
405
|
+
defaultValue: z6.string().time().nullable()
|
|
406
|
+
}
|
|
407
|
+
);
|
|
408
|
+
var datetimeFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
|
|
409
|
+
fieldType: z6.literal(FieldTypeSchema.Enum.datetime),
|
|
410
|
+
defaultValue: z6.string().datetime().nullable()
|
|
411
|
+
});
|
|
412
|
+
var telephoneFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
|
|
413
|
+
fieldType: z6.literal(FieldTypeSchema.Enum.telephone)
|
|
414
|
+
// defaultValue: z.string().e164(), @todo when zod v4 releases @see https://github.com/colinhacks/zod/pull/3476
|
|
415
|
+
});
|
|
416
|
+
var stringFieldDefinitionSchema = z6.union([
|
|
417
|
+
textFieldDefinitionSchema,
|
|
418
|
+
textareaFieldDefinitionSchema,
|
|
419
|
+
emailFieldDefinitionSchema,
|
|
420
|
+
urlFieldDefinitionSchema,
|
|
421
|
+
ipFieldDefinitionSchema,
|
|
422
|
+
dateFieldDefinitionSchema,
|
|
423
|
+
timeFieldDefinitionSchema,
|
|
424
|
+
datetimeFieldDefinitionSchema,
|
|
425
|
+
telephoneFieldDefinitionSchema
|
|
426
|
+
]);
|
|
427
|
+
var NumberFieldDefinitionBaseSchema = FieldDefinitionBaseSchema.extend(
|
|
428
|
+
{
|
|
429
|
+
valueType: z6.literal(ValueTypeSchema.Enum.number),
|
|
430
|
+
min: z6.number().nullable(),
|
|
431
|
+
max: z6.number().nullable(),
|
|
432
|
+
isUnique: z6.literal(false),
|
|
433
|
+
defaultValue: z6.number().nullable()
|
|
434
|
+
}
|
|
435
|
+
);
|
|
436
|
+
var numberFieldDefinitionSchema = NumberFieldDefinitionBaseSchema.extend({
|
|
437
|
+
fieldType: z6.literal(FieldTypeSchema.Enum.number)
|
|
438
|
+
});
|
|
439
|
+
var rangeFieldDefinitionSchema = NumberFieldDefinitionBaseSchema.extend({
|
|
440
|
+
fieldType: z6.literal(FieldTypeSchema.Enum.range),
|
|
441
|
+
// Overwrite from nullable to required because a range needs min, max and default to work and is required, since it always returns a number
|
|
442
|
+
isRequired: z6.literal(true),
|
|
443
|
+
min: z6.number(),
|
|
444
|
+
max: z6.number(),
|
|
445
|
+
defaultValue: z6.number()
|
|
446
|
+
});
|
|
447
|
+
var BooleanFieldDefinitionBaseSchema = FieldDefinitionBaseSchema.extend({
|
|
448
|
+
valueType: z6.literal(ValueTypeSchema.Enum.boolean),
|
|
449
|
+
// Overwrite from nullable to required because a boolean needs a default to work and is required, since it always is either true or false
|
|
450
|
+
isRequired: z6.literal(true),
|
|
451
|
+
defaultValue: z6.boolean(),
|
|
452
|
+
isUnique: z6.literal(false)
|
|
453
|
+
});
|
|
454
|
+
var toggleFieldDefinitionSchema = BooleanFieldDefinitionBaseSchema.extend({
|
|
455
|
+
fieldType: z6.literal(FieldTypeSchema.Enum.toggle)
|
|
456
|
+
});
|
|
457
|
+
var ReferenceFieldDefinitionBaseSchema = FieldDefinitionBaseSchema.extend({
|
|
458
|
+
valueType: z6.literal(ValueTypeSchema.Enum.reference)
|
|
459
|
+
});
|
|
460
|
+
var assetFieldDefinitionSchema = ReferenceFieldDefinitionBaseSchema.extend({
|
|
461
|
+
fieldType: z6.literal(FieldTypeSchema.Enum.asset),
|
|
462
|
+
allowedMimeTypes: z6.array(supportedAssetMimeTypeSchema).min(1),
|
|
463
|
+
min: z6.number().nullable(),
|
|
464
|
+
max: z6.number().nullable()
|
|
465
|
+
});
|
|
466
|
+
var entryFieldDefinitionSchema = ReferenceFieldDefinitionBaseSchema.extend({
|
|
467
|
+
fieldType: z6.literal(FieldTypeSchema.Enum.entry),
|
|
468
|
+
ofCollections: z6.array(uuidSchema),
|
|
469
|
+
min: z6.number().nullable(),
|
|
470
|
+
max: z6.number().nullable()
|
|
471
|
+
});
|
|
472
|
+
var fieldDefinitionSchema = z6.union([
|
|
473
|
+
stringFieldDefinitionSchema,
|
|
474
|
+
numberFieldDefinitionSchema,
|
|
475
|
+
rangeFieldDefinitionSchema,
|
|
476
|
+
toggleFieldDefinitionSchema,
|
|
477
|
+
assetFieldDefinitionSchema,
|
|
478
|
+
entryFieldDefinitionSchema
|
|
479
|
+
// sharedValueDefinitionSchema,
|
|
480
|
+
]);
|
|
481
|
+
function getValueContentSchemaFromFieldDefinition(fieldDefinition) {
|
|
482
|
+
switch (fieldDefinition.valueType) {
|
|
446
483
|
case ValueTypeSchema.Enum.boolean:
|
|
447
484
|
return getBooleanValueContentSchema();
|
|
448
485
|
case ValueTypeSchema.Enum.number:
|
|
449
|
-
return getNumberValueContentSchema(
|
|
486
|
+
return getNumberValueContentSchema(fieldDefinition);
|
|
450
487
|
case ValueTypeSchema.Enum.string:
|
|
451
|
-
return getStringValueContentSchema(
|
|
488
|
+
return getStringValueContentSchema(fieldDefinition);
|
|
452
489
|
case ValueTypeSchema.Enum.reference:
|
|
453
|
-
return getReferenceValueContentSchema(
|
|
490
|
+
return getReferenceValueContentSchema(fieldDefinition);
|
|
454
491
|
default:
|
|
455
492
|
throw new Error(
|
|
456
493
|
// @ts-expect-error
|
|
457
|
-
`Error generating schema for unsupported ValueType "${
|
|
494
|
+
`Error generating schema for unsupported ValueType "${fieldDefinition.valueType}"`
|
|
458
495
|
);
|
|
459
496
|
}
|
|
460
497
|
}
|
|
461
498
|
function getBooleanValueContentSchema() {
|
|
462
|
-
return
|
|
499
|
+
return z6.boolean();
|
|
463
500
|
}
|
|
464
501
|
function getNumberValueContentSchema(definition) {
|
|
465
|
-
let schema =
|
|
502
|
+
let schema = z6.number();
|
|
466
503
|
if (definition.min) {
|
|
467
504
|
schema = schema.min(definition.min);
|
|
468
505
|
}
|
|
@@ -475,33 +512,33 @@ function getNumberValueContentSchema(definition) {
|
|
|
475
512
|
return schema;
|
|
476
513
|
}
|
|
477
514
|
function getStringValueContentSchema(definition) {
|
|
478
|
-
let schema =
|
|
515
|
+
let schema = z6.string().trim();
|
|
479
516
|
if ("min" in definition && definition.min) {
|
|
480
517
|
schema = schema.min(definition.min);
|
|
481
518
|
}
|
|
482
519
|
if ("max" in definition && definition.max) {
|
|
483
520
|
schema = schema.max(definition.max);
|
|
484
521
|
}
|
|
485
|
-
switch (definition.
|
|
486
|
-
case
|
|
522
|
+
switch (definition.fieldType) {
|
|
523
|
+
case FieldTypeSchema.Enum.email:
|
|
487
524
|
schema = schema.email();
|
|
488
525
|
break;
|
|
489
|
-
case
|
|
526
|
+
case FieldTypeSchema.Enum.url:
|
|
490
527
|
schema = schema.url();
|
|
491
528
|
break;
|
|
492
|
-
case
|
|
529
|
+
case FieldTypeSchema.Enum.ip:
|
|
493
530
|
schema = schema.ip();
|
|
494
531
|
break;
|
|
495
|
-
case
|
|
532
|
+
case FieldTypeSchema.Enum.date:
|
|
496
533
|
schema = schema.date();
|
|
497
534
|
break;
|
|
498
|
-
case
|
|
535
|
+
case FieldTypeSchema.Enum.time:
|
|
499
536
|
schema = schema.time();
|
|
500
537
|
break;
|
|
501
|
-
case
|
|
538
|
+
case FieldTypeSchema.Enum.datetime:
|
|
502
539
|
schema = schema.datetime();
|
|
503
540
|
break;
|
|
504
|
-
case
|
|
541
|
+
case FieldTypeSchema.Enum.telephone:
|
|
505
542
|
break;
|
|
506
543
|
}
|
|
507
544
|
if (definition.isRequired === false) {
|
|
@@ -511,15 +548,15 @@ function getStringValueContentSchema(definition) {
|
|
|
511
548
|
}
|
|
512
549
|
function getReferenceValueContentSchema(definition) {
|
|
513
550
|
let schema;
|
|
514
|
-
switch (definition.
|
|
515
|
-
case
|
|
551
|
+
switch (definition.fieldType) {
|
|
552
|
+
case FieldTypeSchema.Enum.asset:
|
|
516
553
|
{
|
|
517
|
-
schema =
|
|
554
|
+
schema = z6.array(valueContentReferenceToAssetSchema);
|
|
518
555
|
}
|
|
519
556
|
break;
|
|
520
|
-
case
|
|
557
|
+
case FieldTypeSchema.Enum.entry:
|
|
521
558
|
{
|
|
522
|
-
schema =
|
|
559
|
+
schema = z6.array(valueContentReferenceToEntrySchema);
|
|
523
560
|
}
|
|
524
561
|
break;
|
|
525
562
|
}
|
|
@@ -535,62 +572,24 @@ function getReferenceValueContentSchema(definition) {
|
|
|
535
572
|
return schema;
|
|
536
573
|
}
|
|
537
574
|
|
|
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
575
|
// src/schema/collectionSchema.ts
|
|
577
576
|
var collectionFileSchema = baseFileSchema.extend({
|
|
578
|
-
objectType:
|
|
579
|
-
name:
|
|
577
|
+
objectType: z7.literal(objectTypeSchema.Enum.collection).readonly(),
|
|
578
|
+
name: z7.object({
|
|
580
579
|
singular: translatableStringSchema,
|
|
581
580
|
plural: translatableStringSchema
|
|
582
581
|
}),
|
|
583
|
-
slug:
|
|
584
|
-
singular:
|
|
585
|
-
plural:
|
|
582
|
+
slug: z7.object({
|
|
583
|
+
singular: z7.string(),
|
|
584
|
+
plural: z7.string()
|
|
586
585
|
}),
|
|
587
586
|
description: translatableStringSchema,
|
|
588
587
|
icon: supportedIconSchema,
|
|
589
|
-
|
|
588
|
+
fieldDefinitions: z7.array(fieldDefinitionSchema)
|
|
590
589
|
});
|
|
591
590
|
var collectionSchema = collectionFileSchema.extend({});
|
|
592
591
|
var collectionExportSchema = collectionSchema.extend({
|
|
593
|
-
entries:
|
|
592
|
+
entries: z7.array(entryExportSchema)
|
|
594
593
|
});
|
|
595
594
|
var createCollectionSchema = collectionSchema.omit({
|
|
596
595
|
id: true,
|
|
@@ -600,7 +599,7 @@ var createCollectionSchema = collectionSchema.omit({
|
|
|
600
599
|
}).extend({
|
|
601
600
|
projectId: uuidSchema.readonly()
|
|
602
601
|
});
|
|
603
|
-
var readCollectionSchema =
|
|
602
|
+
var readCollectionSchema = z7.object({
|
|
604
603
|
id: uuidSchema.readonly(),
|
|
605
604
|
projectId: uuidSchema.readonly()
|
|
606
605
|
});
|
|
@@ -610,18 +609,18 @@ var updateCollectionSchema = collectionFileSchema.pick({
|
|
|
610
609
|
slug: true,
|
|
611
610
|
description: true,
|
|
612
611
|
icon: true,
|
|
613
|
-
|
|
612
|
+
fieldDefinitions: true
|
|
614
613
|
}).extend({
|
|
615
614
|
projectId: uuidSchema.readonly()
|
|
616
615
|
});
|
|
617
616
|
var deleteCollectionSchema = readCollectionSchema.extend({});
|
|
618
|
-
var countCollectionsSchema =
|
|
617
|
+
var countCollectionsSchema = z7.object({
|
|
619
618
|
projectId: uuidSchema.readonly()
|
|
620
619
|
});
|
|
621
620
|
|
|
622
621
|
// src/schema/coreSchema.ts
|
|
623
|
-
import { z as
|
|
624
|
-
var elekIoCoreOptionsSchema =
|
|
622
|
+
import { z as z8 } from "zod";
|
|
623
|
+
var elekIoCoreOptionsSchema = z8.object({
|
|
625
624
|
/**
|
|
626
625
|
* The environment elek.io Core is currently running in
|
|
627
626
|
*/
|
|
@@ -630,14 +629,14 @@ var elekIoCoreOptionsSchema = z7.object({
|
|
|
630
629
|
* The current version of elek.io Core
|
|
631
630
|
*/
|
|
632
631
|
version: versionSchema,
|
|
633
|
-
file:
|
|
634
|
-
json:
|
|
632
|
+
file: z8.object({
|
|
633
|
+
json: z8.object({
|
|
635
634
|
/**
|
|
636
635
|
* If set, adds indentation with spaces (number) or escape character (string)
|
|
637
636
|
* and line break characters to saved JSON files on disk, to make them easier to read.
|
|
638
637
|
* Defaults to 2 spaces of indentation.
|
|
639
638
|
*/
|
|
640
|
-
indentation:
|
|
639
|
+
indentation: z8.union([z8.number(), z8.string()])
|
|
641
640
|
})
|
|
642
641
|
})
|
|
643
642
|
});
|
|
@@ -649,21 +648,21 @@ var constructorElekIoCoreSchema = elekIoCoreOptionsSchema.omit({
|
|
|
649
648
|
}).optional();
|
|
650
649
|
|
|
651
650
|
// src/schema/gitSchema.ts
|
|
652
|
-
import { z as
|
|
653
|
-
var gitRepositoryPathSchema =
|
|
654
|
-
var gitSignatureSchema =
|
|
655
|
-
name:
|
|
656
|
-
email:
|
|
651
|
+
import { z as z9 } from "zod";
|
|
652
|
+
var gitRepositoryPathSchema = z9.string();
|
|
653
|
+
var gitSignatureSchema = z9.object({
|
|
654
|
+
name: z9.string(),
|
|
655
|
+
email: z9.string()
|
|
657
656
|
});
|
|
658
|
-
var gitCommitSchema =
|
|
657
|
+
var gitCommitSchema = z9.object({
|
|
659
658
|
/**
|
|
660
659
|
* SHA-1 hash of the commit
|
|
661
660
|
*/
|
|
662
|
-
hash:
|
|
663
|
-
message:
|
|
661
|
+
hash: z9.string(),
|
|
662
|
+
message: z9.string(),
|
|
664
663
|
author: gitSignatureSchema,
|
|
665
|
-
datetime:
|
|
666
|
-
tag:
|
|
664
|
+
datetime: z9.string().datetime(),
|
|
665
|
+
tag: z9.string().nullable()
|
|
667
666
|
});
|
|
668
667
|
var GitCommitIconNative = /* @__PURE__ */ ((GitCommitIconNative2) => {
|
|
669
668
|
GitCommitIconNative2["INIT"] = ":tada:";
|
|
@@ -672,66 +671,66 @@ var GitCommitIconNative = /* @__PURE__ */ ((GitCommitIconNative2) => {
|
|
|
672
671
|
GitCommitIconNative2["DELETE"] = ":fire:";
|
|
673
672
|
return GitCommitIconNative2;
|
|
674
673
|
})(GitCommitIconNative || {});
|
|
675
|
-
var gitCommitIconSchema =
|
|
676
|
-
var gitInitOptionsSchema =
|
|
674
|
+
var gitCommitIconSchema = z9.nativeEnum(GitCommitIconNative);
|
|
675
|
+
var gitInitOptionsSchema = z9.object({
|
|
677
676
|
/**
|
|
678
677
|
* 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
678
|
*/
|
|
680
|
-
initialBranch:
|
|
679
|
+
initialBranch: z9.string()
|
|
681
680
|
});
|
|
682
|
-
var gitCloneOptionsSchema =
|
|
681
|
+
var gitCloneOptionsSchema = z9.object({
|
|
683
682
|
/**
|
|
684
683
|
* 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
684
|
*/
|
|
686
|
-
depth:
|
|
685
|
+
depth: z9.number(),
|
|
687
686
|
/**
|
|
688
687
|
* 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
688
|
*/
|
|
690
|
-
singleBranch:
|
|
689
|
+
singleBranch: z9.boolean(),
|
|
691
690
|
/**
|
|
692
691
|
* 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
692
|
*/
|
|
694
|
-
branch:
|
|
693
|
+
branch: z9.string()
|
|
695
694
|
});
|
|
696
|
-
var gitSwitchOptionsSchema =
|
|
695
|
+
var gitSwitchOptionsSchema = z9.object({
|
|
697
696
|
/**
|
|
698
697
|
* If true, creates a new local branch and then switches to it
|
|
699
698
|
*
|
|
700
699
|
* @see https://git-scm.com/docs/git-switch#Documentation/git-switch.txt---createltnew-branchgt
|
|
701
700
|
*/
|
|
702
|
-
isNew:
|
|
701
|
+
isNew: z9.boolean().optional()
|
|
703
702
|
});
|
|
704
|
-
var gitLogOptionsSchema =
|
|
703
|
+
var gitLogOptionsSchema = z9.object({
|
|
705
704
|
/**
|
|
706
705
|
* Limit the result to given number of commits
|
|
707
706
|
*/
|
|
708
|
-
limit:
|
|
707
|
+
limit: z9.number().optional(),
|
|
709
708
|
/**
|
|
710
709
|
* Only list commits that are between given SHAs or tag names
|
|
711
710
|
*
|
|
712
711
|
* Note that the commits of from and to are not included in the result
|
|
713
712
|
*/
|
|
714
|
-
between:
|
|
713
|
+
between: z9.object({
|
|
715
714
|
/**
|
|
716
715
|
* From the oldest commit
|
|
717
716
|
*/
|
|
718
|
-
from:
|
|
717
|
+
from: z9.string(),
|
|
719
718
|
/**
|
|
720
719
|
* To the newest commit
|
|
721
720
|
*
|
|
722
721
|
* Defaults to the current HEAD
|
|
723
722
|
*/
|
|
724
|
-
to:
|
|
723
|
+
to: z9.string().optional()
|
|
725
724
|
})
|
|
726
725
|
});
|
|
727
726
|
|
|
728
727
|
// src/schema/gitTagSchema.ts
|
|
729
|
-
import { z as
|
|
730
|
-
var gitTagSchema =
|
|
728
|
+
import { z as z10 } from "zod";
|
|
729
|
+
var gitTagSchema = z10.object({
|
|
731
730
|
id: uuidSchema,
|
|
732
|
-
message:
|
|
731
|
+
message: z10.string(),
|
|
733
732
|
author: gitSignatureSchema,
|
|
734
|
-
datetime:
|
|
733
|
+
datetime: z10.string().datetime()
|
|
735
734
|
});
|
|
736
735
|
var createGitTagSchema = gitTagSchema.pick({
|
|
737
736
|
message: true
|
|
@@ -739,25 +738,25 @@ var createGitTagSchema = gitTagSchema.pick({
|
|
|
739
738
|
path: gitRepositoryPathSchema,
|
|
740
739
|
hash: gitCommitSchema.shape.hash.optional()
|
|
741
740
|
});
|
|
742
|
-
var readGitTagSchema =
|
|
741
|
+
var readGitTagSchema = z10.object({
|
|
743
742
|
path: gitRepositoryPathSchema,
|
|
744
743
|
id: uuidSchema.readonly()
|
|
745
744
|
});
|
|
746
745
|
var deleteGitTagSchema = readGitTagSchema.extend({});
|
|
747
|
-
var countGitTagsSchema =
|
|
746
|
+
var countGitTagsSchema = z10.object({
|
|
748
747
|
path: gitRepositoryPathSchema
|
|
749
748
|
});
|
|
750
749
|
|
|
751
750
|
// src/schema/projectSchema.ts
|
|
752
|
-
import { z as
|
|
753
|
-
var projectStatusSchema =
|
|
754
|
-
var projectSettingsSchema =
|
|
755
|
-
language:
|
|
751
|
+
import { z as z11 } from "zod";
|
|
752
|
+
var projectStatusSchema = z11.enum(["foo", "bar", "todo"]);
|
|
753
|
+
var projectSettingsSchema = z11.object({
|
|
754
|
+
language: z11.object({
|
|
756
755
|
default: supportedLanguageSchema,
|
|
757
|
-
supported:
|
|
756
|
+
supported: z11.array(supportedLanguageSchema)
|
|
758
757
|
})
|
|
759
758
|
});
|
|
760
|
-
var projectFolderSchema =
|
|
759
|
+
var projectFolderSchema = z11.enum([
|
|
761
760
|
"assets",
|
|
762
761
|
"collections",
|
|
763
762
|
"shared-values",
|
|
@@ -767,18 +766,18 @@ var projectFolderSchema = z10.enum([
|
|
|
767
766
|
// 'theme',
|
|
768
767
|
]);
|
|
769
768
|
var projectFileSchema = baseFileSchema.extend({
|
|
770
|
-
objectType:
|
|
769
|
+
objectType: z11.literal(objectTypeSchema.Enum.project).readonly(),
|
|
771
770
|
coreVersion: versionSchema,
|
|
772
|
-
name:
|
|
773
|
-
description:
|
|
771
|
+
name: z11.string().trim().min(1, "shared.projectNameRequired"),
|
|
772
|
+
description: z11.string().trim().min(1, "shared.projectDescriptionRequired"),
|
|
774
773
|
version: versionSchema,
|
|
775
774
|
status: projectStatusSchema,
|
|
776
775
|
settings: projectSettingsSchema
|
|
777
776
|
});
|
|
778
777
|
var projectSchema = projectFileSchema.extend({});
|
|
779
778
|
var projectExportSchema = projectSchema.extend({
|
|
780
|
-
assets:
|
|
781
|
-
collections:
|
|
779
|
+
assets: z11.array(assetExportSchema),
|
|
780
|
+
collections: z11.array(collectionExportSchema)
|
|
782
781
|
});
|
|
783
782
|
var createProjectSchema = projectSchema.pick({
|
|
784
783
|
name: true,
|
|
@@ -788,7 +787,7 @@ var createProjectSchema = projectSchema.pick({
|
|
|
788
787
|
description: true,
|
|
789
788
|
settings: true
|
|
790
789
|
});
|
|
791
|
-
var readProjectSchema =
|
|
790
|
+
var readProjectSchema = z11.object({
|
|
792
791
|
id: uuidSchema.readonly()
|
|
793
792
|
});
|
|
794
793
|
var updateProjectSchema = projectSchema.pick({
|
|
@@ -801,11 +800,11 @@ var updateProjectSchema = projectSchema.pick({
|
|
|
801
800
|
description: true,
|
|
802
801
|
settings: true
|
|
803
802
|
});
|
|
804
|
-
var upgradeProjectSchema =
|
|
803
|
+
var upgradeProjectSchema = z11.object({
|
|
805
804
|
id: uuidSchema.readonly()
|
|
806
805
|
});
|
|
807
806
|
var deleteProjectSchema = readProjectSchema.extend({});
|
|
808
|
-
var projectUpgradeSchema =
|
|
807
|
+
var projectUpgradeSchema = z11.object({
|
|
809
808
|
/**
|
|
810
809
|
* The Core version the Project will be upgraded to
|
|
811
810
|
*/
|
|
@@ -813,45 +812,45 @@ var projectUpgradeSchema = z10.object({
|
|
|
813
812
|
/**
|
|
814
813
|
* Function that will be executed in the process of upgrading a Project
|
|
815
814
|
*/
|
|
816
|
-
run:
|
|
815
|
+
run: z11.function().args(projectFileSchema).returns(z11.promise(z11.void()))
|
|
817
816
|
});
|
|
818
|
-
var cloneProjectSchema =
|
|
819
|
-
url:
|
|
817
|
+
var cloneProjectSchema = z11.object({
|
|
818
|
+
url: z11.string()
|
|
820
819
|
});
|
|
821
|
-
var listBranchesProjectSchema =
|
|
820
|
+
var listBranchesProjectSchema = z11.object({
|
|
822
821
|
id: uuidSchema.readonly()
|
|
823
822
|
});
|
|
824
|
-
var currentBranchProjectSchema =
|
|
823
|
+
var currentBranchProjectSchema = z11.object({
|
|
825
824
|
id: uuidSchema.readonly()
|
|
826
825
|
});
|
|
827
|
-
var switchBranchProjectSchema =
|
|
826
|
+
var switchBranchProjectSchema = z11.object({
|
|
828
827
|
id: uuidSchema.readonly(),
|
|
829
|
-
branch:
|
|
828
|
+
branch: z11.string(),
|
|
830
829
|
options: gitSwitchOptionsSchema.optional()
|
|
831
830
|
});
|
|
832
|
-
var getRemoteOriginUrlProjectSchema =
|
|
831
|
+
var getRemoteOriginUrlProjectSchema = z11.object({
|
|
833
832
|
id: uuidSchema.readonly()
|
|
834
833
|
});
|
|
835
|
-
var setRemoteOriginUrlProjectSchema =
|
|
834
|
+
var setRemoteOriginUrlProjectSchema = z11.object({
|
|
836
835
|
id: uuidSchema.readonly(),
|
|
837
|
-
url:
|
|
836
|
+
url: z11.string()
|
|
838
837
|
});
|
|
839
|
-
var getChangesProjectSchema =
|
|
838
|
+
var getChangesProjectSchema = z11.object({
|
|
840
839
|
id: uuidSchema.readonly()
|
|
841
840
|
});
|
|
842
|
-
var synchronizeProjectSchema =
|
|
841
|
+
var synchronizeProjectSchema = z11.object({
|
|
843
842
|
id: uuidSchema.readonly()
|
|
844
843
|
});
|
|
845
|
-
var searchProjectSchema =
|
|
844
|
+
var searchProjectSchema = z11.object({
|
|
846
845
|
id: uuidSchema.readonly(),
|
|
847
|
-
query:
|
|
846
|
+
query: z11.string(),
|
|
848
847
|
language: supportedLanguageSchema,
|
|
849
|
-
type:
|
|
848
|
+
type: z11.array(objectTypeSchema).optional()
|
|
850
849
|
});
|
|
851
850
|
|
|
852
851
|
// src/schema/serviceSchema.ts
|
|
853
|
-
import { z as
|
|
854
|
-
var serviceTypeSchema =
|
|
852
|
+
import { z as z12 } from "zod";
|
|
853
|
+
var serviceTypeSchema = z12.enum([
|
|
855
854
|
"Git",
|
|
856
855
|
"GitTag",
|
|
857
856
|
"User",
|
|
@@ -863,10 +862,10 @@ var serviceTypeSchema = z11.enum([
|
|
|
863
862
|
"Entry",
|
|
864
863
|
"Value"
|
|
865
864
|
]);
|
|
866
|
-
var listSchema =
|
|
865
|
+
var listSchema = z12.object({
|
|
867
866
|
projectId: uuidSchema,
|
|
868
|
-
limit:
|
|
869
|
-
offset:
|
|
867
|
+
limit: z12.number().optional(),
|
|
868
|
+
offset: z12.number().optional()
|
|
870
869
|
});
|
|
871
870
|
var listCollectionsSchema = listSchema;
|
|
872
871
|
var listEntriesSchema = listSchema.extend({
|
|
@@ -876,25 +875,34 @@ var listAssetsSchema = listSchema;
|
|
|
876
875
|
var listProjectsSchema = listSchema.omit({
|
|
877
876
|
projectId: true
|
|
878
877
|
});
|
|
879
|
-
var listGitTagsSchema =
|
|
878
|
+
var listGitTagsSchema = z12.object({
|
|
880
879
|
path: gitRepositoryPathSchema
|
|
881
880
|
});
|
|
882
881
|
|
|
883
882
|
// src/schema/userSchema.ts
|
|
884
|
-
import
|
|
885
|
-
var UserTypeSchema =
|
|
883
|
+
import z13 from "zod";
|
|
884
|
+
var UserTypeSchema = z13.enum(["local", "cloud"]);
|
|
886
885
|
var baseUserSchema = gitSignatureSchema.extend({
|
|
887
886
|
userType: UserTypeSchema,
|
|
888
|
-
language: supportedLanguageSchema
|
|
887
|
+
language: supportedLanguageSchema,
|
|
888
|
+
window: z13.object({
|
|
889
|
+
displayId: z13.number(),
|
|
890
|
+
width: z13.number(),
|
|
891
|
+
height: z13.number(),
|
|
892
|
+
position: z13.object({
|
|
893
|
+
x: z13.number(),
|
|
894
|
+
y: z13.number()
|
|
895
|
+
})
|
|
896
|
+
}).nullable()
|
|
889
897
|
});
|
|
890
898
|
var localUserSchema = baseUserSchema.extend({
|
|
891
|
-
userType:
|
|
899
|
+
userType: z13.literal(UserTypeSchema.Enum.local)
|
|
892
900
|
});
|
|
893
901
|
var cloudUserSchema = baseUserSchema.extend({
|
|
894
|
-
userType:
|
|
902
|
+
userType: z13.literal(UserTypeSchema.Enum.cloud),
|
|
895
903
|
id: uuidSchema
|
|
896
904
|
});
|
|
897
|
-
var userFileSchema =
|
|
905
|
+
var userFileSchema = z13.union([localUserSchema, cloudUserSchema]);
|
|
898
906
|
var userSchema = userFileSchema;
|
|
899
907
|
var setUserSchema = userSchema;
|
|
900
908
|
|
|
@@ -998,11 +1006,11 @@ var pathTo = {
|
|
|
998
1006
|
projectFolderSchema.Enum.assets
|
|
999
1007
|
);
|
|
1000
1008
|
},
|
|
1001
|
-
assetFile: (projectId, id
|
|
1002
|
-
return Path.join(pathTo.assets(projectId), `${id}
|
|
1009
|
+
assetFile: (projectId, id) => {
|
|
1010
|
+
return Path.join(pathTo.assets(projectId), `${id}.json`);
|
|
1003
1011
|
},
|
|
1004
|
-
asset: (projectId, id,
|
|
1005
|
-
return Path.join(pathTo.lfs(projectId), `${id}.${
|
|
1012
|
+
asset: (projectId, id, extension) => {
|
|
1013
|
+
return Path.join(pathTo.lfs(projectId), `${id}.${extension}`);
|
|
1006
1014
|
}
|
|
1007
1015
|
};
|
|
1008
1016
|
function assignDefaultIfMissing(value, defaultsTo) {
|
|
@@ -1225,13 +1233,8 @@ var AssetService = class extends AbstractCrudService {
|
|
|
1225
1233
|
const projectPath = pathTo.project(props.projectId);
|
|
1226
1234
|
const fileType = await this.getSupportedFileTypeOrThrow(props.filePath);
|
|
1227
1235
|
const size = await this.getAssetSize(props.filePath);
|
|
1228
|
-
const assetPath = pathTo.asset(
|
|
1229
|
-
|
|
1230
|
-
id,
|
|
1231
|
-
props.language,
|
|
1232
|
-
fileType.extension
|
|
1233
|
-
);
|
|
1234
|
-
const assetFilePath = pathTo.assetFile(props.projectId, id, props.language);
|
|
1236
|
+
const assetPath = pathTo.asset(props.projectId, id, fileType.extension);
|
|
1237
|
+
const assetFilePath = pathTo.assetFile(props.projectId, id);
|
|
1235
1238
|
const assetFile = {
|
|
1236
1239
|
...props,
|
|
1237
1240
|
objectType: "asset",
|
|
@@ -1258,12 +1261,12 @@ var AssetService = class extends AbstractCrudService {
|
|
|
1258
1261
|
return this.toAsset(props.projectId, assetFile);
|
|
1259
1262
|
}
|
|
1260
1263
|
/**
|
|
1261
|
-
* Returns an Asset by ID
|
|
1264
|
+
* Returns an Asset by ID
|
|
1262
1265
|
*/
|
|
1263
1266
|
async read(props) {
|
|
1264
1267
|
readAssetSchema.parse(props);
|
|
1265
1268
|
const assetFile = await this.jsonFileService.read(
|
|
1266
|
-
pathTo.assetFile(props.projectId, props.id
|
|
1269
|
+
pathTo.assetFile(props.projectId, props.id),
|
|
1267
1270
|
assetFileSchema
|
|
1268
1271
|
);
|
|
1269
1272
|
return this.toAsset(props.projectId, assetFile);
|
|
@@ -1276,11 +1279,7 @@ var AssetService = class extends AbstractCrudService {
|
|
|
1276
1279
|
async update(props) {
|
|
1277
1280
|
updateAssetSchema.parse(props);
|
|
1278
1281
|
const projectPath = pathTo.project(props.projectId);
|
|
1279
|
-
const assetFilePath = pathTo.assetFile(
|
|
1280
|
-
props.projectId,
|
|
1281
|
-
props.id,
|
|
1282
|
-
props.language
|
|
1283
|
-
);
|
|
1282
|
+
const assetFilePath = pathTo.assetFile(props.projectId, props.id);
|
|
1284
1283
|
const prevAssetFile = await this.read(props);
|
|
1285
1284
|
const assetFile = {
|
|
1286
1285
|
...prevAssetFile,
|
|
@@ -1295,13 +1294,11 @@ var AssetService = class extends AbstractCrudService {
|
|
|
1295
1294
|
const prevAssetPath = pathTo.asset(
|
|
1296
1295
|
props.projectId,
|
|
1297
1296
|
props.id,
|
|
1298
|
-
props.language,
|
|
1299
1297
|
prevAssetFile.extension
|
|
1300
1298
|
);
|
|
1301
1299
|
const assetPath = pathTo.asset(
|
|
1302
1300
|
props.projectId,
|
|
1303
1301
|
props.id,
|
|
1304
|
-
props.language,
|
|
1305
1302
|
fileType.extension
|
|
1306
1303
|
);
|
|
1307
1304
|
await Fs2.remove(prevAssetPath);
|
|
@@ -1325,17 +1322,8 @@ var AssetService = class extends AbstractCrudService {
|
|
|
1325
1322
|
async delete(props) {
|
|
1326
1323
|
deleteAssetSchema.parse(props);
|
|
1327
1324
|
const projectPath = pathTo.project(props.projectId);
|
|
1328
|
-
const assetFilePath = pathTo.assetFile(
|
|
1329
|
-
|
|
1330
|
-
props.id,
|
|
1331
|
-
props.language
|
|
1332
|
-
);
|
|
1333
|
-
const assetPath = pathTo.asset(
|
|
1334
|
-
props.projectId,
|
|
1335
|
-
props.id,
|
|
1336
|
-
props.language,
|
|
1337
|
-
props.extension
|
|
1338
|
-
);
|
|
1325
|
+
const assetFilePath = pathTo.assetFile(props.projectId, props.id);
|
|
1326
|
+
const assetPath = pathTo.asset(props.projectId, props.id, props.extension);
|
|
1339
1327
|
await Fs2.remove(assetPath);
|
|
1340
1328
|
await Fs2.remove(assetFilePath);
|
|
1341
1329
|
await this.gitService.add(projectPath, [assetFilePath, assetPath]);
|
|
@@ -1352,13 +1340,9 @@ var AssetService = class extends AbstractCrudService {
|
|
|
1352
1340
|
const partialAssetReferences = assetReferences.slice(offset, limit);
|
|
1353
1341
|
const assets = await returnResolved(
|
|
1354
1342
|
partialAssetReferences.map((assetReference) => {
|
|
1355
|
-
if (!assetReference.language) {
|
|
1356
|
-
throw new RequiredParameterMissingError("language");
|
|
1357
|
-
}
|
|
1358
1343
|
return this.read({
|
|
1359
1344
|
projectId: props.projectId,
|
|
1360
|
-
id: assetReference.id
|
|
1361
|
-
language: assetReference.language
|
|
1345
|
+
id: assetReference.id
|
|
1362
1346
|
});
|
|
1363
1347
|
})
|
|
1364
1348
|
);
|
|
@@ -1398,7 +1382,6 @@ var AssetService = class extends AbstractCrudService {
|
|
|
1398
1382
|
const assetPath = pathTo.asset(
|
|
1399
1383
|
projectId,
|
|
1400
1384
|
assetFile.id,
|
|
1401
|
-
assetFile.language,
|
|
1402
1385
|
assetFile.extension
|
|
1403
1386
|
);
|
|
1404
1387
|
const asset = {
|
|
@@ -1614,7 +1597,7 @@ var EntryService = class extends AbstractCrudService {
|
|
|
1614
1597
|
});
|
|
1615
1598
|
this.validateValues({
|
|
1616
1599
|
collectionId: props.collectionId,
|
|
1617
|
-
|
|
1600
|
+
fieldDefinitions: collection.fieldDefinitions,
|
|
1618
1601
|
values: entry.values
|
|
1619
1602
|
});
|
|
1620
1603
|
await this.jsonFileService.create(
|
|
@@ -1673,7 +1656,7 @@ var EntryService = class extends AbstractCrudService {
|
|
|
1673
1656
|
});
|
|
1674
1657
|
this.validateValues({
|
|
1675
1658
|
collectionId: props.collectionId,
|
|
1676
|
-
|
|
1659
|
+
fieldDefinitions: collection.fieldDefinitions,
|
|
1677
1660
|
values: entry.values
|
|
1678
1661
|
});
|
|
1679
1662
|
await this.jsonFileService.update(
|
|
@@ -1741,39 +1724,39 @@ var EntryService = class extends AbstractCrudService {
|
|
|
1741
1724
|
return entrySchema.safeParse(obj).success;
|
|
1742
1725
|
}
|
|
1743
1726
|
/**
|
|
1744
|
-
* Returns a
|
|
1727
|
+
* Returns a Field definition by ID
|
|
1745
1728
|
*/
|
|
1746
|
-
|
|
1747
|
-
const
|
|
1748
|
-
if (
|
|
1729
|
+
getFieldDefinitionById(props) {
|
|
1730
|
+
const fieldDefinition = props.fieldDefinitions.find((definition) => {
|
|
1731
|
+
if (definition.id === props.id) {
|
|
1749
1732
|
return true;
|
|
1750
1733
|
}
|
|
1751
1734
|
return false;
|
|
1752
1735
|
});
|
|
1753
|
-
if (!
|
|
1736
|
+
if (!fieldDefinition) {
|
|
1754
1737
|
throw new Error(
|
|
1755
|
-
`No definition with ID "${props.id}" found in Collection "${props.collectionId}" for given Value reference`
|
|
1738
|
+
`No Field definition with ID "${props.id}" found in Collection "${props.collectionId}" for given Value reference`
|
|
1756
1739
|
);
|
|
1757
1740
|
}
|
|
1758
|
-
return
|
|
1741
|
+
return fieldDefinition;
|
|
1759
1742
|
}
|
|
1760
1743
|
/**
|
|
1761
|
-
* Validates given Values against
|
|
1744
|
+
* Validates given Values against their Collections Field definitions
|
|
1762
1745
|
*/
|
|
1763
1746
|
validateValues(props) {
|
|
1764
1747
|
props.values.map((value) => {
|
|
1765
|
-
const
|
|
1748
|
+
const fieldDefinition = this.getFieldDefinitionById({
|
|
1766
1749
|
collectionId: props.collectionId,
|
|
1767
|
-
|
|
1768
|
-
id: value.
|
|
1750
|
+
fieldDefinitions: props.fieldDefinitions,
|
|
1751
|
+
id: value.fieldDefinitionId
|
|
1769
1752
|
});
|
|
1770
|
-
const
|
|
1753
|
+
const contentSchema = getValueContentSchemaFromFieldDefinition(fieldDefinition);
|
|
1771
1754
|
try {
|
|
1772
|
-
for (const [, content] of Object.entries(value.content)) {
|
|
1773
|
-
|
|
1755
|
+
for (const [_language, content] of Object.entries(value.content)) {
|
|
1756
|
+
contentSchema.parse(content);
|
|
1774
1757
|
}
|
|
1775
1758
|
} catch (error) {
|
|
1776
|
-
console.log("Definition:",
|
|
1759
|
+
console.log("Definition:", fieldDefinition);
|
|
1777
1760
|
console.log("Value:", value);
|
|
1778
1761
|
throw error;
|
|
1779
1762
|
}
|
|
@@ -1802,8 +1785,7 @@ var EntryService = class extends AbstractCrudService {
|
|
|
1802
1785
|
case objectTypeSchema.Enum.asset:
|
|
1803
1786
|
return await this.assetService.read({
|
|
1804
1787
|
projectId: props.projectId,
|
|
1805
|
-
id: props.valueContentReference.id
|
|
1806
|
-
language: props.valueContentReference.language
|
|
1788
|
+
id: props.valueContentReference.id
|
|
1807
1789
|
});
|
|
1808
1790
|
case objectTypeSchema.Enum.entry:
|
|
1809
1791
|
return await this.read({
|
|
@@ -3092,19 +3074,19 @@ var ElekIoCore = class {
|
|
|
3092
3074
|
// }
|
|
3093
3075
|
};
|
|
3094
3076
|
export {
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3077
|
+
BooleanFieldDefinitionBaseSchema,
|
|
3078
|
+
FieldDefinitionBaseSchema,
|
|
3079
|
+
FieldTypeSchema,
|
|
3080
|
+
FieldWidthSchema,
|
|
3081
|
+
NumberFieldDefinitionBaseSchema,
|
|
3082
|
+
ReferenceFieldDefinitionBaseSchema,
|
|
3083
|
+
StringFieldDefinitionBaseSchema,
|
|
3099
3084
|
UserTypeSchema,
|
|
3100
|
-
ValueDefinitionBaseSchema,
|
|
3101
|
-
ValueInputTypeSchema,
|
|
3102
|
-
ValueInputWidthSchema,
|
|
3103
3085
|
ValueTypeSchema,
|
|
3104
3086
|
assetExportSchema,
|
|
3087
|
+
assetFieldDefinitionSchema,
|
|
3105
3088
|
assetFileSchema,
|
|
3106
3089
|
assetSchema,
|
|
3107
|
-
assetValueDefinitionSchema,
|
|
3108
3090
|
baseFileSchema,
|
|
3109
3091
|
baseFileWithLanguageSchema,
|
|
3110
3092
|
baseUserSchema,
|
|
@@ -3124,9 +3106,9 @@ export {
|
|
|
3124
3106
|
createGitTagSchema,
|
|
3125
3107
|
createProjectSchema,
|
|
3126
3108
|
currentBranchProjectSchema,
|
|
3127
|
-
|
|
3109
|
+
dateFieldDefinitionSchema,
|
|
3128
3110
|
datetime,
|
|
3129
|
-
|
|
3111
|
+
datetimeFieldDefinitionSchema,
|
|
3130
3112
|
ElekIoCore as default,
|
|
3131
3113
|
deleteAssetSchema,
|
|
3132
3114
|
deleteCollectionSchema,
|
|
@@ -3139,16 +3121,17 @@ export {
|
|
|
3139
3121
|
directValueBaseSchema,
|
|
3140
3122
|
directValueSchema,
|
|
3141
3123
|
elekIoCoreOptionsSchema,
|
|
3142
|
-
|
|
3124
|
+
emailFieldDefinitionSchema,
|
|
3143
3125
|
entryExportSchema,
|
|
3126
|
+
entryFieldDefinitionSchema,
|
|
3144
3127
|
entryFileSchema,
|
|
3145
3128
|
entrySchema,
|
|
3146
|
-
entryValueDefinitionSchema,
|
|
3147
3129
|
environmentSchema,
|
|
3130
|
+
fieldDefinitionSchema,
|
|
3148
3131
|
fileReferenceSchema,
|
|
3149
3132
|
getChangesProjectSchema,
|
|
3150
3133
|
getRemoteOriginUrlProjectSchema,
|
|
3151
|
-
|
|
3134
|
+
getValueContentSchemaFromFieldDefinition,
|
|
3152
3135
|
gitCloneOptionsSchema,
|
|
3153
3136
|
gitCommitIconSchema,
|
|
3154
3137
|
gitCommitSchema,
|
|
@@ -3158,7 +3141,7 @@ export {
|
|
|
3158
3141
|
gitSignatureSchema,
|
|
3159
3142
|
gitSwitchOptionsSchema,
|
|
3160
3143
|
gitTagSchema,
|
|
3161
|
-
|
|
3144
|
+
ipFieldDefinitionSchema,
|
|
3162
3145
|
listAssetsSchema,
|
|
3163
3146
|
listBranchesProjectSchema,
|
|
3164
3147
|
listCollectionsSchema,
|
|
@@ -3166,7 +3149,7 @@ export {
|
|
|
3166
3149
|
listGitTagsSchema,
|
|
3167
3150
|
listProjectsSchema,
|
|
3168
3151
|
localUserSchema,
|
|
3169
|
-
|
|
3152
|
+
numberFieldDefinitionSchema,
|
|
3170
3153
|
objectTypeSchema,
|
|
3171
3154
|
projectExportSchema,
|
|
3172
3155
|
projectFileSchema,
|
|
@@ -3175,7 +3158,7 @@ export {
|
|
|
3175
3158
|
projectSettingsSchema,
|
|
3176
3159
|
projectStatusSchema,
|
|
3177
3160
|
projectUpgradeSchema,
|
|
3178
|
-
|
|
3161
|
+
rangeFieldDefinitionSchema,
|
|
3179
3162
|
readAssetSchema,
|
|
3180
3163
|
readCollectionSchema,
|
|
3181
3164
|
readEntrySchema,
|
|
@@ -3190,7 +3173,7 @@ export {
|
|
|
3190
3173
|
setRemoteOriginUrlProjectSchema,
|
|
3191
3174
|
setUserSchema,
|
|
3192
3175
|
slug,
|
|
3193
|
-
|
|
3176
|
+
stringFieldDefinitionSchema,
|
|
3194
3177
|
supportedAssetExtensionSchema,
|
|
3195
3178
|
supportedAssetMimeTypeSchema,
|
|
3196
3179
|
supportedAssetTypeSchema,
|
|
@@ -3198,11 +3181,11 @@ export {
|
|
|
3198
3181
|
supportedLanguageSchema,
|
|
3199
3182
|
switchBranchProjectSchema,
|
|
3200
3183
|
synchronizeProjectSchema,
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3184
|
+
telephoneFieldDefinitionSchema,
|
|
3185
|
+
textFieldDefinitionSchema,
|
|
3186
|
+
textareaFieldDefinitionSchema,
|
|
3187
|
+
timeFieldDefinitionSchema,
|
|
3188
|
+
toggleFieldDefinitionSchema,
|
|
3206
3189
|
translatableArrayOf,
|
|
3207
3190
|
translatableBooleanSchema,
|
|
3208
3191
|
translatableNumberSchema,
|
|
@@ -3212,7 +3195,7 @@ export {
|
|
|
3212
3195
|
updateEntrySchema,
|
|
3213
3196
|
updateProjectSchema,
|
|
3214
3197
|
upgradeProjectSchema,
|
|
3215
|
-
|
|
3198
|
+
urlFieldDefinitionSchema,
|
|
3216
3199
|
userFileSchema,
|
|
3217
3200
|
userSchema,
|
|
3218
3201
|
uuid,
|
|
@@ -3223,7 +3206,6 @@ export {
|
|
|
3223
3206
|
valueContentReferenceToCollectionSchema,
|
|
3224
3207
|
valueContentReferenceToEntrySchema,
|
|
3225
3208
|
valueContentReferenceWithLanguageBase,
|
|
3226
|
-
valueDefinitionSchema,
|
|
3227
3209
|
valueSchema,
|
|
3228
3210
|
versionSchema
|
|
3229
3211
|
};
|