@elek-io/core 0.14.4 → 0.15.1

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.
@@ -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.4",
13
+ version: "0.15.1",
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",
@@ -37,7 +37,10 @@ var package_default = {
37
37
  }
38
38
  },
39
39
  scripts: {
40
- lint: "tsc",
40
+ lint: "eslint",
41
+ "check-types": "tsc --noEmit",
42
+ "check-format": "prettier --check . || exit 0",
43
+ format: "prettier --write .",
41
44
  dev: "vitest",
42
45
  test: "vitest run",
43
46
  coverage: "vitest run --coverage",
@@ -45,32 +48,38 @@ var package_default = {
45
48
  release: "changeset publish"
46
49
  },
47
50
  dependencies: {
48
- "@hono/node-server": "1.18.1",
51
+ "@hono/node-server": "1.19.5",
49
52
  "@hono/swagger-ui": "0.5.2",
50
- "@hono/zod-openapi": "1.1.0",
51
- "@sindresorhus/slugify": "2.2.1",
52
- "fs-extra": "11.3.1",
53
- hono: "4.9.0",
54
- mime: "4.0.7",
55
- "p-queue": "8.1.0",
53
+ "@hono/zod-openapi": "1.1.3",
54
+ "@sindresorhus/slugify": "3.0.0",
55
+ "fs-extra": "11.3.2",
56
+ hono: "4.9.9",
57
+ mime: "4.1.0",
58
+ "p-queue": "8.1.1",
56
59
  semver: "7.7.2",
57
- uuid: "11.1.0",
58
- winston: "3.17.0",
60
+ uuid: "13.0.0",
61
+ winston: "3.18.2",
59
62
  "winston-daily-rotate-file": "5.0.0",
60
- zod: "4.0.17"
63
+ zod: "4.1.11"
61
64
  },
62
65
  devDependencies: {
63
- "@changesets/cli": "2.29.5",
64
- "@faker-js/faker": "9.9.0",
66
+ "@changesets/cli": "2.29.7",
67
+ "@eslint/js": "9.36.0",
68
+ "@faker-js/faker": "10.0.0",
65
69
  "@tsconfig/node22": "22.0.2",
66
- "@tsconfig/strictest": "2.0.5",
70
+ "@tsconfig/strictest": "2.0.6",
67
71
  "@types/fs-extra": "11.0.4",
68
- "@types/node": "22.16.0",
69
- "@types/semver": "7.7.0",
70
- "@types/uuid": "10.0.0",
72
+ "@types/node": "22.13.14",
73
+ "@types/semver": "7.7.1",
71
74
  "@vitest/coverage-v8": "3.2.4",
75
+ eslint: "9.36.0",
76
+ "eslint-config-prettier": "10.1.8",
77
+ globals: "16.4.0",
78
+ jiti: "2.6.0",
79
+ prettier: "3.6.2",
72
80
  tsup: "8.5.0",
73
81
  typescript: "5.9.2",
82
+ "typescript-eslint": "8.45.0",
74
83
  vitest: "3.2.4"
75
84
  },
76
85
  peerDependencies: {
@@ -110,13 +119,13 @@ var LoggerMiddleware = class {
110
119
  };
111
120
 
112
121
  // src/api/v1/asset.ts
113
- import { createRoute, OpenAPIHono, z as z13 } from "@hono/zod-openapi";
122
+ import { createRoute, OpenAPIHono, z as z14 } from "@hono/zod-openapi";
114
123
 
115
124
  // src/schema/assetSchema.ts
116
125
  import { z as z4 } from "@hono/zod-openapi";
117
126
 
118
127
  // src/schema/baseSchema.ts
119
- import z from "zod";
128
+ import { z } from "@hono/zod-openapi";
120
129
  var supportedLanguageSchema = z.enum([
121
130
  /**
122
131
  * Bulgarian
@@ -203,7 +212,7 @@ function translatableArrayOf(schema) {
203
212
  }
204
213
 
205
214
  // src/schema/fileSchema.ts
206
- import z2 from "zod";
215
+ import { z as z2 } from "@hono/zod-openapi";
207
216
  var baseFileSchema = z2.object({
208
217
  /**
209
218
  * The object type of the file
@@ -230,7 +239,7 @@ var fileReferenceSchema = z2.object({
230
239
  });
231
240
 
232
241
  // src/schema/gitSchema.ts
233
- import { z as z3 } from "zod";
242
+ import { z as z3 } from "@hono/zod-openapi";
234
243
  var gitSignatureSchema = z3.object({
235
244
  name: z3.string(),
236
245
  email: z3.string().email()
@@ -419,7 +428,7 @@ import { z as z8 } from "@hono/zod-openapi";
419
428
  import { z as z6 } from "@hono/zod-openapi";
420
429
 
421
430
  // src/schema/valueSchema.ts
422
- import z5 from "zod";
431
+ import { z as z5 } from "@hono/zod-openapi";
423
432
  var ValueTypeSchema = z5.enum([
424
433
  "string",
425
434
  "number",
@@ -516,7 +525,7 @@ var countEntriesSchema = z6.object({
516
525
  });
517
526
 
518
527
  // src/schema/fieldSchema.ts
519
- import { z as z7 } from "zod";
528
+ import { z as z7 } from "@hono/zod-openapi";
520
529
  var FieldTypeSchema = z7.enum([
521
530
  // String Values
522
531
  "text",
@@ -543,7 +552,7 @@ var FieldWidthSchema = z7.enum(["12", "6", "4", "3"]);
543
552
  var FieldDefinitionBaseSchema = z7.object({
544
553
  id: uuidSchema.readonly(),
545
554
  label: translatableStringSchema,
546
- description: translatableStringSchema,
555
+ description: translatableStringSchema.nullable(),
547
556
  isRequired: z7.boolean(),
548
557
  isDisabled: z7.boolean(),
549
558
  isUnique: z7.boolean(),
@@ -665,104 +674,6 @@ var fieldDefinitionSchema = z7.union([
665
674
  entryFieldDefinitionSchema
666
675
  // sharedValueDefinitionSchema,
667
676
  ]);
668
- function getValueContentSchemaFromFieldDefinition(fieldDefinition) {
669
- switch (fieldDefinition.valueType) {
670
- case ValueTypeSchema.enum.boolean:
671
- return getBooleanValueContentSchema();
672
- case ValueTypeSchema.enum.number:
673
- return getNumberValueContentSchema(fieldDefinition);
674
- case ValueTypeSchema.enum.string:
675
- return getStringValueContentSchema(fieldDefinition);
676
- case ValueTypeSchema.enum.reference:
677
- return getReferenceValueContentSchema(fieldDefinition);
678
- default:
679
- throw new Error(
680
- // @ts-expect-error
681
- `Error generating schema for unsupported ValueType "${fieldDefinition.valueType}"`
682
- );
683
- }
684
- }
685
- function getBooleanValueContentSchema() {
686
- return z7.boolean();
687
- }
688
- function getNumberValueContentSchema(definition) {
689
- let schema = z7.number();
690
- if (definition.min) {
691
- schema = schema.min(definition.min);
692
- }
693
- if (definition.max) {
694
- schema = schema.max(definition.max);
695
- }
696
- if (definition.isRequired === false) {
697
- return schema.nullable();
698
- }
699
- return schema;
700
- }
701
- function getStringValueContentSchema(definition) {
702
- let schema = null;
703
- switch (definition.fieldType) {
704
- case FieldTypeSchema.enum.email:
705
- schema = z7.email();
706
- break;
707
- case FieldTypeSchema.enum.url:
708
- schema = z7.url();
709
- break;
710
- case FieldTypeSchema.enum.ipv4:
711
- schema = z7.ipv4();
712
- break;
713
- case FieldTypeSchema.enum.date:
714
- schema = z7.iso.date();
715
- break;
716
- case FieldTypeSchema.enum.time:
717
- schema = z7.iso.time();
718
- break;
719
- case FieldTypeSchema.enum.datetime:
720
- schema = z7.iso.datetime();
721
- break;
722
- case FieldTypeSchema.enum.telephone:
723
- schema = z7.e164();
724
- break;
725
- case FieldTypeSchema.enum.text:
726
- case FieldTypeSchema.enum.textarea:
727
- schema = z7.string().trim();
728
- break;
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
- }
736
- if (definition.isRequired === false) {
737
- return schema.nullable();
738
- }
739
- return schema.min(1, "shared.stringValueRequired");
740
- }
741
- function getReferenceValueContentSchema(definition) {
742
- let schema;
743
- switch (definition.fieldType) {
744
- case FieldTypeSchema.enum.asset:
745
- {
746
- schema = z7.array(valueContentReferenceToAssetSchema);
747
- }
748
- break;
749
- case FieldTypeSchema.enum.entry:
750
- {
751
- schema = z7.array(valueContentReferenceToEntrySchema);
752
- }
753
- break;
754
- }
755
- if (definition.isRequired) {
756
- schema = schema.min(1, "shared.referenceRequired");
757
- }
758
- if (definition.min) {
759
- schema = schema.min(definition.min);
760
- }
761
- if (definition.max) {
762
- schema = schema.max(definition.max);
763
- }
764
- return schema;
765
- }
766
677
 
767
678
  // src/schema/collectionSchema.ts
768
679
  var collectionFileSchema = baseFileSchema.extend({
@@ -817,7 +728,7 @@ var countCollectionsSchema = z8.object({
817
728
  });
818
729
 
819
730
  // src/schema/coreSchema.ts
820
- import { z as z9 } from "zod";
731
+ import { z as z9 } from "@hono/zod-openapi";
821
732
  var elekIoCoreOptionsSchema = z9.object({
822
733
  log: z9.object({
823
734
  /**
@@ -968,9 +879,172 @@ var searchProjectSchema = z10.object({
968
879
  type: z10.array(objectTypeSchema).optional()
969
880
  });
970
881
 
882
+ // src/schema/schemaFromFieldDefinition.ts
883
+ import { z as z11 } from "@hono/zod-openapi";
884
+ function getBooleanValueContentSchemaFromFieldDefinition() {
885
+ return z11.boolean();
886
+ }
887
+ function getNumberValueContentSchemaFromFieldDefinition(fieldDefinition) {
888
+ let schema = z11.number();
889
+ if (fieldDefinition.min) {
890
+ schema = schema.min(fieldDefinition.min);
891
+ }
892
+ if (fieldDefinition.max) {
893
+ schema = schema.max(fieldDefinition.max);
894
+ }
895
+ if (fieldDefinition.isRequired === false) {
896
+ return schema.nullable();
897
+ }
898
+ return schema;
899
+ }
900
+ function getStringValueContentSchemaFromFieldDefinition(fieldDefinition) {
901
+ let schema = null;
902
+ switch (fieldDefinition.fieldType) {
903
+ case FieldTypeSchema.enum.email:
904
+ schema = z11.email();
905
+ break;
906
+ case FieldTypeSchema.enum.url:
907
+ schema = z11.url();
908
+ break;
909
+ case FieldTypeSchema.enum.ipv4:
910
+ schema = z11.ipv4();
911
+ break;
912
+ case FieldTypeSchema.enum.date:
913
+ schema = z11.iso.date();
914
+ break;
915
+ case FieldTypeSchema.enum.time:
916
+ schema = z11.iso.time();
917
+ break;
918
+ case FieldTypeSchema.enum.datetime:
919
+ schema = z11.iso.datetime();
920
+ break;
921
+ case FieldTypeSchema.enum.telephone:
922
+ schema = z11.e164();
923
+ break;
924
+ case FieldTypeSchema.enum.text:
925
+ case FieldTypeSchema.enum.textarea:
926
+ schema = z11.string().trim();
927
+ break;
928
+ }
929
+ if ("min" in fieldDefinition && fieldDefinition.min) {
930
+ schema = schema.min(fieldDefinition.min);
931
+ }
932
+ if ("max" in fieldDefinition && fieldDefinition.max) {
933
+ schema = schema.max(fieldDefinition.max);
934
+ }
935
+ if (fieldDefinition.isRequired === false) {
936
+ return schema.nullable();
937
+ }
938
+ return schema.min(1, "shared.stringValueRequired");
939
+ }
940
+ function getReferenceValueContentSchemaFromFieldDefinition(fieldDefinition) {
941
+ let schema;
942
+ switch (fieldDefinition.fieldType) {
943
+ case FieldTypeSchema.enum.asset:
944
+ {
945
+ schema = z11.array(valueContentReferenceToAssetSchema);
946
+ }
947
+ break;
948
+ case FieldTypeSchema.enum.entry:
949
+ {
950
+ schema = z11.array(valueContentReferenceToEntrySchema);
951
+ }
952
+ break;
953
+ }
954
+ if (fieldDefinition.isRequired) {
955
+ schema = schema.min(1, "shared.referenceRequired");
956
+ }
957
+ if (fieldDefinition.min) {
958
+ schema = schema.min(fieldDefinition.min);
959
+ }
960
+ if (fieldDefinition.max) {
961
+ schema = schema.max(fieldDefinition.max);
962
+ }
963
+ return schema;
964
+ }
965
+ function getTranslatableStringValueContentSchemaFromFieldDefinition(fieldDefinition) {
966
+ return z11.partialRecord(
967
+ supportedLanguageSchema,
968
+ getStringValueContentSchemaFromFieldDefinition(fieldDefinition)
969
+ );
970
+ }
971
+ function getTranslatableNumberValueContentSchemaFromFieldDefinition(fieldDefinition) {
972
+ return z11.partialRecord(
973
+ supportedLanguageSchema,
974
+ getNumberValueContentSchemaFromFieldDefinition(fieldDefinition)
975
+ );
976
+ }
977
+ function getTranslatableBooleanValueContentSchemaFromFieldDefinition() {
978
+ return z11.partialRecord(
979
+ supportedLanguageSchema,
980
+ getBooleanValueContentSchemaFromFieldDefinition()
981
+ );
982
+ }
983
+ function getTranslatableReferenceValueContentSchemaFromFieldDefinition(fieldDefinition) {
984
+ return z11.partialRecord(
985
+ supportedLanguageSchema,
986
+ getReferenceValueContentSchemaFromFieldDefinition(fieldDefinition)
987
+ );
988
+ }
989
+ function getValueSchemaFromFieldDefinition(fieldDefinition) {
990
+ switch (fieldDefinition.valueType) {
991
+ case ValueTypeSchema.enum.boolean:
992
+ return directBooleanValueSchema.extend({
993
+ content: getTranslatableBooleanValueContentSchemaFromFieldDefinition()
994
+ });
995
+ case ValueTypeSchema.enum.number:
996
+ return directNumberValueSchema.extend({
997
+ content: getTranslatableNumberValueContentSchemaFromFieldDefinition(
998
+ fieldDefinition
999
+ )
1000
+ });
1001
+ case ValueTypeSchema.enum.string:
1002
+ return directStringValueSchema.extend({
1003
+ content: getTranslatableStringValueContentSchemaFromFieldDefinition(
1004
+ fieldDefinition
1005
+ )
1006
+ });
1007
+ case ValueTypeSchema.enum.reference:
1008
+ return referencedValueSchema.extend({
1009
+ content: getTranslatableReferenceValueContentSchemaFromFieldDefinition(
1010
+ fieldDefinition
1011
+ )
1012
+ });
1013
+ default:
1014
+ throw new Error(
1015
+ // @ts-expect-error Code cannot be reached, but if we add a new ValueType and forget to update this function, we want to be notified about it
1016
+ `Error generating schema for unsupported ValueType "${fieldDefinition.valueType}"`
1017
+ );
1018
+ }
1019
+ }
1020
+ function getCreateEntrySchemaFromFieldDefinitions(fieldDefinitions) {
1021
+ const valueSchemas = fieldDefinitions.map((fieldDefinition) => {
1022
+ return getValueSchemaFromFieldDefinition(fieldDefinition);
1023
+ });
1024
+ return z11.object({
1025
+ ...createEntrySchema.shape,
1026
+ values: z11.tuple(
1027
+ valueSchemas
1028
+ // At least one element is required in a tuple
1029
+ )
1030
+ });
1031
+ }
1032
+ function getUpdateEntrySchemaFromFieldDefinitions(fieldDefinitions) {
1033
+ const valueSchemas = fieldDefinitions.map((fieldDefinition) => {
1034
+ return getValueSchemaFromFieldDefinition(fieldDefinition);
1035
+ });
1036
+ return z11.object({
1037
+ ...updateEntrySchema.shape,
1038
+ values: z11.tuple(
1039
+ valueSchemas
1040
+ // At least one element is required in a tuple
1041
+ )
1042
+ });
1043
+ }
1044
+
971
1045
  // src/schema/serviceSchema.ts
972
- import { z as z11 } from "zod";
973
- var serviceTypeSchema = z11.enum([
1046
+ import { z as z12 } from "@hono/zod-openapi";
1047
+ var serviceTypeSchema = z12.enum([
974
1048
  "Git",
975
1049
  "GitTag",
976
1050
  "User",
@@ -983,17 +1057,17 @@ var serviceTypeSchema = z11.enum([
983
1057
  "Value"
984
1058
  ]);
985
1059
  function paginatedListOf(schema) {
986
- return z11.object({
987
- total: z11.number(),
988
- limit: z11.number(),
989
- offset: z11.number(),
990
- list: z11.array(schema)
1060
+ return z12.object({
1061
+ total: z12.number(),
1062
+ limit: z12.number(),
1063
+ offset: z12.number(),
1064
+ list: z12.array(schema)
991
1065
  });
992
1066
  }
993
- var listSchema = z11.object({
1067
+ var listSchema = z12.object({
994
1068
  projectId: uuidSchema,
995
- limit: z11.number().optional(),
996
- offset: z11.number().optional()
1069
+ limit: z12.number().optional(),
1070
+ offset: z12.number().optional()
997
1071
  });
998
1072
  var listCollectionsSchema = listSchema;
999
1073
  var listEntriesSchema = listSchema.extend({
@@ -1003,35 +1077,35 @@ var listAssetsSchema = listSchema;
1003
1077
  var listProjectsSchema = listSchema.omit({
1004
1078
  projectId: true
1005
1079
  });
1006
- var listGitTagsSchema = z11.object({
1007
- path: z11.string()
1080
+ var listGitTagsSchema = z12.object({
1081
+ path: z12.string()
1008
1082
  });
1009
1083
 
1010
1084
  // src/schema/userSchema.ts
1011
- import z12 from "zod";
1012
- var UserTypeSchema = z12.enum(["local", "cloud"]);
1085
+ import { z as z13 } from "@hono/zod-openapi";
1086
+ var UserTypeSchema = z13.enum(["local", "cloud"]);
1013
1087
  var baseUserSchema = gitSignatureSchema.extend({
1014
1088
  userType: UserTypeSchema,
1015
1089
  language: supportedLanguageSchema,
1016
- localApi: z12.object({
1090
+ localApi: z13.object({
1017
1091
  /**
1018
1092
  * If set to true the local API is started whenever Core is initialized
1019
1093
  */
1020
- isEnabled: z12.boolean(),
1094
+ isEnabled: z13.boolean(),
1021
1095
  /**
1022
1096
  * The port the local API uses
1023
1097
  */
1024
- port: z12.number()
1098
+ port: z13.number()
1025
1099
  })
1026
1100
  });
1027
1101
  var localUserSchema = baseUserSchema.extend({
1028
- userType: z12.literal(UserTypeSchema.enum.local)
1102
+ userType: z13.literal(UserTypeSchema.enum.local)
1029
1103
  });
1030
1104
  var cloudUserSchema = baseUserSchema.extend({
1031
- userType: z12.literal(UserTypeSchema.enum.cloud),
1105
+ userType: z13.literal(UserTypeSchema.enum.cloud),
1032
1106
  id: uuidSchema
1033
1107
  });
1034
- var userFileSchema = z12.union([localUserSchema, cloudUserSchema]);
1108
+ var userFileSchema = z13.union([localUserSchema, cloudUserSchema]);
1035
1109
  var userSchema = userFileSchema;
1036
1110
  var setUserSchema = userSchema;
1037
1111
 
@@ -1077,7 +1151,7 @@ var listAssetsRoute = createRoute({
1077
1151
  path: "/projects/{projectId}/assets",
1078
1152
  operationId: "listAssets",
1079
1153
  request: {
1080
- params: z13.object({
1154
+ params: z14.object({
1081
1155
  projectId: uuidSchema.openapi({
1082
1156
  param: {
1083
1157
  name: "projectId",
@@ -1085,12 +1159,12 @@ var listAssetsRoute = createRoute({
1085
1159
  }
1086
1160
  })
1087
1161
  }),
1088
- query: z13.object({
1089
- limit: z13.string().pipe(z13.coerce.number()).optional().openapi({
1162
+ query: z14.object({
1163
+ limit: z14.string().pipe(z14.coerce.number()).optional().openapi({
1090
1164
  default: "15",
1091
1165
  description: "The maximum number of items to return"
1092
1166
  }),
1093
- offset: z13.string().pipe(z13.coerce.number()).optional().openapi({
1167
+ offset: z14.string().pipe(z14.coerce.number()).optional().openapi({
1094
1168
  default: "0",
1095
1169
  description: "The number of items to skip before starting to collect the result set"
1096
1170
  })
@@ -1114,7 +1188,7 @@ var countAssetsRoute = createRoute({
1114
1188
  path: "/projects/{projectId}/assets/count",
1115
1189
  operationId: "countAssets",
1116
1190
  request: {
1117
- params: z13.object({
1191
+ params: z14.object({
1118
1192
  projectId: uuidSchema.openapi({
1119
1193
  param: {
1120
1194
  name: "projectId",
@@ -1127,7 +1201,7 @@ var countAssetsRoute = createRoute({
1127
1201
  200: {
1128
1202
  content: {
1129
1203
  "application/json": {
1130
- schema: z13.number()
1204
+ schema: z14.number()
1131
1205
  }
1132
1206
  },
1133
1207
  description: "The number of Assets of the given Project"
@@ -1141,7 +1215,7 @@ var readAssetRoute = createRoute({
1141
1215
  path: "/projects/{projectId}/assets/{assetId}",
1142
1216
  operationId: "readAsset",
1143
1217
  request: {
1144
- params: z13.object({
1218
+ params: z14.object({
1145
1219
  projectId: uuidSchema.openapi({
1146
1220
  param: {
1147
1221
  name: "projectId",
@@ -1172,7 +1246,7 @@ var readAssetRoute = createRoute({
1172
1246
  });
1173
1247
 
1174
1248
  // src/api/v1/collection.ts
1175
- import { createRoute as createRoute2, OpenAPIHono as OpenAPIHono2, z as z14 } from "@hono/zod-openapi";
1249
+ import { createRoute as createRoute2, OpenAPIHono as OpenAPIHono2, z as z15 } from "@hono/zod-openapi";
1176
1250
  var CollectionApiV1 = class {
1177
1251
  api;
1178
1252
  collectionService;
@@ -1214,7 +1288,7 @@ var listCollectionsRoute = createRoute2({
1214
1288
  path: "/projects/{projectId}/collections",
1215
1289
  operationId: "listCollections",
1216
1290
  request: {
1217
- params: z14.object({
1291
+ params: z15.object({
1218
1292
  projectId: uuidSchema.openapi({
1219
1293
  param: {
1220
1294
  name: "projectId",
@@ -1222,12 +1296,12 @@ var listCollectionsRoute = createRoute2({
1222
1296
  }
1223
1297
  })
1224
1298
  }),
1225
- query: z14.object({
1226
- limit: z14.string().pipe(z14.coerce.number()).optional().openapi({
1299
+ query: z15.object({
1300
+ limit: z15.string().pipe(z15.coerce.number()).optional().openapi({
1227
1301
  default: "15",
1228
1302
  description: "The maximum number of items to return"
1229
1303
  }),
1230
- offset: z14.string().pipe(z14.coerce.number()).optional().openapi({
1304
+ offset: z15.string().pipe(z15.coerce.number()).optional().openapi({
1231
1305
  default: "0",
1232
1306
  description: "The number of items to skip before starting to collect the result set"
1233
1307
  })
@@ -1251,7 +1325,7 @@ var countCollectionsRoute = createRoute2({
1251
1325
  path: "/projects/{projectId}/collections/count",
1252
1326
  operationId: "countCollections",
1253
1327
  request: {
1254
- params: z14.object({
1328
+ params: z15.object({
1255
1329
  projectId: uuidSchema.openapi({
1256
1330
  param: {
1257
1331
  name: "projectId",
@@ -1264,7 +1338,7 @@ var countCollectionsRoute = createRoute2({
1264
1338
  200: {
1265
1339
  content: {
1266
1340
  "application/json": {
1267
- schema: z14.number()
1341
+ schema: z15.number()
1268
1342
  }
1269
1343
  },
1270
1344
  description: "The number of Collections of the given Project"
@@ -1278,7 +1352,7 @@ var readCollectionRoute = createRoute2({
1278
1352
  path: "/projects/{projectId}/collections/{collectionId}",
1279
1353
  operationId: "readCollection",
1280
1354
  request: {
1281
- params: z14.object({
1355
+ params: z15.object({
1282
1356
  projectId: uuidSchema.openapi({
1283
1357
  param: {
1284
1358
  name: "projectId",
@@ -1309,7 +1383,7 @@ var readCollectionRoute = createRoute2({
1309
1383
  });
1310
1384
 
1311
1385
  // src/api/v1/entry.ts
1312
- import { createRoute as createRoute3, OpenAPIHono as OpenAPIHono3, z as z15 } from "@hono/zod-openapi";
1386
+ import { createRoute as createRoute3, OpenAPIHono as OpenAPIHono3, z as z16 } from "@hono/zod-openapi";
1313
1387
  var EntryApiV1 = class {
1314
1388
  api;
1315
1389
  entryService;
@@ -1353,7 +1427,7 @@ var listEntriesRoute = createRoute3({
1353
1427
  path: "/projects/{projectId}/collections/{collectionId}/entries",
1354
1428
  operationId: "listEntries",
1355
1429
  request: {
1356
- params: z15.object({
1430
+ params: z16.object({
1357
1431
  projectId: uuidSchema.openapi({
1358
1432
  param: {
1359
1433
  name: "projectId",
@@ -1367,12 +1441,12 @@ var listEntriesRoute = createRoute3({
1367
1441
  }
1368
1442
  })
1369
1443
  }),
1370
- query: z15.object({
1371
- limit: z15.string().pipe(z15.coerce.number()).optional().openapi({
1444
+ query: z16.object({
1445
+ limit: z16.string().pipe(z16.coerce.number()).optional().openapi({
1372
1446
  default: "15",
1373
1447
  description: "The maximum number of items to return"
1374
1448
  }),
1375
- offset: z15.string().pipe(z15.coerce.number()).optional().openapi({
1449
+ offset: z16.string().pipe(z16.coerce.number()).optional().openapi({
1376
1450
  default: "0",
1377
1451
  description: "The number of items to skip before starting to collect the result set"
1378
1452
  })
@@ -1396,7 +1470,7 @@ var countEntriesRoute = createRoute3({
1396
1470
  path: "/projects/{projectId}/collections/{collectionId}/entries/count",
1397
1471
  operationId: "countEntries",
1398
1472
  request: {
1399
- params: z15.object({
1473
+ params: z16.object({
1400
1474
  projectId: uuidSchema.openapi({
1401
1475
  param: {
1402
1476
  name: "projectId",
@@ -1415,7 +1489,7 @@ var countEntriesRoute = createRoute3({
1415
1489
  200: {
1416
1490
  content: {
1417
1491
  "application/json": {
1418
- schema: z15.number()
1492
+ schema: z16.number()
1419
1493
  }
1420
1494
  },
1421
1495
  description: "The number of Entries of the given Project"
@@ -1429,7 +1503,7 @@ var readEntryRoute = createRoute3({
1429
1503
  path: "/projects/{projectId}/collections/{collectionId}/entries/{entryId}",
1430
1504
  operationId: "readCollection",
1431
1505
  request: {
1432
- params: z15.object({
1506
+ params: z16.object({
1433
1507
  projectId: uuidSchema.openapi({
1434
1508
  param: {
1435
1509
  name: "projectId",
@@ -1466,7 +1540,7 @@ var readEntryRoute = createRoute3({
1466
1540
  });
1467
1541
 
1468
1542
  // src/api/v1/project.ts
1469
- import { createRoute as createRoute4, OpenAPIHono as OpenAPIHono4, z as z16 } from "@hono/zod-openapi";
1543
+ import { createRoute as createRoute4, OpenAPIHono as OpenAPIHono4, z as z17 } from "@hono/zod-openapi";
1470
1544
  var ProjectApiV1 = class {
1471
1545
  api;
1472
1546
  projectService;
@@ -1499,12 +1573,12 @@ var listProjectsRoute = createRoute4({
1499
1573
  path: "/projects",
1500
1574
  operationId: "listProjects",
1501
1575
  request: {
1502
- query: z16.object({
1503
- limit: z16.string().pipe(z16.coerce.number()).optional().openapi({
1576
+ query: z17.object({
1577
+ limit: z17.string().pipe(z17.coerce.number()).optional().openapi({
1504
1578
  default: "15",
1505
1579
  description: "The maximum number of items to return"
1506
1580
  }),
1507
- offset: z16.string().pipe(z16.coerce.number()).optional().openapi({
1581
+ offset: z17.string().pipe(z17.coerce.number()).optional().openapi({
1508
1582
  default: "0",
1509
1583
  description: "The number of items to skip before starting to collect the result set"
1510
1584
  })
@@ -1531,7 +1605,7 @@ var countProjectsRoute = createRoute4({
1531
1605
  200: {
1532
1606
  content: {
1533
1607
  "application/json": {
1534
- schema: z16.number()
1608
+ schema: z17.number()
1535
1609
  }
1536
1610
  },
1537
1611
  description: "The number of Projects you have acces to"
@@ -1545,7 +1619,7 @@ var readProjectRoute = createRoute4({
1545
1619
  path: "/projects/{projectId}",
1546
1620
  operationId: "readProject",
1547
1621
  request: {
1548
- params: z16.object({
1622
+ params: z17.object({
1549
1623
  projectId: uuidSchema.openapi({
1550
1624
  param: {
1551
1625
  name: "projectId",
@@ -1847,12 +1921,14 @@ async function files(path, extension) {
1847
1921
  var AbstractCrudService = class {
1848
1922
  type;
1849
1923
  options;
1924
+ logService;
1850
1925
  /**
1851
1926
  * Do not instantiate directly as this is an abstract class
1852
1927
  */
1853
- constructor(type, options) {
1928
+ constructor(type, options, logService) {
1854
1929
  this.type = type;
1855
1930
  this.options = options;
1931
+ this.logService = logService;
1856
1932
  }
1857
1933
  /**
1858
1934
  * Returns a list of all file references of given project and type
@@ -1903,7 +1979,10 @@ var AbstractCrudService = class {
1903
1979
  };
1904
1980
  try {
1905
1981
  return fileReferenceSchema.parse(folderReference);
1906
- } catch (error) {
1982
+ } catch {
1983
+ this.logService.warn(
1984
+ `[getFolderReferences] Ignoring folder "${possibleFolder.name}" in "${path}" as it does not match the expected format`
1985
+ );
1907
1986
  return null;
1908
1987
  }
1909
1988
  });
@@ -1926,7 +2005,10 @@ var AbstractCrudService = class {
1926
2005
  };
1927
2006
  try {
1928
2007
  return fileReferenceSchema.parse(fileReference);
1929
- } catch (error) {
2008
+ } catch {
2009
+ this.logService.warn(
2010
+ `[getFileReferences] Ignoring file "${possibleFile.name}" in "${path}" as it does not match the expected format`
2011
+ );
1930
2012
  return null;
1931
2013
  }
1932
2014
  })
@@ -1961,13 +2043,10 @@ function slug(string) {
1961
2043
 
1962
2044
  // src/service/AssetService.ts
1963
2045
  var AssetService = class extends AbstractCrudService {
1964
- // @ts-ignore
1965
- logService;
1966
2046
  jsonFileService;
1967
2047
  gitService;
1968
2048
  constructor(options, logService, jsonFileService, gitService) {
1969
- super(serviceTypeSchema.enum.Asset, options);
1970
- this.logService = logService;
2049
+ super(serviceTypeSchema.enum.Asset, options, logService);
1971
2050
  this.jsonFileService = jsonFileService;
1972
2051
  this.gitService = gitService;
1973
2052
  }
@@ -2216,8 +2295,8 @@ import Fs3 from "fs-extra";
2216
2295
  var CollectionService = class extends AbstractCrudService {
2217
2296
  jsonFileService;
2218
2297
  gitService;
2219
- constructor(options, jsonFileService, gitService) {
2220
- super(serviceTypeSchema.enum.Collection, options);
2298
+ constructor(options, logService, jsonFileService, gitService) {
2299
+ super(serviceTypeSchema.enum.Collection, options, logService);
2221
2300
  this.jsonFileService = jsonFileService;
2222
2301
  this.gitService = gitService;
2223
2302
  }
@@ -2396,14 +2475,12 @@ var CollectionService = class extends AbstractCrudService {
2396
2475
  // src/service/EntryService.ts
2397
2476
  import Fs4 from "fs-extra";
2398
2477
  var EntryService = class extends AbstractCrudService {
2399
- logService;
2400
2478
  jsonFileService;
2401
2479
  gitService;
2402
2480
  collectionService;
2403
2481
  // private sharedValueService: SharedValueService;
2404
2482
  constructor(options, logService, jsonFileService, gitService, collectionService) {
2405
- super(serviceTypeSchema.enum.Entry, options);
2406
- this.logService = logService;
2483
+ super(serviceTypeSchema.enum.Entry, options, logService);
2407
2484
  this.jsonFileService = jsonFileService;
2408
2485
  this.gitService = gitService;
2409
2486
  this.collectionService = collectionService;
@@ -2436,11 +2513,8 @@ var EntryService = class extends AbstractCrudService {
2436
2513
  props.collectionId,
2437
2514
  entryFile
2438
2515
  );
2439
- this.validateValues({
2440
- collectionId: props.collectionId,
2441
- fieldDefinitions: collection.fieldDefinitions,
2442
- values: entry.values
2443
- });
2516
+ const createEntrySchemaFromFieldDefinitions = getCreateEntrySchemaFromFieldDefinitions(collection.fieldDefinitions);
2517
+ createEntrySchemaFromFieldDefinitions.parse(props);
2444
2518
  await this.jsonFileService.create(
2445
2519
  entryFile,
2446
2520
  entryFilePath,
@@ -2513,11 +2587,8 @@ var EntryService = class extends AbstractCrudService {
2513
2587
  props.collectionId,
2514
2588
  entryFile
2515
2589
  );
2516
- this.validateValues({
2517
- collectionId: props.collectionId,
2518
- fieldDefinitions: collection.fieldDefinitions,
2519
- values: entry.values
2520
- });
2590
+ const updateEntrySchemaFromFieldDefinitions = getUpdateEntrySchemaFromFieldDefinitions(collection.fieldDefinitions);
2591
+ updateEntrySchemaFromFieldDefinitions.parse(props);
2521
2592
  await this.jsonFileService.update(
2522
2593
  entryFile,
2523
2594
  entryFilePath,
@@ -2602,47 +2673,6 @@ var EntryService = class extends AbstractCrudService {
2602
2673
  migrate(potentiallyOutdatedEntryFile) {
2603
2674
  return entryFileSchema.parse(potentiallyOutdatedEntryFile);
2604
2675
  }
2605
- /**
2606
- * Returns a Field definition by ID
2607
- */
2608
- getFieldDefinitionById(props) {
2609
- const fieldDefinition = props.fieldDefinitions.find((definition) => {
2610
- if (definition.id === props.id) {
2611
- return true;
2612
- }
2613
- return false;
2614
- });
2615
- if (!fieldDefinition) {
2616
- throw new Error(
2617
- `No Field definition with ID "${props.id}" found in Collection "${props.collectionId}" for given Value reference`
2618
- );
2619
- }
2620
- return fieldDefinition;
2621
- }
2622
- /**
2623
- * Validates given Values against their Collections Field definitions
2624
- */
2625
- validateValues(props) {
2626
- props.values.map((value) => {
2627
- const fieldDefinition = this.getFieldDefinitionById({
2628
- collectionId: props.collectionId,
2629
- fieldDefinitions: props.fieldDefinitions,
2630
- id: value.fieldDefinitionId
2631
- });
2632
- const contentSchema = getValueContentSchemaFromFieldDefinition(fieldDefinition);
2633
- this.logService.debug(
2634
- "Validating Value against content schema generated from Field definition",
2635
- {
2636
- value,
2637
- contentSchema,
2638
- fieldDefinition
2639
- }
2640
- );
2641
- for (const [_language, content] of Object.entries(value.content)) {
2642
- contentSchema.parse(content);
2643
- }
2644
- });
2645
- }
2646
2676
  /**
2647
2677
  * Creates an Entry from given EntryFile by resolving it's Values
2648
2678
  */
@@ -2665,8 +2695,8 @@ import Path2 from "path";
2665
2695
  // src/service/GitTagService.ts
2666
2696
  var GitTagService = class extends AbstractCrudService {
2667
2697
  git;
2668
- constructor(options, git) {
2669
- super(serviceTypeSchema.enum.GitTag, options);
2698
+ constructor(options, git, logService) {
2699
+ super(serviceTypeSchema.enum.GitTag, options, logService);
2670
2700
  this.git = git;
2671
2701
  }
2672
2702
  /**
@@ -2810,7 +2840,11 @@ var GitService = class {
2810
2840
  concurrency: 1
2811
2841
  // No concurrency because git operations are sequencial
2812
2842
  });
2813
- this.gitTagService = new GitTagService(options, this.git.bind(this));
2843
+ this.gitTagService = new GitTagService(
2844
+ options,
2845
+ this.git.bind(this),
2846
+ logService
2847
+ );
2814
2848
  this.logService = logService;
2815
2849
  this.userService = userService;
2816
2850
  this.updateVersion();
@@ -3336,10 +3370,8 @@ var GitService = class {
3336
3370
  import Fs5 from "fs-extra";
3337
3371
  var JsonFileService = class extends AbstractCrudService {
3338
3372
  cache = /* @__PURE__ */ new Map();
3339
- logService;
3340
3373
  constructor(options, logService) {
3341
- super(serviceTypeSchema.enum.JsonFile, options);
3342
- this.logService = logService;
3374
+ super(serviceTypeSchema.enum.JsonFile, options, logService);
3343
3375
  }
3344
3376
  /**
3345
3377
  * Creates a new file on disk. Fails if path already exists
@@ -3356,7 +3388,9 @@ var JsonFileService = class extends AbstractCrudService {
3356
3388
  flag: "wx",
3357
3389
  encoding: "utf8"
3358
3390
  });
3359
- this.options.file.cache === true && this.cache.set(path, parsedData);
3391
+ if (this.options.file.cache === true) {
3392
+ this.cache.set(path, parsedData);
3393
+ }
3360
3394
  this.logService.debug(`Created file "${path}"`);
3361
3395
  return parsedData;
3362
3396
  }
@@ -3381,7 +3415,9 @@ var JsonFileService = class extends AbstractCrudService {
3381
3415
  });
3382
3416
  const json = this.deserialize(data);
3383
3417
  const parsedData = schema.parse(json);
3384
- this.options.file.cache === true && this.cache.set(path, parsedData);
3418
+ if (this.options.file.cache === true) {
3419
+ this.cache.set(path, parsedData);
3420
+ }
3385
3421
  return parsedData;
3386
3422
  }
3387
3423
  /**
@@ -3422,7 +3458,9 @@ var JsonFileService = class extends AbstractCrudService {
3422
3458
  flag: "w",
3423
3459
  encoding: "utf8"
3424
3460
  });
3425
- this.options.file.cache === true && this.cache.set(path, parsedData);
3461
+ if (this.options.file.cache === true) {
3462
+ this.cache.set(path, parsedData);
3463
+ }
3426
3464
  this.logService.debug(`Updated file "${path}"`);
3427
3465
  return parsedData;
3428
3466
  }
@@ -3523,7 +3561,6 @@ var SynchronizeLocalChangesError = class extends Error {
3523
3561
  // src/service/ProjectService.ts
3524
3562
  var ProjectService = class extends AbstractCrudService {
3525
3563
  coreVersion;
3526
- logService;
3527
3564
  jsonFileService;
3528
3565
  userService;
3529
3566
  gitService;
@@ -3531,9 +3568,8 @@ var ProjectService = class extends AbstractCrudService {
3531
3568
  collectionService;
3532
3569
  entryService;
3533
3570
  constructor(coreVersion, options, logService, jsonFileService, userService, gitService, assetService, collectionService, entryService) {
3534
- super(serviceTypeSchema.enum.Project, options);
3571
+ super(serviceTypeSchema.enum.Project, options, logService);
3535
3572
  this.coreVersion = coreVersion;
3536
- this.logService = logService;
3537
3573
  this.jsonFileService = jsonFileService;
3538
3574
  this.userService = userService;
3539
3575
  this.gitService = gitService;
@@ -3844,9 +3880,7 @@ var ProjectService = class extends AbstractCrudService {
3844
3880
  async getChanges(props) {
3845
3881
  getChangesProjectSchema.parse(props);
3846
3882
  const projectPath = pathTo.project(props.id);
3847
- const hasRemoteOrigin = await this.gitService.remotes.hasOrigin(
3848
- projectPath
3849
- );
3883
+ const hasRemoteOrigin = await this.gitService.remotes.hasOrigin(projectPath);
3850
3884
  if (hasRemoteOrigin === false) {
3851
3885
  throw new Error(`Project "${props.id}" does not have a remote origin`);
3852
3886
  }
@@ -4047,9 +4081,7 @@ var ProjectService = class extends AbstractCrudService {
4047
4081
  switch (objectType) {
4048
4082
  case "asset": {
4049
4083
  const assetFilePath = pathTo.assetFile(projectId, reference.id);
4050
- const prevAssetFile = await this.jsonFileService.unsafeRead(
4051
- assetFilePath
4052
- );
4084
+ const prevAssetFile = await this.jsonFileService.unsafeRead(assetFilePath);
4053
4085
  const migratedAssetFile = this.assetService.migrate(prevAssetFile);
4054
4086
  await this.assetService.update({ projectId, ...migratedAssetFile });
4055
4087
  this.logService.info(`Upgraded ${objectType} "${assetFilePath}"`, {
@@ -4063,9 +4095,7 @@ var ProjectService = class extends AbstractCrudService {
4063
4095
  projectId,
4064
4096
  reference.id
4065
4097
  );
4066
- const prevCollectionFile = await this.jsonFileService.unsafeRead(
4067
- collectionFilePath
4068
- );
4098
+ const prevCollectionFile = await this.jsonFileService.unsafeRead(collectionFilePath);
4069
4099
  const migratedCollectionFile = this.collectionService.migrate(prevCollectionFile);
4070
4100
  await this.collectionService.update({
4071
4101
  projectId,
@@ -4086,9 +4116,7 @@ var ProjectService = class extends AbstractCrudService {
4086
4116
  collectionId,
4087
4117
  reference.id
4088
4118
  );
4089
- const prevEntryFile = await this.jsonFileService.unsafeRead(
4090
- entryFilePath
4091
- );
4119
+ const prevEntryFile = await this.jsonFileService.unsafeRead(entryFilePath);
4092
4120
  const migratedEntryFile = this.entryService.migrate(prevEntryFile);
4093
4121
  await this.entryService.update({
4094
4122
  projectId,
@@ -4123,7 +4151,7 @@ var UserService = class {
4123
4151
  async get() {
4124
4152
  try {
4125
4153
  return await this.jsonFileService.read(pathTo.userFile, userFileSchema);
4126
- } catch (error) {
4154
+ } catch {
4127
4155
  this.logService.info("No User found");
4128
4156
  return null;
4129
4157
  }
@@ -4188,6 +4216,7 @@ var ElekIoCore = class {
4188
4216
  );
4189
4217
  this.collectionService = new CollectionService(
4190
4218
  this.options,
4219
+ this.logService,
4191
4220
  this.jsonFileService,
4192
4221
  this.gitService
4193
4222
  );
@@ -4334,8 +4363,10 @@ export {
4334
4363
  fieldDefinitionSchema,
4335
4364
  fileReferenceSchema,
4336
4365
  getChangesProjectSchema,
4366
+ getCreateEntrySchemaFromFieldDefinitions,
4337
4367
  getRemoteOriginUrlProjectSchema,
4338
- getValueContentSchemaFromFieldDefinition,
4368
+ getUpdateEntrySchemaFromFieldDefinitions,
4369
+ getValueSchemaFromFieldDefinition,
4339
4370
  gitCloneOptionsSchema,
4340
4371
  gitCommitSchema,
4341
4372
  gitInitOptionsSchema,