@elek-io/core 0.15.0 → 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.15.0",
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",
@@ -125,7 +125,7 @@ import { createRoute, OpenAPIHono, z as z14 } from "@hono/zod-openapi";
125
125
  import { z as z4 } from "@hono/zod-openapi";
126
126
 
127
127
  // src/schema/baseSchema.ts
128
- import z from "zod";
128
+ import { z } from "@hono/zod-openapi";
129
129
  var supportedLanguageSchema = z.enum([
130
130
  /**
131
131
  * Bulgarian
@@ -212,7 +212,7 @@ function translatableArrayOf(schema) {
212
212
  }
213
213
 
214
214
  // src/schema/fileSchema.ts
215
- import z2 from "zod";
215
+ import { z as z2 } from "@hono/zod-openapi";
216
216
  var baseFileSchema = z2.object({
217
217
  /**
218
218
  * The object type of the file
@@ -239,7 +239,7 @@ var fileReferenceSchema = z2.object({
239
239
  });
240
240
 
241
241
  // src/schema/gitSchema.ts
242
- import { z as z3 } from "zod";
242
+ import { z as z3 } from "@hono/zod-openapi";
243
243
  var gitSignatureSchema = z3.object({
244
244
  name: z3.string(),
245
245
  email: z3.string().email()
@@ -428,7 +428,7 @@ import { z as z8 } from "@hono/zod-openapi";
428
428
  import { z as z6 } from "@hono/zod-openapi";
429
429
 
430
430
  // src/schema/valueSchema.ts
431
- import z5 from "zod";
431
+ import { z as z5 } from "@hono/zod-openapi";
432
432
  var ValueTypeSchema = z5.enum([
433
433
  "string",
434
434
  "number",
@@ -525,7 +525,7 @@ var countEntriesSchema = z6.object({
525
525
  });
526
526
 
527
527
  // src/schema/fieldSchema.ts
528
- import { z as z7 } from "zod";
528
+ import { z as z7 } from "@hono/zod-openapi";
529
529
  var FieldTypeSchema = z7.enum([
530
530
  // String Values
531
531
  "text",
@@ -728,7 +728,7 @@ var countCollectionsSchema = z8.object({
728
728
  });
729
729
 
730
730
  // src/schema/coreSchema.ts
731
- import { z as z9 } from "zod";
731
+ import { z as z9 } from "@hono/zod-openapi";
732
732
  var elekIoCoreOptionsSchema = z9.object({
733
733
  log: z9.object({
734
734
  /**
@@ -880,7 +880,7 @@ var searchProjectSchema = z10.object({
880
880
  });
881
881
 
882
882
  // src/schema/schemaFromFieldDefinition.ts
883
- import z11 from "zod";
883
+ import { z as z11 } from "@hono/zod-openapi";
884
884
  function getBooleanValueContentSchemaFromFieldDefinition() {
885
885
  return z11.boolean();
886
886
  }
@@ -1017,43 +1017,33 @@ function getValueSchemaFromFieldDefinition(fieldDefinition) {
1017
1017
  );
1018
1018
  }
1019
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;
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
+ });
1036
1031
  }
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;
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
+ });
1053
1043
  }
1054
1044
 
1055
1045
  // src/schema/serviceSchema.ts
1056
- import { z as z12 } from "zod";
1046
+ import { z as z12 } from "@hono/zod-openapi";
1057
1047
  var serviceTypeSchema = z12.enum([
1058
1048
  "Git",
1059
1049
  "GitTag",
@@ -1092,7 +1082,7 @@ var listGitTagsSchema = z12.object({
1092
1082
  });
1093
1083
 
1094
1084
  // src/schema/userSchema.ts
1095
- import z13 from "zod";
1085
+ import { z as z13 } from "@hono/zod-openapi";
1096
1086
  var UserTypeSchema = z13.enum(["local", "cloud"]);
1097
1087
  var baseUserSchema = gitSignatureSchema.extend({
1098
1088
  userType: UserTypeSchema,
@@ -2523,10 +2513,7 @@ var EntryService = class extends AbstractCrudService {
2523
2513
  props.collectionId,
2524
2514
  entryFile
2525
2515
  );
2526
- const createEntrySchemaFromFieldDefinitions = getCreateEntrySchemaFromFieldDefinitions(
2527
- collection.fieldDefinitions,
2528
- entry.values
2529
- );
2516
+ const createEntrySchemaFromFieldDefinitions = getCreateEntrySchemaFromFieldDefinitions(collection.fieldDefinitions);
2530
2517
  createEntrySchemaFromFieldDefinitions.parse(props);
2531
2518
  await this.jsonFileService.create(
2532
2519
  entryFile,
@@ -2600,10 +2587,7 @@ var EntryService = class extends AbstractCrudService {
2600
2587
  props.collectionId,
2601
2588
  entryFile
2602
2589
  );
2603
- const updateEntrySchemaFromFieldDefinitions = getUpdateEntrySchemaFromFieldDefinitions(
2604
- collection.fieldDefinitions,
2605
- entry.values
2606
- );
2590
+ const updateEntrySchemaFromFieldDefinitions = getUpdateEntrySchemaFromFieldDefinitions(collection.fieldDefinitions);
2607
2591
  updateEntrySchemaFromFieldDefinitions.parse(props);
2608
2592
  await this.jsonFileService.update(
2609
2593
  entryFile,