@elek-io/core 0.4.0 → 0.4.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/index.cjs CHANGED
@@ -30,7 +30,140 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
- default: () => ElekIoCore
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
+ default: () => ElekIoCore,
69
+ deleteAssetSchema: () => deleteAssetSchema,
70
+ deleteCollectionSchema: () => deleteCollectionSchema,
71
+ deleteEntrySchema: () => deleteEntrySchema,
72
+ deleteGitTagSchema: () => deleteGitTagSchema,
73
+ deleteProjectSchema: () => deleteProjectSchema,
74
+ directBooleanValueSchema: () => directBooleanValueSchema,
75
+ directNumberValueSchema: () => directNumberValueSchema,
76
+ directStringValueSchema: () => directStringValueSchema,
77
+ directValueBaseSchema: () => directValueBaseSchema,
78
+ directValueSchema: () => directValueSchema,
79
+ elekIoCoreOptionsSchema: () => elekIoCoreOptionsSchema,
80
+ emailValueDefinitionSchema: () => emailValueDefinitionSchema,
81
+ entryExportSchema: () => entryExportSchema,
82
+ entryFileSchema: () => entryFileSchema,
83
+ entrySchema: () => entrySchema,
84
+ entryValueDefinitionSchema: () => entryValueDefinitionSchema,
85
+ environmentSchema: () => environmentSchema,
86
+ fileReferenceSchema: () => fileReferenceSchema,
87
+ getChangesProjectSchema: () => getChangesProjectSchema,
88
+ getRemoteOriginUrlProjectSchema: () => getRemoteOriginUrlProjectSchema,
89
+ getValueContentSchemaFromDefinition: () => getValueContentSchemaFromDefinition,
90
+ gitCloneOptionsSchema: () => gitCloneOptionsSchema,
91
+ gitCommitIconSchema: () => gitCommitIconSchema,
92
+ gitCommitSchema: () => gitCommitSchema,
93
+ gitInitOptionsSchema: () => gitInitOptionsSchema,
94
+ gitLogOptionsSchema: () => gitLogOptionsSchema,
95
+ gitRepositoryPathSchema: () => gitRepositoryPathSchema,
96
+ gitSignatureSchema: () => gitSignatureSchema,
97
+ gitSwitchOptionsSchema: () => gitSwitchOptionsSchema,
98
+ gitTagSchema: () => gitTagSchema,
99
+ ipValueDefinitionSchema: () => ipValueDefinitionSchema,
100
+ listAssetsSchema: () => listAssetsSchema,
101
+ listBranchesProjectSchema: () => listBranchesProjectSchema,
102
+ listCollectionsSchema: () => listCollectionsSchema,
103
+ listEntriesSchema: () => listEntriesSchema,
104
+ listGitTagsSchema: () => listGitTagsSchema,
105
+ listProjectsSchema: () => listProjectsSchema,
106
+ localUserSchema: () => localUserSchema,
107
+ numberValueDefinitionSchema: () => numberValueDefinitionSchema,
108
+ objectTypeSchema: () => objectTypeSchema,
109
+ projectExportSchema: () => projectExportSchema,
110
+ projectFileSchema: () => projectFileSchema,
111
+ projectFolderSchema: () => projectFolderSchema,
112
+ projectSchema: () => projectSchema,
113
+ projectSettingsSchema: () => projectSettingsSchema,
114
+ projectStatusSchema: () => projectStatusSchema,
115
+ projectUpgradeSchema: () => projectUpgradeSchema,
116
+ rangeValueDefinitionSchema: () => rangeValueDefinitionSchema,
117
+ readAssetSchema: () => readAssetSchema,
118
+ readCollectionSchema: () => readCollectionSchema,
119
+ readEntrySchema: () => readEntrySchema,
120
+ readGitTagSchema: () => readGitTagSchema,
121
+ readProjectSchema: () => readProjectSchema,
122
+ referencedValueSchema: () => referencedValueSchema,
123
+ resolvedReferencedValueSchema: () => resolvedReferencedValueSchema,
124
+ resolvedValueContentReferenceSchema: () => resolvedValueContentReferenceSchema,
125
+ resolvedValueSchema: () => resolvedValueSchema,
126
+ searchProjectSchema: () => searchProjectSchema,
127
+ serviceTypeSchema: () => serviceTypeSchema,
128
+ setRemoteOriginUrlProjectSchema: () => setRemoteOriginUrlProjectSchema,
129
+ setUserSchema: () => setUserSchema,
130
+ slug: () => slug,
131
+ stringValueDefinitionSchema: () => stringValueDefinitionSchema,
132
+ supportedAssetExtensionSchema: () => supportedAssetExtensionSchema,
133
+ supportedAssetMimeTypeSchema: () => supportedAssetMimeTypeSchema,
134
+ supportedAssetTypeSchema: () => supportedAssetTypeSchema,
135
+ supportedIconSchema: () => supportedIconSchema,
136
+ supportedLanguageSchema: () => supportedLanguageSchema,
137
+ switchBranchProjectSchema: () => switchBranchProjectSchema,
138
+ synchronizeProjectSchema: () => synchronizeProjectSchema,
139
+ telephoneValueDefinitionSchema: () => telephoneValueDefinitionSchema,
140
+ textValueDefinitionSchema: () => textValueDefinitionSchema,
141
+ textareaValueDefinitionSchema: () => textareaValueDefinitionSchema,
142
+ timeValueDefinitionSchema: () => timeValueDefinitionSchema,
143
+ toggleValueDefinitionSchema: () => toggleValueDefinitionSchema,
144
+ translatableArrayOf: () => translatableArrayOf,
145
+ translatableBooleanSchema: () => translatableBooleanSchema,
146
+ translatableNumberSchema: () => translatableNumberSchema,
147
+ translatableStringSchema: () => translatableStringSchema,
148
+ updateAssetSchema: () => updateAssetSchema,
149
+ updateCollectionSchema: () => updateCollectionSchema,
150
+ updateEntrySchema: () => updateEntrySchema,
151
+ updateProjectSchema: () => updateProjectSchema,
152
+ upgradeProjectSchema: () => upgradeProjectSchema,
153
+ urlValueDefinitionSchema: () => urlValueDefinitionSchema,
154
+ userFileSchema: () => userFileSchema,
155
+ userSchema: () => userSchema,
156
+ uuid: () => uuid,
157
+ uuidSchema: () => uuidSchema,
158
+ valueContentReferenceBase: () => valueContentReferenceBase,
159
+ valueContentReferenceSchema: () => valueContentReferenceSchema,
160
+ valueContentReferenceToAssetSchema: () => valueContentReferenceToAssetSchema,
161
+ valueContentReferenceToCollectionSchema: () => valueContentReferenceToCollectionSchema,
162
+ valueContentReferenceToEntrySchema: () => valueContentReferenceToEntrySchema,
163
+ valueContentReferenceWithLanguageBase: () => valueContentReferenceWithLanguageBase,
164
+ valueDefinitionSchema: () => valueDefinitionSchema,
165
+ valueSchema: () => valueSchema,
166
+ versionSchema: () => versionSchema
34
167
  });
35
168
  module.exports = __toCommonJS(src_exports);
36
169
  var import_fs_extra7 = __toESM(require("fs-extra"), 1);
@@ -368,11 +501,10 @@ var listGitTagsSchema = import_zod5.z.object({
368
501
  path: gitRepositoryPathSchema
369
502
  });
370
503
 
371
- // src/util/index.ts
372
- var util_exports = {};
373
- __export(util_exports, {
504
+ // src/util/node.ts
505
+ var node_exports = {};
506
+ __export(node_exports, {
374
507
  assignDefaultIfMissing: () => assignDefaultIfMissing,
375
- currentTimestamp: () => currentTimestamp,
376
508
  files: () => files,
377
509
  folders: () => folders,
378
510
  fromPath: () => fromPath,
@@ -382,9 +514,7 @@ __export(util_exports, {
382
514
  notEmpty: () => notEmpty,
383
515
  pathTo: () => pathTo,
384
516
  returnResolved: () => returnResolved,
385
- slug: () => slug,
386
517
  spawnChildProcess: () => spawnChildProcess,
387
- uuid: () => uuid,
388
518
  workingDirectory: () => workingDirectory
389
519
  });
390
520
  var import_child_process = require("child_process");
@@ -392,8 +522,6 @@ var import_fs_extra = __toESM(require("fs-extra"), 1);
392
522
  var import_lodash_es = require("lodash-es");
393
523
  var import_os = __toESM(require("os"), 1);
394
524
  var import_path = __toESM(require("path"), 1);
395
- var import_slugify = __toESM(require("slugify"), 1);
396
- var import_uuid = require("uuid");
397
525
 
398
526
  // src/schema/projectSchema.ts
399
527
  var import_zod9 = require("zod");
@@ -899,26 +1027,7 @@ var searchProjectSchema = import_zod9.z.object({
899
1027
  type: import_zod9.z.array(objectTypeSchema).optional()
900
1028
  });
901
1029
 
902
- // src/util/index.ts
903
- var Slugify = import_slugify.default.default || import_slugify.default;
904
- function uuid() {
905
- return (0, import_uuid.v4)();
906
- }
907
- function currentTimestamp() {
908
- return Math.floor(Date.now() / 1e3);
909
- }
910
- function slug(string) {
911
- return Slugify(string, {
912
- replacement: "-",
913
- // replace spaces with replacement character, defaults to `-`
914
- remove: void 0,
915
- // remove characters that match regex, defaults to `undefined`
916
- lower: true,
917
- // convert to lower case, defaults to `false`
918
- strict: true
919
- // strip special characters except replacement, defaults to `false`
920
- });
921
- }
1030
+ // src/util/node.ts
922
1031
  var workingDirectory = import_path.default.join(import_os.default.homedir(), "elek.io");
923
1032
  var pathTo = {
924
1033
  tmp: import_path.default.join(workingDirectory, "tmp"),
@@ -1087,6 +1196,29 @@ function getDuplicates(arr, key) {
1087
1196
  );
1088
1197
  }
1089
1198
 
1199
+ // src/util/shared.ts
1200
+ var import_slugify = __toESM(require("slugify"), 1);
1201
+ var import_uuid = require("uuid");
1202
+ var Slugify = import_slugify.default.default || import_slugify.default;
1203
+ function uuid() {
1204
+ return (0, import_uuid.v4)();
1205
+ }
1206
+ function currentTimestamp() {
1207
+ return Math.floor(Date.now() / 1e3);
1208
+ }
1209
+ function slug(string) {
1210
+ return Slugify(string, {
1211
+ replacement: "-",
1212
+ // replace spaces with replacement character, defaults to `-`
1213
+ remove: void 0,
1214
+ // remove characters that match regex, defaults to `undefined`
1215
+ lower: true,
1216
+ // convert to lower case, defaults to `false`
1217
+ strict: true
1218
+ // strip special characters except replacement, defaults to `false`
1219
+ });
1220
+ }
1221
+
1090
1222
  // src/service/AbstractCrudService.ts
1091
1223
  var AbstractCrudService = class {
1092
1224
  /**
@@ -1459,10 +1591,7 @@ var UserService = class {
1459
1591
  */
1460
1592
  async get() {
1461
1593
  try {
1462
- return await this.jsonFileService.read(
1463
- pathTo.userFile,
1464
- userFileSchema
1465
- );
1594
+ return await this.jsonFileService.read(pathTo.userFile, userFileSchema);
1466
1595
  } catch (error) {
1467
1596
  return void 0;
1468
1597
  }
@@ -2022,11 +2151,7 @@ var AssetService = class extends AbstractCrudService {
2022
2151
  props.language,
2023
2152
  fileType.extension
2024
2153
  );
2025
- const assetFilePath = pathTo.assetFile(
2026
- props.projectId,
2027
- id,
2028
- props.language
2029
- );
2154
+ const assetFilePath = pathTo.assetFile(props.projectId, id, props.language);
2030
2155
  const assetFile = {
2031
2156
  ...props,
2032
2157
  objectType: "asset",
@@ -2291,10 +2416,7 @@ var CollectionService = class extends AbstractCrudService {
2291
2416
  async update(props) {
2292
2417
  updateCollectionSchema.parse(props);
2293
2418
  const projectPath = pathTo.project(props.projectId);
2294
- const collectionFilePath = pathTo.collectionFile(
2295
- props.projectId,
2296
- props.id
2297
- );
2419
+ const collectionFilePath = pathTo.collectionFile(props.projectId, props.id);
2298
2420
  const prevCollectionFile = await this.read(props);
2299
2421
  const collectionFile = {
2300
2422
  ...prevCollectionFile,
@@ -3150,7 +3272,7 @@ var ElekIoCore = class {
3150
3272
  * Utility / helper functions
3151
3273
  */
3152
3274
  get util() {
3153
- return util_exports;
3275
+ return node_exports;
3154
3276
  }
3155
3277
  /**
3156
3278
  * Exposes git functions
@@ -3195,4 +3317,140 @@ var ElekIoCore = class {
3195
3317
  // return this.sharedValueService;
3196
3318
  // }
3197
3319
  };
3320
+ // Annotate the CommonJS export names for ESM import in node:
3321
+ 0 && (module.exports = {
3322
+ BooleanValueDefinitionBaseSchema,
3323
+ NumberValueDefinitionBaseSchema,
3324
+ ReferenceValueDefinitionBaseSchema,
3325
+ StringValueDefinitionBaseSchema,
3326
+ UserTypeSchema,
3327
+ ValueDefinitionBaseSchema,
3328
+ ValueInputTypeSchema,
3329
+ ValueInputWidthSchema,
3330
+ ValueTypeSchema,
3331
+ assetExportSchema,
3332
+ assetFileSchema,
3333
+ assetSchema,
3334
+ assetValueDefinitionSchema,
3335
+ baseFileSchema,
3336
+ baseFileWithLanguageSchema,
3337
+ baseUserSchema,
3338
+ cloneProjectSchema,
3339
+ cloudUserSchema,
3340
+ collectionExportSchema,
3341
+ collectionFileSchema,
3342
+ collectionSchema,
3343
+ constructorElekIoCoreSchema,
3344
+ countAssetsSchema,
3345
+ countCollectionsSchema,
3346
+ countEntriesSchema,
3347
+ countGitTagsSchema,
3348
+ createAssetSchema,
3349
+ createCollectionSchema,
3350
+ createEntrySchema,
3351
+ createGitTagSchema,
3352
+ createProjectSchema,
3353
+ currentBranchProjectSchema,
3354
+ currentTimestamp,
3355
+ dateValueDefinitionSchema,
3356
+ datetimeValueDefinitionSchema,
3357
+ deleteAssetSchema,
3358
+ deleteCollectionSchema,
3359
+ deleteEntrySchema,
3360
+ deleteGitTagSchema,
3361
+ deleteProjectSchema,
3362
+ directBooleanValueSchema,
3363
+ directNumberValueSchema,
3364
+ directStringValueSchema,
3365
+ directValueBaseSchema,
3366
+ directValueSchema,
3367
+ elekIoCoreOptionsSchema,
3368
+ emailValueDefinitionSchema,
3369
+ entryExportSchema,
3370
+ entryFileSchema,
3371
+ entrySchema,
3372
+ entryValueDefinitionSchema,
3373
+ environmentSchema,
3374
+ fileReferenceSchema,
3375
+ getChangesProjectSchema,
3376
+ getRemoteOriginUrlProjectSchema,
3377
+ getValueContentSchemaFromDefinition,
3378
+ gitCloneOptionsSchema,
3379
+ gitCommitIconSchema,
3380
+ gitCommitSchema,
3381
+ gitInitOptionsSchema,
3382
+ gitLogOptionsSchema,
3383
+ gitRepositoryPathSchema,
3384
+ gitSignatureSchema,
3385
+ gitSwitchOptionsSchema,
3386
+ gitTagSchema,
3387
+ ipValueDefinitionSchema,
3388
+ listAssetsSchema,
3389
+ listBranchesProjectSchema,
3390
+ listCollectionsSchema,
3391
+ listEntriesSchema,
3392
+ listGitTagsSchema,
3393
+ listProjectsSchema,
3394
+ localUserSchema,
3395
+ numberValueDefinitionSchema,
3396
+ objectTypeSchema,
3397
+ projectExportSchema,
3398
+ projectFileSchema,
3399
+ projectFolderSchema,
3400
+ projectSchema,
3401
+ projectSettingsSchema,
3402
+ projectStatusSchema,
3403
+ projectUpgradeSchema,
3404
+ rangeValueDefinitionSchema,
3405
+ readAssetSchema,
3406
+ readCollectionSchema,
3407
+ readEntrySchema,
3408
+ readGitTagSchema,
3409
+ readProjectSchema,
3410
+ referencedValueSchema,
3411
+ resolvedReferencedValueSchema,
3412
+ resolvedValueContentReferenceSchema,
3413
+ resolvedValueSchema,
3414
+ searchProjectSchema,
3415
+ serviceTypeSchema,
3416
+ setRemoteOriginUrlProjectSchema,
3417
+ setUserSchema,
3418
+ slug,
3419
+ stringValueDefinitionSchema,
3420
+ supportedAssetExtensionSchema,
3421
+ supportedAssetMimeTypeSchema,
3422
+ supportedAssetTypeSchema,
3423
+ supportedIconSchema,
3424
+ supportedLanguageSchema,
3425
+ switchBranchProjectSchema,
3426
+ synchronizeProjectSchema,
3427
+ telephoneValueDefinitionSchema,
3428
+ textValueDefinitionSchema,
3429
+ textareaValueDefinitionSchema,
3430
+ timeValueDefinitionSchema,
3431
+ toggleValueDefinitionSchema,
3432
+ translatableArrayOf,
3433
+ translatableBooleanSchema,
3434
+ translatableNumberSchema,
3435
+ translatableStringSchema,
3436
+ updateAssetSchema,
3437
+ updateCollectionSchema,
3438
+ updateEntrySchema,
3439
+ updateProjectSchema,
3440
+ upgradeProjectSchema,
3441
+ urlValueDefinitionSchema,
3442
+ userFileSchema,
3443
+ userSchema,
3444
+ uuid,
3445
+ uuidSchema,
3446
+ valueContentReferenceBase,
3447
+ valueContentReferenceSchema,
3448
+ valueContentReferenceToAssetSchema,
3449
+ valueContentReferenceToCollectionSchema,
3450
+ valueContentReferenceToEntrySchema,
3451
+ valueContentReferenceWithLanguageBase,
3452
+ valueDefinitionSchema,
3453
+ valueSchema,
3454
+ versionSchema
3455
+ });
3198
3456
  //# sourceMappingURL=index.cjs.map