@elek-io/core 0.14.2 → 0.14.4
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 +11846 -13515
- package/dist/browser/index.browser.js +93 -79
- package/dist/browser/index.browser.js.map +1 -1
- package/dist/node/index.node.d.ts +11845 -13514
- package/dist/node/index.node.js +135 -121
- package/dist/node/index.node.js.map +1 -1
- package/package.json +7 -7
package/dist/node/index.node.js
CHANGED
|
@@ -10,7 +10,7 @@ import Fs7 from "fs-extra";
|
|
|
10
10
|
// package.json
|
|
11
11
|
var package_default = {
|
|
12
12
|
name: "@elek-io/core",
|
|
13
|
-
version: "0.14.
|
|
13
|
+
version: "0.14.4",
|
|
14
14
|
description: "Handles core functionality of elek.io Projects like file IO and version control.",
|
|
15
15
|
homepage: "https://elek.io",
|
|
16
16
|
repository: "https://github.com/elek-io/core",
|
|
@@ -45,19 +45,19 @@ var package_default = {
|
|
|
45
45
|
release: "changeset publish"
|
|
46
46
|
},
|
|
47
47
|
dependencies: {
|
|
48
|
-
"@hono/node-server": "1.
|
|
48
|
+
"@hono/node-server": "1.18.1",
|
|
49
49
|
"@hono/swagger-ui": "0.5.2",
|
|
50
|
-
"@hono/zod-openapi": "
|
|
50
|
+
"@hono/zod-openapi": "1.1.0",
|
|
51
51
|
"@sindresorhus/slugify": "2.2.1",
|
|
52
|
-
"fs-extra": "11.3.
|
|
53
|
-
hono: "4.
|
|
52
|
+
"fs-extra": "11.3.1",
|
|
53
|
+
hono: "4.9.0",
|
|
54
54
|
mime: "4.0.7",
|
|
55
55
|
"p-queue": "8.1.0",
|
|
56
56
|
semver: "7.7.2",
|
|
57
57
|
uuid: "11.1.0",
|
|
58
58
|
winston: "3.17.0",
|
|
59
59
|
"winston-daily-rotate-file": "5.0.0",
|
|
60
|
-
zod: "
|
|
60
|
+
zod: "4.0.17"
|
|
61
61
|
},
|
|
62
62
|
devDependencies: {
|
|
63
63
|
"@changesets/cli": "2.29.5",
|
|
@@ -70,7 +70,7 @@ var package_default = {
|
|
|
70
70
|
"@types/uuid": "10.0.0",
|
|
71
71
|
"@vitest/coverage-v8": "3.2.4",
|
|
72
72
|
tsup: "8.5.0",
|
|
73
|
-
typescript: "5.
|
|
73
|
+
typescript: "5.9.2",
|
|
74
74
|
vitest: "3.2.4"
|
|
75
75
|
},
|
|
76
76
|
peerDependencies: {
|
|
@@ -181,21 +181,25 @@ var objectTypeSchema = z.enum([
|
|
|
181
181
|
]);
|
|
182
182
|
var logLevelSchema = z.enum(["error", "warn", "info", "debug"]);
|
|
183
183
|
var versionSchema = z.string();
|
|
184
|
-
var uuidSchema = z.
|
|
185
|
-
var translatableStringSchema = z.
|
|
184
|
+
var uuidSchema = z.uuid("shared.invalidUuid");
|
|
185
|
+
var translatableStringSchema = z.partialRecord(
|
|
186
186
|
supportedLanguageSchema,
|
|
187
187
|
z.string().trim().min(1, "shared.translatableStringRequired")
|
|
188
188
|
);
|
|
189
|
-
var translatableNumberSchema = z.
|
|
189
|
+
var translatableNumberSchema = z.partialRecord(
|
|
190
190
|
supportedLanguageSchema,
|
|
191
|
-
z.number({
|
|
191
|
+
z.number({
|
|
192
|
+
error: (error) => error.input === void 0 ? "shared.translatableNumberRequired" : "shared.translatableNumberNotANumber"
|
|
193
|
+
})
|
|
192
194
|
);
|
|
193
|
-
var translatableBooleanSchema = z.
|
|
195
|
+
var translatableBooleanSchema = z.partialRecord(
|
|
194
196
|
supportedLanguageSchema,
|
|
195
|
-
z.boolean({
|
|
197
|
+
z.boolean({
|
|
198
|
+
error: (error) => error.input === void 0 ? "shared.translatableBooleanRequired" : "shared.translatableBooleanNotABoolean"
|
|
199
|
+
})
|
|
196
200
|
);
|
|
197
201
|
function translatableArrayOf(schema) {
|
|
198
|
-
return z.
|
|
202
|
+
return z.partialRecord(supportedLanguageSchema, z.array(schema));
|
|
199
203
|
}
|
|
200
204
|
|
|
201
205
|
// src/schema/fileSchema.ts
|
|
@@ -345,7 +349,7 @@ var countGitTagsSchema = z3.object({
|
|
|
345
349
|
|
|
346
350
|
// src/schema/assetSchema.ts
|
|
347
351
|
var assetFileSchema = baseFileSchema.extend({
|
|
348
|
-
objectType: z4.literal(objectTypeSchema.
|
|
352
|
+
objectType: z4.literal(objectTypeSchema.enum.asset).readonly(),
|
|
349
353
|
name: z4.string(),
|
|
350
354
|
description: z4.string(),
|
|
351
355
|
extension: z4.string().readonly(),
|
|
@@ -426,13 +430,13 @@ var valueContentReferenceBase = z5.object({
|
|
|
426
430
|
id: uuidSchema
|
|
427
431
|
});
|
|
428
432
|
var valueContentReferenceToAssetSchema = valueContentReferenceBase.extend({
|
|
429
|
-
objectType: z5.literal(objectTypeSchema.
|
|
433
|
+
objectType: z5.literal(objectTypeSchema.enum.asset)
|
|
430
434
|
});
|
|
431
435
|
var valueContentReferenceToCollectionSchema = valueContentReferenceBase.extend({
|
|
432
|
-
objectType: z5.literal(objectTypeSchema.
|
|
436
|
+
objectType: z5.literal(objectTypeSchema.enum.collection)
|
|
433
437
|
});
|
|
434
438
|
var valueContentReferenceToEntrySchema = valueContentReferenceBase.extend({
|
|
435
|
-
objectType: z5.literal(objectTypeSchema.
|
|
439
|
+
objectType: z5.literal(objectTypeSchema.enum.entry)
|
|
436
440
|
});
|
|
437
441
|
var valueContentReferenceSchema = z5.union([
|
|
438
442
|
valueContentReferenceToAssetSchema,
|
|
@@ -441,19 +445,19 @@ var valueContentReferenceSchema = z5.union([
|
|
|
441
445
|
// valueContentReferenceToSharedValueSchema,
|
|
442
446
|
]);
|
|
443
447
|
var directValueBaseSchema = z5.object({
|
|
444
|
-
objectType: z5.literal(objectTypeSchema.
|
|
448
|
+
objectType: z5.literal(objectTypeSchema.enum.value).readonly(),
|
|
445
449
|
fieldDefinitionId: uuidSchema.readonly()
|
|
446
450
|
});
|
|
447
451
|
var directStringValueSchema = directValueBaseSchema.extend({
|
|
448
|
-
valueType: z5.literal(ValueTypeSchema.
|
|
452
|
+
valueType: z5.literal(ValueTypeSchema.enum.string).readonly(),
|
|
449
453
|
content: translatableStringSchema
|
|
450
454
|
});
|
|
451
455
|
var directNumberValueSchema = directValueBaseSchema.extend({
|
|
452
|
-
valueType: z5.literal(ValueTypeSchema.
|
|
456
|
+
valueType: z5.literal(ValueTypeSchema.enum.number).readonly(),
|
|
453
457
|
content: translatableNumberSchema
|
|
454
458
|
});
|
|
455
459
|
var directBooleanValueSchema = directValueBaseSchema.extend({
|
|
456
|
-
valueType: z5.literal(ValueTypeSchema.
|
|
460
|
+
valueType: z5.literal(ValueTypeSchema.enum.boolean).readonly(),
|
|
457
461
|
content: translatableBooleanSchema
|
|
458
462
|
});
|
|
459
463
|
var directValueSchema = z5.union([
|
|
@@ -462,16 +466,16 @@ var directValueSchema = z5.union([
|
|
|
462
466
|
directBooleanValueSchema
|
|
463
467
|
]);
|
|
464
468
|
var referencedValueSchema = z5.object({
|
|
465
|
-
objectType: z5.literal(objectTypeSchema.
|
|
469
|
+
objectType: z5.literal(objectTypeSchema.enum.value).readonly(),
|
|
466
470
|
fieldDefinitionId: uuidSchema.readonly(),
|
|
467
|
-
valueType: z5.literal(ValueTypeSchema.
|
|
471
|
+
valueType: z5.literal(ValueTypeSchema.enum.reference).readonly(),
|
|
468
472
|
content: translatableArrayOf(valueContentReferenceSchema)
|
|
469
473
|
});
|
|
470
474
|
var valueSchema = z5.union([directValueSchema, referencedValueSchema]);
|
|
471
475
|
|
|
472
476
|
// src/schema/entrySchema.ts
|
|
473
477
|
var entryFileSchema = baseFileSchema.extend({
|
|
474
|
-
objectType: z6.literal(objectTypeSchema.
|
|
478
|
+
objectType: z6.literal(objectTypeSchema.enum.entry).readonly(),
|
|
475
479
|
values: z6.array(valueSchema)
|
|
476
480
|
});
|
|
477
481
|
var entrySchema = entryFileSchema.extend({
|
|
@@ -520,7 +524,7 @@ var FieldTypeSchema = z7.enum([
|
|
|
520
524
|
"email",
|
|
521
525
|
// 'password', @todo maybe if there is a usecase
|
|
522
526
|
"url",
|
|
523
|
-
"
|
|
527
|
+
"ipv4",
|
|
524
528
|
"date",
|
|
525
529
|
"time",
|
|
526
530
|
"datetime",
|
|
@@ -547,60 +551,62 @@ var FieldDefinitionBaseSchema = z7.object({
|
|
|
547
551
|
});
|
|
548
552
|
var StringFieldDefinitionBaseSchema = FieldDefinitionBaseSchema.extend(
|
|
549
553
|
{
|
|
550
|
-
valueType: z7.literal(ValueTypeSchema.
|
|
554
|
+
valueType: z7.literal(ValueTypeSchema.enum.string),
|
|
551
555
|
defaultValue: z7.string().nullable()
|
|
552
556
|
}
|
|
553
557
|
);
|
|
554
558
|
var textFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend(
|
|
555
559
|
{
|
|
556
|
-
fieldType: z7.literal(FieldTypeSchema.
|
|
560
|
+
fieldType: z7.literal(FieldTypeSchema.enum.text),
|
|
557
561
|
min: z7.number().nullable(),
|
|
558
562
|
max: z7.number().nullable()
|
|
559
563
|
}
|
|
560
564
|
);
|
|
561
565
|
var textareaFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
|
|
562
|
-
fieldType: z7.literal(FieldTypeSchema.
|
|
566
|
+
fieldType: z7.literal(FieldTypeSchema.enum.textarea),
|
|
563
567
|
min: z7.number().nullable(),
|
|
564
568
|
max: z7.number().nullable()
|
|
565
569
|
});
|
|
566
570
|
var emailFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
|
|
567
|
-
fieldType: z7.literal(FieldTypeSchema.
|
|
568
|
-
defaultValue: z7.
|
|
571
|
+
fieldType: z7.literal(FieldTypeSchema.enum.email),
|
|
572
|
+
defaultValue: z7.email().nullable()
|
|
569
573
|
});
|
|
570
574
|
var urlFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
|
|
571
|
-
fieldType: z7.literal(FieldTypeSchema.
|
|
572
|
-
defaultValue: z7.
|
|
573
|
-
});
|
|
574
|
-
var ipFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
|
|
575
|
-
fieldType: z7.literal(FieldTypeSchema.Enum.ip),
|
|
576
|
-
defaultValue: z7.string().ip().nullable()
|
|
575
|
+
fieldType: z7.literal(FieldTypeSchema.enum.url),
|
|
576
|
+
defaultValue: z7.url().nullable()
|
|
577
577
|
});
|
|
578
|
+
var ipv4FieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend(
|
|
579
|
+
{
|
|
580
|
+
fieldType: z7.literal(FieldTypeSchema.enum.ipv4),
|
|
581
|
+
defaultValue: z7.ipv4().nullable()
|
|
582
|
+
}
|
|
583
|
+
);
|
|
578
584
|
var dateFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend(
|
|
579
585
|
{
|
|
580
|
-
fieldType: z7.literal(FieldTypeSchema.
|
|
581
|
-
defaultValue: z7.
|
|
586
|
+
fieldType: z7.literal(FieldTypeSchema.enum.date),
|
|
587
|
+
defaultValue: z7.iso.date().nullable()
|
|
582
588
|
}
|
|
583
589
|
);
|
|
584
590
|
var timeFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend(
|
|
585
591
|
{
|
|
586
|
-
fieldType: z7.literal(FieldTypeSchema.
|
|
587
|
-
defaultValue: z7.
|
|
592
|
+
fieldType: z7.literal(FieldTypeSchema.enum.time),
|
|
593
|
+
defaultValue: z7.iso.time().nullable()
|
|
588
594
|
}
|
|
589
595
|
);
|
|
590
596
|
var datetimeFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
|
|
591
|
-
fieldType: z7.literal(FieldTypeSchema.
|
|
592
|
-
defaultValue: z7.
|
|
597
|
+
fieldType: z7.literal(FieldTypeSchema.enum.datetime),
|
|
598
|
+
defaultValue: z7.iso.datetime().nullable()
|
|
593
599
|
});
|
|
594
600
|
var telephoneFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
|
|
595
|
-
fieldType: z7.literal(FieldTypeSchema.
|
|
596
|
-
|
|
601
|
+
fieldType: z7.literal(FieldTypeSchema.enum.telephone),
|
|
602
|
+
defaultValue: z7.e164().nullable()
|
|
597
603
|
});
|
|
598
604
|
var stringFieldDefinitionSchema = z7.union([
|
|
599
605
|
textFieldDefinitionSchema,
|
|
600
606
|
textareaFieldDefinitionSchema,
|
|
601
607
|
emailFieldDefinitionSchema,
|
|
602
608
|
urlFieldDefinitionSchema,
|
|
603
|
-
|
|
609
|
+
ipv4FieldDefinitionSchema,
|
|
604
610
|
dateFieldDefinitionSchema,
|
|
605
611
|
timeFieldDefinitionSchema,
|
|
606
612
|
datetimeFieldDefinitionSchema,
|
|
@@ -608,7 +614,7 @@ var stringFieldDefinitionSchema = z7.union([
|
|
|
608
614
|
]);
|
|
609
615
|
var NumberFieldDefinitionBaseSchema = FieldDefinitionBaseSchema.extend(
|
|
610
616
|
{
|
|
611
|
-
valueType: z7.literal(ValueTypeSchema.
|
|
617
|
+
valueType: z7.literal(ValueTypeSchema.enum.number),
|
|
612
618
|
min: z7.number().nullable(),
|
|
613
619
|
max: z7.number().nullable(),
|
|
614
620
|
isUnique: z7.literal(false),
|
|
@@ -616,10 +622,10 @@ var NumberFieldDefinitionBaseSchema = FieldDefinitionBaseSchema.extend(
|
|
|
616
622
|
}
|
|
617
623
|
);
|
|
618
624
|
var numberFieldDefinitionSchema = NumberFieldDefinitionBaseSchema.extend({
|
|
619
|
-
fieldType: z7.literal(FieldTypeSchema.
|
|
625
|
+
fieldType: z7.literal(FieldTypeSchema.enum.number)
|
|
620
626
|
});
|
|
621
627
|
var rangeFieldDefinitionSchema = NumberFieldDefinitionBaseSchema.extend({
|
|
622
|
-
fieldType: z7.literal(FieldTypeSchema.
|
|
628
|
+
fieldType: z7.literal(FieldTypeSchema.enum.range),
|
|
623
629
|
// Overwrite from nullable to required because a range needs min, max and default to work and is required, since it always returns a number
|
|
624
630
|
isRequired: z7.literal(true),
|
|
625
631
|
min: z7.number(),
|
|
@@ -627,25 +633,25 @@ var rangeFieldDefinitionSchema = NumberFieldDefinitionBaseSchema.extend({
|
|
|
627
633
|
defaultValue: z7.number()
|
|
628
634
|
});
|
|
629
635
|
var BooleanFieldDefinitionBaseSchema = FieldDefinitionBaseSchema.extend({
|
|
630
|
-
valueType: z7.literal(ValueTypeSchema.
|
|
636
|
+
valueType: z7.literal(ValueTypeSchema.enum.boolean),
|
|
631
637
|
// Overwrite from nullable to required because a boolean needs a default to work and is required, since it always is either true or false
|
|
632
638
|
isRequired: z7.literal(true),
|
|
633
639
|
defaultValue: z7.boolean(),
|
|
634
640
|
isUnique: z7.literal(false)
|
|
635
641
|
});
|
|
636
642
|
var toggleFieldDefinitionSchema = BooleanFieldDefinitionBaseSchema.extend({
|
|
637
|
-
fieldType: z7.literal(FieldTypeSchema.
|
|
643
|
+
fieldType: z7.literal(FieldTypeSchema.enum.toggle)
|
|
638
644
|
});
|
|
639
645
|
var ReferenceFieldDefinitionBaseSchema = FieldDefinitionBaseSchema.extend({
|
|
640
|
-
valueType: z7.literal(ValueTypeSchema.
|
|
646
|
+
valueType: z7.literal(ValueTypeSchema.enum.reference)
|
|
641
647
|
});
|
|
642
648
|
var assetFieldDefinitionSchema = ReferenceFieldDefinitionBaseSchema.extend({
|
|
643
|
-
fieldType: z7.literal(FieldTypeSchema.
|
|
649
|
+
fieldType: z7.literal(FieldTypeSchema.enum.asset),
|
|
644
650
|
min: z7.number().nullable(),
|
|
645
651
|
max: z7.number().nullable()
|
|
646
652
|
});
|
|
647
653
|
var entryFieldDefinitionSchema = ReferenceFieldDefinitionBaseSchema.extend({
|
|
648
|
-
fieldType: z7.literal(FieldTypeSchema.
|
|
654
|
+
fieldType: z7.literal(FieldTypeSchema.enum.entry),
|
|
649
655
|
ofCollections: z7.array(uuidSchema),
|
|
650
656
|
min: z7.number().nullable(),
|
|
651
657
|
max: z7.number().nullable()
|
|
@@ -661,13 +667,13 @@ var fieldDefinitionSchema = z7.union([
|
|
|
661
667
|
]);
|
|
662
668
|
function getValueContentSchemaFromFieldDefinition(fieldDefinition) {
|
|
663
669
|
switch (fieldDefinition.valueType) {
|
|
664
|
-
case ValueTypeSchema.
|
|
670
|
+
case ValueTypeSchema.enum.boolean:
|
|
665
671
|
return getBooleanValueContentSchema();
|
|
666
|
-
case ValueTypeSchema.
|
|
672
|
+
case ValueTypeSchema.enum.number:
|
|
667
673
|
return getNumberValueContentSchema(fieldDefinition);
|
|
668
|
-
case ValueTypeSchema.
|
|
674
|
+
case ValueTypeSchema.enum.string:
|
|
669
675
|
return getStringValueContentSchema(fieldDefinition);
|
|
670
|
-
case ValueTypeSchema.
|
|
676
|
+
case ValueTypeSchema.enum.reference:
|
|
671
677
|
return getReferenceValueContentSchema(fieldDefinition);
|
|
672
678
|
default:
|
|
673
679
|
throw new Error(
|
|
@@ -693,35 +699,40 @@ function getNumberValueContentSchema(definition) {
|
|
|
693
699
|
return schema;
|
|
694
700
|
}
|
|
695
701
|
function getStringValueContentSchema(definition) {
|
|
696
|
-
let schema =
|
|
697
|
-
if ("min" in definition && definition.min) {
|
|
698
|
-
schema = schema.min(definition.min);
|
|
699
|
-
}
|
|
700
|
-
if ("max" in definition && definition.max) {
|
|
701
|
-
schema = schema.max(definition.max);
|
|
702
|
-
}
|
|
702
|
+
let schema = null;
|
|
703
703
|
switch (definition.fieldType) {
|
|
704
|
-
case FieldTypeSchema.
|
|
705
|
-
schema =
|
|
704
|
+
case FieldTypeSchema.enum.email:
|
|
705
|
+
schema = z7.email();
|
|
706
|
+
break;
|
|
707
|
+
case FieldTypeSchema.enum.url:
|
|
708
|
+
schema = z7.url();
|
|
706
709
|
break;
|
|
707
|
-
case FieldTypeSchema.
|
|
708
|
-
schema =
|
|
710
|
+
case FieldTypeSchema.enum.ipv4:
|
|
711
|
+
schema = z7.ipv4();
|
|
709
712
|
break;
|
|
710
|
-
case FieldTypeSchema.
|
|
711
|
-
schema =
|
|
713
|
+
case FieldTypeSchema.enum.date:
|
|
714
|
+
schema = z7.iso.date();
|
|
712
715
|
break;
|
|
713
|
-
case FieldTypeSchema.
|
|
714
|
-
schema =
|
|
716
|
+
case FieldTypeSchema.enum.time:
|
|
717
|
+
schema = z7.iso.time();
|
|
715
718
|
break;
|
|
716
|
-
case FieldTypeSchema.
|
|
717
|
-
schema =
|
|
719
|
+
case FieldTypeSchema.enum.datetime:
|
|
720
|
+
schema = z7.iso.datetime();
|
|
718
721
|
break;
|
|
719
|
-
case FieldTypeSchema.
|
|
720
|
-
schema =
|
|
722
|
+
case FieldTypeSchema.enum.telephone:
|
|
723
|
+
schema = z7.e164();
|
|
721
724
|
break;
|
|
722
|
-
case FieldTypeSchema.
|
|
725
|
+
case FieldTypeSchema.enum.text:
|
|
726
|
+
case FieldTypeSchema.enum.textarea:
|
|
727
|
+
schema = z7.string().trim();
|
|
723
728
|
break;
|
|
724
729
|
}
|
|
730
|
+
if ("min" in definition && definition.min) {
|
|
731
|
+
schema = schema.min(definition.min);
|
|
732
|
+
}
|
|
733
|
+
if ("max" in definition && definition.max) {
|
|
734
|
+
schema = schema.max(definition.max);
|
|
735
|
+
}
|
|
725
736
|
if (definition.isRequired === false) {
|
|
726
737
|
return schema.nullable();
|
|
727
738
|
}
|
|
@@ -730,12 +741,12 @@ function getStringValueContentSchema(definition) {
|
|
|
730
741
|
function getReferenceValueContentSchema(definition) {
|
|
731
742
|
let schema;
|
|
732
743
|
switch (definition.fieldType) {
|
|
733
|
-
case FieldTypeSchema.
|
|
744
|
+
case FieldTypeSchema.enum.asset:
|
|
734
745
|
{
|
|
735
746
|
schema = z7.array(valueContentReferenceToAssetSchema);
|
|
736
747
|
}
|
|
737
748
|
break;
|
|
738
|
-
case FieldTypeSchema.
|
|
749
|
+
case FieldTypeSchema.enum.entry:
|
|
739
750
|
{
|
|
740
751
|
schema = z7.array(valueContentReferenceToEntrySchema);
|
|
741
752
|
}
|
|
@@ -755,7 +766,7 @@ function getReferenceValueContentSchema(definition) {
|
|
|
755
766
|
|
|
756
767
|
// src/schema/collectionSchema.ts
|
|
757
768
|
var collectionFileSchema = baseFileSchema.extend({
|
|
758
|
-
objectType: z8.literal(objectTypeSchema.
|
|
769
|
+
objectType: z8.literal(objectTypeSchema.enum.collection).readonly(),
|
|
759
770
|
name: z8.object({
|
|
760
771
|
singular: translatableStringSchema,
|
|
761
772
|
plural: translatableStringSchema
|
|
@@ -850,7 +861,7 @@ var projectFolderSchema = z10.enum([
|
|
|
850
861
|
]);
|
|
851
862
|
var projectBranchSchema = z10.enum(["production", "work"]);
|
|
852
863
|
var projectFileSchema = baseFileSchema.extend({
|
|
853
|
-
objectType: z10.literal(objectTypeSchema.
|
|
864
|
+
objectType: z10.literal(objectTypeSchema.enum.project).readonly(),
|
|
854
865
|
coreVersion: versionSchema,
|
|
855
866
|
name: z10.string().trim().min(1, "shared.projectNameRequired"),
|
|
856
867
|
description: z10.string().trim().min(1, "shared.projectDescriptionRequired"),
|
|
@@ -918,7 +929,10 @@ var projectUpgradeSchema = z10.object({
|
|
|
918
929
|
/**
|
|
919
930
|
* Function that will be executed in the process of upgrading a Project
|
|
920
931
|
*/
|
|
921
|
-
run: z10.function(
|
|
932
|
+
run: z10.function({
|
|
933
|
+
input: [projectFileSchema],
|
|
934
|
+
output: z10.promise(z10.void())
|
|
935
|
+
})
|
|
922
936
|
});
|
|
923
937
|
var cloneProjectSchema = z10.object({
|
|
924
938
|
url: z10.string()
|
|
@@ -1011,10 +1025,10 @@ var baseUserSchema = gitSignatureSchema.extend({
|
|
|
1011
1025
|
})
|
|
1012
1026
|
});
|
|
1013
1027
|
var localUserSchema = baseUserSchema.extend({
|
|
1014
|
-
userType: z12.literal(UserTypeSchema.
|
|
1028
|
+
userType: z12.literal(UserTypeSchema.enum.local)
|
|
1015
1029
|
});
|
|
1016
1030
|
var cloudUserSchema = baseUserSchema.extend({
|
|
1017
|
-
userType: z12.literal(UserTypeSchema.
|
|
1031
|
+
userType: z12.literal(UserTypeSchema.enum.cloud),
|
|
1018
1032
|
id: uuidSchema
|
|
1019
1033
|
});
|
|
1020
1034
|
var userFileSchema = z12.union([localUserSchema, cloudUserSchema]);
|
|
@@ -1730,18 +1744,18 @@ var pathTo = {
|
|
|
1730
1744
|
return Path.join(pathTo.project(projectId), "project.json");
|
|
1731
1745
|
},
|
|
1732
1746
|
// projectLogs: (projectId: string): string => {
|
|
1733
|
-
// return Path.join(pathTo.project(projectId), projectFolderSchema.
|
|
1747
|
+
// return Path.join(pathTo.project(projectId), projectFolderSchema.enum.logs);
|
|
1734
1748
|
// },
|
|
1735
1749
|
// public: (projectId: string): string => {
|
|
1736
1750
|
// return Path.join(pathTo.project(projectId), 'public');
|
|
1737
1751
|
// },
|
|
1738
1752
|
lfs: (projectId) => {
|
|
1739
|
-
return Path.join(pathTo.project(projectId), projectFolderSchema.
|
|
1753
|
+
return Path.join(pathTo.project(projectId), projectFolderSchema.enum.lfs);
|
|
1740
1754
|
},
|
|
1741
1755
|
collections: (projectId) => {
|
|
1742
1756
|
return Path.join(
|
|
1743
1757
|
pathTo.project(projectId),
|
|
1744
|
-
projectFolderSchema.
|
|
1758
|
+
projectFolderSchema.enum.collections
|
|
1745
1759
|
);
|
|
1746
1760
|
},
|
|
1747
1761
|
collection: (projectId, id) => {
|
|
@@ -1765,7 +1779,7 @@ var pathTo = {
|
|
|
1765
1779
|
assets: (projectId) => {
|
|
1766
1780
|
return Path.join(
|
|
1767
1781
|
pathTo.project(projectId),
|
|
1768
|
-
projectFolderSchema.
|
|
1782
|
+
projectFolderSchema.enum.assets
|
|
1769
1783
|
);
|
|
1770
1784
|
},
|
|
1771
1785
|
assetFile: (projectId, id) => {
|
|
@@ -1849,20 +1863,20 @@ var AbstractCrudService = class {
|
|
|
1849
1863
|
*/
|
|
1850
1864
|
async listReferences(type, projectId, collectionId) {
|
|
1851
1865
|
switch (type) {
|
|
1852
|
-
case objectTypeSchema.
|
|
1866
|
+
case objectTypeSchema.enum.asset:
|
|
1853
1867
|
if (!projectId) {
|
|
1854
1868
|
throw new RequiredParameterMissingError("projectId");
|
|
1855
1869
|
}
|
|
1856
1870
|
return this.getFileReferences(pathTo.lfs(projectId));
|
|
1857
1871
|
// LFS folder is correct, since we want the extension of the file itself, not the AssetFile (.json)
|
|
1858
|
-
case objectTypeSchema.
|
|
1872
|
+
case objectTypeSchema.enum.project:
|
|
1859
1873
|
return this.getFolderReferences(pathTo.projects);
|
|
1860
|
-
case objectTypeSchema.
|
|
1874
|
+
case objectTypeSchema.enum.collection:
|
|
1861
1875
|
if (!projectId) {
|
|
1862
1876
|
throw new RequiredParameterMissingError("projectId");
|
|
1863
1877
|
}
|
|
1864
1878
|
return this.getFolderReferences(pathTo.collections(projectId));
|
|
1865
|
-
case objectTypeSchema.
|
|
1879
|
+
case objectTypeSchema.enum.entry:
|
|
1866
1880
|
if (!projectId) {
|
|
1867
1881
|
throw new RequiredParameterMissingError("projectId");
|
|
1868
1882
|
}
|
|
@@ -1872,7 +1886,7 @@ var AbstractCrudService = class {
|
|
|
1872
1886
|
return this.getFileReferences(
|
|
1873
1887
|
pathTo.collection(projectId, collectionId)
|
|
1874
1888
|
);
|
|
1875
|
-
case objectTypeSchema.
|
|
1889
|
+
case objectTypeSchema.enum.sharedValue:
|
|
1876
1890
|
if (!projectId) {
|
|
1877
1891
|
throw new RequiredParameterMissingError("projectId");
|
|
1878
1892
|
}
|
|
@@ -1952,7 +1966,7 @@ var AssetService = class extends AbstractCrudService {
|
|
|
1952
1966
|
jsonFileService;
|
|
1953
1967
|
gitService;
|
|
1954
1968
|
constructor(options, logService, jsonFileService, gitService) {
|
|
1955
|
-
super(serviceTypeSchema.
|
|
1969
|
+
super(serviceTypeSchema.enum.Asset, options);
|
|
1956
1970
|
this.logService = logService;
|
|
1957
1971
|
this.jsonFileService = jsonFileService;
|
|
1958
1972
|
this.gitService = gitService;
|
|
@@ -2111,7 +2125,7 @@ var AssetService = class extends AbstractCrudService {
|
|
|
2111
2125
|
const offset = props.offset || 0;
|
|
2112
2126
|
const limit = props.limit || 15;
|
|
2113
2127
|
const assetReferences = await this.listReferences(
|
|
2114
|
-
objectTypeSchema.
|
|
2128
|
+
objectTypeSchema.enum.asset,
|
|
2115
2129
|
props.projectId
|
|
2116
2130
|
);
|
|
2117
2131
|
const partialAssetReferences = assetReferences.slice(offset, limit);
|
|
@@ -2132,7 +2146,7 @@ var AssetService = class extends AbstractCrudService {
|
|
|
2132
2146
|
}
|
|
2133
2147
|
async count(props) {
|
|
2134
2148
|
countAssetsSchema.parse(props);
|
|
2135
|
-
const count = (await this.listReferences(objectTypeSchema.
|
|
2149
|
+
const count = (await this.listReferences(objectTypeSchema.enum.asset, props.projectId)).length;
|
|
2136
2150
|
return count;
|
|
2137
2151
|
}
|
|
2138
2152
|
/**
|
|
@@ -2203,7 +2217,7 @@ var CollectionService = class extends AbstractCrudService {
|
|
|
2203
2217
|
jsonFileService;
|
|
2204
2218
|
gitService;
|
|
2205
2219
|
constructor(options, jsonFileService, gitService) {
|
|
2206
|
-
super(serviceTypeSchema.
|
|
2220
|
+
super(serviceTypeSchema.enum.Collection, options);
|
|
2207
2221
|
this.jsonFileService = jsonFileService;
|
|
2208
2222
|
this.gitService = gitService;
|
|
2209
2223
|
}
|
|
@@ -2319,7 +2333,7 @@ var CollectionService = class extends AbstractCrudService {
|
|
|
2319
2333
|
const offset = props.offset || 0;
|
|
2320
2334
|
const limit = props.limit || 15;
|
|
2321
2335
|
const collectionReferences = await this.listReferences(
|
|
2322
|
-
objectTypeSchema.
|
|
2336
|
+
objectTypeSchema.enum.collection,
|
|
2323
2337
|
props.projectId
|
|
2324
2338
|
);
|
|
2325
2339
|
const partialCollectionReferences = collectionReferences.slice(
|
|
@@ -2344,7 +2358,7 @@ var CollectionService = class extends AbstractCrudService {
|
|
|
2344
2358
|
async count(props) {
|
|
2345
2359
|
countCollectionsSchema.parse(props);
|
|
2346
2360
|
const count = (await this.listReferences(
|
|
2347
|
-
objectTypeSchema.
|
|
2361
|
+
objectTypeSchema.enum.collection,
|
|
2348
2362
|
props.projectId
|
|
2349
2363
|
)).length;
|
|
2350
2364
|
return count;
|
|
@@ -2388,7 +2402,7 @@ var EntryService = class extends AbstractCrudService {
|
|
|
2388
2402
|
collectionService;
|
|
2389
2403
|
// private sharedValueService: SharedValueService;
|
|
2390
2404
|
constructor(options, logService, jsonFileService, gitService, collectionService) {
|
|
2391
|
-
super(serviceTypeSchema.
|
|
2405
|
+
super(serviceTypeSchema.enum.Entry, options);
|
|
2392
2406
|
this.logService = logService;
|
|
2393
2407
|
this.jsonFileService = jsonFileService;
|
|
2394
2408
|
this.gitService = gitService;
|
|
@@ -2547,7 +2561,7 @@ var EntryService = class extends AbstractCrudService {
|
|
|
2547
2561
|
const offset = props.offset || 0;
|
|
2548
2562
|
const limit = props.limit || 15;
|
|
2549
2563
|
const entryReferences = await this.listReferences(
|
|
2550
|
-
objectTypeSchema.
|
|
2564
|
+
objectTypeSchema.enum.entry,
|
|
2551
2565
|
props.projectId,
|
|
2552
2566
|
props.collectionId
|
|
2553
2567
|
);
|
|
@@ -2571,7 +2585,7 @@ var EntryService = class extends AbstractCrudService {
|
|
|
2571
2585
|
async count(props) {
|
|
2572
2586
|
countEntriesSchema.parse(props);
|
|
2573
2587
|
return (await this.listReferences(
|
|
2574
|
-
objectTypeSchema.
|
|
2588
|
+
objectTypeSchema.enum.entry,
|
|
2575
2589
|
props.projectId,
|
|
2576
2590
|
props.collectionId
|
|
2577
2591
|
)).length;
|
|
@@ -2652,7 +2666,7 @@ import Path2 from "path";
|
|
|
2652
2666
|
var GitTagService = class extends AbstractCrudService {
|
|
2653
2667
|
git;
|
|
2654
2668
|
constructor(options, git) {
|
|
2655
|
-
super(serviceTypeSchema.
|
|
2669
|
+
super(serviceTypeSchema.enum.GitTag, options);
|
|
2656
2670
|
this.git = git;
|
|
2657
2671
|
}
|
|
2658
2672
|
/**
|
|
@@ -3324,7 +3338,7 @@ var JsonFileService = class extends AbstractCrudService {
|
|
|
3324
3338
|
cache = /* @__PURE__ */ new Map();
|
|
3325
3339
|
logService;
|
|
3326
3340
|
constructor(options, logService) {
|
|
3327
|
-
super(serviceTypeSchema.
|
|
3341
|
+
super(serviceTypeSchema.enum.JsonFile, options);
|
|
3328
3342
|
this.logService = logService;
|
|
3329
3343
|
}
|
|
3330
3344
|
/**
|
|
@@ -3517,7 +3531,7 @@ var ProjectService = class extends AbstractCrudService {
|
|
|
3517
3531
|
collectionService;
|
|
3518
3532
|
entryService;
|
|
3519
3533
|
constructor(coreVersion, options, logService, jsonFileService, userService, gitService, assetService, collectionService, entryService) {
|
|
3520
|
-
super(serviceTypeSchema.
|
|
3534
|
+
super(serviceTypeSchema.enum.Project, options);
|
|
3521
3535
|
this.coreVersion = coreVersion;
|
|
3522
3536
|
this.logService = logService;
|
|
3523
3537
|
this.jsonFileService = jsonFileService;
|
|
@@ -3561,7 +3575,7 @@ var ProjectService = class extends AbstractCrudService {
|
|
|
3561
3575
|
await this.createFolderStructure(projectPath);
|
|
3562
3576
|
await this.createGitignore(projectPath);
|
|
3563
3577
|
await this.gitService.init(projectPath, {
|
|
3564
|
-
initialBranch: projectBranchSchema.
|
|
3578
|
+
initialBranch: projectBranchSchema.enum.production
|
|
3565
3579
|
});
|
|
3566
3580
|
await this.jsonFileService.create(
|
|
3567
3581
|
projectFile,
|
|
@@ -3575,7 +3589,7 @@ var ProjectService = class extends AbstractCrudService {
|
|
|
3575
3589
|
});
|
|
3576
3590
|
await this.gitService.branches.switch(
|
|
3577
3591
|
projectPath,
|
|
3578
|
-
projectBranchSchema.
|
|
3592
|
+
projectBranchSchema.enum.work,
|
|
3579
3593
|
{
|
|
3580
3594
|
isNew: true
|
|
3581
3595
|
}
|
|
@@ -3677,10 +3691,10 @@ var ProjectService = class extends AbstractCrudService {
|
|
|
3677
3691
|
const projectPath = pathTo.project(props.id);
|
|
3678
3692
|
const projectFilePath = pathTo.projectFile(props.id);
|
|
3679
3693
|
const currentBranch = await this.gitService.branches.current(projectPath);
|
|
3680
|
-
if (currentBranch !== projectBranchSchema.
|
|
3694
|
+
if (currentBranch !== projectBranchSchema.enum.work) {
|
|
3681
3695
|
await this.gitService.branches.switch(
|
|
3682
3696
|
projectPath,
|
|
3683
|
-
projectBranchSchema.
|
|
3697
|
+
projectBranchSchema.enum.work
|
|
3684
3698
|
);
|
|
3685
3699
|
}
|
|
3686
3700
|
const currentProjectFile = outdatedProjectSchema.passthrough().parse(await this.jsonFileService.unsafeRead(projectFilePath));
|
|
@@ -3740,7 +3754,7 @@ var ProjectService = class extends AbstractCrudService {
|
|
|
3740
3754
|
await this.update(migratedProjectFile);
|
|
3741
3755
|
await this.gitService.branches.switch(
|
|
3742
3756
|
projectPath,
|
|
3743
|
-
projectBranchSchema.
|
|
3757
|
+
projectBranchSchema.enum.work
|
|
3744
3758
|
);
|
|
3745
3759
|
await this.gitService.merge(projectPath, upgradeBranchName, {
|
|
3746
3760
|
squash: true
|
|
@@ -3768,7 +3782,7 @@ var ProjectService = class extends AbstractCrudService {
|
|
|
3768
3782
|
} catch (error) {
|
|
3769
3783
|
await this.gitService.branches.switch(
|
|
3770
3784
|
projectPath,
|
|
3771
|
-
projectBranchSchema.
|
|
3785
|
+
projectBranchSchema.enum.work
|
|
3772
3786
|
);
|
|
3773
3787
|
await this.gitService.branches.delete(
|
|
3774
3788
|
projectPath,
|
|
@@ -3887,7 +3901,7 @@ var ProjectService = class extends AbstractCrudService {
|
|
|
3887
3901
|
*/
|
|
3888
3902
|
async listOutdated() {
|
|
3889
3903
|
const projectReferences = await this.listReferences(
|
|
3890
|
-
objectTypeSchema.
|
|
3904
|
+
objectTypeSchema.enum.project
|
|
3891
3905
|
);
|
|
3892
3906
|
const result = await Promise.all(
|
|
3893
3907
|
projectReferences.map(async (reference) => {
|
|
@@ -3910,7 +3924,7 @@ var ProjectService = class extends AbstractCrudService {
|
|
|
3910
3924
|
const offset = props?.offset || 0;
|
|
3911
3925
|
const limit = props?.limit || 15;
|
|
3912
3926
|
const projectReferences = await this.listReferences(
|
|
3913
|
-
objectTypeSchema.
|
|
3927
|
+
objectTypeSchema.enum.project
|
|
3914
3928
|
);
|
|
3915
3929
|
const partialProjectReferences = projectReferences.slice(offset, limit);
|
|
3916
3930
|
const projects = await returnResolved(
|
|
@@ -3926,7 +3940,7 @@ var ProjectService = class extends AbstractCrudService {
|
|
|
3926
3940
|
};
|
|
3927
3941
|
}
|
|
3928
3942
|
async count() {
|
|
3929
|
-
return (await this.listReferences(objectTypeSchema.
|
|
3943
|
+
return (await this.listReferences(objectTypeSchema.enum.project)).length;
|
|
3930
3944
|
}
|
|
3931
3945
|
/**
|
|
3932
3946
|
* Checks if given object is of type Project
|
|
@@ -3999,7 +4013,7 @@ var ProjectService = class extends AbstractCrudService {
|
|
|
3999
4013
|
* committed
|
|
4000
4014
|
*/
|
|
4001
4015
|
async createFolderStructure(path) {
|
|
4002
|
-
const folders2 = Object.values(projectFolderSchema.
|
|
4016
|
+
const folders2 = Object.values(projectFolderSchema.enum);
|
|
4003
4017
|
await Promise.all(
|
|
4004
4018
|
folders2.map(async (folder) => {
|
|
4005
4019
|
await Fs6.mkdirp(Path4.join(path, folder));
|
|
@@ -4023,9 +4037,9 @@ var ProjectService = class extends AbstractCrudService {
|
|
|
4023
4037
|
"!/**/.gitkeep",
|
|
4024
4038
|
"",
|
|
4025
4039
|
"# elek.io related ignores"
|
|
4026
|
-
// projectFolderSchema.
|
|
4027
|
-
// projectFolderSchema.
|
|
4028
|
-
// projectFolderSchema.
|
|
4040
|
+
// projectFolderSchema.enum.theme + '/',
|
|
4041
|
+
// projectFolderSchema.enum.public + '/',
|
|
4042
|
+
// projectFolderSchema.enum.logs + '/',
|
|
4029
4043
|
];
|
|
4030
4044
|
await Fs6.writeFile(Path4.join(path, ".gitignore"), lines.join(Os2.EOL));
|
|
4031
4045
|
}
|
|
@@ -4125,7 +4139,7 @@ var UserService = class {
|
|
|
4125
4139
|
const userFile = {
|
|
4126
4140
|
...props
|
|
4127
4141
|
};
|
|
4128
|
-
if (userFile.userType === UserTypeSchema.
|
|
4142
|
+
if (userFile.userType === UserTypeSchema.enum.cloud) {
|
|
4129
4143
|
}
|
|
4130
4144
|
await this.jsonFileService.update(userFile, userFilePath, userFileSchema);
|
|
4131
4145
|
this.logService.debug("Updated User");
|
|
@@ -4331,7 +4345,7 @@ export {
|
|
|
4331
4345
|
gitSignatureSchema,
|
|
4332
4346
|
gitSwitchOptionsSchema,
|
|
4333
4347
|
gitTagSchema,
|
|
4334
|
-
|
|
4348
|
+
ipv4FieldDefinitionSchema,
|
|
4335
4349
|
listAssetsSchema,
|
|
4336
4350
|
listBranchesProjectSchema,
|
|
4337
4351
|
listCollectionsSchema,
|