@elek-io/core 0.11.1 → 0.13.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/README.md +5 -6
- package/dist/browser/index.browser.d.ts +8796 -10278
- package/dist/browser/index.browser.js +36 -35
- package/dist/browser/index.browser.js.map +1 -1
- package/dist/node/index.node.d.ts +8078 -9560
- package/dist/node/index.node.js +740 -128
- package/dist/node/index.node.js.map +1 -1
- package/package.json +7 -3
package/dist/node/index.node.js
CHANGED
|
@@ -8,10 +8,44 @@ var __export = (target, all) => {
|
|
|
8
8
|
import Fs7 from "fs-extra";
|
|
9
9
|
|
|
10
10
|
// package.json
|
|
11
|
-
var version = "0.
|
|
11
|
+
var version = "0.13.0";
|
|
12
|
+
|
|
13
|
+
// src/api/index.ts
|
|
14
|
+
import { serve } from "@hono/node-server";
|
|
15
|
+
import { swaggerUI } from "@hono/swagger-ui";
|
|
16
|
+
import { OpenAPIHono as OpenAPIHono5 } from "@hono/zod-openapi";
|
|
17
|
+
import { cors } from "hono/cors";
|
|
18
|
+
|
|
19
|
+
// src/api/middleware/logger.ts
|
|
20
|
+
import { createMiddleware } from "hono/factory";
|
|
21
|
+
var LoggerMiddleware = class {
|
|
22
|
+
logService;
|
|
23
|
+
constructor(logService) {
|
|
24
|
+
this.logService = logService;
|
|
25
|
+
}
|
|
26
|
+
handler = createMiddleware(async (c, next) => {
|
|
27
|
+
const { method, url } = c.req;
|
|
28
|
+
this.logService.info(`Recieved API request "${method} ${url}"`);
|
|
29
|
+
const start = Date.now();
|
|
30
|
+
await next();
|
|
31
|
+
const durationMs = Date.now() - start;
|
|
32
|
+
const statusCode = c.res.status.toString();
|
|
33
|
+
const resultLog = `Response for API request "${method} ${url}" with status code ${statusCode} in ${durationMs}ms`;
|
|
34
|
+
if (statusCode.startsWith("2")) {
|
|
35
|
+
this.logService.info(resultLog);
|
|
36
|
+
} else if (statusCode.startsWith("3")) {
|
|
37
|
+
this.logService.warn(resultLog);
|
|
38
|
+
} else if (statusCode.startsWith("4") || statusCode.startsWith("5")) {
|
|
39
|
+
this.logService.error(resultLog);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// src/api/v1/asset.ts
|
|
45
|
+
import { createRoute, OpenAPIHono, z as z13 } from "@hono/zod-openapi";
|
|
12
46
|
|
|
13
47
|
// src/schema/assetSchema.ts
|
|
14
|
-
import z4 from "zod";
|
|
48
|
+
import { z as z4 } from "@hono/zod-openapi";
|
|
15
49
|
|
|
16
50
|
// src/schema/baseSchema.ts
|
|
17
51
|
import z from "zod";
|
|
@@ -262,7 +296,7 @@ var assetSchema = assetFileSchema.extend({
|
|
|
262
296
|
* Commit history of this Asset
|
|
263
297
|
*/
|
|
264
298
|
history: z4.array(gitCommitSchema)
|
|
265
|
-
});
|
|
299
|
+
}).openapi("Asset");
|
|
266
300
|
var assetExportSchema = assetSchema.extend({});
|
|
267
301
|
var createAssetSchema = assetFileSchema.pick({
|
|
268
302
|
name: true,
|
|
@@ -307,10 +341,10 @@ var deleteAssetSchema = assetFileSchema.pick({
|
|
|
307
341
|
var countAssetsSchema = z4.object({ projectId: uuidSchema.readonly() });
|
|
308
342
|
|
|
309
343
|
// src/schema/collectionSchema.ts
|
|
310
|
-
import z8 from "zod";
|
|
344
|
+
import { z as z8 } from "@hono/zod-openapi";
|
|
311
345
|
|
|
312
346
|
// src/schema/entrySchema.ts
|
|
313
|
-
import z6 from "zod";
|
|
347
|
+
import { z as z6 } from "@hono/zod-openapi";
|
|
314
348
|
|
|
315
349
|
// src/schema/valueSchema.ts
|
|
316
350
|
import z5 from "zod";
|
|
@@ -338,12 +372,6 @@ var valueContentReferenceSchema = z5.union([
|
|
|
338
372
|
valueContentReferenceToEntrySchema
|
|
339
373
|
// valueContentReferenceToSharedValueSchema,
|
|
340
374
|
]);
|
|
341
|
-
var resolvedValueContentReferenceSchema = z5.union([
|
|
342
|
-
assetSchema,
|
|
343
|
-
z5.lazy(() => entrySchema)
|
|
344
|
-
// Circular dependency / recursive type @see https://github.com/colinhacks/zod?tab=readme-ov-file#recursive-types
|
|
345
|
-
// resolvedValueContentReferenceToSharedValueSchema,
|
|
346
|
-
]);
|
|
347
375
|
var directValueBaseSchema = z5.object({
|
|
348
376
|
objectType: z5.literal(objectTypeSchema.Enum.value).readonly(),
|
|
349
377
|
fieldDefinitionId: uuidSchema.readonly()
|
|
@@ -372,13 +400,6 @@ var referencedValueSchema = z5.object({
|
|
|
372
400
|
content: translatableArrayOf(valueContentReferenceSchema)
|
|
373
401
|
});
|
|
374
402
|
var valueSchema = z5.union([directValueSchema, referencedValueSchema]);
|
|
375
|
-
var resolvedReferencedValueSchema = referencedValueSchema.extend({
|
|
376
|
-
content: translatableArrayOf(resolvedValueContentReferenceSchema)
|
|
377
|
-
});
|
|
378
|
-
var resolvedValueSchema = z5.union([
|
|
379
|
-
directValueSchema,
|
|
380
|
-
resolvedReferencedValueSchema
|
|
381
|
-
]);
|
|
382
403
|
|
|
383
404
|
// src/schema/entrySchema.ts
|
|
384
405
|
var entryFileSchema = baseFileSchema.extend({
|
|
@@ -386,12 +407,11 @@ var entryFileSchema = baseFileSchema.extend({
|
|
|
386
407
|
values: z6.array(valueSchema)
|
|
387
408
|
});
|
|
388
409
|
var entrySchema = entryFileSchema.extend({
|
|
389
|
-
values: z6.array(z6.lazy(() => resolvedValueSchema)),
|
|
390
410
|
/**
|
|
391
411
|
* Commit history of this Entry
|
|
392
412
|
*/
|
|
393
413
|
history: z6.array(gitCommitSchema)
|
|
394
|
-
});
|
|
414
|
+
}).openapi("Entry");
|
|
395
415
|
var entryExportSchema = entrySchema.extend({});
|
|
396
416
|
var createEntrySchema = entryFileSchema.omit({
|
|
397
417
|
id: true,
|
|
@@ -685,7 +705,7 @@ var collectionSchema = collectionFileSchema.extend({
|
|
|
685
705
|
* Commit history of this Collection
|
|
686
706
|
*/
|
|
687
707
|
history: z8.array(gitCommitSchema)
|
|
688
|
-
});
|
|
708
|
+
}).openapi("Collection");
|
|
689
709
|
var collectionExportSchema = collectionSchema.extend({
|
|
690
710
|
entries: z8.array(entryExportSchema)
|
|
691
711
|
});
|
|
@@ -743,7 +763,7 @@ var constructorElekIoCoreSchema = elekIoCoreOptionsSchema.partial({
|
|
|
743
763
|
}).optional();
|
|
744
764
|
|
|
745
765
|
// src/schema/projectSchema.ts
|
|
746
|
-
import { z as z10 } from "zod";
|
|
766
|
+
import { z as z10 } from "@hono/zod-openapi";
|
|
747
767
|
var projectStatusSchema = z10.enum(["foo", "bar", "todo"]);
|
|
748
768
|
var projectSettingsSchema = z10.object({
|
|
749
769
|
language: z10.object({
|
|
@@ -771,17 +791,16 @@ var projectFileSchema = baseFileSchema.extend({
|
|
|
771
791
|
settings: projectSettingsSchema
|
|
772
792
|
});
|
|
773
793
|
var projectSchema = projectFileSchema.extend({
|
|
774
|
-
remoteOriginUrl: z10.string().nullable()
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
});
|
|
794
|
+
remoteOriginUrl: z10.string().nullable().openapi({
|
|
795
|
+
description: "URL of the remote Git repository"
|
|
796
|
+
}),
|
|
797
|
+
history: z10.array(gitCommitSchema).openapi({
|
|
798
|
+
description: "Commit history of this Project"
|
|
799
|
+
}),
|
|
800
|
+
fullHistory: z10.array(gitCommitSchema).openapi({
|
|
801
|
+
description: "Full commit history of this Project including all Assets, Collections, Entries and other files"
|
|
802
|
+
})
|
|
803
|
+
}).openapi("Project");
|
|
785
804
|
var outdatedProjectSchema = projectFileSchema.pick({
|
|
786
805
|
id: true,
|
|
787
806
|
name: true,
|
|
@@ -881,6 +900,14 @@ var serviceTypeSchema = z11.enum([
|
|
|
881
900
|
"Entry",
|
|
882
901
|
"Value"
|
|
883
902
|
]);
|
|
903
|
+
function paginatedListOf(schema) {
|
|
904
|
+
return z11.object({
|
|
905
|
+
total: z11.number(),
|
|
906
|
+
limit: z11.number(),
|
|
907
|
+
offset: z11.number(),
|
|
908
|
+
list: z11.array(schema)
|
|
909
|
+
});
|
|
910
|
+
}
|
|
884
911
|
var listSchema = z11.object({
|
|
885
912
|
projectId: uuidSchema,
|
|
886
913
|
limit: z11.number().optional(),
|
|
@@ -904,6 +931,16 @@ var UserTypeSchema = z12.enum(["local", "cloud"]);
|
|
|
904
931
|
var baseUserSchema = gitSignatureSchema.extend({
|
|
905
932
|
userType: UserTypeSchema,
|
|
906
933
|
language: supportedLanguageSchema,
|
|
934
|
+
localApi: z12.object({
|
|
935
|
+
/**
|
|
936
|
+
* If set to true the local API is started whenever Core is initialized
|
|
937
|
+
*/
|
|
938
|
+
isEnabled: z12.boolean(),
|
|
939
|
+
/**
|
|
940
|
+
* The port the local API uses
|
|
941
|
+
*/
|
|
942
|
+
port: z12.number()
|
|
943
|
+
}),
|
|
907
944
|
window: z12.object({
|
|
908
945
|
width: z12.number(),
|
|
909
946
|
height: z12.number(),
|
|
@@ -924,6 +961,656 @@ var userFileSchema = z12.union([localUserSchema, cloudUserSchema]);
|
|
|
924
961
|
var userSchema = userFileSchema;
|
|
925
962
|
var setUserSchema = userSchema;
|
|
926
963
|
|
|
964
|
+
// src/api/v1/asset.ts
|
|
965
|
+
var AssetApiV1 = class {
|
|
966
|
+
api;
|
|
967
|
+
assetService;
|
|
968
|
+
constructor(assetService) {
|
|
969
|
+
this.assetService = assetService;
|
|
970
|
+
this.api = new OpenAPIHono();
|
|
971
|
+
this.registerRoutes();
|
|
972
|
+
}
|
|
973
|
+
registerRoutes() {
|
|
974
|
+
this.api.openapi(listAssetsRoute, async (context) => {
|
|
975
|
+
const { projectId } = context.req.valid("param");
|
|
976
|
+
const { limit, offset } = context.req.valid("query");
|
|
977
|
+
const assets = await this.assetService.list({
|
|
978
|
+
projectId,
|
|
979
|
+
limit,
|
|
980
|
+
offset
|
|
981
|
+
});
|
|
982
|
+
return context.json(assets, 200);
|
|
983
|
+
});
|
|
984
|
+
this.api.openapi(countAssetsRoute, async (context) => {
|
|
985
|
+
const { projectId } = context.req.valid("param");
|
|
986
|
+
const count = await this.assetService.count({ projectId });
|
|
987
|
+
return context.json(count, 200);
|
|
988
|
+
});
|
|
989
|
+
this.api.openapi(readAssetRoute, async (context) => {
|
|
990
|
+
const { projectId, assetId } = context.req.valid("param");
|
|
991
|
+
const asset = await this.assetService.read({
|
|
992
|
+
projectId,
|
|
993
|
+
id: assetId
|
|
994
|
+
});
|
|
995
|
+
return context.json(asset, 200);
|
|
996
|
+
});
|
|
997
|
+
}
|
|
998
|
+
};
|
|
999
|
+
var listAssetsRoute = createRoute({
|
|
1000
|
+
tags: ["Assets"],
|
|
1001
|
+
description: "Lists all Assets of the given Project",
|
|
1002
|
+
method: "get",
|
|
1003
|
+
path: "/projects/{projectId}/assets",
|
|
1004
|
+
operationId: "listAssets",
|
|
1005
|
+
request: {
|
|
1006
|
+
params: z13.object({
|
|
1007
|
+
projectId: uuidSchema.openapi({
|
|
1008
|
+
param: {
|
|
1009
|
+
name: "projectId",
|
|
1010
|
+
in: "path"
|
|
1011
|
+
}
|
|
1012
|
+
})
|
|
1013
|
+
}),
|
|
1014
|
+
query: z13.object({
|
|
1015
|
+
limit: z13.string().pipe(z13.coerce.number()).optional().openapi({
|
|
1016
|
+
default: "15",
|
|
1017
|
+
description: "The maximum number of items to return"
|
|
1018
|
+
}),
|
|
1019
|
+
offset: z13.string().pipe(z13.coerce.number()).optional().openapi({
|
|
1020
|
+
default: "0",
|
|
1021
|
+
description: "The number of items to skip before starting to collect the result set"
|
|
1022
|
+
})
|
|
1023
|
+
})
|
|
1024
|
+
},
|
|
1025
|
+
responses: {
|
|
1026
|
+
200: {
|
|
1027
|
+
content: {
|
|
1028
|
+
"application/json": {
|
|
1029
|
+
schema: paginatedListOf(assetSchema)
|
|
1030
|
+
}
|
|
1031
|
+
},
|
|
1032
|
+
description: "A list of Assets of the given Project"
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
});
|
|
1036
|
+
var countAssetsRoute = createRoute({
|
|
1037
|
+
tags: ["Assets"],
|
|
1038
|
+
description: "Counts all Assets of the given Project",
|
|
1039
|
+
method: "get",
|
|
1040
|
+
path: "/projects/{projectId}/assets/count",
|
|
1041
|
+
operationId: "countAssets",
|
|
1042
|
+
request: {
|
|
1043
|
+
params: z13.object({
|
|
1044
|
+
projectId: uuidSchema.openapi({
|
|
1045
|
+
param: {
|
|
1046
|
+
name: "projectId",
|
|
1047
|
+
in: "path"
|
|
1048
|
+
}
|
|
1049
|
+
})
|
|
1050
|
+
})
|
|
1051
|
+
},
|
|
1052
|
+
responses: {
|
|
1053
|
+
200: {
|
|
1054
|
+
content: {
|
|
1055
|
+
"application/json": {
|
|
1056
|
+
schema: z13.number()
|
|
1057
|
+
}
|
|
1058
|
+
},
|
|
1059
|
+
description: "The number of Assets of the given Project"
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
});
|
|
1063
|
+
var readAssetRoute = createRoute({
|
|
1064
|
+
tags: ["Assets"],
|
|
1065
|
+
description: "Retrieve an Asset by ID",
|
|
1066
|
+
method: "get",
|
|
1067
|
+
path: "/projects/{projectId}/assets/{assetId}",
|
|
1068
|
+
operationId: "readAsset",
|
|
1069
|
+
request: {
|
|
1070
|
+
params: z13.object({
|
|
1071
|
+
projectId: uuidSchema.openapi({
|
|
1072
|
+
param: {
|
|
1073
|
+
name: "projectId",
|
|
1074
|
+
in: "path"
|
|
1075
|
+
}
|
|
1076
|
+
}),
|
|
1077
|
+
assetId: uuidSchema.openapi({
|
|
1078
|
+
param: {
|
|
1079
|
+
name: "assetId",
|
|
1080
|
+
in: "path"
|
|
1081
|
+
}
|
|
1082
|
+
})
|
|
1083
|
+
})
|
|
1084
|
+
},
|
|
1085
|
+
responses: {
|
|
1086
|
+
200: {
|
|
1087
|
+
content: {
|
|
1088
|
+
"application/json": {
|
|
1089
|
+
schema: assetSchema
|
|
1090
|
+
}
|
|
1091
|
+
},
|
|
1092
|
+
description: "The requested Asset"
|
|
1093
|
+
},
|
|
1094
|
+
404: {
|
|
1095
|
+
description: "The requested Asset does not exist"
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
});
|
|
1099
|
+
|
|
1100
|
+
// src/api/v1/collection.ts
|
|
1101
|
+
import { createRoute as createRoute2, OpenAPIHono as OpenAPIHono2, z as z14 } from "@hono/zod-openapi";
|
|
1102
|
+
var CollectionApiV1 = class {
|
|
1103
|
+
api;
|
|
1104
|
+
collectionService;
|
|
1105
|
+
constructor(collectionService) {
|
|
1106
|
+
this.collectionService = collectionService;
|
|
1107
|
+
this.api = new OpenAPIHono2();
|
|
1108
|
+
this.registerRoutes();
|
|
1109
|
+
}
|
|
1110
|
+
registerRoutes() {
|
|
1111
|
+
this.api.openapi(listCollectionsRoute, async (context) => {
|
|
1112
|
+
const { projectId } = context.req.valid("param");
|
|
1113
|
+
const { limit, offset } = context.req.valid("query");
|
|
1114
|
+
const collections = await this.collectionService.list({
|
|
1115
|
+
projectId,
|
|
1116
|
+
limit,
|
|
1117
|
+
offset
|
|
1118
|
+
});
|
|
1119
|
+
return context.json(collections, 200);
|
|
1120
|
+
});
|
|
1121
|
+
this.api.openapi(countCollectionsRoute, async (context) => {
|
|
1122
|
+
const { projectId } = context.req.valid("param");
|
|
1123
|
+
const count = await this.collectionService.count({ projectId });
|
|
1124
|
+
return context.json(count, 200);
|
|
1125
|
+
});
|
|
1126
|
+
this.api.openapi(readCollectionRoute, async (context) => {
|
|
1127
|
+
const { projectId, collectionId } = context.req.valid("param");
|
|
1128
|
+
const collection = await this.collectionService.read({
|
|
1129
|
+
projectId,
|
|
1130
|
+
id: collectionId
|
|
1131
|
+
});
|
|
1132
|
+
return context.json(collection, 200);
|
|
1133
|
+
});
|
|
1134
|
+
}
|
|
1135
|
+
};
|
|
1136
|
+
var listCollectionsRoute = createRoute2({
|
|
1137
|
+
tags: ["Collections"],
|
|
1138
|
+
description: "Lists all Collections of the given Project",
|
|
1139
|
+
method: "get",
|
|
1140
|
+
path: "/projects/{projectId}/collections",
|
|
1141
|
+
operationId: "listCollections",
|
|
1142
|
+
request: {
|
|
1143
|
+
params: z14.object({
|
|
1144
|
+
projectId: uuidSchema.openapi({
|
|
1145
|
+
param: {
|
|
1146
|
+
name: "projectId",
|
|
1147
|
+
in: "path"
|
|
1148
|
+
}
|
|
1149
|
+
})
|
|
1150
|
+
}),
|
|
1151
|
+
query: z14.object({
|
|
1152
|
+
limit: z14.string().pipe(z14.coerce.number()).optional().openapi({
|
|
1153
|
+
default: "15",
|
|
1154
|
+
description: "The maximum number of items to return"
|
|
1155
|
+
}),
|
|
1156
|
+
offset: z14.string().pipe(z14.coerce.number()).optional().openapi({
|
|
1157
|
+
default: "0",
|
|
1158
|
+
description: "The number of items to skip before starting to collect the result set"
|
|
1159
|
+
})
|
|
1160
|
+
})
|
|
1161
|
+
},
|
|
1162
|
+
responses: {
|
|
1163
|
+
200: {
|
|
1164
|
+
content: {
|
|
1165
|
+
"application/json": {
|
|
1166
|
+
schema: paginatedListOf(collectionSchema)
|
|
1167
|
+
}
|
|
1168
|
+
},
|
|
1169
|
+
description: "A list of Collections of the given Project"
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
});
|
|
1173
|
+
var countCollectionsRoute = createRoute2({
|
|
1174
|
+
tags: ["Collections"],
|
|
1175
|
+
description: "Counts all Collections of the given Project",
|
|
1176
|
+
method: "get",
|
|
1177
|
+
path: "/projects/{projectId}/collections/count",
|
|
1178
|
+
operationId: "countCollections",
|
|
1179
|
+
request: {
|
|
1180
|
+
params: z14.object({
|
|
1181
|
+
projectId: uuidSchema.openapi({
|
|
1182
|
+
param: {
|
|
1183
|
+
name: "projectId",
|
|
1184
|
+
in: "path"
|
|
1185
|
+
}
|
|
1186
|
+
})
|
|
1187
|
+
})
|
|
1188
|
+
},
|
|
1189
|
+
responses: {
|
|
1190
|
+
200: {
|
|
1191
|
+
content: {
|
|
1192
|
+
"application/json": {
|
|
1193
|
+
schema: z14.number()
|
|
1194
|
+
}
|
|
1195
|
+
},
|
|
1196
|
+
description: "The number of Collections of the given Project"
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
});
|
|
1200
|
+
var readCollectionRoute = createRoute2({
|
|
1201
|
+
tags: ["Collections"],
|
|
1202
|
+
description: "Retrieve a Project by ID",
|
|
1203
|
+
method: "get",
|
|
1204
|
+
path: "/projects/{projectId}/collections/{collectionId}",
|
|
1205
|
+
operationId: "readCollection",
|
|
1206
|
+
request: {
|
|
1207
|
+
params: z14.object({
|
|
1208
|
+
projectId: uuidSchema.openapi({
|
|
1209
|
+
param: {
|
|
1210
|
+
name: "projectId",
|
|
1211
|
+
in: "path"
|
|
1212
|
+
}
|
|
1213
|
+
}),
|
|
1214
|
+
collectionId: uuidSchema.openapi({
|
|
1215
|
+
param: {
|
|
1216
|
+
name: "collectionId",
|
|
1217
|
+
in: "path"
|
|
1218
|
+
}
|
|
1219
|
+
})
|
|
1220
|
+
})
|
|
1221
|
+
},
|
|
1222
|
+
responses: {
|
|
1223
|
+
200: {
|
|
1224
|
+
content: {
|
|
1225
|
+
"application/json": {
|
|
1226
|
+
schema: collectionSchema
|
|
1227
|
+
}
|
|
1228
|
+
},
|
|
1229
|
+
description: "The requested Collection"
|
|
1230
|
+
},
|
|
1231
|
+
404: {
|
|
1232
|
+
description: "The requested Collection does not exist"
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
});
|
|
1236
|
+
|
|
1237
|
+
// src/api/v1/entry.ts
|
|
1238
|
+
import { createRoute as createRoute3, OpenAPIHono as OpenAPIHono3, z as z15 } from "@hono/zod-openapi";
|
|
1239
|
+
var EntryApiV1 = class {
|
|
1240
|
+
api;
|
|
1241
|
+
entryService;
|
|
1242
|
+
constructor(entryService) {
|
|
1243
|
+
this.entryService = entryService;
|
|
1244
|
+
this.api = new OpenAPIHono3();
|
|
1245
|
+
this.registerRoutes();
|
|
1246
|
+
}
|
|
1247
|
+
registerRoutes() {
|
|
1248
|
+
this.api.openapi(listEntriesRoute, async (context) => {
|
|
1249
|
+
const { projectId, collectionId } = context.req.valid("param");
|
|
1250
|
+
const { limit, offset } = context.req.valid("query");
|
|
1251
|
+
const entries = await this.entryService.list({
|
|
1252
|
+
projectId,
|
|
1253
|
+
collectionId,
|
|
1254
|
+
limit,
|
|
1255
|
+
offset
|
|
1256
|
+
});
|
|
1257
|
+
return context.json(entries, 200);
|
|
1258
|
+
});
|
|
1259
|
+
this.api.openapi(countEntriesRoute, async (context) => {
|
|
1260
|
+
const { projectId, collectionId } = context.req.valid("param");
|
|
1261
|
+
const count = await this.entryService.count({ projectId, collectionId });
|
|
1262
|
+
return context.json(count, 200);
|
|
1263
|
+
});
|
|
1264
|
+
this.api.openapi(readEntryRoute, async (context) => {
|
|
1265
|
+
const { projectId, collectionId, entryId } = context.req.valid("param");
|
|
1266
|
+
const entry = await this.entryService.read({
|
|
1267
|
+
projectId,
|
|
1268
|
+
collectionId,
|
|
1269
|
+
id: entryId
|
|
1270
|
+
});
|
|
1271
|
+
return context.json(entry, 200);
|
|
1272
|
+
});
|
|
1273
|
+
}
|
|
1274
|
+
};
|
|
1275
|
+
var listEntriesRoute = createRoute3({
|
|
1276
|
+
tags: ["Entries"],
|
|
1277
|
+
description: "Lists all Entries of the given Project",
|
|
1278
|
+
method: "get",
|
|
1279
|
+
path: "/projects/{projectId}/collections/{collectionId}/entries",
|
|
1280
|
+
operationId: "listEntries",
|
|
1281
|
+
request: {
|
|
1282
|
+
params: z15.object({
|
|
1283
|
+
projectId: uuidSchema.openapi({
|
|
1284
|
+
param: {
|
|
1285
|
+
name: "projectId",
|
|
1286
|
+
in: "path"
|
|
1287
|
+
}
|
|
1288
|
+
}),
|
|
1289
|
+
collectionId: uuidSchema.openapi({
|
|
1290
|
+
param: {
|
|
1291
|
+
name: "collectionId",
|
|
1292
|
+
in: "path"
|
|
1293
|
+
}
|
|
1294
|
+
})
|
|
1295
|
+
}),
|
|
1296
|
+
query: z15.object({
|
|
1297
|
+
limit: z15.string().pipe(z15.coerce.number()).optional().openapi({
|
|
1298
|
+
default: "15",
|
|
1299
|
+
description: "The maximum number of items to return"
|
|
1300
|
+
}),
|
|
1301
|
+
offset: z15.string().pipe(z15.coerce.number()).optional().openapi({
|
|
1302
|
+
default: "0",
|
|
1303
|
+
description: "The number of items to skip before starting to collect the result set"
|
|
1304
|
+
})
|
|
1305
|
+
})
|
|
1306
|
+
},
|
|
1307
|
+
responses: {
|
|
1308
|
+
200: {
|
|
1309
|
+
content: {
|
|
1310
|
+
"application/json": {
|
|
1311
|
+
schema: paginatedListOf(entrySchema)
|
|
1312
|
+
}
|
|
1313
|
+
},
|
|
1314
|
+
description: "A list of Entries of the given Project"
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
});
|
|
1318
|
+
var countEntriesRoute = createRoute3({
|
|
1319
|
+
tags: ["Entries"],
|
|
1320
|
+
description: "Counts all Entries of the given Project",
|
|
1321
|
+
method: "get",
|
|
1322
|
+
path: "/projects/{projectId}/collections/{collectionId}/entries/count",
|
|
1323
|
+
operationId: "countEntries",
|
|
1324
|
+
request: {
|
|
1325
|
+
params: z15.object({
|
|
1326
|
+
projectId: uuidSchema.openapi({
|
|
1327
|
+
param: {
|
|
1328
|
+
name: "projectId",
|
|
1329
|
+
in: "path"
|
|
1330
|
+
}
|
|
1331
|
+
}),
|
|
1332
|
+
collectionId: uuidSchema.openapi({
|
|
1333
|
+
param: {
|
|
1334
|
+
name: "collectionId",
|
|
1335
|
+
in: "path"
|
|
1336
|
+
}
|
|
1337
|
+
})
|
|
1338
|
+
})
|
|
1339
|
+
},
|
|
1340
|
+
responses: {
|
|
1341
|
+
200: {
|
|
1342
|
+
content: {
|
|
1343
|
+
"application/json": {
|
|
1344
|
+
schema: z15.number()
|
|
1345
|
+
}
|
|
1346
|
+
},
|
|
1347
|
+
description: "The number of Entries of the given Project"
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
});
|
|
1351
|
+
var readEntryRoute = createRoute3({
|
|
1352
|
+
tags: ["Entries"],
|
|
1353
|
+
description: "Retrieve a Project by ID",
|
|
1354
|
+
method: "get",
|
|
1355
|
+
path: "/projects/{projectId}/collections/{collectionId}/entries/{entryId}",
|
|
1356
|
+
operationId: "readCollection",
|
|
1357
|
+
request: {
|
|
1358
|
+
params: z15.object({
|
|
1359
|
+
projectId: uuidSchema.openapi({
|
|
1360
|
+
param: {
|
|
1361
|
+
name: "projectId",
|
|
1362
|
+
in: "path"
|
|
1363
|
+
}
|
|
1364
|
+
}),
|
|
1365
|
+
collectionId: uuidSchema.openapi({
|
|
1366
|
+
param: {
|
|
1367
|
+
name: "collectionId",
|
|
1368
|
+
in: "path"
|
|
1369
|
+
}
|
|
1370
|
+
}),
|
|
1371
|
+
entryId: uuidSchema.openapi({
|
|
1372
|
+
param: {
|
|
1373
|
+
name: "entryId",
|
|
1374
|
+
in: "path"
|
|
1375
|
+
}
|
|
1376
|
+
})
|
|
1377
|
+
})
|
|
1378
|
+
},
|
|
1379
|
+
responses: {
|
|
1380
|
+
200: {
|
|
1381
|
+
content: {
|
|
1382
|
+
"application/json": {
|
|
1383
|
+
schema: entrySchema
|
|
1384
|
+
}
|
|
1385
|
+
},
|
|
1386
|
+
description: "The requested Collection"
|
|
1387
|
+
},
|
|
1388
|
+
404: {
|
|
1389
|
+
description: "The requested Collection does not exist"
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
});
|
|
1393
|
+
|
|
1394
|
+
// src/api/v1/project.ts
|
|
1395
|
+
import { createRoute as createRoute4, OpenAPIHono as OpenAPIHono4, z as z16 } from "@hono/zod-openapi";
|
|
1396
|
+
var ProjectApiV1 = class {
|
|
1397
|
+
api;
|
|
1398
|
+
projectService;
|
|
1399
|
+
constructor(projectService) {
|
|
1400
|
+
this.projectService = projectService;
|
|
1401
|
+
this.api = new OpenAPIHono4();
|
|
1402
|
+
this.registerRoutes();
|
|
1403
|
+
}
|
|
1404
|
+
registerRoutes() {
|
|
1405
|
+
this.api.openapi(listProjectsRoute, async (context) => {
|
|
1406
|
+
const { limit, offset } = context.req.valid("query");
|
|
1407
|
+
const projects = await this.projectService.list({ limit, offset });
|
|
1408
|
+
return context.json(projects, 200);
|
|
1409
|
+
});
|
|
1410
|
+
this.api.openapi(countProjectsRoute, async (context) => {
|
|
1411
|
+
const count = await this.projectService.count();
|
|
1412
|
+
return context.json(count, 200);
|
|
1413
|
+
});
|
|
1414
|
+
this.api.openapi(readProjectRoute, async (context) => {
|
|
1415
|
+
const { projectId } = context.req.valid("param");
|
|
1416
|
+
const project = await this.projectService.read({ id: projectId });
|
|
1417
|
+
return context.json(project, 200);
|
|
1418
|
+
});
|
|
1419
|
+
}
|
|
1420
|
+
};
|
|
1421
|
+
var listProjectsRoute = createRoute4({
|
|
1422
|
+
tags: ["Projects"],
|
|
1423
|
+
description: "Lists all Projects you currently have access to",
|
|
1424
|
+
method: "get",
|
|
1425
|
+
path: "/projects",
|
|
1426
|
+
operationId: "listProjects",
|
|
1427
|
+
request: {
|
|
1428
|
+
query: z16.object({
|
|
1429
|
+
limit: z16.string().pipe(z16.coerce.number()).optional().openapi({
|
|
1430
|
+
default: "15",
|
|
1431
|
+
description: "The maximum number of items to return"
|
|
1432
|
+
}),
|
|
1433
|
+
offset: z16.string().pipe(z16.coerce.number()).optional().openapi({
|
|
1434
|
+
default: "0",
|
|
1435
|
+
description: "The number of items to skip before starting to collect the result set"
|
|
1436
|
+
})
|
|
1437
|
+
})
|
|
1438
|
+
},
|
|
1439
|
+
responses: {
|
|
1440
|
+
200: {
|
|
1441
|
+
content: {
|
|
1442
|
+
"application/json": {
|
|
1443
|
+
schema: paginatedListOf(projectSchema)
|
|
1444
|
+
}
|
|
1445
|
+
},
|
|
1446
|
+
description: "A list of Projects you have access to"
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
});
|
|
1450
|
+
var countProjectsRoute = createRoute4({
|
|
1451
|
+
tags: ["Projects"],
|
|
1452
|
+
description: "Counts all Projects you currently have access to",
|
|
1453
|
+
method: "get",
|
|
1454
|
+
path: "/projects/count",
|
|
1455
|
+
operationId: "countProjects",
|
|
1456
|
+
responses: {
|
|
1457
|
+
200: {
|
|
1458
|
+
content: {
|
|
1459
|
+
"application/json": {
|
|
1460
|
+
schema: z16.number()
|
|
1461
|
+
}
|
|
1462
|
+
},
|
|
1463
|
+
description: "The number of Projects you have acces to"
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
});
|
|
1467
|
+
var readProjectRoute = createRoute4({
|
|
1468
|
+
tags: ["Projects"],
|
|
1469
|
+
description: "Retrieve a Project by ID",
|
|
1470
|
+
method: "get",
|
|
1471
|
+
path: "/projects/{projectId}",
|
|
1472
|
+
operationId: "readProject",
|
|
1473
|
+
request: {
|
|
1474
|
+
params: z16.object({
|
|
1475
|
+
projectId: uuidSchema.openapi({
|
|
1476
|
+
param: {
|
|
1477
|
+
name: "projectId",
|
|
1478
|
+
in: "path"
|
|
1479
|
+
}
|
|
1480
|
+
})
|
|
1481
|
+
})
|
|
1482
|
+
},
|
|
1483
|
+
responses: {
|
|
1484
|
+
200: {
|
|
1485
|
+
content: {
|
|
1486
|
+
"application/json": {
|
|
1487
|
+
schema: projectSchema
|
|
1488
|
+
}
|
|
1489
|
+
},
|
|
1490
|
+
description: "The requested Project"
|
|
1491
|
+
},
|
|
1492
|
+
404: {
|
|
1493
|
+
description: "The requested Project does not exist or you have no right to access it"
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
});
|
|
1497
|
+
|
|
1498
|
+
// src/api/index.ts
|
|
1499
|
+
var LocalApi = class {
|
|
1500
|
+
logService;
|
|
1501
|
+
projectService;
|
|
1502
|
+
collectionService;
|
|
1503
|
+
entryService;
|
|
1504
|
+
assetService;
|
|
1505
|
+
api;
|
|
1506
|
+
server = null;
|
|
1507
|
+
constructor(logService, projectService, collectionService, entryService, assetService) {
|
|
1508
|
+
this.logService = logService;
|
|
1509
|
+
this.projectService = projectService;
|
|
1510
|
+
this.collectionService = collectionService;
|
|
1511
|
+
this.entryService = entryService;
|
|
1512
|
+
this.assetService = assetService;
|
|
1513
|
+
this.api = new OpenAPIHono5();
|
|
1514
|
+
this.api.use(
|
|
1515
|
+
cors({
|
|
1516
|
+
origin: ["http://localhost"]
|
|
1517
|
+
})
|
|
1518
|
+
);
|
|
1519
|
+
this.api.use(new LoggerMiddleware(logService).handler);
|
|
1520
|
+
this.registerRoutesV1();
|
|
1521
|
+
}
|
|
1522
|
+
/**
|
|
1523
|
+
* Starts the local API on given port
|
|
1524
|
+
*/
|
|
1525
|
+
start(port) {
|
|
1526
|
+
this.server = serve(
|
|
1527
|
+
{
|
|
1528
|
+
fetch: this.api.fetch,
|
|
1529
|
+
port
|
|
1530
|
+
},
|
|
1531
|
+
(info) => {
|
|
1532
|
+
this.logService.info(
|
|
1533
|
+
`Started local API on ${info.address}:${info.port} (${info.family})`
|
|
1534
|
+
);
|
|
1535
|
+
}
|
|
1536
|
+
);
|
|
1537
|
+
}
|
|
1538
|
+
/**
|
|
1539
|
+
* Stops the local API
|
|
1540
|
+
*/
|
|
1541
|
+
stop() {
|
|
1542
|
+
this.server?.close(() => {
|
|
1543
|
+
this.logService.info("Stopped local API");
|
|
1544
|
+
});
|
|
1545
|
+
}
|
|
1546
|
+
/**
|
|
1547
|
+
* Returns true if the local API is running
|
|
1548
|
+
*/
|
|
1549
|
+
isRunning() {
|
|
1550
|
+
if (this.server?.listening) {
|
|
1551
|
+
return true;
|
|
1552
|
+
}
|
|
1553
|
+
return false;
|
|
1554
|
+
}
|
|
1555
|
+
registerRoutesV1() {
|
|
1556
|
+
const apiV1 = new OpenAPIHono5();
|
|
1557
|
+
apiV1.doc("/openapi.json", {
|
|
1558
|
+
openapi: "3.0.0",
|
|
1559
|
+
externalDocs: { url: "https://elek.io/docs" },
|
|
1560
|
+
info: {
|
|
1561
|
+
version: "0.1.0",
|
|
1562
|
+
title: "elek.io Project API",
|
|
1563
|
+
description: "This API allows reading data from elek.io Projects"
|
|
1564
|
+
},
|
|
1565
|
+
servers: [
|
|
1566
|
+
{
|
|
1567
|
+
url: "http://localhost:{port}/v1/",
|
|
1568
|
+
description: "Local development API",
|
|
1569
|
+
variables: {
|
|
1570
|
+
port: {
|
|
1571
|
+
default: 31310,
|
|
1572
|
+
description: "The port specified in elek.io Clients user configuration"
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
},
|
|
1576
|
+
{
|
|
1577
|
+
url: "https://api.elek.io/v1/",
|
|
1578
|
+
description: "Public production API",
|
|
1579
|
+
variables: {}
|
|
1580
|
+
}
|
|
1581
|
+
],
|
|
1582
|
+
tags: [
|
|
1583
|
+
{
|
|
1584
|
+
name: "Projects",
|
|
1585
|
+
description: "Retrieve information about Projects",
|
|
1586
|
+
externalDocs: { url: "https://elek.io/docs/projects" }
|
|
1587
|
+
},
|
|
1588
|
+
{
|
|
1589
|
+
name: "Collections",
|
|
1590
|
+
description: "Retrieve information about Collections",
|
|
1591
|
+
externalDocs: { url: "https://elek.io/docs/collections" }
|
|
1592
|
+
},
|
|
1593
|
+
{
|
|
1594
|
+
name: "Entries",
|
|
1595
|
+
description: "Retrieve information about Entries",
|
|
1596
|
+
externalDocs: { url: "https://elek.io/docs/entries" }
|
|
1597
|
+
},
|
|
1598
|
+
{
|
|
1599
|
+
name: "Assets",
|
|
1600
|
+
description: "Retrieve information about Assets",
|
|
1601
|
+
externalDocs: { url: "https://elek.io/docs/assets" }
|
|
1602
|
+
}
|
|
1603
|
+
]
|
|
1604
|
+
});
|
|
1605
|
+
apiV1.get("/ui", swaggerUI({ url: "/v1/openapi.json" }));
|
|
1606
|
+
apiV1.route("/", new ProjectApiV1(this.projectService).api);
|
|
1607
|
+
apiV1.route("/", new CollectionApiV1(this.collectionService).api);
|
|
1608
|
+
apiV1.route("/", new EntryApiV1(this.entryService).api);
|
|
1609
|
+
apiV1.route("/", new AssetApiV1(this.assetService).api);
|
|
1610
|
+
this.api.route("/v1", apiV1);
|
|
1611
|
+
}
|
|
1612
|
+
};
|
|
1613
|
+
|
|
927
1614
|
// src/error/GitError.ts
|
|
928
1615
|
var GitError = class extends Error {
|
|
929
1616
|
constructor(message) {
|
|
@@ -1639,15 +2326,13 @@ var EntryService = class extends AbstractCrudService {
|
|
|
1639
2326
|
jsonFileService;
|
|
1640
2327
|
gitService;
|
|
1641
2328
|
collectionService;
|
|
1642
|
-
assetService;
|
|
1643
2329
|
// private sharedValueService: SharedValueService;
|
|
1644
|
-
constructor(options, logService, jsonFileService, gitService, collectionService
|
|
2330
|
+
constructor(options, logService, jsonFileService, gitService, collectionService) {
|
|
1645
2331
|
super(serviceTypeSchema.Enum.Entry, options);
|
|
1646
2332
|
this.logService = logService;
|
|
1647
2333
|
this.jsonFileService = jsonFileService;
|
|
1648
2334
|
this.gitService = gitService;
|
|
1649
2335
|
this.collectionService = collectionService;
|
|
1650
|
-
this.assetService = assetService;
|
|
1651
2336
|
}
|
|
1652
2337
|
/**
|
|
1653
2338
|
* Creates a new Entry for given Collection
|
|
@@ -1884,74 +2569,6 @@ var EntryService = class extends AbstractCrudService {
|
|
|
1884
2569
|
}
|
|
1885
2570
|
});
|
|
1886
2571
|
}
|
|
1887
|
-
/**
|
|
1888
|
-
* Validates given shared Value references against it's Collections definitions
|
|
1889
|
-
*/
|
|
1890
|
-
// private validateResolvedSharedValues(props: {
|
|
1891
|
-
// collectionId: string;
|
|
1892
|
-
// valueDefinitions: ValueDefinition[];
|
|
1893
|
-
// resolvedSharedValues: ResolvedSharedValueReference[];
|
|
1894
|
-
// }) {
|
|
1895
|
-
// props.resolvedSharedValues.map((value) => {
|
|
1896
|
-
// const definition = this.getValueDefinitionById({
|
|
1897
|
-
// collectionId: props.collectionId,
|
|
1898
|
-
// valueDefinitions: props.valueDefinitions,
|
|
1899
|
-
// id: value.definitionId,
|
|
1900
|
-
// });
|
|
1901
|
-
// const schema = getValueSchemaFromDefinition(definition);
|
|
1902
|
-
// schema.parse(value.resolved.content);
|
|
1903
|
-
// });
|
|
1904
|
-
// }
|
|
1905
|
-
async resolveValueContentReference(props) {
|
|
1906
|
-
switch (props.valueContentReference.objectType) {
|
|
1907
|
-
case objectTypeSchema.Enum.asset:
|
|
1908
|
-
return await this.assetService.read({
|
|
1909
|
-
projectId: props.projectId,
|
|
1910
|
-
id: props.valueContentReference.id
|
|
1911
|
-
});
|
|
1912
|
-
case objectTypeSchema.Enum.entry:
|
|
1913
|
-
return await this.read({
|
|
1914
|
-
projectId: props.projectId,
|
|
1915
|
-
collectionId: props.collectionId,
|
|
1916
|
-
id: props.valueContentReference.id
|
|
1917
|
-
});
|
|
1918
|
-
// case objectTypeSchema.Enum.sharedValue:
|
|
1919
|
-
// return this.resolveValueContentReferenceToSharedValue({
|
|
1920
|
-
// projectId: props.projectId,
|
|
1921
|
-
// valueContentReferenceToSharedValue: props.valueContentReference,
|
|
1922
|
-
// });
|
|
1923
|
-
default:
|
|
1924
|
-
throw new Error(
|
|
1925
|
-
// @ts-ignore
|
|
1926
|
-
`Tried to resolve unsupported Value reference "${props.valueContentReference.referenceObjectType}"`
|
|
1927
|
-
);
|
|
1928
|
-
}
|
|
1929
|
-
}
|
|
1930
|
-
async resolveValueContentReferences(props) {
|
|
1931
|
-
let resolvedContent = {};
|
|
1932
|
-
for (const language in props.valueReference.content) {
|
|
1933
|
-
const referencesOfLanguage = props.valueReference.content[language];
|
|
1934
|
-
if (!referencesOfLanguage) {
|
|
1935
|
-
throw new Error(
|
|
1936
|
-
`Trying to access content references by language "${language}" failed`
|
|
1937
|
-
);
|
|
1938
|
-
}
|
|
1939
|
-
const resolvedReferencesOfLanguage = await Promise.all(
|
|
1940
|
-
referencesOfLanguage.map(async (reference) => {
|
|
1941
|
-
return await this.resolveValueContentReference({
|
|
1942
|
-
projectId: props.projectId,
|
|
1943
|
-
collectionId: props.collectionId,
|
|
1944
|
-
valueContentReference: reference
|
|
1945
|
-
});
|
|
1946
|
-
})
|
|
1947
|
-
);
|
|
1948
|
-
resolvedContent = {
|
|
1949
|
-
...resolvedContent,
|
|
1950
|
-
[language]: resolvedReferencesOfLanguage
|
|
1951
|
-
};
|
|
1952
|
-
}
|
|
1953
|
-
return resolvedContent;
|
|
1954
|
-
}
|
|
1955
2572
|
/**
|
|
1956
2573
|
* Creates an Entry from given EntryFile by resolving it's Values
|
|
1957
2574
|
*/
|
|
@@ -1961,24 +2578,7 @@ var EntryService = class extends AbstractCrudService {
|
|
|
1961
2578
|
});
|
|
1962
2579
|
return {
|
|
1963
2580
|
...entryFile,
|
|
1964
|
-
history
|
|
1965
|
-
// @ts-ignore @todo fixme - I have no idea why this happens. The types seem to be compatible to me and they work
|
|
1966
|
-
values: await Promise.all(
|
|
1967
|
-
entryFile.values.map(async (value) => {
|
|
1968
|
-
if (value.valueType === ValueTypeSchema.Enum.reference) {
|
|
1969
|
-
const resolvedContentReferences = await this.resolveValueContentReferences({
|
|
1970
|
-
projectId,
|
|
1971
|
-
collectionId,
|
|
1972
|
-
valueReference: value
|
|
1973
|
-
});
|
|
1974
|
-
return {
|
|
1975
|
-
...value,
|
|
1976
|
-
content: resolvedContentReferences
|
|
1977
|
-
};
|
|
1978
|
-
}
|
|
1979
|
-
return value;
|
|
1980
|
-
})
|
|
1981
|
-
)
|
|
2581
|
+
history
|
|
1982
2582
|
};
|
|
1983
2583
|
}
|
|
1984
2584
|
};
|
|
@@ -3443,7 +4043,7 @@ var UserService = class {
|
|
|
3443
4043
|
return await this.jsonFileService.read(pathTo.userFile, userFileSchema);
|
|
3444
4044
|
} catch (error) {
|
|
3445
4045
|
this.logService.info("No User found");
|
|
3446
|
-
return
|
|
4046
|
+
return null;
|
|
3447
4047
|
}
|
|
3448
4048
|
}
|
|
3449
4049
|
/**
|
|
@@ -3477,6 +4077,7 @@ var ElekIoCore = class {
|
|
|
3477
4077
|
projectService;
|
|
3478
4078
|
collectionService;
|
|
3479
4079
|
entryService;
|
|
4080
|
+
localApi;
|
|
3480
4081
|
constructor(props) {
|
|
3481
4082
|
this.coreVersion = version;
|
|
3482
4083
|
const parsedProps = constructorElekIoCoreSchema.parse(props);
|
|
@@ -3513,8 +4114,7 @@ var ElekIoCore = class {
|
|
|
3513
4114
|
this.logService,
|
|
3514
4115
|
this.jsonFileService,
|
|
3515
4116
|
this.gitService,
|
|
3516
|
-
this.collectionService
|
|
3517
|
-
this.assetService
|
|
4117
|
+
this.collectionService
|
|
3518
4118
|
);
|
|
3519
4119
|
this.projectService = new ProjectService(
|
|
3520
4120
|
this.coreVersion,
|
|
@@ -3527,6 +4127,13 @@ var ElekIoCore = class {
|
|
|
3527
4127
|
this.collectionService,
|
|
3528
4128
|
this.entryService
|
|
3529
4129
|
);
|
|
4130
|
+
this.localApi = new LocalApi(
|
|
4131
|
+
this.logService,
|
|
4132
|
+
this.projectService,
|
|
4133
|
+
this.collectionService,
|
|
4134
|
+
this.entryService,
|
|
4135
|
+
this.assetService
|
|
4136
|
+
);
|
|
3530
4137
|
this.logService.info(`Initializing elek.io Core ${this.coreVersion}`, {
|
|
3531
4138
|
options: this.options
|
|
3532
4139
|
});
|
|
@@ -3582,6 +4189,13 @@ var ElekIoCore = class {
|
|
|
3582
4189
|
get entries() {
|
|
3583
4190
|
return this.entryService;
|
|
3584
4191
|
}
|
|
4192
|
+
/**
|
|
4193
|
+
* Allows starting and stopping a REST API
|
|
4194
|
+
* to allow developers to read local Project data
|
|
4195
|
+
*/
|
|
4196
|
+
get api() {
|
|
4197
|
+
return this.localApi;
|
|
4198
|
+
}
|
|
3585
4199
|
};
|
|
3586
4200
|
export {
|
|
3587
4201
|
BooleanFieldDefinitionBaseSchema,
|
|
@@ -3661,6 +4275,7 @@ export {
|
|
|
3661
4275
|
numberFieldDefinitionSchema,
|
|
3662
4276
|
objectTypeSchema,
|
|
3663
4277
|
outdatedProjectSchema,
|
|
4278
|
+
paginatedListOf,
|
|
3664
4279
|
projectBranchSchema,
|
|
3665
4280
|
projectExportSchema,
|
|
3666
4281
|
projectFileSchema,
|
|
@@ -3676,9 +4291,6 @@ export {
|
|
|
3676
4291
|
readGitTagSchema,
|
|
3677
4292
|
readProjectSchema,
|
|
3678
4293
|
referencedValueSchema,
|
|
3679
|
-
resolvedReferencedValueSchema,
|
|
3680
|
-
resolvedValueContentReferenceSchema,
|
|
3681
|
-
resolvedValueSchema,
|
|
3682
4294
|
saveAssetSchema,
|
|
3683
4295
|
searchProjectSchema,
|
|
3684
4296
|
serviceTypeSchema,
|