@elek-io/core 0.4.1 → 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 +37 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -22
- package/dist/index.d.ts +20 -22
- package/dist/index.js +34 -42
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -62,6 +62,7 @@ __export(src_exports, {
|
|
|
62
62
|
createGitTagSchema: () => createGitTagSchema,
|
|
63
63
|
createProjectSchema: () => createProjectSchema,
|
|
64
64
|
currentBranchProjectSchema: () => currentBranchProjectSchema,
|
|
65
|
+
currentTimestamp: () => currentTimestamp,
|
|
65
66
|
dateValueDefinitionSchema: () => dateValueDefinitionSchema,
|
|
66
67
|
datetimeValueDefinitionSchema: () => datetimeValueDefinitionSchema,
|
|
67
68
|
default: () => ElekIoCore,
|
|
@@ -126,6 +127,7 @@ __export(src_exports, {
|
|
|
126
127
|
serviceTypeSchema: () => serviceTypeSchema,
|
|
127
128
|
setRemoteOriginUrlProjectSchema: () => setRemoteOriginUrlProjectSchema,
|
|
128
129
|
setUserSchema: () => setUserSchema,
|
|
130
|
+
slug: () => slug,
|
|
129
131
|
stringValueDefinitionSchema: () => stringValueDefinitionSchema,
|
|
130
132
|
supportedAssetExtensionSchema: () => supportedAssetExtensionSchema,
|
|
131
133
|
supportedAssetMimeTypeSchema: () => supportedAssetMimeTypeSchema,
|
|
@@ -151,6 +153,7 @@ __export(src_exports, {
|
|
|
151
153
|
urlValueDefinitionSchema: () => urlValueDefinitionSchema,
|
|
152
154
|
userFileSchema: () => userFileSchema,
|
|
153
155
|
userSchema: () => userSchema,
|
|
156
|
+
uuid: () => uuid,
|
|
154
157
|
uuidSchema: () => uuidSchema,
|
|
155
158
|
valueContentReferenceBase: () => valueContentReferenceBase,
|
|
156
159
|
valueContentReferenceSchema: () => valueContentReferenceSchema,
|
|
@@ -498,11 +501,10 @@ var listGitTagsSchema = import_zod5.z.object({
|
|
|
498
501
|
path: gitRepositoryPathSchema
|
|
499
502
|
});
|
|
500
503
|
|
|
501
|
-
// src/util/
|
|
502
|
-
var
|
|
503
|
-
__export(
|
|
504
|
+
// src/util/node.ts
|
|
505
|
+
var node_exports = {};
|
|
506
|
+
__export(node_exports, {
|
|
504
507
|
assignDefaultIfMissing: () => assignDefaultIfMissing,
|
|
505
|
-
currentTimestamp: () => currentTimestamp,
|
|
506
508
|
files: () => files,
|
|
507
509
|
folders: () => folders,
|
|
508
510
|
fromPath: () => fromPath,
|
|
@@ -512,9 +514,7 @@ __export(util_exports, {
|
|
|
512
514
|
notEmpty: () => notEmpty,
|
|
513
515
|
pathTo: () => pathTo,
|
|
514
516
|
returnResolved: () => returnResolved,
|
|
515
|
-
slug: () => slug,
|
|
516
517
|
spawnChildProcess: () => spawnChildProcess,
|
|
517
|
-
uuid: () => uuid,
|
|
518
518
|
workingDirectory: () => workingDirectory
|
|
519
519
|
});
|
|
520
520
|
var import_child_process = require("child_process");
|
|
@@ -522,8 +522,6 @@ var import_fs_extra = __toESM(require("fs-extra"), 1);
|
|
|
522
522
|
var import_lodash_es = require("lodash-es");
|
|
523
523
|
var import_os = __toESM(require("os"), 1);
|
|
524
524
|
var import_path = __toESM(require("path"), 1);
|
|
525
|
-
var import_slugify = __toESM(require("slugify"), 1);
|
|
526
|
-
var import_uuid = require("uuid");
|
|
527
525
|
|
|
528
526
|
// src/schema/projectSchema.ts
|
|
529
527
|
var import_zod9 = require("zod");
|
|
@@ -1029,26 +1027,7 @@ var searchProjectSchema = import_zod9.z.object({
|
|
|
1029
1027
|
type: import_zod9.z.array(objectTypeSchema).optional()
|
|
1030
1028
|
});
|
|
1031
1029
|
|
|
1032
|
-
// src/util/
|
|
1033
|
-
var Slugify = import_slugify.default.default || import_slugify.default;
|
|
1034
|
-
function uuid() {
|
|
1035
|
-
return (0, import_uuid.v4)();
|
|
1036
|
-
}
|
|
1037
|
-
function currentTimestamp() {
|
|
1038
|
-
return Math.floor(Date.now() / 1e3);
|
|
1039
|
-
}
|
|
1040
|
-
function slug(string) {
|
|
1041
|
-
return Slugify(string, {
|
|
1042
|
-
replacement: "-",
|
|
1043
|
-
// replace spaces with replacement character, defaults to `-`
|
|
1044
|
-
remove: void 0,
|
|
1045
|
-
// remove characters that match regex, defaults to `undefined`
|
|
1046
|
-
lower: true,
|
|
1047
|
-
// convert to lower case, defaults to `false`
|
|
1048
|
-
strict: true
|
|
1049
|
-
// strip special characters except replacement, defaults to `false`
|
|
1050
|
-
});
|
|
1051
|
-
}
|
|
1030
|
+
// src/util/node.ts
|
|
1052
1031
|
var workingDirectory = import_path.default.join(import_os.default.homedir(), "elek.io");
|
|
1053
1032
|
var pathTo = {
|
|
1054
1033
|
tmp: import_path.default.join(workingDirectory, "tmp"),
|
|
@@ -1217,6 +1196,29 @@ function getDuplicates(arr, key) {
|
|
|
1217
1196
|
);
|
|
1218
1197
|
}
|
|
1219
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
|
+
|
|
1220
1222
|
// src/service/AbstractCrudService.ts
|
|
1221
1223
|
var AbstractCrudService = class {
|
|
1222
1224
|
/**
|
|
@@ -1589,10 +1591,7 @@ var UserService = class {
|
|
|
1589
1591
|
*/
|
|
1590
1592
|
async get() {
|
|
1591
1593
|
try {
|
|
1592
|
-
return await this.jsonFileService.read(
|
|
1593
|
-
pathTo.userFile,
|
|
1594
|
-
userFileSchema
|
|
1595
|
-
);
|
|
1594
|
+
return await this.jsonFileService.read(pathTo.userFile, userFileSchema);
|
|
1596
1595
|
} catch (error) {
|
|
1597
1596
|
return void 0;
|
|
1598
1597
|
}
|
|
@@ -2152,11 +2151,7 @@ var AssetService = class extends AbstractCrudService {
|
|
|
2152
2151
|
props.language,
|
|
2153
2152
|
fileType.extension
|
|
2154
2153
|
);
|
|
2155
|
-
const assetFilePath = pathTo.assetFile(
|
|
2156
|
-
props.projectId,
|
|
2157
|
-
id,
|
|
2158
|
-
props.language
|
|
2159
|
-
);
|
|
2154
|
+
const assetFilePath = pathTo.assetFile(props.projectId, id, props.language);
|
|
2160
2155
|
const assetFile = {
|
|
2161
2156
|
...props,
|
|
2162
2157
|
objectType: "asset",
|
|
@@ -2421,10 +2416,7 @@ var CollectionService = class extends AbstractCrudService {
|
|
|
2421
2416
|
async update(props) {
|
|
2422
2417
|
updateCollectionSchema.parse(props);
|
|
2423
2418
|
const projectPath = pathTo.project(props.projectId);
|
|
2424
|
-
const collectionFilePath = pathTo.collectionFile(
|
|
2425
|
-
props.projectId,
|
|
2426
|
-
props.id
|
|
2427
|
-
);
|
|
2419
|
+
const collectionFilePath = pathTo.collectionFile(props.projectId, props.id);
|
|
2428
2420
|
const prevCollectionFile = await this.read(props);
|
|
2429
2421
|
const collectionFile = {
|
|
2430
2422
|
...prevCollectionFile,
|
|
@@ -3280,7 +3272,7 @@ var ElekIoCore = class {
|
|
|
3280
3272
|
* Utility / helper functions
|
|
3281
3273
|
*/
|
|
3282
3274
|
get util() {
|
|
3283
|
-
return
|
|
3275
|
+
return node_exports;
|
|
3284
3276
|
}
|
|
3285
3277
|
/**
|
|
3286
3278
|
* Exposes git functions
|
|
@@ -3359,6 +3351,7 @@ var ElekIoCore = class {
|
|
|
3359
3351
|
createGitTagSchema,
|
|
3360
3352
|
createProjectSchema,
|
|
3361
3353
|
currentBranchProjectSchema,
|
|
3354
|
+
currentTimestamp,
|
|
3362
3355
|
dateValueDefinitionSchema,
|
|
3363
3356
|
datetimeValueDefinitionSchema,
|
|
3364
3357
|
deleteAssetSchema,
|
|
@@ -3422,6 +3415,7 @@ var ElekIoCore = class {
|
|
|
3422
3415
|
serviceTypeSchema,
|
|
3423
3416
|
setRemoteOriginUrlProjectSchema,
|
|
3424
3417
|
setUserSchema,
|
|
3418
|
+
slug,
|
|
3425
3419
|
stringValueDefinitionSchema,
|
|
3426
3420
|
supportedAssetExtensionSchema,
|
|
3427
3421
|
supportedAssetMimeTypeSchema,
|
|
@@ -3447,6 +3441,7 @@ var ElekIoCore = class {
|
|
|
3447
3441
|
urlValueDefinitionSchema,
|
|
3448
3442
|
userFileSchema,
|
|
3449
3443
|
userSchema,
|
|
3444
|
+
uuid,
|
|
3450
3445
|
uuidSchema,
|
|
3451
3446
|
valueContentReferenceBase,
|
|
3452
3447
|
valueContentReferenceSchema,
|