@cyberismo/backend 0.0.21 → 0.0.23
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/app.d.ts +5 -2
- package/dist/app.js +25 -10
- package/dist/app.js.map +1 -1
- package/dist/auth/index.d.ts +16 -0
- package/dist/auth/index.js +15 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/keycloak.d.ts +27 -0
- package/dist/auth/keycloak.js +81 -0
- package/dist/auth/keycloak.js.map +1 -0
- package/dist/auth/mock.d.ts +23 -0
- package/dist/auth/mock.js +28 -0
- package/dist/auth/mock.js.map +1 -0
- package/dist/auth/types.d.ts +16 -0
- package/dist/auth/types.js +14 -0
- package/dist/auth/types.js.map +1 -0
- package/dist/domain/auth/index.d.ts +14 -0
- package/dist/domain/auth/index.js +30 -0
- package/dist/domain/auth/index.js.map +1 -0
- package/dist/domain/calculations/index.js +3 -1
- package/dist/domain/calculations/index.js.map +1 -1
- package/dist/domain/calculations/service.js +13 -11
- package/dist/domain/calculations/service.js.map +1 -1
- package/dist/domain/cardTypes/index.js +5 -3
- package/dist/domain/cardTypes/index.js.map +1 -1
- package/dist/domain/cardTypes/service.js +24 -72
- package/dist/domain/cardTypes/service.js.map +1 -1
- package/dist/domain/cards/index.js +124 -25
- package/dist/domain/cards/index.js.map +1 -1
- package/dist/domain/cards/lib.js +92 -93
- package/dist/domain/cards/lib.js.map +1 -1
- package/dist/domain/cards/presence.d.ts +50 -0
- package/dist/domain/cards/presence.js +93 -0
- package/dist/domain/cards/presence.js.map +1 -0
- package/dist/domain/cards/schema.d.ts +47 -0
- package/dist/domain/cards/schema.js +37 -0
- package/dist/domain/cards/schema.js.map +1 -0
- package/dist/domain/cards/service.d.ts +7 -3
- package/dist/domain/cards/service.js +81 -91
- package/dist/domain/cards/service.js.map +1 -1
- package/dist/domain/connectors/index.d.ts +15 -0
- package/dist/domain/connectors/index.js +37 -0
- package/dist/domain/connectors/index.js.map +1 -0
- package/dist/domain/connectors/service.d.ts +23 -0
- package/dist/domain/connectors/service.js +46 -0
- package/dist/domain/connectors/service.js.map +1 -0
- package/dist/domain/fieldTypes/index.js +4 -2
- package/dist/domain/fieldTypes/index.js.map +1 -1
- package/dist/domain/graphModels/index.js +3 -1
- package/dist/domain/graphModels/index.js.map +1 -1
- package/dist/domain/graphViews/index.js +3 -1
- package/dist/domain/graphViews/index.js.map +1 -1
- package/dist/domain/labels/index.js +4 -2
- package/dist/domain/labels/index.js.map +1 -1
- package/dist/domain/labels/service.d.ts +1 -1
- package/dist/domain/labels/service.js +2 -2
- package/dist/domain/labels/service.js.map +1 -1
- package/dist/domain/linkTypes/index.js +4 -2
- package/dist/domain/linkTypes/index.js.map +1 -1
- package/dist/domain/logicPrograms/index.js +3 -1
- package/dist/domain/logicPrograms/index.js.map +1 -1
- package/dist/domain/mcp/index.d.ts +15 -0
- package/dist/domain/mcp/index.js +127 -0
- package/dist/domain/mcp/index.js.map +1 -0
- package/dist/domain/project/index.js +19 -6
- package/dist/domain/project/index.js.map +1 -1
- package/dist/domain/project/schema.d.ts +3 -0
- package/dist/domain/project/schema.js +8 -0
- package/dist/domain/project/schema.js.map +1 -1
- package/dist/domain/project/service.d.ts +3 -1
- package/dist/domain/project/service.js +24 -14
- package/dist/domain/project/service.js.map +1 -1
- package/dist/domain/reports/index.js +3 -1
- package/dist/domain/reports/index.js.map +1 -1
- package/dist/domain/resources/index.js +6 -4
- package/dist/domain/resources/index.js.map +1 -1
- package/dist/domain/resources/service.js +66 -64
- package/dist/domain/resources/service.js.map +1 -1
- package/dist/domain/templates/index.js +5 -3
- package/dist/domain/templates/index.js.map +1 -1
- package/dist/domain/tree/index.js +3 -1
- package/dist/domain/tree/index.js.map +1 -1
- package/dist/domain/tree/service.js +0 -1
- package/dist/domain/tree/service.js.map +1 -1
- package/dist/domain/workflows/index.js +3 -1
- package/dist/domain/workflows/index.js.map +1 -1
- package/dist/export.d.ts +6 -5
- package/dist/export.js +16 -13
- package/dist/export.js.map +1 -1
- package/dist/index.d.ts +8 -2
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/dist/main.js +29 -2
- package/dist/main.js.map +1 -1
- package/dist/middleware/auth.d.ts +40 -0
- package/dist/middleware/auth.js +68 -0
- package/dist/middleware/auth.js.map +1 -0
- package/dist/middleware/commandManager.d.ts +2 -2
- package/dist/middleware/commandManager.js +9 -11
- package/dist/middleware/commandManager.js.map +1 -1
- package/dist/public/THIRD-PARTY.txt +1212 -605
- package/dist/public/assets/index-Cdn_jRWy.js +720 -0
- package/dist/public/assets/index-ypsafPwV.css +1 -0
- package/dist/public/config.json +1 -0
- package/dist/public/images/broken_link.svg +7 -0
- package/dist/public/index.html +2 -2
- package/dist/types.d.ts +25 -0
- package/dist/types.js +13 -1
- package/dist/types.js.map +1 -1
- package/package.json +10 -7
- package/src/app.ts +37 -15
- package/src/auth/index.ts +17 -0
- package/src/auth/keycloak.ts +109 -0
- package/src/auth/mock.ts +38 -0
- package/src/auth/types.ts +18 -0
- package/src/domain/auth/index.ts +35 -0
- package/src/domain/calculations/index.ts +13 -6
- package/src/domain/calculations/service.ts +16 -14
- package/src/domain/cardTypes/index.ts +24 -16
- package/src/domain/cardTypes/service.ts +41 -95
- package/src/domain/cards/index.ts +258 -90
- package/src/domain/cards/lib.ts +102 -100
- package/src/domain/cards/presence.ts +124 -0
- package/src/domain/cards/schema.ts +41 -0
- package/src/domain/cards/service.ts +138 -93
- package/src/domain/connectors/index.ts +39 -0
- package/src/domain/connectors/service.ts +67 -0
- package/src/domain/fieldTypes/index.ts +23 -16
- package/src/domain/graphModels/index.ts +13 -6
- package/src/domain/graphViews/index.ts +13 -6
- package/src/domain/labels/index.ts +5 -2
- package/src/domain/labels/service.ts +2 -2
- package/src/domain/linkTypes/index.ts +14 -7
- package/src/domain/logicPrograms/index.ts +3 -0
- package/src/domain/mcp/index.ts +159 -0
- package/src/domain/project/index.ts +40 -9
- package/src/domain/project/schema.ts +9 -0
- package/src/domain/project/service.ts +37 -17
- package/src/domain/reports/index.ts +13 -6
- package/src/domain/resources/index.ts +6 -1
- package/src/domain/resources/service.ts +102 -97
- package/src/domain/templates/index.ts +31 -19
- package/src/domain/tree/index.ts +3 -1
- package/src/domain/tree/service.ts +0 -1
- package/src/domain/workflows/index.ts +13 -6
- package/src/export.ts +17 -15
- package/src/index.ts +18 -7
- package/src/main.ts +44 -2
- package/src/middleware/auth.ts +90 -0
- package/src/middleware/commandManager.ts +11 -14
- package/src/types.ts +27 -0
- package/dist/public/assets/index-CRSBseQM.css +0 -1
- package/dist/public/assets/index-Ca10XaMv.js +0 -164156
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../../src/domain/cards/lib.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AAEF,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAE1C,OAAO,EAAuB,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAUrD,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,QAAwB,EACxB,GAAW,EACX,UAAmB,EACnB,GAAY;IAEZ,IAAI,mBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../../src/domain/cards/lib.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AAEF,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAE1C,OAAO,EAAuB,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAUrD,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,QAAwB,EACxB,GAAW,EACX,UAAmB,EACnB,GAAY;IAEZ,OAAO,QAAQ,CAAC,UAAU,CAAC,KAAK,IAAI,EAAE;QACpC,IAAI,mBAAyB,CAAC;QAC9B,IAAI,CAAC;YACH,mBAAmB,GAAG,MAA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CAAC,YAAY,CAAC,QAAQ,CACvD,MAAM,EACN,cAAc,EACd,OAAO,IAAI,EAAE,CACd,CAAC;IAEF,SAAS,YAAY,CAAC,KAA4B;QAChD,OAAO,KAAK,CAAC,MAAM,CAAwB,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YACvD,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACf,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC9C,GAAG,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;YAC3C,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAE,CAAC,CAAC;IACT,CAAC;IACD,OAAO,YAAY,CAAC,YAAY,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2026
|
|
4
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
5
|
+
the terms of the GNU Affero General Public License version 3 as published by
|
|
6
|
+
the Free Software Foundation. This program is distributed in the hope that it
|
|
7
|
+
will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
|
8
|
+
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
9
|
+
See the GNU Affero General Public License for more details.
|
|
10
|
+
You should have received a copy of the GNU Affero General Public
|
|
11
|
+
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
12
|
+
*/
|
|
13
|
+
import type { UserInfo } from '../../types.js';
|
|
14
|
+
import type { SSEMessage } from 'hono/streaming';
|
|
15
|
+
export interface PresenceEntry {
|
|
16
|
+
userId: string;
|
|
17
|
+
userName: string;
|
|
18
|
+
mode: 'viewing' | 'editing';
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* In-memory presence tracker for card editing/viewing.
|
|
22
|
+
* Tracks which users are currently looking at or editing each card,
|
|
23
|
+
* and notifies all connected clients via SSE when presence changes.
|
|
24
|
+
*/
|
|
25
|
+
declare class PresenceStore {
|
|
26
|
+
private connections;
|
|
27
|
+
private nextId;
|
|
28
|
+
/**
|
|
29
|
+
* Add a user connection for a card. Returns a connection ID for later removal.
|
|
30
|
+
*/
|
|
31
|
+
add(cardKey: string, user: UserInfo, mode: 'viewing' | 'editing', send: (message: SSEMessage) => void): string;
|
|
32
|
+
/**
|
|
33
|
+
* Remove a connection and broadcast updated presence.
|
|
34
|
+
*/
|
|
35
|
+
remove(cardKey: string, connId: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Get current presence list for a card.
|
|
38
|
+
*/
|
|
39
|
+
getPresence(cardKey: string): PresenceEntry[];
|
|
40
|
+
/**
|
|
41
|
+
* Broadcast current presence to all connected clients for a card.
|
|
42
|
+
*/
|
|
43
|
+
private broadcast;
|
|
44
|
+
/**
|
|
45
|
+
* Remove all connections. Intended for test cleanup.
|
|
46
|
+
*/
|
|
47
|
+
removeAll(): void;
|
|
48
|
+
}
|
|
49
|
+
export declare const presenceStore: PresenceStore;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2026
|
|
4
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
5
|
+
the terms of the GNU Affero General Public License version 3 as published by
|
|
6
|
+
the Free Software Foundation. This program is distributed in the hope that it
|
|
7
|
+
will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
|
8
|
+
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
9
|
+
See the GNU Affero General Public License for more details.
|
|
10
|
+
You should have received a copy of the GNU Affero General Public
|
|
11
|
+
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* In-memory presence tracker for card editing/viewing.
|
|
15
|
+
* Tracks which users are currently looking at or editing each card,
|
|
16
|
+
* and notifies all connected clients via SSE when presence changes.
|
|
17
|
+
*/
|
|
18
|
+
class PresenceStore {
|
|
19
|
+
// cardKey -> connectionId -> Connection
|
|
20
|
+
connections = new Map();
|
|
21
|
+
nextId = 0;
|
|
22
|
+
/**
|
|
23
|
+
* Add a user connection for a card. Returns a connection ID for later removal.
|
|
24
|
+
*/
|
|
25
|
+
add(cardKey, user, mode, send) {
|
|
26
|
+
const connId = String(this.nextId++);
|
|
27
|
+
if (!this.connections.has(cardKey)) {
|
|
28
|
+
this.connections.set(cardKey, new Map());
|
|
29
|
+
}
|
|
30
|
+
this.connections.get(cardKey).set(connId, { user, mode, send });
|
|
31
|
+
this.broadcast(cardKey);
|
|
32
|
+
return connId;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Remove a connection and broadcast updated presence.
|
|
36
|
+
*/
|
|
37
|
+
remove(cardKey, connId) {
|
|
38
|
+
const cardConns = this.connections.get(cardKey);
|
|
39
|
+
if (!cardConns)
|
|
40
|
+
return;
|
|
41
|
+
cardConns.delete(connId);
|
|
42
|
+
if (cardConns.size === 0) {
|
|
43
|
+
this.connections.delete(cardKey);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
this.broadcast(cardKey);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Get current presence list for a card.
|
|
51
|
+
*/
|
|
52
|
+
getPresence(cardKey) {
|
|
53
|
+
const cardConns = this.connections.get(cardKey);
|
|
54
|
+
if (!cardConns)
|
|
55
|
+
return [];
|
|
56
|
+
// Deduplicate by userId — if a user has multiple connections,
|
|
57
|
+
// prefer the 'editing' mode
|
|
58
|
+
const byUser = new Map();
|
|
59
|
+
for (const conn of cardConns.values()) {
|
|
60
|
+
const existing = byUser.get(conn.user.id);
|
|
61
|
+
if (!existing || conn.mode === 'editing') {
|
|
62
|
+
byUser.set(conn.user.id, {
|
|
63
|
+
userId: conn.user.id,
|
|
64
|
+
userName: conn.user.name,
|
|
65
|
+
mode: conn.mode,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return Array.from(byUser.values());
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Broadcast current presence to all connected clients for a card.
|
|
73
|
+
*/
|
|
74
|
+
broadcast(cardKey) {
|
|
75
|
+
const cardConns = this.connections.get(cardKey);
|
|
76
|
+
if (!cardConns)
|
|
77
|
+
return;
|
|
78
|
+
const presence = this.getPresence(cardKey);
|
|
79
|
+
const data = JSON.stringify({ editors: presence });
|
|
80
|
+
const message = { event: 'presence', data };
|
|
81
|
+
for (const conn of cardConns.values()) {
|
|
82
|
+
conn.send(message);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Remove all connections. Intended for test cleanup.
|
|
87
|
+
*/
|
|
88
|
+
removeAll() {
|
|
89
|
+
this.connections.clear();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
export const presenceStore = new PresenceStore();
|
|
93
|
+
//# sourceMappingURL=presence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presence.js","sourceRoot":"","sources":["../../../src/domain/cards/presence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AAiBF;;;;GAIG;AACH,MAAM,aAAa;IACjB,wCAAwC;IAChC,WAAW,GAAG,IAAI,GAAG,EAAmC,CAAC;IACzD,MAAM,GAAG,CAAC,CAAC;IAEnB;;OAEG;IACH,GAAG,CACD,OAAe,EACf,IAAc,EACd,IAA2B,EAC3B,IAAmC;QAEnC,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QAErC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YACnC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO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AE;oBACvB,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE;oBACpB,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI;oBACxB,IAAI,EAAE,IAAI,CAAC,IAAI;iBAChB,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IACrC,CAAC;IAED;;OAEG;IACK,SAAS,CAAC,OAAe;QAC/B,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAChD,IAAI,CAAC,SAAS;YAAE,OAAO;QAEvB,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAC3C,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;QACnD,MAAM,OAAO,GAAe,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;QAExD,KAAK,MAAM,IAAI,IAAI,SAAS,CAAC,MAAM,EAAE,EAAE,CAAC;YACtC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;IAED;;OAEG;IACH,SAAS;QACP,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC;CACF;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2026
|
|
4
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
5
|
+
the terms of the GNU Affero General Public License version 3 as published by
|
|
6
|
+
the Free Software Foundation.
|
|
7
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
8
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
9
|
+
FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
|
10
|
+
details. You should have received a copy of the GNU Affero General Public
|
|
11
|
+
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
12
|
+
*/
|
|
13
|
+
import { z } from 'zod';
|
|
14
|
+
export declare const createLinkSchema: z.ZodObject<{
|
|
15
|
+
toCard: z.ZodString;
|
|
16
|
+
linkType: z.ZodString;
|
|
17
|
+
direction: z.ZodDefault<z.ZodEnum<{
|
|
18
|
+
outbound: "outbound";
|
|
19
|
+
inbound: "inbound";
|
|
20
|
+
}>>;
|
|
21
|
+
description: z.ZodOptional<z.ZodString>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
export declare const removeLinkSchema: z.ZodObject<{
|
|
24
|
+
toCard: z.ZodString;
|
|
25
|
+
linkType: z.ZodString;
|
|
26
|
+
direction: z.ZodDefault<z.ZodEnum<{
|
|
27
|
+
outbound: "outbound";
|
|
28
|
+
inbound: "inbound";
|
|
29
|
+
}>>;
|
|
30
|
+
description: z.ZodOptional<z.ZodString>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
export declare const updateLinkSchema: z.ZodObject<{
|
|
33
|
+
toCard: z.ZodString;
|
|
34
|
+
linkType: z.ZodString;
|
|
35
|
+
direction: z.ZodEnum<{
|
|
36
|
+
outbound: "outbound";
|
|
37
|
+
inbound: "inbound";
|
|
38
|
+
}>;
|
|
39
|
+
description: z.ZodOptional<z.ZodString>;
|
|
40
|
+
previousToCard: z.ZodString;
|
|
41
|
+
previousLinkType: z.ZodString;
|
|
42
|
+
previousDirection: z.ZodEnum<{
|
|
43
|
+
outbound: "outbound";
|
|
44
|
+
inbound: "inbound";
|
|
45
|
+
}>;
|
|
46
|
+
previousDescription: z.ZodOptional<z.ZodString>;
|
|
47
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2026
|
|
4
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
5
|
+
the terms of the GNU Affero General Public License version 3 as published by
|
|
6
|
+
the Free Software Foundation.
|
|
7
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
8
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
9
|
+
FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
|
10
|
+
details. You should have received a copy of the GNU Affero General Public
|
|
11
|
+
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
12
|
+
*/
|
|
13
|
+
import { z } from 'zod';
|
|
14
|
+
const linkDirection = z.enum(['outbound', 'inbound']);
|
|
15
|
+
export const createLinkSchema = z.object({
|
|
16
|
+
toCard: z.string(),
|
|
17
|
+
linkType: z.string(),
|
|
18
|
+
direction: linkDirection.default('outbound'),
|
|
19
|
+
description: z.string().optional(),
|
|
20
|
+
});
|
|
21
|
+
export const removeLinkSchema = z.object({
|
|
22
|
+
toCard: z.string(),
|
|
23
|
+
linkType: z.string(),
|
|
24
|
+
direction: linkDirection.default('outbound'),
|
|
25
|
+
description: z.string().optional(),
|
|
26
|
+
});
|
|
27
|
+
export const updateLinkSchema = z.object({
|
|
28
|
+
toCard: z.string(),
|
|
29
|
+
linkType: z.string(),
|
|
30
|
+
direction: linkDirection,
|
|
31
|
+
description: z.string().optional(),
|
|
32
|
+
previousToCard: z.string(),
|
|
33
|
+
previousLinkType: z.string(),
|
|
34
|
+
previousDirection: linkDirection,
|
|
35
|
+
previousDescription: z.string().optional(),
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/domain/cards/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AAEF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,aAAa,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC;AAEtD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,SAAS,EAAE,aAAa,CAAC,OAAO,CAAC,UAAU,CAAC;IAC5C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACnC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,SAAS,EAAE,aAAa,CAAC,OAAO,CAAC,UAAU,CAAC;IAC5C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACnC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,SAAS,EAAE,aAAa;IACxB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE;IAC5B,iBAAiB,EAAE,aAAa;IAChC,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC3C,CAAC,CAAC"}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
details. You should have received a copy of the GNU Affero General Public
|
|
11
11
|
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
12
12
|
*/
|
|
13
|
+
import type { attachmentPayload } from '@cyberismo/data-handler/interfaces/request-status-interfaces';
|
|
13
14
|
import { type CommandManager } from '@cyberismo/data-handler';
|
|
14
15
|
import { allCards } from './lib.js';
|
|
15
16
|
import type { TreeOptions } from '../../types.js';
|
|
@@ -35,13 +36,16 @@ export declare function openAttachment(commands: CommandManager, key: string, fi
|
|
|
35
36
|
export declare function parseContent(commands: CommandManager, key: string, content: string): Promise<{
|
|
36
37
|
parsedContent: string;
|
|
37
38
|
}>;
|
|
38
|
-
export declare function createLink(commands: CommandManager, key: string,
|
|
39
|
+
export declare function createLink(commands: CommandManager, key: string, target: string, linkType: string, direction?: 'outbound' | 'inbound', description?: string): Promise<{
|
|
39
40
|
message: string;
|
|
40
41
|
}>;
|
|
41
|
-
export declare function removeLink(commands: CommandManager, key: string,
|
|
42
|
+
export declare function removeLink(commands: CommandManager, key: string, target: string, linkType: string, direction?: 'outbound' | 'inbound', description?: string): Promise<{
|
|
42
43
|
message: string;
|
|
43
44
|
}>;
|
|
44
|
-
export declare function
|
|
45
|
+
export declare function updateLink(commands: CommandManager, key: string, toCard: string, linkType: string, direction: 'outbound' | 'inbound', previousToCard: string, previousLinkType: string, previousDirection: 'outbound' | 'inbound', linkDescription?: string, previousLinkDescription?: string): Promise<{
|
|
46
|
+
message: string;
|
|
47
|
+
}>;
|
|
48
|
+
export declare function getAttachment(commands: CommandManager, key: string, filename: string): Promise<attachmentPayload>;
|
|
45
49
|
/**
|
|
46
50
|
* Used for exporting cards, thus static mode is assumed
|
|
47
51
|
* @param commandsthe command manager used for the query
|
|
@@ -14,77 +14,46 @@ import Processor from '@asciidoctor/core';
|
|
|
14
14
|
import { evaluateMacros } from '@cyberismo/data-handler';
|
|
15
15
|
import { allCards } from './lib.js';
|
|
16
16
|
export async function getProjectInfo(commands) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
17
|
+
return commands.consistent(async () => {
|
|
18
|
+
const projectResponse = await commands.showCmd.showProject();
|
|
19
|
+
const workflowsResponse = await commands.showCmd.showWorkflowsWithDetails();
|
|
20
|
+
if (!workflowsResponse) {
|
|
21
|
+
throw new Error('No workflows found');
|
|
22
|
+
}
|
|
23
|
+
const cardTypesResponse = await commands.showCmd.showCardTypesWithDetails();
|
|
24
|
+
if (!cardTypesResponse) {
|
|
25
|
+
throw new Error('No card types found');
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
name: projectResponse.name,
|
|
29
|
+
prefix: projectResponse.prefix,
|
|
30
|
+
workflows: workflowsResponse,
|
|
31
|
+
cardTypes: cardTypesResponse,
|
|
32
|
+
};
|
|
33
|
+
});
|
|
32
34
|
}
|
|
33
35
|
export async function updateCard(commands, key,
|
|
34
36
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
35
37
|
body) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
try {
|
|
38
|
+
await commands.atomic(async () => {
|
|
39
|
+
if (body.state) {
|
|
39
40
|
await commands.transitionCmd.cardTransition(key, body.state);
|
|
40
41
|
}
|
|
41
|
-
|
|
42
|
-
if (error instanceof Error)
|
|
43
|
-
errors.push(error.message);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
if (body.content != null) {
|
|
47
|
-
try {
|
|
42
|
+
if (body.content != null) {
|
|
48
43
|
await commands.editCmd.editCardContent(key, body.content);
|
|
49
44
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
if (body.metadata) {
|
|
56
|
-
for (const [metadataKey, metadataValue] of Object.entries(body.metadata)) {
|
|
57
|
-
const value = metadataValue;
|
|
58
|
-
try {
|
|
59
|
-
await commands.editCmd.editCardMetadata(key, metadataKey, value);
|
|
60
|
-
}
|
|
61
|
-
catch (error) {
|
|
62
|
-
if (error instanceof Error)
|
|
63
|
-
errors.push(error.message);
|
|
45
|
+
if (body.metadata) {
|
|
46
|
+
for (const [metadataKey, metadataValue] of Object.entries(body.metadata)) {
|
|
47
|
+
await commands.editCmd.editCardMetadata(key, metadataKey, metadataValue);
|
|
64
48
|
}
|
|
65
49
|
}
|
|
66
|
-
|
|
67
|
-
if (body.parent) {
|
|
68
|
-
try {
|
|
50
|
+
if (body.parent) {
|
|
69
51
|
await commands.moveCmd.moveCard(key, body.parent);
|
|
70
52
|
}
|
|
71
|
-
|
|
72
|
-
if (error instanceof Error)
|
|
73
|
-
errors.push(error.message);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
if (body.index != null) {
|
|
77
|
-
try {
|
|
53
|
+
if (body.index != null) {
|
|
78
54
|
await commands.moveCmd.rankByIndex(key, body.index);
|
|
79
55
|
}
|
|
80
|
-
|
|
81
|
-
if (error instanceof Error)
|
|
82
|
-
errors.push(error.message);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
if (errors.length > 0) {
|
|
86
|
-
throw new Error(errors.join('\n'));
|
|
87
|
-
}
|
|
56
|
+
}, `Update card ${key}`);
|
|
88
57
|
}
|
|
89
58
|
export async function deleteCard(commands, key) {
|
|
90
59
|
await commands.removeCmd.remove('card', key);
|
|
@@ -98,13 +67,15 @@ export async function createCard(commands, template, parentKey) {
|
|
|
98
67
|
}
|
|
99
68
|
export async function uploadAttachments(commands, key, files) {
|
|
100
69
|
const succeeded = [];
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
70
|
+
await commands.atomic(async () => {
|
|
71
|
+
for (const file of files) {
|
|
72
|
+
if (file instanceof File) {
|
|
73
|
+
const buffer = await file.arrayBuffer();
|
|
74
|
+
await commands.createCmd.createAttachment(key, file.name, Buffer.from(buffer));
|
|
75
|
+
succeeded.push(file.name);
|
|
76
|
+
}
|
|
106
77
|
}
|
|
107
|
-
}
|
|
78
|
+
}, `Add attachments to ${key}`);
|
|
108
79
|
return {
|
|
109
80
|
message: 'Attachments uploaded successfully',
|
|
110
81
|
files: succeeded,
|
|
@@ -119,39 +90,58 @@ export async function openAttachment(commands, key, filename) {
|
|
|
119
90
|
return { message: 'Attachment opened successfully' };
|
|
120
91
|
}
|
|
121
92
|
export async function parseContent(commands, key, content) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
93
|
+
return commands.consistent(async () => {
|
|
94
|
+
let asciidocContent;
|
|
95
|
+
try {
|
|
96
|
+
asciidocContent = await evaluateMacros(content, {
|
|
97
|
+
context: 'localApp',
|
|
98
|
+
mode: 'inject',
|
|
99
|
+
project: commands.project,
|
|
100
|
+
cardKey: key,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
asciidocContent = `Macro error: ${error instanceof Error ? error.message : 'Unknown error'}\n\n${content}`;
|
|
105
|
+
}
|
|
106
|
+
const processor = Processor();
|
|
107
|
+
const parsedContent = processor
|
|
108
|
+
.convert(asciidocContent, {
|
|
109
|
+
safe: 'safe',
|
|
110
|
+
attributes: {
|
|
111
|
+
imagesdir: `/api/cards/${key}/a`,
|
|
112
|
+
icons: 'font',
|
|
113
|
+
},
|
|
114
|
+
})
|
|
115
|
+
.toString();
|
|
116
|
+
return { parsedContent };
|
|
117
|
+
});
|
|
145
118
|
}
|
|
146
|
-
export async function createLink(commands, key,
|
|
147
|
-
|
|
119
|
+
export async function createLink(commands, key, target, linkType, direction = 'outbound', description) {
|
|
120
|
+
// For outbound: key is source, target is destination
|
|
121
|
+
// For inbound: target is source, key is destination
|
|
122
|
+
const source = direction === 'outbound' ? key : target;
|
|
123
|
+
const destination = direction === 'outbound' ? target : key;
|
|
124
|
+
await commands.createCmd.createLink(source, destination, linkType, description, direction);
|
|
148
125
|
return { message: 'Link created successfully' };
|
|
149
126
|
}
|
|
150
|
-
export async function removeLink(commands, key,
|
|
151
|
-
|
|
127
|
+
export async function removeLink(commands, key, target, linkType, direction = 'outbound', description) {
|
|
128
|
+
// For outbound: key is source, target is destination
|
|
129
|
+
// For inbound: target is source, key is destination
|
|
130
|
+
const source = direction === 'outbound' ? key : target;
|
|
131
|
+
const destination = direction === 'outbound' ? target : key;
|
|
132
|
+
await commands.removeCmd.remove('link', source, destination, linkType, description);
|
|
152
133
|
return { message: 'Link removed successfully' };
|
|
153
134
|
}
|
|
154
|
-
export function
|
|
135
|
+
export async function updateLink(commands, key, toCard, linkType, direction, previousToCard, previousLinkType, previousDirection, linkDescription, previousLinkDescription) {
|
|
136
|
+
// For simplicity create the new link first so that duplicate-link validation runs before
|
|
137
|
+
// the old link is removed. This also handles direction changes.
|
|
138
|
+
return commands.atomic(async () => {
|
|
139
|
+
await createLink(commands, key, toCard, linkType, direction, linkDescription);
|
|
140
|
+
await removeLink(commands, key, previousToCard, previousLinkType, previousDirection, previousLinkDescription);
|
|
141
|
+
return { message: 'Link updated successfully' };
|
|
142
|
+
}, `Update link on ${key} to ${toCard}`);
|
|
143
|
+
}
|
|
144
|
+
export async function getAttachment(commands, key, filename) {
|
|
155
145
|
return commands.showCmd.showAttachment(key, filename);
|
|
156
146
|
}
|
|
157
147
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../../src/domain/cards/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AAEF,OAAO,SAAS,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../../src/domain/cards/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AAEF,O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,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;AACxD,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,QAAwB,EACxB,OAAqB;IAErB,OAAO,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AACrC,CAAC;AACD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,QAAwB,EACxB,OAAqB;IAErB,MAAM,KAAK,GAAG,IAAI,GAAG,CACnB,CAAC,MAAM,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CACtD,CAAC;IACF,MAAM,WAAW,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC;IAC7D,OAAO,WAAW;SACf,MAAM,CACL,CAAC,UAAU,EAAE,EAAE,CACb,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC,CAC1E;SACA,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QACpB,GAAG,EAAE,UAAU,CAAC,IAAI;QACpB,UAAU,EAAE,UAAU,CAAC,QAAQ;KAChC,CAAC,CAAC,CAAC;AACR,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2026
|
|
4
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
5
|
+
the terms of the GNU Affero General Public License version 3 as published by
|
|
6
|
+
the Free Software Foundation. This program is distributed in the hope that it
|
|
7
|
+
will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
|
8
|
+
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
9
|
+
See the GNU Affero General Public License for more details.
|
|
10
|
+
You should have received a copy of the GNU Affero General Public
|
|
11
|
+
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
12
|
+
*/
|
|
13
|
+
import { Hono } from 'hono';
|
|
14
|
+
declare const router: Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
|
|
15
|
+
export default router;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2026
|
|
4
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
5
|
+
the terms of the GNU Affero General Public License version 3 as published by
|
|
6
|
+
the Free Software Foundation. This program is distributed in the hope that it
|
|
7
|
+
will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
|
8
|
+
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
9
|
+
See the GNU Affero General Public License for more details.
|
|
10
|
+
You should have received a copy of the GNU Affero General Public
|
|
11
|
+
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
12
|
+
*/
|
|
13
|
+
import { Hono } from 'hono';
|
|
14
|
+
import { isSSGContext } from 'hono/ssg';
|
|
15
|
+
import * as connectorsService from './service.js';
|
|
16
|
+
import { UserRole } from '../../types.js';
|
|
17
|
+
import { requireRole } from '../../middleware/auth.js';
|
|
18
|
+
const router = new Hono();
|
|
19
|
+
/**
|
|
20
|
+
* @openapi
|
|
21
|
+
* /api/connectors:
|
|
22
|
+
* get:
|
|
23
|
+
* summary: Returns all available connectors
|
|
24
|
+
* responses:
|
|
25
|
+
* 200:
|
|
26
|
+
* description: List of connectors with their display names
|
|
27
|
+
*/
|
|
28
|
+
router.get('/', requireRole(UserRole.Reader), async (c) => {
|
|
29
|
+
if (isSSGContext(c)) {
|
|
30
|
+
return c.json([]);
|
|
31
|
+
}
|
|
32
|
+
const commands = c.get('commands');
|
|
33
|
+
const connectors = await connectorsService.getConnectors(commands);
|
|
34
|
+
return c.json(connectors);
|
|
35
|
+
});
|
|
36
|
+
export default router;
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/connectors/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AACF,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,iBAAiB,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,MAAM,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;AAE1B;;;;;;;;GAQG;AACH,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IACxD,IAAI,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;QACpB,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpB,CAAC;IACD,MAAM,QAAQ,GAAG,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACnC,MAAM,UAAU,GAAG,MAAM,iBAAiB,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACnE,OAAO,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AAC5B,CAAC,CAAC,CAAC;AAEH,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2024
|
|
4
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
5
|
+
the terms of the GNU Affero General Public License version 3 as published by
|
|
6
|
+
the Free Software Foundation.
|
|
7
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
8
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
9
|
+
FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
|
10
|
+
details. You should have received a copy of the GNU Affero General Public
|
|
11
|
+
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
12
|
+
*/
|
|
13
|
+
import type { CommandManager } from '@cyberismo/data-handler';
|
|
14
|
+
export interface ExternalItem {
|
|
15
|
+
key: string;
|
|
16
|
+
title: string;
|
|
17
|
+
}
|
|
18
|
+
export interface Connector {
|
|
19
|
+
name: string;
|
|
20
|
+
displayName: string;
|
|
21
|
+
items: ExternalItem[];
|
|
22
|
+
}
|
|
23
|
+
export declare function getConnectors(commands: CommandManager): Promise<Connector[]>;
|