@cyberismo/backend 1.1.2 → 1.3.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 +21 -0
- package/dist/app.d.ts +5 -15
- package/dist/app.js +46 -44
- package/dist/app.js.map +1 -1
- package/dist/auth/index.d.ts +1 -13
- package/dist/auth/index.js +3 -13
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/keycloak.d.ts +2 -15
- package/dist/auth/keycloak.js +8 -12
- package/dist/auth/keycloak.js.map +1 -1
- package/dist/auth/mock.d.ts +12 -20
- package/dist/auth/mock.js +121 -43
- package/dist/auth/mock.js.map +1 -1
- package/dist/auth/types.d.ts +7 -13
- package/dist/auth/types.js +2 -12
- package/dist/auth/types.js.map +1 -1
- package/dist/common/errors.d.ts +12 -0
- package/dist/common/errors.js +31 -0
- package/dist/common/errors.js.map +1 -0
- package/dist/common/validationSchemas.d.ts +0 -12
- package/dist/common/validationSchemas.js +2 -12
- package/dist/common/validationSchemas.js.map +1 -1
- package/dist/domain/auth/index.d.ts +0 -12
- package/dist/domain/auth/index.js +2 -12
- package/dist/domain/auth/index.js.map +1 -1
- package/dist/domain/calculations/index.d.ts +0 -12
- package/dist/domain/calculations/index.js +4 -14
- package/dist/domain/calculations/index.js.map +1 -1
- package/dist/domain/calculations/schema.d.ts +0 -12
- package/dist/domain/calculations/schema.js +2 -12
- package/dist/domain/calculations/schema.js.map +1 -1
- package/dist/domain/calculations/service.d.ts +2 -14
- package/dist/domain/calculations/service.js +7 -17
- package/dist/domain/calculations/service.js.map +1 -1
- package/dist/domain/cardTypes/index.d.ts +0 -12
- package/dist/domain/cardTypes/index.js +10 -20
- package/dist/domain/cardTypes/index.js.map +1 -1
- package/dist/domain/cardTypes/schema.d.ts +0 -12
- package/dist/domain/cardTypes/schema.js +2 -12
- package/dist/domain/cardTypes/schema.js.map +1 -1
- package/dist/domain/cardTypes/service.d.ts +4 -16
- package/dist/domain/cardTypes/service.js +17 -25
- package/dist/domain/cardTypes/service.js.map +1 -1
- package/dist/domain/cards/index.d.ts +0 -12
- package/dist/domain/cards/index.js +120 -175
- package/dist/domain/cards/index.js.map +1 -1
- package/dist/domain/cards/lib.d.ts +6 -23
- package/dist/domain/cards/lib.js +7 -135
- package/dist/domain/cards/lib.js.map +1 -1
- package/dist/domain/cards/mermaid.d.ts +8 -0
- package/dist/domain/cards/mermaid.js +23 -0
- package/dist/domain/cards/mermaid.js.map +1 -0
- package/dist/domain/cards/schema.d.ts +6 -12
- package/dist/domain/cards/schema.js +15 -15
- package/dist/domain/cards/schema.js.map +1 -1
- package/dist/domain/cards/service.d.ts +29 -36
- package/dist/domain/cards/service.js +119 -90
- package/dist/domain/cards/service.js.map +1 -1
- package/dist/domain/connectors/index.d.ts +0 -12
- package/dist/domain/connectors/index.js +4 -14
- package/dist/domain/connectors/index.js.map +1 -1
- package/dist/domain/connectors/service.d.ts +2 -14
- package/dist/domain/connectors/service.js +4 -14
- package/dist/domain/connectors/service.js.map +1 -1
- package/dist/domain/events/events-by-project.d.ts +19 -0
- package/dist/domain/events/events-by-project.js +57 -0
- package/dist/domain/events/events-by-project.js.map +1 -0
- package/dist/domain/events/index.d.ts +3 -0
- package/dist/domain/events/index.js +84 -0
- package/dist/domain/events/index.js.map +1 -0
- package/dist/domain/events/lifetime.d.ts +2 -0
- package/dist/domain/events/lifetime.js +15 -0
- package/dist/domain/events/lifetime.js.map +1 -0
- package/dist/domain/events/project-events.d.ts +63 -0
- package/dist/domain/events/project-events.js +204 -0
- package/dist/domain/events/project-events.js.map +1 -0
- package/dist/domain/events/schema.d.ts +10 -0
- package/dist/domain/events/schema.js +10 -0
- package/dist/domain/events/schema.js.map +1 -0
- package/dist/domain/fieldTypes/index.d.ts +0 -12
- package/dist/domain/fieldTypes/index.js +6 -16
- package/dist/domain/fieldTypes/index.js.map +1 -1
- package/dist/domain/fieldTypes/schema.d.ts +0 -12
- package/dist/domain/fieldTypes/schema.js +2 -12
- package/dist/domain/fieldTypes/schema.js.map +1 -1
- package/dist/domain/fieldTypes/service.d.ts +4 -16
- package/dist/domain/fieldTypes/service.js +7 -17
- package/dist/domain/fieldTypes/service.js.map +1 -1
- package/dist/domain/graphModels/index.d.ts +0 -12
- package/dist/domain/graphModels/index.js +4 -14
- package/dist/domain/graphModels/index.js.map +1 -1
- package/dist/domain/graphModels/schema.d.ts +0 -12
- package/dist/domain/graphModels/schema.js +2 -12
- package/dist/domain/graphModels/schema.js.map +1 -1
- package/dist/domain/graphModels/service.d.ts +2 -14
- package/dist/domain/graphModels/service.js +4 -14
- package/dist/domain/graphModels/service.js.map +1 -1
- package/dist/domain/graphViews/index.d.ts +0 -12
- package/dist/domain/graphViews/index.js +4 -14
- package/dist/domain/graphViews/index.js.map +1 -1
- package/dist/domain/graphViews/schema.js +2 -0
- package/dist/domain/graphViews/schema.js.map +1 -1
- package/dist/domain/graphViews/service.d.ts +2 -14
- package/dist/domain/graphViews/service.js +4 -14
- package/dist/domain/graphViews/service.js.map +1 -1
- package/dist/domain/labels/index.d.ts +0 -12
- package/dist/domain/labels/index.js +4 -14
- package/dist/domain/labels/index.js.map +1 -1
- package/dist/domain/labels/service.d.ts +3 -15
- package/dist/domain/labels/service.js +5 -15
- package/dist/domain/labels/service.js.map +1 -1
- package/dist/domain/linkTypes/index.d.ts +0 -12
- package/dist/domain/linkTypes/index.js +6 -16
- package/dist/domain/linkTypes/index.js.map +1 -1
- package/dist/domain/linkTypes/schema.d.ts +0 -12
- package/dist/domain/linkTypes/schema.js +2 -12
- package/dist/domain/linkTypes/schema.js.map +1 -1
- package/dist/domain/linkTypes/service.d.ts +3 -15
- package/dist/domain/linkTypes/service.js +7 -17
- package/dist/domain/linkTypes/service.js.map +1 -1
- package/dist/domain/logicPrograms/index.d.ts +0 -12
- package/dist/domain/logicPrograms/index.js +4 -14
- package/dist/domain/logicPrograms/index.js.map +1 -1
- package/dist/domain/logicPrograms/service.d.ts +2 -14
- package/dist/domain/logicPrograms/service.js +5 -3
- package/dist/domain/logicPrograms/service.js.map +1 -1
- package/dist/domain/mcp/index.d.ts +3 -15
- package/dist/domain/mcp/index.js +27 -21
- package/dist/domain/mcp/index.js.map +1 -1
- package/dist/domain/project/index.d.ts +0 -12
- package/dist/domain/project/index.js +41 -39
- package/dist/domain/project/index.js.map +1 -1
- package/dist/domain/project/schema.d.ts +8 -12
- package/dist/domain/project/schema.js +36 -18
- package/dist/domain/project/schema.js.map +1 -1
- package/dist/domain/project/service.d.ts +20 -28
- package/dist/domain/project/service.js +56 -60
- package/dist/domain/project/service.js.map +1 -1
- package/dist/domain/projects/index.d.ts +2 -14
- package/dist/domain/projects/index.js +23 -36
- package/dist/domain/projects/index.js.map +1 -1
- package/dist/domain/projects/schema.d.ts +1 -12
- package/dist/domain/projects/schema.js +3 -12
- package/dist/domain/projects/schema.js.map +1 -1
- package/dist/domain/projects/service.d.ts +9 -35
- package/dist/domain/projects/service.js +12 -48
- package/dist/domain/projects/service.js.map +1 -1
- package/dist/domain/reports/index.d.ts +0 -12
- package/dist/domain/reports/index.js +4 -14
- package/dist/domain/reports/index.js.map +1 -1
- package/dist/domain/reports/schema.d.ts +0 -12
- package/dist/domain/reports/schema.js +2 -12
- package/dist/domain/reports/schema.js.map +1 -1
- package/dist/domain/reports/service.d.ts +2 -14
- package/dist/domain/reports/service.js +4 -14
- package/dist/domain/reports/service.js.map +1 -1
- package/dist/domain/resources/index.d.ts +0 -12
- package/dist/domain/resources/index.js +91 -26
- package/dist/domain/resources/index.js.map +1 -1
- package/dist/domain/resources/schema.d.ts +8 -2
- package/dist/domain/resources/schema.js +8 -1
- package/dist/domain/resources/schema.js.map +1 -1
- package/dist/domain/resources/service.d.ts +23 -23
- package/dist/domain/resources/service.js +83 -51
- package/dist/domain/resources/service.js.map +1 -1
- package/dist/domain/skills/index.d.ts +3 -0
- package/dist/domain/skills/index.js +42 -0
- package/dist/domain/skills/index.js.map +1 -0
- package/dist/domain/skills/schema.d.ts +4 -0
- package/dist/domain/skills/schema.js +8 -0
- package/dist/domain/skills/schema.js.map +1 -0
- package/dist/domain/skills/service.d.ts +2 -0
- package/dist/domain/skills/service.js +6 -0
- package/dist/domain/skills/service.js.map +1 -0
- package/dist/domain/templates/index.d.ts +0 -12
- package/dist/domain/templates/index.js +8 -18
- package/dist/domain/templates/index.js.map +1 -1
- package/dist/domain/templates/schema.d.ts +0 -12
- package/dist/domain/templates/schema.js +2 -12
- package/dist/domain/templates/schema.js.map +1 -1
- package/dist/domain/templates/service.d.ts +4 -16
- package/dist/domain/templates/service.js +8 -18
- package/dist/domain/templates/service.js.map +1 -1
- package/dist/domain/tree/index.d.ts +0 -12
- package/dist/domain/tree/index.js +4 -14
- package/dist/domain/tree/index.js.map +1 -1
- package/dist/domain/tree/service.d.ts +3 -15
- package/dist/domain/tree/service.js +8 -15
- package/dist/domain/tree/service.js.map +1 -1
- package/dist/domain/workflows/index.d.ts +0 -12
- package/dist/domain/workflows/index.js +4 -14
- package/dist/domain/workflows/index.js.map +1 -1
- package/dist/domain/workflows/schema.d.ts +0 -12
- package/dist/domain/workflows/schema.js +2 -12
- package/dist/domain/workflows/schema.js.map +1 -1
- package/dist/domain/workflows/service.d.ts +2 -14
- package/dist/domain/workflows/service.js +4 -14
- package/dist/domain/workflows/service.js.map +1 -1
- package/dist/export.d.ts +8 -21
- package/dist/export.js +71 -66
- package/dist/export.js.map +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.js +20 -41
- package/dist/index.js.map +1 -1
- package/dist/main.js +36 -32
- package/dist/main.js.map +1 -1
- package/dist/middleware/auth.d.ts +5 -12
- package/dist/middleware/auth.js +22 -16
- package/dist/middleware/auth.js.map +1 -1
- package/dist/middleware/commandManager.d.ts +17 -20
- package/dist/middleware/commandManager.js +27 -35
- package/dist/middleware/commandManager.js.map +1 -1
- package/dist/middleware/tree.js +2 -0
- package/dist/middleware/tree.js.map +1 -1
- package/dist/middleware/zvalidator.js +2 -0
- package/dist/middleware/zvalidator.js.map +1 -1
- package/dist/overlay.d.ts +33 -0
- package/dist/overlay.js +162 -0
- package/dist/overlay.js.map +1 -0
- package/dist/public/THIRD-PARTY.txt +1892 -688
- package/dist/public/assets/__vite-browser-external-DGgK3jMU.js +1 -0
- package/dist/public/assets/abnfDiagram-WEYOIA3C-B3qq7PKv.js +1 -0
- package/dist/public/assets/architecture-WOLXFQ4H-Bzau2LI0.js +1 -0
- package/dist/public/assets/architectureDiagram-ZHVYKT53-Bg0cUwdb.js +36 -0
- package/dist/public/assets/blockDiagram-RJAE7QA3-0RJB-ra-.js +140 -0
- package/dist/public/assets/c4Diagram-XDPPPE54-BzoQcLvf.js +38 -0
- package/dist/public/assets/channel-6BNdw4Ax.js +1 -0
- package/dist/public/assets/{chunk-MOJQB5TN-D1shKbMs.js → chunk-2E7WHVMD-6aqPk-Hk.js} +4 -4
- package/dist/public/assets/chunk-4EMNKR2T-vovNSAaE.js +1 -0
- package/dist/public/assets/chunk-55XCU76K-DXkKnt2y.js +1 -0
- package/dist/public/assets/chunk-7S6XSTFO-B9bfO0l3.js +2 -0
- package/dist/public/assets/chunk-AQDTSKZB-ilLy_cYP.js +72 -0
- package/dist/public/assets/chunk-DSNLSHJZ-DAudglXu.js +129 -0
- package/dist/public/assets/chunk-DUW6YSOI-Dgx8z5s3.js +1 -0
- package/dist/public/assets/chunk-HAGFOTED-CSKFgs6b.js +62 -0
- package/dist/public/assets/chunk-HNE4Q36P-Cu5gPBVk.js +1 -0
- package/dist/public/assets/chunk-J5ZVWO5B-oDCd-gWO.js +1 -0
- package/dist/public/assets/chunk-NGNAAXSQ-DI_UYJZ4.js +136 -0
- package/dist/public/assets/chunk-NQOKRVIF-Bpcvhq1n.js +213 -0
- package/dist/public/assets/chunk-UHW7PFBP-BDjvOaTH.js +1 -0
- package/dist/public/assets/chunk-VQ5W62QI-DHTcO93W.js +1 -0
- package/dist/public/assets/chunk-WQQL4CDK-H6nAhuck.js +10 -0
- package/dist/public/assets/chunk-XXDRQBXY-BUghdEVl.js +1 -0
- package/dist/public/assets/chunk-YZO67HFG-D13E0_Yh.js +1 -0
- package/dist/public/assets/chunk-ZAUX2LTX-Dp5y-2wt.js +1 -0
- package/dist/public/assets/chunk-ZCHMQSOR-RJjlln1D.js +2 -0
- package/dist/public/assets/classDiagram-v2-4MYWR3UA-CAqiFCSv.js +217 -0
- package/dist/public/assets/cose-bilkent-JH36ORCC-C_VOHzoP.js +1 -0
- package/dist/public/assets/cynefin-EF2NZ3EQ-Dyk4ZPjK.js +1 -0
- package/dist/public/assets/cynefinDiagram-WF24UDRP-b_Ia8gQX.js +62 -0
- package/dist/public/assets/cytoscape.esm-GRKmfDkD.js +321 -0
- package/dist/public/assets/dagre-NK4GIZVX-CH1K1yF8.js +4 -0
- package/dist/public/assets/diagram-CBK3MWTC-OaKd5avy.js +24 -0
- package/dist/public/assets/diagram-I5XIIV2D-Cmu5z1ad.js +24 -0
- package/dist/public/assets/diagram-ODIL2UCW-Cz1kkDDX.js +30 -0
- package/dist/public/assets/diagram-PFBEJUXE-faMkmqUW.js +3 -0
- package/dist/public/assets/diagram-RJA3I4VV-nycvfte-.js +41 -0
- package/dist/public/assets/diagram-TYUNFSNR-CjEv5QCm.js +200 -0
- package/dist/public/assets/dist-DGs_yUrP.js +1 -0
- package/dist/public/assets/ebnfDiagram-V4P3TTPT-DN-IIxCy.js +1 -0
- package/dist/public/assets/elk-QONTBCTQ-Bsam88GP.js +27 -0
- package/dist/public/assets/erDiagram-KYQIGQAA-DEU_qqNK.js +99 -0
- package/dist/public/assets/eventmodeling-K75KTNOO-Bl6NCM9E.js +1 -0
- package/dist/public/assets/flowDiagram-IUGLLWBU-Cl4qZ-36.js +1 -0
- package/dist/public/assets/ganttDiagram-R7GPNTJY-BmMd4aGi.js +292 -0
- package/dist/public/assets/gitGraph-VSP46ZUC-Q0H2PWek.js +1 -0
- package/dist/public/assets/gitGraphDiagram-PDYL7XHY-BlCTBYTj.js +106 -0
- package/dist/public/assets/index-CuBJ0hof.css +1 -0
- package/dist/public/assets/index-D6WqGtsG.js +27876 -0
- package/dist/public/assets/index-D701BZPh.js +2219 -0
- package/dist/public/assets/info-OHQRW6UA-D0TMPJxW.js +1 -0
- package/dist/public/assets/infoDiagram-MVDRKAX5-CljbtJXu.js +2 -0
- package/dist/public/assets/{ishikawaDiagram-FXEZZL3T-CiLpASIW.js → ishikawaDiagram-HPEHV2GE-_Y3Fr0hu.js} +6 -6
- package/dist/public/assets/journeyDiagram-BOSHW7O7-Bo55jJ4m.js +139 -0
- package/dist/public/assets/kanban-definition-FNSA4HC5-Cd-10MtF.js +89 -0
- package/dist/public/assets/katex-MEuSR36T.js +257 -0
- package/dist/public/assets/line-BDmh4sWC.js +1 -0
- package/dist/public/assets/linear-Dt7xjMrI.js +1 -0
- package/dist/public/assets/mermaid-parser.core-BJ1yyzvV.js +7 -0
- package/dist/public/assets/mindmap-definition-6OY57UG3-CRgumPuN.js +98 -0
- package/dist/public/assets/packet-JDAUHWVQ-DsTMT3Kw.js +1 -0
- package/dist/public/assets/path-B_0haWDX.js +1 -0
- package/dist/public/assets/pegDiagram-ECIUJNBX-BEGI5k3m.js +1 -0
- package/dist/public/assets/pie-XZMESJXO-COyqzA3N.js +1 -0
- package/dist/public/assets/pieDiagram-GNMPY74T-CrLJhZJJ.js +39 -0
- package/dist/public/assets/{quadrantDiagram-ABIIQ3AL-B3czMbdS.js → quadrantDiagram-D57K4MC3-Fl7HMHxK.js} +6 -6
- package/dist/public/assets/radar-ABXABTNO-DeXHKowk.js +1 -0
- package/dist/public/assets/railroad-I3PHUGI6-CUjKUdPz.js +1 -0
- package/dist/public/assets/railroad-abnf-LNEFI6M7-B1aEgHE6.js +1 -0
- package/dist/public/assets/railroad-ebnf-DWYD2UWJ-DmmI3Voz.js +1 -0
- package/dist/public/assets/railroad-peg-JR7BVNR7-BHzi9m7r.js +1 -0
- package/dist/public/assets/railroadDiagram-Y72NRBL7-D1oeE5fy.js +1 -0
- package/dist/public/assets/requirementDiagram-EQYSW5RA-BJDKK1aS.js +84 -0
- package/dist/public/assets/rolldown-runtime-BCiCTKAo.js +1 -0
- package/dist/public/assets/{rough.esm-By172zw-.js → rough.esm-Dy-Kn_BL.js} +1 -1
- package/dist/public/assets/sankeyDiagram-SY24JHO5-C4g0OwZ9.js +40 -0
- package/dist/public/assets/sequenceDiagram-BLEHNHQU-CEvy4P-b.js +169 -0
- package/dist/public/assets/sizeCapture-INFHLROL-3uHXrFqA.js +1 -0
- package/dist/public/assets/src-MPsEqXxq.js +1 -0
- package/dist/public/assets/stateDiagram-v2-A6IESKWZ-BFhvw4Gl.js +291 -0
- package/dist/public/assets/swimlanes-B3ENRKFQ-BIl_Q-FM.js +1 -0
- package/dist/public/assets/swimlanesDiagram-AYQRV4AK-rvDbKEHQ.js +8 -0
- package/dist/public/assets/timeline-definition-JXYKGLGB-qAoWTH4N.js +120 -0
- package/dist/public/assets/treeView-D4JQ5SDB-vq16JKkJ.js +1 -0
- package/dist/public/assets/treemap-SAJKECNS-C0IZTaDk.js +1 -0
- package/dist/public/assets/usecaseDiagram-WPOLBNNX-Dq8iz49r.js +328 -0
- package/dist/public/assets/vennDiagram-Q3Y3IDCW-Br4JmRjM.js +34 -0
- package/dist/public/assets/wardley-7MLQ67FV-CEPlAQ79.js +1 -0
- package/dist/public/assets/wardleyDiagram-IVAIDKWA-DURB7Ue6.js +78 -0
- package/dist/public/assets/xychartDiagram-4URNHDU4-BiZywfhy.js +7 -0
- package/dist/public/index.html +27 -28
- package/dist/public/sbom.cdx.json +1 -0
- package/dist/types.d.ts +0 -12
- package/dist/types.js +2 -12
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +12 -5
- package/dist/utils.js +18 -43
- package/dist/utils.js.map +1 -1
- package/package.json +14 -14
- package/src/app.ts +51 -49
- package/src/auth/index.ts +3 -13
- package/src/auth/keycloak.ts +10 -15
- package/src/auth/mock.ts +144 -48
- package/src/auth/types.ts +10 -13
- package/src/common/errors.ts +45 -0
- package/src/common/validationSchemas.ts +3 -12
- package/src/domain/auth/index.ts +2 -12
- package/src/domain/calculations/index.ts +4 -14
- package/src/domain/calculations/schema.ts +2 -12
- package/src/domain/calculations/service.ts +8 -21
- package/src/domain/cardTypes/index.ts +10 -20
- package/src/domain/cardTypes/schema.ts +3 -12
- package/src/domain/cardTypes/service.ts +22 -29
- package/src/domain/cards/index.ts +158 -218
- package/src/domain/cards/lib.ts +9 -173
- package/src/domain/cards/mermaid.ts +25 -0
- package/src/domain/cards/schema.ts +19 -15
- package/src/domain/cards/service.ts +166 -134
- package/src/domain/connectors/index.ts +5 -14
- package/src/domain/connectors/service.ts +5 -20
- package/src/domain/events/events-by-project.ts +59 -0
- package/src/domain/events/index.ts +102 -0
- package/src/domain/events/lifetime.ts +17 -0
- package/src/domain/events/project-events.ts +266 -0
- package/src/domain/events/schema.ts +11 -0
- package/src/domain/fieldTypes/index.ts +6 -16
- package/src/domain/fieldTypes/schema.ts +3 -12
- package/src/domain/fieldTypes/service.ts +9 -21
- package/src/domain/graphModels/index.ts +4 -14
- package/src/domain/graphModels/schema.ts +3 -12
- package/src/domain/graphModels/service.ts +5 -18
- package/src/domain/graphViews/index.ts +4 -14
- package/src/domain/graphViews/schema.ts +3 -0
- package/src/domain/graphViews/service.ts +5 -18
- package/src/domain/labels/index.ts +4 -14
- package/src/domain/labels/service.ts +6 -16
- package/src/domain/linkTypes/index.ts +6 -16
- package/src/domain/linkTypes/schema.ts +2 -12
- package/src/domain/linkTypes/service.ts +8 -21
- package/src/domain/logicPrograms/index.ts +5 -17
- package/src/domain/logicPrograms/service.ts +7 -16
- package/src/domain/mcp/index.ts +33 -24
- package/src/domain/project/index.ts +59 -37
- package/src/domain/project/schema.ts +41 -18
- package/src/domain/project/service.ts +81 -71
- package/src/domain/projects/index.ts +38 -50
- package/src/domain/projects/schema.ts +3 -12
- package/src/domain/projects/service.ts +18 -88
- package/src/domain/reports/index.ts +4 -14
- package/src/domain/reports/schema.ts +2 -12
- package/src/domain/reports/service.ts +5 -18
- package/src/domain/resources/index.ts +102 -30
- package/src/domain/resources/schema.ts +15 -2
- package/src/domain/resources/service.ts +98 -81
- package/src/domain/skills/index.ts +51 -0
- package/src/domain/skills/schema.ts +9 -0
- package/src/domain/skills/service.ts +8 -0
- package/src/domain/templates/index.ts +8 -18
- package/src/domain/templates/schema.ts +2 -12
- package/src/domain/templates/service.ts +9 -22
- package/src/domain/tree/index.ts +4 -14
- package/src/domain/tree/service.ts +10 -21
- package/src/domain/workflows/index.ts +4 -14
- package/src/domain/workflows/schema.ts +2 -12
- package/src/domain/workflows/service.ts +5 -18
- package/src/export.ts +82 -73
- package/src/index.ts +30 -46
- package/src/main.ts +45 -37
- package/src/middleware/auth.ts +25 -16
- package/src/middleware/commandManager.ts +37 -49
- package/src/middleware/tree.ts +3 -0
- package/src/middleware/zvalidator.ts +3 -0
- package/src/overlay.ts +185 -0
- package/src/types.ts +2 -12
- package/src/utils.ts +26 -46
- package/dist/domain/cards/presence.d.ts +0 -50
- package/dist/domain/cards/presence.js +0 -93
- package/dist/domain/cards/presence.js.map +0 -1
- package/dist/project-registry.d.ts +0 -57
- package/dist/project-registry.js +0 -93
- package/dist/project-registry.js.map +0 -1
- package/dist/public/assets/abnfDiagram-VRR7QNED-Djr4KJ5E.js +0 -1
- package/dist/public/assets/arc-DrR4k_H-.js +0 -1
- package/dist/public/assets/architecture-TIHT7OUA-XL6N-4o9.js +0 -1
- package/dist/public/assets/architectureDiagram-ZJ3FMSHR-DsMU2Uwa.js +0 -36
- package/dist/public/assets/blockDiagram-677ZJIJ3-DRBmQUQJ.js +0 -132
- package/dist/public/assets/c4Diagram-LMCZKHZV-E0rM02LD.js +0 -10
- package/dist/public/assets/channel-D5fnImJy.js +0 -1
- package/dist/public/assets/chunk-32BRIVSS-BnDY0aSV.js +0 -1
- package/dist/public/assets/chunk-52WLFC77-N5YugKaZ.js +0 -10
- package/dist/public/assets/chunk-5FCAYU7R-I3_t_Ic_.js +0 -1
- package/dist/public/assets/chunk-5HE753X5-Dxz40rzH.js +0 -1
- package/dist/public/assets/chunk-5JV3BV7I-CNwCKRLH.js +0 -1
- package/dist/public/assets/chunk-5TONJI2A-ezWQ_Z2j.js +0 -2
- package/dist/public/assets/chunk-7BUUIJ7U-Bb538aSH.js +0 -1
- package/dist/public/assets/chunk-BIQX33UG-DS132-R_.js +0 -1
- package/dist/public/assets/chunk-C7G6YPKG-BN-cNjoj.js +0 -1
- package/dist/public/assets/chunk-CQNSW5MT-D8Mn1I73.js +0 -1
- package/dist/public/assets/chunk-CYSBUYHQ-Dc64Dwdo.js +0 -1
- package/dist/public/assets/chunk-EMLP6XTP-aIK0V8GX.js +0 -1
- package/dist/public/assets/chunk-EX3LRPZG-Db0XYyxy.js +0 -231
- package/dist/public/assets/chunk-FWX5IMBZ-BF_P2-Do.js +0 -2
- package/dist/public/assets/chunk-HOUHSVGY-L35GPy9G.js +0 -1
- package/dist/public/assets/chunk-ICXQ74PX-Bb8zaHde.js +0 -2
- package/dist/public/assets/chunk-JG7HCLWE-BtAXK3iQ.js +0 -2
- package/dist/public/assets/chunk-KEIR6QF5-DEvma7oi.js +0 -161
- package/dist/public/assets/chunk-MOZMSUNE-5FIqIBsY.js +0 -1
- package/dist/public/assets/chunk-OGEWGWER-BVIFy9xz.js +0 -1
- package/dist/public/assets/chunk-OSBZ3O6U-Cfd7kf1R.js +0 -1
- package/dist/public/assets/chunk-PUDLZKDR-Db3FSNR9.js +0 -156
- package/dist/public/assets/chunk-Q4XR5HBZ-BuKFRUzR.js +0 -70
- package/dist/public/assets/chunk-QBLGF6JB-DUGZXFh-.js +0 -1
- package/dist/public/assets/chunk-R7FJI6CG-D7mUd-qN.js +0 -1
- package/dist/public/assets/chunk-RYQCIY6F-C_3rESBd.js +0 -1
- package/dist/public/assets/chunk-U6XO7XAA-C3UhlwA1.js +0 -2
- package/dist/public/assets/chunk-V7JOEXUC-71b0ABpv.js +0 -206
- package/dist/public/assets/chunk-VAUOI2AC-C-GBw18h.js +0 -1
- package/dist/public/assets/chunk-VR4S4FIN-tUhbELKr.js +0 -1
- package/dist/public/assets/chunk-WYO6CB5R-BQoO62-B.js +0 -127
- package/dist/public/assets/chunk-XXDRQBXY-Co8n4ZHT.js +0 -1
- package/dist/public/assets/chunk-YOTPTUD7-DhCRKU1A.js +0 -1
- package/dist/public/assets/chunk-ZGVPDNZ5-hpz2Ryq5.js +0 -62
- package/dist/public/assets/chunk-ZIRB5QZD-BpeS1aZ7.js +0 -32
- package/dist/public/assets/classDiagram-OUVF2IWQ-CXdVorPK.js +0 -1
- package/dist/public/assets/classDiagram-v2-EOCWNBFH-CXdVorPK.js +0 -1
- package/dist/public/assets/colors-Cg5Vh3br.js +0 -1
- package/dist/public/assets/cose-bilkent-JH36ORCC-4GoRbloS.js +0 -1
- package/dist/public/assets/cynefin-VYW2F7L2-BPH-25fI.js +0 -1
- package/dist/public/assets/cynefinDiagram-TSTJHNR4-PEf16euv.js +0 -62
- package/dist/public/assets/cytoscape.esm-C3UvhD5t.js +0 -321
- package/dist/public/assets/dagre-Buvkdvvj.js +0 -1
- package/dist/public/assets/dagre-VKFMJZFB-DPsCMBF1.js +0 -4
- package/dist/public/assets/diagram-FQU43EPY-DS-ryuRg.js +0 -3
- package/dist/public/assets/diagram-G47NLZAW-CzUoYkFf.js +0 -24
- package/dist/public/assets/diagram-NH7WQ7WH-MhGnE2fh.js +0 -24
- package/dist/public/assets/diagram-OA4YK3LP-CsQ9aFR_.js +0 -30
- package/dist/public/assets/diagram-WEI45ONY-Er3q49ew.js +0 -41
- package/dist/public/assets/dist-BzwexiH1.js +0 -1
- package/dist/public/assets/ebnfDiagram-CCIWWBDH-AnJAsk14.js +0 -1
- package/dist/public/assets/erDiagram-Q63AITRT-DulA16my.js +0 -85
- package/dist/public/assets/eventmodeling-45OFAUF4-CoIhTpHU.js +0 -1
- package/dist/public/assets/flowDiagram-23GEKE2U-BGMXUq18.js +0 -1
- package/dist/public/assets/ganttDiagram-NO4QXBWP-DAvCPT7_.js +0 -292
- package/dist/public/assets/gitGraph-TEB2WS4Q-BcPsZts5.js +0 -1
- package/dist/public/assets/gitGraphDiagram-IHSO6WYX-CksvJvsQ.js +0 -106
- package/dist/public/assets/index-COSSLZqt.css +0 -1
- package/dist/public/assets/index-Y8Ckwau7.js +0 -447
- package/dist/public/assets/info-DKCQHKI2-7VGzrAVB.js +0 -1
- package/dist/public/assets/infoDiagram-FWYZ7A6U-D_by7lSL.js +0 -2
- package/dist/public/assets/journeyDiagram-5HDEW3XC-DpvFmk7c.js +0 -139
- package/dist/public/assets/kanban-definition-HUTT4EX6-DYP_x6zD.js +0 -89
- package/dist/public/assets/katex-DolUETbr.js +0 -257
- package/dist/public/assets/line-C8Sfsgt8.js +0 -1
- package/dist/public/assets/linear-BWTvbP1l.js +0 -1
- package/dist/public/assets/map-BaFkSB1l.js +0 -1
- package/dist/public/assets/mermaid-parser.core--8614tkK.js +0 -4
- package/dist/public/assets/mindmap-definition-LN4V7U3C-3IAd4gp3.js +0 -96
- package/dist/public/assets/ordinal-BdBDtYTt.js +0 -1
- package/dist/public/assets/packet-7NZHBO7P-KYt33H0C.js +0 -1
- package/dist/public/assets/path-HTXttWil.js +0 -1
- package/dist/public/assets/pegDiagram-2B236MQR-BQNFxYz2.js +0 -1
- package/dist/public/assets/pie-RZYD4A2V-xKz9s9I4.js +0 -1
- package/dist/public/assets/pieDiagram-ENE6RG2P-Cy13tg8_.js +0 -39
- package/dist/public/assets/radar-I7S5WNFK-B4QTX-fX.js +0 -1
- package/dist/public/assets/railroad-3IZDKUUU-Co_9rPVC.js +0 -1
- package/dist/public/assets/railroad-abnf-AHOZXSZD-Bhy_c3ol.js +0 -1
- package/dist/public/assets/railroad-ebnf-EBAXGLYW-B9ENjG34.js +0 -1
- package/dist/public/assets/railroad-peg-LSFZ7HO6-CyJxDBsB.js +0 -1
- package/dist/public/assets/railroadDiagram-RFXS5EU6-M2j5SJF2.js +0 -1
- package/dist/public/assets/range-EplFIxc7.js +0 -1
- package/dist/public/assets/requirementDiagram-TGXJPOKE-CmvJWy_S.js +0 -84
- package/dist/public/assets/sankeyDiagram-HTMAVEWB-tAeOzMTn.js +0 -40
- package/dist/public/assets/sequenceDiagram-DBY2YBRQ-r0pwijM4.js +0 -162
- package/dist/public/assets/sizeCapture-X5ZJPWSS-B0uUizjq.js +0 -1
- package/dist/public/assets/src-DOh7_en_.js +0 -1
- package/dist/public/assets/stateDiagram-2N3HPSRC-a9IdkSQG.js +0 -1
- package/dist/public/assets/stateDiagram-v2-6OUMAXLB-s2blPtZ-.js +0 -1
- package/dist/public/assets/swimlanes-5IMT3BWC-5w0Cdxk6.js +0 -2
- package/dist/public/assets/swimlanesDiagram-G3AALYLV-BWa-KRed.js +0 -8
- package/dist/public/assets/time-BM2d9MsQ.js +0 -1
- package/dist/public/assets/timeline-definition-FHXFAJF6-CvXlv_4Y.js +0 -120
- package/dist/public/assets/treeView-QDETBFTQ-B9cxjfpB.js +0 -1
- package/dist/public/assets/treemap-6X3UGDF4-BplEq4hB.js +0 -1
- package/dist/public/assets/treemap-BfjIY-m6.js +0 -1
- package/dist/public/assets/vennDiagram-L72KCM5P-ti2qNcvo.js +0 -34
- package/dist/public/assets/wardley-OPB4EBWU-BX2ghg5e.js +0 -1
- package/dist/public/assets/wardleyDiagram-EHGQE667-C8lblm8x.js +0 -78
- package/dist/public/assets/xychartDiagram-FW5EYKEG-US-_k5eu.js +0 -7
- package/src/domain/cards/presence.ts +0 -124
- package/src/project-registry.ts +0 -130
|
@@ -1,38 +1,130 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
14
|
-
import { convert } from '@asciidoctor/core';
|
|
1
|
+
// SPDX-FileCopyrightText: Cyberismo Ltd and contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
3
|
+
|
|
15
4
|
import type {
|
|
5
|
+
AttachmentContent,
|
|
6
|
+
Card,
|
|
16
7
|
ExportPdfOptions,
|
|
17
8
|
MetadataContent,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
import { type
|
|
21
|
-
import { preprocessMermaidBlocksForHtml } from '
|
|
22
|
-
import { rewriteAsciidocCardXrefs } from '@cyberismo/data-handler/utils/asciidoc-xref';
|
|
9
|
+
QueryResult,
|
|
10
|
+
} from '@cyberismo/model';
|
|
11
|
+
import { AsciidoctorPdfError, type Workspace } from '@cyberismo/data-handler';
|
|
12
|
+
import { preprocessMermaidBlocksForHtml } from './mermaid.js';
|
|
23
13
|
import { allCards } from './lib.js';
|
|
14
|
+
import { getCardQueryResult } from '../../export.js';
|
|
24
15
|
import type { TreeOptions } from '../../types.js';
|
|
25
16
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
type RenderMode = 'inject' | 'staticSite';
|
|
18
|
+
|
|
19
|
+
async function renderAdoc(
|
|
20
|
+
ws: Workspace,
|
|
21
|
+
key: string,
|
|
22
|
+
content: string,
|
|
23
|
+
mode: RenderMode,
|
|
24
|
+
fallback?: string,
|
|
25
|
+
): Promise<string> {
|
|
26
|
+
let { content: asciidocContent } = await ws.render.macros(content, {
|
|
27
|
+
context: mode === 'staticSite' ? 'exportedSite' : 'localApp',
|
|
28
|
+
mode,
|
|
29
|
+
cardKey: key,
|
|
30
|
+
fallback,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// Convert [mermaid] AsciiDoc blocks to passthrough HTML before asciidoctor processes them
|
|
34
|
+
asciidocContent = preprocessMermaidBlocksForHtml(asciidocContent);
|
|
35
|
+
|
|
36
|
+
// Rewrite native AsciiDoc xrefs that target other cards into
|
|
37
|
+
// /projects/<prefix>/cards/<key> links.
|
|
38
|
+
return ws.render.xrefs(asciidocContent, mode);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export async function getCardData(
|
|
42
|
+
ws: Workspace,
|
|
43
|
+
key: string,
|
|
44
|
+
staticMode: boolean,
|
|
45
|
+
): Promise<QueryResult<'card'>> {
|
|
46
|
+
return ws.consistent(async () => {
|
|
47
|
+
// The key reaches the logic program unchecked; details() rejects unknown keys first.
|
|
48
|
+
await ws.cards.details(key);
|
|
49
|
+
const card = staticMode
|
|
50
|
+
? await getCardQueryResult(ws, key)
|
|
51
|
+
: await ws.queries.runQuery('card', 'localApp', { cardKey: key });
|
|
52
|
+
if (card.length !== 1) {
|
|
53
|
+
throw new Error('Query failed. Check card-query syntax');
|
|
54
|
+
}
|
|
55
|
+
// Hidden fields stay off the static site; the card view never shows them.
|
|
56
|
+
const data = staticMode
|
|
57
|
+
? { ...card[0], fields: card[0].fields.filter((f) => f.visibility) }
|
|
58
|
+
: card[0];
|
|
59
|
+
return data;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** One solve for many cards; keys the project does not hold are left out. */
|
|
64
|
+
export async function getCardBatch(
|
|
65
|
+
ws: Workspace,
|
|
66
|
+
keys: string[],
|
|
67
|
+
): Promise<Record<string, QueryResult<'card'>>> {
|
|
68
|
+
return ws.consistent(async () => {
|
|
69
|
+
// The keys reach the logic program unchecked; only known ones go through.
|
|
70
|
+
const cardKeys = [...new Set(keys)].filter((key) => ws.cards.has(key));
|
|
71
|
+
// The card query reads an empty list as no list and answers every card.
|
|
72
|
+
if (cardKeys.length === 0) {
|
|
73
|
+
return {};
|
|
74
|
+
}
|
|
75
|
+
const cards = await ws.queries.runQuery('card', 'localApp', { cardKeys });
|
|
76
|
+
return Object.fromEntries(cards.map((card) => [card.key, card]));
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export async function getCardContent(
|
|
81
|
+
ws: Workspace,
|
|
82
|
+
key: string,
|
|
83
|
+
staticMode: boolean,
|
|
84
|
+
): Promise<{ adocContent: string }> {
|
|
85
|
+
return ws.consistent(async () => {
|
|
86
|
+
const card = await ws.cards.details(key);
|
|
87
|
+
const adocContent = await renderAdoc(
|
|
88
|
+
ws,
|
|
89
|
+
key,
|
|
90
|
+
card.content || '',
|
|
91
|
+
staticMode ? 'staticSite' : 'inject',
|
|
92
|
+
'',
|
|
93
|
+
);
|
|
94
|
+
return { adocContent };
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// The static site publishes no more of the stored card than its card view reads.
|
|
99
|
+
type StaticCardSource = Pick<Card, 'key' | 'path' | 'content' | 'attachments'>;
|
|
100
|
+
|
|
101
|
+
export async function getCardSource(
|
|
102
|
+
ws: Workspace,
|
|
103
|
+
key: string,
|
|
104
|
+
staticMode: boolean,
|
|
105
|
+
): Promise<Card | StaticCardSource> {
|
|
106
|
+
const card = await ws.cards.details(key);
|
|
107
|
+
if (!staticMode) {
|
|
108
|
+
return card;
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
key: card.key,
|
|
112
|
+
path: card.path,
|
|
113
|
+
content: card.content,
|
|
114
|
+
attachments: card.attachments,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export async function getProjectInfo(ws: Workspace) {
|
|
119
|
+
return ws.consistent(async () => {
|
|
120
|
+
const projectResponse = await ws.settings.info();
|
|
29
121
|
|
|
30
|
-
const workflowsResponse = await
|
|
122
|
+
const workflowsResponse = await ws.resources.contents('workflows');
|
|
31
123
|
if (!workflowsResponse) {
|
|
32
124
|
throw new Error('No workflows found');
|
|
33
125
|
}
|
|
34
126
|
|
|
35
|
-
const cardTypesResponse = await
|
|
127
|
+
const cardTypesResponse = await ws.resources.contents('cardTypes');
|
|
36
128
|
if (!cardTypesResponse) {
|
|
37
129
|
throw new Error('No card types found');
|
|
38
130
|
}
|
|
@@ -47,48 +139,48 @@ export async function getProjectInfo(commands: CommandManager) {
|
|
|
47
139
|
}
|
|
48
140
|
|
|
49
141
|
export async function updateCard(
|
|
50
|
-
|
|
142
|
+
ws: Workspace,
|
|
51
143
|
key: string,
|
|
52
144
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
53
145
|
body: any,
|
|
54
|
-
) {
|
|
55
|
-
await
|
|
146
|
+
): Promise<void> {
|
|
147
|
+
await ws.atomic(async () => {
|
|
56
148
|
if (body.state) {
|
|
57
|
-
await
|
|
149
|
+
await ws.cards.transition(key, body.state);
|
|
58
150
|
}
|
|
59
151
|
if (body.content != null) {
|
|
60
|
-
await
|
|
152
|
+
await ws.cards.edit(key, body.content);
|
|
61
153
|
}
|
|
62
154
|
if (body.metadata) {
|
|
63
155
|
for (const [metadataKey, metadataValue] of Object.entries(
|
|
64
156
|
body.metadata,
|
|
65
157
|
)) {
|
|
66
|
-
await
|
|
158
|
+
await ws.cards.editField(
|
|
67
159
|
key,
|
|
68
160
|
metadataKey,
|
|
69
|
-
metadataValue as MetadataContent,
|
|
161
|
+
metadataValue as Exclude<MetadataContent, bigint>,
|
|
70
162
|
);
|
|
71
163
|
}
|
|
72
164
|
}
|
|
73
165
|
if (body.parent) {
|
|
74
|
-
await
|
|
166
|
+
await ws.cards.move(key, body.parent);
|
|
75
167
|
}
|
|
76
168
|
if (body.index != null) {
|
|
77
|
-
await
|
|
169
|
+
await ws.cards.rankAt(key, body.index);
|
|
78
170
|
}
|
|
79
171
|
}, `Update card ${key}`);
|
|
80
172
|
}
|
|
81
173
|
|
|
82
|
-
export async function deleteCard(
|
|
83
|
-
await
|
|
174
|
+
export async function deleteCard(ws: Workspace, key: string) {
|
|
175
|
+
await ws.cards.remove(key);
|
|
84
176
|
}
|
|
85
177
|
|
|
86
178
|
export async function createCard(
|
|
87
|
-
|
|
179
|
+
ws: Workspace,
|
|
88
180
|
template: string,
|
|
89
181
|
parentKey?: string,
|
|
90
182
|
) {
|
|
91
|
-
const result = await
|
|
183
|
+
const result = await ws.cards.create(
|
|
92
184
|
template,
|
|
93
185
|
parentKey === 'root' ? undefined : parentKey,
|
|
94
186
|
);
|
|
@@ -100,20 +192,16 @@ export async function createCard(
|
|
|
100
192
|
}
|
|
101
193
|
|
|
102
194
|
export async function uploadAttachments(
|
|
103
|
-
|
|
195
|
+
ws: Workspace,
|
|
104
196
|
key: string,
|
|
105
197
|
files: File[],
|
|
106
198
|
) {
|
|
107
199
|
const succeeded: string[] = [];
|
|
108
|
-
await
|
|
200
|
+
await ws.atomic(async () => {
|
|
109
201
|
for (const file of files) {
|
|
110
202
|
if (file instanceof File) {
|
|
111
203
|
const buffer = await file.arrayBuffer();
|
|
112
|
-
await
|
|
113
|
-
key,
|
|
114
|
-
file.name,
|
|
115
|
-
Buffer.from(buffer),
|
|
116
|
-
);
|
|
204
|
+
await ws.cards.addAttachment(key, file.name, Buffer.from(buffer));
|
|
117
205
|
succeeded.push(file.name);
|
|
118
206
|
}
|
|
119
207
|
}
|
|
@@ -133,71 +221,27 @@ function validateAttachmentFileName(filename: string): void {
|
|
|
133
221
|
}
|
|
134
222
|
|
|
135
223
|
export async function removeAttachment(
|
|
136
|
-
|
|
224
|
+
ws: Workspace,
|
|
137
225
|
key: string,
|
|
138
226
|
filename: string,
|
|
139
227
|
) {
|
|
140
228
|
validateAttachmentFileName(filename);
|
|
141
|
-
await
|
|
229
|
+
await ws.cards.removeAttachment(key, filename);
|
|
142
230
|
return { message: 'Attachment removed successfully' };
|
|
143
231
|
}
|
|
144
232
|
|
|
145
|
-
export async function openAttachment(
|
|
146
|
-
commands: CommandManager,
|
|
147
|
-
key: string,
|
|
148
|
-
filename: string,
|
|
149
|
-
) {
|
|
150
|
-
validateAttachmentFileName(filename);
|
|
151
|
-
await commands.showCmd.openAttachment(key, filename);
|
|
152
|
-
return { message: 'Attachment opened successfully' };
|
|
153
|
-
}
|
|
154
|
-
|
|
155
233
|
export async function parseContent(
|
|
156
|
-
|
|
234
|
+
ws: Workspace,
|
|
157
235
|
key: string,
|
|
158
236
|
content: string,
|
|
159
237
|
) {
|
|
160
|
-
return
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
asciidocContent = await evaluateMacros(content, {
|
|
164
|
-
context: 'localApp',
|
|
165
|
-
mode: 'inject',
|
|
166
|
-
project: commands.project,
|
|
167
|
-
cardKey: key,
|
|
168
|
-
});
|
|
169
|
-
} catch (error) {
|
|
170
|
-
asciidocContent = `Macro error: ${error instanceof Error ? error.message : 'Unknown error'}\n\n${content}`;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// Convert [mermaid] AsciiDoc blocks to passthrough HTML before asciidoctor processes them
|
|
174
|
-
asciidocContent = preprocessMermaidBlocksForHtml(asciidocContent);
|
|
175
|
-
|
|
176
|
-
// Rewrite native AsciiDoc xrefs that target other cards into
|
|
177
|
-
// /projects/<prefix>/cards/<key> links.
|
|
178
|
-
asciidocContent = rewriteAsciidocCardXrefs(
|
|
179
|
-
asciidocContent,
|
|
180
|
-
commands.project,
|
|
181
|
-
'inject',
|
|
182
|
-
);
|
|
183
|
-
|
|
184
|
-
const projectPrefix = commands.project.projectPrefix;
|
|
185
|
-
const parsedContent = (
|
|
186
|
-
await convert(asciidocContent, {
|
|
187
|
-
safe: 'safe',
|
|
188
|
-
attributes: {
|
|
189
|
-
imagesdir: `/api/projects/${projectPrefix}/cards/${key}/a`,
|
|
190
|
-
icons: 'font',
|
|
191
|
-
},
|
|
192
|
-
})
|
|
193
|
-
).toString();
|
|
194
|
-
|
|
195
|
-
return { parsedContent };
|
|
196
|
-
});
|
|
238
|
+
return ws.consistent(async () => ({
|
|
239
|
+
adocContent: await renderAdoc(ws, key, content, 'inject'),
|
|
240
|
+
}));
|
|
197
241
|
}
|
|
198
242
|
|
|
199
243
|
export async function createLink(
|
|
200
|
-
|
|
244
|
+
ws: Workspace,
|
|
201
245
|
key: string,
|
|
202
246
|
target: string,
|
|
203
247
|
linkType: string,
|
|
@@ -209,19 +253,13 @@ export async function createLink(
|
|
|
209
253
|
const source = direction === 'outbound' ? key : target;
|
|
210
254
|
const destination = direction === 'outbound' ? target : key;
|
|
211
255
|
|
|
212
|
-
await
|
|
213
|
-
source,
|
|
214
|
-
destination,
|
|
215
|
-
linkType,
|
|
216
|
-
description,
|
|
217
|
-
direction,
|
|
218
|
-
);
|
|
256
|
+
await ws.cards.addLink(source, destination, linkType, description, direction);
|
|
219
257
|
|
|
220
258
|
return { message: 'Link created successfully' };
|
|
221
259
|
}
|
|
222
260
|
|
|
223
261
|
export async function removeLink(
|
|
224
|
-
|
|
262
|
+
ws: Workspace,
|
|
225
263
|
key: string,
|
|
226
264
|
target: string,
|
|
227
265
|
linkType: string,
|
|
@@ -232,18 +270,12 @@ export async function removeLink(
|
|
|
232
270
|
// For inbound: target is source, key is destination
|
|
233
271
|
const source = direction === 'outbound' ? key : target;
|
|
234
272
|
const destination = direction === 'outbound' ? target : key;
|
|
235
|
-
await
|
|
236
|
-
'link',
|
|
237
|
-
source,
|
|
238
|
-
destination,
|
|
239
|
-
linkType,
|
|
240
|
-
description,
|
|
241
|
-
);
|
|
273
|
+
await ws.cards.removeLink(source, destination, linkType, description);
|
|
242
274
|
return { message: 'Link removed successfully' };
|
|
243
275
|
}
|
|
244
276
|
|
|
245
277
|
export async function updateLink(
|
|
246
|
-
|
|
278
|
+
ws: Workspace,
|
|
247
279
|
key: string,
|
|
248
280
|
toCard: string,
|
|
249
281
|
linkType: string,
|
|
@@ -256,18 +288,11 @@ export async function updateLink(
|
|
|
256
288
|
) {
|
|
257
289
|
// For simplicity create the new link first so that duplicate-link validation runs before
|
|
258
290
|
// the old link is removed. This also handles direction changes.
|
|
259
|
-
return
|
|
260
|
-
await createLink(
|
|
261
|
-
commands,
|
|
262
|
-
key,
|
|
263
|
-
toCard,
|
|
264
|
-
linkType,
|
|
265
|
-
direction,
|
|
266
|
-
linkDescription,
|
|
267
|
-
);
|
|
291
|
+
return ws.atomic(async () => {
|
|
292
|
+
await createLink(ws, key, toCard, linkType, direction, linkDescription);
|
|
268
293
|
|
|
269
294
|
await removeLink(
|
|
270
|
-
|
|
295
|
+
ws,
|
|
271
296
|
key,
|
|
272
297
|
previousToCard,
|
|
273
298
|
previousLinkType,
|
|
@@ -280,12 +305,12 @@ export async function updateLink(
|
|
|
280
305
|
}
|
|
281
306
|
|
|
282
307
|
export async function getAttachment(
|
|
283
|
-
|
|
308
|
+
ws: Workspace,
|
|
284
309
|
key: string,
|
|
285
310
|
filename: string,
|
|
286
|
-
): Promise<
|
|
311
|
+
): Promise<AttachmentContent> {
|
|
287
312
|
validateAttachmentFileName(filename);
|
|
288
|
-
return
|
|
313
|
+
return ws.cards.attachment(key, filename);
|
|
289
314
|
}
|
|
290
315
|
|
|
291
316
|
/**
|
|
@@ -295,25 +320,25 @@ export async function getAttachment(
|
|
|
295
320
|
* @returns all cards in a flattened array
|
|
296
321
|
*/
|
|
297
322
|
export async function findAllCards(
|
|
298
|
-
|
|
323
|
+
ws: Workspace,
|
|
299
324
|
options?: TreeOptions,
|
|
300
325
|
): ReturnType<typeof allCards> {
|
|
301
|
-
return allCards(
|
|
326
|
+
return allCards(ws, options);
|
|
302
327
|
}
|
|
303
328
|
/**
|
|
304
329
|
* Gets all attachments that are required for rendering the wanted cards
|
|
305
|
-
* @param
|
|
330
|
+
* @param ws the command manager used for the query
|
|
306
331
|
* @param options optional tree query options
|
|
307
332
|
* @returns all attachments for cards returned by the tree query
|
|
308
333
|
*/
|
|
309
334
|
export async function findRelevantAttachments(
|
|
310
|
-
|
|
335
|
+
ws: Workspace,
|
|
311
336
|
options?: TreeOptions,
|
|
312
337
|
) {
|
|
313
338
|
const cards = new Set<string>(
|
|
314
|
-
(await allCards(
|
|
339
|
+
(await allCards(ws, options)).map((c) => c.key),
|
|
315
340
|
);
|
|
316
|
-
const attachments = await
|
|
341
|
+
const attachments = await ws.cards.attachments();
|
|
317
342
|
return attachments
|
|
318
343
|
.filter(
|
|
319
344
|
(attachment) =>
|
|
@@ -326,9 +351,16 @@ export async function findRelevantAttachments(
|
|
|
326
351
|
}
|
|
327
352
|
|
|
328
353
|
export async function exportCard(
|
|
329
|
-
|
|
354
|
+
ws: Workspace,
|
|
330
355
|
options: ExportPdfOptions,
|
|
331
|
-
): Promise<
|
|
332
|
-
|
|
333
|
-
|
|
356
|
+
): Promise<Uint8Array> {
|
|
357
|
+
try {
|
|
358
|
+
return (await ws.export.pdf(options)).pdf;
|
|
359
|
+
} catch (error) {
|
|
360
|
+
// Diagnostics can carry server paths: logged here, never sent.
|
|
361
|
+
if (error instanceof AsciidoctorPdfError) {
|
|
362
|
+
console.error(error.message, error.diagnostics.join('\n'));
|
|
363
|
+
}
|
|
364
|
+
throw error;
|
|
365
|
+
}
|
|
334
366
|
}
|
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Cyberismo Ltd and contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
3
|
+
|
|
13
4
|
import { Hono } from 'hono';
|
|
14
5
|
import { isSSGContext } from 'hono/ssg';
|
|
15
6
|
import * as connectorsService from './service.js';
|
|
@@ -31,8 +22,8 @@ router.get('/', requireRole(UserRole.Reader), async (c) => {
|
|
|
31
22
|
if (isSSGContext(c)) {
|
|
32
23
|
return c.json([]);
|
|
33
24
|
}
|
|
34
|
-
const
|
|
35
|
-
const connectors = await connectorsService.getConnectors(
|
|
25
|
+
const ws = c.get('ws');
|
|
26
|
+
const connectors = await connectorsService.getConnectors(ws);
|
|
36
27
|
return c.json(connectors);
|
|
37
28
|
});
|
|
38
29
|
|
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Cyberismo Ltd and contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
13
3
|
|
|
14
|
-
import type {
|
|
4
|
+
import type { Workspace } from '@cyberismo/data-handler';
|
|
15
5
|
|
|
16
6
|
export interface ExternalItem {
|
|
17
7
|
key: string;
|
|
@@ -24,13 +14,8 @@ export interface Connector {
|
|
|
24
14
|
items: ExternalItem[];
|
|
25
15
|
}
|
|
26
16
|
|
|
27
|
-
export async function getConnectors(
|
|
28
|
-
|
|
29
|
-
): Promise<Connector[]> {
|
|
30
|
-
const results = await commands.calculateCmd.runQuery(
|
|
31
|
-
'connectors',
|
|
32
|
-
'localApp',
|
|
33
|
-
);
|
|
17
|
+
export async function getConnectors(ws: Workspace): Promise<Connector[]> {
|
|
18
|
+
const results = await ws.queries.runQuery('connectors', 'localApp');
|
|
34
19
|
|
|
35
20
|
// Separate connectors from items based on type field
|
|
36
21
|
const connectorsMap = new Map<string, Connector>();
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Cyberismo Ltd and contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
3
|
+
|
|
4
|
+
import { SYSTEM_ACTOR, type ProjectDirectory } from '@cyberismo/data-handler';
|
|
5
|
+
import { ProjectEvents } from './project-events.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The events of each project of a directory, by prefix. A project's events
|
|
9
|
+
* follow its changes, read through a system handle, from first use.
|
|
10
|
+
*/
|
|
11
|
+
export class EventsByProject {
|
|
12
|
+
private readonly events = new Map<string, ProjectEvents>();
|
|
13
|
+
|
|
14
|
+
constructor(private readonly directory: ProjectDirectory) {}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The events of the project with `prefix`.
|
|
18
|
+
* @throws ProjectNotFoundError if the directory has no such project.
|
|
19
|
+
*/
|
|
20
|
+
async for(prefix: string): Promise<ProjectEvents> {
|
|
21
|
+
const known = this.events.get(prefix);
|
|
22
|
+
if (known) {
|
|
23
|
+
return known;
|
|
24
|
+
}
|
|
25
|
+
const ws = await this.directory.open(prefix, SYSTEM_ACTOR);
|
|
26
|
+
// Another request may have created them while this one waited.
|
|
27
|
+
let events = this.events.get(prefix);
|
|
28
|
+
if (!events) {
|
|
29
|
+
const held = new ProjectEvents(ws.changes);
|
|
30
|
+
this.events.set(prefix, held);
|
|
31
|
+
// An event names the project's prefix once its write is done, so a
|
|
32
|
+
// rename is followed as the directory follows it.
|
|
33
|
+
ws.changes.subscribe(({ project }) => this.follow(held, project));
|
|
34
|
+
events = held;
|
|
35
|
+
}
|
|
36
|
+
return events;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Keeps `events` under `prefix`, its project's prefix now, unless another
|
|
40
|
+
// project's events hold it.
|
|
41
|
+
private follow(events: ProjectEvents, prefix: string) {
|
|
42
|
+
if (this.events.has(prefix)) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
for (const [key, held] of this.events) {
|
|
46
|
+
if (held === events) {
|
|
47
|
+
this.events.delete(key);
|
|
48
|
+
this.events.set(prefix, events);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Disposes the project's events, closing their connections. */
|
|
55
|
+
drop(prefix: string) {
|
|
56
|
+
this.events.get(prefix)?.dispose();
|
|
57
|
+
this.events.delete(prefix);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Cyberismo Ltd and contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
3
|
+
|
|
4
|
+
import { Hono } from 'hono';
|
|
5
|
+
import { disableSSG } from 'hono/ssg';
|
|
6
|
+
import { streamSSE, type SSEMessage } from 'hono/streaming';
|
|
7
|
+
import { isAtLeastRole, requireRole } from '../../middleware/auth.js';
|
|
8
|
+
import { zValidator } from '../../middleware/zvalidator.js';
|
|
9
|
+
import { UserRole } from '../../types.js';
|
|
10
|
+
import { computeLifetimeMs } from './lifetime.js';
|
|
11
|
+
import { presenceSchema } from './schema.js';
|
|
12
|
+
|
|
13
|
+
const HEARTBEAT_INTERVAL_MS = 30_000;
|
|
14
|
+
|
|
15
|
+
const router = new Hono();
|
|
16
|
+
|
|
17
|
+
router.get('/', disableSSG(), requireRole(UserRole.Reader), (c) => {
|
|
18
|
+
const events = c.get('events');
|
|
19
|
+
const user = c.get('user');
|
|
20
|
+
const capabilities = {
|
|
21
|
+
canSeeIdentity: isAtLeastRole(user.role, UserRole.Editor),
|
|
22
|
+
canDeclareEditing: isAtLeastRole(user.role, UserRole.Editor),
|
|
23
|
+
canSeePresence: isAtLeastRole(user.role, UserRole.Editor),
|
|
24
|
+
};
|
|
25
|
+
return streamSSE(c, async (stream) => {
|
|
26
|
+
if (stream.aborted) return;
|
|
27
|
+
let finish: () => void = () => {};
|
|
28
|
+
const closed = new Promise<void>((resolve) => {
|
|
29
|
+
finish = resolve;
|
|
30
|
+
});
|
|
31
|
+
let stopped = false;
|
|
32
|
+
let release = () => {};
|
|
33
|
+
const stop = () => {
|
|
34
|
+
if (stopped) return;
|
|
35
|
+
stopped = true;
|
|
36
|
+
release();
|
|
37
|
+
finish();
|
|
38
|
+
};
|
|
39
|
+
// Ends the stream after one last message. Deliberately does not call
|
|
40
|
+
// `release()`: a rotating connection has been retired, and disconnecting
|
|
41
|
+
// it would drop the presence entry that bridges the client's reconnect.
|
|
42
|
+
const terminate = (message: SSEMessage) => {
|
|
43
|
+
if (stopped) return;
|
|
44
|
+
stopped = true;
|
|
45
|
+
clearInterval(heartbeat);
|
|
46
|
+
clearTimeout(rotate);
|
|
47
|
+
void stream.writeSSE(message).then(finish);
|
|
48
|
+
};
|
|
49
|
+
// Hono swallows stream write errors; `onAbort` is the only teardown signal.
|
|
50
|
+
stream.onAbort(stop);
|
|
51
|
+
const connectionId = events.connect(user, capabilities, {
|
|
52
|
+
send: (message) => void stream.writeSSE(message),
|
|
53
|
+
close: stop,
|
|
54
|
+
terminate,
|
|
55
|
+
});
|
|
56
|
+
release = () => events.disconnect(connectionId);
|
|
57
|
+
const heartbeat = setInterval(
|
|
58
|
+
() => void stream.writeSSE({ event: 'hb', data: '' }),
|
|
59
|
+
HEARTBEAT_INTERVAL_MS,
|
|
60
|
+
);
|
|
61
|
+
const rotate = setTimeout(
|
|
62
|
+
() => {
|
|
63
|
+
events.retire(connectionId);
|
|
64
|
+
terminate({ event: 'rotating', data: '' });
|
|
65
|
+
},
|
|
66
|
+
computeLifetimeMs(c.get('tokenExp')),
|
|
67
|
+
);
|
|
68
|
+
try {
|
|
69
|
+
await closed;
|
|
70
|
+
} finally {
|
|
71
|
+
clearInterval(heartbeat);
|
|
72
|
+
clearTimeout(rotate);
|
|
73
|
+
stop();
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
router.put(
|
|
79
|
+
'/presence',
|
|
80
|
+
requireRole(UserRole.Reader),
|
|
81
|
+
zValidator('json', presenceSchema),
|
|
82
|
+
(c) => {
|
|
83
|
+
const { connectionId, sequence, cardKey, mode } = c.req.valid('json');
|
|
84
|
+
if (cardKey && !c.get('ws').cards.has(cardKey)) {
|
|
85
|
+
return c.json({ error: 'Card not found' }, 404);
|
|
86
|
+
}
|
|
87
|
+
const events = c.get('events');
|
|
88
|
+
const known = events.update(
|
|
89
|
+
connectionId,
|
|
90
|
+
c.get('user').id,
|
|
91
|
+
sequence,
|
|
92
|
+
cardKey,
|
|
93
|
+
mode,
|
|
94
|
+
);
|
|
95
|
+
if (!known) {
|
|
96
|
+
return c.json({ error: 'Presence connection not found' }, 404);
|
|
97
|
+
}
|
|
98
|
+
return c.body(null, 204);
|
|
99
|
+
},
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
export default router;
|