@elek-io/core 0.5.1 → 0.5.3
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.
|
@@ -13273,18 +13273,6 @@ declare const pathTo: {
|
|
|
13273
13273
|
assetFile: (projectId: string, id: string, language: string) => string;
|
|
13274
13274
|
asset: (projectId: string, id: string, language: string, extension: string) => string;
|
|
13275
13275
|
};
|
|
13276
|
-
/**
|
|
13277
|
-
* Searches for a potential project ID in given path string and returns it
|
|
13278
|
-
*
|
|
13279
|
-
* Mainly used for logging inside the GitService, where we don't have a project ID,
|
|
13280
|
-
* but always have a path which could contain one. The ID is then used,
|
|
13281
|
-
* to log to the current project log, instead of logging to the main log file.
|
|
13282
|
-
*
|
|
13283
|
-
* @todo I really dont like this and I do not know how much performance we loose here
|
|
13284
|
-
*/
|
|
13285
|
-
declare const fromPath: {
|
|
13286
|
-
projectId: (path: string) => string | undefined;
|
|
13287
|
-
};
|
|
13288
13276
|
/**
|
|
13289
13277
|
* Returns a complete default type, hydrated with the partials of value
|
|
13290
13278
|
*/
|
|
@@ -13316,25 +13304,10 @@ declare function folders(path: string): Promise<Fs.Dirent[]>;
|
|
|
13316
13304
|
* Returns all files of given path which can be filtered by extension
|
|
13317
13305
|
*/
|
|
13318
13306
|
declare function files(path: string, extension?: string): Promise<Fs.Dirent[]>;
|
|
13319
|
-
/**
|
|
13320
|
-
* Returns the relative path for given path
|
|
13321
|
-
* by stripping out everything up to the working directory
|
|
13322
|
-
*/
|
|
13323
|
-
declare function getRelativePath(path: string): string;
|
|
13324
|
-
/**
|
|
13325
|
-
* Searches given array of objects for duplicates of given key and returns them
|
|
13326
|
-
*
|
|
13327
|
-
* @param arr Array with possible duplicate values
|
|
13328
|
-
* @param key Key of object T to get duplicates of
|
|
13329
|
-
*/
|
|
13330
|
-
declare function getDuplicates<T>(arr: T[], key: keyof T): T[];
|
|
13331
13307
|
|
|
13332
13308
|
declare const Util_assignDefaultIfMissing: typeof assignDefaultIfMissing;
|
|
13333
13309
|
declare const Util_files: typeof files;
|
|
13334
13310
|
declare const Util_folders: typeof folders;
|
|
13335
|
-
declare const Util_fromPath: typeof fromPath;
|
|
13336
|
-
declare const Util_getDuplicates: typeof getDuplicates;
|
|
13337
|
-
declare const Util_getRelativePath: typeof getRelativePath;
|
|
13338
13311
|
declare const Util_isNoError: typeof isNoError;
|
|
13339
13312
|
declare const Util_notEmpty: typeof notEmpty;
|
|
13340
13313
|
declare const Util_pathTo: typeof pathTo;
|
|
@@ -13342,7 +13315,7 @@ declare const Util_returnResolved: typeof returnResolved;
|
|
|
13342
13315
|
declare const Util_spawnChildProcess: typeof spawnChildProcess;
|
|
13343
13316
|
declare const Util_workingDirectory: typeof workingDirectory;
|
|
13344
13317
|
declare namespace Util {
|
|
13345
|
-
export { Util_assignDefaultIfMissing as assignDefaultIfMissing, Util_files as files, Util_folders as folders,
|
|
13318
|
+
export { Util_assignDefaultIfMissing as assignDefaultIfMissing, Util_files as files, Util_folders as folders, Util_isNoError as isNoError, Util_notEmpty as notEmpty, Util_pathTo as pathTo, Util_returnResolved as returnResolved, Util_spawnChildProcess as spawnChildProcess, Util_workingDirectory as workingDirectory };
|
|
13346
13319
|
}
|
|
13347
13320
|
|
|
13348
13321
|
/**
|
|
@@ -13273,18 +13273,6 @@ declare const pathTo: {
|
|
|
13273
13273
|
assetFile: (projectId: string, id: string, language: string) => string;
|
|
13274
13274
|
asset: (projectId: string, id: string, language: string, extension: string) => string;
|
|
13275
13275
|
};
|
|
13276
|
-
/**
|
|
13277
|
-
* Searches for a potential project ID in given path string and returns it
|
|
13278
|
-
*
|
|
13279
|
-
* Mainly used for logging inside the GitService, where we don't have a project ID,
|
|
13280
|
-
* but always have a path which could contain one. The ID is then used,
|
|
13281
|
-
* to log to the current project log, instead of logging to the main log file.
|
|
13282
|
-
*
|
|
13283
|
-
* @todo I really dont like this and I do not know how much performance we loose here
|
|
13284
|
-
*/
|
|
13285
|
-
declare const fromPath: {
|
|
13286
|
-
projectId: (path: string) => string | undefined;
|
|
13287
|
-
};
|
|
13288
13276
|
/**
|
|
13289
13277
|
* Returns a complete default type, hydrated with the partials of value
|
|
13290
13278
|
*/
|
|
@@ -13316,25 +13304,10 @@ declare function folders(path: string): Promise<Fs.Dirent[]>;
|
|
|
13316
13304
|
* Returns all files of given path which can be filtered by extension
|
|
13317
13305
|
*/
|
|
13318
13306
|
declare function files(path: string, extension?: string): Promise<Fs.Dirent[]>;
|
|
13319
|
-
/**
|
|
13320
|
-
* Returns the relative path for given path
|
|
13321
|
-
* by stripping out everything up to the working directory
|
|
13322
|
-
*/
|
|
13323
|
-
declare function getRelativePath(path: string): string;
|
|
13324
|
-
/**
|
|
13325
|
-
* Searches given array of objects for duplicates of given key and returns them
|
|
13326
|
-
*
|
|
13327
|
-
* @param arr Array with possible duplicate values
|
|
13328
|
-
* @param key Key of object T to get duplicates of
|
|
13329
|
-
*/
|
|
13330
|
-
declare function getDuplicates<T>(arr: T[], key: keyof T): T[];
|
|
13331
13307
|
|
|
13332
13308
|
declare const Util_assignDefaultIfMissing: typeof assignDefaultIfMissing;
|
|
13333
13309
|
declare const Util_files: typeof files;
|
|
13334
13310
|
declare const Util_folders: typeof folders;
|
|
13335
|
-
declare const Util_fromPath: typeof fromPath;
|
|
13336
|
-
declare const Util_getDuplicates: typeof getDuplicates;
|
|
13337
|
-
declare const Util_getRelativePath: typeof getRelativePath;
|
|
13338
13311
|
declare const Util_isNoError: typeof isNoError;
|
|
13339
13312
|
declare const Util_notEmpty: typeof notEmpty;
|
|
13340
13313
|
declare const Util_pathTo: typeof pathTo;
|
|
@@ -13342,7 +13315,7 @@ declare const Util_returnResolved: typeof returnResolved;
|
|
|
13342
13315
|
declare const Util_spawnChildProcess: typeof spawnChildProcess;
|
|
13343
13316
|
declare const Util_workingDirectory: typeof workingDirectory;
|
|
13344
13317
|
declare namespace Util {
|
|
13345
|
-
export { Util_assignDefaultIfMissing as assignDefaultIfMissing, Util_files as files, Util_folders as folders,
|
|
13318
|
+
export { Util_assignDefaultIfMissing as assignDefaultIfMissing, Util_files as files, Util_folders as folders, Util_isNoError as isNoError, Util_notEmpty as notEmpty, Util_pathTo as pathTo, Util_returnResolved as returnResolved, Util_spawnChildProcess as spawnChildProcess, Util_workingDirectory as workingDirectory };
|
|
13346
13319
|
}
|
|
13347
13320
|
|
|
13348
13321
|
/**
|
package/dist/node/index.node.js
CHANGED
|
@@ -936,9 +936,6 @@ __export(node_exports, {
|
|
|
936
936
|
assignDefaultIfMissing: () => assignDefaultIfMissing,
|
|
937
937
|
files: () => files,
|
|
938
938
|
folders: () => folders,
|
|
939
|
-
fromPath: () => fromPath,
|
|
940
|
-
getDuplicates: () => getDuplicates,
|
|
941
|
-
getRelativePath: () => getRelativePath,
|
|
942
939
|
isNoError: () => isNoError,
|
|
943
940
|
notEmpty: () => notEmpty,
|
|
944
941
|
pathTo: () => pathTo,
|
|
@@ -948,7 +945,6 @@ __export(node_exports, {
|
|
|
948
945
|
});
|
|
949
946
|
import { spawn } from "child_process";
|
|
950
947
|
import Fs from "fs-extra";
|
|
951
|
-
import { filter, flatten, groupBy, uniq } from "lodash-es";
|
|
952
948
|
import Os from "os";
|
|
953
949
|
import Path from "path";
|
|
954
950
|
var workingDirectory = Path.join(Os.homedir(), "elek.io");
|
|
@@ -1009,22 +1005,6 @@ var pathTo = {
|
|
|
1009
1005
|
return Path.join(pathTo.lfs(projectId), `${id}.${language}.${extension}`);
|
|
1010
1006
|
}
|
|
1011
1007
|
};
|
|
1012
|
-
var fromPath = {
|
|
1013
|
-
projectId: (path) => {
|
|
1014
|
-
const startsWith = "projects/";
|
|
1015
|
-
const endsWith = "/";
|
|
1016
|
-
const start = path.indexOf(startsWith) + startsWith.length;
|
|
1017
|
-
if (start === -1) {
|
|
1018
|
-
return void 0;
|
|
1019
|
-
}
|
|
1020
|
-
const end = path.indexOf(endsWith, start);
|
|
1021
|
-
const result = path.substring(start, end === -1 ? path.length : end);
|
|
1022
|
-
if (result && uuidSchema.safeParse(result).success) {
|
|
1023
|
-
return result;
|
|
1024
|
-
}
|
|
1025
|
-
return void 0;
|
|
1026
|
-
}
|
|
1027
|
-
};
|
|
1028
1008
|
function assignDefaultIfMissing(value, defaultsTo) {
|
|
1029
1009
|
return Object.assign(defaultsTo, value);
|
|
1030
1010
|
}
|
|
@@ -1099,25 +1079,6 @@ async function files(path, extension) {
|
|
|
1099
1079
|
return dirent2.isFile();
|
|
1100
1080
|
});
|
|
1101
1081
|
}
|
|
1102
|
-
function getRelativePath(path) {
|
|
1103
|
-
let relativePath = path.replace(workingDirectory, "");
|
|
1104
|
-
if (relativePath.startsWith("/")) {
|
|
1105
|
-
relativePath = relativePath.substr(1);
|
|
1106
|
-
}
|
|
1107
|
-
return relativePath;
|
|
1108
|
-
}
|
|
1109
|
-
function getDuplicates(arr, key) {
|
|
1110
|
-
const grouped = groupBy(arr, (item) => {
|
|
1111
|
-
return item[key];
|
|
1112
|
-
});
|
|
1113
|
-
return uniq(
|
|
1114
|
-
flatten(
|
|
1115
|
-
filter(grouped, (item) => {
|
|
1116
|
-
return item.length > 1;
|
|
1117
|
-
})
|
|
1118
|
-
)
|
|
1119
|
-
);
|
|
1120
|
-
}
|
|
1121
1082
|
|
|
1122
1083
|
// src/service/AbstractCrudService.ts
|
|
1123
1084
|
var AbstractCrudService = class {
|