@cyberismo/backend 1.0.0 → 1.1.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/app.js +1 -1
- package/dist/app.js.map +1 -1
- package/dist/auth/keycloak.js +3 -0
- package/dist/auth/keycloak.js.map +1 -1
- package/dist/auth/mock.js +1 -0
- package/dist/auth/mock.js.map +1 -1
- package/dist/common/validationSchemas.d.ts +3 -1
- package/dist/common/validationSchemas.js +1 -0
- package/dist/common/validationSchemas.js.map +1 -1
- package/dist/domain/calculations/index.js +1 -1
- package/dist/domain/calculations/index.js.map +1 -1
- package/dist/domain/cardTypes/service.d.ts +1 -1
- package/dist/domain/cardTypes/service.js +26 -4
- package/dist/domain/cardTypes/service.js.map +1 -1
- package/dist/domain/cards/lib.js +7 -5
- package/dist/domain/cards/lib.js.map +1 -1
- package/dist/domain/cards/service.js +3 -6
- package/dist/domain/cards/service.js.map +1 -1
- package/dist/domain/project/index.js +32 -1
- package/dist/domain/project/index.js.map +1 -1
- package/dist/domain/project/schema.d.ts +9 -0
- package/dist/domain/project/schema.js +18 -0
- package/dist/domain/project/schema.js.map +1 -1
- package/dist/domain/project/service.d.ts +19 -1
- package/dist/domain/project/service.js +43 -0
- package/dist/domain/project/service.js.map +1 -1
- package/dist/domain/resources/index.js +1 -1
- package/dist/domain/resources/index.js.map +1 -1
- package/dist/domain/resources/schema.d.ts +4 -1
- package/dist/domain/resources/schema.js +4 -2
- package/dist/domain/resources/schema.js.map +1 -1
- package/dist/domain/resources/service.d.ts +1 -1
- package/dist/domain/resources/service.js +7 -2
- package/dist/domain/resources/service.js.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/middleware/auth.d.ts +5 -3
- package/dist/middleware/auth.js +7 -4
- package/dist/middleware/auth.js.map +1 -1
- package/dist/middleware/zvalidator.d.ts +1 -1
- package/dist/public/THIRD-PARTY.txt +823 -879
- package/dist/public/assets/abnfDiagram-VRR7QNED-Djr4KJ5E.js +1 -0
- package/dist/public/assets/arc-DrR4k_H-.js +1 -0
- package/dist/public/assets/architecture-TIHT7OUA-XL6N-4o9.js +1 -0
- package/dist/public/assets/architectureDiagram-ZJ3FMSHR-DsMU2Uwa.js +36 -0
- package/dist/public/assets/blockDiagram-677ZJIJ3-DRBmQUQJ.js +132 -0
- package/dist/public/assets/c4Diagram-LMCZKHZV-E0rM02LD.js +10 -0
- package/dist/public/assets/channel-D5fnImJy.js +1 -0
- package/dist/public/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
- package/dist/public/assets/chunk-32BRIVSS-BnDY0aSV.js +1 -0
- package/dist/public/assets/chunk-52WLFC77-N5YugKaZ.js +10 -0
- package/dist/public/assets/chunk-5FCAYU7R-I3_t_Ic_.js +1 -0
- package/dist/public/assets/chunk-5HE753X5-Dxz40rzH.js +1 -0
- package/dist/public/assets/chunk-5JV3BV7I-CNwCKRLH.js +1 -0
- package/dist/public/assets/chunk-5TONJI2A-ezWQ_Z2j.js +2 -0
- package/dist/public/assets/{chunk-FMBD7UC4-Cgl-u-NC.js → chunk-5VM5RSS4-ZNzvKenW.js} +1 -1
- package/dist/public/assets/chunk-7BUUIJ7U-Bb538aSH.js +1 -0
- package/dist/public/assets/chunk-BIQX33UG-DS132-R_.js +1 -0
- package/dist/public/assets/chunk-C7G6YPKG-BN-cNjoj.js +1 -0
- package/dist/public/assets/chunk-CQNSW5MT-D8Mn1I73.js +1 -0
- package/dist/public/assets/chunk-CYSBUYHQ-Dc64Dwdo.js +1 -0
- package/dist/public/assets/chunk-EMLP6XTP-aIK0V8GX.js +1 -0
- package/dist/public/assets/chunk-EX3LRPZG-Db0XYyxy.js +231 -0
- package/dist/public/assets/chunk-FWX5IMBZ-BF_P2-Do.js +2 -0
- package/dist/public/assets/chunk-HOUHSVGY-L35GPy9G.js +1 -0
- package/dist/public/assets/chunk-ICXQ74PX-Bb8zaHde.js +2 -0
- package/dist/public/assets/chunk-JG7HCLWE-BtAXK3iQ.js +2 -0
- package/dist/public/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
- package/dist/public/assets/chunk-KEIR6QF5-DEvma7oi.js +161 -0
- package/dist/public/assets/chunk-MOJQB5TN-D1shKbMs.js +88 -0
- package/dist/public/assets/chunk-MOZMSUNE-5FIqIBsY.js +1 -0
- package/dist/public/assets/chunk-OGEWGWER-BVIFy9xz.js +1 -0
- package/dist/public/assets/chunk-OSBZ3O6U-Cfd7kf1R.js +1 -0
- package/dist/public/assets/chunk-PUDLZKDR-Db3FSNR9.js +156 -0
- package/dist/public/assets/chunk-Q4XR5HBZ-BuKFRUzR.js +70 -0
- package/dist/public/assets/chunk-QBLGF6JB-DUGZXFh-.js +1 -0
- package/dist/public/assets/chunk-R7FJI6CG-D7mUd-qN.js +1 -0
- package/dist/public/assets/chunk-RYQCIY6F-C_3rESBd.js +1 -0
- package/dist/public/assets/chunk-U6XO7XAA-C3UhlwA1.js +2 -0
- package/dist/public/assets/chunk-V7JOEXUC-71b0ABpv.js +206 -0
- package/dist/public/assets/chunk-VAUOI2AC-C-GBw18h.js +1 -0
- package/dist/public/assets/chunk-VR4S4FIN-tUhbELKr.js +1 -0
- package/dist/public/assets/chunk-WYO6CB5R-BQoO62-B.js +127 -0
- package/dist/public/assets/chunk-XXDRQBXY-Co8n4ZHT.js +1 -0
- package/dist/public/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
- package/dist/public/assets/chunk-YOTPTUD7-DhCRKU1A.js +1 -0
- package/dist/public/assets/chunk-ZGVPDNZ5-hpz2Ryq5.js +62 -0
- package/dist/public/assets/chunk-ZIRB5QZD-BpeS1aZ7.js +32 -0
- package/dist/public/assets/classDiagram-OUVF2IWQ-CXdVorPK.js +1 -0
- package/dist/public/assets/classDiagram-v2-EOCWNBFH-CXdVorPK.js +1 -0
- package/dist/public/assets/colors-Cg5Vh3br.js +1 -0
- package/dist/public/assets/cose-bilkent-JH36ORCC-4GoRbloS.js +1 -0
- package/dist/public/assets/cynefin-VYW2F7L2-BPH-25fI.js +1 -0
- package/dist/public/assets/cynefinDiagram-TSTJHNR4-PEf16euv.js +62 -0
- package/dist/public/assets/cytoscape.esm-C3UvhD5t.js +321 -0
- package/dist/public/assets/dagre-Buvkdvvj.js +1 -0
- package/dist/public/assets/dagre-VKFMJZFB-DPsCMBF1.js +4 -0
- package/dist/public/assets/defaultLocale-CNPGWpMu.js +1 -0
- package/dist/public/assets/diagram-FQU43EPY-DS-ryuRg.js +3 -0
- package/dist/public/assets/diagram-G47NLZAW-CzUoYkFf.js +24 -0
- package/dist/public/assets/diagram-NH7WQ7WH-MhGnE2fh.js +24 -0
- package/dist/public/assets/diagram-OA4YK3LP-CsQ9aFR_.js +30 -0
- package/dist/public/assets/diagram-WEI45ONY-Er3q49ew.js +41 -0
- package/dist/public/assets/dist-BzwexiH1.js +1 -0
- package/dist/public/assets/ebnfDiagram-CCIWWBDH-AnJAsk14.js +1 -0
- package/dist/public/assets/erDiagram-Q63AITRT-DulA16my.js +85 -0
- package/dist/public/assets/eventmodeling-45OFAUF4-CoIhTpHU.js +1 -0
- package/dist/public/assets/flowDiagram-23GEKE2U-BGMXUq18.js +1 -0
- package/dist/public/assets/ganttDiagram-NO4QXBWP-DAvCPT7_.js +292 -0
- package/dist/public/assets/gitGraph-TEB2WS4Q-BcPsZts5.js +1 -0
- package/dist/public/assets/gitGraphDiagram-IHSO6WYX-CksvJvsQ.js +106 -0
- package/dist/public/assets/{graphlib-B8gBHxth.js → graphlib-DS17s2tU.js} +1 -1
- package/dist/public/assets/index-H1CkT-JT.js +447 -0
- package/dist/public/assets/info-DKCQHKI2-7VGzrAVB.js +1 -0
- package/dist/public/assets/infoDiagram-FWYZ7A6U-D_by7lSL.js +2 -0
- package/dist/public/assets/init-ZlXS9mIS.js +1 -0
- package/dist/public/assets/{ishikawaDiagram-YF4QCWOH-BMZVbhq1.js → ishikawaDiagram-FXEZZL3T-CiLpASIW.js} +6 -6
- package/dist/public/assets/journeyDiagram-5HDEW3XC-DpvFmk7c.js +139 -0
- package/dist/public/assets/kanban-definition-HUTT4EX6-DYP_x6zD.js +89 -0
- package/dist/public/assets/{katex-Vhh-h91d.js → katex-DolUETbr.js} +3 -3
- package/dist/public/assets/{line-DNZMOnJ3.js → line-C8Sfsgt8.js} +1 -1
- package/dist/public/assets/linear-BWTvbP1l.js +1 -0
- package/dist/public/assets/map-BaFkSB1l.js +1 -0
- package/dist/public/assets/mermaid-parser.core--8614tkK.js +4 -0
- package/dist/public/assets/mindmap-definition-LN4V7U3C-3IAd4gp3.js +96 -0
- package/dist/public/assets/ordinal-BdBDtYTt.js +1 -0
- package/dist/public/assets/packet-7NZHBO7P-KYt33H0C.js +1 -0
- package/dist/public/assets/pegDiagram-2B236MQR-BQNFxYz2.js +1 -0
- package/dist/public/assets/pie-RZYD4A2V-xKz9s9I4.js +1 -0
- package/dist/public/assets/pieDiagram-ENE6RG2P-Cy13tg8_.js +39 -0
- package/dist/public/assets/quadrantDiagram-ABIIQ3AL-B3czMbdS.js +7 -0
- package/dist/public/assets/radar-I7S5WNFK-B4QTX-fX.js +1 -0
- package/dist/public/assets/railroad-3IZDKUUU-Co_9rPVC.js +1 -0
- package/dist/public/assets/railroad-abnf-AHOZXSZD-Bhy_c3ol.js +1 -0
- package/dist/public/assets/railroad-ebnf-EBAXGLYW-B9ENjG34.js +1 -0
- package/dist/public/assets/railroad-peg-LSFZ7HO6-CyJxDBsB.js +1 -0
- package/dist/public/assets/railroadDiagram-RFXS5EU6-M2j5SJF2.js +1 -0
- package/dist/public/assets/range-EplFIxc7.js +1 -0
- package/dist/public/assets/requirementDiagram-TGXJPOKE-CmvJWy_S.js +84 -0
- package/dist/public/assets/{rough.esm-CSKSodPl.js → rough.esm-By172zw-.js} +1 -1
- package/dist/public/assets/sankeyDiagram-HTMAVEWB-tAeOzMTn.js +40 -0
- package/dist/public/assets/sequenceDiagram-DBY2YBRQ-r0pwijM4.js +162 -0
- package/dist/public/assets/sizeCapture-X5ZJPWSS-B0uUizjq.js +1 -0
- package/dist/public/assets/src-DOh7_en_.js +1 -0
- package/dist/public/assets/stateDiagram-2N3HPSRC-a9IdkSQG.js +1 -0
- package/dist/public/assets/stateDiagram-v2-6OUMAXLB-s2blPtZ-.js +1 -0
- package/dist/public/assets/swimlanes-5IMT3BWC-5w0Cdxk6.js +2 -0
- package/dist/public/assets/swimlanesDiagram-G3AALYLV-BWa-KRed.js +8 -0
- package/dist/public/assets/time-BM2d9MsQ.js +1 -0
- package/dist/public/assets/timeline-definition-FHXFAJF6-CvXlv_4Y.js +120 -0
- package/dist/public/assets/treeView-QDETBFTQ-B9cxjfpB.js +1 -0
- package/dist/public/assets/treemap-6X3UGDF4-BplEq4hB.js +1 -0
- package/dist/public/assets/treemap-BfjIY-m6.js +1 -0
- package/dist/public/assets/vennDiagram-L72KCM5P-ti2qNcvo.js +34 -0
- package/dist/public/assets/wardley-OPB4EBWU-BX2ghg5e.js +1 -0
- package/dist/public/assets/wardleyDiagram-EHGQE667-C8lblm8x.js +78 -0
- package/dist/public/assets/xychartDiagram-FW5EYKEG-US-_k5eu.js +7 -0
- package/dist/public/index.html +31 -12
- package/dist/types.d.ts +4 -1
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -1
- package/package.json +11 -11
- package/src/app.ts +1 -1
- package/src/auth/keycloak.ts +3 -0
- package/src/auth/mock.ts +1 -0
- package/src/common/validationSchemas.ts +1 -0
- package/src/domain/calculations/index.ts +1 -1
- package/src/domain/cardTypes/service.ts +26 -21
- package/src/domain/cards/lib.ts +11 -4
- package/src/domain/cards/service.ts +4 -5
- package/src/domain/project/index.ts +54 -0
- package/src/domain/project/schema.ts +21 -0
- package/src/domain/project/service.ts +76 -0
- package/src/domain/resources/index.ts +1 -1
- package/src/domain/resources/schema.ts +4 -2
- package/src/domain/resources/service.ts +5 -4
- package/src/index.ts +3 -4
- package/src/middleware/auth.ts +10 -4
- package/src/types.ts +3 -0
- package/dist/public/assets/architecture-7EHR7CIX-CHU1xuYF.js +0 -1
- package/dist/public/assets/architectureDiagram-3BPJPVTR-BfDrO6_w.js +0 -36
- package/dist/public/assets/blockDiagram-GPEHLZMM-KVU5YZg5.js +0 -132
- package/dist/public/assets/c4Diagram-AAUBKEIU-CKZoRo4y.js +0 -10
- package/dist/public/assets/channel-DylEVeTd.js +0 -1
- package/dist/public/assets/chunk-2J33WTMH-3csjo24p.js +0 -1
- package/dist/public/assets/chunk-3OPIFGDE-BKzRNP07.js +0 -62
- package/dist/public/assets/chunk-4BX2VUAB-ClBqZOcE.js +0 -1
- package/dist/public/assets/chunk-55IACEB6-Bgi2dUOh.js +0 -1
- package/dist/public/assets/chunk-5ZQYHXKU-CECM_AkK.js +0 -2
- package/dist/public/assets/chunk-727SXJPM-xJrElvZJ.js +0 -206
- package/dist/public/assets/chunk-AQP2D5EJ-DlQQ44Ki.js +0 -231
- package/dist/public/assets/chunk-BSJP7CBP-ByoKnyMP.js +0 -1
- package/dist/public/assets/chunk-CSCIHK7Q-DPeQmPB5.js +0 -124
- package/dist/public/assets/chunk-L5ZTLDWV-pkYUefHU.js +0 -1
- package/dist/public/assets/chunk-ND2GUHAM-BbBhIALU.js +0 -1
- package/dist/public/assets/chunk-NNHCCRGN-DlpIbxXb.js +0 -159
- package/dist/public/assets/chunk-NZK2D7GU-Bsg3s0FQ.js +0 -1
- package/dist/public/assets/chunk-O5CBEL6O-CLKEM0Ng.js +0 -70
- package/dist/public/assets/chunk-QZHKN3VN-DYbrfjC5.js +0 -1
- package/dist/public/assets/classDiagram-4FO5ZUOK-Dw2NhQGr.js +0 -1
- package/dist/public/assets/classDiagram-v2-Q7XG4LA2-Dw2NhQGr.js +0 -1
- package/dist/public/assets/cose-bilkent-S5V4N54A-BW2eHW0s.js +0 -1
- package/dist/public/assets/cytoscape.esm-FqbQrHcz.js +0 -321
- package/dist/public/assets/dagre-BM42HDAG-BWzuCoWz.js +0 -4
- package/dist/public/assets/dagre-Bx709z4p.js +0 -1
- package/dist/public/assets/diagram-2AECGRRQ-BO4dhTfd.js +0 -43
- package/dist/public/assets/diagram-5GNKFQAL-v25ju5Ui.js +0 -10
- package/dist/public/assets/diagram-KO2AKTUF-C-khQZwA.js +0 -3
- package/dist/public/assets/diagram-LMA3HP47-D7SSAeUZ.js +0 -24
- package/dist/public/assets/diagram-OG6HWLK6-D2CeL9Qd.js +0 -24
- package/dist/public/assets/dist-Dek0Yhn0.js +0 -1
- package/dist/public/assets/erDiagram-TEJ5UH35-CsShdaJw.js +0 -85
- package/dist/public/assets/eventmodeling-FCH6USID-C_5XBe82.js +0 -1
- package/dist/public/assets/flowDiagram-I6XJVG4X-BSiUVjsY.js +0 -162
- package/dist/public/assets/ganttDiagram-6RSMTGT7-BumhHDWI.js +0 -292
- package/dist/public/assets/gitGraph-WXDBUCRP-D4dBNuhe.js +0 -1
- package/dist/public/assets/gitGraphDiagram-PVQCEYII-BPrVPTyG.js +0 -106
- package/dist/public/assets/index-WMbgvnqh.js +0 -487
- package/dist/public/assets/info-J43DQDTF-D7lvZ6o6.js +0 -1
- package/dist/public/assets/infoDiagram-5YYISTIA-CEASd4Im.js +0 -2
- package/dist/public/assets/journeyDiagram-JHISSGLW-B3iswT_x.js +0 -139
- package/dist/public/assets/kanban-definition-UN3LZRKU-xX5kT_P-.js +0 -89
- package/dist/public/assets/mermaid-parser.core-DFZGVidJ.js +0 -4
- package/dist/public/assets/mindmap-definition-RKZ34NQL-C77038Zx.js +0 -96
- package/dist/public/assets/packet-YPE3B663-AbbU2Ze4.js +0 -1
- package/dist/public/assets/pie-LRSECV5Y-DN4QBmSF.js +0 -1
- package/dist/public/assets/pieDiagram-4H26LBE5-C1GhVY4H.js +0 -30
- package/dist/public/assets/quadrantDiagram-W4KKPZXB-3v--YO6t.js +0 -7
- package/dist/public/assets/radar-GUYGQ44K-ej308gGR.js +0 -1
- package/dist/public/assets/requirementDiagram-4Y6WPE33-Bcj6wwJW.js +0 -84
- package/dist/public/assets/sankeyDiagram-5OEKKPKP-BHDSc0nY.js +0 -40
- package/dist/public/assets/sequenceDiagram-3UESZ5HK-B7Huaheu.js +0 -162
- package/dist/public/assets/src-CqxF9LGw.js +0 -1
- package/dist/public/assets/stateDiagram-AJRCARHV-C1l1yZDH.js +0 -1
- package/dist/public/assets/stateDiagram-v2-BHNVJYJU-DQC9x5mr.js +0 -1
- package/dist/public/assets/timeline-definition-PNZ67QCA-CwBz01Qw.js +0 -120
- package/dist/public/assets/treeView-BLDUP644--ooV0k8a.js +0 -1
- package/dist/public/assets/treemap-LRROVOQU-BKq-VDOX.js +0 -1
- package/dist/public/assets/vennDiagram-CIIHVFJN-DpiZAjsM.js +0 -34
- package/dist/public/assets/wardley-L42UT6IY-VU5ormp0.js +0 -1
- package/dist/public/assets/wardleyDiagram-YWT4CUSO-COVxB67h.js +0 -78
- package/dist/public/assets/xychartDiagram-2RQKCTM6-C7lnc5PN.js +0 -7
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import type
|
|
14
|
+
import { resourceName, type CommandManager } from '@cyberismo/data-handler';
|
|
15
15
|
import type { VisibilityGroup, FieldVisibilityBody } from './schema.js';
|
|
16
16
|
|
|
17
17
|
export async function getCardTypes(commands: CommandManager) {
|
|
@@ -53,6 +53,7 @@ export async function updateFieldVisibility(
|
|
|
53
53
|
body: FieldVisibilityBody,
|
|
54
54
|
): Promise<void> {
|
|
55
55
|
const { fieldName, group: targetGroup, index: targetIndex } = body;
|
|
56
|
+
const target = resourceName(cardTypeName);
|
|
56
57
|
|
|
57
58
|
await commands.atomic(async () => {
|
|
58
59
|
// Read is now inside the write lock
|
|
@@ -87,38 +88,42 @@ export async function updateFieldVisibility(
|
|
|
87
88
|
// If same group, just handle reordering
|
|
88
89
|
if (currentGroup === targetGroup) {
|
|
89
90
|
if (targetGroup !== 'hidden' && targetIndex !== undefined) {
|
|
90
|
-
await commands.updateCmd.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
await commands.updateCmd.apply({
|
|
92
|
+
kind: 'edit',
|
|
93
|
+
target,
|
|
94
|
+
updateKey: { key: groupToKey[targetGroup] },
|
|
95
|
+
operation: { name: 'rank', target: fieldName, newIndex: targetIndex },
|
|
96
|
+
});
|
|
95
97
|
}
|
|
96
98
|
return;
|
|
97
99
|
}
|
|
98
100
|
|
|
99
101
|
// Remove from current group (if not hidden)
|
|
100
102
|
if (currentGroup !== 'hidden') {
|
|
101
|
-
await commands.updateCmd.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
await commands.updateCmd.apply({
|
|
104
|
+
kind: 'edit',
|
|
105
|
+
target,
|
|
106
|
+
updateKey: { key: groupToKey[currentGroup] },
|
|
107
|
+
operation: { name: 'remove', target: fieldName },
|
|
108
|
+
});
|
|
106
109
|
}
|
|
107
110
|
|
|
108
111
|
// Add to new group (if not hidden)
|
|
109
112
|
if (targetGroup !== 'hidden') {
|
|
110
|
-
await commands.updateCmd.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
await commands.updateCmd.apply({
|
|
114
|
+
kind: 'edit',
|
|
115
|
+
target,
|
|
116
|
+
updateKey: { key: groupToKey[targetGroup] },
|
|
117
|
+
operation: { name: 'add', target: fieldName },
|
|
118
|
+
});
|
|
115
119
|
|
|
116
120
|
if (targetIndex !== undefined) {
|
|
117
|
-
await commands.updateCmd.
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
121
|
+
await commands.updateCmd.apply({
|
|
122
|
+
kind: 'edit',
|
|
123
|
+
target,
|
|
124
|
+
updateKey: { key: groupToKey[targetGroup] },
|
|
125
|
+
operation: { name: 'rank', target: fieldName, newIndex: targetIndex },
|
|
126
|
+
});
|
|
122
127
|
}
|
|
123
128
|
}
|
|
124
129
|
}, `Update field visibility for ${cardTypeName}`);
|
package/src/domain/cards/lib.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import
|
|
14
|
+
import { convert } from '@asciidoctor/core';
|
|
15
15
|
import type { Card } from '@cyberismo/data-handler/interfaces/project-interfaces';
|
|
16
16
|
import { type CommandManager, evaluateMacros } from '@cyberismo/data-handler';
|
|
17
17
|
import { preprocessMermaidBlocksForHtml } from '@cyberismo/data-handler/utils/mermaid-renderer';
|
|
@@ -71,15 +71,15 @@ export async function getCardDetails(
|
|
|
71
71
|
);
|
|
72
72
|
|
|
73
73
|
const projectPrefix = commands.project.projectPrefix;
|
|
74
|
-
const htmlContent =
|
|
75
|
-
|
|
74
|
+
const htmlContent = (
|
|
75
|
+
await convert(asciidocContent, {
|
|
76
76
|
safe: 'safe',
|
|
77
77
|
attributes: {
|
|
78
78
|
imagesdir: `/api/projects/${projectPrefix}/cards/${key}/a`,
|
|
79
79
|
icons: 'font',
|
|
80
80
|
},
|
|
81
81
|
})
|
|
82
|
-
|
|
82
|
+
).toString();
|
|
83
83
|
|
|
84
84
|
if (raw) {
|
|
85
85
|
if (!cardDetailsResponse.metadata) {
|
|
@@ -105,6 +105,13 @@ export async function getCardDetails(
|
|
|
105
105
|
fieldDescription: fieldType.description,
|
|
106
106
|
dataType: fieldType.dataType,
|
|
107
107
|
isCalculated: customField.isCalculated,
|
|
108
|
+
isOverridable: !!(
|
|
109
|
+
customField.isCalculated && customField.enableOverride
|
|
110
|
+
),
|
|
111
|
+
overrideValue:
|
|
112
|
+
customField.isCalculated && customField.enableOverride
|
|
113
|
+
? cardDetailsResponse.metadata[customField.name]
|
|
114
|
+
: undefined,
|
|
108
115
|
value: cardDetailsResponse.metadata[customField.name],
|
|
109
116
|
enumValues: fieldType.enumValues ?? [],
|
|
110
117
|
});
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import
|
|
14
|
+
import { convert } from '@asciidoctor/core';
|
|
15
15
|
import type {
|
|
16
16
|
ExportPdfOptions,
|
|
17
17
|
MetadataContent,
|
|
@@ -181,17 +181,16 @@ export async function parseContent(
|
|
|
181
181
|
'inject',
|
|
182
182
|
);
|
|
183
183
|
|
|
184
|
-
const processor = Processor();
|
|
185
184
|
const projectPrefix = commands.project.projectPrefix;
|
|
186
|
-
const parsedContent =
|
|
187
|
-
|
|
185
|
+
const parsedContent = (
|
|
186
|
+
await convert(asciidocContent, {
|
|
188
187
|
safe: 'safe',
|
|
189
188
|
attributes: {
|
|
190
189
|
imagesdir: `/api/projects/${projectPrefix}/cards/${key}/a`,
|
|
191
190
|
icons: 'font',
|
|
192
191
|
},
|
|
193
192
|
})
|
|
194
|
-
|
|
193
|
+
).toString();
|
|
195
194
|
|
|
196
195
|
return { parsedContent };
|
|
197
196
|
});
|
|
@@ -14,8 +14,11 @@
|
|
|
14
14
|
import { Hono } from 'hono';
|
|
15
15
|
import { zValidator } from '../../middleware/zvalidator.js';
|
|
16
16
|
import {
|
|
17
|
+
addHubSchema,
|
|
18
|
+
cleanSchema,
|
|
17
19
|
importModuleSchema,
|
|
18
20
|
moduleParamSchema,
|
|
21
|
+
removeHubSchema,
|
|
19
22
|
updateProjectSchema,
|
|
20
23
|
} from './schema.js';
|
|
21
24
|
import * as projectService from './service.js';
|
|
@@ -92,4 +95,55 @@ router.delete(
|
|
|
92
95
|
},
|
|
93
96
|
);
|
|
94
97
|
|
|
98
|
+
router.get('/hubs', requireRole(UserRole.Reader), async (c) => {
|
|
99
|
+
const commands = c.get('commands');
|
|
100
|
+
const hubs = await projectService.getHubs(commands);
|
|
101
|
+
return c.json(hubs);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
router.post(
|
|
105
|
+
'/hubs',
|
|
106
|
+
requireRole(UserRole.Admin),
|
|
107
|
+
zValidator('json', addHubSchema),
|
|
108
|
+
async (c) => {
|
|
109
|
+
const commands = c.get('commands');
|
|
110
|
+
const { location } = c.req.valid('json');
|
|
111
|
+
const unreachable = await projectService.addHub(commands, location);
|
|
112
|
+
return c.json({ message: 'Hub added', unreachable });
|
|
113
|
+
},
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
router.delete(
|
|
117
|
+
'/hubs',
|
|
118
|
+
requireRole(UserRole.Admin),
|
|
119
|
+
zValidator('query', removeHubSchema),
|
|
120
|
+
async (c) => {
|
|
121
|
+
const commands = c.get('commands');
|
|
122
|
+
const { location } = c.req.valid('query');
|
|
123
|
+
await projectService.removeHub(commands, location);
|
|
124
|
+
return c.json({ message: 'Hub removed' });
|
|
125
|
+
},
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
router.post('/hubs/fetch', requireRole(UserRole.Admin), async (c) => {
|
|
129
|
+
const commands = c.get('commands');
|
|
130
|
+
const unreachable = await projectService.fetchHubs(commands);
|
|
131
|
+
return c.json({ message: 'Hubs fetched', unreachable });
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
// A non-empty 'failedCards' in the response is a partial success, not an error:
|
|
135
|
+
// the command collects per-card failures instead of throwing, so the report of
|
|
136
|
+
// what was and was not removed is returned with 200.
|
|
137
|
+
router.post(
|
|
138
|
+
'/clean',
|
|
139
|
+
requireRole(UserRole.Admin),
|
|
140
|
+
zValidator('json', cleanSchema),
|
|
141
|
+
async (c) => {
|
|
142
|
+
const commands = c.get('commands');
|
|
143
|
+
const { dryRun } = c.req.valid('json');
|
|
144
|
+
const result = await projectService.cleanProject(commands, dryRun);
|
|
145
|
+
return c.json(result);
|
|
146
|
+
},
|
|
147
|
+
);
|
|
148
|
+
|
|
95
149
|
export default router;
|
|
@@ -30,6 +30,27 @@ export const updateProjectSchema = z.object({
|
|
|
30
30
|
.optional(),
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
+
export const addHubSchema = z.object({
|
|
34
|
+
location: z.url({
|
|
35
|
+
protocol: /^https?$/,
|
|
36
|
+
error: 'Hub location must be a valid HTTP or HTTPS URL',
|
|
37
|
+
}),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// Removal accepts any stored location: configurations written before locations
|
|
41
|
+
// were validated may hold entries this schema would otherwise refuse, and those
|
|
42
|
+
// have to stay removable.
|
|
43
|
+
export const removeHubSchema = z.object({
|
|
44
|
+
location: z.string().min(1),
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// 'dryRun' is required so that a request whose body did not arrive fails with
|
|
48
|
+
// 400 instead of defaulting into the destructive real clean. The command's
|
|
49
|
+
// 'cardType' narrowing is deliberately not exposed yet.
|
|
50
|
+
export const cleanSchema = z.object({
|
|
51
|
+
dryRun: z.boolean(),
|
|
52
|
+
});
|
|
53
|
+
|
|
33
54
|
export const importModuleSchema = z.object({
|
|
34
55
|
source: z
|
|
35
56
|
.string()
|
|
@@ -12,10 +12,14 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import {
|
|
15
|
+
type CleanResult,
|
|
15
16
|
type CommandManager,
|
|
17
|
+
type HubFetchFailure,
|
|
16
18
|
type ModuleSettingFromHub,
|
|
17
19
|
} from '@cyberismo/data-handler';
|
|
18
20
|
|
|
21
|
+
export type { CleanResult } from '@cyberismo/data-handler';
|
|
22
|
+
|
|
19
23
|
export interface ProjectModule {
|
|
20
24
|
name: string;
|
|
21
25
|
cardKeyPrefix: string;
|
|
@@ -38,6 +42,20 @@ export interface ProjectUpdatePayload {
|
|
|
38
42
|
gitRemoteUrl?: string;
|
|
39
43
|
}
|
|
40
44
|
|
|
45
|
+
export interface HubModuleInfo {
|
|
46
|
+
name: string;
|
|
47
|
+
displayName?: string;
|
|
48
|
+
location: string;
|
|
49
|
+
imported: boolean;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface HubInfo {
|
|
53
|
+
location: string;
|
|
54
|
+
displayName?: string;
|
|
55
|
+
description?: string;
|
|
56
|
+
modules: HubModuleInfo[];
|
|
57
|
+
}
|
|
58
|
+
|
|
41
59
|
async function toModuleInfo(
|
|
42
60
|
commands: CommandManager,
|
|
43
61
|
moduleName: string,
|
|
@@ -119,9 +137,21 @@ export async function deleteModule(commands: CommandManager, module: string) {
|
|
|
119
137
|
await commands.removeCmd.remove('module', module);
|
|
120
138
|
}
|
|
121
139
|
|
|
140
|
+
// Hub data is only refreshed on demand, so a project that has never fetched
|
|
141
|
+
// would otherwise show an empty catalogue until the user asks for a refresh.
|
|
142
|
+
async function populateHubCache(commands: CommandManager) {
|
|
143
|
+
try {
|
|
144
|
+
await commands.fetchCmd.ensureModuleListExists();
|
|
145
|
+
} catch (error) {
|
|
146
|
+
// An unreachable hub must not fail listing the hubs we already know about.
|
|
147
|
+
console.warn('Failed to populate the hub cache', error);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
122
151
|
export async function getImportableModules(
|
|
123
152
|
commands: CommandManager,
|
|
124
153
|
): Promise<ModuleSettingFromHub[]> {
|
|
154
|
+
await populateHubCache(commands);
|
|
125
155
|
return commands.showCmd.showImportableModules(false, true);
|
|
126
156
|
}
|
|
127
157
|
|
|
@@ -131,3 +161,49 @@ export async function importModule(
|
|
|
131
161
|
): Promise<void> {
|
|
132
162
|
await commands.importCmd.importModule(source);
|
|
133
163
|
}
|
|
164
|
+
|
|
165
|
+
export async function getHubs(commands: CommandManager): Promise<HubInfo[]> {
|
|
166
|
+
await populateHubCache(commands);
|
|
167
|
+
const hubs = await commands.showCmd.showHubDetails();
|
|
168
|
+
const importedModules = new Set(
|
|
169
|
+
(await commands.showCmd.showModules()).map((mod) => mod.name),
|
|
170
|
+
);
|
|
171
|
+
return hubs.map((hub) => ({
|
|
172
|
+
location: hub.location,
|
|
173
|
+
displayName: hub.displayName,
|
|
174
|
+
description: hub.description,
|
|
175
|
+
modules: hub.modules.map((mod) => ({
|
|
176
|
+
name: mod.name,
|
|
177
|
+
displayName: mod.displayName,
|
|
178
|
+
location: mod.location,
|
|
179
|
+
imported: importedModules.has(mod.name),
|
|
180
|
+
})),
|
|
181
|
+
}));
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export async function addHub(
|
|
185
|
+
commands: CommandManager,
|
|
186
|
+
location: string,
|
|
187
|
+
): Promise<HubFetchFailure[]> {
|
|
188
|
+
await commands.createCmd.addHubLocation(location);
|
|
189
|
+
// The hub is configured even when it cannot be reached right now; its
|
|
190
|
+
// modules appear once a later refresh succeeds.
|
|
191
|
+
return commands.fetchCmd.fetchHubs(true);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export async function removeHub(commands: CommandManager, location: string) {
|
|
195
|
+
await commands.removeCmd.remove('hub', location);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export async function fetchHubs(
|
|
199
|
+
commands: CommandManager,
|
|
200
|
+
): Promise<HubFetchFailure[]> {
|
|
201
|
+
return commands.fetchCmd.fetchHubs(true);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export async function cleanProject(
|
|
205
|
+
commands: CommandManager,
|
|
206
|
+
dryRun: boolean,
|
|
207
|
+
): Promise<CleanResult> {
|
|
208
|
+
return commands.cleanCmd.clean(dryRun);
|
|
209
|
+
}
|
|
@@ -213,7 +213,7 @@ router.get(
|
|
|
213
213
|
|
|
214
214
|
router.post(
|
|
215
215
|
'/:prefix/:type/:identifier/operation',
|
|
216
|
-
requireRole(UserRole.Admin),
|
|
216
|
+
requireRole(UserRole.Admin, [UserRole.Connector]),
|
|
217
217
|
zValidator('param', resourceParamsSchema),
|
|
218
218
|
zValidator('json', updateOperationBodySchema),
|
|
219
219
|
async (c) => {
|
|
@@ -25,7 +25,7 @@ export const resourceFileParamsSchema = resourceParamsSchema.extend({
|
|
|
25
25
|
export type ResourceFileParams = z.infer<typeof resourceFileParamsSchema>;
|
|
26
26
|
|
|
27
27
|
export const validateResourceParamsSchema = resourceParamsSchema.extend({
|
|
28
|
-
type: z.enum(resourceTypes
|
|
28
|
+
type: z.enum(resourceTypes),
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
export type ValidateResourceParams = z.infer<
|
|
@@ -54,7 +54,9 @@ export const updateOperationBodySchema = z.object({
|
|
|
54
54
|
}),
|
|
55
55
|
z.object({
|
|
56
56
|
name: z.literal('change'),
|
|
57
|
-
|
|
57
|
+
// The old value; scalar changes have none, and clients drop the key
|
|
58
|
+
// entirely when it is undefined (JSON.stringify omits undefined).
|
|
59
|
+
target: z.unknown().optional(),
|
|
58
60
|
to: z.unknown(),
|
|
59
61
|
mappingTable: z
|
|
60
62
|
.object({
|
|
@@ -532,7 +532,7 @@ export async function getWorkflowGraph(
|
|
|
532
532
|
|
|
533
533
|
/**
|
|
534
534
|
* Perform an updateOperation on a resource key.
|
|
535
|
-
* This delegates to data-handler
|
|
535
|
+
* This delegates to the data-handler mutation engine.
|
|
536
536
|
*/
|
|
537
537
|
export async function updateResourceWithOperation(
|
|
538
538
|
commands: CommandManager,
|
|
@@ -542,11 +542,12 @@ export async function updateResourceWithOperation(
|
|
|
542
542
|
const { updateKey, operation } = body;
|
|
543
543
|
await commands.atomic(
|
|
544
544
|
() =>
|
|
545
|
-
commands.updateCmd.
|
|
546
|
-
|
|
545
|
+
commands.updateCmd.apply({
|
|
546
|
+
kind: 'edit',
|
|
547
|
+
target: resource,
|
|
547
548
|
updateKey,
|
|
548
549
|
operation,
|
|
549
|
-
),
|
|
550
|
+
}),
|
|
550
551
|
`Update ${resource.type} ${resource.identifier}`,
|
|
551
552
|
);
|
|
552
553
|
}
|
package/src/index.ts
CHANGED
|
@@ -37,13 +37,12 @@ const DEFAULT_MAX_PORT = DEFAULT_PORT + 100;
|
|
|
37
37
|
export async function previewSite(dir: string, findPort: boolean = true) {
|
|
38
38
|
const app = new Hono();
|
|
39
39
|
app.use(serveStatic({ root: dir }));
|
|
40
|
-
app.get('*', (c) => {
|
|
40
|
+
app.get('*', async (c) => {
|
|
41
41
|
if (c.req.path.startsWith('/api/')) {
|
|
42
42
|
return c.json({ error: 'Resource not found' }, 404);
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
);
|
|
44
|
+
const file = await readFile(path.join(dir, 'index.html'));
|
|
45
|
+
return c.html(file.toString());
|
|
47
46
|
});
|
|
48
47
|
|
|
49
48
|
let port = parseInt(process.env.PORT || DEFAULT_PORT.toString(), 10);
|
package/src/middleware/auth.ts
CHANGED
|
@@ -24,6 +24,7 @@ declare module 'hono' {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
const roleLevel: Record<UserRole, number> = {
|
|
27
|
+
[UserRole.Connector]: -1,
|
|
27
28
|
[UserRole.Reader]: 0,
|
|
28
29
|
[UserRole.Editor]: 1,
|
|
29
30
|
[UserRole.Admin]: 2,
|
|
@@ -72,10 +73,15 @@ export function hasRole(c: Context, minimumRole: UserRole): boolean {
|
|
|
72
73
|
}
|
|
73
74
|
|
|
74
75
|
/**
|
|
75
|
-
* Require minimum role middleware factory
|
|
76
|
-
*
|
|
76
|
+
* Require minimum role middleware factory.
|
|
77
|
+
* Optional exactRoles allows orthogonal roles (e.g. Connector) that bypass
|
|
78
|
+
* the hierarchy with an exact match.
|
|
79
|
+
* e.g. requireRole(Admin, [Connector]) → Admin ✓, Editor ✗, Connector ✓
|
|
77
80
|
*/
|
|
78
|
-
export function requireRole(
|
|
81
|
+
export function requireRole(
|
|
82
|
+
minimumRole: UserRole,
|
|
83
|
+
exactRoles?: UserRole[],
|
|
84
|
+
): MiddlewareHandler {
|
|
79
85
|
return async (c, next) => {
|
|
80
86
|
const user = c.get('user');
|
|
81
87
|
|
|
@@ -83,7 +89,7 @@ export function requireRole(minimumRole: UserRole): MiddlewareHandler {
|
|
|
83
89
|
return c.json({ error: 'Unauthorized' }, 401);
|
|
84
90
|
}
|
|
85
91
|
|
|
86
|
-
if (!hasRole(c, minimumRole)) {
|
|
92
|
+
if (!hasRole(c, minimumRole) && !exactRoles?.includes(user.role)) {
|
|
87
93
|
return c.json({ error: 'Forbidden' }, 403);
|
|
88
94
|
}
|
|
89
95
|
|
package/src/types.ts
CHANGED
|
@@ -32,11 +32,14 @@ export interface TreeOptions {
|
|
|
32
32
|
* - Admin: All operations including configuration
|
|
33
33
|
* - Editor: Can create, edit, and manage content but not config
|
|
34
34
|
* - Reader: Can only view content
|
|
35
|
+
* Orthogonal role (outside hierarchy):
|
|
36
|
+
* - Connector: Service accounts that can only create/update calculations
|
|
35
37
|
*/
|
|
36
38
|
export enum UserRole {
|
|
37
39
|
Admin = 'admin',
|
|
38
40
|
Editor = 'editor',
|
|
39
41
|
Reader = 'reader',
|
|
42
|
+
Connector = 'connector',
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
/**
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./chunk-NNHCCRGN-DlpIbxXb.js";import{x as e}from"./mermaid-parser.core-DFZGVidJ.js";export{e as createArchitectureServices};
|