@elek-io/core 0.9.1 → 0.10.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/dist/browser/index.browser.d.ts +2320 -721
- package/dist/browser/index.browser.js +262 -213
- package/dist/browser/index.browser.js.map +1 -1
- package/dist/node/index.node.d.ts +2377 -778
- package/dist/node/index.node.js +840 -420
- package/dist/node/index.node.js.map +1 -1
- package/package.json +4 -2
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// src/schema/assetSchema.ts
|
|
2
|
-
import
|
|
2
|
+
import z4 from "zod";
|
|
3
3
|
|
|
4
4
|
// src/schema/baseSchema.ts
|
|
5
5
|
import z from "zod";
|
|
6
|
-
var environmentSchema = z.enum(["production", "development", "test"]);
|
|
7
6
|
var supportedLanguageSchema = z.enum([
|
|
8
7
|
/**
|
|
9
8
|
* Bulgarian
|
|
@@ -99,6 +98,7 @@ var objectTypeSchema = z.enum([
|
|
|
99
98
|
"value",
|
|
100
99
|
"sharedValue"
|
|
101
100
|
]);
|
|
101
|
+
var logLevelSchema = z.enum(["error", "warn", "info", "debug"]);
|
|
102
102
|
var versionSchema = z.string();
|
|
103
103
|
var uuidSchema = z.string().uuid("shared.invalidUuid");
|
|
104
104
|
var translatableStringSchema = z.record(
|
|
@@ -120,6 +120,10 @@ function translatableArrayOf(schema) {
|
|
|
120
120
|
// src/schema/fileSchema.ts
|
|
121
121
|
import z2 from "zod";
|
|
122
122
|
var baseFileSchema = z2.object({
|
|
123
|
+
/**
|
|
124
|
+
* The object type of the file
|
|
125
|
+
*/
|
|
126
|
+
objectType: objectTypeSchema.readonly(),
|
|
123
127
|
/**
|
|
124
128
|
* The ID of the file
|
|
125
129
|
*
|
|
@@ -152,23 +156,108 @@ var fileReferenceSchema = z2.object({
|
|
|
152
156
|
extension: supportedAssetExtensionSchema.optional()
|
|
153
157
|
});
|
|
154
158
|
|
|
159
|
+
// src/schema/gitSchema.ts
|
|
160
|
+
import { z as z3 } from "zod";
|
|
161
|
+
var gitRepositoryPathSchema = z3.string();
|
|
162
|
+
var gitSignatureSchema = z3.object({
|
|
163
|
+
name: z3.string(),
|
|
164
|
+
email: z3.string()
|
|
165
|
+
});
|
|
166
|
+
var gitCommitSchema = z3.object({
|
|
167
|
+
/**
|
|
168
|
+
* SHA-1 hash of the commit
|
|
169
|
+
*/
|
|
170
|
+
hash: z3.string(),
|
|
171
|
+
message: z3.string(),
|
|
172
|
+
author: gitSignatureSchema,
|
|
173
|
+
datetime: z3.string().datetime(),
|
|
174
|
+
tag: z3.string().nullable()
|
|
175
|
+
});
|
|
176
|
+
var GitCommitIconNative = /* @__PURE__ */ ((GitCommitIconNative2) => {
|
|
177
|
+
GitCommitIconNative2["INIT"] = ":tada:";
|
|
178
|
+
GitCommitIconNative2["CREATE"] = ":heavy_plus_sign:";
|
|
179
|
+
GitCommitIconNative2["UPDATE"] = ":wrench:";
|
|
180
|
+
GitCommitIconNative2["DELETE"] = ":heavy_minus_sign:";
|
|
181
|
+
return GitCommitIconNative2;
|
|
182
|
+
})(GitCommitIconNative || {});
|
|
183
|
+
var gitCommitIconSchema = z3.nativeEnum(GitCommitIconNative);
|
|
184
|
+
var gitInitOptionsSchema = z3.object({
|
|
185
|
+
/**
|
|
186
|
+
* 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).
|
|
187
|
+
*/
|
|
188
|
+
initialBranch: z3.string()
|
|
189
|
+
});
|
|
190
|
+
var gitCloneOptionsSchema = z3.object({
|
|
191
|
+
/**
|
|
192
|
+
* 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.
|
|
193
|
+
*/
|
|
194
|
+
depth: z3.number(),
|
|
195
|
+
/**
|
|
196
|
+
* 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.
|
|
197
|
+
*/
|
|
198
|
+
singleBranch: z3.boolean(),
|
|
199
|
+
/**
|
|
200
|
+
* 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.
|
|
201
|
+
*/
|
|
202
|
+
branch: z3.string()
|
|
203
|
+
});
|
|
204
|
+
var gitSwitchOptionsSchema = z3.object({
|
|
205
|
+
/**
|
|
206
|
+
* If true, creates a new local branch and then switches to it
|
|
207
|
+
*
|
|
208
|
+
* @see https://git-scm.com/docs/git-switch#Documentation/git-switch.txt---createltnew-branchgt
|
|
209
|
+
*/
|
|
210
|
+
isNew: z3.boolean().optional()
|
|
211
|
+
});
|
|
212
|
+
var gitLogOptionsSchema = z3.object({
|
|
213
|
+
/**
|
|
214
|
+
* Limit the result to given number of commits
|
|
215
|
+
*/
|
|
216
|
+
limit: z3.number().optional(),
|
|
217
|
+
/**
|
|
218
|
+
* Only list commits that are between given SHAs or tag names
|
|
219
|
+
*
|
|
220
|
+
* Note that the commits of from and to are not included in the result
|
|
221
|
+
*/
|
|
222
|
+
between: z3.object({
|
|
223
|
+
/**
|
|
224
|
+
* From the oldest commit
|
|
225
|
+
*/
|
|
226
|
+
from: z3.string(),
|
|
227
|
+
/**
|
|
228
|
+
* To the newest commit
|
|
229
|
+
*
|
|
230
|
+
* Defaults to the current HEAD
|
|
231
|
+
*/
|
|
232
|
+
to: z3.string().optional()
|
|
233
|
+
}),
|
|
234
|
+
/**
|
|
235
|
+
* Only shows commits of given file
|
|
236
|
+
*/
|
|
237
|
+
filePath: z3.string().optional()
|
|
238
|
+
});
|
|
239
|
+
|
|
155
240
|
// src/schema/assetSchema.ts
|
|
156
241
|
var assetFileSchema = baseFileSchema.extend({
|
|
157
|
-
objectType:
|
|
158
|
-
name:
|
|
159
|
-
description:
|
|
242
|
+
objectType: z4.literal(objectTypeSchema.Enum.asset).readonly(),
|
|
243
|
+
name: z4.string(),
|
|
244
|
+
description: z4.string(),
|
|
160
245
|
extension: supportedAssetExtensionSchema.readonly(),
|
|
161
246
|
mimeType: supportedAssetMimeTypeSchema.readonly(),
|
|
162
247
|
/**
|
|
163
248
|
* Total size in bytes
|
|
164
249
|
*/
|
|
165
|
-
size:
|
|
250
|
+
size: z4.number().readonly()
|
|
166
251
|
});
|
|
167
252
|
var assetSchema = assetFileSchema.extend({
|
|
168
253
|
/**
|
|
169
254
|
* Absolute path on this filesystem
|
|
170
255
|
*/
|
|
171
|
-
absolutePath:
|
|
256
|
+
absolutePath: z4.string().readonly(),
|
|
257
|
+
/**
|
|
258
|
+
* Commit history of this Asset
|
|
259
|
+
*/
|
|
260
|
+
history: z4.array(gitCommitSchema)
|
|
172
261
|
});
|
|
173
262
|
var assetExportSchema = assetSchema.extend({});
|
|
174
263
|
var createAssetSchema = assetFileSchema.pick({
|
|
@@ -179,12 +268,20 @@ var createAssetSchema = assetFileSchema.pick({
|
|
|
179
268
|
/**
|
|
180
269
|
* Path of the file to add as a new Asset
|
|
181
270
|
*/
|
|
182
|
-
filePath:
|
|
271
|
+
filePath: z4.string().readonly()
|
|
183
272
|
});
|
|
184
273
|
var readAssetSchema = assetFileSchema.pick({
|
|
185
274
|
id: true
|
|
186
275
|
}).extend({
|
|
187
|
-
projectId: uuidSchema.readonly()
|
|
276
|
+
projectId: uuidSchema.readonly(),
|
|
277
|
+
commitHash: z4.string().optional().readonly()
|
|
278
|
+
});
|
|
279
|
+
var saveAssetSchema = assetFileSchema.pick({
|
|
280
|
+
id: true
|
|
281
|
+
}).extend({
|
|
282
|
+
projectId: uuidSchema.readonly(),
|
|
283
|
+
filePath: z4.string().readonly(),
|
|
284
|
+
commitHash: z4.string().optional().readonly()
|
|
188
285
|
});
|
|
189
286
|
var updateAssetSchema = assetFileSchema.pick({
|
|
190
287
|
id: true,
|
|
@@ -195,7 +292,7 @@ var updateAssetSchema = assetFileSchema.pick({
|
|
|
195
292
|
/**
|
|
196
293
|
* Path of the new file to update the Asset with
|
|
197
294
|
*/
|
|
198
|
-
newFilePath:
|
|
295
|
+
newFilePath: z4.string().readonly().optional()
|
|
199
296
|
});
|
|
200
297
|
var deleteAssetSchema = assetFileSchema.pick({
|
|
201
298
|
id: true,
|
|
@@ -203,92 +300,96 @@ var deleteAssetSchema = assetFileSchema.pick({
|
|
|
203
300
|
}).extend({
|
|
204
301
|
projectId: uuidSchema.readonly()
|
|
205
302
|
});
|
|
206
|
-
var countAssetsSchema =
|
|
303
|
+
var countAssetsSchema = z4.object({ projectId: uuidSchema.readonly() });
|
|
207
304
|
|
|
208
305
|
// src/schema/collectionSchema.ts
|
|
209
|
-
import
|
|
306
|
+
import z8 from "zod";
|
|
210
307
|
|
|
211
308
|
// src/schema/entrySchema.ts
|
|
212
|
-
import
|
|
309
|
+
import z6 from "zod";
|
|
213
310
|
|
|
214
311
|
// src/schema/valueSchema.ts
|
|
215
|
-
import
|
|
216
|
-
var ValueTypeSchema =
|
|
312
|
+
import z5 from "zod";
|
|
313
|
+
var ValueTypeSchema = z5.enum([
|
|
217
314
|
"string",
|
|
218
315
|
"number",
|
|
219
316
|
"boolean",
|
|
220
317
|
"reference"
|
|
221
318
|
]);
|
|
222
|
-
var valueContentReferenceBase =
|
|
319
|
+
var valueContentReferenceBase = z5.object({
|
|
223
320
|
id: uuidSchema
|
|
224
321
|
});
|
|
225
322
|
var valueContentReferenceWithLanguageBase = valueContentReferenceBase.extend({
|
|
226
323
|
language: supportedLanguageSchema
|
|
227
324
|
});
|
|
228
325
|
var valueContentReferenceToAssetSchema = valueContentReferenceBase.extend({
|
|
229
|
-
objectType:
|
|
326
|
+
objectType: z5.literal(objectTypeSchema.Enum.asset)
|
|
230
327
|
});
|
|
231
328
|
var valueContentReferenceToCollectionSchema = valueContentReferenceBase.extend({
|
|
232
|
-
objectType:
|
|
329
|
+
objectType: z5.literal(objectTypeSchema.Enum.collection)
|
|
233
330
|
});
|
|
234
331
|
var valueContentReferenceToEntrySchema = valueContentReferenceBase.extend({
|
|
235
|
-
objectType:
|
|
332
|
+
objectType: z5.literal(objectTypeSchema.Enum.entry)
|
|
236
333
|
});
|
|
237
|
-
var valueContentReferenceSchema =
|
|
334
|
+
var valueContentReferenceSchema = z5.union([
|
|
238
335
|
valueContentReferenceToAssetSchema,
|
|
239
336
|
valueContentReferenceToCollectionSchema,
|
|
240
337
|
valueContentReferenceToEntrySchema
|
|
241
338
|
// valueContentReferenceToSharedValueSchema,
|
|
242
339
|
]);
|
|
243
|
-
var resolvedValueContentReferenceSchema =
|
|
340
|
+
var resolvedValueContentReferenceSchema = z5.union([
|
|
244
341
|
assetSchema,
|
|
245
|
-
|
|
342
|
+
z5.lazy(() => entrySchema)
|
|
246
343
|
// Circular dependency / recursive type @see https://github.com/colinhacks/zod?tab=readme-ov-file#recursive-types
|
|
247
344
|
// resolvedValueContentReferenceToSharedValueSchema,
|
|
248
345
|
]);
|
|
249
|
-
var directValueBaseSchema =
|
|
250
|
-
objectType:
|
|
346
|
+
var directValueBaseSchema = z5.object({
|
|
347
|
+
objectType: z5.literal(objectTypeSchema.Enum.value).readonly(),
|
|
251
348
|
fieldDefinitionId: uuidSchema.readonly()
|
|
252
349
|
});
|
|
253
350
|
var directStringValueSchema = directValueBaseSchema.extend({
|
|
254
|
-
valueType:
|
|
351
|
+
valueType: z5.literal(ValueTypeSchema.Enum.string).readonly(),
|
|
255
352
|
content: translatableStringSchema
|
|
256
353
|
});
|
|
257
354
|
var directNumberValueSchema = directValueBaseSchema.extend({
|
|
258
|
-
valueType:
|
|
355
|
+
valueType: z5.literal(ValueTypeSchema.Enum.number).readonly(),
|
|
259
356
|
content: translatableNumberSchema
|
|
260
357
|
});
|
|
261
358
|
var directBooleanValueSchema = directValueBaseSchema.extend({
|
|
262
|
-
valueType:
|
|
359
|
+
valueType: z5.literal(ValueTypeSchema.Enum.boolean).readonly(),
|
|
263
360
|
content: translatableBooleanSchema
|
|
264
361
|
});
|
|
265
|
-
var directValueSchema =
|
|
362
|
+
var directValueSchema = z5.union([
|
|
266
363
|
directStringValueSchema,
|
|
267
364
|
directNumberValueSchema,
|
|
268
365
|
directBooleanValueSchema
|
|
269
366
|
]);
|
|
270
|
-
var referencedValueSchema =
|
|
271
|
-
objectType:
|
|
367
|
+
var referencedValueSchema = z5.object({
|
|
368
|
+
objectType: z5.literal(objectTypeSchema.Enum.value).readonly(),
|
|
272
369
|
fieldDefinitionId: uuidSchema.readonly(),
|
|
273
|
-
valueType:
|
|
370
|
+
valueType: z5.literal(ValueTypeSchema.Enum.reference).readonly(),
|
|
274
371
|
content: translatableArrayOf(valueContentReferenceSchema)
|
|
275
372
|
});
|
|
276
|
-
var valueSchema =
|
|
373
|
+
var valueSchema = z5.union([directValueSchema, referencedValueSchema]);
|
|
277
374
|
var resolvedReferencedValueSchema = referencedValueSchema.extend({
|
|
278
375
|
content: translatableArrayOf(resolvedValueContentReferenceSchema)
|
|
279
376
|
});
|
|
280
|
-
var resolvedValueSchema =
|
|
377
|
+
var resolvedValueSchema = z5.union([
|
|
281
378
|
directValueSchema,
|
|
282
379
|
resolvedReferencedValueSchema
|
|
283
380
|
]);
|
|
284
381
|
|
|
285
382
|
// src/schema/entrySchema.ts
|
|
286
383
|
var entryFileSchema = baseFileSchema.extend({
|
|
287
|
-
objectType:
|
|
288
|
-
values:
|
|
384
|
+
objectType: z6.literal(objectTypeSchema.Enum.entry).readonly(),
|
|
385
|
+
values: z6.array(valueSchema)
|
|
289
386
|
});
|
|
290
387
|
var entrySchema = entryFileSchema.extend({
|
|
291
|
-
values:
|
|
388
|
+
values: z6.array(z6.lazy(() => resolvedValueSchema)),
|
|
389
|
+
/**
|
|
390
|
+
* Commit history of this Entry
|
|
391
|
+
*/
|
|
392
|
+
history: z6.array(gitCommitSchema)
|
|
292
393
|
});
|
|
293
394
|
var entryExportSchema = entrySchema.extend({});
|
|
294
395
|
var createEntrySchema = entryFileSchema.omit({
|
|
@@ -299,14 +400,15 @@ var createEntrySchema = entryFileSchema.omit({
|
|
|
299
400
|
}).extend({
|
|
300
401
|
projectId: uuidSchema.readonly(),
|
|
301
402
|
collectionId: uuidSchema.readonly(),
|
|
302
|
-
values:
|
|
403
|
+
values: z6.array(valueSchema)
|
|
303
404
|
});
|
|
304
|
-
var readEntrySchema =
|
|
405
|
+
var readEntrySchema = z6.object({
|
|
305
406
|
id: uuidSchema.readonly(),
|
|
306
407
|
projectId: uuidSchema.readonly(),
|
|
307
|
-
collectionId: uuidSchema.readonly()
|
|
408
|
+
collectionId: uuidSchema.readonly(),
|
|
409
|
+
commitHash: z6.string().optional().readonly()
|
|
308
410
|
});
|
|
309
|
-
var updateEntrySchema =
|
|
411
|
+
var updateEntrySchema = entryFileSchema.omit({
|
|
310
412
|
objectType: true,
|
|
311
413
|
created: true,
|
|
312
414
|
updated: true
|
|
@@ -315,14 +417,14 @@ var updateEntrySchema = entrySchema.omit({
|
|
|
315
417
|
collectionId: uuidSchema.readonly()
|
|
316
418
|
});
|
|
317
419
|
var deleteEntrySchema = readEntrySchema.extend({});
|
|
318
|
-
var countEntriesSchema =
|
|
420
|
+
var countEntriesSchema = z6.object({
|
|
319
421
|
projectId: uuidSchema.readonly(),
|
|
320
422
|
collectionId: uuidSchema.readonly()
|
|
321
423
|
});
|
|
322
424
|
|
|
323
425
|
// src/schema/fieldSchema.ts
|
|
324
|
-
import { z as
|
|
325
|
-
var FieldTypeSchema =
|
|
426
|
+
import { z as z7 } from "zod";
|
|
427
|
+
var FieldTypeSchema = z7.enum([
|
|
326
428
|
// String Values
|
|
327
429
|
"text",
|
|
328
430
|
"textarea",
|
|
@@ -344,67 +446,67 @@ var FieldTypeSchema = z6.enum([
|
|
|
344
446
|
"entry"
|
|
345
447
|
// 'sharedValue', // @todo
|
|
346
448
|
]);
|
|
347
|
-
var FieldWidthSchema =
|
|
348
|
-
var FieldDefinitionBaseSchema =
|
|
449
|
+
var FieldWidthSchema = z7.enum(["12", "6", "4", "3"]);
|
|
450
|
+
var FieldDefinitionBaseSchema = z7.object({
|
|
349
451
|
id: uuidSchema.readonly(),
|
|
350
452
|
label: translatableStringSchema,
|
|
351
453
|
description: translatableStringSchema,
|
|
352
|
-
isRequired:
|
|
353
|
-
isDisabled:
|
|
354
|
-
isUnique:
|
|
454
|
+
isRequired: z7.boolean(),
|
|
455
|
+
isDisabled: z7.boolean(),
|
|
456
|
+
isUnique: z7.boolean(),
|
|
355
457
|
inputWidth: FieldWidthSchema
|
|
356
458
|
});
|
|
357
459
|
var StringFieldDefinitionBaseSchema = FieldDefinitionBaseSchema.extend(
|
|
358
460
|
{
|
|
359
|
-
valueType:
|
|
360
|
-
defaultValue:
|
|
461
|
+
valueType: z7.literal(ValueTypeSchema.Enum.string),
|
|
462
|
+
defaultValue: z7.string().nullable()
|
|
361
463
|
}
|
|
362
464
|
);
|
|
363
465
|
var textFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend(
|
|
364
466
|
{
|
|
365
|
-
fieldType:
|
|
366
|
-
min:
|
|
367
|
-
max:
|
|
467
|
+
fieldType: z7.literal(FieldTypeSchema.Enum.text),
|
|
468
|
+
min: z7.number().nullable(),
|
|
469
|
+
max: z7.number().nullable()
|
|
368
470
|
}
|
|
369
471
|
);
|
|
370
472
|
var textareaFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
|
|
371
|
-
fieldType:
|
|
372
|
-
min:
|
|
373
|
-
max:
|
|
473
|
+
fieldType: z7.literal(FieldTypeSchema.Enum.textarea),
|
|
474
|
+
min: z7.number().nullable(),
|
|
475
|
+
max: z7.number().nullable()
|
|
374
476
|
});
|
|
375
477
|
var emailFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
|
|
376
|
-
fieldType:
|
|
377
|
-
defaultValue:
|
|
478
|
+
fieldType: z7.literal(FieldTypeSchema.Enum.email),
|
|
479
|
+
defaultValue: z7.string().email().nullable()
|
|
378
480
|
});
|
|
379
481
|
var urlFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
|
|
380
|
-
fieldType:
|
|
381
|
-
defaultValue:
|
|
482
|
+
fieldType: z7.literal(FieldTypeSchema.Enum.url),
|
|
483
|
+
defaultValue: z7.string().url().nullable()
|
|
382
484
|
});
|
|
383
485
|
var ipFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
|
|
384
|
-
fieldType:
|
|
385
|
-
defaultValue:
|
|
486
|
+
fieldType: z7.literal(FieldTypeSchema.Enum.ip),
|
|
487
|
+
defaultValue: z7.string().ip().nullable()
|
|
386
488
|
});
|
|
387
489
|
var dateFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend(
|
|
388
490
|
{
|
|
389
|
-
fieldType:
|
|
390
|
-
defaultValue:
|
|
491
|
+
fieldType: z7.literal(FieldTypeSchema.Enum.date),
|
|
492
|
+
defaultValue: z7.string().date().nullable()
|
|
391
493
|
}
|
|
392
494
|
);
|
|
393
495
|
var timeFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend(
|
|
394
496
|
{
|
|
395
|
-
fieldType:
|
|
396
|
-
defaultValue:
|
|
497
|
+
fieldType: z7.literal(FieldTypeSchema.Enum.time),
|
|
498
|
+
defaultValue: z7.string().time().nullable()
|
|
397
499
|
}
|
|
398
500
|
);
|
|
399
501
|
var datetimeFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
|
|
400
|
-
fieldType:
|
|
401
|
-
defaultValue:
|
|
502
|
+
fieldType: z7.literal(FieldTypeSchema.Enum.datetime),
|
|
503
|
+
defaultValue: z7.string().datetime().nullable()
|
|
402
504
|
});
|
|
403
505
|
var telephoneFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
|
|
404
|
-
fieldType:
|
|
506
|
+
fieldType: z7.literal(FieldTypeSchema.Enum.telephone)
|
|
405
507
|
// defaultValue: z.string().e164(), @todo when zod v4 releases @see https://github.com/colinhacks/zod/pull/3476
|
|
406
508
|
});
|
|
407
|
-
var stringFieldDefinitionSchema =
|
|
509
|
+
var stringFieldDefinitionSchema = z7.union([
|
|
408
510
|
textFieldDefinitionSchema,
|
|
409
511
|
textareaFieldDefinitionSchema,
|
|
410
512
|
emailFieldDefinitionSchema,
|
|
@@ -417,50 +519,50 @@ var stringFieldDefinitionSchema = z6.union([
|
|
|
417
519
|
]);
|
|
418
520
|
var NumberFieldDefinitionBaseSchema = FieldDefinitionBaseSchema.extend(
|
|
419
521
|
{
|
|
420
|
-
valueType:
|
|
421
|
-
min:
|
|
422
|
-
max:
|
|
423
|
-
isUnique:
|
|
424
|
-
defaultValue:
|
|
522
|
+
valueType: z7.literal(ValueTypeSchema.Enum.number),
|
|
523
|
+
min: z7.number().nullable(),
|
|
524
|
+
max: z7.number().nullable(),
|
|
525
|
+
isUnique: z7.literal(false),
|
|
526
|
+
defaultValue: z7.number().nullable()
|
|
425
527
|
}
|
|
426
528
|
);
|
|
427
529
|
var numberFieldDefinitionSchema = NumberFieldDefinitionBaseSchema.extend({
|
|
428
|
-
fieldType:
|
|
530
|
+
fieldType: z7.literal(FieldTypeSchema.Enum.number)
|
|
429
531
|
});
|
|
430
532
|
var rangeFieldDefinitionSchema = NumberFieldDefinitionBaseSchema.extend({
|
|
431
|
-
fieldType:
|
|
533
|
+
fieldType: z7.literal(FieldTypeSchema.Enum.range),
|
|
432
534
|
// 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:
|
|
434
|
-
min:
|
|
435
|
-
max:
|
|
436
|
-
defaultValue:
|
|
535
|
+
isRequired: z7.literal(true),
|
|
536
|
+
min: z7.number(),
|
|
537
|
+
max: z7.number(),
|
|
538
|
+
defaultValue: z7.number()
|
|
437
539
|
});
|
|
438
540
|
var BooleanFieldDefinitionBaseSchema = FieldDefinitionBaseSchema.extend({
|
|
439
|
-
valueType:
|
|
541
|
+
valueType: z7.literal(ValueTypeSchema.Enum.boolean),
|
|
440
542
|
// 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:
|
|
442
|
-
defaultValue:
|
|
443
|
-
isUnique:
|
|
543
|
+
isRequired: z7.literal(true),
|
|
544
|
+
defaultValue: z7.boolean(),
|
|
545
|
+
isUnique: z7.literal(false)
|
|
444
546
|
});
|
|
445
547
|
var toggleFieldDefinitionSchema = BooleanFieldDefinitionBaseSchema.extend({
|
|
446
|
-
fieldType:
|
|
548
|
+
fieldType: z7.literal(FieldTypeSchema.Enum.toggle)
|
|
447
549
|
});
|
|
448
550
|
var ReferenceFieldDefinitionBaseSchema = FieldDefinitionBaseSchema.extend({
|
|
449
|
-
valueType:
|
|
551
|
+
valueType: z7.literal(ValueTypeSchema.Enum.reference)
|
|
450
552
|
});
|
|
451
553
|
var assetFieldDefinitionSchema = ReferenceFieldDefinitionBaseSchema.extend({
|
|
452
|
-
fieldType:
|
|
453
|
-
allowedMimeTypes:
|
|
454
|
-
min:
|
|
455
|
-
max:
|
|
554
|
+
fieldType: z7.literal(FieldTypeSchema.Enum.asset),
|
|
555
|
+
allowedMimeTypes: z7.array(supportedAssetMimeTypeSchema).min(1),
|
|
556
|
+
min: z7.number().nullable(),
|
|
557
|
+
max: z7.number().nullable()
|
|
456
558
|
});
|
|
457
559
|
var entryFieldDefinitionSchema = ReferenceFieldDefinitionBaseSchema.extend({
|
|
458
|
-
fieldType:
|
|
459
|
-
ofCollections:
|
|
460
|
-
min:
|
|
461
|
-
max:
|
|
560
|
+
fieldType: z7.literal(FieldTypeSchema.Enum.entry),
|
|
561
|
+
ofCollections: z7.array(uuidSchema),
|
|
562
|
+
min: z7.number().nullable(),
|
|
563
|
+
max: z7.number().nullable()
|
|
462
564
|
});
|
|
463
|
-
var fieldDefinitionSchema =
|
|
565
|
+
var fieldDefinitionSchema = z7.union([
|
|
464
566
|
stringFieldDefinitionSchema,
|
|
465
567
|
numberFieldDefinitionSchema,
|
|
466
568
|
rangeFieldDefinitionSchema,
|
|
@@ -487,10 +589,10 @@ function getValueContentSchemaFromFieldDefinition(fieldDefinition) {
|
|
|
487
589
|
}
|
|
488
590
|
}
|
|
489
591
|
function getBooleanValueContentSchema() {
|
|
490
|
-
return
|
|
592
|
+
return z7.boolean();
|
|
491
593
|
}
|
|
492
594
|
function getNumberValueContentSchema(definition) {
|
|
493
|
-
let schema =
|
|
595
|
+
let schema = z7.number();
|
|
494
596
|
if (definition.min) {
|
|
495
597
|
schema = schema.min(definition.min);
|
|
496
598
|
}
|
|
@@ -503,7 +605,7 @@ function getNumberValueContentSchema(definition) {
|
|
|
503
605
|
return schema;
|
|
504
606
|
}
|
|
505
607
|
function getStringValueContentSchema(definition) {
|
|
506
|
-
let schema =
|
|
608
|
+
let schema = z7.string().trim();
|
|
507
609
|
if ("min" in definition && definition.min) {
|
|
508
610
|
schema = schema.min(definition.min);
|
|
509
611
|
}
|
|
@@ -542,12 +644,12 @@ function getReferenceValueContentSchema(definition) {
|
|
|
542
644
|
switch (definition.fieldType) {
|
|
543
645
|
case FieldTypeSchema.Enum.asset:
|
|
544
646
|
{
|
|
545
|
-
schema =
|
|
647
|
+
schema = z7.array(valueContentReferenceToAssetSchema);
|
|
546
648
|
}
|
|
547
649
|
break;
|
|
548
650
|
case FieldTypeSchema.Enum.entry:
|
|
549
651
|
{
|
|
550
|
-
schema =
|
|
652
|
+
schema = z7.array(valueContentReferenceToEntrySchema);
|
|
551
653
|
}
|
|
552
654
|
break;
|
|
553
655
|
}
|
|
@@ -565,24 +667,29 @@ function getReferenceValueContentSchema(definition) {
|
|
|
565
667
|
|
|
566
668
|
// src/schema/collectionSchema.ts
|
|
567
669
|
var collectionFileSchema = baseFileSchema.extend({
|
|
568
|
-
objectType:
|
|
569
|
-
name:
|
|
670
|
+
objectType: z8.literal(objectTypeSchema.Enum.collection).readonly(),
|
|
671
|
+
name: z8.object({
|
|
570
672
|
singular: translatableStringSchema,
|
|
571
673
|
plural: translatableStringSchema
|
|
572
674
|
}),
|
|
573
|
-
slug:
|
|
574
|
-
singular:
|
|
575
|
-
plural:
|
|
675
|
+
slug: z8.object({
|
|
676
|
+
singular: z8.string(),
|
|
677
|
+
plural: z8.string()
|
|
576
678
|
}),
|
|
577
679
|
description: translatableStringSchema,
|
|
578
680
|
icon: supportedIconSchema,
|
|
579
|
-
fieldDefinitions:
|
|
681
|
+
fieldDefinitions: z8.array(fieldDefinitionSchema)
|
|
682
|
+
});
|
|
683
|
+
var collectionSchema = collectionFileSchema.extend({
|
|
684
|
+
/**
|
|
685
|
+
* Commit history of this Collection
|
|
686
|
+
*/
|
|
687
|
+
history: z8.array(gitCommitSchema)
|
|
580
688
|
});
|
|
581
|
-
var collectionSchema = collectionFileSchema.extend({});
|
|
582
689
|
var collectionExportSchema = collectionSchema.extend({
|
|
583
|
-
entries:
|
|
690
|
+
entries: z8.array(entryExportSchema)
|
|
584
691
|
});
|
|
585
|
-
var createCollectionSchema =
|
|
692
|
+
var createCollectionSchema = collectionFileSchema.omit({
|
|
586
693
|
id: true,
|
|
587
694
|
objectType: true,
|
|
588
695
|
created: true,
|
|
@@ -590,9 +697,10 @@ var createCollectionSchema = collectionSchema.omit({
|
|
|
590
697
|
}).extend({
|
|
591
698
|
projectId: uuidSchema.readonly()
|
|
592
699
|
});
|
|
593
|
-
var readCollectionSchema =
|
|
700
|
+
var readCollectionSchema = z8.object({
|
|
594
701
|
id: uuidSchema.readonly(),
|
|
595
|
-
projectId: uuidSchema.readonly()
|
|
702
|
+
projectId: uuidSchema.readonly(),
|
|
703
|
+
commitHash: z8.string().optional().readonly()
|
|
596
704
|
});
|
|
597
705
|
var updateCollectionSchema = collectionFileSchema.pick({
|
|
598
706
|
id: true,
|
|
@@ -605,115 +713,34 @@ var updateCollectionSchema = collectionFileSchema.pick({
|
|
|
605
713
|
projectId: uuidSchema.readonly()
|
|
606
714
|
});
|
|
607
715
|
var deleteCollectionSchema = readCollectionSchema.extend({});
|
|
608
|
-
var countCollectionsSchema =
|
|
716
|
+
var countCollectionsSchema = z8.object({
|
|
609
717
|
projectId: uuidSchema.readonly()
|
|
610
718
|
});
|
|
611
719
|
|
|
612
720
|
// src/schema/coreSchema.ts
|
|
613
|
-
import { z as z8 } from "zod";
|
|
614
|
-
var elekIoCoreOptionsSchema = z8.object({
|
|
615
|
-
/**
|
|
616
|
-
* The environment elek.io Core is currently running in
|
|
617
|
-
*/
|
|
618
|
-
environment: environmentSchema,
|
|
619
|
-
/**
|
|
620
|
-
* The current version of elek.io Core
|
|
621
|
-
*/
|
|
622
|
-
version: versionSchema,
|
|
623
|
-
file: z8.object({
|
|
624
|
-
json: z8.object({
|
|
625
|
-
/**
|
|
626
|
-
* If set, adds indentation with spaces (number) or escape character (string)
|
|
627
|
-
* and line break characters to saved JSON files on disk, to make them easier to read.
|
|
628
|
-
* Defaults to 2 spaces of indentation.
|
|
629
|
-
*/
|
|
630
|
-
indentation: z8.union([z8.number(), z8.string()])
|
|
631
|
-
})
|
|
632
|
-
})
|
|
633
|
-
});
|
|
634
|
-
var constructorElekIoCoreSchema = elekIoCoreOptionsSchema.omit({
|
|
635
|
-
version: true
|
|
636
|
-
}).partial({
|
|
637
|
-
environment: true,
|
|
638
|
-
file: true
|
|
639
|
-
}).optional();
|
|
640
|
-
|
|
641
|
-
// src/schema/gitSchema.ts
|
|
642
721
|
import { z as z9 } from "zod";
|
|
643
|
-
var
|
|
644
|
-
|
|
645
|
-
name: z9.string(),
|
|
646
|
-
email: z9.string()
|
|
647
|
-
});
|
|
648
|
-
var gitCommitSchema = z9.object({
|
|
649
|
-
/**
|
|
650
|
-
* SHA-1 hash of the commit
|
|
651
|
-
*/
|
|
652
|
-
hash: z9.string(),
|
|
653
|
-
message: z9.string(),
|
|
654
|
-
author: gitSignatureSchema,
|
|
655
|
-
datetime: z9.string().datetime(),
|
|
656
|
-
tag: z9.string().nullable()
|
|
657
|
-
});
|
|
658
|
-
var GitCommitIconNative = /* @__PURE__ */ ((GitCommitIconNative2) => {
|
|
659
|
-
GitCommitIconNative2["INIT"] = ":tada:";
|
|
660
|
-
GitCommitIconNative2["CREATE"] = ":heavy_plus_sign:";
|
|
661
|
-
GitCommitIconNative2["UPDATE"] = ":wrench:";
|
|
662
|
-
GitCommitIconNative2["DELETE"] = ":fire:";
|
|
663
|
-
return GitCommitIconNative2;
|
|
664
|
-
})(GitCommitIconNative || {});
|
|
665
|
-
var gitCommitIconSchema = z9.nativeEnum(GitCommitIconNative);
|
|
666
|
-
var gitInitOptionsSchema = z9.object({
|
|
667
|
-
/**
|
|
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).
|
|
669
|
-
*/
|
|
670
|
-
initialBranch: z9.string()
|
|
671
|
-
});
|
|
672
|
-
var gitCloneOptionsSchema = z9.object({
|
|
673
|
-
/**
|
|
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.
|
|
675
|
-
*/
|
|
676
|
-
depth: z9.number(),
|
|
677
|
-
/**
|
|
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.
|
|
679
|
-
*/
|
|
680
|
-
singleBranch: z9.boolean(),
|
|
681
|
-
/**
|
|
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.
|
|
683
|
-
*/
|
|
684
|
-
branch: z9.string()
|
|
685
|
-
});
|
|
686
|
-
var gitSwitchOptionsSchema = z9.object({
|
|
687
|
-
/**
|
|
688
|
-
* If true, creates a new local branch and then switches to it
|
|
689
|
-
*
|
|
690
|
-
* @see https://git-scm.com/docs/git-switch#Documentation/git-switch.txt---createltnew-branchgt
|
|
691
|
-
*/
|
|
692
|
-
isNew: z9.boolean().optional()
|
|
693
|
-
});
|
|
694
|
-
var gitLogOptionsSchema = z9.object({
|
|
695
|
-
/**
|
|
696
|
-
* Limit the result to given number of commits
|
|
697
|
-
*/
|
|
698
|
-
limit: z9.number().optional(),
|
|
699
|
-
/**
|
|
700
|
-
* Only list commits that are between given SHAs or tag names
|
|
701
|
-
*
|
|
702
|
-
* Note that the commits of from and to are not included in the result
|
|
703
|
-
*/
|
|
704
|
-
between: z9.object({
|
|
722
|
+
var elekIoCoreOptionsSchema = z9.object({
|
|
723
|
+
log: z9.object({
|
|
705
724
|
/**
|
|
706
|
-
*
|
|
725
|
+
* The lowest level that should be logged
|
|
726
|
+
*
|
|
727
|
+
* @default 'info'
|
|
707
728
|
*/
|
|
708
|
-
|
|
729
|
+
level: logLevelSchema
|
|
730
|
+
}),
|
|
731
|
+
file: z9.object({
|
|
709
732
|
/**
|
|
710
|
-
*
|
|
733
|
+
* If set to true, caches files in memory to speed up access
|
|
711
734
|
*
|
|
712
|
-
*
|
|
735
|
+
* @default true
|
|
713
736
|
*/
|
|
714
|
-
|
|
737
|
+
cache: z9.boolean()
|
|
715
738
|
})
|
|
716
739
|
});
|
|
740
|
+
var constructorElekIoCoreSchema = elekIoCoreOptionsSchema.partial({
|
|
741
|
+
log: true,
|
|
742
|
+
file: true
|
|
743
|
+
}).optional();
|
|
717
744
|
|
|
718
745
|
// src/schema/gitTagSchema.ts
|
|
719
746
|
import { z as z10 } from "zod";
|
|
@@ -765,7 +792,22 @@ var projectFileSchema = baseFileSchema.extend({
|
|
|
765
792
|
status: projectStatusSchema,
|
|
766
793
|
settings: projectSettingsSchema
|
|
767
794
|
});
|
|
768
|
-
var projectSchema = projectFileSchema.extend({
|
|
795
|
+
var projectSchema = projectFileSchema.extend({
|
|
796
|
+
/**
|
|
797
|
+
* Commit history of this Project
|
|
798
|
+
*/
|
|
799
|
+
history: z11.array(gitCommitSchema),
|
|
800
|
+
/**
|
|
801
|
+
* Full commit history of this Project
|
|
802
|
+
* including all Assets, Collections, Entries and other files
|
|
803
|
+
*/
|
|
804
|
+
fullHistory: z11.array(gitCommitSchema)
|
|
805
|
+
});
|
|
806
|
+
var outdatedProjectSchema = projectFileSchema.pick({
|
|
807
|
+
id: true,
|
|
808
|
+
name: true,
|
|
809
|
+
coreVersion: true
|
|
810
|
+
});
|
|
769
811
|
var projectExportSchema = projectSchema.extend({
|
|
770
812
|
assets: z11.array(assetExportSchema),
|
|
771
813
|
collections: z11.array(collectionExportSchema)
|
|
@@ -779,7 +821,8 @@ var createProjectSchema = projectSchema.pick({
|
|
|
779
821
|
settings: true
|
|
780
822
|
});
|
|
781
823
|
var readProjectSchema = z11.object({
|
|
782
|
-
id: uuidSchema.readonly()
|
|
824
|
+
id: uuidSchema.readonly(),
|
|
825
|
+
commitHash: z11.string().optional().readonly()
|
|
783
826
|
});
|
|
784
827
|
var updateProjectSchema = projectSchema.pick({
|
|
785
828
|
id: true,
|
|
@@ -792,7 +835,11 @@ var updateProjectSchema = projectSchema.pick({
|
|
|
792
835
|
settings: true
|
|
793
836
|
});
|
|
794
837
|
var upgradeProjectSchema = z11.object({
|
|
795
|
-
id: uuidSchema.readonly()
|
|
838
|
+
id: uuidSchema.readonly(),
|
|
839
|
+
/**
|
|
840
|
+
* Force the upgrade even if the Project is up-to-date
|
|
841
|
+
*/
|
|
842
|
+
force: z11.boolean().optional()
|
|
796
843
|
});
|
|
797
844
|
var deleteProjectSchema = readProjectSchema.extend({});
|
|
798
845
|
var projectUpgradeSchema = z11.object({
|
|
@@ -967,7 +1014,6 @@ export {
|
|
|
967
1014
|
entryFieldDefinitionSchema,
|
|
968
1015
|
entryFileSchema,
|
|
969
1016
|
entrySchema,
|
|
970
|
-
environmentSchema,
|
|
971
1017
|
fieldDefinitionSchema,
|
|
972
1018
|
fileReferenceSchema,
|
|
973
1019
|
getChangesProjectSchema,
|
|
@@ -990,8 +1036,10 @@ export {
|
|
|
990
1036
|
listGitTagsSchema,
|
|
991
1037
|
listProjectsSchema,
|
|
992
1038
|
localUserSchema,
|
|
1039
|
+
logLevelSchema,
|
|
993
1040
|
numberFieldDefinitionSchema,
|
|
994
1041
|
objectTypeSchema,
|
|
1042
|
+
outdatedProjectSchema,
|
|
995
1043
|
projectExportSchema,
|
|
996
1044
|
projectFileSchema,
|
|
997
1045
|
projectFolderSchema,
|
|
@@ -1009,6 +1057,7 @@ export {
|
|
|
1009
1057
|
resolvedReferencedValueSchema,
|
|
1010
1058
|
resolvedValueContentReferenceSchema,
|
|
1011
1059
|
resolvedValueSchema,
|
|
1060
|
+
saveAssetSchema,
|
|
1012
1061
|
searchProjectSchema,
|
|
1013
1062
|
serviceTypeSchema,
|
|
1014
1063
|
setRemoteOriginUrlProjectSchema,
|