@elek-io/core 0.15.3 → 0.16.0
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/astro/index.astro.d.mts +60 -0
- package/dist/astro/index.astro.mjs +3864 -0
- package/dist/astro/index.astro.mjs.map +1 -0
- package/dist/browser/index.browser.d.ts +158 -45
- package/dist/browser/index.browser.js +1 -1
- package/dist/browser/index.browser.js.map +1 -1
- package/dist/cli/{index.cli.js → index.cli.mjs} +292 -148
- package/dist/node/chunk-DQk6qfdC.mjs +18 -0
- package/dist/node/{index.node.d.ts → index.node.d.mts} +149 -36
- package/dist/node/{index.node.js → index.node.mjs} +122 -98
- package/dist/node/index.node.mjs.map +1 -0
- package/package.json +44 -30
- package/dist/node/chunk-Bp6m_JJh.js +0 -13
- package/dist/node/index.node.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as
|
|
1
|
+
import { t as __exportAll } from "./chunk-DQk6qfdC.mjs";
|
|
2
2
|
import Fs from "fs-extra";
|
|
3
3
|
import { serve } from "@hono/node-server";
|
|
4
4
|
import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
|
|
@@ -8,13 +8,13 @@ import { cors } from "hono/cors";
|
|
|
8
8
|
import { trimTrailingSlash } from "hono/trailing-slash";
|
|
9
9
|
import { z as z$1 } from "zod";
|
|
10
10
|
import { Scalar } from "@scalar/hono-api-reference";
|
|
11
|
-
import Os from "os";
|
|
12
|
-
import Path from "path";
|
|
13
|
-
import { execFile } from "child_process";
|
|
11
|
+
import Os from "node:os";
|
|
12
|
+
import Path from "node:path";
|
|
13
|
+
import { execFile } from "node:child_process";
|
|
14
14
|
import mime from "mime";
|
|
15
15
|
import slugify from "@sindresorhus/slugify";
|
|
16
16
|
import { v4 } from "uuid";
|
|
17
|
-
import {
|
|
17
|
+
import { exec } from "dugite";
|
|
18
18
|
import PQueue from "p-queue";
|
|
19
19
|
import { createLogger, format, transports } from "winston";
|
|
20
20
|
import DailyRotateFile from "winston-daily-rotate-file";
|
|
@@ -23,24 +23,34 @@ import Semver from "semver";
|
|
|
23
23
|
//#region package.json
|
|
24
24
|
var package_default = {
|
|
25
25
|
name: "@elek-io/core",
|
|
26
|
-
version: "0.
|
|
26
|
+
version: "0.16.0",
|
|
27
27
|
description: "Handles core functionality of elek.io Projects like file IO and version control.",
|
|
28
28
|
homepage: "https://elek.io",
|
|
29
29
|
repository: "https://github.com/elek-io/core",
|
|
30
30
|
bugs: { "url": "https://github.com/elek-io/core/issues" },
|
|
31
31
|
type: "module",
|
|
32
|
-
bin: { "elek": "./dist/cli/index.cli.
|
|
33
|
-
files: [
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
32
|
+
bin: { "elek": "./dist/cli/index.cli.mjs" },
|
|
33
|
+
files: [
|
|
34
|
+
"dist/node",
|
|
35
|
+
"dist/browser",
|
|
36
|
+
"dist/astro"
|
|
37
|
+
],
|
|
38
|
+
exports: {
|
|
39
|
+
".": {
|
|
40
|
+
"node": { "import": {
|
|
41
|
+
"types": "./dist/node/index.node.d.mts",
|
|
42
|
+
"default": "./dist/node/index.node.mjs"
|
|
43
|
+
} },
|
|
44
|
+
"import": {
|
|
45
|
+
"types": "./dist/browser/index.browser.d.ts",
|
|
46
|
+
"default": "./dist/browser/index.browser.js"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"./astro": { "import": {
|
|
50
|
+
"types": "./dist/astro/index.astro.d.mts",
|
|
51
|
+
"default": "./dist/astro/index.astro.mjs"
|
|
52
|
+
} }
|
|
53
|
+
},
|
|
44
54
|
pnpm: { "overrides": {} },
|
|
45
55
|
scripts: {
|
|
46
56
|
"lint": "eslint",
|
|
@@ -55,44 +65,49 @@ var package_default = {
|
|
|
55
65
|
},
|
|
56
66
|
dependencies: {
|
|
57
67
|
"@commander-js/extra-typings": "14.0.0",
|
|
58
|
-
"@hono/node-server": "1.19.
|
|
59
|
-
"@hono/zod-openapi": "1.
|
|
60
|
-
"@scalar/hono-api-reference": "0.
|
|
68
|
+
"@hono/node-server": "1.19.11",
|
|
69
|
+
"@hono/zod-openapi": "1.2.2",
|
|
70
|
+
"@scalar/hono-api-reference": "0.10.0",
|
|
61
71
|
"@sindresorhus/slugify": "3.0.0",
|
|
62
|
-
"chokidar": "
|
|
72
|
+
"chokidar": "5.0.0",
|
|
63
73
|
"code-block-writer": "13.0.3",
|
|
64
|
-
"commander": "14.0.
|
|
65
|
-
"fs-extra": "11.3.
|
|
66
|
-
"hono": "4.
|
|
74
|
+
"commander": "14.0.3",
|
|
75
|
+
"fs-extra": "11.3.4",
|
|
76
|
+
"hono": "4.12.5",
|
|
67
77
|
"mime": "4.1.0",
|
|
68
|
-
"p-queue": "9.
|
|
69
|
-
"semver": "7.7.
|
|
70
|
-
"tsdown": "0.
|
|
78
|
+
"p-queue": "9.1.0",
|
|
79
|
+
"semver": "7.7.4",
|
|
80
|
+
"tsdown": "0.21.0",
|
|
71
81
|
"uuid": "13.0.0",
|
|
72
|
-
"winston": "3.
|
|
82
|
+
"winston": "3.19.0",
|
|
73
83
|
"winston-daily-rotate-file": "5.0.0",
|
|
74
|
-
"zod": "4.
|
|
84
|
+
"zod": "4.3.6"
|
|
75
85
|
},
|
|
76
86
|
devDependencies: {
|
|
77
|
-
"@changesets/cli": "2.
|
|
78
|
-
"@eslint/js": "
|
|
79
|
-
"@faker-js/faker": "10.
|
|
80
|
-
"@tsconfig/
|
|
81
|
-
"@tsconfig/strictest": "2.0.
|
|
87
|
+
"@changesets/cli": "2.30.0",
|
|
88
|
+
"@eslint/js": "10.0.1",
|
|
89
|
+
"@faker-js/faker": "10.3.0",
|
|
90
|
+
"@tsconfig/node24": "24.0.4",
|
|
91
|
+
"@tsconfig/strictest": "2.0.8",
|
|
82
92
|
"@types/fs-extra": "11.0.4",
|
|
83
|
-
"@types/node": "
|
|
93
|
+
"@types/node": "24.12.0",
|
|
84
94
|
"@types/semver": "7.7.1",
|
|
85
|
-
"@vitest/coverage-v8": "4.0.
|
|
86
|
-
"
|
|
95
|
+
"@vitest/coverage-v8": "4.0.18",
|
|
96
|
+
"astro": "5.18.0",
|
|
97
|
+
"eslint": "10.0.3",
|
|
87
98
|
"eslint-config-prettier": "10.1.8",
|
|
88
|
-
"globals": "
|
|
99
|
+
"globals": "17.4.0",
|
|
89
100
|
"jiti": "2.6.1",
|
|
90
|
-
"prettier": "3.
|
|
101
|
+
"prettier": "3.8.1",
|
|
91
102
|
"typescript": "5.9.3",
|
|
92
|
-
"typescript-eslint": "8.
|
|
93
|
-
"vitest": "4.0.
|
|
103
|
+
"typescript-eslint": "8.56.1",
|
|
104
|
+
"vitest": "4.0.18"
|
|
105
|
+
},
|
|
106
|
+
peerDependencies: {
|
|
107
|
+
"astro": ">=5.0.0",
|
|
108
|
+
"dugite": "3.2.0"
|
|
94
109
|
},
|
|
95
|
-
|
|
110
|
+
peerDependenciesMeta: { "astro": { "optional": true } }
|
|
96
111
|
};
|
|
97
112
|
|
|
98
113
|
//#endregion
|
|
@@ -102,10 +117,10 @@ var package_default = {
|
|
|
102
117
|
*/
|
|
103
118
|
const requestResponseLogger = createMiddleware(async (c, next) => {
|
|
104
119
|
const { method, url } = c.req;
|
|
105
|
-
const requestId
|
|
120
|
+
const requestId = c.get("requestId");
|
|
106
121
|
c.var.logService.info({
|
|
107
122
|
source: "core",
|
|
108
|
-
message: `Recieved API request "${method} ${url}" with requestId ${requestId
|
|
123
|
+
message: `Recieved API request "${method} ${url}" with requestId ${requestId}`
|
|
109
124
|
});
|
|
110
125
|
const start = Date.now();
|
|
111
126
|
await next();
|
|
@@ -113,7 +128,7 @@ const requestResponseLogger = createMiddleware(async (c, next) => {
|
|
|
113
128
|
const statusCode = c.res.status.toString();
|
|
114
129
|
const resultLog = {
|
|
115
130
|
source: "core",
|
|
116
|
-
message: `Response for API request "${method} ${url}" with requestId ${requestId
|
|
131
|
+
message: `Response for API request "${method} ${url}" with requestId ${requestId} and status code ${statusCode} in ${durationMs}ms`
|
|
117
132
|
};
|
|
118
133
|
if (statusCode.startsWith("2")) c.var.logService.info(resultLog);
|
|
119
134
|
else if (statusCode.startsWith("3")) c.var.logService.warn(resultLog);
|
|
@@ -223,19 +238,19 @@ const logLevelSchema = z.enum([
|
|
|
223
238
|
"debug"
|
|
224
239
|
]);
|
|
225
240
|
const versionSchema = z.string();
|
|
226
|
-
const uuidSchema = z.uuid(
|
|
241
|
+
const uuidSchema = z.uuid();
|
|
227
242
|
/**
|
|
228
243
|
* A record that can be used to translate a string value into all supported languages
|
|
229
244
|
*/
|
|
230
|
-
const translatableStringSchema = z.partialRecord(supportedLanguageSchema, z.string().trim().min(1
|
|
245
|
+
const translatableStringSchema = z.partialRecord(supportedLanguageSchema, z.string().trim().min(1));
|
|
231
246
|
/**
|
|
232
247
|
* A record that can be used to translate a number value into all supported languages
|
|
233
248
|
*/
|
|
234
|
-
const translatableNumberSchema = z.partialRecord(supportedLanguageSchema, z.number(
|
|
249
|
+
const translatableNumberSchema = z.partialRecord(supportedLanguageSchema, z.number());
|
|
235
250
|
/**
|
|
236
251
|
* A record that can be used to translate a boolean value into all supported languages
|
|
237
252
|
*/
|
|
238
|
-
const translatableBooleanSchema = z.partialRecord(supportedLanguageSchema, z.boolean(
|
|
253
|
+
const translatableBooleanSchema = z.partialRecord(supportedLanguageSchema, z.boolean());
|
|
239
254
|
function translatableArrayOf(schema) {
|
|
240
255
|
return z.partialRecord(supportedLanguageSchema, z.array(schema));
|
|
241
256
|
}
|
|
@@ -670,8 +685,8 @@ const projectBranchSchema = z.enum(["production", "work"]);
|
|
|
670
685
|
const projectFileSchema = baseFileSchema.extend({
|
|
671
686
|
objectType: z.literal(objectTypeSchema.enum.project).readonly(),
|
|
672
687
|
coreVersion: versionSchema,
|
|
673
|
-
name: z.string().trim().min(1
|
|
674
|
-
description: z.string().trim().min(1
|
|
688
|
+
name: z.string().trim().min(1),
|
|
689
|
+
description: z.string().trim().min(1),
|
|
675
690
|
version: versionSchema,
|
|
676
691
|
status: projectStatusSchema,
|
|
677
692
|
settings: projectSettingsSchema
|
|
@@ -741,6 +756,12 @@ const searchProjectSchema = z.object({
|
|
|
741
756
|
//#endregion
|
|
742
757
|
//#region src/schema/schemaFromFieldDefinition.ts
|
|
743
758
|
/**
|
|
759
|
+
* Dynamic zod schema generation
|
|
760
|
+
*
|
|
761
|
+
* Altough everything is already strictly typed, a type of string might not be an email or text of a certain length.
|
|
762
|
+
* To validate this, we need to generate zod schemas based on Field definitions the user created.
|
|
763
|
+
*/
|
|
764
|
+
/**
|
|
744
765
|
* Boolean Values are always either true or false, so we don't need the Field definition here
|
|
745
766
|
*/
|
|
746
767
|
function getBooleanValueContentSchemaFromFieldDefinition() {
|
|
@@ -792,7 +813,7 @@ function getStringValueContentSchemaFromFieldDefinition(fieldDefinition) {
|
|
|
792
813
|
if ("min" in fieldDefinition && fieldDefinition.min) schema = schema.min(fieldDefinition.min);
|
|
793
814
|
if ("max" in fieldDefinition && fieldDefinition.max) schema = schema.max(fieldDefinition.max);
|
|
794
815
|
if (fieldDefinition.isRequired === false) return schema.nullable();
|
|
795
|
-
return schema.min(1
|
|
816
|
+
return schema.min(1);
|
|
796
817
|
}
|
|
797
818
|
/**
|
|
798
819
|
* Reference Values can reference either Assets or Entries (or Shared Values in the future)
|
|
@@ -808,7 +829,7 @@ function getReferenceValueContentSchemaFromFieldDefinition(fieldDefinition) {
|
|
|
808
829
|
schema = z.array(valueContentReferenceToEntrySchema);
|
|
809
830
|
break;
|
|
810
831
|
}
|
|
811
|
-
if (fieldDefinition.isRequired) schema = schema.min(1
|
|
832
|
+
if (fieldDefinition.isRequired) schema = schema.min(1);
|
|
812
833
|
if (fieldDefinition.min) schema = schema.min(fieldDefinition.min);
|
|
813
834
|
if (fieldDefinition.max) schema = schema.max(fieldDefinition.max);
|
|
814
835
|
return schema;
|
|
@@ -953,7 +974,7 @@ const projectsSchema = z$1.string().default("all").transform((value) => {
|
|
|
953
974
|
return value.split(",").map((v) => uuidSchema.parse(v.trim()));
|
|
954
975
|
});
|
|
955
976
|
const generateApiClientOptionsSchema = z$1.object({ watch: z$1.boolean().default(false) });
|
|
956
|
-
const exportProjectsOptionsSchema = generateApiClientOptionsSchema.extend({
|
|
977
|
+
const exportProjectsOptionsSchema = generateApiClientOptionsSchema.extend({ watch: z$1.boolean().default(false) });
|
|
957
978
|
const generateApiClientSchema = z$1.object({
|
|
958
979
|
outDir: outDirSchema,
|
|
959
980
|
language: languageSchema,
|
|
@@ -977,6 +998,7 @@ const apiStartSchema = z$1.object({ port: portSchema });
|
|
|
977
998
|
const exportSchema = z$1.object({
|
|
978
999
|
outDir: outDirSchema,
|
|
979
1000
|
projects: projectsSchema,
|
|
1001
|
+
template: z$1.enum(["nested", "separate"]).default("nested"),
|
|
980
1002
|
options: exportProjectsOptionsSchema
|
|
981
1003
|
});
|
|
982
1004
|
|
|
@@ -1055,7 +1077,6 @@ const router$6 = createRouter().openapi(createRoute({
|
|
|
1055
1077
|
const project = await c.var.projectService.read({ id: projectId });
|
|
1056
1078
|
return c.json(project, 200);
|
|
1057
1079
|
});
|
|
1058
|
-
var projects_default = router$6;
|
|
1059
1080
|
|
|
1060
1081
|
//#endregion
|
|
1061
1082
|
//#region src/api/routes/content/v1/collections.ts
|
|
@@ -1141,7 +1162,6 @@ const router$5 = createRouter().openapi(createRoute({
|
|
|
1141
1162
|
});
|
|
1142
1163
|
return c.json(collection, 200);
|
|
1143
1164
|
});
|
|
1144
|
-
var collections_default = router$5;
|
|
1145
1165
|
|
|
1146
1166
|
//#endregion
|
|
1147
1167
|
//#region src/api/routes/content/v1/entries.ts
|
|
@@ -1248,7 +1268,6 @@ const router$4 = createRouter().openapi(createRoute({
|
|
|
1248
1268
|
});
|
|
1249
1269
|
return c.json(entry, 200);
|
|
1250
1270
|
});
|
|
1251
|
-
var entries_default = router$4;
|
|
1252
1271
|
|
|
1253
1272
|
//#endregion
|
|
1254
1273
|
//#region src/api/routes/content/v1/assets.ts
|
|
@@ -1334,22 +1353,18 @@ const router$3 = createRouter().openapi(createRoute({
|
|
|
1334
1353
|
});
|
|
1335
1354
|
return c.json(asset, 200);
|
|
1336
1355
|
});
|
|
1337
|
-
var assets_default = router$3;
|
|
1338
1356
|
|
|
1339
1357
|
//#endregion
|
|
1340
1358
|
//#region src/api/routes/content/v1/index.ts
|
|
1341
|
-
const router$2 = createRouter().route("/projects",
|
|
1342
|
-
var v1_default = router$2;
|
|
1359
|
+
const router$2 = createRouter().route("/projects", router$6).route("/projects", router$5).route("/projects", router$4).route("/projects", router$3);
|
|
1343
1360
|
|
|
1344
1361
|
//#endregion
|
|
1345
1362
|
//#region src/api/routes/content/index.ts
|
|
1346
|
-
const router$1 = createRouter().route("/v1",
|
|
1347
|
-
var content_default = router$1;
|
|
1363
|
+
const router$1 = createRouter().route("/v1", router$2);
|
|
1348
1364
|
|
|
1349
1365
|
//#endregion
|
|
1350
1366
|
//#region src/api/routes/index.ts
|
|
1351
|
-
const router = createRouter().route("/content",
|
|
1352
|
-
var routes_default = router;
|
|
1367
|
+
const router = createRouter().route("/content", router$1);
|
|
1353
1368
|
|
|
1354
1369
|
//#endregion
|
|
1355
1370
|
//#region src/api/index.ts
|
|
@@ -1367,7 +1382,7 @@ var LocalApi = class {
|
|
|
1367
1382
|
this.collectionService = collectionService;
|
|
1368
1383
|
this.entryService = entryService;
|
|
1369
1384
|
this.assetService = assetService;
|
|
1370
|
-
this.api = createApi(this.logService, this.projectService, this.collectionService, this.entryService, this.assetService).route("/",
|
|
1385
|
+
this.api = createApi(this.logService, this.projectService, this.collectionService, this.entryService, this.assetService).route("/", router).doc("/openapi.json", {
|
|
1371
1386
|
openapi: "3.0.0",
|
|
1372
1387
|
externalDocs: { url: "https://elek.io/docs" },
|
|
1373
1388
|
info: {
|
|
@@ -1471,7 +1486,7 @@ var RequiredParameterMissingError = class extends Error {
|
|
|
1471
1486
|
|
|
1472
1487
|
//#endregion
|
|
1473
1488
|
//#region src/util/node.ts
|
|
1474
|
-
var node_exports = /* @__PURE__ */
|
|
1489
|
+
var node_exports = /* @__PURE__ */ __exportAll({
|
|
1475
1490
|
execCommand: () => execCommand,
|
|
1476
1491
|
files: () => files,
|
|
1477
1492
|
folders: () => folders,
|
|
@@ -1638,8 +1653,8 @@ var AbstractCrudService = class {
|
|
|
1638
1653
|
/**
|
|
1639
1654
|
* Do not instantiate directly as this is an abstract class
|
|
1640
1655
|
*/
|
|
1641
|
-
constructor(type
|
|
1642
|
-
this.type = type
|
|
1656
|
+
constructor(type, options, logService) {
|
|
1657
|
+
this.type = type;
|
|
1643
1658
|
this.options = options;
|
|
1644
1659
|
this.logService = logService;
|
|
1645
1660
|
}
|
|
@@ -1675,8 +1690,8 @@ var AbstractCrudService = class {
|
|
|
1675
1690
|
* @param projectId Project to get all asset references from
|
|
1676
1691
|
* @param collectionId Only needed when requesting files of type "Entry"
|
|
1677
1692
|
*/
|
|
1678
|
-
async listReferences(type
|
|
1679
|
-
switch (type
|
|
1693
|
+
async listReferences(type, projectId, collectionId) {
|
|
1694
|
+
switch (type) {
|
|
1680
1695
|
case objectTypeSchema.enum.asset:
|
|
1681
1696
|
if (!projectId) throw new RequiredParameterMissingError("projectId");
|
|
1682
1697
|
return this.getFileReferences(pathTo.lfs(projectId));
|
|
@@ -1691,7 +1706,7 @@ var AbstractCrudService = class {
|
|
|
1691
1706
|
case objectTypeSchema.enum.sharedValue:
|
|
1692
1707
|
if (!projectId) throw new RequiredParameterMissingError("projectId");
|
|
1693
1708
|
return this.getFileReferences(pathTo.sharedValues(projectId));
|
|
1694
|
-
default: throw new Error(`Trying to list files of unsupported type "${type
|
|
1709
|
+
default: throw new Error(`Trying to list files of unsupported type "${type}"`);
|
|
1695
1710
|
}
|
|
1696
1711
|
}
|
|
1697
1712
|
async getFolderReferences(path) {
|
|
@@ -1911,9 +1926,9 @@ var AssetService = class extends AbstractCrudService {
|
|
|
1911
1926
|
async list(props) {
|
|
1912
1927
|
listAssetsSchema.parse(props);
|
|
1913
1928
|
const offset = props.offset || 0;
|
|
1914
|
-
const limit = props.limit
|
|
1929
|
+
const limit = props.limit ?? 15;
|
|
1915
1930
|
const assetReferences = await this.listReferences(objectTypeSchema.enum.asset, props.projectId);
|
|
1916
|
-
const partialAssetReferences = assetReferences.slice(offset, limit);
|
|
1931
|
+
const partialAssetReferences = limit === 0 ? assetReferences.slice(offset) : assetReferences.slice(offset, offset + limit);
|
|
1917
1932
|
const assets = await this.returnResolved(partialAssetReferences.map((assetReference) => {
|
|
1918
1933
|
return this.read({
|
|
1919
1934
|
projectId: props.projectId,
|
|
@@ -2096,9 +2111,9 @@ var CollectionService = class extends AbstractCrudService {
|
|
|
2096
2111
|
async list(props) {
|
|
2097
2112
|
listCollectionsSchema.parse(props);
|
|
2098
2113
|
const offset = props.offset || 0;
|
|
2099
|
-
const limit = props.limit
|
|
2114
|
+
const limit = props.limit ?? 15;
|
|
2100
2115
|
const collectionReferences = await this.listReferences(objectTypeSchema.enum.collection, props.projectId);
|
|
2101
|
-
const partialCollectionReferences = collectionReferences.slice(offset, limit);
|
|
2116
|
+
const partialCollectionReferences = limit === 0 ? collectionReferences.slice(offset) : collectionReferences.slice(offset, offset + limit);
|
|
2102
2117
|
const collections = await this.returnResolved(partialCollectionReferences.map((reference) => {
|
|
2103
2118
|
return this.read({
|
|
2104
2119
|
projectId: props.projectId,
|
|
@@ -2261,9 +2276,9 @@ var EntryService = class extends AbstractCrudService {
|
|
|
2261
2276
|
async list(props) {
|
|
2262
2277
|
listEntriesSchema.parse(props);
|
|
2263
2278
|
const offset = props.offset || 0;
|
|
2264
|
-
const limit = props.limit
|
|
2279
|
+
const limit = props.limit ?? 15;
|
|
2265
2280
|
const entryReferences = await this.listReferences(objectTypeSchema.enum.entry, props.projectId, props.collectionId);
|
|
2266
|
-
const partialEntryReferences = entryReferences.slice(offset, limit);
|
|
2281
|
+
const partialEntryReferences = limit === 0 ? entryReferences.slice(offset) : entryReferences.slice(offset, offset + limit);
|
|
2267
2282
|
const entries = await this.returnResolved(partialEntryReferences.map((reference) => {
|
|
2268
2283
|
return this.read({
|
|
2269
2284
|
projectId: props.projectId,
|
|
@@ -2349,8 +2364,8 @@ var GitTagService = class extends AbstractCrudService {
|
|
|
2349
2364
|
*/
|
|
2350
2365
|
async read(props) {
|
|
2351
2366
|
readGitTagSchema.parse(props);
|
|
2352
|
-
const tag = (await this.list({ path: props.path })).list.find((tag
|
|
2353
|
-
return tag
|
|
2367
|
+
const tag = (await this.list({ path: props.path })).list.find((tag) => {
|
|
2368
|
+
return tag.id === props.id;
|
|
2354
2369
|
});
|
|
2355
2370
|
if (!tag) throw new GitError(`Provided tag with UUID "${props.id}" did not match any known tags`);
|
|
2356
2371
|
return tag;
|
|
@@ -2541,11 +2556,11 @@ var GitService = class {
|
|
|
2541
2556
|
* @param path Path to the repository
|
|
2542
2557
|
* @param files Files to add
|
|
2543
2558
|
*/
|
|
2544
|
-
async add(path, files
|
|
2559
|
+
async add(path, files) {
|
|
2545
2560
|
const args = [
|
|
2546
2561
|
"add",
|
|
2547
2562
|
"--",
|
|
2548
|
-
...files
|
|
2563
|
+
...files.map((filePath) => {
|
|
2549
2564
|
return filePath.replace(`${path}${Path.sep}`, "");
|
|
2550
2565
|
})
|
|
2551
2566
|
];
|
|
@@ -2819,11 +2834,11 @@ var GitService = class {
|
|
|
2819
2834
|
* @param path Path to the repository
|
|
2820
2835
|
* @param name Name to check
|
|
2821
2836
|
*/
|
|
2822
|
-
async checkBranchOrTagName(path, name
|
|
2837
|
+
async checkBranchOrTagName(path, name) {
|
|
2823
2838
|
await this.git(path, [
|
|
2824
2839
|
"check-ref-format",
|
|
2825
2840
|
"--allow-onelevel",
|
|
2826
|
-
name
|
|
2841
|
+
name
|
|
2827
2842
|
]);
|
|
2828
2843
|
}
|
|
2829
2844
|
/**
|
|
@@ -2882,7 +2897,7 @@ var GitService = class {
|
|
|
2882
2897
|
const result = await this.queue.add(async () => {
|
|
2883
2898
|
const start = Date.now();
|
|
2884
2899
|
return {
|
|
2885
|
-
gitResult: await
|
|
2900
|
+
gitResult: await exec(args, path, options),
|
|
2886
2901
|
durationMs: Date.now() - start
|
|
2887
2902
|
};
|
|
2888
2903
|
});
|
|
@@ -2894,8 +2909,12 @@ var GitService = class {
|
|
|
2894
2909
|
};
|
|
2895
2910
|
if (result.durationMs >= 100) this.logService.warn(gitLog);
|
|
2896
2911
|
else this.logService.debug(gitLog);
|
|
2897
|
-
if (result.gitResult.exitCode !== 0) throw new GitError(`Git ${this.version} (${this.gitPath}) command "git ${args.join(" ")}" executed for "${path}" failed with exit code "${result.gitResult.exitCode}" and message "${result.gitResult.stderr.trim() || result.gitResult.stdout.trim()}"`);
|
|
2898
|
-
return
|
|
2912
|
+
if (result.gitResult.exitCode !== 0) throw new GitError(`Git ${this.version} (${this.gitPath}) command "git ${args.join(" ")}" executed for "${path}" failed with exit code "${result.gitResult.exitCode}" and message "${result.gitResult.stderr.toString().trim() || result.gitResult.stdout.toString().trim()}"`);
|
|
2913
|
+
return {
|
|
2914
|
+
...result.gitResult,
|
|
2915
|
+
stdout: result.gitResult.stdout.toString(),
|
|
2916
|
+
stderr: result.gitResult.stderr.toString()
|
|
2917
|
+
};
|
|
2899
2918
|
}
|
|
2900
2919
|
};
|
|
2901
2920
|
|
|
@@ -2944,8 +2963,8 @@ var JsonFileService = class extends AbstractCrudService {
|
|
|
2944
2963
|
source: "core",
|
|
2945
2964
|
message: `Cache hit reading file "${path}"`
|
|
2946
2965
|
});
|
|
2947
|
-
const json
|
|
2948
|
-
return schema.parse(json
|
|
2966
|
+
const json = this.cache.get(path);
|
|
2967
|
+
return schema.parse(json);
|
|
2949
2968
|
}
|
|
2950
2969
|
this.logService.debug({
|
|
2951
2970
|
source: "core",
|
|
@@ -3050,13 +3069,18 @@ var LogService = class {
|
|
|
3050
3069
|
handleExceptions: true,
|
|
3051
3070
|
handleRejections: true,
|
|
3052
3071
|
format: format.combine(format.colorize(), format.timestamp({ format: "HH:mm:ss" }), format.printf((props) => {
|
|
3053
|
-
const
|
|
3054
|
-
|
|
3072
|
+
const splatArgs = props[Symbol.for("splat")];
|
|
3073
|
+
const result = logConsoleTransportSchema.safeParse({
|
|
3074
|
+
...splatArgs?.[0] ?? {},
|
|
3055
3075
|
timestamp: props["timestamp"],
|
|
3056
3076
|
level: props.level,
|
|
3057
3077
|
message: props.message
|
|
3058
3078
|
});
|
|
3059
|
-
|
|
3079
|
+
if (result.success) {
|
|
3080
|
+
const { timestamp, level, source, message } = result.data;
|
|
3081
|
+
return `${timestamp} [${source}] ${level}: ${message}`;
|
|
3082
|
+
}
|
|
3083
|
+
return `${String(props["timestamp"])} ${props.level}: ${String(props.message)}`;
|
|
3060
3084
|
}))
|
|
3061
3085
|
});
|
|
3062
3086
|
this.logger = createLogger({
|
|
@@ -3387,9 +3411,9 @@ var ProjectService = class extends AbstractCrudService {
|
|
|
3387
3411
|
async list(props) {
|
|
3388
3412
|
if (props) listProjectsSchema.parse(props);
|
|
3389
3413
|
const offset = props?.offset || 0;
|
|
3390
|
-
const limit = props?.limit
|
|
3414
|
+
const limit = props?.limit ?? 15;
|
|
3391
3415
|
const projectReferences = await this.listReferences(objectTypeSchema.enum.project);
|
|
3392
|
-
const partialProjectReferences = projectReferences.slice(offset, limit);
|
|
3416
|
+
const partialProjectReferences = limit === 0 ? projectReferences.slice(offset) : projectReferences.slice(offset, offset + limit);
|
|
3393
3417
|
const projects = await this.returnResolved(partialProjectReferences.map((reference) => {
|
|
3394
3418
|
return this.read({ id: reference.id });
|
|
3395
3419
|
}));
|
|
@@ -3438,8 +3462,8 @@ var ProjectService = class extends AbstractCrudService {
|
|
|
3438
3462
|
* committed
|
|
3439
3463
|
*/
|
|
3440
3464
|
async createFolderStructure(path) {
|
|
3441
|
-
const folders
|
|
3442
|
-
await Promise.all(folders
|
|
3465
|
+
const folders = Object.values(projectFolderSchema.enum);
|
|
3466
|
+
await Promise.all(folders.map(async (folder) => {
|
|
3443
3467
|
await Fs.mkdirp(Path.join(path, folder));
|
|
3444
3468
|
await Fs.writeFile(Path.join(path, folder, ".gitkeep"), "");
|
|
3445
3469
|
}));
|
|
@@ -3672,5 +3696,5 @@ var ElekIoCore = class {
|
|
|
3672
3696
|
};
|
|
3673
3697
|
|
|
3674
3698
|
//#endregion
|
|
3675
|
-
export { BooleanFieldDefinitionBaseSchema, FieldDefinitionBaseSchema, FieldTypeSchema, FieldWidthSchema, NumberFieldDefinitionBaseSchema, ReferenceFieldDefinitionBaseSchema, StringFieldDefinitionBaseSchema, UserTypeSchema, ValueTypeSchema, apiStartSchema, assetExportSchema, assetFieldDefinitionSchema, assetFileSchema, assetSchema, baseFileSchema, baseUserSchema, cloneProjectSchema, cloudUserSchema, collectionExportSchema, collectionFileSchema, collectionSchema, constructorElekIoCoreSchema, countAssetsSchema, countCollectionsSchema, countEntriesSchema, countGitTagsSchema, createAssetSchema, createCollectionSchema, createEntrySchema, createGitTagSchema, createProjectSchema, currentBranchProjectSchema, dateFieldDefinitionSchema, datetime, datetimeFieldDefinitionSchema, ElekIoCore as default, deleteAssetSchema, deleteCollectionSchema, deleteEntrySchema, deleteGitTagSchema, deleteProjectSchema, directBooleanValueSchema, directNumberValueSchema, directStringValueSchema, directValueBaseSchema, directValueSchema, elekIoCoreOptionsSchema, emailFieldDefinitionSchema, entryExportSchema, entryFieldDefinitionSchema, entryFileSchema, entrySchema, exportSchema, fieldDefinitionSchema, fileReferenceSchema, generateApiClientSchema, getChangesProjectSchema, getCreateEntrySchemaFromFieldDefinitions, getEntrySchemaFromFieldDefinitions, getRemoteOriginUrlProjectSchema, getUpdateEntrySchemaFromFieldDefinitions, getValueSchemaFromFieldDefinition, gitCloneOptionsSchema, gitCommitSchema, gitInitOptionsSchema, gitLogOptionsSchema, gitMergeOptionsSchema, gitMessageSchema, gitSignatureSchema, gitSwitchOptionsSchema, gitTagSchema, ipv4FieldDefinitionSchema, listAssetsSchema, listBranchesProjectSchema, listCollectionsSchema, listEntriesSchema, listGitTagsSchema, listProjectsSchema, localUserSchema, logConsoleTransportSchema, logLevelSchema, logSchema, logSourceSchema, migrateProjectSchema, numberFieldDefinitionSchema, objectTypeSchema, paginatedListOf, projectBranchSchema, projectExportSchema, projectFileSchema, projectFolderSchema, projectSchema, projectSettingsSchema, projectStatusSchema, projectUpgradeSchema, rangeFieldDefinitionSchema, readAssetSchema, readCollectionSchema, readEntrySchema, readGitTagSchema, readProjectSchema, referencedValueSchema, saveAssetSchema, searchProjectSchema, serviceTypeSchema, setRemoteOriginUrlProjectSchema, setUserSchema, slug, stringFieldDefinitionSchema, supportedIconSchema, supportedLanguageSchema, switchBranchProjectSchema, synchronizeProjectSchema, telephoneFieldDefinitionSchema, textFieldDefinitionSchema, textareaFieldDefinitionSchema, timeFieldDefinitionSchema, toggleFieldDefinitionSchema, translatableArrayOf, translatableBooleanSchema, translatableNumberSchema, translatableStringSchema, updateAssetSchema, updateCollectionSchema, updateEntrySchema, updateProjectSchema, upgradeProjectSchema, urlFieldDefinitionSchema, userFileSchema, userSchema, uuid, uuidSchema, valueContentReferenceBase, valueContentReferenceSchema, valueContentReferenceToAssetSchema, valueContentReferenceToCollectionSchema, valueContentReferenceToEntrySchema, valueSchema, versionSchema };
|
|
3676
|
-
//# sourceMappingURL=index.node.
|
|
3699
|
+
export { BooleanFieldDefinitionBaseSchema, FieldDefinitionBaseSchema, FieldTypeSchema, FieldWidthSchema, NumberFieldDefinitionBaseSchema, ReferenceFieldDefinitionBaseSchema, StringFieldDefinitionBaseSchema, UserTypeSchema, ValueTypeSchema, apiStartSchema, assetExportSchema, assetFieldDefinitionSchema, assetFileSchema, assetSchema, baseFileSchema, baseUserSchema, cloneProjectSchema, cloudUserSchema, collectionExportSchema, collectionFileSchema, collectionSchema, constructorElekIoCoreSchema, countAssetsSchema, countCollectionsSchema, countEntriesSchema, countGitTagsSchema, createAssetSchema, createCollectionSchema, createEntrySchema, createGitTagSchema, createProjectSchema, currentBranchProjectSchema, dateFieldDefinitionSchema, datetime, datetimeFieldDefinitionSchema, ElekIoCore as default, deleteAssetSchema, deleteCollectionSchema, deleteEntrySchema, deleteGitTagSchema, deleteProjectSchema, directBooleanValueSchema, directNumberValueSchema, directStringValueSchema, directValueBaseSchema, directValueSchema, elekIoCoreOptionsSchema, emailFieldDefinitionSchema, entryExportSchema, entryFieldDefinitionSchema, entryFileSchema, entrySchema, exportSchema, fieldDefinitionSchema, fileReferenceSchema, generateApiClientSchema, getChangesProjectSchema, getCreateEntrySchemaFromFieldDefinitions, getEntrySchemaFromFieldDefinitions, getRemoteOriginUrlProjectSchema, getTranslatableBooleanValueContentSchemaFromFieldDefinition, getTranslatableNumberValueContentSchemaFromFieldDefinition, getTranslatableReferenceValueContentSchemaFromFieldDefinition, getTranslatableStringValueContentSchemaFromFieldDefinition, getUpdateEntrySchemaFromFieldDefinitions, getValueSchemaFromFieldDefinition, gitCloneOptionsSchema, gitCommitSchema, gitInitOptionsSchema, gitLogOptionsSchema, gitMergeOptionsSchema, gitMessageSchema, gitSignatureSchema, gitSwitchOptionsSchema, gitTagSchema, ipv4FieldDefinitionSchema, listAssetsSchema, listBranchesProjectSchema, listCollectionsSchema, listEntriesSchema, listGitTagsSchema, listProjectsSchema, localUserSchema, logConsoleTransportSchema, logLevelSchema, logSchema, logSourceSchema, migrateProjectSchema, numberFieldDefinitionSchema, objectTypeSchema, paginatedListOf, projectBranchSchema, projectExportSchema, projectFileSchema, projectFolderSchema, projectSchema, projectSettingsSchema, projectStatusSchema, projectUpgradeSchema, rangeFieldDefinitionSchema, readAssetSchema, readCollectionSchema, readEntrySchema, readGitTagSchema, readProjectSchema, referencedValueSchema, saveAssetSchema, searchProjectSchema, serviceTypeSchema, setRemoteOriginUrlProjectSchema, setUserSchema, slug, stringFieldDefinitionSchema, supportedIconSchema, supportedLanguageSchema, switchBranchProjectSchema, synchronizeProjectSchema, telephoneFieldDefinitionSchema, textFieldDefinitionSchema, textareaFieldDefinitionSchema, timeFieldDefinitionSchema, toggleFieldDefinitionSchema, translatableArrayOf, translatableBooleanSchema, translatableNumberSchema, translatableStringSchema, updateAssetSchema, updateCollectionSchema, updateEntrySchema, updateProjectSchema, upgradeProjectSchema, urlFieldDefinitionSchema, userFileSchema, userSchema, uuid, uuidSchema, valueContentReferenceBase, valueContentReferenceSchema, valueContentReferenceToAssetSchema, valueContentReferenceToCollectionSchema, valueContentReferenceToEntrySchema, valueSchema, versionSchema };
|
|
3700
|
+
//# sourceMappingURL=index.node.mjs.map
|