@kaddo/cli 3.82.0 → 3.84.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/admin-dist/assets/{index-DIfpc20n.js → index-DNuMsvZr.js} +15 -15
- package/dist/admin-dist/index.html +1 -1
- package/dist/admin-server/index.js +204 -7
- package/dist/core.js +588 -14
- package/dist/index.js +317 -15
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>admin</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-DNuMsvZr.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-DNkI-1xG.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
@@ -71,11 +71,24 @@ import {
|
|
|
71
71
|
getSystemMapProjection as coreGetSystemMapProjection,
|
|
72
72
|
buildTopologyEnrichmentHandoff as coreBuildTopologyHandoff,
|
|
73
73
|
listIntegrations as coreListIntegrations,
|
|
74
|
+
getIntegration as coreGetIntegration,
|
|
75
|
+
getIntegrationSecretStatus as coreGetIntegrationSecretStatus,
|
|
76
|
+
getAvailableIntegrationTypes as coreGetAvailableIntegrationTypes,
|
|
77
|
+
createIntegration as coreCreateIntegration,
|
|
78
|
+
updateIntegration as coreUpdateIntegration,
|
|
79
|
+
deleteIntegration as coreDeleteIntegration,
|
|
80
|
+
enableIntegration as coreEnableIntegration,
|
|
81
|
+
disableIntegration as coreDisableIntegration,
|
|
82
|
+
setIntegrationSecret as coreSetIntegrationSecret,
|
|
83
|
+
removeIntegrationSecret as coreRemoveIntegrationSecret,
|
|
74
84
|
verifyIntegration as coreVerifyIntegration,
|
|
75
85
|
listExternalWorkItems as coreListExternalWorkItems,
|
|
76
86
|
getExternalWorkItem as coreGetExternalWorkItem,
|
|
77
87
|
previewImport as corePreviewImport,
|
|
78
88
|
importExternalWorkItem as coreImportExternalWorkItem,
|
|
89
|
+
discoverExternalWorkItems as coreDiscoverExternalWorkItems,
|
|
90
|
+
getIntegrationFilters as coreGetIntegrationFilters,
|
|
91
|
+
updateIntegrationFilters as coreUpdateIntegrationFilters,
|
|
79
92
|
IntegrationError,
|
|
80
93
|
IntegrationServiceError,
|
|
81
94
|
WorkItemWriteError,
|
|
@@ -365,7 +378,7 @@ async function getIntegrationStatus(dir, id) {
|
|
|
365
378
|
}
|
|
366
379
|
async function getExternalWorkItems(dir, id, opts) {
|
|
367
380
|
try {
|
|
368
|
-
return await coreListExternalWorkItems(dir, id, { cursor: opts.cursor, pageSize: opts.pageSize, filters:
|
|
381
|
+
return await coreListExternalWorkItems(dir, id, { cursor: opts.cursor, pageSize: opts.pageSize, filters: opts.filters });
|
|
369
382
|
} catch (err) {
|
|
370
383
|
mapIntegrationError(err);
|
|
371
384
|
}
|
|
@@ -395,6 +408,93 @@ async function importIntegrationWorkItem(dir, id, externalId, opts) {
|
|
|
395
408
|
mapIntegrationError(err);
|
|
396
409
|
}
|
|
397
410
|
}
|
|
411
|
+
function getIntegrationDetail(dir, id) {
|
|
412
|
+
try {
|
|
413
|
+
return coreGetIntegration(dir, id);
|
|
414
|
+
} catch (err) {
|
|
415
|
+
mapIntegrationError(err);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
async function getIntegrationSecretStatusAdmin(dir, id) {
|
|
419
|
+
try {
|
|
420
|
+
return await coreGetIntegrationSecretStatus(dir, id);
|
|
421
|
+
} catch (err) {
|
|
422
|
+
mapIntegrationError(err);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
function getAvailableIntegrationTypesAdmin() {
|
|
426
|
+
return coreGetAvailableIntegrationTypes();
|
|
427
|
+
}
|
|
428
|
+
function createIntegrationAdmin(dir, body) {
|
|
429
|
+
try {
|
|
430
|
+
return coreCreateIntegration(dir, body);
|
|
431
|
+
} catch (err) {
|
|
432
|
+
mapIntegrationError(err);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
function updateIntegrationAdmin(dir, id, body) {
|
|
436
|
+
try {
|
|
437
|
+
return coreUpdateIntegration(dir, id, body);
|
|
438
|
+
} catch (err) {
|
|
439
|
+
mapIntegrationError(err);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
function deleteIntegrationAdmin(dir, id) {
|
|
443
|
+
try {
|
|
444
|
+
coreDeleteIntegration(dir, id);
|
|
445
|
+
} catch (err) {
|
|
446
|
+
mapIntegrationError(err);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
function enableIntegrationAdmin(dir, id) {
|
|
450
|
+
try {
|
|
451
|
+
return coreEnableIntegration(dir, id);
|
|
452
|
+
} catch (err) {
|
|
453
|
+
mapIntegrationError(err);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
function disableIntegrationAdmin(dir, id) {
|
|
457
|
+
try {
|
|
458
|
+
return coreDisableIntegration(dir, id);
|
|
459
|
+
} catch (err) {
|
|
460
|
+
mapIntegrationError(err);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
async function setIntegrationSecretAdmin(dir, id, secretName, value) {
|
|
464
|
+
try {
|
|
465
|
+
await coreSetIntegrationSecret(dir, id, secretName, value);
|
|
466
|
+
} catch (err) {
|
|
467
|
+
mapIntegrationError(err);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
async function removeIntegrationSecretAdmin(dir, id, secretName) {
|
|
471
|
+
try {
|
|
472
|
+
await coreRemoveIntegrationSecret(dir, id, secretName);
|
|
473
|
+
} catch (err) {
|
|
474
|
+
mapIntegrationError(err);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
async function discoverExternalWorkItemsAdmin(dir, opts) {
|
|
478
|
+
try {
|
|
479
|
+
return await coreDiscoverExternalWorkItems(dir, opts);
|
|
480
|
+
} catch (err) {
|
|
481
|
+
mapIntegrationError(err);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
function getIntegrationFiltersAdmin(dir, id) {
|
|
485
|
+
try {
|
|
486
|
+
return coreGetIntegrationFilters(dir, id);
|
|
487
|
+
} catch (err) {
|
|
488
|
+
mapIntegrationError(err);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
function updateIntegrationFiltersAdmin(dir, id, filters) {
|
|
492
|
+
try {
|
|
493
|
+
return coreUpdateIntegrationFilters(dir, id, filters);
|
|
494
|
+
} catch (err) {
|
|
495
|
+
mapIntegrationError(err);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
398
498
|
|
|
399
499
|
// src/contracts/schemas.ts
|
|
400
500
|
import { z } from "zod";
|
|
@@ -896,18 +996,86 @@ async function createAdminServer(opts) {
|
|
|
896
996
|
}
|
|
897
997
|
};
|
|
898
998
|
app.get("/api/v1/admin/integrations", coreRoute(getIntegrations));
|
|
999
|
+
app.get("/api/v1/admin/integrations/types", coreRoute(() => getAvailableIntegrationTypesAdmin()));
|
|
1000
|
+
app.get("/api/v1/admin/integrations/:id", async (request, reply) => {
|
|
1001
|
+
try {
|
|
1002
|
+
return getIntegrationDetail(projectDir, request.params.id);
|
|
1003
|
+
} catch (err) {
|
|
1004
|
+
if (err instanceof CoreError) return reply.code(statusForCode(err.code)).send({ error: { code: err.code, message: err.message } });
|
|
1005
|
+
throw err;
|
|
1006
|
+
}
|
|
1007
|
+
});
|
|
1008
|
+
app.get(
|
|
1009
|
+
"/api/v1/admin/integrations/:id/secrets",
|
|
1010
|
+
async (request, reply) => asyncCore(reply, () => getIntegrationSecretStatusAdmin(projectDir, request.params.id))
|
|
1011
|
+
);
|
|
899
1012
|
app.get(
|
|
900
1013
|
"/api/v1/admin/integrations/:id/status",
|
|
901
1014
|
async (request, reply) => asyncCore(reply, () => getIntegrationStatus(projectDir, request.params.id))
|
|
902
1015
|
);
|
|
1016
|
+
app.post(
|
|
1017
|
+
"/api/v1/admin/integrations",
|
|
1018
|
+
async (request, reply) => {
|
|
1019
|
+
const { id, adapter, enabled, config, secrets } = request.body ?? {};
|
|
1020
|
+
if (!id || !adapter) return reply.code(400).send({ error: { code: "INVALID_INPUT", message: "id and adapter are required." } });
|
|
1021
|
+
return writeHandler(reply, () => createIntegrationAdmin(projectDir, { id, adapter, enabled, config, secrets }));
|
|
1022
|
+
}
|
|
1023
|
+
);
|
|
1024
|
+
app.put(
|
|
1025
|
+
"/api/v1/admin/integrations/:id",
|
|
1026
|
+
async (request, reply) => writeHandler(reply, () => updateIntegrationAdmin(projectDir, request.params.id, request.body ?? {}))
|
|
1027
|
+
);
|
|
1028
|
+
app.delete("/api/v1/admin/integrations/:id", async (request, reply) => {
|
|
1029
|
+
try {
|
|
1030
|
+
deleteIntegrationAdmin(projectDir, request.params.id);
|
|
1031
|
+
return { ok: true };
|
|
1032
|
+
} catch (err) {
|
|
1033
|
+
if (err instanceof CoreError) return reply.code(statusForCode(err.code)).send({ error: { code: err.code, message: err.message } });
|
|
1034
|
+
throw err;
|
|
1035
|
+
}
|
|
1036
|
+
});
|
|
1037
|
+
app.post(
|
|
1038
|
+
"/api/v1/admin/integrations/:id/enable",
|
|
1039
|
+
async (request, reply) => writeHandler(reply, () => enableIntegrationAdmin(projectDir, request.params.id))
|
|
1040
|
+
);
|
|
1041
|
+
app.post(
|
|
1042
|
+
"/api/v1/admin/integrations/:id/disable",
|
|
1043
|
+
async (request, reply) => writeHandler(reply, () => disableIntegrationAdmin(projectDir, request.params.id))
|
|
1044
|
+
);
|
|
1045
|
+
app.post(
|
|
1046
|
+
"/api/v1/admin/integrations/:id/secrets/:name",
|
|
1047
|
+
async (request, reply) => {
|
|
1048
|
+
const { value } = request.body ?? {};
|
|
1049
|
+
if (!value || typeof value !== "string") return reply.code(400).send({ error: { code: "INVALID_INPUT", message: "A secret value is required." } });
|
|
1050
|
+
return asyncCore(reply, async () => {
|
|
1051
|
+
await setIntegrationSecretAdmin(projectDir, request.params.id, request.params.name, value);
|
|
1052
|
+
return { ok: true };
|
|
1053
|
+
});
|
|
1054
|
+
}
|
|
1055
|
+
);
|
|
1056
|
+
app.delete(
|
|
1057
|
+
"/api/v1/admin/integrations/:id/secrets/:name",
|
|
1058
|
+
async (request, reply) => asyncCore(reply, async () => {
|
|
1059
|
+
await removeIntegrationSecretAdmin(projectDir, request.params.id, request.params.name);
|
|
1060
|
+
return { ok: true };
|
|
1061
|
+
})
|
|
1062
|
+
);
|
|
903
1063
|
app.get(
|
|
904
1064
|
"/api/v1/admin/integrations/:id/work-items",
|
|
905
|
-
async (request, reply) =>
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
1065
|
+
async (request, reply) => {
|
|
1066
|
+
const q = request.query;
|
|
1067
|
+
const filters = {};
|
|
1068
|
+
if (q.statuses) filters.statuses = q.statuses.split(",");
|
|
1069
|
+
if (q.types) filters.types = q.types.split(",");
|
|
1070
|
+
if (q.labels) filters.labels = q.labels.split(",");
|
|
1071
|
+
if (q.assignees) filters.assignees = q.assignees.split(",");
|
|
1072
|
+
if (q.search) filters.search = q.search;
|
|
1073
|
+
return asyncCore(reply, () => getExternalWorkItems(projectDir, request.params.id, {
|
|
1074
|
+
cursor: q.cursor,
|
|
1075
|
+
pageSize: q.pageSize ? Number.parseInt(q.pageSize, 10) : void 0,
|
|
1076
|
+
filters: Object.keys(filters).length ? filters : void 0
|
|
1077
|
+
}));
|
|
1078
|
+
}
|
|
911
1079
|
);
|
|
912
1080
|
app.get(
|
|
913
1081
|
"/api/v1/admin/integrations/:id/work-items/:externalId",
|
|
@@ -925,6 +1093,35 @@ async function createAdminServer(opts) {
|
|
|
925
1093
|
return asyncCore(reply, () => importIntegrationWorkItem(projectDir, request.params.id, request.params.externalId, { type }));
|
|
926
1094
|
}
|
|
927
1095
|
);
|
|
1096
|
+
app.get(
|
|
1097
|
+
"/api/v1/admin/integrations/discover",
|
|
1098
|
+
async (request, reply) => {
|
|
1099
|
+
const q = request.query;
|
|
1100
|
+
const filters = {};
|
|
1101
|
+
if (q.statuses) filters.statuses = q.statuses.split(",");
|
|
1102
|
+
if (q.types) filters.types = q.types.split(",");
|
|
1103
|
+
if (q.labels) filters.labels = q.labels.split(",");
|
|
1104
|
+
if (q.assignees) filters.assignees = q.assignees.split(",");
|
|
1105
|
+
if (q.search) filters.search = q.search;
|
|
1106
|
+
return asyncCore(reply, () => discoverExternalWorkItemsAdmin(projectDir, {
|
|
1107
|
+
filters: Object.keys(filters).length ? filters : void 0,
|
|
1108
|
+
pageSize: q.pageSize ? Number.parseInt(q.pageSize, 10) : void 0,
|
|
1109
|
+
integrationIds: q.integrationIds ? q.integrationIds.split(",") : void 0
|
|
1110
|
+
}));
|
|
1111
|
+
}
|
|
1112
|
+
);
|
|
1113
|
+
app.get("/api/v1/admin/integrations/:id/filters", async (request, reply) => {
|
|
1114
|
+
try {
|
|
1115
|
+
return getIntegrationFiltersAdmin(projectDir, request.params.id);
|
|
1116
|
+
} catch (err) {
|
|
1117
|
+
if (err instanceof CoreError) return reply.code(statusForCode(err.code)).send({ error: { code: err.code, message: err.message } });
|
|
1118
|
+
throw err;
|
|
1119
|
+
}
|
|
1120
|
+
});
|
|
1121
|
+
app.put(
|
|
1122
|
+
"/api/v1/admin/integrations/:id/filters",
|
|
1123
|
+
async (request, reply) => writeHandler(reply, () => updateIntegrationFiltersAdmin(projectDir, request.params.id, request.body ?? {}))
|
|
1124
|
+
);
|
|
928
1125
|
app.get("/api/v1/admin/knowledge/inventory", coreRoute(getKnowledgeInventory));
|
|
929
1126
|
app.get("/api/v1/admin/knowledge/artifact/:artifactId", async (request) => {
|
|
930
1127
|
try {
|