@elek-io/core 0.4.1 → 0.5.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.
- package/dist/browser/index.browser.cjs +1082 -0
- package/dist/browser/index.browser.cjs.map +1 -0
- package/dist/browser/index.browser.d.cts +12551 -0
- package/dist/browser/index.browser.d.ts +12551 -0
- package/dist/browser/index.browser.js +1049 -0
- package/dist/browser/index.browser.js.map +1 -0
- package/dist/{index.cjs → node/index.node.cjs} +1005 -1018
- package/dist/node/index.node.cjs.map +1 -0
- package/dist/{index.d.cts → node/index.node.d.cts} +3032 -3034
- package/dist/{index.d.ts → node/index.node.d.ts} +3032 -3034
- package/dist/{index.js → node/index.node.js} +1049 -1065
- package/dist/node/index.node.js.map +1 -0
- package/package.json +1 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,1082 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.browser.ts
|
|
31
|
+
var index_browser_exports = {};
|
|
32
|
+
__export(index_browser_exports, {
|
|
33
|
+
BooleanValueDefinitionBaseSchema: () => BooleanValueDefinitionBaseSchema,
|
|
34
|
+
NumberValueDefinitionBaseSchema: () => NumberValueDefinitionBaseSchema,
|
|
35
|
+
ReferenceValueDefinitionBaseSchema: () => ReferenceValueDefinitionBaseSchema,
|
|
36
|
+
StringValueDefinitionBaseSchema: () => StringValueDefinitionBaseSchema,
|
|
37
|
+
UserTypeSchema: () => UserTypeSchema,
|
|
38
|
+
ValueDefinitionBaseSchema: () => ValueDefinitionBaseSchema,
|
|
39
|
+
ValueInputTypeSchema: () => ValueInputTypeSchema,
|
|
40
|
+
ValueInputWidthSchema: () => ValueInputWidthSchema,
|
|
41
|
+
ValueTypeSchema: () => ValueTypeSchema,
|
|
42
|
+
assetExportSchema: () => assetExportSchema,
|
|
43
|
+
assetFileSchema: () => assetFileSchema,
|
|
44
|
+
assetSchema: () => assetSchema,
|
|
45
|
+
assetValueDefinitionSchema: () => assetValueDefinitionSchema,
|
|
46
|
+
baseFileSchema: () => baseFileSchema,
|
|
47
|
+
baseFileWithLanguageSchema: () => baseFileWithLanguageSchema,
|
|
48
|
+
baseUserSchema: () => baseUserSchema,
|
|
49
|
+
cloneProjectSchema: () => cloneProjectSchema,
|
|
50
|
+
cloudUserSchema: () => cloudUserSchema,
|
|
51
|
+
collectionExportSchema: () => collectionExportSchema,
|
|
52
|
+
collectionFileSchema: () => collectionFileSchema,
|
|
53
|
+
collectionSchema: () => collectionSchema,
|
|
54
|
+
constructorElekIoCoreSchema: () => constructorElekIoCoreSchema,
|
|
55
|
+
countAssetsSchema: () => countAssetsSchema,
|
|
56
|
+
countCollectionsSchema: () => countCollectionsSchema,
|
|
57
|
+
countEntriesSchema: () => countEntriesSchema,
|
|
58
|
+
countGitTagsSchema: () => countGitTagsSchema,
|
|
59
|
+
createAssetSchema: () => createAssetSchema,
|
|
60
|
+
createCollectionSchema: () => createCollectionSchema,
|
|
61
|
+
createEntrySchema: () => createEntrySchema,
|
|
62
|
+
createGitTagSchema: () => createGitTagSchema,
|
|
63
|
+
createProjectSchema: () => createProjectSchema,
|
|
64
|
+
currentBranchProjectSchema: () => currentBranchProjectSchema,
|
|
65
|
+
currentTimestamp: () => currentTimestamp,
|
|
66
|
+
dateValueDefinitionSchema: () => dateValueDefinitionSchema,
|
|
67
|
+
datetimeValueDefinitionSchema: () => datetimeValueDefinitionSchema,
|
|
68
|
+
deleteAssetSchema: () => deleteAssetSchema,
|
|
69
|
+
deleteCollectionSchema: () => deleteCollectionSchema,
|
|
70
|
+
deleteEntrySchema: () => deleteEntrySchema,
|
|
71
|
+
deleteGitTagSchema: () => deleteGitTagSchema,
|
|
72
|
+
deleteProjectSchema: () => deleteProjectSchema,
|
|
73
|
+
directBooleanValueSchema: () => directBooleanValueSchema,
|
|
74
|
+
directNumberValueSchema: () => directNumberValueSchema,
|
|
75
|
+
directStringValueSchema: () => directStringValueSchema,
|
|
76
|
+
directValueBaseSchema: () => directValueBaseSchema,
|
|
77
|
+
directValueSchema: () => directValueSchema,
|
|
78
|
+
elekIoCoreOptionsSchema: () => elekIoCoreOptionsSchema,
|
|
79
|
+
emailValueDefinitionSchema: () => emailValueDefinitionSchema,
|
|
80
|
+
entryExportSchema: () => entryExportSchema,
|
|
81
|
+
entryFileSchema: () => entryFileSchema,
|
|
82
|
+
entrySchema: () => entrySchema,
|
|
83
|
+
entryValueDefinitionSchema: () => entryValueDefinitionSchema,
|
|
84
|
+
environmentSchema: () => environmentSchema,
|
|
85
|
+
fileReferenceSchema: () => fileReferenceSchema,
|
|
86
|
+
getChangesProjectSchema: () => getChangesProjectSchema,
|
|
87
|
+
getRemoteOriginUrlProjectSchema: () => getRemoteOriginUrlProjectSchema,
|
|
88
|
+
getValueContentSchemaFromDefinition: () => getValueContentSchemaFromDefinition,
|
|
89
|
+
gitCloneOptionsSchema: () => gitCloneOptionsSchema,
|
|
90
|
+
gitCommitIconSchema: () => gitCommitIconSchema,
|
|
91
|
+
gitCommitSchema: () => gitCommitSchema,
|
|
92
|
+
gitInitOptionsSchema: () => gitInitOptionsSchema,
|
|
93
|
+
gitLogOptionsSchema: () => gitLogOptionsSchema,
|
|
94
|
+
gitRepositoryPathSchema: () => gitRepositoryPathSchema,
|
|
95
|
+
gitSignatureSchema: () => gitSignatureSchema,
|
|
96
|
+
gitSwitchOptionsSchema: () => gitSwitchOptionsSchema,
|
|
97
|
+
gitTagSchema: () => gitTagSchema,
|
|
98
|
+
ipValueDefinitionSchema: () => ipValueDefinitionSchema,
|
|
99
|
+
listAssetsSchema: () => listAssetsSchema,
|
|
100
|
+
listBranchesProjectSchema: () => listBranchesProjectSchema,
|
|
101
|
+
listCollectionsSchema: () => listCollectionsSchema,
|
|
102
|
+
listEntriesSchema: () => listEntriesSchema,
|
|
103
|
+
listGitTagsSchema: () => listGitTagsSchema,
|
|
104
|
+
listProjectsSchema: () => listProjectsSchema,
|
|
105
|
+
localUserSchema: () => localUserSchema,
|
|
106
|
+
numberValueDefinitionSchema: () => numberValueDefinitionSchema,
|
|
107
|
+
objectTypeSchema: () => objectTypeSchema,
|
|
108
|
+
projectExportSchema: () => projectExportSchema,
|
|
109
|
+
projectFileSchema: () => projectFileSchema,
|
|
110
|
+
projectFolderSchema: () => projectFolderSchema,
|
|
111
|
+
projectSchema: () => projectSchema,
|
|
112
|
+
projectSettingsSchema: () => projectSettingsSchema,
|
|
113
|
+
projectStatusSchema: () => projectStatusSchema,
|
|
114
|
+
projectUpgradeSchema: () => projectUpgradeSchema,
|
|
115
|
+
rangeValueDefinitionSchema: () => rangeValueDefinitionSchema,
|
|
116
|
+
readAssetSchema: () => readAssetSchema,
|
|
117
|
+
readCollectionSchema: () => readCollectionSchema,
|
|
118
|
+
readEntrySchema: () => readEntrySchema,
|
|
119
|
+
readGitTagSchema: () => readGitTagSchema,
|
|
120
|
+
readProjectSchema: () => readProjectSchema,
|
|
121
|
+
referencedValueSchema: () => referencedValueSchema,
|
|
122
|
+
resolvedReferencedValueSchema: () => resolvedReferencedValueSchema,
|
|
123
|
+
resolvedValueContentReferenceSchema: () => resolvedValueContentReferenceSchema,
|
|
124
|
+
resolvedValueSchema: () => resolvedValueSchema,
|
|
125
|
+
searchProjectSchema: () => searchProjectSchema,
|
|
126
|
+
serviceTypeSchema: () => serviceTypeSchema,
|
|
127
|
+
setRemoteOriginUrlProjectSchema: () => setRemoteOriginUrlProjectSchema,
|
|
128
|
+
setUserSchema: () => setUserSchema,
|
|
129
|
+
slug: () => slug,
|
|
130
|
+
stringValueDefinitionSchema: () => stringValueDefinitionSchema,
|
|
131
|
+
supportedAssetExtensionSchema: () => supportedAssetExtensionSchema,
|
|
132
|
+
supportedAssetMimeTypeSchema: () => supportedAssetMimeTypeSchema,
|
|
133
|
+
supportedAssetTypeSchema: () => supportedAssetTypeSchema,
|
|
134
|
+
supportedIconSchema: () => supportedIconSchema,
|
|
135
|
+
supportedLanguageSchema: () => supportedLanguageSchema,
|
|
136
|
+
switchBranchProjectSchema: () => switchBranchProjectSchema,
|
|
137
|
+
synchronizeProjectSchema: () => synchronizeProjectSchema,
|
|
138
|
+
telephoneValueDefinitionSchema: () => telephoneValueDefinitionSchema,
|
|
139
|
+
textValueDefinitionSchema: () => textValueDefinitionSchema,
|
|
140
|
+
textareaValueDefinitionSchema: () => textareaValueDefinitionSchema,
|
|
141
|
+
timeValueDefinitionSchema: () => timeValueDefinitionSchema,
|
|
142
|
+
toggleValueDefinitionSchema: () => toggleValueDefinitionSchema,
|
|
143
|
+
translatableArrayOf: () => translatableArrayOf,
|
|
144
|
+
translatableBooleanSchema: () => translatableBooleanSchema,
|
|
145
|
+
translatableNumberSchema: () => translatableNumberSchema,
|
|
146
|
+
translatableStringSchema: () => translatableStringSchema,
|
|
147
|
+
updateAssetSchema: () => updateAssetSchema,
|
|
148
|
+
updateCollectionSchema: () => updateCollectionSchema,
|
|
149
|
+
updateEntrySchema: () => updateEntrySchema,
|
|
150
|
+
updateProjectSchema: () => updateProjectSchema,
|
|
151
|
+
upgradeProjectSchema: () => upgradeProjectSchema,
|
|
152
|
+
urlValueDefinitionSchema: () => urlValueDefinitionSchema,
|
|
153
|
+
userFileSchema: () => userFileSchema,
|
|
154
|
+
userSchema: () => userSchema,
|
|
155
|
+
uuid: () => uuid,
|
|
156
|
+
uuidSchema: () => uuidSchema,
|
|
157
|
+
valueContentReferenceBase: () => valueContentReferenceBase,
|
|
158
|
+
valueContentReferenceSchema: () => valueContentReferenceSchema,
|
|
159
|
+
valueContentReferenceToAssetSchema: () => valueContentReferenceToAssetSchema,
|
|
160
|
+
valueContentReferenceToCollectionSchema: () => valueContentReferenceToCollectionSchema,
|
|
161
|
+
valueContentReferenceToEntrySchema: () => valueContentReferenceToEntrySchema,
|
|
162
|
+
valueContentReferenceWithLanguageBase: () => valueContentReferenceWithLanguageBase,
|
|
163
|
+
valueDefinitionSchema: () => valueDefinitionSchema,
|
|
164
|
+
valueSchema: () => valueSchema,
|
|
165
|
+
versionSchema: () => versionSchema
|
|
166
|
+
});
|
|
167
|
+
module.exports = __toCommonJS(index_browser_exports);
|
|
168
|
+
|
|
169
|
+
// src/schema/assetSchema.ts
|
|
170
|
+
var import_zod3 = __toESM(require("zod"), 1);
|
|
171
|
+
|
|
172
|
+
// src/schema/baseSchema.ts
|
|
173
|
+
var import_zod = __toESM(require("zod"), 1);
|
|
174
|
+
var environmentSchema = import_zod.default.enum(["production", "development", "test"]);
|
|
175
|
+
var supportedLanguageSchema = import_zod.default.enum([
|
|
176
|
+
/**
|
|
177
|
+
* Bulgarian
|
|
178
|
+
*/
|
|
179
|
+
"bg",
|
|
180
|
+
//
|
|
181
|
+
"cs",
|
|
182
|
+
// Czech
|
|
183
|
+
"da",
|
|
184
|
+
// Danish
|
|
185
|
+
"de",
|
|
186
|
+
// German
|
|
187
|
+
"el",
|
|
188
|
+
// Greek
|
|
189
|
+
"en",
|
|
190
|
+
// (US) English
|
|
191
|
+
"es",
|
|
192
|
+
// Spanish
|
|
193
|
+
"et",
|
|
194
|
+
// Estonian
|
|
195
|
+
"fi",
|
|
196
|
+
// Finnish
|
|
197
|
+
"fr",
|
|
198
|
+
// French
|
|
199
|
+
"hu",
|
|
200
|
+
// Hungarian
|
|
201
|
+
"it",
|
|
202
|
+
// Italian
|
|
203
|
+
"ja",
|
|
204
|
+
// Japanese
|
|
205
|
+
"lt",
|
|
206
|
+
// Lithuanian
|
|
207
|
+
"lv",
|
|
208
|
+
// Latvian
|
|
209
|
+
"nl",
|
|
210
|
+
// Dutch
|
|
211
|
+
"pl",
|
|
212
|
+
// Polish
|
|
213
|
+
"pt",
|
|
214
|
+
// Portuguese
|
|
215
|
+
"ro",
|
|
216
|
+
// Romanian
|
|
217
|
+
"ru",
|
|
218
|
+
// Russian
|
|
219
|
+
"sk",
|
|
220
|
+
// Slovak
|
|
221
|
+
"sl",
|
|
222
|
+
// Slovenian
|
|
223
|
+
"sv",
|
|
224
|
+
// Swedish
|
|
225
|
+
"zh"
|
|
226
|
+
// (Simplified) Chinese
|
|
227
|
+
]);
|
|
228
|
+
var supportedIconSchema = import_zod.default.enum(["home", "plus", "foobar"]);
|
|
229
|
+
var supportedAssetMimeTypeSchema = import_zod.default.enum([
|
|
230
|
+
"image/avif",
|
|
231
|
+
"image/gif",
|
|
232
|
+
"image/jpeg",
|
|
233
|
+
"image/png",
|
|
234
|
+
"image/svg+xml",
|
|
235
|
+
"image/webp",
|
|
236
|
+
"application/pdf",
|
|
237
|
+
"application/zip",
|
|
238
|
+
"video/mp4",
|
|
239
|
+
"video/webm",
|
|
240
|
+
"audio/webm",
|
|
241
|
+
"audio/flac"
|
|
242
|
+
]);
|
|
243
|
+
var supportedAssetExtensionSchema = import_zod.default.enum([
|
|
244
|
+
"avif",
|
|
245
|
+
"gif",
|
|
246
|
+
"jpg",
|
|
247
|
+
"jpeg",
|
|
248
|
+
"png",
|
|
249
|
+
"svg",
|
|
250
|
+
"webp",
|
|
251
|
+
"pdf",
|
|
252
|
+
"zip",
|
|
253
|
+
"mp4",
|
|
254
|
+
"webm",
|
|
255
|
+
"flac",
|
|
256
|
+
"json"
|
|
257
|
+
]);
|
|
258
|
+
var supportedAssetTypeSchema = import_zod.default.object({
|
|
259
|
+
extension: supportedAssetExtensionSchema,
|
|
260
|
+
mimeType: supportedAssetMimeTypeSchema
|
|
261
|
+
});
|
|
262
|
+
var objectTypeSchema = import_zod.default.enum([
|
|
263
|
+
"project",
|
|
264
|
+
"asset",
|
|
265
|
+
"collection",
|
|
266
|
+
"entry",
|
|
267
|
+
"value",
|
|
268
|
+
"sharedValue"
|
|
269
|
+
]);
|
|
270
|
+
var versionSchema = import_zod.default.string();
|
|
271
|
+
var uuidSchema = import_zod.default.string().uuid("shared.invalidUuid");
|
|
272
|
+
var translatableStringSchema = import_zod.default.record(
|
|
273
|
+
supportedLanguageSchema,
|
|
274
|
+
import_zod.default.string().trim().min(1, "shared.translatableStringRequired")
|
|
275
|
+
);
|
|
276
|
+
var translatableNumberSchema = import_zod.default.record(
|
|
277
|
+
supportedLanguageSchema,
|
|
278
|
+
import_zod.default.number({ required_error: "shared.translatableNumberRequired" })
|
|
279
|
+
);
|
|
280
|
+
var translatableBooleanSchema = import_zod.default.record(
|
|
281
|
+
supportedLanguageSchema,
|
|
282
|
+
import_zod.default.boolean({ required_error: "shared.translatableBooleanRequired" })
|
|
283
|
+
);
|
|
284
|
+
function translatableArrayOf(schema) {
|
|
285
|
+
return import_zod.default.record(supportedLanguageSchema, import_zod.default.array(schema));
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// src/schema/fileSchema.ts
|
|
289
|
+
var import_zod2 = __toESM(require("zod"), 1);
|
|
290
|
+
var baseFileSchema = import_zod2.default.object({
|
|
291
|
+
/**
|
|
292
|
+
* The ID of the file
|
|
293
|
+
*
|
|
294
|
+
* The ID is part of the files name.
|
|
295
|
+
*/
|
|
296
|
+
id: uuidSchema.readonly(),
|
|
297
|
+
/**
|
|
298
|
+
* The timestamp of the file being created is set by the service of "objectType" while creating it
|
|
299
|
+
*/
|
|
300
|
+
created: import_zod2.default.number().readonly(),
|
|
301
|
+
/**
|
|
302
|
+
* The timestamp of the file being updated is set by the service of "objectType" while updating it
|
|
303
|
+
*/
|
|
304
|
+
updated: import_zod2.default.number().nullable()
|
|
305
|
+
});
|
|
306
|
+
var baseFileWithLanguageSchema = baseFileSchema.extend({
|
|
307
|
+
/**
|
|
308
|
+
* The language of the file
|
|
309
|
+
*
|
|
310
|
+
* The language is part of the files name and together with it's ID the only unique identifier.
|
|
311
|
+
* That's why the language cannot be changed after creating the file.
|
|
312
|
+
*
|
|
313
|
+
* @todo Maybe remove the above restriction by implementing logic to handle changing the files language inside all services
|
|
314
|
+
*/
|
|
315
|
+
language: supportedLanguageSchema.readonly()
|
|
316
|
+
});
|
|
317
|
+
var fileReferenceSchema = import_zod2.default.object({
|
|
318
|
+
id: uuidSchema,
|
|
319
|
+
language: supportedLanguageSchema.optional(),
|
|
320
|
+
extension: supportedAssetExtensionSchema.optional()
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
// src/schema/assetSchema.ts
|
|
324
|
+
var assetFileSchema = baseFileWithLanguageSchema.extend({
|
|
325
|
+
objectType: import_zod3.default.literal(objectTypeSchema.Enum.asset).readonly(),
|
|
326
|
+
name: import_zod3.default.string(),
|
|
327
|
+
description: import_zod3.default.string(),
|
|
328
|
+
extension: supportedAssetExtensionSchema.readonly(),
|
|
329
|
+
mimeType: supportedAssetMimeTypeSchema.readonly(),
|
|
330
|
+
/**
|
|
331
|
+
* Total size in bytes
|
|
332
|
+
*/
|
|
333
|
+
size: import_zod3.default.number().readonly()
|
|
334
|
+
});
|
|
335
|
+
var assetSchema = assetFileSchema.extend({
|
|
336
|
+
/**
|
|
337
|
+
* Absolute path on this filesystem
|
|
338
|
+
*/
|
|
339
|
+
absolutePath: import_zod3.default.string().readonly()
|
|
340
|
+
});
|
|
341
|
+
var assetExportSchema = assetSchema.extend({});
|
|
342
|
+
var createAssetSchema = assetFileSchema.pick({
|
|
343
|
+
name: true,
|
|
344
|
+
description: true,
|
|
345
|
+
language: true
|
|
346
|
+
}).extend({
|
|
347
|
+
projectId: uuidSchema.readonly(),
|
|
348
|
+
/**
|
|
349
|
+
* Path of the file to add as a new Asset
|
|
350
|
+
*/
|
|
351
|
+
filePath: import_zod3.default.string().readonly()
|
|
352
|
+
});
|
|
353
|
+
var readAssetSchema = assetFileSchema.pick({
|
|
354
|
+
id: true,
|
|
355
|
+
language: true
|
|
356
|
+
}).extend({
|
|
357
|
+
projectId: uuidSchema.readonly()
|
|
358
|
+
});
|
|
359
|
+
var updateAssetSchema = assetFileSchema.pick({
|
|
360
|
+
id: true,
|
|
361
|
+
name: true,
|
|
362
|
+
description: true,
|
|
363
|
+
language: true
|
|
364
|
+
}).extend({
|
|
365
|
+
projectId: uuidSchema.readonly(),
|
|
366
|
+
/**
|
|
367
|
+
* Path of the new file to update the Asset with
|
|
368
|
+
*/
|
|
369
|
+
newFilePath: import_zod3.default.string().readonly().optional()
|
|
370
|
+
});
|
|
371
|
+
var deleteAssetSchema = assetFileSchema.pick({
|
|
372
|
+
id: true,
|
|
373
|
+
language: true,
|
|
374
|
+
extension: true
|
|
375
|
+
}).extend({
|
|
376
|
+
projectId: uuidSchema.readonly()
|
|
377
|
+
});
|
|
378
|
+
var countAssetsSchema = import_zod3.default.object({ projectId: uuidSchema.readonly() });
|
|
379
|
+
|
|
380
|
+
// src/schema/collectionSchema.ts
|
|
381
|
+
var import_zod6 = __toESM(require("zod"), 1);
|
|
382
|
+
|
|
383
|
+
// src/schema/entrySchema.ts
|
|
384
|
+
var import_zod5 = __toESM(require("zod"), 1);
|
|
385
|
+
|
|
386
|
+
// src/schema/valueSchema.ts
|
|
387
|
+
var import_zod4 = __toESM(require("zod"), 1);
|
|
388
|
+
var ValueTypeSchema = import_zod4.default.enum([
|
|
389
|
+
"string",
|
|
390
|
+
"number",
|
|
391
|
+
"boolean",
|
|
392
|
+
"reference"
|
|
393
|
+
]);
|
|
394
|
+
var ValueInputTypeSchema = import_zod4.default.enum([
|
|
395
|
+
// String
|
|
396
|
+
"text",
|
|
397
|
+
"textarea",
|
|
398
|
+
"email",
|
|
399
|
+
// 'password', @todo maybe if there is a usecase
|
|
400
|
+
"url",
|
|
401
|
+
"ip",
|
|
402
|
+
"date",
|
|
403
|
+
"time",
|
|
404
|
+
"datetime",
|
|
405
|
+
"telephone",
|
|
406
|
+
// Number
|
|
407
|
+
"number",
|
|
408
|
+
"range",
|
|
409
|
+
// Boolean
|
|
410
|
+
"toggle",
|
|
411
|
+
// Reference
|
|
412
|
+
"asset",
|
|
413
|
+
"entry"
|
|
414
|
+
// 'sharedValue', // @todo
|
|
415
|
+
]);
|
|
416
|
+
var ValueInputWidthSchema = import_zod4.default.enum(["12", "6", "4", "3"]);
|
|
417
|
+
var ValueDefinitionBaseSchema = import_zod4.default.object({
|
|
418
|
+
id: uuidSchema.readonly(),
|
|
419
|
+
label: translatableStringSchema,
|
|
420
|
+
description: translatableStringSchema,
|
|
421
|
+
isRequired: import_zod4.default.boolean(),
|
|
422
|
+
isDisabled: import_zod4.default.boolean(),
|
|
423
|
+
isUnique: import_zod4.default.boolean(),
|
|
424
|
+
inputWidth: ValueInputWidthSchema
|
|
425
|
+
});
|
|
426
|
+
var StringValueDefinitionBaseSchema = ValueDefinitionBaseSchema.extend(
|
|
427
|
+
{
|
|
428
|
+
valueType: import_zod4.default.literal(ValueTypeSchema.Enum.string),
|
|
429
|
+
defaultValue: import_zod4.default.string().nullable()
|
|
430
|
+
}
|
|
431
|
+
);
|
|
432
|
+
var textValueDefinitionSchema = StringValueDefinitionBaseSchema.extend(
|
|
433
|
+
{
|
|
434
|
+
inputType: import_zod4.default.literal(ValueInputTypeSchema.Enum.text),
|
|
435
|
+
min: import_zod4.default.number().nullable(),
|
|
436
|
+
max: import_zod4.default.number().nullable()
|
|
437
|
+
}
|
|
438
|
+
);
|
|
439
|
+
var textareaValueDefinitionSchema = StringValueDefinitionBaseSchema.extend({
|
|
440
|
+
inputType: import_zod4.default.literal(ValueInputTypeSchema.Enum.textarea),
|
|
441
|
+
min: import_zod4.default.number().nullable(),
|
|
442
|
+
max: import_zod4.default.number().nullable()
|
|
443
|
+
});
|
|
444
|
+
var emailValueDefinitionSchema = StringValueDefinitionBaseSchema.extend({
|
|
445
|
+
inputType: import_zod4.default.literal(ValueInputTypeSchema.Enum.email),
|
|
446
|
+
defaultValue: import_zod4.default.string().email().nullable()
|
|
447
|
+
});
|
|
448
|
+
var urlValueDefinitionSchema = StringValueDefinitionBaseSchema.extend({
|
|
449
|
+
inputType: import_zod4.default.literal(ValueInputTypeSchema.Enum.url),
|
|
450
|
+
defaultValue: import_zod4.default.string().url().nullable()
|
|
451
|
+
});
|
|
452
|
+
var ipValueDefinitionSchema = StringValueDefinitionBaseSchema.extend({
|
|
453
|
+
inputType: import_zod4.default.literal(ValueInputTypeSchema.Enum.ip),
|
|
454
|
+
defaultValue: import_zod4.default.string().ip().nullable()
|
|
455
|
+
});
|
|
456
|
+
var dateValueDefinitionSchema = StringValueDefinitionBaseSchema.extend(
|
|
457
|
+
{
|
|
458
|
+
inputType: import_zod4.default.literal(ValueInputTypeSchema.Enum.date),
|
|
459
|
+
defaultValue: import_zod4.default.string().date().nullable()
|
|
460
|
+
}
|
|
461
|
+
);
|
|
462
|
+
var timeValueDefinitionSchema = StringValueDefinitionBaseSchema.extend(
|
|
463
|
+
{
|
|
464
|
+
inputType: import_zod4.default.literal(ValueInputTypeSchema.Enum.time),
|
|
465
|
+
defaultValue: import_zod4.default.string().time().nullable()
|
|
466
|
+
}
|
|
467
|
+
);
|
|
468
|
+
var datetimeValueDefinitionSchema = StringValueDefinitionBaseSchema.extend({
|
|
469
|
+
inputType: import_zod4.default.literal(ValueInputTypeSchema.Enum.datetime),
|
|
470
|
+
defaultValue: import_zod4.default.string().datetime().nullable()
|
|
471
|
+
});
|
|
472
|
+
var telephoneValueDefinitionSchema = StringValueDefinitionBaseSchema.extend({
|
|
473
|
+
inputType: import_zod4.default.literal(ValueInputTypeSchema.Enum.telephone)
|
|
474
|
+
// defaultValue: z.string().e164(), @todo when zod v4 releases @see https://github.com/colinhacks/zod/pull/3476
|
|
475
|
+
});
|
|
476
|
+
var stringValueDefinitionSchema = import_zod4.default.union([
|
|
477
|
+
textValueDefinitionSchema,
|
|
478
|
+
textareaValueDefinitionSchema,
|
|
479
|
+
emailValueDefinitionSchema,
|
|
480
|
+
urlValueDefinitionSchema,
|
|
481
|
+
ipValueDefinitionSchema,
|
|
482
|
+
dateValueDefinitionSchema,
|
|
483
|
+
timeValueDefinitionSchema,
|
|
484
|
+
datetimeValueDefinitionSchema,
|
|
485
|
+
telephoneValueDefinitionSchema
|
|
486
|
+
]);
|
|
487
|
+
var NumberValueDefinitionBaseSchema = ValueDefinitionBaseSchema.extend(
|
|
488
|
+
{
|
|
489
|
+
valueType: import_zod4.default.literal(ValueTypeSchema.Enum.number),
|
|
490
|
+
min: import_zod4.default.number().nullable(),
|
|
491
|
+
max: import_zod4.default.number().nullable(),
|
|
492
|
+
isUnique: import_zod4.default.literal(false),
|
|
493
|
+
defaultValue: import_zod4.default.number().nullable()
|
|
494
|
+
}
|
|
495
|
+
);
|
|
496
|
+
var numberValueDefinitionSchema = NumberValueDefinitionBaseSchema.extend({
|
|
497
|
+
inputType: import_zod4.default.literal(ValueInputTypeSchema.Enum.number)
|
|
498
|
+
});
|
|
499
|
+
var rangeValueDefinitionSchema = NumberValueDefinitionBaseSchema.extend({
|
|
500
|
+
inputType: import_zod4.default.literal(ValueInputTypeSchema.Enum.range),
|
|
501
|
+
// Overwrite from nullable to required because a range needs min, max and default to work and is required, since it always returns a number
|
|
502
|
+
isRequired: import_zod4.default.literal(true),
|
|
503
|
+
min: import_zod4.default.number(),
|
|
504
|
+
max: import_zod4.default.number(),
|
|
505
|
+
defaultValue: import_zod4.default.number()
|
|
506
|
+
});
|
|
507
|
+
var BooleanValueDefinitionBaseSchema = ValueDefinitionBaseSchema.extend({
|
|
508
|
+
valueType: import_zod4.default.literal(ValueTypeSchema.Enum.boolean),
|
|
509
|
+
// Overwrite from nullable to required because a boolean needs a default to work and is required, since it always is either true or false
|
|
510
|
+
isRequired: import_zod4.default.literal(true),
|
|
511
|
+
defaultValue: import_zod4.default.boolean(),
|
|
512
|
+
isUnique: import_zod4.default.literal(false)
|
|
513
|
+
});
|
|
514
|
+
var toggleValueDefinitionSchema = BooleanValueDefinitionBaseSchema.extend({
|
|
515
|
+
inputType: import_zod4.default.literal(ValueInputTypeSchema.Enum.toggle)
|
|
516
|
+
});
|
|
517
|
+
var ReferenceValueDefinitionBaseSchema = ValueDefinitionBaseSchema.extend({
|
|
518
|
+
valueType: import_zod4.default.literal(ValueTypeSchema.Enum.reference)
|
|
519
|
+
});
|
|
520
|
+
var assetValueDefinitionSchema = ReferenceValueDefinitionBaseSchema.extend({
|
|
521
|
+
inputType: import_zod4.default.literal(ValueInputTypeSchema.Enum.asset),
|
|
522
|
+
allowedMimeTypes: import_zod4.default.array(supportedAssetMimeTypeSchema).min(1),
|
|
523
|
+
min: import_zod4.default.number().nullable(),
|
|
524
|
+
max: import_zod4.default.number().nullable()
|
|
525
|
+
});
|
|
526
|
+
var entryValueDefinitionSchema = ReferenceValueDefinitionBaseSchema.extend({
|
|
527
|
+
inputType: import_zod4.default.literal(ValueInputTypeSchema.Enum.entry),
|
|
528
|
+
ofCollections: import_zod4.default.array(uuidSchema),
|
|
529
|
+
min: import_zod4.default.number().nullable(),
|
|
530
|
+
max: import_zod4.default.number().nullable()
|
|
531
|
+
});
|
|
532
|
+
var valueDefinitionSchema = import_zod4.default.union([
|
|
533
|
+
stringValueDefinitionSchema,
|
|
534
|
+
numberValueDefinitionSchema,
|
|
535
|
+
rangeValueDefinitionSchema,
|
|
536
|
+
toggleValueDefinitionSchema,
|
|
537
|
+
assetValueDefinitionSchema,
|
|
538
|
+
entryValueDefinitionSchema
|
|
539
|
+
// sharedValueDefinitionSchema,
|
|
540
|
+
]);
|
|
541
|
+
var valueContentReferenceBase = import_zod4.default.object({
|
|
542
|
+
id: uuidSchema
|
|
543
|
+
});
|
|
544
|
+
var valueContentReferenceWithLanguageBase = valueContentReferenceBase.extend({
|
|
545
|
+
language: supportedLanguageSchema
|
|
546
|
+
});
|
|
547
|
+
var valueContentReferenceToAssetSchema = valueContentReferenceWithLanguageBase.extend({
|
|
548
|
+
objectType: import_zod4.default.literal(objectTypeSchema.Enum.asset)
|
|
549
|
+
});
|
|
550
|
+
var valueContentReferenceToCollectionSchema = valueContentReferenceBase.extend({
|
|
551
|
+
objectType: import_zod4.default.literal(objectTypeSchema.Enum.collection)
|
|
552
|
+
});
|
|
553
|
+
var valueContentReferenceToEntrySchema = valueContentReferenceBase.extend({
|
|
554
|
+
objectType: import_zod4.default.literal(objectTypeSchema.Enum.entry)
|
|
555
|
+
});
|
|
556
|
+
var valueContentReferenceSchema = import_zod4.default.union([
|
|
557
|
+
valueContentReferenceToAssetSchema,
|
|
558
|
+
valueContentReferenceToCollectionSchema,
|
|
559
|
+
valueContentReferenceToEntrySchema
|
|
560
|
+
// valueContentReferenceToSharedValueSchema,
|
|
561
|
+
]);
|
|
562
|
+
var resolvedValueContentReferenceSchema = import_zod4.default.union([
|
|
563
|
+
assetSchema,
|
|
564
|
+
import_zod4.default.lazy(() => entrySchema)
|
|
565
|
+
// Circular dependency / recursive type @see https://github.com/colinhacks/zod?tab=readme-ov-file#recursive-types
|
|
566
|
+
// resolvedValueContentReferenceToSharedValueSchema,
|
|
567
|
+
]);
|
|
568
|
+
var directValueBaseSchema = import_zod4.default.object({
|
|
569
|
+
objectType: import_zod4.default.literal(objectTypeSchema.Enum.value).readonly(),
|
|
570
|
+
definitionId: uuidSchema.readonly()
|
|
571
|
+
});
|
|
572
|
+
var directStringValueSchema = directValueBaseSchema.extend({
|
|
573
|
+
valueType: import_zod4.default.literal(ValueTypeSchema.Enum.string).readonly(),
|
|
574
|
+
content: translatableStringSchema
|
|
575
|
+
});
|
|
576
|
+
var directNumberValueSchema = directValueBaseSchema.extend({
|
|
577
|
+
valueType: import_zod4.default.literal(ValueTypeSchema.Enum.number).readonly(),
|
|
578
|
+
content: translatableNumberSchema
|
|
579
|
+
});
|
|
580
|
+
var directBooleanValueSchema = directValueBaseSchema.extend({
|
|
581
|
+
valueType: import_zod4.default.literal(ValueTypeSchema.Enum.boolean).readonly(),
|
|
582
|
+
content: translatableBooleanSchema
|
|
583
|
+
});
|
|
584
|
+
var directValueSchema = import_zod4.default.union([
|
|
585
|
+
directStringValueSchema,
|
|
586
|
+
directNumberValueSchema,
|
|
587
|
+
directBooleanValueSchema
|
|
588
|
+
]);
|
|
589
|
+
var referencedValueSchema = import_zod4.default.object({
|
|
590
|
+
objectType: import_zod4.default.literal(objectTypeSchema.Enum.value).readonly(),
|
|
591
|
+
definitionId: uuidSchema.readonly(),
|
|
592
|
+
valueType: import_zod4.default.literal(ValueTypeSchema.Enum.reference).readonly(),
|
|
593
|
+
content: translatableArrayOf(valueContentReferenceSchema)
|
|
594
|
+
});
|
|
595
|
+
var valueSchema = import_zod4.default.union([directValueSchema, referencedValueSchema]);
|
|
596
|
+
var resolvedReferencedValueSchema = referencedValueSchema.extend({
|
|
597
|
+
content: translatableArrayOf(resolvedValueContentReferenceSchema)
|
|
598
|
+
});
|
|
599
|
+
var resolvedValueSchema = import_zod4.default.union([
|
|
600
|
+
directValueSchema,
|
|
601
|
+
resolvedReferencedValueSchema
|
|
602
|
+
]);
|
|
603
|
+
function getValueContentSchemaFromDefinition(definition) {
|
|
604
|
+
switch (definition.valueType) {
|
|
605
|
+
case ValueTypeSchema.Enum.boolean:
|
|
606
|
+
return getBooleanValueContentSchema(definition);
|
|
607
|
+
case ValueTypeSchema.Enum.number:
|
|
608
|
+
return getNumberValueContentSchema(definition);
|
|
609
|
+
case ValueTypeSchema.Enum.string:
|
|
610
|
+
return getStringValueContentSchema(definition);
|
|
611
|
+
case ValueTypeSchema.Enum.reference:
|
|
612
|
+
return getReferenceValueContentSchema(definition);
|
|
613
|
+
default:
|
|
614
|
+
throw new Error(
|
|
615
|
+
// @ts-expect-error
|
|
616
|
+
`Error generating schema for unsupported ValueType "${definition.valueType}"`
|
|
617
|
+
);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
function getBooleanValueContentSchema(definition) {
|
|
621
|
+
return import_zod4.default.boolean();
|
|
622
|
+
}
|
|
623
|
+
function getNumberValueContentSchema(definition) {
|
|
624
|
+
let schema = import_zod4.default.number();
|
|
625
|
+
if (definition.min) {
|
|
626
|
+
schema = schema.min(definition.min);
|
|
627
|
+
}
|
|
628
|
+
if (definition.max) {
|
|
629
|
+
schema = schema.max(definition.max);
|
|
630
|
+
}
|
|
631
|
+
if (definition.isRequired === false) {
|
|
632
|
+
return schema.nullable();
|
|
633
|
+
}
|
|
634
|
+
return schema;
|
|
635
|
+
}
|
|
636
|
+
function getStringValueContentSchema(definition) {
|
|
637
|
+
let schema = import_zod4.default.string().trim();
|
|
638
|
+
if ("min" in definition && definition.min) {
|
|
639
|
+
schema = schema.min(definition.min);
|
|
640
|
+
}
|
|
641
|
+
if ("max" in definition && definition.max) {
|
|
642
|
+
schema = schema.max(definition.max);
|
|
643
|
+
}
|
|
644
|
+
switch (definition.inputType) {
|
|
645
|
+
case ValueInputTypeSchema.Enum.email:
|
|
646
|
+
schema = schema.email();
|
|
647
|
+
break;
|
|
648
|
+
case ValueInputTypeSchema.Enum.url:
|
|
649
|
+
schema = schema.url();
|
|
650
|
+
break;
|
|
651
|
+
case ValueInputTypeSchema.Enum.ip:
|
|
652
|
+
schema = schema.ip();
|
|
653
|
+
break;
|
|
654
|
+
case ValueInputTypeSchema.Enum.date:
|
|
655
|
+
schema = schema.date();
|
|
656
|
+
break;
|
|
657
|
+
case ValueInputTypeSchema.Enum.time:
|
|
658
|
+
schema = schema.time();
|
|
659
|
+
break;
|
|
660
|
+
case ValueInputTypeSchema.Enum.datetime:
|
|
661
|
+
schema = schema.datetime();
|
|
662
|
+
break;
|
|
663
|
+
case ValueInputTypeSchema.Enum.telephone:
|
|
664
|
+
break;
|
|
665
|
+
}
|
|
666
|
+
if (definition.isRequired === false) {
|
|
667
|
+
return schema.nullable();
|
|
668
|
+
}
|
|
669
|
+
return schema.min(1, "shared.stringValueRequired");
|
|
670
|
+
}
|
|
671
|
+
function getReferenceValueContentSchema(definition) {
|
|
672
|
+
let schema;
|
|
673
|
+
switch (definition.inputType) {
|
|
674
|
+
case ValueInputTypeSchema.Enum.asset:
|
|
675
|
+
{
|
|
676
|
+
schema = import_zod4.default.array(valueContentReferenceToAssetSchema);
|
|
677
|
+
}
|
|
678
|
+
break;
|
|
679
|
+
case ValueInputTypeSchema.Enum.entry:
|
|
680
|
+
{
|
|
681
|
+
schema = import_zod4.default.array(valueContentReferenceToEntrySchema);
|
|
682
|
+
}
|
|
683
|
+
break;
|
|
684
|
+
}
|
|
685
|
+
if (definition.isRequired) {
|
|
686
|
+
schema = schema.min(1, "shared.referenceRequired");
|
|
687
|
+
}
|
|
688
|
+
if (definition.min) {
|
|
689
|
+
schema = schema.min(definition.min);
|
|
690
|
+
}
|
|
691
|
+
if (definition.max) {
|
|
692
|
+
schema = schema.max(definition.max);
|
|
693
|
+
}
|
|
694
|
+
return schema;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
// src/schema/entrySchema.ts
|
|
698
|
+
var entryFileSchema = baseFileSchema.extend({
|
|
699
|
+
objectType: import_zod5.default.literal(objectTypeSchema.Enum.entry).readonly(),
|
|
700
|
+
values: import_zod5.default.array(valueSchema)
|
|
701
|
+
});
|
|
702
|
+
var entrySchema = entryFileSchema.extend({
|
|
703
|
+
values: import_zod5.default.array(import_zod5.default.lazy(() => resolvedValueSchema))
|
|
704
|
+
});
|
|
705
|
+
var entryExportSchema = entrySchema.extend({});
|
|
706
|
+
var createEntrySchema = entryFileSchema.omit({
|
|
707
|
+
id: true,
|
|
708
|
+
objectType: true,
|
|
709
|
+
created: true,
|
|
710
|
+
updated: true
|
|
711
|
+
}).extend({
|
|
712
|
+
projectId: uuidSchema.readonly(),
|
|
713
|
+
collectionId: uuidSchema.readonly(),
|
|
714
|
+
values: import_zod5.default.array(valueSchema)
|
|
715
|
+
});
|
|
716
|
+
var readEntrySchema = import_zod5.default.object({
|
|
717
|
+
id: uuidSchema.readonly(),
|
|
718
|
+
projectId: uuidSchema.readonly(),
|
|
719
|
+
collectionId: uuidSchema.readonly()
|
|
720
|
+
});
|
|
721
|
+
var updateEntrySchema = entrySchema.omit({
|
|
722
|
+
objectType: true,
|
|
723
|
+
created: true,
|
|
724
|
+
updated: true
|
|
725
|
+
}).extend({
|
|
726
|
+
projectId: uuidSchema.readonly(),
|
|
727
|
+
collectionId: uuidSchema.readonly()
|
|
728
|
+
});
|
|
729
|
+
var deleteEntrySchema = readEntrySchema.extend({});
|
|
730
|
+
var countEntriesSchema = import_zod5.default.object({
|
|
731
|
+
projectId: uuidSchema.readonly(),
|
|
732
|
+
collectionId: uuidSchema.readonly()
|
|
733
|
+
});
|
|
734
|
+
|
|
735
|
+
// src/schema/collectionSchema.ts
|
|
736
|
+
var collectionFileSchema = baseFileSchema.extend({
|
|
737
|
+
objectType: import_zod6.default.literal(objectTypeSchema.Enum.collection).readonly(),
|
|
738
|
+
name: import_zod6.default.object({
|
|
739
|
+
singular: translatableStringSchema,
|
|
740
|
+
plural: translatableStringSchema
|
|
741
|
+
}),
|
|
742
|
+
slug: import_zod6.default.object({
|
|
743
|
+
singular: import_zod6.default.string(),
|
|
744
|
+
plural: import_zod6.default.string()
|
|
745
|
+
}),
|
|
746
|
+
description: translatableStringSchema,
|
|
747
|
+
icon: supportedIconSchema,
|
|
748
|
+
valueDefinitions: import_zod6.default.array(valueDefinitionSchema)
|
|
749
|
+
});
|
|
750
|
+
var collectionSchema = collectionFileSchema.extend({});
|
|
751
|
+
var collectionExportSchema = collectionSchema.extend({
|
|
752
|
+
entries: import_zod6.default.array(entryExportSchema)
|
|
753
|
+
});
|
|
754
|
+
var createCollectionSchema = collectionSchema.omit({
|
|
755
|
+
id: true,
|
|
756
|
+
objectType: true,
|
|
757
|
+
created: true,
|
|
758
|
+
updated: true
|
|
759
|
+
}).extend({
|
|
760
|
+
projectId: uuidSchema.readonly()
|
|
761
|
+
});
|
|
762
|
+
var readCollectionSchema = import_zod6.default.object({
|
|
763
|
+
id: uuidSchema.readonly(),
|
|
764
|
+
projectId: uuidSchema.readonly()
|
|
765
|
+
});
|
|
766
|
+
var updateCollectionSchema = collectionFileSchema.pick({
|
|
767
|
+
id: true,
|
|
768
|
+
name: true,
|
|
769
|
+
slug: true,
|
|
770
|
+
description: true,
|
|
771
|
+
icon: true,
|
|
772
|
+
valueDefinitions: true
|
|
773
|
+
}).extend({
|
|
774
|
+
projectId: uuidSchema.readonly()
|
|
775
|
+
});
|
|
776
|
+
var deleteCollectionSchema = readCollectionSchema.extend({});
|
|
777
|
+
var countCollectionsSchema = import_zod6.default.object({
|
|
778
|
+
projectId: uuidSchema.readonly()
|
|
779
|
+
});
|
|
780
|
+
|
|
781
|
+
// src/schema/coreSchema.ts
|
|
782
|
+
var import_zod7 = require("zod");
|
|
783
|
+
var elekIoCoreOptionsSchema = import_zod7.z.object({
|
|
784
|
+
/**
|
|
785
|
+
* The environment elek.io Core is currently running in
|
|
786
|
+
*/
|
|
787
|
+
environment: environmentSchema,
|
|
788
|
+
/**
|
|
789
|
+
* The current version of elek.io Core
|
|
790
|
+
*/
|
|
791
|
+
version: versionSchema,
|
|
792
|
+
file: import_zod7.z.object({
|
|
793
|
+
json: import_zod7.z.object({
|
|
794
|
+
/**
|
|
795
|
+
* If set, adds indentation with spaces (number) or escape character (string)
|
|
796
|
+
* and line break characters to saved JSON files on disk, to make them easier to read.
|
|
797
|
+
* Defaults to 2 spaces of indentation.
|
|
798
|
+
*/
|
|
799
|
+
indentation: import_zod7.z.union([import_zod7.z.number(), import_zod7.z.string()])
|
|
800
|
+
})
|
|
801
|
+
})
|
|
802
|
+
});
|
|
803
|
+
var constructorElekIoCoreSchema = elekIoCoreOptionsSchema.omit({
|
|
804
|
+
version: true
|
|
805
|
+
}).partial({
|
|
806
|
+
environment: true,
|
|
807
|
+
file: true
|
|
808
|
+
}).optional();
|
|
809
|
+
|
|
810
|
+
// src/schema/gitSchema.ts
|
|
811
|
+
var import_zod8 = require("zod");
|
|
812
|
+
var gitRepositoryPathSchema = import_zod8.z.string();
|
|
813
|
+
var gitSignatureSchema = import_zod8.z.object({
|
|
814
|
+
name: import_zod8.z.string(),
|
|
815
|
+
email: import_zod8.z.string()
|
|
816
|
+
});
|
|
817
|
+
var gitCommitSchema = import_zod8.z.object({
|
|
818
|
+
/**
|
|
819
|
+
* SHA-1 hash of the commit
|
|
820
|
+
*/
|
|
821
|
+
hash: import_zod8.z.string(),
|
|
822
|
+
message: import_zod8.z.string(),
|
|
823
|
+
author: gitSignatureSchema,
|
|
824
|
+
timestamp: import_zod8.z.number(),
|
|
825
|
+
tag: import_zod8.z.string().nullable()
|
|
826
|
+
});
|
|
827
|
+
var GitCommitIconNative = /* @__PURE__ */ ((GitCommitIconNative2) => {
|
|
828
|
+
GitCommitIconNative2["INIT"] = ":tada:";
|
|
829
|
+
GitCommitIconNative2["CREATE"] = ":heavy_plus_sign:";
|
|
830
|
+
GitCommitIconNative2["UPDATE"] = ":wrench:";
|
|
831
|
+
GitCommitIconNative2["DELETE"] = ":fire:";
|
|
832
|
+
return GitCommitIconNative2;
|
|
833
|
+
})(GitCommitIconNative || {});
|
|
834
|
+
var gitCommitIconSchema = import_zod8.z.nativeEnum(GitCommitIconNative);
|
|
835
|
+
var gitInitOptionsSchema = import_zod8.z.object({
|
|
836
|
+
/**
|
|
837
|
+
* 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).
|
|
838
|
+
*/
|
|
839
|
+
initialBranch: import_zod8.z.string()
|
|
840
|
+
});
|
|
841
|
+
var gitCloneOptionsSchema = import_zod8.z.object({
|
|
842
|
+
/**
|
|
843
|
+
* Create a shallow clone with a history truncated to the specified number of commits. Implies --single-branch unless --no-single-branch is given to fetch the histories near the tips of all branches. If you want to clone submodules shallowly, also pass --shallow-submodules.
|
|
844
|
+
*/
|
|
845
|
+
depth: import_zod8.z.number(),
|
|
846
|
+
/**
|
|
847
|
+
* Clone only the history leading to the tip of a single branch, either specified by the --branch option or the primary branch remote’s HEAD points at. Further fetches into the resulting repository will only update the remote-tracking branch for the branch this option was used for the initial cloning. If the HEAD at the remote did not point at any branch when --single-branch clone was made, no remote-tracking branch is created.
|
|
848
|
+
*/
|
|
849
|
+
singleBranch: import_zod8.z.boolean(),
|
|
850
|
+
/**
|
|
851
|
+
* 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.
|
|
852
|
+
*/
|
|
853
|
+
branch: import_zod8.z.string()
|
|
854
|
+
});
|
|
855
|
+
var gitSwitchOptionsSchema = import_zod8.z.object({
|
|
856
|
+
/**
|
|
857
|
+
* If true, creates a new local branch and then switches to it
|
|
858
|
+
*
|
|
859
|
+
* @see https://git-scm.com/docs/git-switch#Documentation/git-switch.txt---createltnew-branchgt
|
|
860
|
+
*/
|
|
861
|
+
isNew: import_zod8.z.boolean().optional()
|
|
862
|
+
});
|
|
863
|
+
var gitLogOptionsSchema = import_zod8.z.object({
|
|
864
|
+
/**
|
|
865
|
+
* Limit the result to given number of commits
|
|
866
|
+
*/
|
|
867
|
+
limit: import_zod8.z.number().optional(),
|
|
868
|
+
/**
|
|
869
|
+
* Only list commits that are between given SHAs or tag names
|
|
870
|
+
*
|
|
871
|
+
* Note that the commits of from and to are not included in the result
|
|
872
|
+
*/
|
|
873
|
+
between: import_zod8.z.object({
|
|
874
|
+
/**
|
|
875
|
+
* From the oldest commit
|
|
876
|
+
*/
|
|
877
|
+
from: import_zod8.z.string(),
|
|
878
|
+
/**
|
|
879
|
+
* To the newest commit
|
|
880
|
+
*
|
|
881
|
+
* Defaults to the current HEAD
|
|
882
|
+
*/
|
|
883
|
+
to: import_zod8.z.string().optional()
|
|
884
|
+
})
|
|
885
|
+
});
|
|
886
|
+
|
|
887
|
+
// src/schema/gitTagSchema.ts
|
|
888
|
+
var import_zod9 = require("zod");
|
|
889
|
+
var gitTagSchema = import_zod9.z.object({
|
|
890
|
+
id: uuidSchema,
|
|
891
|
+
message: import_zod9.z.string(),
|
|
892
|
+
author: gitSignatureSchema,
|
|
893
|
+
timestamp: import_zod9.z.number()
|
|
894
|
+
});
|
|
895
|
+
var createGitTagSchema = gitTagSchema.pick({
|
|
896
|
+
message: true
|
|
897
|
+
}).extend({
|
|
898
|
+
path: gitRepositoryPathSchema,
|
|
899
|
+
hash: gitCommitSchema.shape.hash.optional()
|
|
900
|
+
});
|
|
901
|
+
var readGitTagSchema = import_zod9.z.object({
|
|
902
|
+
path: gitRepositoryPathSchema,
|
|
903
|
+
id: uuidSchema.readonly()
|
|
904
|
+
});
|
|
905
|
+
var deleteGitTagSchema = readGitTagSchema.extend({});
|
|
906
|
+
var countGitTagsSchema = import_zod9.z.object({
|
|
907
|
+
path: gitRepositoryPathSchema
|
|
908
|
+
});
|
|
909
|
+
|
|
910
|
+
// src/schema/projectSchema.ts
|
|
911
|
+
var import_zod10 = require("zod");
|
|
912
|
+
var projectStatusSchema = import_zod10.z.enum(["foo", "bar", "todo"]);
|
|
913
|
+
var projectSettingsSchema = import_zod10.z.object({
|
|
914
|
+
language: import_zod10.z.object({
|
|
915
|
+
default: supportedLanguageSchema,
|
|
916
|
+
supported: import_zod10.z.array(supportedLanguageSchema)
|
|
917
|
+
})
|
|
918
|
+
});
|
|
919
|
+
var projectFolderSchema = import_zod10.z.enum([
|
|
920
|
+
"assets",
|
|
921
|
+
"collections",
|
|
922
|
+
"shared-values",
|
|
923
|
+
"lfs"
|
|
924
|
+
// 'logs',
|
|
925
|
+
// 'public',
|
|
926
|
+
// 'theme',
|
|
927
|
+
]);
|
|
928
|
+
var projectFileSchema = baseFileSchema.extend({
|
|
929
|
+
objectType: import_zod10.z.literal(objectTypeSchema.Enum.project).readonly(),
|
|
930
|
+
coreVersion: versionSchema,
|
|
931
|
+
name: import_zod10.z.string().trim().min(1, "shared.projectNameRequired"),
|
|
932
|
+
description: import_zod10.z.string().trim().min(1, "shared.projectDescriptionRequired"),
|
|
933
|
+
version: versionSchema,
|
|
934
|
+
status: projectStatusSchema,
|
|
935
|
+
settings: projectSettingsSchema
|
|
936
|
+
});
|
|
937
|
+
var projectSchema = projectFileSchema.extend({});
|
|
938
|
+
var projectExportSchema = projectSchema.extend({
|
|
939
|
+
assets: import_zod10.z.array(assetExportSchema),
|
|
940
|
+
collections: import_zod10.z.array(collectionExportSchema)
|
|
941
|
+
});
|
|
942
|
+
var createProjectSchema = projectSchema.pick({
|
|
943
|
+
name: true,
|
|
944
|
+
description: true,
|
|
945
|
+
settings: true
|
|
946
|
+
}).partial({
|
|
947
|
+
description: true,
|
|
948
|
+
settings: true
|
|
949
|
+
});
|
|
950
|
+
var readProjectSchema = import_zod10.z.object({
|
|
951
|
+
id: uuidSchema.readonly()
|
|
952
|
+
});
|
|
953
|
+
var updateProjectSchema = projectSchema.pick({
|
|
954
|
+
id: true,
|
|
955
|
+
name: true,
|
|
956
|
+
description: true,
|
|
957
|
+
settings: true
|
|
958
|
+
}).partial({
|
|
959
|
+
name: true,
|
|
960
|
+
description: true,
|
|
961
|
+
settings: true
|
|
962
|
+
});
|
|
963
|
+
var upgradeProjectSchema = import_zod10.z.object({
|
|
964
|
+
id: uuidSchema.readonly()
|
|
965
|
+
});
|
|
966
|
+
var deleteProjectSchema = readProjectSchema.extend({});
|
|
967
|
+
var projectUpgradeSchema = import_zod10.z.object({
|
|
968
|
+
/**
|
|
969
|
+
* The Core version the Project will be upgraded to
|
|
970
|
+
*/
|
|
971
|
+
to: versionSchema.readonly(),
|
|
972
|
+
/**
|
|
973
|
+
* Function that will be executed in the process of upgrading a Project
|
|
974
|
+
*/
|
|
975
|
+
run: import_zod10.z.function().args(projectFileSchema).returns(import_zod10.z.promise(import_zod10.z.void()))
|
|
976
|
+
});
|
|
977
|
+
var cloneProjectSchema = import_zod10.z.object({
|
|
978
|
+
url: import_zod10.z.string()
|
|
979
|
+
});
|
|
980
|
+
var listBranchesProjectSchema = import_zod10.z.object({
|
|
981
|
+
id: uuidSchema.readonly()
|
|
982
|
+
});
|
|
983
|
+
var currentBranchProjectSchema = import_zod10.z.object({
|
|
984
|
+
id: uuidSchema.readonly()
|
|
985
|
+
});
|
|
986
|
+
var switchBranchProjectSchema = import_zod10.z.object({
|
|
987
|
+
id: uuidSchema.readonly(),
|
|
988
|
+
branch: import_zod10.z.string(),
|
|
989
|
+
options: gitSwitchOptionsSchema.optional()
|
|
990
|
+
});
|
|
991
|
+
var getRemoteOriginUrlProjectSchema = import_zod10.z.object({
|
|
992
|
+
id: uuidSchema.readonly()
|
|
993
|
+
});
|
|
994
|
+
var setRemoteOriginUrlProjectSchema = import_zod10.z.object({
|
|
995
|
+
id: uuidSchema.readonly(),
|
|
996
|
+
url: import_zod10.z.string()
|
|
997
|
+
});
|
|
998
|
+
var getChangesProjectSchema = import_zod10.z.object({
|
|
999
|
+
id: uuidSchema.readonly()
|
|
1000
|
+
});
|
|
1001
|
+
var synchronizeProjectSchema = import_zod10.z.object({
|
|
1002
|
+
id: uuidSchema.readonly()
|
|
1003
|
+
});
|
|
1004
|
+
var searchProjectSchema = import_zod10.z.object({
|
|
1005
|
+
id: uuidSchema.readonly(),
|
|
1006
|
+
query: import_zod10.z.string(),
|
|
1007
|
+
language: supportedLanguageSchema,
|
|
1008
|
+
type: import_zod10.z.array(objectTypeSchema).optional()
|
|
1009
|
+
});
|
|
1010
|
+
|
|
1011
|
+
// src/schema/serviceSchema.ts
|
|
1012
|
+
var import_zod11 = require("zod");
|
|
1013
|
+
var serviceTypeSchema = import_zod11.z.enum([
|
|
1014
|
+
"Git",
|
|
1015
|
+
"GitTag",
|
|
1016
|
+
"User",
|
|
1017
|
+
"Project",
|
|
1018
|
+
"Asset",
|
|
1019
|
+
"JsonFile",
|
|
1020
|
+
"Search",
|
|
1021
|
+
"Collection",
|
|
1022
|
+
"Entry",
|
|
1023
|
+
"Value"
|
|
1024
|
+
]);
|
|
1025
|
+
var listSchema = import_zod11.z.object({
|
|
1026
|
+
projectId: uuidSchema,
|
|
1027
|
+
limit: import_zod11.z.number().optional(),
|
|
1028
|
+
offset: import_zod11.z.number().optional()
|
|
1029
|
+
});
|
|
1030
|
+
var listCollectionsSchema = listSchema;
|
|
1031
|
+
var listEntriesSchema = listSchema.extend({
|
|
1032
|
+
collectionId: uuidSchema
|
|
1033
|
+
});
|
|
1034
|
+
var listAssetsSchema = listSchema;
|
|
1035
|
+
var listProjectsSchema = listSchema.omit({
|
|
1036
|
+
projectId: true
|
|
1037
|
+
});
|
|
1038
|
+
var listGitTagsSchema = import_zod11.z.object({
|
|
1039
|
+
path: gitRepositoryPathSchema
|
|
1040
|
+
});
|
|
1041
|
+
|
|
1042
|
+
// src/schema/userSchema.ts
|
|
1043
|
+
var import_zod12 = __toESM(require("zod"), 1);
|
|
1044
|
+
var UserTypeSchema = import_zod12.default.enum(["local", "cloud"]);
|
|
1045
|
+
var baseUserSchema = gitSignatureSchema.extend({
|
|
1046
|
+
userType: UserTypeSchema,
|
|
1047
|
+
language: supportedLanguageSchema
|
|
1048
|
+
});
|
|
1049
|
+
var localUserSchema = baseUserSchema.extend({
|
|
1050
|
+
userType: import_zod12.default.literal(UserTypeSchema.Enum.local)
|
|
1051
|
+
});
|
|
1052
|
+
var cloudUserSchema = baseUserSchema.extend({
|
|
1053
|
+
userType: import_zod12.default.literal(UserTypeSchema.Enum.cloud),
|
|
1054
|
+
id: uuidSchema
|
|
1055
|
+
});
|
|
1056
|
+
var userFileSchema = import_zod12.default.union([localUserSchema, cloudUserSchema]);
|
|
1057
|
+
var userSchema = userFileSchema;
|
|
1058
|
+
var setUserSchema = userSchema;
|
|
1059
|
+
|
|
1060
|
+
// src/util/shared.ts
|
|
1061
|
+
var import_slugify = __toESM(require("slugify"), 1);
|
|
1062
|
+
var import_uuid = require("uuid");
|
|
1063
|
+
var Slugify = import_slugify.default.default || import_slugify.default;
|
|
1064
|
+
function uuid() {
|
|
1065
|
+
return (0, import_uuid.v4)();
|
|
1066
|
+
}
|
|
1067
|
+
function currentTimestamp() {
|
|
1068
|
+
return Math.floor(Date.now() / 1e3);
|
|
1069
|
+
}
|
|
1070
|
+
function slug(string) {
|
|
1071
|
+
return Slugify(string, {
|
|
1072
|
+
replacement: "-",
|
|
1073
|
+
// replace spaces with replacement character, defaults to `-`
|
|
1074
|
+
remove: void 0,
|
|
1075
|
+
// remove characters that match regex, defaults to `undefined`
|
|
1076
|
+
lower: true,
|
|
1077
|
+
// convert to lower case, defaults to `false`
|
|
1078
|
+
strict: true
|
|
1079
|
+
// strip special characters except replacement, defaults to `false`
|
|
1080
|
+
});
|
|
1081
|
+
}
|
|
1082
|
+
//# sourceMappingURL=index.browser.cjs.map
|