@elek-io/core 0.10.0 → 0.11.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.
@@ -57,39 +57,6 @@ var supportedLanguageSchema = z.enum([
57
57
  // (Simplified) Chinese
58
58
  ]);
59
59
  var supportedIconSchema = z.enum(["home", "plus", "foobar"]);
60
- var supportedAssetMimeTypeSchema = z.enum([
61
- "image/avif",
62
- "image/gif",
63
- "image/jpeg",
64
- "image/png",
65
- "image/svg+xml",
66
- "image/webp",
67
- "application/pdf",
68
- "application/zip",
69
- "video/mp4",
70
- "video/webm",
71
- "audio/webm",
72
- "audio/flac"
73
- ]);
74
- var supportedAssetExtensionSchema = z.enum([
75
- "avif",
76
- "gif",
77
- "jpg",
78
- "jpeg",
79
- "png",
80
- "svg",
81
- "webp",
82
- "pdf",
83
- "zip",
84
- "mp4",
85
- "webm",
86
- "flac",
87
- "json"
88
- ]);
89
- var supportedAssetTypeSchema = z.object({
90
- extension: supportedAssetExtensionSchema,
91
- mimeType: supportedAssetMimeTypeSchema
92
- });
93
60
  var objectTypeSchema = z.enum([
94
61
  "project",
95
62
  "asset",
@@ -139,48 +106,47 @@ var baseFileSchema = z2.object({
139
106
  */
140
107
  updated: z2.string().datetime().nullable()
141
108
  });
142
- var baseFileWithLanguageSchema = baseFileSchema.extend({
143
- /**
144
- * The language of the file
145
- *
146
- * The language is part of the files name and together with it's ID the only unique identifier.
147
- * That's why the language cannot be changed after creating the file.
148
- *
149
- * @todo Maybe remove the above restriction by implementing logic to handle changing the files language inside all services
150
- */
151
- language: supportedLanguageSchema.readonly()
152
- });
153
109
  var fileReferenceSchema = z2.object({
154
110
  id: uuidSchema,
155
- language: supportedLanguageSchema.optional(),
156
- extension: supportedAssetExtensionSchema.optional()
111
+ extension: z2.string().optional()
157
112
  });
158
113
 
159
114
  // src/schema/gitSchema.ts
160
115
  import { z as z3 } from "zod";
161
- var gitRepositoryPathSchema = z3.string();
162
116
  var gitSignatureSchema = z3.object({
163
117
  name: z3.string(),
164
118
  email: z3.string()
165
119
  });
120
+ var gitMessageSchema = z3.object({
121
+ method: z3.enum(["create", "update", "delete", "upgrade"]),
122
+ reference: z3.object({
123
+ objectType: objectTypeSchema,
124
+ /**
125
+ * ID of the objectType
126
+ */
127
+ id: uuidSchema,
128
+ /**
129
+ * Only present if the objectType is of "entry"
130
+ */
131
+ collectionId: uuidSchema.optional()
132
+ })
133
+ });
134
+ var gitTagSchema = z3.object({
135
+ id: uuidSchema,
136
+ message: z3.string(),
137
+ author: gitSignatureSchema,
138
+ datetime: z3.string().datetime()
139
+ });
166
140
  var gitCommitSchema = z3.object({
167
141
  /**
168
142
  * SHA-1 hash of the commit
169
143
  */
170
144
  hash: z3.string(),
171
- message: z3.string(),
145
+ message: gitMessageSchema,
172
146
  author: gitSignatureSchema,
173
147
  datetime: z3.string().datetime(),
174
- tag: z3.string().nullable()
175
- });
176
- var GitCommitIconNative = /* @__PURE__ */ ((GitCommitIconNative2) => {
177
- GitCommitIconNative2["INIT"] = ":tada:";
178
- GitCommitIconNative2["CREATE"] = ":heavy_plus_sign:";
179
- GitCommitIconNative2["UPDATE"] = ":wrench:";
180
- GitCommitIconNative2["DELETE"] = ":heavy_minus_sign:";
181
- return GitCommitIconNative2;
182
- })(GitCommitIconNative || {});
183
- var gitCommitIconSchema = z3.nativeEnum(GitCommitIconNative);
148
+ tag: gitTagSchema.nullable()
149
+ });
184
150
  var gitInitOptionsSchema = z3.object({
185
151
  /**
186
152
  * Use the specified name for the initial branch in the newly created repository. If not specified, fall back to the default name (currently master, but this is subject to change in the future; the name can be customized via the init.defaultBranch configuration variable).
@@ -199,7 +165,19 @@ var gitCloneOptionsSchema = z3.object({
199
165
  /**
200
166
  * Instead of pointing the newly created HEAD to the branch pointed to by the cloned repository’s HEAD, point to <name> branch instead. In a non-bare repository, this is the branch that will be checked out. --branch can also take tags and detaches the HEAD at that commit in the resulting repository.
201
167
  */
202
- branch: z3.string()
168
+ branch: z3.string(),
169
+ /**
170
+ * Make a bare Git repository. That is, instead of creating <directory> and placing the administrative files in <directory>`/.git`, make the <directory> itself the $GIT_DIR.
171
+ * Used primarily to copy an existing local repository to a server, where you want to set up the repository as a central point to work with others.
172
+ *
173
+ * The destination path for the cloned repository should end with a .git by convention.
174
+ *
175
+ * @see https://git-scm.com/book/en/v2/Git-on-the-Server-Getting-Git-on-a-Server
176
+ */
177
+ bare: z3.boolean()
178
+ });
179
+ var gitMergeOptionsSchema = z3.object({
180
+ squash: z3.boolean()
203
181
  });
204
182
  var gitSwitchOptionsSchema = z3.object({
205
183
  /**
@@ -236,14 +214,28 @@ var gitLogOptionsSchema = z3.object({
236
214
  */
237
215
  filePath: z3.string().optional()
238
216
  });
217
+ var createGitTagSchema = gitTagSchema.pick({
218
+ message: true
219
+ }).extend({
220
+ path: z3.string(),
221
+ hash: z3.string().optional()
222
+ });
223
+ var readGitTagSchema = z3.object({
224
+ path: z3.string(),
225
+ id: uuidSchema.readonly()
226
+ });
227
+ var deleteGitTagSchema = readGitTagSchema.extend({});
228
+ var countGitTagsSchema = z3.object({
229
+ path: z3.string()
230
+ });
239
231
 
240
232
  // src/schema/assetSchema.ts
241
233
  var assetFileSchema = baseFileSchema.extend({
242
234
  objectType: z4.literal(objectTypeSchema.Enum.asset).readonly(),
243
235
  name: z4.string(),
244
236
  description: z4.string(),
245
- extension: supportedAssetExtensionSchema.readonly(),
246
- mimeType: supportedAssetMimeTypeSchema.readonly(),
237
+ extension: z4.string().readonly(),
238
+ mimeType: z4.string().readonly(),
247
239
  /**
248
240
  * Total size in bytes
249
241
  */
@@ -319,9 +311,6 @@ var ValueTypeSchema = z5.enum([
319
311
  var valueContentReferenceBase = z5.object({
320
312
  id: uuidSchema
321
313
  });
322
- var valueContentReferenceWithLanguageBase = valueContentReferenceBase.extend({
323
- language: supportedLanguageSchema
324
- });
325
314
  var valueContentReferenceToAssetSchema = valueContentReferenceBase.extend({
326
315
  objectType: z5.literal(objectTypeSchema.Enum.asset)
327
316
  });
@@ -552,7 +541,6 @@ var ReferenceFieldDefinitionBaseSchema = FieldDefinitionBaseSchema.extend({
552
541
  });
553
542
  var assetFieldDefinitionSchema = ReferenceFieldDefinitionBaseSchema.extend({
554
543
  fieldType: z7.literal(FieldTypeSchema.Enum.asset),
555
- allowedMimeTypes: z7.array(supportedAssetMimeTypeSchema).min(1),
556
544
  min: z7.number().nullable(),
557
545
  max: z7.number().nullable()
558
546
  });
@@ -742,39 +730,16 @@ var constructorElekIoCoreSchema = elekIoCoreOptionsSchema.partial({
742
730
  file: true
743
731
  }).optional();
744
732
 
745
- // src/schema/gitTagSchema.ts
746
- import { z as z10 } from "zod";
747
- var gitTagSchema = z10.object({
748
- id: uuidSchema,
749
- message: z10.string(),
750
- author: gitSignatureSchema,
751
- datetime: z10.string().datetime()
752
- });
753
- var createGitTagSchema = gitTagSchema.pick({
754
- message: true
755
- }).extend({
756
- path: gitRepositoryPathSchema,
757
- hash: gitCommitSchema.shape.hash.optional()
758
- });
759
- var readGitTagSchema = z10.object({
760
- path: gitRepositoryPathSchema,
761
- id: uuidSchema.readonly()
762
- });
763
- var deleteGitTagSchema = readGitTagSchema.extend({});
764
- var countGitTagsSchema = z10.object({
765
- path: gitRepositoryPathSchema
766
- });
767
-
768
733
  // src/schema/projectSchema.ts
769
- import { z as z11 } from "zod";
770
- var projectStatusSchema = z11.enum(["foo", "bar", "todo"]);
771
- var projectSettingsSchema = z11.object({
772
- language: z11.object({
734
+ import { z as z10 } from "zod";
735
+ var projectStatusSchema = z10.enum(["foo", "bar", "todo"]);
736
+ var projectSettingsSchema = z10.object({
737
+ language: z10.object({
773
738
  default: supportedLanguageSchema,
774
- supported: z11.array(supportedLanguageSchema)
739
+ supported: z10.array(supportedLanguageSchema)
775
740
  })
776
741
  });
777
- var projectFolderSchema = z11.enum([
742
+ var projectFolderSchema = z10.enum([
778
743
  "assets",
779
744
  "collections",
780
745
  "shared-values",
@@ -783,25 +748,27 @@ var projectFolderSchema = z11.enum([
783
748
  // 'public',
784
749
  // 'theme',
785
750
  ]);
751
+ var projectBranchSchema = z10.enum(["production", "work"]);
786
752
  var projectFileSchema = baseFileSchema.extend({
787
- objectType: z11.literal(objectTypeSchema.Enum.project).readonly(),
753
+ objectType: z10.literal(objectTypeSchema.Enum.project).readonly(),
788
754
  coreVersion: versionSchema,
789
- name: z11.string().trim().min(1, "shared.projectNameRequired"),
790
- description: z11.string().trim().min(1, "shared.projectDescriptionRequired"),
755
+ name: z10.string().trim().min(1, "shared.projectNameRequired"),
756
+ description: z10.string().trim().min(1, "shared.projectDescriptionRequired"),
791
757
  version: versionSchema,
792
758
  status: projectStatusSchema,
793
759
  settings: projectSettingsSchema
794
760
  });
795
761
  var projectSchema = projectFileSchema.extend({
762
+ remoteOriginUrl: z10.string().nullable(),
796
763
  /**
797
764
  * Commit history of this Project
798
765
  */
799
- history: z11.array(gitCommitSchema),
766
+ history: z10.array(gitCommitSchema),
800
767
  /**
801
768
  * Full commit history of this Project
802
769
  * including all Assets, Collections, Entries and other files
803
770
  */
804
- fullHistory: z11.array(gitCommitSchema)
771
+ fullHistory: z10.array(gitCommitSchema)
805
772
  });
806
773
  var outdatedProjectSchema = projectFileSchema.pick({
807
774
  id: true,
@@ -809,8 +776,8 @@ var outdatedProjectSchema = projectFileSchema.pick({
809
776
  coreVersion: true
810
777
  });
811
778
  var projectExportSchema = projectSchema.extend({
812
- assets: z11.array(assetExportSchema),
813
- collections: z11.array(collectionExportSchema)
779
+ assets: z10.array(assetExportSchema),
780
+ collections: z10.array(collectionExportSchema)
814
781
  });
815
782
  var createProjectSchema = projectSchema.pick({
816
783
  name: true,
@@ -820,9 +787,9 @@ var createProjectSchema = projectSchema.pick({
820
787
  description: true,
821
788
  settings: true
822
789
  });
823
- var readProjectSchema = z11.object({
790
+ var readProjectSchema = z10.object({
824
791
  id: uuidSchema.readonly(),
825
- commitHash: z11.string().optional().readonly()
792
+ commitHash: z10.string().optional().readonly()
826
793
  });
827
794
  var updateProjectSchema = projectSchema.pick({
828
795
  id: true,
@@ -834,15 +801,17 @@ var updateProjectSchema = projectSchema.pick({
834
801
  description: true,
835
802
  settings: true
836
803
  });
837
- var upgradeProjectSchema = z11.object({
804
+ var upgradeProjectSchema = z10.object({
838
805
  id: uuidSchema.readonly(),
839
806
  /**
840
807
  * Force the upgrade even if the Project is up-to-date
841
808
  */
842
- force: z11.boolean().optional()
809
+ force: z10.boolean().optional()
810
+ });
811
+ var deleteProjectSchema = readProjectSchema.extend({
812
+ force: z10.boolean().optional()
843
813
  });
844
- var deleteProjectSchema = readProjectSchema.extend({});
845
- var projectUpgradeSchema = z11.object({
814
+ var projectUpgradeSchema = z10.object({
846
815
  /**
847
816
  * The Core version the Project will be upgraded to
848
817
  */
@@ -850,45 +819,45 @@ var projectUpgradeSchema = z11.object({
850
819
  /**
851
820
  * Function that will be executed in the process of upgrading a Project
852
821
  */
853
- run: z11.function().args(projectFileSchema).returns(z11.promise(z11.void()))
822
+ run: z10.function().args(projectFileSchema).returns(z10.promise(z10.void()))
854
823
  });
855
- var cloneProjectSchema = z11.object({
856
- url: z11.string()
824
+ var cloneProjectSchema = z10.object({
825
+ url: z10.string()
857
826
  });
858
- var listBranchesProjectSchema = z11.object({
827
+ var listBranchesProjectSchema = z10.object({
859
828
  id: uuidSchema.readonly()
860
829
  });
861
- var currentBranchProjectSchema = z11.object({
830
+ var currentBranchProjectSchema = z10.object({
862
831
  id: uuidSchema.readonly()
863
832
  });
864
- var switchBranchProjectSchema = z11.object({
833
+ var switchBranchProjectSchema = z10.object({
865
834
  id: uuidSchema.readonly(),
866
- branch: z11.string(),
835
+ branch: z10.string(),
867
836
  options: gitSwitchOptionsSchema.optional()
868
837
  });
869
- var getRemoteOriginUrlProjectSchema = z11.object({
838
+ var getRemoteOriginUrlProjectSchema = z10.object({
870
839
  id: uuidSchema.readonly()
871
840
  });
872
- var setRemoteOriginUrlProjectSchema = z11.object({
841
+ var setRemoteOriginUrlProjectSchema = z10.object({
873
842
  id: uuidSchema.readonly(),
874
- url: z11.string()
843
+ url: z10.string()
875
844
  });
876
- var getChangesProjectSchema = z11.object({
845
+ var getChangesProjectSchema = z10.object({
877
846
  id: uuidSchema.readonly()
878
847
  });
879
- var synchronizeProjectSchema = z11.object({
848
+ var synchronizeProjectSchema = z10.object({
880
849
  id: uuidSchema.readonly()
881
850
  });
882
- var searchProjectSchema = z11.object({
851
+ var searchProjectSchema = z10.object({
883
852
  id: uuidSchema.readonly(),
884
- query: z11.string(),
853
+ query: z10.string(),
885
854
  language: supportedLanguageSchema,
886
- type: z11.array(objectTypeSchema).optional()
855
+ type: z10.array(objectTypeSchema).optional()
887
856
  });
888
857
 
889
858
  // src/schema/serviceSchema.ts
890
- import { z as z12 } from "zod";
891
- var serviceTypeSchema = z12.enum([
859
+ import { z as z11 } from "zod";
860
+ var serviceTypeSchema = z11.enum([
892
861
  "Git",
893
862
  "GitTag",
894
863
  "User",
@@ -900,10 +869,10 @@ var serviceTypeSchema = z12.enum([
900
869
  "Entry",
901
870
  "Value"
902
871
  ]);
903
- var listSchema = z12.object({
872
+ var listSchema = z11.object({
904
873
  projectId: uuidSchema,
905
- limit: z12.number().optional(),
906
- offset: z12.number().optional()
874
+ limit: z11.number().optional(),
875
+ offset: z11.number().optional()
907
876
  });
908
877
  var listCollectionsSchema = listSchema;
909
878
  var listEntriesSchema = listSchema.extend({
@@ -913,33 +882,33 @@ var listAssetsSchema = listSchema;
913
882
  var listProjectsSchema = listSchema.omit({
914
883
  projectId: true
915
884
  });
916
- var listGitTagsSchema = z12.object({
917
- path: gitRepositoryPathSchema
885
+ var listGitTagsSchema = z11.object({
886
+ path: z11.string()
918
887
  });
919
888
 
920
889
  // src/schema/userSchema.ts
921
- import z13 from "zod";
922
- var UserTypeSchema = z13.enum(["local", "cloud"]);
890
+ import z12 from "zod";
891
+ var UserTypeSchema = z12.enum(["local", "cloud"]);
923
892
  var baseUserSchema = gitSignatureSchema.extend({
924
893
  userType: UserTypeSchema,
925
894
  language: supportedLanguageSchema,
926
- window: z13.object({
927
- width: z13.number(),
928
- height: z13.number(),
929
- position: z13.object({
930
- x: z13.number(),
931
- y: z13.number()
895
+ window: z12.object({
896
+ width: z12.number(),
897
+ height: z12.number(),
898
+ position: z12.object({
899
+ x: z12.number(),
900
+ y: z12.number()
932
901
  })
933
902
  }).nullable()
934
903
  });
935
904
  var localUserSchema = baseUserSchema.extend({
936
- userType: z13.literal(UserTypeSchema.Enum.local)
905
+ userType: z12.literal(UserTypeSchema.Enum.local)
937
906
  });
938
907
  var cloudUserSchema = baseUserSchema.extend({
939
- userType: z13.literal(UserTypeSchema.Enum.cloud),
908
+ userType: z12.literal(UserTypeSchema.Enum.cloud),
940
909
  id: uuidSchema
941
910
  });
942
- var userFileSchema = z13.union([localUserSchema, cloudUserSchema]);
911
+ var userFileSchema = z12.union([localUserSchema, cloudUserSchema]);
943
912
  var userSchema = userFileSchema;
944
913
  var setUserSchema = userSchema;
945
914
 
@@ -977,7 +946,6 @@ export {
977
946
  assetFileSchema,
978
947
  assetSchema,
979
948
  baseFileSchema,
980
- baseFileWithLanguageSchema,
981
949
  baseUserSchema,
982
950
  cloneProjectSchema,
983
951
  cloudUserSchema,
@@ -1020,11 +988,11 @@ export {
1020
988
  getRemoteOriginUrlProjectSchema,
1021
989
  getValueContentSchemaFromFieldDefinition,
1022
990
  gitCloneOptionsSchema,
1023
- gitCommitIconSchema,
1024
991
  gitCommitSchema,
1025
992
  gitInitOptionsSchema,
1026
993
  gitLogOptionsSchema,
1027
- gitRepositoryPathSchema,
994
+ gitMergeOptionsSchema,
995
+ gitMessageSchema,
1028
996
  gitSignatureSchema,
1029
997
  gitSwitchOptionsSchema,
1030
998
  gitTagSchema,
@@ -1040,6 +1008,7 @@ export {
1040
1008
  numberFieldDefinitionSchema,
1041
1009
  objectTypeSchema,
1042
1010
  outdatedProjectSchema,
1011
+ projectBranchSchema,
1043
1012
  projectExportSchema,
1044
1013
  projectFileSchema,
1045
1014
  projectFolderSchema,
@@ -1064,9 +1033,6 @@ export {
1064
1033
  setUserSchema,
1065
1034
  slug,
1066
1035
  stringFieldDefinitionSchema,
1067
- supportedAssetExtensionSchema,
1068
- supportedAssetMimeTypeSchema,
1069
- supportedAssetTypeSchema,
1070
1036
  supportedIconSchema,
1071
1037
  supportedLanguageSchema,
1072
1038
  switchBranchProjectSchema,
@@ -1095,7 +1061,6 @@ export {
1095
1061
  valueContentReferenceToAssetSchema,
1096
1062
  valueContentReferenceToCollectionSchema,
1097
1063
  valueContentReferenceToEntrySchema,
1098
- valueContentReferenceWithLanguageBase,
1099
1064
  valueSchema,
1100
1065
  versionSchema
1101
1066
  };