@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.js CHANGED
@@ -340,11 +340,10 @@ var listGitTagsSchema = z5.object({
340
340
  path: gitRepositoryPathSchema
341
341
  });
342
342
 
343
- // src/util/index.ts
344
- var util_exports = {};
345
- __export(util_exports, {
343
+ // src/util/node.ts
344
+ var node_exports = {};
345
+ __export(node_exports, {
346
346
  assignDefaultIfMissing: () => assignDefaultIfMissing,
347
- currentTimestamp: () => currentTimestamp,
348
347
  files: () => files,
349
348
  folders: () => folders,
350
349
  fromPath: () => fromPath,
@@ -354,9 +353,7 @@ __export(util_exports, {
354
353
  notEmpty: () => notEmpty,
355
354
  pathTo: () => pathTo,
356
355
  returnResolved: () => returnResolved,
357
- slug: () => slug,
358
356
  spawnChildProcess: () => spawnChildProcess,
359
- uuid: () => uuid,
360
357
  workingDirectory: () => workingDirectory
361
358
  });
362
359
  import { spawn } from "child_process";
@@ -364,8 +361,6 @@ import Fs from "fs-extra";
364
361
  import { filter, flatten, groupBy, uniq } from "lodash-es";
365
362
  import Os from "os";
366
363
  import Path from "path";
367
- import slugify from "slugify";
368
- import { v4 as generateUuid } from "uuid";
369
364
 
370
365
  // src/schema/projectSchema.ts
371
366
  import { z as z9 } from "zod";
@@ -871,26 +866,7 @@ var searchProjectSchema = z9.object({
871
866
  type: z9.array(objectTypeSchema).optional()
872
867
  });
873
868
 
874
- // src/util/index.ts
875
- var Slugify = slugify.default || slugify;
876
- function uuid() {
877
- return generateUuid();
878
- }
879
- function currentTimestamp() {
880
- return Math.floor(Date.now() / 1e3);
881
- }
882
- function slug(string) {
883
- return Slugify(string, {
884
- replacement: "-",
885
- // replace spaces with replacement character, defaults to `-`
886
- remove: void 0,
887
- // remove characters that match regex, defaults to `undefined`
888
- lower: true,
889
- // convert to lower case, defaults to `false`
890
- strict: true
891
- // strip special characters except replacement, defaults to `false`
892
- });
893
- }
869
+ // src/util/node.ts
894
870
  var workingDirectory = Path.join(Os.homedir(), "elek.io");
895
871
  var pathTo = {
896
872
  tmp: Path.join(workingDirectory, "tmp"),
@@ -1059,6 +1035,29 @@ function getDuplicates(arr, key) {
1059
1035
  );
1060
1036
  }
1061
1037
 
1038
+ // src/util/shared.ts
1039
+ import slugify from "slugify";
1040
+ import { v4 as generateUuid } from "uuid";
1041
+ var Slugify = slugify.default || slugify;
1042
+ function uuid() {
1043
+ return generateUuid();
1044
+ }
1045
+ function currentTimestamp() {
1046
+ return Math.floor(Date.now() / 1e3);
1047
+ }
1048
+ function slug(string) {
1049
+ return Slugify(string, {
1050
+ replacement: "-",
1051
+ // replace spaces with replacement character, defaults to `-`
1052
+ remove: void 0,
1053
+ // remove characters that match regex, defaults to `undefined`
1054
+ lower: true,
1055
+ // convert to lower case, defaults to `false`
1056
+ strict: true
1057
+ // strip special characters except replacement, defaults to `false`
1058
+ });
1059
+ }
1060
+
1062
1061
  // src/service/AbstractCrudService.ts
1063
1062
  var AbstractCrudService = class {
1064
1063
  /**
@@ -1431,10 +1430,7 @@ var UserService = class {
1431
1430
  */
1432
1431
  async get() {
1433
1432
  try {
1434
- return await this.jsonFileService.read(
1435
- pathTo.userFile,
1436
- userFileSchema
1437
- );
1433
+ return await this.jsonFileService.read(pathTo.userFile, userFileSchema);
1438
1434
  } catch (error) {
1439
1435
  return void 0;
1440
1436
  }
@@ -1994,11 +1990,7 @@ var AssetService = class extends AbstractCrudService {
1994
1990
  props.language,
1995
1991
  fileType.extension
1996
1992
  );
1997
- const assetFilePath = pathTo.assetFile(
1998
- props.projectId,
1999
- id,
2000
- props.language
2001
- );
1993
+ const assetFilePath = pathTo.assetFile(props.projectId, id, props.language);
2002
1994
  const assetFile = {
2003
1995
  ...props,
2004
1996
  objectType: "asset",
@@ -2263,10 +2255,7 @@ var CollectionService = class extends AbstractCrudService {
2263
2255
  async update(props) {
2264
2256
  updateCollectionSchema.parse(props);
2265
2257
  const projectPath = pathTo.project(props.projectId);
2266
- const collectionFilePath = pathTo.collectionFile(
2267
- props.projectId,
2268
- props.id
2269
- );
2258
+ const collectionFilePath = pathTo.collectionFile(props.projectId, props.id);
2270
2259
  const prevCollectionFile = await this.read(props);
2271
2260
  const collectionFile = {
2272
2261
  ...prevCollectionFile,
@@ -3122,7 +3111,7 @@ var ElekIoCore = class {
3122
3111
  * Utility / helper functions
3123
3112
  */
3124
3113
  get util() {
3125
- return util_exports;
3114
+ return node_exports;
3126
3115
  }
3127
3116
  /**
3128
3117
  * Exposes git functions
@@ -3168,6 +3157,139 @@ var ElekIoCore = class {
3168
3157
  // }
3169
3158
  };
3170
3159
  export {
3171
- ElekIoCore as default
3160
+ BooleanValueDefinitionBaseSchema,
3161
+ NumberValueDefinitionBaseSchema,
3162
+ ReferenceValueDefinitionBaseSchema,
3163
+ StringValueDefinitionBaseSchema,
3164
+ UserTypeSchema,
3165
+ ValueDefinitionBaseSchema,
3166
+ ValueInputTypeSchema,
3167
+ ValueInputWidthSchema,
3168
+ ValueTypeSchema,
3169
+ assetExportSchema,
3170
+ assetFileSchema,
3171
+ assetSchema,
3172
+ assetValueDefinitionSchema,
3173
+ baseFileSchema,
3174
+ baseFileWithLanguageSchema,
3175
+ baseUserSchema,
3176
+ cloneProjectSchema,
3177
+ cloudUserSchema,
3178
+ collectionExportSchema,
3179
+ collectionFileSchema,
3180
+ collectionSchema,
3181
+ constructorElekIoCoreSchema,
3182
+ countAssetsSchema,
3183
+ countCollectionsSchema,
3184
+ countEntriesSchema,
3185
+ countGitTagsSchema,
3186
+ createAssetSchema,
3187
+ createCollectionSchema,
3188
+ createEntrySchema,
3189
+ createGitTagSchema,
3190
+ createProjectSchema,
3191
+ currentBranchProjectSchema,
3192
+ currentTimestamp,
3193
+ dateValueDefinitionSchema,
3194
+ datetimeValueDefinitionSchema,
3195
+ ElekIoCore as default,
3196
+ deleteAssetSchema,
3197
+ deleteCollectionSchema,
3198
+ deleteEntrySchema,
3199
+ deleteGitTagSchema,
3200
+ deleteProjectSchema,
3201
+ directBooleanValueSchema,
3202
+ directNumberValueSchema,
3203
+ directStringValueSchema,
3204
+ directValueBaseSchema,
3205
+ directValueSchema,
3206
+ elekIoCoreOptionsSchema,
3207
+ emailValueDefinitionSchema,
3208
+ entryExportSchema,
3209
+ entryFileSchema,
3210
+ entrySchema,
3211
+ entryValueDefinitionSchema,
3212
+ environmentSchema,
3213
+ fileReferenceSchema,
3214
+ getChangesProjectSchema,
3215
+ getRemoteOriginUrlProjectSchema,
3216
+ getValueContentSchemaFromDefinition,
3217
+ gitCloneOptionsSchema,
3218
+ gitCommitIconSchema,
3219
+ gitCommitSchema,
3220
+ gitInitOptionsSchema,
3221
+ gitLogOptionsSchema,
3222
+ gitRepositoryPathSchema,
3223
+ gitSignatureSchema,
3224
+ gitSwitchOptionsSchema,
3225
+ gitTagSchema,
3226
+ ipValueDefinitionSchema,
3227
+ listAssetsSchema,
3228
+ listBranchesProjectSchema,
3229
+ listCollectionsSchema,
3230
+ listEntriesSchema,
3231
+ listGitTagsSchema,
3232
+ listProjectsSchema,
3233
+ localUserSchema,
3234
+ numberValueDefinitionSchema,
3235
+ objectTypeSchema,
3236
+ projectExportSchema,
3237
+ projectFileSchema,
3238
+ projectFolderSchema,
3239
+ projectSchema,
3240
+ projectSettingsSchema,
3241
+ projectStatusSchema,
3242
+ projectUpgradeSchema,
3243
+ rangeValueDefinitionSchema,
3244
+ readAssetSchema,
3245
+ readCollectionSchema,
3246
+ readEntrySchema,
3247
+ readGitTagSchema,
3248
+ readProjectSchema,
3249
+ referencedValueSchema,
3250
+ resolvedReferencedValueSchema,
3251
+ resolvedValueContentReferenceSchema,
3252
+ resolvedValueSchema,
3253
+ searchProjectSchema,
3254
+ serviceTypeSchema,
3255
+ setRemoteOriginUrlProjectSchema,
3256
+ setUserSchema,
3257
+ slug,
3258
+ stringValueDefinitionSchema,
3259
+ supportedAssetExtensionSchema,
3260
+ supportedAssetMimeTypeSchema,
3261
+ supportedAssetTypeSchema,
3262
+ supportedIconSchema,
3263
+ supportedLanguageSchema,
3264
+ switchBranchProjectSchema,
3265
+ synchronizeProjectSchema,
3266
+ telephoneValueDefinitionSchema,
3267
+ textValueDefinitionSchema,
3268
+ textareaValueDefinitionSchema,
3269
+ timeValueDefinitionSchema,
3270
+ toggleValueDefinitionSchema,
3271
+ translatableArrayOf,
3272
+ translatableBooleanSchema,
3273
+ translatableNumberSchema,
3274
+ translatableStringSchema,
3275
+ updateAssetSchema,
3276
+ updateCollectionSchema,
3277
+ updateEntrySchema,
3278
+ updateProjectSchema,
3279
+ upgradeProjectSchema,
3280
+ urlValueDefinitionSchema,
3281
+ userFileSchema,
3282
+ userSchema,
3283
+ uuid,
3284
+ uuidSchema,
3285
+ valueContentReferenceBase,
3286
+ valueContentReferenceSchema,
3287
+ valueContentReferenceToAssetSchema,
3288
+ valueContentReferenceToCollectionSchema,
3289
+ valueContentReferenceToEntrySchema,
3290
+ valueContentReferenceWithLanguageBase,
3291
+ valueDefinitionSchema,
3292
+ valueSchema,
3293
+ versionSchema
3172
3294
  };
3173
3295
  //# sourceMappingURL=index.js.map