@elek-io/core 0.15.1 → 0.15.2
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.d.ts +12997 -12598
- package/dist/browser/index.browser.js +1 -1140
- package/dist/browser/index.browser.js.map +1 -1
- package/dist/cli/index.cli.js +4004 -0
- package/dist/node/chunk-Bp6m_JJh.js +13 -0
- package/dist/node/index.node.d.ts +12995 -12598
- package/dist/node/index.node.js +3556 -4301
- package/dist/node/index.node.js.map +1 -1
- package/package.json +27 -20
|
@@ -1,1141 +1,2 @@
|
|
|
1
|
-
// src/schema/assetSchema.ts
|
|
2
|
-
import { z as z4 } from "@hono/zod-openapi";
|
|
3
|
-
|
|
4
|
-
// src/schema/baseSchema.ts
|
|
5
|
-
import { z } from "@hono/zod-openapi";
|
|
6
|
-
var supportedLanguageSchema = z.enum([
|
|
7
|
-
/**
|
|
8
|
-
* Bulgarian
|
|
9
|
-
*/
|
|
10
|
-
"bg",
|
|
11
|
-
//
|
|
12
|
-
"cs",
|
|
13
|
-
// Czech
|
|
14
|
-
"da",
|
|
15
|
-
// Danish
|
|
16
|
-
"de",
|
|
17
|
-
// German
|
|
18
|
-
"el",
|
|
19
|
-
// Greek
|
|
20
|
-
"en",
|
|
21
|
-
// (US) English
|
|
22
|
-
"es",
|
|
23
|
-
// Spanish
|
|
24
|
-
"et",
|
|
25
|
-
// Estonian
|
|
26
|
-
"fi",
|
|
27
|
-
// Finnish
|
|
28
|
-
"fr",
|
|
29
|
-
// French
|
|
30
|
-
"hu",
|
|
31
|
-
// Hungarian
|
|
32
|
-
"it",
|
|
33
|
-
// Italian
|
|
34
|
-
"ja",
|
|
35
|
-
// Japanese
|
|
36
|
-
"lt",
|
|
37
|
-
// Lithuanian
|
|
38
|
-
"lv",
|
|
39
|
-
// Latvian
|
|
40
|
-
"nl",
|
|
41
|
-
// Dutch
|
|
42
|
-
"pl",
|
|
43
|
-
// Polish
|
|
44
|
-
"pt",
|
|
45
|
-
// Portuguese
|
|
46
|
-
"ro",
|
|
47
|
-
// Romanian
|
|
48
|
-
"ru",
|
|
49
|
-
// Russian
|
|
50
|
-
"sk",
|
|
51
|
-
// Slovak
|
|
52
|
-
"sl",
|
|
53
|
-
// Slovenian
|
|
54
|
-
"sv",
|
|
55
|
-
// Swedish
|
|
56
|
-
"zh"
|
|
57
|
-
// (Simplified) Chinese
|
|
58
|
-
]);
|
|
59
|
-
var supportedIconSchema = z.enum(["home", "plus", "foobar"]);
|
|
60
|
-
var objectTypeSchema = z.enum([
|
|
61
|
-
"project",
|
|
62
|
-
"asset",
|
|
63
|
-
"collection",
|
|
64
|
-
"entry",
|
|
65
|
-
"value",
|
|
66
|
-
"sharedValue"
|
|
67
|
-
]);
|
|
68
|
-
var logLevelSchema = z.enum(["error", "warn", "info", "debug"]);
|
|
69
|
-
var versionSchema = z.string();
|
|
70
|
-
var uuidSchema = z.uuid("shared.invalidUuid");
|
|
71
|
-
var translatableStringSchema = z.partialRecord(
|
|
72
|
-
supportedLanguageSchema,
|
|
73
|
-
z.string().trim().min(1, "shared.translatableStringRequired")
|
|
74
|
-
);
|
|
75
|
-
var translatableNumberSchema = z.partialRecord(
|
|
76
|
-
supportedLanguageSchema,
|
|
77
|
-
z.number({
|
|
78
|
-
error: (error) => error.input === void 0 ? "shared.translatableNumberRequired" : "shared.translatableNumberNotANumber"
|
|
79
|
-
})
|
|
80
|
-
);
|
|
81
|
-
var translatableBooleanSchema = z.partialRecord(
|
|
82
|
-
supportedLanguageSchema,
|
|
83
|
-
z.boolean({
|
|
84
|
-
error: (error) => error.input === void 0 ? "shared.translatableBooleanRequired" : "shared.translatableBooleanNotABoolean"
|
|
85
|
-
})
|
|
86
|
-
);
|
|
87
|
-
function translatableArrayOf(schema) {
|
|
88
|
-
return z.partialRecord(supportedLanguageSchema, z.array(schema));
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// src/schema/fileSchema.ts
|
|
92
|
-
import { z as z2 } from "@hono/zod-openapi";
|
|
93
|
-
var baseFileSchema = z2.object({
|
|
94
|
-
/**
|
|
95
|
-
* The object type of the file
|
|
96
|
-
*/
|
|
97
|
-
objectType: objectTypeSchema.readonly(),
|
|
98
|
-
/**
|
|
99
|
-
* The ID of the file
|
|
100
|
-
*
|
|
101
|
-
* The ID is part of the files name.
|
|
102
|
-
*/
|
|
103
|
-
id: uuidSchema.readonly(),
|
|
104
|
-
/**
|
|
105
|
-
* The datetime of the file being created is set by the service of "objectType" while creating it
|
|
106
|
-
*/
|
|
107
|
-
created: z2.string().datetime().readonly(),
|
|
108
|
-
/**
|
|
109
|
-
* The datetime of the file being updated is set by the service of "objectType" while updating it
|
|
110
|
-
*/
|
|
111
|
-
updated: z2.string().datetime().nullable()
|
|
112
|
-
});
|
|
113
|
-
var fileReferenceSchema = z2.object({
|
|
114
|
-
id: uuidSchema,
|
|
115
|
-
extension: z2.string().optional()
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
// src/schema/gitSchema.ts
|
|
119
|
-
import { z as z3 } from "@hono/zod-openapi";
|
|
120
|
-
var gitSignatureSchema = z3.object({
|
|
121
|
-
name: z3.string(),
|
|
122
|
-
email: z3.string().email()
|
|
123
|
-
});
|
|
124
|
-
var gitMessageSchema = z3.object({
|
|
125
|
-
method: z3.enum(["create", "update", "delete", "upgrade"]),
|
|
126
|
-
reference: z3.object({
|
|
127
|
-
objectType: objectTypeSchema,
|
|
128
|
-
/**
|
|
129
|
-
* ID of the objectType
|
|
130
|
-
*/
|
|
131
|
-
id: uuidSchema,
|
|
132
|
-
/**
|
|
133
|
-
* Only present if the objectType is of "entry"
|
|
134
|
-
*/
|
|
135
|
-
collectionId: uuidSchema.optional()
|
|
136
|
-
})
|
|
137
|
-
});
|
|
138
|
-
var gitTagSchema = z3.object({
|
|
139
|
-
id: uuidSchema,
|
|
140
|
-
message: z3.string(),
|
|
141
|
-
author: gitSignatureSchema,
|
|
142
|
-
datetime: z3.string().datetime()
|
|
143
|
-
});
|
|
144
|
-
var gitCommitSchema = z3.object({
|
|
145
|
-
/**
|
|
146
|
-
* SHA-1 hash of the commit
|
|
147
|
-
*/
|
|
148
|
-
hash: z3.string(),
|
|
149
|
-
message: gitMessageSchema,
|
|
150
|
-
author: gitSignatureSchema,
|
|
151
|
-
datetime: z3.string().datetime(),
|
|
152
|
-
tag: gitTagSchema.nullable()
|
|
153
|
-
});
|
|
154
|
-
var gitInitOptionsSchema = z3.object({
|
|
155
|
-
/**
|
|
156
|
-
* 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).
|
|
157
|
-
*/
|
|
158
|
-
initialBranch: z3.string()
|
|
159
|
-
});
|
|
160
|
-
var gitCloneOptionsSchema = z3.object({
|
|
161
|
-
/**
|
|
162
|
-
* 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.
|
|
163
|
-
*/
|
|
164
|
-
depth: z3.number(),
|
|
165
|
-
/**
|
|
166
|
-
* 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.
|
|
167
|
-
*/
|
|
168
|
-
singleBranch: z3.boolean(),
|
|
169
|
-
/**
|
|
170
|
-
* 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.
|
|
171
|
-
*/
|
|
172
|
-
branch: z3.string(),
|
|
173
|
-
/**
|
|
174
|
-
* 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.
|
|
175
|
-
* 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.
|
|
176
|
-
*
|
|
177
|
-
* The destination path for the cloned repository should end with a .git by convention.
|
|
178
|
-
*
|
|
179
|
-
* @see https://git-scm.com/book/en/v2/Git-on-the-Server-Getting-Git-on-a-Server
|
|
180
|
-
*/
|
|
181
|
-
bare: z3.boolean()
|
|
182
|
-
});
|
|
183
|
-
var gitMergeOptionsSchema = z3.object({
|
|
184
|
-
squash: z3.boolean()
|
|
185
|
-
});
|
|
186
|
-
var gitSwitchOptionsSchema = z3.object({
|
|
187
|
-
/**
|
|
188
|
-
* If true, creates a new local branch and then switches to it
|
|
189
|
-
*
|
|
190
|
-
* @see https://git-scm.com/docs/git-switch#Documentation/git-switch.txt---createltnew-branchgt
|
|
191
|
-
*/
|
|
192
|
-
isNew: z3.boolean().optional()
|
|
193
|
-
});
|
|
194
|
-
var gitLogOptionsSchema = z3.object({
|
|
195
|
-
/**
|
|
196
|
-
* Limit the result to given number of commits
|
|
197
|
-
*/
|
|
198
|
-
limit: z3.number().optional(),
|
|
199
|
-
/**
|
|
200
|
-
* Only list commits that are between given SHAs or tag names
|
|
201
|
-
*
|
|
202
|
-
* Note that the commits of from and to are not included in the result
|
|
203
|
-
*/
|
|
204
|
-
between: z3.object({
|
|
205
|
-
/**
|
|
206
|
-
* From the oldest commit
|
|
207
|
-
*/
|
|
208
|
-
from: z3.string(),
|
|
209
|
-
/**
|
|
210
|
-
* To the newest commit
|
|
211
|
-
*
|
|
212
|
-
* Defaults to the current HEAD
|
|
213
|
-
*/
|
|
214
|
-
to: z3.string().optional()
|
|
215
|
-
}),
|
|
216
|
-
/**
|
|
217
|
-
* Only shows commits of given file
|
|
218
|
-
*/
|
|
219
|
-
filePath: z3.string().optional()
|
|
220
|
-
});
|
|
221
|
-
var createGitTagSchema = gitTagSchema.pick({
|
|
222
|
-
message: true
|
|
223
|
-
}).extend({
|
|
224
|
-
path: z3.string(),
|
|
225
|
-
hash: z3.string().optional()
|
|
226
|
-
});
|
|
227
|
-
var readGitTagSchema = z3.object({
|
|
228
|
-
path: z3.string(),
|
|
229
|
-
id: uuidSchema.readonly()
|
|
230
|
-
});
|
|
231
|
-
var deleteGitTagSchema = readGitTagSchema.extend({});
|
|
232
|
-
var countGitTagsSchema = z3.object({
|
|
233
|
-
path: z3.string()
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
// src/schema/assetSchema.ts
|
|
237
|
-
var assetFileSchema = baseFileSchema.extend({
|
|
238
|
-
objectType: z4.literal(objectTypeSchema.enum.asset).readonly(),
|
|
239
|
-
name: z4.string(),
|
|
240
|
-
description: z4.string(),
|
|
241
|
-
extension: z4.string().readonly(),
|
|
242
|
-
mimeType: z4.string().readonly(),
|
|
243
|
-
/**
|
|
244
|
-
* Total size in bytes
|
|
245
|
-
*/
|
|
246
|
-
size: z4.number().readonly()
|
|
247
|
-
});
|
|
248
|
-
var assetSchema = assetFileSchema.extend({
|
|
249
|
-
/**
|
|
250
|
-
* Absolute path on this filesystem
|
|
251
|
-
*/
|
|
252
|
-
absolutePath: z4.string().readonly(),
|
|
253
|
-
/**
|
|
254
|
-
* Commit history of this Asset
|
|
255
|
-
*/
|
|
256
|
-
history: z4.array(gitCommitSchema)
|
|
257
|
-
}).openapi("Asset");
|
|
258
|
-
var assetExportSchema = assetSchema.extend({});
|
|
259
|
-
var createAssetSchema = assetFileSchema.pick({
|
|
260
|
-
name: true,
|
|
261
|
-
description: true
|
|
262
|
-
}).extend({
|
|
263
|
-
projectId: uuidSchema.readonly(),
|
|
264
|
-
/**
|
|
265
|
-
* Path of the file to add as a new Asset
|
|
266
|
-
*/
|
|
267
|
-
filePath: z4.string().readonly()
|
|
268
|
-
});
|
|
269
|
-
var readAssetSchema = assetFileSchema.pick({
|
|
270
|
-
id: true
|
|
271
|
-
}).extend({
|
|
272
|
-
projectId: uuidSchema.readonly(),
|
|
273
|
-
commitHash: z4.string().optional().readonly()
|
|
274
|
-
});
|
|
275
|
-
var saveAssetSchema = assetFileSchema.pick({
|
|
276
|
-
id: true
|
|
277
|
-
}).extend({
|
|
278
|
-
projectId: uuidSchema.readonly(),
|
|
279
|
-
filePath: z4.string().readonly(),
|
|
280
|
-
commitHash: z4.string().optional().readonly()
|
|
281
|
-
});
|
|
282
|
-
var updateAssetSchema = assetFileSchema.pick({
|
|
283
|
-
id: true,
|
|
284
|
-
name: true,
|
|
285
|
-
description: true
|
|
286
|
-
}).extend({
|
|
287
|
-
projectId: uuidSchema.readonly(),
|
|
288
|
-
/**
|
|
289
|
-
* Path of the new file to update the Asset with
|
|
290
|
-
*/
|
|
291
|
-
newFilePath: z4.string().readonly().optional()
|
|
292
|
-
});
|
|
293
|
-
var deleteAssetSchema = assetFileSchema.pick({
|
|
294
|
-
id: true,
|
|
295
|
-
extension: true
|
|
296
|
-
}).extend({
|
|
297
|
-
projectId: uuidSchema.readonly()
|
|
298
|
-
});
|
|
299
|
-
var countAssetsSchema = z4.object({ projectId: uuidSchema.readonly() });
|
|
300
|
-
|
|
301
|
-
// src/schema/collectionSchema.ts
|
|
302
|
-
import { z as z8 } from "@hono/zod-openapi";
|
|
303
|
-
|
|
304
|
-
// src/schema/entrySchema.ts
|
|
305
|
-
import { z as z6 } from "@hono/zod-openapi";
|
|
306
|
-
|
|
307
|
-
// src/schema/valueSchema.ts
|
|
308
|
-
import { z as z5 } from "@hono/zod-openapi";
|
|
309
|
-
var ValueTypeSchema = z5.enum([
|
|
310
|
-
"string",
|
|
311
|
-
"number",
|
|
312
|
-
"boolean",
|
|
313
|
-
"reference"
|
|
314
|
-
]);
|
|
315
|
-
var valueContentReferenceBase = z5.object({
|
|
316
|
-
id: uuidSchema
|
|
317
|
-
});
|
|
318
|
-
var valueContentReferenceToAssetSchema = valueContentReferenceBase.extend({
|
|
319
|
-
objectType: z5.literal(objectTypeSchema.enum.asset)
|
|
320
|
-
});
|
|
321
|
-
var valueContentReferenceToCollectionSchema = valueContentReferenceBase.extend({
|
|
322
|
-
objectType: z5.literal(objectTypeSchema.enum.collection)
|
|
323
|
-
});
|
|
324
|
-
var valueContentReferenceToEntrySchema = valueContentReferenceBase.extend({
|
|
325
|
-
objectType: z5.literal(objectTypeSchema.enum.entry)
|
|
326
|
-
});
|
|
327
|
-
var valueContentReferenceSchema = z5.union([
|
|
328
|
-
valueContentReferenceToAssetSchema,
|
|
329
|
-
valueContentReferenceToCollectionSchema,
|
|
330
|
-
valueContentReferenceToEntrySchema
|
|
331
|
-
// valueContentReferenceToSharedValueSchema,
|
|
332
|
-
]);
|
|
333
|
-
var directValueBaseSchema = z5.object({
|
|
334
|
-
objectType: z5.literal(objectTypeSchema.enum.value).readonly(),
|
|
335
|
-
fieldDefinitionId: uuidSchema.readonly()
|
|
336
|
-
});
|
|
337
|
-
var directStringValueSchema = directValueBaseSchema.extend({
|
|
338
|
-
valueType: z5.literal(ValueTypeSchema.enum.string).readonly(),
|
|
339
|
-
content: translatableStringSchema
|
|
340
|
-
});
|
|
341
|
-
var directNumberValueSchema = directValueBaseSchema.extend({
|
|
342
|
-
valueType: z5.literal(ValueTypeSchema.enum.number).readonly(),
|
|
343
|
-
content: translatableNumberSchema
|
|
344
|
-
});
|
|
345
|
-
var directBooleanValueSchema = directValueBaseSchema.extend({
|
|
346
|
-
valueType: z5.literal(ValueTypeSchema.enum.boolean).readonly(),
|
|
347
|
-
content: translatableBooleanSchema
|
|
348
|
-
});
|
|
349
|
-
var directValueSchema = z5.union([
|
|
350
|
-
directStringValueSchema,
|
|
351
|
-
directNumberValueSchema,
|
|
352
|
-
directBooleanValueSchema
|
|
353
|
-
]);
|
|
354
|
-
var referencedValueSchema = z5.object({
|
|
355
|
-
objectType: z5.literal(objectTypeSchema.enum.value).readonly(),
|
|
356
|
-
fieldDefinitionId: uuidSchema.readonly(),
|
|
357
|
-
valueType: z5.literal(ValueTypeSchema.enum.reference).readonly(),
|
|
358
|
-
content: translatableArrayOf(valueContentReferenceSchema)
|
|
359
|
-
});
|
|
360
|
-
var valueSchema = z5.union([directValueSchema, referencedValueSchema]);
|
|
361
|
-
|
|
362
|
-
// src/schema/entrySchema.ts
|
|
363
|
-
var entryFileSchema = baseFileSchema.extend({
|
|
364
|
-
objectType: z6.literal(objectTypeSchema.enum.entry).readonly(),
|
|
365
|
-
values: z6.array(valueSchema)
|
|
366
|
-
});
|
|
367
|
-
var entrySchema = entryFileSchema.extend({
|
|
368
|
-
/**
|
|
369
|
-
* Commit history of this Entry
|
|
370
|
-
*/
|
|
371
|
-
history: z6.array(gitCommitSchema)
|
|
372
|
-
}).openapi("Entry");
|
|
373
|
-
var entryExportSchema = entrySchema.extend({});
|
|
374
|
-
var createEntrySchema = entryFileSchema.omit({
|
|
375
|
-
id: true,
|
|
376
|
-
objectType: true,
|
|
377
|
-
created: true,
|
|
378
|
-
updated: true
|
|
379
|
-
}).extend({
|
|
380
|
-
projectId: uuidSchema.readonly(),
|
|
381
|
-
collectionId: uuidSchema.readonly(),
|
|
382
|
-
values: z6.array(valueSchema)
|
|
383
|
-
});
|
|
384
|
-
var readEntrySchema = z6.object({
|
|
385
|
-
id: uuidSchema.readonly(),
|
|
386
|
-
projectId: uuidSchema.readonly(),
|
|
387
|
-
collectionId: uuidSchema.readonly(),
|
|
388
|
-
commitHash: z6.string().optional().readonly()
|
|
389
|
-
});
|
|
390
|
-
var updateEntrySchema = entryFileSchema.omit({
|
|
391
|
-
objectType: true,
|
|
392
|
-
created: true,
|
|
393
|
-
updated: true
|
|
394
|
-
}).extend({
|
|
395
|
-
projectId: uuidSchema.readonly(),
|
|
396
|
-
collectionId: uuidSchema.readonly()
|
|
397
|
-
});
|
|
398
|
-
var deleteEntrySchema = readEntrySchema.extend({});
|
|
399
|
-
var countEntriesSchema = z6.object({
|
|
400
|
-
projectId: uuidSchema.readonly(),
|
|
401
|
-
collectionId: uuidSchema.readonly()
|
|
402
|
-
});
|
|
403
|
-
|
|
404
|
-
// src/schema/fieldSchema.ts
|
|
405
|
-
import { z as z7 } from "@hono/zod-openapi";
|
|
406
|
-
var FieldTypeSchema = z7.enum([
|
|
407
|
-
// String Values
|
|
408
|
-
"text",
|
|
409
|
-
"textarea",
|
|
410
|
-
"email",
|
|
411
|
-
// 'password', @todo maybe if there is a usecase
|
|
412
|
-
"url",
|
|
413
|
-
"ipv4",
|
|
414
|
-
"date",
|
|
415
|
-
"time",
|
|
416
|
-
"datetime",
|
|
417
|
-
"telephone",
|
|
418
|
-
// Number Values
|
|
419
|
-
"number",
|
|
420
|
-
"range",
|
|
421
|
-
// Boolean Values
|
|
422
|
-
"toggle",
|
|
423
|
-
// Reference Values
|
|
424
|
-
"asset",
|
|
425
|
-
"entry"
|
|
426
|
-
// 'sharedValue', // @todo
|
|
427
|
-
]);
|
|
428
|
-
var FieldWidthSchema = z7.enum(["12", "6", "4", "3"]);
|
|
429
|
-
var FieldDefinitionBaseSchema = z7.object({
|
|
430
|
-
id: uuidSchema.readonly(),
|
|
431
|
-
label: translatableStringSchema,
|
|
432
|
-
description: translatableStringSchema.nullable(),
|
|
433
|
-
isRequired: z7.boolean(),
|
|
434
|
-
isDisabled: z7.boolean(),
|
|
435
|
-
isUnique: z7.boolean(),
|
|
436
|
-
inputWidth: FieldWidthSchema
|
|
437
|
-
});
|
|
438
|
-
var StringFieldDefinitionBaseSchema = FieldDefinitionBaseSchema.extend(
|
|
439
|
-
{
|
|
440
|
-
valueType: z7.literal(ValueTypeSchema.enum.string),
|
|
441
|
-
defaultValue: z7.string().nullable()
|
|
442
|
-
}
|
|
443
|
-
);
|
|
444
|
-
var textFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend(
|
|
445
|
-
{
|
|
446
|
-
fieldType: z7.literal(FieldTypeSchema.enum.text),
|
|
447
|
-
min: z7.number().nullable(),
|
|
448
|
-
max: z7.number().nullable()
|
|
449
|
-
}
|
|
450
|
-
);
|
|
451
|
-
var textareaFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
|
|
452
|
-
fieldType: z7.literal(FieldTypeSchema.enum.textarea),
|
|
453
|
-
min: z7.number().nullable(),
|
|
454
|
-
max: z7.number().nullable()
|
|
455
|
-
});
|
|
456
|
-
var emailFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
|
|
457
|
-
fieldType: z7.literal(FieldTypeSchema.enum.email),
|
|
458
|
-
defaultValue: z7.email().nullable()
|
|
459
|
-
});
|
|
460
|
-
var urlFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
|
|
461
|
-
fieldType: z7.literal(FieldTypeSchema.enum.url),
|
|
462
|
-
defaultValue: z7.url().nullable()
|
|
463
|
-
});
|
|
464
|
-
var ipv4FieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend(
|
|
465
|
-
{
|
|
466
|
-
fieldType: z7.literal(FieldTypeSchema.enum.ipv4),
|
|
467
|
-
defaultValue: z7.ipv4().nullable()
|
|
468
|
-
}
|
|
469
|
-
);
|
|
470
|
-
var dateFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend(
|
|
471
|
-
{
|
|
472
|
-
fieldType: z7.literal(FieldTypeSchema.enum.date),
|
|
473
|
-
defaultValue: z7.iso.date().nullable()
|
|
474
|
-
}
|
|
475
|
-
);
|
|
476
|
-
var timeFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend(
|
|
477
|
-
{
|
|
478
|
-
fieldType: z7.literal(FieldTypeSchema.enum.time),
|
|
479
|
-
defaultValue: z7.iso.time().nullable()
|
|
480
|
-
}
|
|
481
|
-
);
|
|
482
|
-
var datetimeFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
|
|
483
|
-
fieldType: z7.literal(FieldTypeSchema.enum.datetime),
|
|
484
|
-
defaultValue: z7.iso.datetime().nullable()
|
|
485
|
-
});
|
|
486
|
-
var telephoneFieldDefinitionSchema = StringFieldDefinitionBaseSchema.extend({
|
|
487
|
-
fieldType: z7.literal(FieldTypeSchema.enum.telephone),
|
|
488
|
-
defaultValue: z7.e164().nullable()
|
|
489
|
-
});
|
|
490
|
-
var stringFieldDefinitionSchema = z7.union([
|
|
491
|
-
textFieldDefinitionSchema,
|
|
492
|
-
textareaFieldDefinitionSchema,
|
|
493
|
-
emailFieldDefinitionSchema,
|
|
494
|
-
urlFieldDefinitionSchema,
|
|
495
|
-
ipv4FieldDefinitionSchema,
|
|
496
|
-
dateFieldDefinitionSchema,
|
|
497
|
-
timeFieldDefinitionSchema,
|
|
498
|
-
datetimeFieldDefinitionSchema,
|
|
499
|
-
telephoneFieldDefinitionSchema
|
|
500
|
-
]);
|
|
501
|
-
var NumberFieldDefinitionBaseSchema = FieldDefinitionBaseSchema.extend(
|
|
502
|
-
{
|
|
503
|
-
valueType: z7.literal(ValueTypeSchema.enum.number),
|
|
504
|
-
min: z7.number().nullable(),
|
|
505
|
-
max: z7.number().nullable(),
|
|
506
|
-
isUnique: z7.literal(false),
|
|
507
|
-
defaultValue: z7.number().nullable()
|
|
508
|
-
}
|
|
509
|
-
);
|
|
510
|
-
var numberFieldDefinitionSchema = NumberFieldDefinitionBaseSchema.extend({
|
|
511
|
-
fieldType: z7.literal(FieldTypeSchema.enum.number)
|
|
512
|
-
});
|
|
513
|
-
var rangeFieldDefinitionSchema = NumberFieldDefinitionBaseSchema.extend({
|
|
514
|
-
fieldType: z7.literal(FieldTypeSchema.enum.range),
|
|
515
|
-
// Overwrite from nullable to required because a range needs min, max and default to work and is required, since it always returns a number
|
|
516
|
-
isRequired: z7.literal(true),
|
|
517
|
-
min: z7.number(),
|
|
518
|
-
max: z7.number(),
|
|
519
|
-
defaultValue: z7.number()
|
|
520
|
-
});
|
|
521
|
-
var BooleanFieldDefinitionBaseSchema = FieldDefinitionBaseSchema.extend({
|
|
522
|
-
valueType: z7.literal(ValueTypeSchema.enum.boolean),
|
|
523
|
-
// Overwrite from nullable to required because a boolean needs a default to work and is required, since it always is either true or false
|
|
524
|
-
isRequired: z7.literal(true),
|
|
525
|
-
defaultValue: z7.boolean(),
|
|
526
|
-
isUnique: z7.literal(false)
|
|
527
|
-
});
|
|
528
|
-
var toggleFieldDefinitionSchema = BooleanFieldDefinitionBaseSchema.extend({
|
|
529
|
-
fieldType: z7.literal(FieldTypeSchema.enum.toggle)
|
|
530
|
-
});
|
|
531
|
-
var ReferenceFieldDefinitionBaseSchema = FieldDefinitionBaseSchema.extend({
|
|
532
|
-
valueType: z7.literal(ValueTypeSchema.enum.reference)
|
|
533
|
-
});
|
|
534
|
-
var assetFieldDefinitionSchema = ReferenceFieldDefinitionBaseSchema.extend({
|
|
535
|
-
fieldType: z7.literal(FieldTypeSchema.enum.asset),
|
|
536
|
-
min: z7.number().nullable(),
|
|
537
|
-
max: z7.number().nullable()
|
|
538
|
-
});
|
|
539
|
-
var entryFieldDefinitionSchema = ReferenceFieldDefinitionBaseSchema.extend({
|
|
540
|
-
fieldType: z7.literal(FieldTypeSchema.enum.entry),
|
|
541
|
-
ofCollections: z7.array(uuidSchema),
|
|
542
|
-
min: z7.number().nullable(),
|
|
543
|
-
max: z7.number().nullable()
|
|
544
|
-
});
|
|
545
|
-
var fieldDefinitionSchema = z7.union([
|
|
546
|
-
stringFieldDefinitionSchema,
|
|
547
|
-
numberFieldDefinitionSchema,
|
|
548
|
-
rangeFieldDefinitionSchema,
|
|
549
|
-
toggleFieldDefinitionSchema,
|
|
550
|
-
assetFieldDefinitionSchema,
|
|
551
|
-
entryFieldDefinitionSchema
|
|
552
|
-
// sharedValueDefinitionSchema,
|
|
553
|
-
]);
|
|
554
|
-
|
|
555
|
-
// src/schema/collectionSchema.ts
|
|
556
|
-
var collectionFileSchema = baseFileSchema.extend({
|
|
557
|
-
objectType: z8.literal(objectTypeSchema.enum.collection).readonly(),
|
|
558
|
-
name: z8.object({
|
|
559
|
-
singular: translatableStringSchema,
|
|
560
|
-
plural: translatableStringSchema
|
|
561
|
-
}),
|
|
562
|
-
slug: z8.object({
|
|
563
|
-
singular: z8.string(),
|
|
564
|
-
plural: z8.string()
|
|
565
|
-
}),
|
|
566
|
-
description: translatableStringSchema,
|
|
567
|
-
icon: supportedIconSchema,
|
|
568
|
-
fieldDefinitions: z8.array(fieldDefinitionSchema)
|
|
569
|
-
});
|
|
570
|
-
var collectionSchema = collectionFileSchema.extend({
|
|
571
|
-
/**
|
|
572
|
-
* Commit history of this Collection
|
|
573
|
-
*/
|
|
574
|
-
history: z8.array(gitCommitSchema)
|
|
575
|
-
}).openapi("Collection");
|
|
576
|
-
var collectionExportSchema = collectionSchema.extend({
|
|
577
|
-
entries: z8.array(entryExportSchema)
|
|
578
|
-
});
|
|
579
|
-
var createCollectionSchema = collectionFileSchema.omit({
|
|
580
|
-
id: true,
|
|
581
|
-
objectType: true,
|
|
582
|
-
created: true,
|
|
583
|
-
updated: true
|
|
584
|
-
}).extend({
|
|
585
|
-
projectId: uuidSchema.readonly()
|
|
586
|
-
});
|
|
587
|
-
var readCollectionSchema = z8.object({
|
|
588
|
-
id: uuidSchema.readonly(),
|
|
589
|
-
projectId: uuidSchema.readonly(),
|
|
590
|
-
commitHash: z8.string().optional().readonly()
|
|
591
|
-
});
|
|
592
|
-
var updateCollectionSchema = collectionFileSchema.pick({
|
|
593
|
-
id: true,
|
|
594
|
-
name: true,
|
|
595
|
-
slug: true,
|
|
596
|
-
description: true,
|
|
597
|
-
icon: true,
|
|
598
|
-
fieldDefinitions: true
|
|
599
|
-
}).extend({
|
|
600
|
-
projectId: uuidSchema.readonly()
|
|
601
|
-
});
|
|
602
|
-
var deleteCollectionSchema = readCollectionSchema.extend({});
|
|
603
|
-
var countCollectionsSchema = z8.object({
|
|
604
|
-
projectId: uuidSchema.readonly()
|
|
605
|
-
});
|
|
606
|
-
|
|
607
|
-
// src/schema/coreSchema.ts
|
|
608
|
-
import { z as z9 } from "@hono/zod-openapi";
|
|
609
|
-
var elekIoCoreOptionsSchema = z9.object({
|
|
610
|
-
log: z9.object({
|
|
611
|
-
/**
|
|
612
|
-
* The lowest level that should be logged
|
|
613
|
-
*
|
|
614
|
-
* @default 'info'
|
|
615
|
-
*/
|
|
616
|
-
level: logLevelSchema
|
|
617
|
-
}),
|
|
618
|
-
file: z9.object({
|
|
619
|
-
/**
|
|
620
|
-
* If set to true, caches files in memory to speed up access
|
|
621
|
-
*
|
|
622
|
-
* @default true
|
|
623
|
-
*/
|
|
624
|
-
cache: z9.boolean()
|
|
625
|
-
})
|
|
626
|
-
});
|
|
627
|
-
var constructorElekIoCoreSchema = elekIoCoreOptionsSchema.partial({
|
|
628
|
-
log: true,
|
|
629
|
-
file: true
|
|
630
|
-
}).optional();
|
|
631
|
-
|
|
632
|
-
// src/schema/projectSchema.ts
|
|
633
|
-
import { z as z10 } from "@hono/zod-openapi";
|
|
634
|
-
var projectStatusSchema = z10.enum(["foo", "bar", "todo"]);
|
|
635
|
-
var projectSettingsSchema = z10.object({
|
|
636
|
-
language: z10.object({
|
|
637
|
-
default: supportedLanguageSchema,
|
|
638
|
-
supported: z10.array(supportedLanguageSchema)
|
|
639
|
-
})
|
|
640
|
-
});
|
|
641
|
-
var projectFolderSchema = z10.enum([
|
|
642
|
-
"assets",
|
|
643
|
-
"collections",
|
|
644
|
-
"shared-values",
|
|
645
|
-
"lfs"
|
|
646
|
-
// 'logs',
|
|
647
|
-
// 'public',
|
|
648
|
-
// 'theme',
|
|
649
|
-
]);
|
|
650
|
-
var projectBranchSchema = z10.enum(["production", "work"]);
|
|
651
|
-
var projectFileSchema = baseFileSchema.extend({
|
|
652
|
-
objectType: z10.literal(objectTypeSchema.enum.project).readonly(),
|
|
653
|
-
coreVersion: versionSchema,
|
|
654
|
-
name: z10.string().trim().min(1, "shared.projectNameRequired"),
|
|
655
|
-
description: z10.string().trim().min(1, "shared.projectDescriptionRequired"),
|
|
656
|
-
version: versionSchema,
|
|
657
|
-
status: projectStatusSchema,
|
|
658
|
-
settings: projectSettingsSchema
|
|
659
|
-
});
|
|
660
|
-
var projectSchema = projectFileSchema.extend({
|
|
661
|
-
remoteOriginUrl: z10.string().nullable().openapi({
|
|
662
|
-
description: "URL of the remote Git repository"
|
|
663
|
-
}),
|
|
664
|
-
history: z10.array(gitCommitSchema).openapi({
|
|
665
|
-
description: "Commit history of this Project"
|
|
666
|
-
}),
|
|
667
|
-
fullHistory: z10.array(gitCommitSchema).openapi({
|
|
668
|
-
description: "Full commit history of this Project including all Assets, Collections, Entries and other files"
|
|
669
|
-
})
|
|
670
|
-
}).openapi("Project");
|
|
671
|
-
var outdatedProjectSchema = projectFileSchema.pick({
|
|
672
|
-
id: true,
|
|
673
|
-
name: true,
|
|
674
|
-
coreVersion: true
|
|
675
|
-
});
|
|
676
|
-
var projectExportSchema = projectSchema.extend({
|
|
677
|
-
assets: z10.array(assetExportSchema),
|
|
678
|
-
collections: z10.array(collectionExportSchema)
|
|
679
|
-
});
|
|
680
|
-
var createProjectSchema = projectSchema.pick({
|
|
681
|
-
name: true,
|
|
682
|
-
description: true,
|
|
683
|
-
settings: true
|
|
684
|
-
}).partial({
|
|
685
|
-
description: true,
|
|
686
|
-
settings: true
|
|
687
|
-
});
|
|
688
|
-
var readProjectSchema = z10.object({
|
|
689
|
-
id: uuidSchema.readonly(),
|
|
690
|
-
commitHash: z10.string().optional().readonly()
|
|
691
|
-
});
|
|
692
|
-
var updateProjectSchema = projectSchema.pick({
|
|
693
|
-
id: true,
|
|
694
|
-
name: true,
|
|
695
|
-
description: true,
|
|
696
|
-
settings: true
|
|
697
|
-
}).partial({
|
|
698
|
-
name: true,
|
|
699
|
-
description: true,
|
|
700
|
-
settings: true
|
|
701
|
-
});
|
|
702
|
-
var upgradeProjectSchema = z10.object({
|
|
703
|
-
id: uuidSchema.readonly(),
|
|
704
|
-
/**
|
|
705
|
-
* Force the upgrade even if the Project is up-to-date
|
|
706
|
-
*/
|
|
707
|
-
force: z10.boolean().optional()
|
|
708
|
-
});
|
|
709
|
-
var deleteProjectSchema = readProjectSchema.extend({
|
|
710
|
-
force: z10.boolean().optional()
|
|
711
|
-
});
|
|
712
|
-
var projectUpgradeSchema = z10.object({
|
|
713
|
-
/**
|
|
714
|
-
* The Core version the Project will be upgraded to
|
|
715
|
-
*/
|
|
716
|
-
to: versionSchema.readonly(),
|
|
717
|
-
/**
|
|
718
|
-
* Function that will be executed in the process of upgrading a Project
|
|
719
|
-
*/
|
|
720
|
-
run: z10.function({
|
|
721
|
-
input: [projectFileSchema],
|
|
722
|
-
output: z10.promise(z10.void())
|
|
723
|
-
})
|
|
724
|
-
});
|
|
725
|
-
var cloneProjectSchema = z10.object({
|
|
726
|
-
url: z10.string()
|
|
727
|
-
});
|
|
728
|
-
var listBranchesProjectSchema = z10.object({
|
|
729
|
-
id: uuidSchema.readonly()
|
|
730
|
-
});
|
|
731
|
-
var currentBranchProjectSchema = z10.object({
|
|
732
|
-
id: uuidSchema.readonly()
|
|
733
|
-
});
|
|
734
|
-
var switchBranchProjectSchema = z10.object({
|
|
735
|
-
id: uuidSchema.readonly(),
|
|
736
|
-
branch: z10.string(),
|
|
737
|
-
options: gitSwitchOptionsSchema.optional()
|
|
738
|
-
});
|
|
739
|
-
var getRemoteOriginUrlProjectSchema = z10.object({
|
|
740
|
-
id: uuidSchema.readonly()
|
|
741
|
-
});
|
|
742
|
-
var setRemoteOriginUrlProjectSchema = z10.object({
|
|
743
|
-
id: uuidSchema.readonly(),
|
|
744
|
-
url: z10.string()
|
|
745
|
-
});
|
|
746
|
-
var getChangesProjectSchema = z10.object({
|
|
747
|
-
id: uuidSchema.readonly()
|
|
748
|
-
});
|
|
749
|
-
var synchronizeProjectSchema = z10.object({
|
|
750
|
-
id: uuidSchema.readonly()
|
|
751
|
-
});
|
|
752
|
-
var searchProjectSchema = z10.object({
|
|
753
|
-
id: uuidSchema.readonly(),
|
|
754
|
-
query: z10.string(),
|
|
755
|
-
language: supportedLanguageSchema,
|
|
756
|
-
type: z10.array(objectTypeSchema).optional()
|
|
757
|
-
});
|
|
758
|
-
|
|
759
|
-
// src/schema/schemaFromFieldDefinition.ts
|
|
760
|
-
import { z as z11 } from "@hono/zod-openapi";
|
|
761
|
-
function getBooleanValueContentSchemaFromFieldDefinition() {
|
|
762
|
-
return z11.boolean();
|
|
763
|
-
}
|
|
764
|
-
function getNumberValueContentSchemaFromFieldDefinition(fieldDefinition) {
|
|
765
|
-
let schema = z11.number();
|
|
766
|
-
if (fieldDefinition.min) {
|
|
767
|
-
schema = schema.min(fieldDefinition.min);
|
|
768
|
-
}
|
|
769
|
-
if (fieldDefinition.max) {
|
|
770
|
-
schema = schema.max(fieldDefinition.max);
|
|
771
|
-
}
|
|
772
|
-
if (fieldDefinition.isRequired === false) {
|
|
773
|
-
return schema.nullable();
|
|
774
|
-
}
|
|
775
|
-
return schema;
|
|
776
|
-
}
|
|
777
|
-
function getStringValueContentSchemaFromFieldDefinition(fieldDefinition) {
|
|
778
|
-
let schema = null;
|
|
779
|
-
switch (fieldDefinition.fieldType) {
|
|
780
|
-
case FieldTypeSchema.enum.email:
|
|
781
|
-
schema = z11.email();
|
|
782
|
-
break;
|
|
783
|
-
case FieldTypeSchema.enum.url:
|
|
784
|
-
schema = z11.url();
|
|
785
|
-
break;
|
|
786
|
-
case FieldTypeSchema.enum.ipv4:
|
|
787
|
-
schema = z11.ipv4();
|
|
788
|
-
break;
|
|
789
|
-
case FieldTypeSchema.enum.date:
|
|
790
|
-
schema = z11.iso.date();
|
|
791
|
-
break;
|
|
792
|
-
case FieldTypeSchema.enum.time:
|
|
793
|
-
schema = z11.iso.time();
|
|
794
|
-
break;
|
|
795
|
-
case FieldTypeSchema.enum.datetime:
|
|
796
|
-
schema = z11.iso.datetime();
|
|
797
|
-
break;
|
|
798
|
-
case FieldTypeSchema.enum.telephone:
|
|
799
|
-
schema = z11.e164();
|
|
800
|
-
break;
|
|
801
|
-
case FieldTypeSchema.enum.text:
|
|
802
|
-
case FieldTypeSchema.enum.textarea:
|
|
803
|
-
schema = z11.string().trim();
|
|
804
|
-
break;
|
|
805
|
-
}
|
|
806
|
-
if ("min" in fieldDefinition && fieldDefinition.min) {
|
|
807
|
-
schema = schema.min(fieldDefinition.min);
|
|
808
|
-
}
|
|
809
|
-
if ("max" in fieldDefinition && fieldDefinition.max) {
|
|
810
|
-
schema = schema.max(fieldDefinition.max);
|
|
811
|
-
}
|
|
812
|
-
if (fieldDefinition.isRequired === false) {
|
|
813
|
-
return schema.nullable();
|
|
814
|
-
}
|
|
815
|
-
return schema.min(1, "shared.stringValueRequired");
|
|
816
|
-
}
|
|
817
|
-
function getReferenceValueContentSchemaFromFieldDefinition(fieldDefinition) {
|
|
818
|
-
let schema;
|
|
819
|
-
switch (fieldDefinition.fieldType) {
|
|
820
|
-
case FieldTypeSchema.enum.asset:
|
|
821
|
-
{
|
|
822
|
-
schema = z11.array(valueContentReferenceToAssetSchema);
|
|
823
|
-
}
|
|
824
|
-
break;
|
|
825
|
-
case FieldTypeSchema.enum.entry:
|
|
826
|
-
{
|
|
827
|
-
schema = z11.array(valueContentReferenceToEntrySchema);
|
|
828
|
-
}
|
|
829
|
-
break;
|
|
830
|
-
}
|
|
831
|
-
if (fieldDefinition.isRequired) {
|
|
832
|
-
schema = schema.min(1, "shared.referenceRequired");
|
|
833
|
-
}
|
|
834
|
-
if (fieldDefinition.min) {
|
|
835
|
-
schema = schema.min(fieldDefinition.min);
|
|
836
|
-
}
|
|
837
|
-
if (fieldDefinition.max) {
|
|
838
|
-
schema = schema.max(fieldDefinition.max);
|
|
839
|
-
}
|
|
840
|
-
return schema;
|
|
841
|
-
}
|
|
842
|
-
function getTranslatableStringValueContentSchemaFromFieldDefinition(fieldDefinition) {
|
|
843
|
-
return z11.partialRecord(
|
|
844
|
-
supportedLanguageSchema,
|
|
845
|
-
getStringValueContentSchemaFromFieldDefinition(fieldDefinition)
|
|
846
|
-
);
|
|
847
|
-
}
|
|
848
|
-
function getTranslatableNumberValueContentSchemaFromFieldDefinition(fieldDefinition) {
|
|
849
|
-
return z11.partialRecord(
|
|
850
|
-
supportedLanguageSchema,
|
|
851
|
-
getNumberValueContentSchemaFromFieldDefinition(fieldDefinition)
|
|
852
|
-
);
|
|
853
|
-
}
|
|
854
|
-
function getTranslatableBooleanValueContentSchemaFromFieldDefinition() {
|
|
855
|
-
return z11.partialRecord(
|
|
856
|
-
supportedLanguageSchema,
|
|
857
|
-
getBooleanValueContentSchemaFromFieldDefinition()
|
|
858
|
-
);
|
|
859
|
-
}
|
|
860
|
-
function getTranslatableReferenceValueContentSchemaFromFieldDefinition(fieldDefinition) {
|
|
861
|
-
return z11.partialRecord(
|
|
862
|
-
supportedLanguageSchema,
|
|
863
|
-
getReferenceValueContentSchemaFromFieldDefinition(fieldDefinition)
|
|
864
|
-
);
|
|
865
|
-
}
|
|
866
|
-
function getValueSchemaFromFieldDefinition(fieldDefinition) {
|
|
867
|
-
switch (fieldDefinition.valueType) {
|
|
868
|
-
case ValueTypeSchema.enum.boolean:
|
|
869
|
-
return directBooleanValueSchema.extend({
|
|
870
|
-
content: getTranslatableBooleanValueContentSchemaFromFieldDefinition()
|
|
871
|
-
});
|
|
872
|
-
case ValueTypeSchema.enum.number:
|
|
873
|
-
return directNumberValueSchema.extend({
|
|
874
|
-
content: getTranslatableNumberValueContentSchemaFromFieldDefinition(
|
|
875
|
-
fieldDefinition
|
|
876
|
-
)
|
|
877
|
-
});
|
|
878
|
-
case ValueTypeSchema.enum.string:
|
|
879
|
-
return directStringValueSchema.extend({
|
|
880
|
-
content: getTranslatableStringValueContentSchemaFromFieldDefinition(
|
|
881
|
-
fieldDefinition
|
|
882
|
-
)
|
|
883
|
-
});
|
|
884
|
-
case ValueTypeSchema.enum.reference:
|
|
885
|
-
return referencedValueSchema.extend({
|
|
886
|
-
content: getTranslatableReferenceValueContentSchemaFromFieldDefinition(
|
|
887
|
-
fieldDefinition
|
|
888
|
-
)
|
|
889
|
-
});
|
|
890
|
-
default:
|
|
891
|
-
throw new Error(
|
|
892
|
-
// @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
|
|
893
|
-
`Error generating schema for unsupported ValueType "${fieldDefinition.valueType}"`
|
|
894
|
-
);
|
|
895
|
-
}
|
|
896
|
-
}
|
|
897
|
-
function getCreateEntrySchemaFromFieldDefinitions(fieldDefinitions) {
|
|
898
|
-
const valueSchemas = fieldDefinitions.map((fieldDefinition) => {
|
|
899
|
-
return getValueSchemaFromFieldDefinition(fieldDefinition);
|
|
900
|
-
});
|
|
901
|
-
return z11.object({
|
|
902
|
-
...createEntrySchema.shape,
|
|
903
|
-
values: z11.tuple(
|
|
904
|
-
valueSchemas
|
|
905
|
-
// At least one element is required in a tuple
|
|
906
|
-
)
|
|
907
|
-
});
|
|
908
|
-
}
|
|
909
|
-
function getUpdateEntrySchemaFromFieldDefinitions(fieldDefinitions) {
|
|
910
|
-
const valueSchemas = fieldDefinitions.map((fieldDefinition) => {
|
|
911
|
-
return getValueSchemaFromFieldDefinition(fieldDefinition);
|
|
912
|
-
});
|
|
913
|
-
return z11.object({
|
|
914
|
-
...updateEntrySchema.shape,
|
|
915
|
-
values: z11.tuple(
|
|
916
|
-
valueSchemas
|
|
917
|
-
// At least one element is required in a tuple
|
|
918
|
-
)
|
|
919
|
-
});
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
// src/schema/serviceSchema.ts
|
|
923
|
-
import { z as z12 } from "@hono/zod-openapi";
|
|
924
|
-
var serviceTypeSchema = z12.enum([
|
|
925
|
-
"Git",
|
|
926
|
-
"GitTag",
|
|
927
|
-
"User",
|
|
928
|
-
"Project",
|
|
929
|
-
"Asset",
|
|
930
|
-
"JsonFile",
|
|
931
|
-
"Search",
|
|
932
|
-
"Collection",
|
|
933
|
-
"Entry",
|
|
934
|
-
"Value"
|
|
935
|
-
]);
|
|
936
|
-
function paginatedListOf(schema) {
|
|
937
|
-
return z12.object({
|
|
938
|
-
total: z12.number(),
|
|
939
|
-
limit: z12.number(),
|
|
940
|
-
offset: z12.number(),
|
|
941
|
-
list: z12.array(schema)
|
|
942
|
-
});
|
|
943
|
-
}
|
|
944
|
-
var listSchema = z12.object({
|
|
945
|
-
projectId: uuidSchema,
|
|
946
|
-
limit: z12.number().optional(),
|
|
947
|
-
offset: z12.number().optional()
|
|
948
|
-
});
|
|
949
|
-
var listCollectionsSchema = listSchema;
|
|
950
|
-
var listEntriesSchema = listSchema.extend({
|
|
951
|
-
collectionId: uuidSchema
|
|
952
|
-
});
|
|
953
|
-
var listAssetsSchema = listSchema;
|
|
954
|
-
var listProjectsSchema = listSchema.omit({
|
|
955
|
-
projectId: true
|
|
956
|
-
});
|
|
957
|
-
var listGitTagsSchema = z12.object({
|
|
958
|
-
path: z12.string()
|
|
959
|
-
});
|
|
960
|
-
|
|
961
|
-
// src/schema/userSchema.ts
|
|
962
|
-
import { z as z13 } from "@hono/zod-openapi";
|
|
963
|
-
var UserTypeSchema = z13.enum(["local", "cloud"]);
|
|
964
|
-
var baseUserSchema = gitSignatureSchema.extend({
|
|
965
|
-
userType: UserTypeSchema,
|
|
966
|
-
language: supportedLanguageSchema,
|
|
967
|
-
localApi: z13.object({
|
|
968
|
-
/**
|
|
969
|
-
* If set to true the local API is started whenever Core is initialized
|
|
970
|
-
*/
|
|
971
|
-
isEnabled: z13.boolean(),
|
|
972
|
-
/**
|
|
973
|
-
* The port the local API uses
|
|
974
|
-
*/
|
|
975
|
-
port: z13.number()
|
|
976
|
-
})
|
|
977
|
-
});
|
|
978
|
-
var localUserSchema = baseUserSchema.extend({
|
|
979
|
-
userType: z13.literal(UserTypeSchema.enum.local)
|
|
980
|
-
});
|
|
981
|
-
var cloudUserSchema = baseUserSchema.extend({
|
|
982
|
-
userType: z13.literal(UserTypeSchema.enum.cloud),
|
|
983
|
-
id: uuidSchema
|
|
984
|
-
});
|
|
985
|
-
var userFileSchema = z13.union([localUserSchema, cloudUserSchema]);
|
|
986
|
-
var userSchema = userFileSchema;
|
|
987
|
-
var setUserSchema = userSchema;
|
|
988
|
-
|
|
989
|
-
// src/util/shared.ts
|
|
990
|
-
import slugify from "@sindresorhus/slugify";
|
|
991
|
-
import { v4 as generateUuid } from "uuid";
|
|
992
|
-
function uuid() {
|
|
993
|
-
return generateUuid();
|
|
994
|
-
}
|
|
995
|
-
function datetime(value) {
|
|
996
|
-
if (!value) {
|
|
997
|
-
return (/* @__PURE__ */ new Date()).toISOString();
|
|
998
|
-
}
|
|
999
|
-
return new Date(value).toISOString();
|
|
1000
|
-
}
|
|
1001
|
-
function slug(string) {
|
|
1002
|
-
return slugify(string, {
|
|
1003
|
-
separator: "-",
|
|
1004
|
-
lowercase: true,
|
|
1005
|
-
decamelize: true
|
|
1006
|
-
});
|
|
1007
|
-
}
|
|
1008
|
-
export {
|
|
1009
|
-
BooleanFieldDefinitionBaseSchema,
|
|
1010
|
-
FieldDefinitionBaseSchema,
|
|
1011
|
-
FieldTypeSchema,
|
|
1012
|
-
FieldWidthSchema,
|
|
1013
|
-
NumberFieldDefinitionBaseSchema,
|
|
1014
|
-
ReferenceFieldDefinitionBaseSchema,
|
|
1015
|
-
StringFieldDefinitionBaseSchema,
|
|
1016
|
-
UserTypeSchema,
|
|
1017
|
-
ValueTypeSchema,
|
|
1018
|
-
assetExportSchema,
|
|
1019
|
-
assetFieldDefinitionSchema,
|
|
1020
|
-
assetFileSchema,
|
|
1021
|
-
assetSchema,
|
|
1022
|
-
baseFileSchema,
|
|
1023
|
-
baseUserSchema,
|
|
1024
|
-
cloneProjectSchema,
|
|
1025
|
-
cloudUserSchema,
|
|
1026
|
-
collectionExportSchema,
|
|
1027
|
-
collectionFileSchema,
|
|
1028
|
-
collectionSchema,
|
|
1029
|
-
constructorElekIoCoreSchema,
|
|
1030
|
-
countAssetsSchema,
|
|
1031
|
-
countCollectionsSchema,
|
|
1032
|
-
countEntriesSchema,
|
|
1033
|
-
countGitTagsSchema,
|
|
1034
|
-
createAssetSchema,
|
|
1035
|
-
createCollectionSchema,
|
|
1036
|
-
createEntrySchema,
|
|
1037
|
-
createGitTagSchema,
|
|
1038
|
-
createProjectSchema,
|
|
1039
|
-
currentBranchProjectSchema,
|
|
1040
|
-
dateFieldDefinitionSchema,
|
|
1041
|
-
datetime,
|
|
1042
|
-
datetimeFieldDefinitionSchema,
|
|
1043
|
-
deleteAssetSchema,
|
|
1044
|
-
deleteCollectionSchema,
|
|
1045
|
-
deleteEntrySchema,
|
|
1046
|
-
deleteGitTagSchema,
|
|
1047
|
-
deleteProjectSchema,
|
|
1048
|
-
directBooleanValueSchema,
|
|
1049
|
-
directNumberValueSchema,
|
|
1050
|
-
directStringValueSchema,
|
|
1051
|
-
directValueBaseSchema,
|
|
1052
|
-
directValueSchema,
|
|
1053
|
-
elekIoCoreOptionsSchema,
|
|
1054
|
-
emailFieldDefinitionSchema,
|
|
1055
|
-
entryExportSchema,
|
|
1056
|
-
entryFieldDefinitionSchema,
|
|
1057
|
-
entryFileSchema,
|
|
1058
|
-
entrySchema,
|
|
1059
|
-
fieldDefinitionSchema,
|
|
1060
|
-
fileReferenceSchema,
|
|
1061
|
-
getChangesProjectSchema,
|
|
1062
|
-
getCreateEntrySchemaFromFieldDefinitions,
|
|
1063
|
-
getRemoteOriginUrlProjectSchema,
|
|
1064
|
-
getUpdateEntrySchemaFromFieldDefinitions,
|
|
1065
|
-
getValueSchemaFromFieldDefinition,
|
|
1066
|
-
gitCloneOptionsSchema,
|
|
1067
|
-
gitCommitSchema,
|
|
1068
|
-
gitInitOptionsSchema,
|
|
1069
|
-
gitLogOptionsSchema,
|
|
1070
|
-
gitMergeOptionsSchema,
|
|
1071
|
-
gitMessageSchema,
|
|
1072
|
-
gitSignatureSchema,
|
|
1073
|
-
gitSwitchOptionsSchema,
|
|
1074
|
-
gitTagSchema,
|
|
1075
|
-
ipv4FieldDefinitionSchema,
|
|
1076
|
-
listAssetsSchema,
|
|
1077
|
-
listBranchesProjectSchema,
|
|
1078
|
-
listCollectionsSchema,
|
|
1079
|
-
listEntriesSchema,
|
|
1080
|
-
listGitTagsSchema,
|
|
1081
|
-
listProjectsSchema,
|
|
1082
|
-
localUserSchema,
|
|
1083
|
-
logLevelSchema,
|
|
1084
|
-
numberFieldDefinitionSchema,
|
|
1085
|
-
objectTypeSchema,
|
|
1086
|
-
outdatedProjectSchema,
|
|
1087
|
-
paginatedListOf,
|
|
1088
|
-
projectBranchSchema,
|
|
1089
|
-
projectExportSchema,
|
|
1090
|
-
projectFileSchema,
|
|
1091
|
-
projectFolderSchema,
|
|
1092
|
-
projectSchema,
|
|
1093
|
-
projectSettingsSchema,
|
|
1094
|
-
projectStatusSchema,
|
|
1095
|
-
projectUpgradeSchema,
|
|
1096
|
-
rangeFieldDefinitionSchema,
|
|
1097
|
-
readAssetSchema,
|
|
1098
|
-
readCollectionSchema,
|
|
1099
|
-
readEntrySchema,
|
|
1100
|
-
readGitTagSchema,
|
|
1101
|
-
readProjectSchema,
|
|
1102
|
-
referencedValueSchema,
|
|
1103
|
-
saveAssetSchema,
|
|
1104
|
-
searchProjectSchema,
|
|
1105
|
-
serviceTypeSchema,
|
|
1106
|
-
setRemoteOriginUrlProjectSchema,
|
|
1107
|
-
setUserSchema,
|
|
1108
|
-
slug,
|
|
1109
|
-
stringFieldDefinitionSchema,
|
|
1110
|
-
supportedIconSchema,
|
|
1111
|
-
supportedLanguageSchema,
|
|
1112
|
-
switchBranchProjectSchema,
|
|
1113
|
-
synchronizeProjectSchema,
|
|
1114
|
-
telephoneFieldDefinitionSchema,
|
|
1115
|
-
textFieldDefinitionSchema,
|
|
1116
|
-
textareaFieldDefinitionSchema,
|
|
1117
|
-
timeFieldDefinitionSchema,
|
|
1118
|
-
toggleFieldDefinitionSchema,
|
|
1119
|
-
translatableArrayOf,
|
|
1120
|
-
translatableBooleanSchema,
|
|
1121
|
-
translatableNumberSchema,
|
|
1122
|
-
translatableStringSchema,
|
|
1123
|
-
updateAssetSchema,
|
|
1124
|
-
updateCollectionSchema,
|
|
1125
|
-
updateEntrySchema,
|
|
1126
|
-
updateProjectSchema,
|
|
1127
|
-
upgradeProjectSchema,
|
|
1128
|
-
urlFieldDefinitionSchema,
|
|
1129
|
-
userFileSchema,
|
|
1130
|
-
userSchema,
|
|
1131
|
-
uuid,
|
|
1132
|
-
uuidSchema,
|
|
1133
|
-
valueContentReferenceBase,
|
|
1134
|
-
valueContentReferenceSchema,
|
|
1135
|
-
valueContentReferenceToAssetSchema,
|
|
1136
|
-
valueContentReferenceToCollectionSchema,
|
|
1137
|
-
valueContentReferenceToEntrySchema,
|
|
1138
|
-
valueSchema,
|
|
1139
|
-
versionSchema
|
|
1140
|
-
};
|
|
1
|
+
import{z as e}from"@hono/zod-openapi";import{z as t}from"zod";import n from"@sindresorhus/slugify";import{v4 as ee}from"uuid";const r=e.enum([`bg`,`cs`,`da`,`de`,`el`,`en`,`es`,`et`,`fi`,`fr`,`hu`,`it`,`ja`,`lt`,`lv`,`nl`,`pl`,`pt`,`ro`,`ru`,`sk`,`sl`,`sv`,`zh`]),te=e.enum([`home`,`plus`,`foobar`]),i=e.enum([`project`,`asset`,`collection`,`entry`,`value`,`sharedValue`]),a=e.enum([`error`,`warn`,`info`,`debug`]),o=e.string(),s=e.uuid(`shared.invalidUuid`),c=e.partialRecord(r,e.string().trim().min(1,`shared.translatableStringRequired`)),l=e.partialRecord(r,e.number({error:e=>e.input===void 0?`shared.translatableNumberRequired`:`shared.translatableNumberNotANumber`})),ne=e.partialRecord(r,e.boolean({error:e=>e.input===void 0?`shared.translatableBooleanRequired`:`shared.translatableBooleanNotABoolean`}));function re(t){return e.partialRecord(r,e.array(t))}const u=e.object({objectType:i.readonly(),id:s.readonly(),created:e.string().datetime().readonly(),updated:e.string().datetime().nullable()}),ie=e.object({id:s,extension:e.string().optional()}),d=e.object({name:e.string(),email:e.string().email()}),f=e.object({method:e.enum([`create`,`update`,`delete`,`upgrade`]),reference:e.object({objectType:i,id:s,collectionId:s.optional()})}),p=e.object({id:s,message:e.string(),author:d,datetime:e.string().datetime()}),m=e.object({hash:e.string(),message:f,author:d,datetime:e.string().datetime(),tag:p.nullable()}),ae=e.object({initialBranch:e.string()}),oe=e.object({depth:e.number(),singleBranch:e.boolean(),branch:e.string(),bare:e.boolean()}),se=e.object({squash:e.boolean()}),h=e.object({isNew:e.boolean().optional()}),ce=e.object({limit:e.number().optional(),between:e.object({from:e.string(),to:e.string().optional()}),filePath:e.string().optional()}),le=p.pick({message:!0}).extend({path:e.string(),hash:e.string().optional()}),g=e.object({path:e.string(),id:s.readonly()}),ue=g.extend({}),de=e.object({path:e.string()}),_=u.extend({objectType:e.literal(i.enum.asset).readonly(),name:e.string(),description:e.string(),extension:e.string().readonly(),mimeType:e.string().readonly(),size:e.number().readonly()}),fe=_.extend({absolutePath:e.string().readonly(),history:e.array(m)}).openapi(`Asset`),pe=fe.extend({}),me=_.pick({name:!0,description:!0}).extend({projectId:s.readonly(),filePath:e.string().readonly()}),he=_.pick({id:!0}).extend({projectId:s.readonly(),commitHash:e.string().optional().readonly()}),ge=_.pick({id:!0}).extend({projectId:s.readonly(),filePath:e.string().readonly(),commitHash:e.string().optional().readonly()}),_e=_.pick({id:!0,name:!0,description:!0}).extend({projectId:s.readonly(),newFilePath:e.string().readonly().optional()}),ve=_.pick({id:!0,extension:!0}).extend({projectId:s.readonly()}),ye=e.object({projectId:s.readonly()}),v=e.enum([`string`,`number`,`boolean`,`reference`]),y=e.object({id:s}),b=y.extend({objectType:e.literal(i.enum.asset)}),x=y.extend({objectType:e.literal(i.enum.collection)}),S=y.extend({objectType:e.literal(i.enum.entry)}),C=e.union([b,x,S]),w=e.object({objectType:e.literal(i.enum.value).readonly(),fieldDefinitionId:s.readonly()}),T=w.extend({valueType:e.literal(v.enum.string).readonly(),content:c}),E=w.extend({valueType:e.literal(v.enum.number).readonly(),content:l}),D=w.extend({valueType:e.literal(v.enum.boolean).readonly(),content:ne}),O=e.union([T,E,D]),k=e.object({objectType:e.literal(i.enum.value).readonly(),fieldDefinitionId:s.readonly(),valueType:e.literal(v.enum.reference).readonly(),content:re(C)}),A=e.union([O,k]),j=u.extend({objectType:e.literal(i.enum.entry).readonly(),values:e.array(A)}),M=j.extend({history:e.array(m)}).openapi(`Entry`),N=M.extend({}),P=j.omit({id:!0,objectType:!0,created:!0,updated:!0}).extend({projectId:s.readonly(),collectionId:s.readonly(),values:e.array(A)}),F=e.object({id:s.readonly(),projectId:s.readonly(),collectionId:s.readonly(),commitHash:e.string().optional().readonly()}),I=j.omit({objectType:!0,created:!0,updated:!0}).extend({projectId:s.readonly(),collectionId:s.readonly()}),be=F.extend({}),xe=e.object({projectId:s.readonly(),collectionId:s.readonly()}),L=e.enum([`text`,`textarea`,`email`,`url`,`ipv4`,`date`,`time`,`datetime`,`telephone`,`number`,`range`,`toggle`,`asset`,`entry`]),R=e.enum([`12`,`6`,`4`,`3`]),z=e.object({id:s.readonly(),label:c,description:c.nullable(),isRequired:e.boolean(),isDisabled:e.boolean(),isUnique:e.boolean(),inputWidth:R}),B=z.extend({valueType:e.literal(v.enum.string),defaultValue:e.string().nullable()}),V=B.extend({fieldType:e.literal(L.enum.text),min:e.number().nullable(),max:e.number().nullable()}),H=B.extend({fieldType:e.literal(L.enum.textarea),min:e.number().nullable(),max:e.number().nullable()}),U=B.extend({fieldType:e.literal(L.enum.email),defaultValue:e.email().nullable()}),Se=B.extend({fieldType:e.literal(L.enum.url),defaultValue:e.url().nullable()}),Ce=B.extend({fieldType:e.literal(L.enum.ipv4),defaultValue:e.ipv4().nullable()}),we=B.extend({fieldType:e.literal(L.enum.date),defaultValue:e.iso.date().nullable()}),Te=B.extend({fieldType:e.literal(L.enum.time),defaultValue:e.iso.time().nullable()}),Ee=B.extend({fieldType:e.literal(L.enum.datetime),defaultValue:e.iso.datetime().nullable()}),De=B.extend({fieldType:e.literal(L.enum.telephone),defaultValue:e.e164().nullable()}),Oe=e.union([V,H,U,Se,Ce,we,Te,Ee,De]),W=z.extend({valueType:e.literal(v.enum.number),min:e.number().nullable(),max:e.number().nullable(),isUnique:e.literal(!1),defaultValue:e.number().nullable()}),ke=W.extend({fieldType:e.literal(L.enum.number)}),Ae=W.extend({fieldType:e.literal(L.enum.range),isRequired:e.literal(!0),min:e.number(),max:e.number(),defaultValue:e.number()}),je=z.extend({valueType:e.literal(v.enum.boolean),isRequired:e.literal(!0),defaultValue:e.boolean(),isUnique:e.literal(!1)}),Me=je.extend({fieldType:e.literal(L.enum.toggle)}),G=z.extend({valueType:e.literal(v.enum.reference)}),Ne=G.extend({fieldType:e.literal(L.enum.asset),min:e.number().nullable(),max:e.number().nullable()}),Pe=G.extend({fieldType:e.literal(L.enum.entry),ofCollections:e.array(s),min:e.number().nullable(),max:e.number().nullable()}),Fe=e.union([Oe,ke,Ae,Me,Ne,Pe]),K=u.extend({objectType:e.literal(i.enum.collection).readonly(),name:e.object({singular:c,plural:c}),slug:e.object({singular:e.string(),plural:e.string()}),description:c,icon:te,fieldDefinitions:e.array(Fe)}),Ie=K.extend({history:e.array(m)}).openapi(`Collection`),q=Ie.extend({entries:e.array(N)}),Le=K.omit({id:!0,objectType:!0,created:!0,updated:!0}).extend({projectId:s.readonly()}),Re=e.object({id:s.readonly(),projectId:s.readonly(),commitHash:e.string().optional().readonly()}),ze=K.pick({id:!0,name:!0,slug:!0,description:!0,icon:!0,fieldDefinitions:!0}).extend({projectId:s.readonly()}),Be=Re.extend({}),Ve=e.object({projectId:s.readonly()}),He=e.object({log:e.object({level:a}),file:e.object({cache:e.boolean()})}),Ue=He.partial({log:!0,file:!0}).optional(),We=e.enum([`foo`,`bar`,`todo`]),Ge=e.object({language:e.object({default:r,supported:e.array(r)})}),Ke=e.enum([`assets`,`collections`,`shared-values`,`lfs`]),qe=e.enum([`production`,`work`]),J=u.extend({objectType:e.literal(i.enum.project).readonly(),coreVersion:o,name:e.string().trim().min(1,`shared.projectNameRequired`),description:e.string().trim().min(1,`shared.projectDescriptionRequired`),version:o,status:We,settings:Ge}),Y=J.extend({remoteOriginUrl:e.string().nullable().openapi({description:`URL of the remote Git repository`}),history:e.array(m).openapi({description:`Commit history of this Project`}),fullHistory:e.array(m).openapi({description:`Full commit history of this Project including all Assets, Collections, Entries and other files`})}).openapi(`Project`),Je=J.pick({id:!0,name:!0,coreVersion:!0}),Ye=Y.extend({assets:e.array(pe),collections:e.array(q)}),Xe=Y.pick({name:!0,description:!0,settings:!0}).partial({description:!0,settings:!0}),Ze=e.object({id:s.readonly(),commitHash:e.string().optional().readonly()}),Qe=Y.pick({id:!0,name:!0,description:!0,settings:!0}).partial({name:!0,description:!0,settings:!0}),$e=e.object({id:s.readonly(),force:e.boolean().optional()}),et=Ze.extend({force:e.boolean().optional()}),tt=e.object({to:o.readonly(),run:e.function({input:[J],output:e.promise(e.void())})}),nt=e.object({url:e.string()}),rt=e.object({id:s.readonly()}),it=e.object({id:s.readonly()}),at=e.object({id:s.readonly(),branch:e.string(),options:h.optional()}),ot=e.object({id:s.readonly()}),st=e.object({id:s.readonly(),url:e.string()}),ct=e.object({id:s.readonly()}),lt=e.object({id:s.readonly()}),ut=e.object({id:s.readonly(),query:e.string(),language:r,type:e.array(i).optional()});function dt(){return e.boolean()}function ft(t){let n=e.number();return t.min&&(n=n.min(t.min)),t.max&&(n=n.max(t.max)),t.isRequired===!1?n.nullable():n}function pt(t){let n=null;switch(t.fieldType){case L.enum.email:n=e.email();break;case L.enum.url:n=e.url();break;case L.enum.ipv4:n=e.ipv4();break;case L.enum.date:n=e.iso.date();break;case L.enum.time:n=e.iso.time();break;case L.enum.datetime:n=e.iso.datetime();break;case L.enum.telephone:n=e.e164();break;case L.enum.text:case L.enum.textarea:n=e.string().trim();break}return`min`in t&&t.min&&(n=n.min(t.min)),`max`in t&&t.max&&(n=n.max(t.max)),t.isRequired===!1?n.nullable():n.min(1,`shared.stringValueRequired`)}function mt(t){let n;switch(t.fieldType){case L.enum.asset:n=e.array(b);break;case L.enum.entry:n=e.array(S);break}return t.isRequired&&(n=n.min(1,`shared.referenceRequired`)),t.min&&(n=n.min(t.min)),t.max&&(n=n.max(t.max)),n}function ht(t){return e.partialRecord(r,pt(t))}function gt(t){return e.partialRecord(r,ft(t))}function _t(){return e.partialRecord(r,dt())}function vt(t){return e.partialRecord(r,mt(t))}function X(e){switch(e.valueType){case v.enum.boolean:return D.extend({content:_t()});case v.enum.number:return E.extend({content:gt(e)});case v.enum.string:return T.extend({content:ht(e)});case v.enum.reference:return k.extend({content:vt(e)});default:throw Error(`Error generating schema for unsupported ValueType "${e.valueType}"`)}}function yt(t){let n=t.map(e=>X(e));return e.object({...M.shape,values:e.tuple(n)})}function bt(t){let n=t.map(e=>X(e));return e.object({...P.shape,values:e.tuple(n)})}function xt(t){let n=t.map(e=>X(e));return e.object({...I.shape,values:e.tuple(n)})}const St=e.enum([`Git`,`GitTag`,`User`,`Project`,`Asset`,`JsonFile`,`Search`,`Collection`,`Entry`,`Value`]);function Ct(t){return e.object({total:e.number(),limit:e.number(),offset:e.number(),list:e.array(t)})}const Z=e.object({projectId:s,limit:e.number().optional(),offset:e.number().optional()}),wt=Z,Tt=Z.extend({collectionId:s}),Et=Z,Dt=Z.omit({projectId:!0}),Ot=e.object({path:e.string()}),Q=e.enum([`local`,`cloud`]),$=d.extend({userType:Q,language:r,localApi:e.object({isEnabled:e.boolean(),port:e.number()})}),kt=$.extend({userType:e.literal(Q.enum.local)}),At=$.extend({userType:e.literal(Q.enum.cloud),id:s}),jt=e.union([kt,At]),Mt=jt,Nt=Mt,Pt=t.string().default(`./.elek.io`),Ft=t.enum([`ts`,`js`]).default(`ts`),It=t.enum([`esm`,`cjs`]).default(`esm`),Lt=t.enum([`es3`,`es5`,`es6`,`es2015`,`es2016`,`es2017`,`es2018`,`es2019`,`es2020`,`es2021`,`es2022`,`es2023`,`es2024`,`esnext`]).default(`es2020`),Rt=t.string().default(`all`).transform(e=>e===`all`?`all`:e.split(`,`).map(e=>s.parse(e.trim()))),zt=t.object({watch:t.boolean().default(!1)}),Bt=zt.extend({separate:t.boolean().default(!1)}),Vt=t.object({outDir:Pt,language:Ft,format:It,target:Lt,options:zt}),Ht=t.string().default(`31310`).transform((e,n)=>{try{return parseInt(e)}catch{return n.addIssue({code:`custom`,message:`Invalid port number`,input:e}),t.NEVER}}),Ut=t.object({port:Ht}),Wt=t.object({outDir:Pt,projects:Rt,options:Bt}),Gt=e.enum([`core`,`desktop`]),Kt=e.object({source:Gt,message:e.string(),meta:e.record(e.string(),e.unknown()).optional()}),qt=Kt.extend({timestamp:e.string(),level:e.string()});function Jt(){return ee()}function Yt(e){return e?new Date(e).toISOString():new Date().toISOString()}function Xt(e){return n(e,{separator:`-`,lowercase:!0,decamelize:!0})}export{je as BooleanFieldDefinitionBaseSchema,z as FieldDefinitionBaseSchema,L as FieldTypeSchema,R as FieldWidthSchema,W as NumberFieldDefinitionBaseSchema,G as ReferenceFieldDefinitionBaseSchema,B as StringFieldDefinitionBaseSchema,Q as UserTypeSchema,v as ValueTypeSchema,Ut as apiStartSchema,pe as assetExportSchema,Ne as assetFieldDefinitionSchema,_ as assetFileSchema,fe as assetSchema,u as baseFileSchema,$ as baseUserSchema,nt as cloneProjectSchema,At as cloudUserSchema,q as collectionExportSchema,K as collectionFileSchema,Ie as collectionSchema,Ue as constructorElekIoCoreSchema,ye as countAssetsSchema,Ve as countCollectionsSchema,xe as countEntriesSchema,de as countGitTagsSchema,me as createAssetSchema,Le as createCollectionSchema,P as createEntrySchema,le as createGitTagSchema,Xe as createProjectSchema,it as currentBranchProjectSchema,we as dateFieldDefinitionSchema,Yt as datetime,Ee as datetimeFieldDefinitionSchema,ve as deleteAssetSchema,Be as deleteCollectionSchema,be as deleteEntrySchema,ue as deleteGitTagSchema,et as deleteProjectSchema,D as directBooleanValueSchema,E as directNumberValueSchema,T as directStringValueSchema,w as directValueBaseSchema,O as directValueSchema,He as elekIoCoreOptionsSchema,U as emailFieldDefinitionSchema,N as entryExportSchema,Pe as entryFieldDefinitionSchema,j as entryFileSchema,M as entrySchema,Wt as exportSchema,Fe as fieldDefinitionSchema,ie as fileReferenceSchema,Vt as generateApiClientSchema,ct as getChangesProjectSchema,bt as getCreateEntrySchemaFromFieldDefinitions,yt as getEntrySchemaFromFieldDefinitions,ot as getRemoteOriginUrlProjectSchema,xt as getUpdateEntrySchemaFromFieldDefinitions,X as getValueSchemaFromFieldDefinition,oe as gitCloneOptionsSchema,m as gitCommitSchema,ae as gitInitOptionsSchema,ce as gitLogOptionsSchema,se as gitMergeOptionsSchema,f as gitMessageSchema,d as gitSignatureSchema,h as gitSwitchOptionsSchema,p as gitTagSchema,Ce as ipv4FieldDefinitionSchema,Et as listAssetsSchema,rt as listBranchesProjectSchema,wt as listCollectionsSchema,Tt as listEntriesSchema,Ot as listGitTagsSchema,Dt as listProjectsSchema,kt as localUserSchema,qt as logConsoleTransportSchema,a as logLevelSchema,Kt as logSchema,Gt as logSourceSchema,ke as numberFieldDefinitionSchema,i as objectTypeSchema,Je as outdatedProjectSchema,Ct as paginatedListOf,qe as projectBranchSchema,Ye as projectExportSchema,J as projectFileSchema,Ke as projectFolderSchema,Y as projectSchema,Ge as projectSettingsSchema,We as projectStatusSchema,tt as projectUpgradeSchema,Ae as rangeFieldDefinitionSchema,he as readAssetSchema,Re as readCollectionSchema,F as readEntrySchema,g as readGitTagSchema,Ze as readProjectSchema,k as referencedValueSchema,ge as saveAssetSchema,ut as searchProjectSchema,St as serviceTypeSchema,st as setRemoteOriginUrlProjectSchema,Nt as setUserSchema,Xt as slug,Oe as stringFieldDefinitionSchema,te as supportedIconSchema,r as supportedLanguageSchema,at as switchBranchProjectSchema,lt as synchronizeProjectSchema,De as telephoneFieldDefinitionSchema,V as textFieldDefinitionSchema,H as textareaFieldDefinitionSchema,Te as timeFieldDefinitionSchema,Me as toggleFieldDefinitionSchema,re as translatableArrayOf,ne as translatableBooleanSchema,l as translatableNumberSchema,c as translatableStringSchema,_e as updateAssetSchema,ze as updateCollectionSchema,I as updateEntrySchema,Qe as updateProjectSchema,$e as upgradeProjectSchema,Se as urlFieldDefinitionSchema,jt as userFileSchema,Mt as userSchema,Jt as uuid,s as uuidSchema,y as valueContentReferenceBase,C as valueContentReferenceSchema,b as valueContentReferenceToAssetSchema,x as valueContentReferenceToCollectionSchema,S as valueContentReferenceToEntrySchema,A as valueSchema,o as versionSchema};
|
|
1141
2
|
//# sourceMappingURL=index.browser.js.map
|