@elek-io/core 0.14.4 → 0.15.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.
@@ -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.0",
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,7 +119,7 @@ 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";
@@ -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({
@@ -968,9 +879,182 @@ var searchProjectSchema = z10.object({
968
879
  type: z10.array(objectTypeSchema).optional()
969
880
  });
970
881
 
882
+ // src/schema/schemaFromFieldDefinition.ts
883
+ import z11 from "zod";
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, values) {
1021
+ const schema = {
1022
+ ...createEntrySchema,
1023
+ values: values.map((value) => {
1024
+ const fieldDefinition = fieldDefinitions.find(
1025
+ (fieldDefinition2) => fieldDefinition2.id === value.fieldDefinitionId
1026
+ );
1027
+ if (!fieldDefinition) {
1028
+ throw new Error(
1029
+ `Field definition with ID "${value.fieldDefinitionId}" not found`
1030
+ );
1031
+ }
1032
+ return getValueSchemaFromFieldDefinition(fieldDefinition);
1033
+ })
1034
+ };
1035
+ return schema;
1036
+ }
1037
+ function getUpdateEntrySchemaFromFieldDefinitions(fieldDefinitions, values) {
1038
+ const schema = {
1039
+ ...updateEntrySchema,
1040
+ values: values.map((value) => {
1041
+ const fieldDefinition = fieldDefinitions.find(
1042
+ (fieldDefinition2) => fieldDefinition2.id === value.fieldDefinitionId
1043
+ );
1044
+ if (!fieldDefinition) {
1045
+ throw new Error(
1046
+ `Field definition with ID "${value.fieldDefinitionId}" not found`
1047
+ );
1048
+ }
1049
+ return getValueSchemaFromFieldDefinition(fieldDefinition);
1050
+ })
1051
+ };
1052
+ return schema;
1053
+ }
1054
+
971
1055
  // src/schema/serviceSchema.ts
972
- import { z as z11 } from "zod";
973
- var serviceTypeSchema = z11.enum([
1056
+ import { z as z12 } from "zod";
1057
+ var serviceTypeSchema = z12.enum([
974
1058
  "Git",
975
1059
  "GitTag",
976
1060
  "User",
@@ -983,17 +1067,17 @@ var serviceTypeSchema = z11.enum([
983
1067
  "Value"
984
1068
  ]);
985
1069
  function paginatedListOf(schema) {
986
- return z11.object({
987
- total: z11.number(),
988
- limit: z11.number(),
989
- offset: z11.number(),
990
- list: z11.array(schema)
1070
+ return z12.object({
1071
+ total: z12.number(),
1072
+ limit: z12.number(),
1073
+ offset: z12.number(),
1074
+ list: z12.array(schema)
991
1075
  });
992
1076
  }
993
- var listSchema = z11.object({
1077
+ var listSchema = z12.object({
994
1078
  projectId: uuidSchema,
995
- limit: z11.number().optional(),
996
- offset: z11.number().optional()
1079
+ limit: z12.number().optional(),
1080
+ offset: z12.number().optional()
997
1081
  });
998
1082
  var listCollectionsSchema = listSchema;
999
1083
  var listEntriesSchema = listSchema.extend({
@@ -1003,35 +1087,35 @@ var listAssetsSchema = listSchema;
1003
1087
  var listProjectsSchema = listSchema.omit({
1004
1088
  projectId: true
1005
1089
  });
1006
- var listGitTagsSchema = z11.object({
1007
- path: z11.string()
1090
+ var listGitTagsSchema = z12.object({
1091
+ path: z12.string()
1008
1092
  });
1009
1093
 
1010
1094
  // src/schema/userSchema.ts
1011
- import z12 from "zod";
1012
- var UserTypeSchema = z12.enum(["local", "cloud"]);
1095
+ import z13 from "zod";
1096
+ var UserTypeSchema = z13.enum(["local", "cloud"]);
1013
1097
  var baseUserSchema = gitSignatureSchema.extend({
1014
1098
  userType: UserTypeSchema,
1015
1099
  language: supportedLanguageSchema,
1016
- localApi: z12.object({
1100
+ localApi: z13.object({
1017
1101
  /**
1018
1102
  * If set to true the local API is started whenever Core is initialized
1019
1103
  */
1020
- isEnabled: z12.boolean(),
1104
+ isEnabled: z13.boolean(),
1021
1105
  /**
1022
1106
  * The port the local API uses
1023
1107
  */
1024
- port: z12.number()
1108
+ port: z13.number()
1025
1109
  })
1026
1110
  });
1027
1111
  var localUserSchema = baseUserSchema.extend({
1028
- userType: z12.literal(UserTypeSchema.enum.local)
1112
+ userType: z13.literal(UserTypeSchema.enum.local)
1029
1113
  });
1030
1114
  var cloudUserSchema = baseUserSchema.extend({
1031
- userType: z12.literal(UserTypeSchema.enum.cloud),
1115
+ userType: z13.literal(UserTypeSchema.enum.cloud),
1032
1116
  id: uuidSchema
1033
1117
  });
1034
- var userFileSchema = z12.union([localUserSchema, cloudUserSchema]);
1118
+ var userFileSchema = z13.union([localUserSchema, cloudUserSchema]);
1035
1119
  var userSchema = userFileSchema;
1036
1120
  var setUserSchema = userSchema;
1037
1121
 
@@ -1077,7 +1161,7 @@ var listAssetsRoute = createRoute({
1077
1161
  path: "/projects/{projectId}/assets",
1078
1162
  operationId: "listAssets",
1079
1163
  request: {
1080
- params: z13.object({
1164
+ params: z14.object({
1081
1165
  projectId: uuidSchema.openapi({
1082
1166
  param: {
1083
1167
  name: "projectId",
@@ -1085,12 +1169,12 @@ var listAssetsRoute = createRoute({
1085
1169
  }
1086
1170
  })
1087
1171
  }),
1088
- query: z13.object({
1089
- limit: z13.string().pipe(z13.coerce.number()).optional().openapi({
1172
+ query: z14.object({
1173
+ limit: z14.string().pipe(z14.coerce.number()).optional().openapi({
1090
1174
  default: "15",
1091
1175
  description: "The maximum number of items to return"
1092
1176
  }),
1093
- offset: z13.string().pipe(z13.coerce.number()).optional().openapi({
1177
+ offset: z14.string().pipe(z14.coerce.number()).optional().openapi({
1094
1178
  default: "0",
1095
1179
  description: "The number of items to skip before starting to collect the result set"
1096
1180
  })
@@ -1114,7 +1198,7 @@ var countAssetsRoute = createRoute({
1114
1198
  path: "/projects/{projectId}/assets/count",
1115
1199
  operationId: "countAssets",
1116
1200
  request: {
1117
- params: z13.object({
1201
+ params: z14.object({
1118
1202
  projectId: uuidSchema.openapi({
1119
1203
  param: {
1120
1204
  name: "projectId",
@@ -1127,7 +1211,7 @@ var countAssetsRoute = createRoute({
1127
1211
  200: {
1128
1212
  content: {
1129
1213
  "application/json": {
1130
- schema: z13.number()
1214
+ schema: z14.number()
1131
1215
  }
1132
1216
  },
1133
1217
  description: "The number of Assets of the given Project"
@@ -1141,7 +1225,7 @@ var readAssetRoute = createRoute({
1141
1225
  path: "/projects/{projectId}/assets/{assetId}",
1142
1226
  operationId: "readAsset",
1143
1227
  request: {
1144
- params: z13.object({
1228
+ params: z14.object({
1145
1229
  projectId: uuidSchema.openapi({
1146
1230
  param: {
1147
1231
  name: "projectId",
@@ -1172,7 +1256,7 @@ var readAssetRoute = createRoute({
1172
1256
  });
1173
1257
 
1174
1258
  // src/api/v1/collection.ts
1175
- import { createRoute as createRoute2, OpenAPIHono as OpenAPIHono2, z as z14 } from "@hono/zod-openapi";
1259
+ import { createRoute as createRoute2, OpenAPIHono as OpenAPIHono2, z as z15 } from "@hono/zod-openapi";
1176
1260
  var CollectionApiV1 = class {
1177
1261
  api;
1178
1262
  collectionService;
@@ -1214,7 +1298,7 @@ var listCollectionsRoute = createRoute2({
1214
1298
  path: "/projects/{projectId}/collections",
1215
1299
  operationId: "listCollections",
1216
1300
  request: {
1217
- params: z14.object({
1301
+ params: z15.object({
1218
1302
  projectId: uuidSchema.openapi({
1219
1303
  param: {
1220
1304
  name: "projectId",
@@ -1222,12 +1306,12 @@ var listCollectionsRoute = createRoute2({
1222
1306
  }
1223
1307
  })
1224
1308
  }),
1225
- query: z14.object({
1226
- limit: z14.string().pipe(z14.coerce.number()).optional().openapi({
1309
+ query: z15.object({
1310
+ limit: z15.string().pipe(z15.coerce.number()).optional().openapi({
1227
1311
  default: "15",
1228
1312
  description: "The maximum number of items to return"
1229
1313
  }),
1230
- offset: z14.string().pipe(z14.coerce.number()).optional().openapi({
1314
+ offset: z15.string().pipe(z15.coerce.number()).optional().openapi({
1231
1315
  default: "0",
1232
1316
  description: "The number of items to skip before starting to collect the result set"
1233
1317
  })
@@ -1251,7 +1335,7 @@ var countCollectionsRoute = createRoute2({
1251
1335
  path: "/projects/{projectId}/collections/count",
1252
1336
  operationId: "countCollections",
1253
1337
  request: {
1254
- params: z14.object({
1338
+ params: z15.object({
1255
1339
  projectId: uuidSchema.openapi({
1256
1340
  param: {
1257
1341
  name: "projectId",
@@ -1264,7 +1348,7 @@ var countCollectionsRoute = createRoute2({
1264
1348
  200: {
1265
1349
  content: {
1266
1350
  "application/json": {
1267
- schema: z14.number()
1351
+ schema: z15.number()
1268
1352
  }
1269
1353
  },
1270
1354
  description: "The number of Collections of the given Project"
@@ -1278,7 +1362,7 @@ var readCollectionRoute = createRoute2({
1278
1362
  path: "/projects/{projectId}/collections/{collectionId}",
1279
1363
  operationId: "readCollection",
1280
1364
  request: {
1281
- params: z14.object({
1365
+ params: z15.object({
1282
1366
  projectId: uuidSchema.openapi({
1283
1367
  param: {
1284
1368
  name: "projectId",
@@ -1309,7 +1393,7 @@ var readCollectionRoute = createRoute2({
1309
1393
  });
1310
1394
 
1311
1395
  // src/api/v1/entry.ts
1312
- import { createRoute as createRoute3, OpenAPIHono as OpenAPIHono3, z as z15 } from "@hono/zod-openapi";
1396
+ import { createRoute as createRoute3, OpenAPIHono as OpenAPIHono3, z as z16 } from "@hono/zod-openapi";
1313
1397
  var EntryApiV1 = class {
1314
1398
  api;
1315
1399
  entryService;
@@ -1353,7 +1437,7 @@ var listEntriesRoute = createRoute3({
1353
1437
  path: "/projects/{projectId}/collections/{collectionId}/entries",
1354
1438
  operationId: "listEntries",
1355
1439
  request: {
1356
- params: z15.object({
1440
+ params: z16.object({
1357
1441
  projectId: uuidSchema.openapi({
1358
1442
  param: {
1359
1443
  name: "projectId",
@@ -1367,12 +1451,12 @@ var listEntriesRoute = createRoute3({
1367
1451
  }
1368
1452
  })
1369
1453
  }),
1370
- query: z15.object({
1371
- limit: z15.string().pipe(z15.coerce.number()).optional().openapi({
1454
+ query: z16.object({
1455
+ limit: z16.string().pipe(z16.coerce.number()).optional().openapi({
1372
1456
  default: "15",
1373
1457
  description: "The maximum number of items to return"
1374
1458
  }),
1375
- offset: z15.string().pipe(z15.coerce.number()).optional().openapi({
1459
+ offset: z16.string().pipe(z16.coerce.number()).optional().openapi({
1376
1460
  default: "0",
1377
1461
  description: "The number of items to skip before starting to collect the result set"
1378
1462
  })
@@ -1396,7 +1480,7 @@ var countEntriesRoute = createRoute3({
1396
1480
  path: "/projects/{projectId}/collections/{collectionId}/entries/count",
1397
1481
  operationId: "countEntries",
1398
1482
  request: {
1399
- params: z15.object({
1483
+ params: z16.object({
1400
1484
  projectId: uuidSchema.openapi({
1401
1485
  param: {
1402
1486
  name: "projectId",
@@ -1415,7 +1499,7 @@ var countEntriesRoute = createRoute3({
1415
1499
  200: {
1416
1500
  content: {
1417
1501
  "application/json": {
1418
- schema: z15.number()
1502
+ schema: z16.number()
1419
1503
  }
1420
1504
  },
1421
1505
  description: "The number of Entries of the given Project"
@@ -1429,7 +1513,7 @@ var readEntryRoute = createRoute3({
1429
1513
  path: "/projects/{projectId}/collections/{collectionId}/entries/{entryId}",
1430
1514
  operationId: "readCollection",
1431
1515
  request: {
1432
- params: z15.object({
1516
+ params: z16.object({
1433
1517
  projectId: uuidSchema.openapi({
1434
1518
  param: {
1435
1519
  name: "projectId",
@@ -1466,7 +1550,7 @@ var readEntryRoute = createRoute3({
1466
1550
  });
1467
1551
 
1468
1552
  // src/api/v1/project.ts
1469
- import { createRoute as createRoute4, OpenAPIHono as OpenAPIHono4, z as z16 } from "@hono/zod-openapi";
1553
+ import { createRoute as createRoute4, OpenAPIHono as OpenAPIHono4, z as z17 } from "@hono/zod-openapi";
1470
1554
  var ProjectApiV1 = class {
1471
1555
  api;
1472
1556
  projectService;
@@ -1499,12 +1583,12 @@ var listProjectsRoute = createRoute4({
1499
1583
  path: "/projects",
1500
1584
  operationId: "listProjects",
1501
1585
  request: {
1502
- query: z16.object({
1503
- limit: z16.string().pipe(z16.coerce.number()).optional().openapi({
1586
+ query: z17.object({
1587
+ limit: z17.string().pipe(z17.coerce.number()).optional().openapi({
1504
1588
  default: "15",
1505
1589
  description: "The maximum number of items to return"
1506
1590
  }),
1507
- offset: z16.string().pipe(z16.coerce.number()).optional().openapi({
1591
+ offset: z17.string().pipe(z17.coerce.number()).optional().openapi({
1508
1592
  default: "0",
1509
1593
  description: "The number of items to skip before starting to collect the result set"
1510
1594
  })
@@ -1531,7 +1615,7 @@ var countProjectsRoute = createRoute4({
1531
1615
  200: {
1532
1616
  content: {
1533
1617
  "application/json": {
1534
- schema: z16.number()
1618
+ schema: z17.number()
1535
1619
  }
1536
1620
  },
1537
1621
  description: "The number of Projects you have acces to"
@@ -1545,7 +1629,7 @@ var readProjectRoute = createRoute4({
1545
1629
  path: "/projects/{projectId}",
1546
1630
  operationId: "readProject",
1547
1631
  request: {
1548
- params: z16.object({
1632
+ params: z17.object({
1549
1633
  projectId: uuidSchema.openapi({
1550
1634
  param: {
1551
1635
  name: "projectId",
@@ -1847,12 +1931,14 @@ async function files(path, extension) {
1847
1931
  var AbstractCrudService = class {
1848
1932
  type;
1849
1933
  options;
1934
+ logService;
1850
1935
  /**
1851
1936
  * Do not instantiate directly as this is an abstract class
1852
1937
  */
1853
- constructor(type, options) {
1938
+ constructor(type, options, logService) {
1854
1939
  this.type = type;
1855
1940
  this.options = options;
1941
+ this.logService = logService;
1856
1942
  }
1857
1943
  /**
1858
1944
  * Returns a list of all file references of given project and type
@@ -1903,7 +1989,10 @@ var AbstractCrudService = class {
1903
1989
  };
1904
1990
  try {
1905
1991
  return fileReferenceSchema.parse(folderReference);
1906
- } catch (error) {
1992
+ } catch {
1993
+ this.logService.warn(
1994
+ `[getFolderReferences] Ignoring folder "${possibleFolder.name}" in "${path}" as it does not match the expected format`
1995
+ );
1907
1996
  return null;
1908
1997
  }
1909
1998
  });
@@ -1926,7 +2015,10 @@ var AbstractCrudService = class {
1926
2015
  };
1927
2016
  try {
1928
2017
  return fileReferenceSchema.parse(fileReference);
1929
- } catch (error) {
2018
+ } catch {
2019
+ this.logService.warn(
2020
+ `[getFileReferences] Ignoring file "${possibleFile.name}" in "${path}" as it does not match the expected format`
2021
+ );
1930
2022
  return null;
1931
2023
  }
1932
2024
  })
@@ -1961,13 +2053,10 @@ function slug(string) {
1961
2053
 
1962
2054
  // src/service/AssetService.ts
1963
2055
  var AssetService = class extends AbstractCrudService {
1964
- // @ts-ignore
1965
- logService;
1966
2056
  jsonFileService;
1967
2057
  gitService;
1968
2058
  constructor(options, logService, jsonFileService, gitService) {
1969
- super(serviceTypeSchema.enum.Asset, options);
1970
- this.logService = logService;
2059
+ super(serviceTypeSchema.enum.Asset, options, logService);
1971
2060
  this.jsonFileService = jsonFileService;
1972
2061
  this.gitService = gitService;
1973
2062
  }
@@ -2216,8 +2305,8 @@ import Fs3 from "fs-extra";
2216
2305
  var CollectionService = class extends AbstractCrudService {
2217
2306
  jsonFileService;
2218
2307
  gitService;
2219
- constructor(options, jsonFileService, gitService) {
2220
- super(serviceTypeSchema.enum.Collection, options);
2308
+ constructor(options, logService, jsonFileService, gitService) {
2309
+ super(serviceTypeSchema.enum.Collection, options, logService);
2221
2310
  this.jsonFileService = jsonFileService;
2222
2311
  this.gitService = gitService;
2223
2312
  }
@@ -2396,14 +2485,12 @@ var CollectionService = class extends AbstractCrudService {
2396
2485
  // src/service/EntryService.ts
2397
2486
  import Fs4 from "fs-extra";
2398
2487
  var EntryService = class extends AbstractCrudService {
2399
- logService;
2400
2488
  jsonFileService;
2401
2489
  gitService;
2402
2490
  collectionService;
2403
2491
  // private sharedValueService: SharedValueService;
2404
2492
  constructor(options, logService, jsonFileService, gitService, collectionService) {
2405
- super(serviceTypeSchema.enum.Entry, options);
2406
- this.logService = logService;
2493
+ super(serviceTypeSchema.enum.Entry, options, logService);
2407
2494
  this.jsonFileService = jsonFileService;
2408
2495
  this.gitService = gitService;
2409
2496
  this.collectionService = collectionService;
@@ -2436,11 +2523,11 @@ var EntryService = class extends AbstractCrudService {
2436
2523
  props.collectionId,
2437
2524
  entryFile
2438
2525
  );
2439
- this.validateValues({
2440
- collectionId: props.collectionId,
2441
- fieldDefinitions: collection.fieldDefinitions,
2442
- values: entry.values
2443
- });
2526
+ const createEntrySchemaFromFieldDefinitions = getCreateEntrySchemaFromFieldDefinitions(
2527
+ collection.fieldDefinitions,
2528
+ entry.values
2529
+ );
2530
+ createEntrySchemaFromFieldDefinitions.parse(props);
2444
2531
  await this.jsonFileService.create(
2445
2532
  entryFile,
2446
2533
  entryFilePath,
@@ -2513,11 +2600,11 @@ var EntryService = class extends AbstractCrudService {
2513
2600
  props.collectionId,
2514
2601
  entryFile
2515
2602
  );
2516
- this.validateValues({
2517
- collectionId: props.collectionId,
2518
- fieldDefinitions: collection.fieldDefinitions,
2519
- values: entry.values
2520
- });
2603
+ const updateEntrySchemaFromFieldDefinitions = getUpdateEntrySchemaFromFieldDefinitions(
2604
+ collection.fieldDefinitions,
2605
+ entry.values
2606
+ );
2607
+ updateEntrySchemaFromFieldDefinitions.parse(props);
2521
2608
  await this.jsonFileService.update(
2522
2609
  entryFile,
2523
2610
  entryFilePath,
@@ -2602,47 +2689,6 @@ var EntryService = class extends AbstractCrudService {
2602
2689
  migrate(potentiallyOutdatedEntryFile) {
2603
2690
  return entryFileSchema.parse(potentiallyOutdatedEntryFile);
2604
2691
  }
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
2692
  /**
2647
2693
  * Creates an Entry from given EntryFile by resolving it's Values
2648
2694
  */
@@ -2665,8 +2711,8 @@ import Path2 from "path";
2665
2711
  // src/service/GitTagService.ts
2666
2712
  var GitTagService = class extends AbstractCrudService {
2667
2713
  git;
2668
- constructor(options, git) {
2669
- super(serviceTypeSchema.enum.GitTag, options);
2714
+ constructor(options, git, logService) {
2715
+ super(serviceTypeSchema.enum.GitTag, options, logService);
2670
2716
  this.git = git;
2671
2717
  }
2672
2718
  /**
@@ -2810,7 +2856,11 @@ var GitService = class {
2810
2856
  concurrency: 1
2811
2857
  // No concurrency because git operations are sequencial
2812
2858
  });
2813
- this.gitTagService = new GitTagService(options, this.git.bind(this));
2859
+ this.gitTagService = new GitTagService(
2860
+ options,
2861
+ this.git.bind(this),
2862
+ logService
2863
+ );
2814
2864
  this.logService = logService;
2815
2865
  this.userService = userService;
2816
2866
  this.updateVersion();
@@ -3336,10 +3386,8 @@ var GitService = class {
3336
3386
  import Fs5 from "fs-extra";
3337
3387
  var JsonFileService = class extends AbstractCrudService {
3338
3388
  cache = /* @__PURE__ */ new Map();
3339
- logService;
3340
3389
  constructor(options, logService) {
3341
- super(serviceTypeSchema.enum.JsonFile, options);
3342
- this.logService = logService;
3390
+ super(serviceTypeSchema.enum.JsonFile, options, logService);
3343
3391
  }
3344
3392
  /**
3345
3393
  * Creates a new file on disk. Fails if path already exists
@@ -3356,7 +3404,9 @@ var JsonFileService = class extends AbstractCrudService {
3356
3404
  flag: "wx",
3357
3405
  encoding: "utf8"
3358
3406
  });
3359
- this.options.file.cache === true && this.cache.set(path, parsedData);
3407
+ if (this.options.file.cache === true) {
3408
+ this.cache.set(path, parsedData);
3409
+ }
3360
3410
  this.logService.debug(`Created file "${path}"`);
3361
3411
  return parsedData;
3362
3412
  }
@@ -3381,7 +3431,9 @@ var JsonFileService = class extends AbstractCrudService {
3381
3431
  });
3382
3432
  const json = this.deserialize(data);
3383
3433
  const parsedData = schema.parse(json);
3384
- this.options.file.cache === true && this.cache.set(path, parsedData);
3434
+ if (this.options.file.cache === true) {
3435
+ this.cache.set(path, parsedData);
3436
+ }
3385
3437
  return parsedData;
3386
3438
  }
3387
3439
  /**
@@ -3422,7 +3474,9 @@ var JsonFileService = class extends AbstractCrudService {
3422
3474
  flag: "w",
3423
3475
  encoding: "utf8"
3424
3476
  });
3425
- this.options.file.cache === true && this.cache.set(path, parsedData);
3477
+ if (this.options.file.cache === true) {
3478
+ this.cache.set(path, parsedData);
3479
+ }
3426
3480
  this.logService.debug(`Updated file "${path}"`);
3427
3481
  return parsedData;
3428
3482
  }
@@ -3523,7 +3577,6 @@ var SynchronizeLocalChangesError = class extends Error {
3523
3577
  // src/service/ProjectService.ts
3524
3578
  var ProjectService = class extends AbstractCrudService {
3525
3579
  coreVersion;
3526
- logService;
3527
3580
  jsonFileService;
3528
3581
  userService;
3529
3582
  gitService;
@@ -3531,9 +3584,8 @@ var ProjectService = class extends AbstractCrudService {
3531
3584
  collectionService;
3532
3585
  entryService;
3533
3586
  constructor(coreVersion, options, logService, jsonFileService, userService, gitService, assetService, collectionService, entryService) {
3534
- super(serviceTypeSchema.enum.Project, options);
3587
+ super(serviceTypeSchema.enum.Project, options, logService);
3535
3588
  this.coreVersion = coreVersion;
3536
- this.logService = logService;
3537
3589
  this.jsonFileService = jsonFileService;
3538
3590
  this.userService = userService;
3539
3591
  this.gitService = gitService;
@@ -3844,9 +3896,7 @@ var ProjectService = class extends AbstractCrudService {
3844
3896
  async getChanges(props) {
3845
3897
  getChangesProjectSchema.parse(props);
3846
3898
  const projectPath = pathTo.project(props.id);
3847
- const hasRemoteOrigin = await this.gitService.remotes.hasOrigin(
3848
- projectPath
3849
- );
3899
+ const hasRemoteOrigin = await this.gitService.remotes.hasOrigin(projectPath);
3850
3900
  if (hasRemoteOrigin === false) {
3851
3901
  throw new Error(`Project "${props.id}" does not have a remote origin`);
3852
3902
  }
@@ -4047,9 +4097,7 @@ var ProjectService = class extends AbstractCrudService {
4047
4097
  switch (objectType) {
4048
4098
  case "asset": {
4049
4099
  const assetFilePath = pathTo.assetFile(projectId, reference.id);
4050
- const prevAssetFile = await this.jsonFileService.unsafeRead(
4051
- assetFilePath
4052
- );
4100
+ const prevAssetFile = await this.jsonFileService.unsafeRead(assetFilePath);
4053
4101
  const migratedAssetFile = this.assetService.migrate(prevAssetFile);
4054
4102
  await this.assetService.update({ projectId, ...migratedAssetFile });
4055
4103
  this.logService.info(`Upgraded ${objectType} "${assetFilePath}"`, {
@@ -4063,9 +4111,7 @@ var ProjectService = class extends AbstractCrudService {
4063
4111
  projectId,
4064
4112
  reference.id
4065
4113
  );
4066
- const prevCollectionFile = await this.jsonFileService.unsafeRead(
4067
- collectionFilePath
4068
- );
4114
+ const prevCollectionFile = await this.jsonFileService.unsafeRead(collectionFilePath);
4069
4115
  const migratedCollectionFile = this.collectionService.migrate(prevCollectionFile);
4070
4116
  await this.collectionService.update({
4071
4117
  projectId,
@@ -4086,9 +4132,7 @@ var ProjectService = class extends AbstractCrudService {
4086
4132
  collectionId,
4087
4133
  reference.id
4088
4134
  );
4089
- const prevEntryFile = await this.jsonFileService.unsafeRead(
4090
- entryFilePath
4091
- );
4135
+ const prevEntryFile = await this.jsonFileService.unsafeRead(entryFilePath);
4092
4136
  const migratedEntryFile = this.entryService.migrate(prevEntryFile);
4093
4137
  await this.entryService.update({
4094
4138
  projectId,
@@ -4123,7 +4167,7 @@ var UserService = class {
4123
4167
  async get() {
4124
4168
  try {
4125
4169
  return await this.jsonFileService.read(pathTo.userFile, userFileSchema);
4126
- } catch (error) {
4170
+ } catch {
4127
4171
  this.logService.info("No User found");
4128
4172
  return null;
4129
4173
  }
@@ -4188,6 +4232,7 @@ var ElekIoCore = class {
4188
4232
  );
4189
4233
  this.collectionService = new CollectionService(
4190
4234
  this.options,
4235
+ this.logService,
4191
4236
  this.jsonFileService,
4192
4237
  this.gitService
4193
4238
  );
@@ -4334,8 +4379,10 @@ export {
4334
4379
  fieldDefinitionSchema,
4335
4380
  fileReferenceSchema,
4336
4381
  getChangesProjectSchema,
4382
+ getCreateEntrySchemaFromFieldDefinitions,
4337
4383
  getRemoteOriginUrlProjectSchema,
4338
- getValueContentSchemaFromFieldDefinition,
4384
+ getUpdateEntrySchemaFromFieldDefinitions,
4385
+ getValueSchemaFromFieldDefinition,
4339
4386
  gitCloneOptionsSchema,
4340
4387
  gitCommitSchema,
4341
4388
  gitInitOptionsSchema,