@kern0x1b/penstock-cli 26.11.0 → 26.11.2
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/THIRD-PARTY-NOTICES.md +16 -16
- package/dist/chunk-account-BaYNvO18.js +1 -0
- package/dist/{chunk-agentLaunch-D21uPuMr.js → chunk-agentLaunch-BnrpVME4.js} +1 -1
- package/dist/chunk-agentServe-BeOh1rjE.js +10 -0
- package/dist/chunk-agents-CZJoU2u2.js +1 -0
- package/dist/chunk-agentsMigrate-DnrqoXNz.js +2 -0
- package/dist/{chunk-analyze-BG-rlggA.js → chunk-analyze-ClE2LBCj.js} +1 -1
- package/dist/chunk-analyze-DgQqzEgb.js +1 -0
- package/dist/{chunk-analyzeFlow-2cYPgjh-.js → chunk-analyzeFlow-F2ZFmJhv.js} +1 -1
- package/dist/chunk-apiTemplates-Cl_z63FA.js +1 -0
- package/dist/{chunk-bot-DlhStBoG.js → chunk-bot-C2k8yaXA.js} +5 -5
- package/dist/chunk-cmmnFindings-DKpYqUZN.js +1 -0
- package/dist/{chunk-codeFactSet-LxSnQy8K.js → chunk-codeFactSet-DiAYqvbb.js} +1 -1
- package/dist/{chunk-codeIndex-N1gnP_sW.js → chunk-codeIndex-vStNh6Bm.js} +1 -1
- package/dist/chunk-codeLinks-BVpn4_Sr.js +1 -0
- package/dist/chunk-codeLinks-BrGduhsm.js +1 -0
- package/dist/chunk-command-8s6m3ZUw.js +5 -0
- package/dist/chunk-command-aMxPQdiV.js +1 -0
- package/dist/chunk-command-vH1_y5F0.js +1 -0
- package/dist/chunk-commands-B8YVT41b.js +5 -0
- package/dist/{chunk-commands-DcjlDt7B.js → chunk-commands-CJCSznbv.js} +1 -1
- package/dist/chunk-compose-BUJTvoFX.js +4 -0
- package/dist/chunk-connections-Drr67X9U.js +1 -0
- package/dist/chunk-connectors-DcMqy0u8.js +1 -0
- package/dist/chunk-convert-Ce1MZmsE.js +3 -0
- package/dist/chunk-convert-FkMnlxyi.js +1 -0
- package/dist/chunk-deploy-BHg8pB9x.js +1 -0
- package/dist/chunk-deploy-DZgCTgaY.js +6 -0
- package/dist/{chunk-diagrams-BukAOL0g.js → chunk-diagrams-CtGMGTa8.js} +1 -1
- package/dist/chunk-diff-9hjavV6V.js +1 -0
- package/dist/chunk-diff-Dp3fUALc.js +1 -0
- package/dist/chunk-dispatch-o-eqJb9Y.js +7 -0
- package/dist/chunk-dmnTests-BOxutoRs.js +1 -0
- package/dist/{chunk-dmnTests-ChwX1YVo.js → chunk-dmnTests-BzNA-u2k.js} +1 -1
- package/dist/{chunk-docs-D7yEDpa4.js → chunk-docs-B3C3pZpY.js} +17 -17
- package/dist/chunk-doctor-CRxbsAm7.js +1 -0
- package/dist/{chunk-editPreview-CC2vwhIW.js → chunk-editPreview-DCUnMkTU.js} +1 -1
- package/dist/chunk-evidence-ny_2ltVe.js +23 -0
- package/dist/{chunk-examples-0HkF-frb.js → chunk-examples-BG0lGXcZ.js} +9 -9
- package/dist/chunk-export-Blwjf23H.js +1 -0
- package/dist/chunk-export-kt3sBTZu.js +20 -0
- package/dist/{chunk-facts-DSVaURw5.js → chunk-facts-Dl5lLriU.js} +1 -1
- package/dist/chunk-failure-BRyRvObj.js +1 -0
- package/dist/{chunk-file-BswMa3FN.js → chunk-file-1YhfNmPn.js} +1 -1
- package/dist/chunk-import-Dh3az4BC.js +6 -0
- package/dist/chunk-importCommand-Dhikkmo0.js +1 -0
- package/dist/chunk-incident-LJe2-ohi.js +1 -0
- package/dist/chunk-init-D34Q4YA8.js +227 -0
- package/dist/chunk-lint-CnEhoYRB.js +1 -0
- package/dist/{chunk-lsp-7vA_mIt1.js → chunk-lsp-BzeJkpmf.js} +1 -1
- package/dist/chunk-main-BZF-ErAx.js +1 -0
- package/dist/chunk-mcp-B_B9bet5.js +95 -0
- package/dist/{chunk-mcpLaunch-LyfmIF_Z.js → chunk-mcpLaunch-BS709697.js} +1 -1
- package/dist/chunk-migrate-DVfXC-iJ.js +1 -0
- package/dist/chunk-migrate-DwWg0k5_.js +16 -0
- package/dist/{chunk-migrateApply-CzOkgKhB.js → chunk-migrateApply-e8O9oZXP.js} +3 -3
- package/dist/chunk-migrateVerify-oIBf-PM3.js +1 -0
- package/dist/{chunk-model-f8AzYUK7.js → chunk-model-BulEKnY1.js} +2 -2
- package/dist/{chunk-parse-B-uKGDy-.js → chunk-parse-DiOcpdOU.js} +1 -1
- package/dist/{chunk-penstockCli-CKMvaZ0O.js → chunk-penstockCli-C41P_G7i.js} +1 -1
- package/dist/chunk-policy-BVb7c7G_.js +1 -0
- package/dist/chunk-policyGate-BOgKsqLq.js +2 -0
- package/dist/chunk-pr-1jKcTNnP.js +1 -0
- package/dist/{chunk-project-DBYOlYRi.js → chunk-project-COaBZhMt.js} +1 -1
- package/dist/chunk-project-lO_6DX8G.js +1 -0
- package/dist/chunk-promotion-CTMPjXjZ.js +2 -0
- package/dist/chunk-promotion-DDLrgBqZ.js +1 -0
- package/dist/{chunk-promotion-DchO6xoC.js → chunk-promotion-NeRj4uTP.js} +1 -1
- package/dist/chunk-receipt-C4NqnSkH.js +1 -0
- package/dist/chunk-receiptDeps-B7MehyHT.js +1 -0
- package/dist/chunk-receiptGate-BZCKCMTV.js +1 -0
- package/dist/chunk-receiptGate-DRcw327y.js +1 -0
- package/dist/{chunk-receiptSnapshot-B6ruXw8z.js → chunk-receiptSnapshot-CHSk3_4N.js} +1 -1
- package/dist/{chunk-receiptStore-Cy-L0H1u.js → chunk-receiptStore-DhROtI2h.js} +1 -1
- package/dist/chunk-refactor-CO3qyIEv.js +17 -0
- package/dist/chunk-refactor-CWeCOl7w.js +1 -0
- package/dist/{chunk-render-Ci5d6mg4.js → chunk-render-DZd5hScS.js} +1 -1
- package/dist/chunk-report-w7YZwhyg.js +1 -0
- package/dist/chunk-review-DYMgFDSy.js +1 -0
- package/dist/chunk-say-CP1IyOSv.js +1 -0
- package/dist/{chunk-security-VgKwtohm.js → chunk-security-pgip-kdY.js} +2 -2
- package/dist/chunk-serve-CKt2rO05.js +10 -0
- package/dist/{chunk-share-CBV2FuKq.js → chunk-share-rsL0itIM.js} +18 -18
- package/dist/chunk-stages-B2sBBxUc.js +3 -0
- package/dist/chunk-systemError-O3vQ8hLb.js +1 -0
- package/dist/chunk-systemError-n2E6isvg.js +1 -0
- package/dist/chunk-taskTest-DWoME1mY.js +2 -0
- package/dist/chunk-taskTest-JErgWO6t.js +1 -0
- package/dist/{chunk-templateDiagnostics-BwH7RNkz.js → chunk-templateDiagnostics-6txfKwas.js} +2 -2
- package/dist/chunk-templates-Y3xfCO_3.js +1 -0
- package/dist/chunk-testCases-BwimUfDC.js +4 -0
- package/dist/chunk-testCases-DO2Rkyvd.js +1 -0
- package/dist/chunk-tests-Cy325OGw.js +1 -0
- package/dist/chunk-tests-DNkORsqB.js +23 -0
- package/dist/{chunk-trust-DXcsUJaK.js → chunk-trust-DSX-k3by.js} +1 -1
- package/dist/{chunk-trust-DubjEjlN.js → chunk-trust-Di4EYPah.js} +1 -1
- package/dist/{chunk-variableChecks-KnECGMR3.js → chunk-variableChecks-CBDpmI4d.js} +1 -1
- package/dist/{chunk-workerVariables-CajAcbwl.js → chunk-workerVariables-CNnCRijJ.js} +1 -1
- package/dist/{chunk-workerVariables-DIDoUpHF.js → chunk-workerVariables-CulLc3YH.js} +1 -1
- package/dist/chunk-wrapper-CGYED7G2.js +1 -0
- package/dist/chunk-wrapper-CK7Xtes6.js +3 -0
- package/dist/grammars/web-tree-sitter.wasm +0 -0
- package/dist/penstock.js +1 -1
- package/dist/web/assets/{AgentSettings-Cn5Vcph3.js → AgentSettings-D24jOuht.js} +1 -1
- package/dist/web/assets/{AgentsDialog-C6WqzlxZ.js → AgentsDialog-BMWv3Gyk.js} +1 -1
- package/dist/web/assets/{AgentsDialog-dpbwVSxk.js → AgentsDialog-DbY2O6O5.js} +1 -1
- package/dist/web/assets/{AgentsTab-C34OhVkw.js → AgentsTab-D6LbK6sG.js} +2 -2
- package/dist/web/assets/{BpmnCanvas-yur9daZa.js → BpmnCanvas-BcQRQ2Br.js} +27 -27
- package/dist/web/assets/BpmnDocument-Ce5F4K1e.js +27 -0
- package/dist/web/assets/CmmnDocument-C_UlPowC.js +17 -0
- package/dist/web/assets/{ConflictDialog-Bb5kduaR.js → ConflictDialog-DfFp8F7n.js} +1 -1
- package/dist/web/assets/{ConnectionsDialog-qtF7yDFw.js → ConnectionsDialog-BaYtHD5h.js} +1 -1
- package/dist/web/assets/{DiffDocument-LHOif5Ac.js → DiffDocument-BOPdBEN3.js} +1 -1
- package/dist/web/assets/{DmnDocument-0f5uS67x.css → DmnDocument-DZ9u2uk2.css} +1 -1
- package/dist/web/assets/DmnDocument-vtnARy7Q.js +41 -0
- package/dist/web/assets/{DriftDialog-Chl6BX6k.js → DriftDialog-dIbCbSK2.js} +1 -1
- package/dist/web/assets/FormDocument-B0q8DF9v.css +1 -0
- package/dist/web/assets/FormDocument-DHBUBUzO.js +32 -0
- package/dist/web/assets/FormStepView-CbHb32_8.js +1 -0
- package/dist/web/assets/{GraphAwareLayoutService-wsos3yPD.js → GraphAwareLayoutService-C5N8K9dm.js} +1 -1
- package/dist/web/assets/{MigrationDialog-CBJU7Oe3.js → MigrationDialog-DA3Vrzgw.js} +1 -1
- package/dist/web/assets/{NewFileDialog-B7075LWG.js → NewFileDialog-Dev41oA1.js} +1 -1
- package/dist/web/assets/PolicyDialog-qR19Csji.js +1 -0
- package/dist/web/assets/{QuickOpen-DJQrI7Od.js → QuickOpen-ps-rMjiS.js} +1 -1
- package/dist/web/assets/ScriptPane-BQLMNYzc.js +2 -0
- package/dist/web/assets/{ScriptRunDialog-BwE4cXnp.js → ScriptRunDialog-YivjHB6j.js} +1 -1
- package/dist/web/assets/{SettingsDialog-c307wPsg.js → SettingsDialog-DI0vZ6Ay.js} +1 -1
- package/dist/web/assets/ShortcutsDialog-DLXnv4Vm.js +1 -0
- package/dist/web/assets/SourceDocument-Cj8cGsoS.js +1 -0
- package/dist/web/assets/TemplateDocument-BRyFsofH.js +7 -0
- package/dist/web/assets/TextDocument-DB2hEuMA.js +1 -0
- package/dist/web/assets/{UnreadableFileLayer-CUP_30X8.js → UnreadableFileLayer-CRW3MM7w.js} +1 -1
- package/dist/web/assets/{UploadDialog-CaVBOxUL.js → UploadDialog-D-X6GG98.js} +1 -1
- package/dist/web/assets/Viewer-BcpDlvg_.js +4 -0
- package/dist/web/assets/apply-Nsj6ek02.js +1 -0
- package/dist/web/assets/{bpmnTheme-CZ7xp4R5.js → bpmnTheme-pKgl9Mrn.js} +2 -2
- package/dist/web/assets/{data-ZauKnQ2Z.js → data-CdiToGOq.js} +2 -2
- package/dist/web/assets/{data-Da5Nxzev.js → data-wU6sw6RY.js} +1 -1
- package/dist/web/assets/{dialog-DSLu1Bbo.js → dialog-BDJ5dDiU.js} +1 -1
- package/dist/web/assets/{diff-C4hitkRR.js → diff-BhYqTg4l.js} +1 -1
- package/dist/web/assets/dist-27z6Phtg.js +23 -0
- package/dist/web/assets/{dist-CofBTWz1.js → dist-B7TL-7R3.js} +4 -4
- package/dist/web/assets/dist-BEpeEbIu.js +1 -0
- package/dist/web/assets/{dist-CYCbBoYQ.js → dist-BTf7NfeQ.js} +1 -1
- package/dist/web/assets/{dist-CJKVV2_S.js → dist-BqGv7f4M.js} +10 -10
- package/dist/web/assets/dist-C-q1IWjr.js +6 -0
- package/dist/web/assets/{dist-Blylfrak.js → dist-CJx_2eBF.js} +2 -2
- package/dist/web/assets/dist-COUY_jv5.js +1 -0
- package/dist/web/assets/{dist-DpDu6Wz_.js → dist-CWjAtsKe.js} +1 -1
- package/dist/web/assets/{dist-gb3IfUZi.js → dist-Cv8_A_95.js} +2 -2
- package/dist/web/assets/dist-DDE6BjgI.js +5 -0
- package/dist/web/assets/{dist-7VC_hKpw.js → dist-DDNYYQtV.js} +1 -1
- package/dist/web/assets/dist-DW-S9iZN.js +1 -0
- package/dist/web/assets/dist-OnU5n5o1.js +1 -0
- package/dist/web/assets/dmn-Cgoh6wXm.js +3 -0
- package/dist/web/assets/{documentBridge-1Eg7H9yI.js → documentBridge-CHw4XsZH.js} +3 -3
- package/dist/web/assets/{documents-LG-7CTrn.js → documents-CEtohzAC.js} +1 -1
- package/dist/web/assets/duplicate-D_ic-m62.js +342 -0
- package/dist/web/assets/{engines-DhO6OW1S.js → engines-lyEvb0pH.js} +1 -1
- package/dist/web/assets/{executable-BTarDLry.js → executable--4381_Lf.js} +1 -1
- package/dist/web/assets/{file-CIeVSOHy.js → file-BbVBUuIH.js} +1 -1
- package/dist/web/assets/formChecks-CSClH9sH.js +1 -0
- package/dist/web/assets/frontend-uXAWaalt.js +1 -0
- package/dist/web/assets/{httpHost-DBSjdVth.js → httpHost-C973OTRe.js} +1 -1
- package/dist/web/assets/{index.es-pigASDxC.js → index.es-CMvq8Bhe.js} +3 -3
- package/dist/web/assets/index.es-GbdJvMnO.js +78 -0
- package/dist/web/assets/{index.esm-CTLpq4ik.js → index.esm-Ba6q0zSu.js} +1 -1
- package/dist/web/assets/{intelligence-_1C71hkQ.js → intelligence-DNqJNmdB.js} +3 -3
- package/dist/web/assets/{jspdf.es.min-PgZzOmkT.js → jspdf.es.min-C0L4zezU.js} +6 -6
- package/dist/web/assets/{kind-X3_nabTt.js → kind-DDHnk6dW.js} +1 -1
- package/dist/web/assets/{lib-BmLAen_d.js → lib-DrkEMJ65.js} +1 -1
- package/dist/web/assets/{list-DovB9lWV.js → list-TmXvCwja.js} +1 -1
- package/dist/web/assets/{migrationHost-BcguK4K5.js → migrationHost-DCWBb3L6.js} +1 -1
- package/dist/web/assets/moddle-f0Q4Guwd.js +1 -0
- package/dist/web/assets/{model--Bj28IOj.js → model-afHgSxJs.js} +1 -1
- package/dist/web/assets/{nudges-UF9_cBuO.js → nudges-DPG3WpyV.js} +1 -1
- package/dist/web/assets/{open-C9Kt9JLw.js → open-Vkx72dYx.js} +1 -1
- package/dist/web/assets/platform-G53Cenyw.js +2 -0
- package/dist/web/assets/{preload-helper-VRuDKI9K.js → preload-helper-DExCAR_V.js} +1 -1
- package/dist/web/assets/{run-BZgz1U9U.js → run-BMfRBe5O.js} +1 -1
- package/dist/web/assets/samples-BL3jA_Vd.js +1 -0
- package/dist/web/assets/{say-WvEHqIbO.js → say-BkdZMivA.js} +1 -1
- package/dist/web/assets/{say-ChFGKK2E.js → say-C7KqKcFr.js} +1 -1
- package/dist/web/assets/{sections-N6WYk7b8.js → sections-LJKSRDTS.js} +1 -1
- package/dist/web/assets/sharedReader-BsXfiBT8.js +1 -0
- package/dist/web/assets/{source-frame-DcptKpVq.js → source-frame-DC4W0A5-.js} +2 -2
- package/dist/web/assets/{syntax-DW10Wzg4.js → syntax-00Hk6Xv7.js} +4 -4
- package/dist/web/assets/{template-CMl68jPp.js → template-BQP7ZXdK.js} +1 -1
- package/dist/web/assets/testCaseRuns-liAhWMg7.js +1 -0
- package/dist/web/assets/{trace-DLziNpe2.js → trace-DXQU2N_l.js} +1 -1
- package/dist/web/assets/{translator-DLDFsUlE.js → translator-BLCeE6UY.js} +1 -1
- package/dist/web/assets/ui-BLtm3Y1J.js +1 -0
- package/dist/web/assets/{useTrace-UYBskc2k.js → useTrace-dZdQ805W.js} +1 -1
- package/dist/web/assets/web-C4k0NLZ9.js +982 -0
- package/dist/web/assets/web-CnDpD6qy.css +1 -0
- package/dist/web/assets/{workerVariables-DURgyUbG.js → workerVariables-O6VqwDzr.js} +1 -1
- package/dist/web/assets/xml-DIWt4von.js +1 -0
- package/dist/web/index.html +39 -40
- package/package.json +5 -5
- package/dist/chunk-account-CpZu-RTg.js +0 -1
- package/dist/chunk-agentServe-BYRtgGGD.js +0 -10
- package/dist/chunk-agents-B9oxdPTA.js +0 -1
- package/dist/chunk-agentsMigrate-BV8TeRXq.js +0 -2
- package/dist/chunk-analyze-pgzR-Cx-.js +0 -1
- package/dist/chunk-apiTemplates-cU7C8vap.js +0 -1
- package/dist/chunk-cmmnFindings-S2TGSnEp.js +0 -1
- package/dist/chunk-codeLinks-C8N6e8k3.js +0 -1
- package/dist/chunk-codeLinks-o0a8tBGk.js +0 -1
- package/dist/chunk-command-Bqlbgo-2.js +0 -1
- package/dist/chunk-command-DT84ioJb.js +0 -5
- package/dist/chunk-command-DrGP2kg8.js +0 -1
- package/dist/chunk-commands-B4PoZbpX.js +0 -5
- package/dist/chunk-compose-CWKKVtN5.js +0 -4
- package/dist/chunk-connections-DQpKbIGD.js +0 -1
- package/dist/chunk-connectors-PtAvE91B.js +0 -1
- package/dist/chunk-convert-CpgtOlZk.js +0 -1
- package/dist/chunk-convert-HbFpg8ab.js +0 -3
- package/dist/chunk-deploy-l4MdFfn8.js +0 -6
- package/dist/chunk-deploy-qRaaKGZb.js +0 -1
- package/dist/chunk-diff-BhTFlCE3.js +0 -1
- package/dist/chunk-diff-kBF83vzM.js +0 -1
- package/dist/chunk-dispatch-BnO-QhMh.js +0 -7
- package/dist/chunk-dmnTests-0x_yUH6S.js +0 -1
- package/dist/chunk-doctor-BuHK1dTm.js +0 -1
- package/dist/chunk-evidence-oLw_C6j8.js +0 -23
- package/dist/chunk-export-cIFHDXug.js +0 -1
- package/dist/chunk-export-jBVxtmCH.js +0 -20
- package/dist/chunk-failure-D5brrYW2.js +0 -1
- package/dist/chunk-import-BBOe-5RZ.js +0 -6
- package/dist/chunk-importCommand-DRjYoljA.js +0 -1
- package/dist/chunk-incident-BK1h37CD.js +0 -1
- package/dist/chunk-init-_OALJuKm.js +0 -227
- package/dist/chunk-lint-7KJFxyCN.js +0 -1
- package/dist/chunk-main-Cw2JXCil.js +0 -1
- package/dist/chunk-mcp-K63bhqnF.js +0 -95
- package/dist/chunk-migrate-BMwBV5sc.js +0 -16
- package/dist/chunk-migrate-CxfVmKt0.js +0 -1
- package/dist/chunk-migrateVerify-DSEXSpfR.js +0 -1
- package/dist/chunk-policy-BX0Ftdws.js +0 -1
- package/dist/chunk-policyGate-dmcufnwB.js +0 -2
- package/dist/chunk-pr-ByrGcfam.js +0 -1
- package/dist/chunk-project-DA3KnAZH.js +0 -1
- package/dist/chunk-promotion-Boedyq43.js +0 -1
- package/dist/chunk-promotion-D8Ti-vxp.js +0 -2
- package/dist/chunk-receipt-CusJaqNn.js +0 -1
- package/dist/chunk-receiptDeps-oVbX156d.js +0 -1
- package/dist/chunk-receiptGate-DrGChj7i.js +0 -1
- package/dist/chunk-receiptGate-xldHKMyJ.js +0 -1
- package/dist/chunk-refactor-B1W_MGTp.js +0 -1
- package/dist/chunk-refactor-BJXxEtVs.js +0 -17
- package/dist/chunk-report-D9pM09Nu.js +0 -1
- package/dist/chunk-review-UcqS5AAi.js +0 -1
- package/dist/chunk-say-CYb4HeJD.js +0 -1
- package/dist/chunk-serve-Dmqen1yd.js +0 -10
- package/dist/chunk-stages-BTQJrAMF.js +0 -3
- package/dist/chunk-systemError-BYrMzp2o.js +0 -1
- package/dist/chunk-systemError-CXvnhNPK.js +0 -1
- package/dist/chunk-taskTest-9gMsx0zu.js +0 -2
- package/dist/chunk-taskTest-BjXYpG5p.js +0 -1
- package/dist/chunk-templates-D3ouIwHD.js +0 -1
- package/dist/chunk-testCases-9jwT_Y7z.js +0 -4
- package/dist/chunk-testCases-BcpBPg9L.js +0 -1
- package/dist/chunk-tests-CEEXnWOp.js +0 -23
- package/dist/chunk-tests-CRVosdWp.js +0 -1
- package/dist/chunk-wrapper-B2WnOIoB.js +0 -3
- package/dist/chunk-wrapper-DiKCKZti.js +0 -1
- package/dist/web/assets/BpmnDocument-C247Rqim.js +0 -27
- package/dist/web/assets/CmmnDocument-Dj48bsUd.js +0 -17
- package/dist/web/assets/DmnDocument-Cb9Zi9fS.js +0 -41
- package/dist/web/assets/FormDocument-DoZaxWd-.js +0 -32
- package/dist/web/assets/FormDocument-URLcKn84.css +0 -1
- package/dist/web/assets/FormStepView-D8MFcpeI.js +0 -1
- package/dist/web/assets/PolicyDialog-CGdglmDn.js +0 -1
- package/dist/web/assets/ScriptPane-T6M5f6fc.js +0 -2
- package/dist/web/assets/ShortcutsDialog-BAoL9EHu.js +0 -1
- package/dist/web/assets/SourceDocument-C9KIzBA5.js +0 -1
- package/dist/web/assets/TemplateDocument-CNt2turg.js +0 -7
- package/dist/web/assets/TextDocument-CtkHoEqN.js +0 -1
- package/dist/web/assets/Viewer-DZske1C5.js +0 -4
- package/dist/web/assets/apply-nnKP9HIM.js +0 -1
- package/dist/web/assets/dist--PmHUHDp.js +0 -1
- package/dist/web/assets/dist-BoPrKCf2.js +0 -5
- package/dist/web/assets/dist-C1m02xAO.js +0 -1
- package/dist/web/assets/dist-CLqJMzT-.js +0 -1
- package/dist/web/assets/dist-D3jqq0XS.js +0 -1
- package/dist/web/assets/dist-DA-9F0U9.js +0 -1
- package/dist/web/assets/dist-DojzF5q2.js +0 -6
- package/dist/web/assets/dist-yvjzrXXf.js +0 -23
- package/dist/web/assets/dmn-DwdcYXGr.js +0 -3
- package/dist/web/assets/duplicate-D-ilQqKz.js +0 -342
- package/dist/web/assets/formChecks-CGox1z7R.js +0 -1
- package/dist/web/assets/frontend-Qq5hBH0U.js +0 -1
- package/dist/web/assets/index.es-CcNNw3VB.js +0 -78
- package/dist/web/assets/moddle-DJxj0oEU.js +0 -1
- package/dist/web/assets/platform-BLPhsye9.js +0 -2
- package/dist/web/assets/samples-oeXBsJ9Y.js +0 -1
- package/dist/web/assets/sharedReader-Bopy7Uk9.js +0 -1
- package/dist/web/assets/testCaseRuns-B_XdqGFh.js +0 -1
- package/dist/web/assets/ui-BTKMbWYG.js +0 -1
- package/dist/web/assets/web-FzNBw1kZ.css +0 -1
- package/dist/web/assets/web-jPMZVwbQ.js +0 -982
- package/dist/web/assets/xml-DTgZ-B-l.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./chunk-atomicWrite-C6J1gDtO.js";import{r as t}from"./chunk-context-rCJvBM9p.js";import{a as n,c as r,d as i,f as a,h as o,i as s,l as c,m as l,n as u,o as d,p as f,s as p,t as m,u as h}from"./chunk-editPreview-DCUnMkTU.js";import{n as g}from"./chunk-placeholderLayout-B18ekWmh.js";import{t as _}from"./chunk-diff-Dp3fUALc.js";import{n as v}from"./chunk-drawing-MbILUK8j.js";import{a as y,s as b}from"./chunk-diagram-N1chbom5.js";import{f as x,l as S}from"./chunk-moddle-D3Ym38EZ.js";import{y as C}from"./chunk-engine-CxgdJ2wO.js";import{r as w}from"./chunk-translator-DNm9zRpP.js";import{t as T}from"./chunk-table-BOiaGWwY.js";import{t as E}from"./chunk-plural-Dn-7ulHf.js";import{createRequire as D}from"node:module";import O from"node:path";import{tmpdir as k}from"node:os";import{mkdtempSync as A,readFileSync as j,rmSync as M,writeFileSync as N}from"node:fs";const P=D(import.meta.url),F={camunda:JSON.parse(j(P.resolve(`camunda-bpmn-moddle/resources/camunda.json`),`utf8`)),operaton:x,zeebe:JSON.parse(j(P.resolve(`zeebe-bpmn-moddle/resources/zeebe.json`),`utf8`)),flowable:S(`flowable`),activiti:S(`activiti`)},I=/^bpmn:(\w*Task|CallActivity|\w*Gateway|(Start|End|IntermediateCatch|IntermediateThrow)Event)$/;var L=class e{modeler;container;engine;conventions;importWarnings=0;constructor(e,t,n,r){this.modeler=e,this.container=t,this.engine=n,this.conventions=r}static async open(t,n,r={}){let{window:i}=await v(`modeler`),a=i.document.createElement(`div`);i.document.body.appendChild(a);let o=i.BpmnJS,s=C(n),c=new o({container:a,moddleExtensions:s===`plain`?{}:{[s]:F[s]}}),l=new e(c,a,n,r),u=c.get(`graphicsFactory`);u.update=()=>{};let{warnings:d}=await c.importXML(t);return l.importWarnings=d.length,l}dispose(){this.modeler.destroy(),this.container.remove()}async save(){return`${(await this.modeler.saveXML({format:!0})).xml}\n`}get registry(){return this.modeler.get(`elementRegistry`)}get modeling(){return this.modeler.get(`modeling`)}get moddle(){return this.modeler.get(`moddle`)}get properties(){return{modeling:this.modeling,moddle:this.moddle}}element(e){let t=this.registry.get(e);if(!t||t.type===`label`)throw new d(w(`app.cli.edit.noSuchElement`,{id:e}));return t}async apply(e,t){switch(e.op){case`add`:return this.add(e,t);case`connect`:return this.connect(e);case`set`:{let t=this.element(e.id);return n(this.properties,this.engine,t,e.properties),w(`app.cli.edit.set`,{keys:Object.keys(e.properties).join(`, `),id:t.id})}case`remove`:{let t=this.element(e.id);if(t.type===`bpmn:Process`||t.type===`bpmn:Collaboration`)throw new d(w(`app.cli.edit.isTheRoot`,{id:t.id}));return this.modeling.removeElements([t]),w(`app.cli.edit.removed`,{id:t.id})}case`move`:{let t=this.element(e.id);if(t.waypoints)throw new d(w(`app.cli.edit.isAConnection`,{id:t.id}));return this.modeling.moveElements([t],{x:e.dx,y:e.dy}),w(`app.cli.edit.moved`,{id:t.id,dx:e.dx,dy:e.dy})}}}add(e,t){let i=this.element(e.after);if(i.waypoints)throw new d(w(`app.cli.edit.isAConnection`,{id:i.id}));if(i.type===`bpmn:EndEvent`)throw new d(w(`app.cli.edit.afterEndEvent`,{id:i.id}));if(i.type===`bpmn:Participant`||i.type===`bpmn:Lane`)throw new d(w(`app.cli.edit.addAfterAnElementInside`,{id:i.id,type:l(i)}));let o=p[e.element].type,s=this.idFor(o,e.id,e.name),c=this.place(i,()=>this.modeler.get(`elementFactory`).createShape({type:o,businessObject:this.modeler.get(`bpmnFactory`).create(o,s?{id:s}:{}),...e.event?{eventDefinitionType:r[e.event]}:{}}),t),u=a(this.conventions,c.businessObject.$type);return Object.keys(u).length>0&&this.modeling.updateProperties(c,u),e.name&&this.modeling.updateProperties(c,{name:e.name}),e.properties&&n(this.properties,this.engine,c,e.properties),w(`app.cli.edit.added`,{type:l(c),id:c.id,after:i.id})}place(e,t,n){let r=this.modeler.get(`commandStack`),i=new Set(this.registry.getAll().map(e=>e.id)),a=this.modeler.get(`autoPlace`).append(e,t());if(!n)return a;let o=t=>{let n=Math.min(e.x,t.x)-160,r=Math.min(e.y,t.y)-160,i=Math.max(e.x+e.width,t.x+t.width)+160,a=Math.max(e.y+e.height,t.y+t.height)+160;return{x:n,y:r,width:i-n,height:a-r}},s=e=>n(y(this.modeler.getDefinitions(),this.moddle,e,i)),c=o(a),l=s(c);if(l<=0)return a;if(r.undo(),l-s(c)<=0)return r.redo(),a;let u=a.width,d=a.height,f=e.x+e.width+80+u/2,p=e.y+e.height/2,m=[];for(let e of[0,1,2,3,4])for(let t of[1,-1,2,-2,3,-3,4,-4,0])(e!==0||t!==0)&&m.push([f+e*(u+60),p+t*(d+60)]);let h=I.test(a.type)?this.registry.filter(t=>t.parent===e.parent&&!t.waypoints&&I.test(t.type)):[],g=e=>{let t={x:e[0]-u/2,y:e[1]-d/2,width:u,height:d};return h.filter(e=>b(t,e)).length},_={position:null,route:0,extra:1/0};for(let n of m){if(g(n)*1e3>=_.extra)continue;let i=o({x:n[0]-u/2,y:n[1]-d/2,width:u,height:d}),a=s(i),c=this.modeling.appendShape(e,t(),{x:n[0],y:n[1]},e.parent),l=c.incoming[0];for(let[t,o]of[null,...this.routes(e,c)].entries()){o&&this.modeling.updateWaypoints(l,o);let e=s(i)-a;if(e<=0)return c;e<_.extra&&(_={position:n,route:t,extra:e}),o&&r.undo()}r.undo()}if(!_.position)return this.modeler.get(`autoPlace`).append(e,t());let v=this.modeling.appendShape(e,t(),{x:_.position[0],y:_.position[1]},e.parent),x=_.route>0?this.routes(e,v)[_.route-1]:null;return x&&this.modeling.updateWaypoints(v.incoming[0],x),v}routes(e,t){let n={x:e.x+e.width/2,y:e.y+e.height/2},r={x:t.x+t.width/2,y:t.y+t.height/2},i=r.y>n.y,a=[{x:n.x,y:i?e.y+e.height:e.y},{x:n.x,y:r.y},{x:t.x,y:r.y}],o=[{x:e.x+e.width,y:n.y},{x:r.x,y:n.y},{x:r.x,y:i?t.y:t.y+t.height}],s=e.x+e.width,c=[{x:s,y:n.y},{x:s+20,y:n.y},{x:s+20,y:r.y},{x:t.x,y:r.y}],l=[{x:s,y:n.y},{x:t.x-20,y:n.y},{x:t.x-20,y:r.y},{x:t.x,y:r.y}];return n.y===r.y?[]:[c,a,o,l]}idFor(e,t,n){let r=e=>!!this.registry.get(e);if(t){if(r(t))throw new d(w(`app.cli.edit.idTaken`,{id:t}));return t}let i=n&&this.conventions.ids?f({$type:e},n,this.conventions.ids):null;return i?o(i,r):void 0}connect(e){let t=this.element(e.from),r=this.element(e.to),i=this.modeler.get(`bpmnRules`).canConnect(t,r);if(!i||i.type!==`bpmn:SequenceFlow`)throw new d(w(`app.cli.edit.noSequenceFlow`,{from:t.id,to:r.id}));let a=this.modeling.connect(t,r,{type:`bpmn:SequenceFlow`});return e.name&&this.modeling.updateProperties(a,{name:e.name}),e.condition&&n(this.properties,this.engine,a,{condition:e.condition}),w(`app.cli.edit.connect`,{from:t.id,to:r.id,id:a.id})}describe(){return this.registry.getAll().filter(e=>e.type!==`label`&&e.businessObject&&e.parent).map(e=>{let t=e.businessObject,n={id:e.id,type:l(e),name:t.name||void 0,parent:e.parent?.parent?e.parent.id:void 0,incoming:(e.incoming??[]).map(e=>e.id),outgoing:(e.outgoing??[]).map(e=>e.id),properties:s(t,this.engine)};return e.waypoints&&(n.source=e.source?.id,n.target=e.target?.id),n})}};const R=[`LOST-CONNECTION`,`SEMANTIC-DRIFT`,`BACKTRACK`,`CONTAINMENT`,`OVERLAP`,`EDGE-THROUGH-NODE`,`DETACHED-EDGE`,`LABEL-OVERLAP`,`DANGLING-CONNECTION`,`BOUNDARY-OFF-HOST`],z=e=>R.includes(e.slice(0,e.indexOf(`:`)));async function B(e){let t=A(O.join(k(),`penstock-edit-`));try{let n=O.join(t,`diagram.bpmn`);N(n,e);let{measureDiagram:r}=await import(`./chunk-diagram-jfVu0sT3.js`);return(await r(n,{asAuthored:!0})).defects.map(e=>`${e.kind}: ${e.detail}`)}finally{M(t,{recursive:!0,force:!0})}}async function V(e,t){let n=A(O.join(k(),`penstock-edit-`));try{return N(O.join(n,`before.bpmn`),e),N(O.join(n,`after.bpmn`),t),(await _(O.join(n,`before.bpmn`),O.join(n,`after.bpmn`),!0)).summary?.lines??[]}finally{M(n,{recursive:!0,force:!0})}}async function H(n,r,a={}){let o=j(n,`utf8`),s=u(n,o),c;try{c=i(r,s)}catch(e){return{ok:!1,applied:[],lines:[e instanceof Error?e.message:String(e),w(`app.cli.nothingWritten`)]}}let l=new Set(await B(o)),f=e=>{let t=e.filter(e=>!l.has(e));return t.filter(z).length*1e3+t.filter(e=>!z(e)).length},p=await L.open(o,s,m(n)),h=[],g;try{for(let e of c)h.push(await p.apply(e,f));g=await p.save()}catch(e){let t=e instanceof d?e.message:w(`app.cli.edit.editorRefused`,{reason:e instanceof Error?e.message:String(e)});return{ok:!1,applied:[],lines:[w(`app.cli.edit.operationFailed`,{number:h.length+1,message:t}),w(`app.cli.nothingWritten`)]}}finally{p.dispose()}let _=await L.open(g,s),v=_.importWarnings;_.dispose();let y=await L.open(o,s),b=y.importWarnings;if(y.dispose(),v>b)return{ok:!1,applied:h,lines:[w(`app.cli.edit.didNotReadBack`),w(`app.cli.nothingWritten`)]};let x=(await B(g)).filter(e=>!l.has(e)),S=x.filter(z),C=x.filter(e=>!z(e)),T=S.length>0&&!a.force;if(!a.dryRun&&!T){if(j(n,`utf8`)!==o)return{ok:!1,applied:h,lines:[w(`app.cli.edit.changedWhileEditing`),w(`app.cli.nothingWritten`)]};e(n,g)}let D=[...h,``,...(await V(o,g)).map(e=>` ${e}`),``,S.length===0?w(`app.cli.edit.nothingBroken`):w(`app.cli.edit.breaksTheDrawing`,{problems:E(S.length,`app.cli.edit.count.newProblem`)}),...S.map(e=>` ${e}`),...C.length>0?[w(`app.cli.edit.readsLessWell`,{things:E(C.length,`app.cli.edit.count.thing`)}),...C.map(e=>` ${e}`)]:[],a.dryRun?w(`app.cli.edit.dryRun`,{file:t(n)}):w(T?`app.cli.edit.wouldBreak`:`app.cli.wrote`,{file:t(n)})];return{ok:!T,applied:h,xml:g,lines:D}}async function U(e){let t=j(e,`utf8`),n=u(e,t),r=await L.open(await g(t),n);try{return{engine:n,elements:r.describe()}}finally{r.dispose()}}async function W(e,n){let{engine:r,elements:i}=await U(e);if(n)return{ok:!0,lines:[JSON.stringify({file:t(e),engine:r,elements:i},null,2)]};let a=i.map(e=>({type:e.type,id:e.id,name:e.name??``,flow:e.source&&e.target?`${e.source} -> ${e.target}`:``})),o=T(a,{columns:[{name:`type`,header:w(`app.cli.header.type`),minWidth:16},{name:`id`,header:w(`app.cli.header.id`),minWidth:14},{name:`name`,header:w(`app.cli.header.name`)},{name:`flow`,header:w(`app.cli.header.flow`)}]});return{ok:!0,lines:[`${t(e)} (${r})`,``,...o]}}function G(e){let t=j(e,`utf8`);return{ok:!0,lines:[JSON.stringify(h(u(e,t)),null,2)]}}function K(e,t,n){let r=Object.hasOwn(c[e],t)?c[e][t].kind:void 0;return r===`boolean`?n===`true`||n!==`false`&&n:r===`integer`&&/^\d+$/.test(n)?Number(n):n}function q(e,t){return e.map(e=>{let n=e.indexOf(`=`);if(n<=0)throw new d(w(`app.cli.edit.mustLookLikePairs`,{where:t,entry:e}));return[e.slice(0,n),e.slice(n+1)]})}function J(e,t){let[n,...r]=t.words,i=()=>{let i=[...r.slice(n===`set`?1:r.length),...t.options(`set`)],a=Object.fromEntries(q(i,`--set`).map(([t,n])=>[t,K(e,t,n)])),o=q(t.options(`input`),`--input`),s=q(t.options(`output`),`--output`);return o.length>0&&(a.inputs=Object.fromEntries(o)),s.length>0&&(a.outputs=Object.fromEntries(s)),Object.keys(a).length>0?a:void 0},a=e=>Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0));switch(n){case`add`:return a({op:`add`,element:r[0],after:t.option(`after`),event:t.option(`event`),name:t.option(`name`),id:t.option(`id`),properties:i()});case`connect`:return a({op:`connect`,from:r[0],to:r[1],name:t.option(`name`),condition:t.option(`condition`)});case`set`:return{op:`set`,id:r[0],properties:i()??{}};case`remove`:return{op:`remove`,id:r[0]};default:throw new d(w(`app.cli.edit.sayWhatToDo`))}}export{G as a,J as i,H as n,W as o,U as r,R as t};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{r as e,t}from"./chunk-context-rCJvBM9p.js";import{t as n}from"./chunk-atomicWrite-C6J1gDtO.js";import{r,t as i}from"./chunk-unreadableDiagram-CcrctihL.js";import{r as a}from"./chunk-translator-DNm9zRpP.js";import{n as o,r as s,t as c}from"./chunk-report-w7YZwhyg.js";import{i as l,n as u,r as d}from"./chunk-docs-BVmrekiH.js";import{a as f,r as p,t as m}from"./chunk-model-BulEKnY1.js";import{a as h}from"./chunk-moddle-D3Ym38EZ.js";import{r as g,t as _}from"./chunk-say-CtmOlXtN.js";import{t as ee}from"./chunk-rules-Tds3uL4b.js";import{t as v}from"./chunk-table-BOiaGWwY.js";import{t as y}from"./chunk-plural-Dn-7ulHf.js";import{n as b,t as x}from"./chunk-status-CmYxwOCn.js";import{t as S}from"./chunk-placeholderLayout-B18ekWmh.js";import{a as C,n as w,r as te,s as T}from"./chunk-failure-BRyRvObj.js";import{t as E}from"./chunk-list-XuNpvC6j.js";import{a as D,c as O,i as ne}from"./chunk-codeLinks-BrGduhsm.js";import{t as re}from"./chunk-connections-D_wC6d0W.js";import{n as ie,r as ae,s as oe,t as se}from"./chunk-workerVariables-CulLc3YH.js";import{t as k}from"./chunk-buffers-B8jONhEB.js";import{i as ce,n as le,o as ue,r as de,s as fe,t as pe}from"./chunk-variableChecks-CBDpmI4d.js";import{f as me}from"./chunk-load-rfn3E0t5.js";import A from"node:path";import{tmpdir as he}from"node:os";import{existsSync as ge,mkdtempSync as _e,readFileSync as j,rmSync as ve}from"node:fs";const ye=`penstock-baseline.json`,be=`penstock-migration-baseline.json`;function xe(e){return e.replace(/\\/g,`/`)}function Se(e,t){return xe(A.isAbsolute(t)?A.relative(e,t):t)}function M(e,t,n=!1){return`${n?xe(t.file):Se(e,t.file)}::${t.rule}::${t.message}`}function Ce(e,t){let n;try{n=JSON.parse(j(e,`utf8`))}catch(e){throw Error(a(`app.output.notValid`,{file:t,what:`JSON`,reason:r(i(e))}))}let o=n?.findings;if(!Array.isArray(o))throw Error(a(`app.output.notValid`,{file:t,what:`baseline`,reason:`it has no list of findings.`}));return o.filter(e=>typeof e?.file==`string`&&typeof e.rule==`string`&&typeof e.message==`string`)}function N(e,t,n=ye){let r=A.join(e,n);if(!ge(r))return{fresh:t,known:[],fixed:[]};let i=Ce(r,n),a=new Set(i.map(t=>M(e,t,!0))),o=new Set(t.map(t=>M(e,t)));return{fresh:t.filter(t=>!a.has(M(e,t))),known:t.filter(t=>a.has(M(e,t))),fixed:[...a].filter(e=>!o.has(e))}}function we(e,t,r=ye){let i=A.join(e,r),a={generated:(/* @__PURE__ */ new Date()).toISOString(),findings:t.map(t=>({file:Se(e,t.file),rule:t.rule,message:t.message})).sort((e,t)=>`${e.file}${e.rule}${e.message}`.localeCompare(`${t.file}${t.rule}${t.message}`))};return n(i,`${JSON.stringify(a,null,2)}\n`),i}function Te(e,t){return t.map(t=>{let n=ie(t);return{file:A.join(e,t.file),rule:t.rule,message:ae(t),severity:t.severity,line:t.line,ruleId:`connections/${t.rule}`,docs:l(`connections/${t.rule}`),title:g(`connections`,t.rule),...n?{where:n}:{},...t.elementId?{elements:[t.elementId]}:{}}})}function Ee(e){let t=e.detail;switch(e.rule){case`no-model-call-limit`:return a(`app.agents.finding.noModelCallLimit`,{agent:t.agent});case`tool-without-description`:return a(`app.agents.finding.toolWithoutDescription`,{tool:t.tool,agent:t.agent});case`fromai-incomplete`:return a(`app.agents.finding.fromaiIncomplete.${t.missing}`,{parameter:t.parameter,tool:t.tool});case`tool-filter-matches-nothing`:return a(`app.agents.finding.filter.${t.reason}`,{client:t.client,scope:a(`app.agents.scope.${t.scope}`)});case`duplicate-tool-names`:return a(t.kind===`client`?`app.agents.finding.duplicateClient`:`app.agents.finding.duplicateTool`,{name:t.name,other:t.other,agent:t.agent});case`adhoc-without-agent`:return a(`app.agents.finding.adhocWithoutAgent`,{name:t.name});case`mcp-client-no-config`:return a(`app.agents.finding.mcpClientNoConfig`,{client:t.client,agent:t.agent});case`plain-text-secret`:return a(`app.agents.finding.plainTextSecret`,{field:t.field,agent:t.agent});case`deprecated-template`:return a(`app.agents.finding.deprecatedTemplate`,{agent:t.agent,version:t.version,replacement:t.replacement})}}const P=`io.camunda.connectors.agenticai.aiagent.v1`,F=`io.camunda.connectors.agenticai.aiagent.jobworker.v1`,De=`io.camunda.connectors.agenticai.ai-agent-task.v2`,Oe=`io.camunda.connectors.agenticai.ai-agent-subprocess.v2`,ke=/* @__PURE__ */ new Set([P,F]),Ae=/* @__PURE__ */ new Set([P,F,De,Oe]),je=/* @__PURE__ */ new Set([`io.camunda.connectors.agenticai.mcp.client.v0`,`io.camunda.connectors.agenticai.mcp.remoteclient.v0`]);function Me(e,t,n){let r=e===null?null:/^\s*(\d+)\.(\d+)/.exec(e);return!r||Number(r[1])*1e3+Number(r[2])>=t*1e3+n}function I(e,t,n,r,i={}){return{rule:e,severity:t,elementId:n,agentId:r,detail:i}}function Ne(e){let t=e.maxModelCalls;return t===null||t.trim()===``||t.trim()===`=`||t.trim()===`=null`}function Pe(e){if(e.included.kind!==`list`)return null;if(e.included.names.length===0)return`empty`;if(e.excluded.kind!==`list`)return null;let t=new Set(e.excluded.names);return e.included.names.every(e=>t.has(e))?`allExcluded`:null}function Fe(e,t){return e===null&&t===null?`both`:e===null?`description`:t===null?`type`:null}function Ie(e,t,n){let r=[];!t.remote&&t.clientId!==null&&n.mcpStatus?.(t.clientId)===`undefined`&&r.push(I(`mcp-client-no-config`,`error`,t.elementId,e.id,{client:t.clientId,name:t.name,agent:e.name}));for(let n of t.filters){let i=Pe(n);i!==null&&r.push(I(`tool-filter-matches-nothing`,`warning`,t.elementId,e.id,{client:t.name,scope:n.scope,reason:i}))}return r}function Le(e){return e.kind===`task`?De:Oe}function Re(e,t={}){let n=[];for(let r of e.agents){Ne(r)&&n.push(I(`no-model-call-limit`,`warning`,r.id,r.id,{agent:r.name})),r.legacyTemplate&&Me(e.platformVersion,8,10)&&n.push(I(`deprecated-template`,`warning`,r.id,r.id,{agent:r.name,template:r.template.id??``,version:String(r.template.version??``),replacement:Le(r)}));for(let e of r.credentials)e.plain&&n.push(I(`plain-text-secret`,`error`,r.id,r.id,{agent:r.name,field:e.target}));let i=/* @__PURE__ */ new Map;for(let e of r.tools){e.description===null&&n.push(I(`tool-without-description`,`warning`,e.id,r.id,{tool:e.name,agent:r.name}));let t=e.id.toLowerCase(),a=i.get(t);a===void 0?i.set(t,e.id):n.push(I(`duplicate-tool-names`,`warning`,e.id,r.id,{name:e.id,other:a,agent:r.name,kind:`tool`}));for(let t of e.parameters){let i=Fe(t.description,t.type);t.complete||i===null||n.push(I(`fromai-incomplete`,`warning`,e.id,r.id,{parameter:t.name,tool:e.name,missing:i}))}}let a=/* @__PURE__ */ new Map;for(let e of r.mcpClients)n.push(...Ie(r,e,t)),e.remote||e.clientId===null||(a.has(e.clientId)?n.push(I(`duplicate-tool-names`,`warning`,e.elementId,r.id,{name:e.clientId,other:a.get(e.clientId),agent:r.name,kind:`client`})):a.set(e.clientId,e.elementId))}for(let t of e.orphans)n.push(I(`adhoc-without-agent`,`warning`,t.id,null,{name:t.name}));return n}const ze={n:`
|
|
2
|
+
`,t:` `,r:`\r`,'"':`"`,"\\":`\\`,"'":`'`};function L(e){let t=e.trim().replace(/^=\s*/,``).trim();if(t.length<2||t[0]!==`"`||t[t.length-1]!==`"`)return null;let n=``;for(let e=1;e<t.length-1;e+=1){let r=t[e];if(r===`"`)return null;if(r===`\\`){if(e+=1,e>=t.length-1)return null;n+=ze[t[e]]??t[e]}else n+=r}return n}function R(e,t){let n=t+1;for(;n<e.length;)if(e[n]===`\\`)n+=2;else if(e[n]===`"`)return n+1;else n+=1;return-1}function Be(e,t){let n=[],r=0,i=t+1,a=t+1;for(;a<e.length;){let t=e[a];if(t===`"`){let t=R(e,a);if(t<0)return null;a=t}else{if(t===`(`||t===`[`||t===`{`)r+=1;else if(t===`)`||t===`]`||t===`}`){if(r===0)return t===`)`?(n.push(e.slice(i,a)),{args:n,end:a+1}):null;--r}else t===`,`&&r===0&&(n.push(e.slice(i,a)),i=a+1);a+=1}}return null}function Ve(e){let t=e.trim(),n=/^toolCall\.([\w.]+)$/.exec(t);return n?n[1]:t}function z(e){let t=(e??``).trim();return t!==``&&t!==`null`}function He(e){if(!z(e))return null;let t=L(e);return t===null?``:t.trim()===``?null:t}function Ue(e){if(!z(e))return null;let t=/(?:^|[{,\s])type\s*:\s*("(?:[^"\\]|\\.)*")/.exec(e);return t?L(t[1]):null}function We(e){let t=``,n=0;for(;n<e.length;)if(e[n]===`"`){let r=R(e,n);if(r<0)return t+e.slice(n);t+=e.slice(n,r).replace(/[^"]/g,` `),n=r}else t+=e[n],n+=1;return t}function B(e){let t=[],n=We(e),r=/\bfromAi\s*\(/g,i;for(;(i=r.exec(n))!==null;){let n=Be(e,i.index+i[0].length-1);if(!n)continue;let[a,o,s,c,l]=n.args,u=z(c);t.push({name:Ve(a??``),description:He(o),type:He(s)??(u?Ue(c):null),schema:u,options:z(l)}),r.lastIndex=n.end}return t}function Ge(e){let t=e.trim();if(!t.startsWith(`=`))return null;let n=t.slice(1).trim();if(n.length<2||n[0]!==`[`||n[n.length-1]!==`]`)return null;let r=n.slice(1,-1).trim();if(r===``)return[];let i=[],a=0;for(;a<r.length;){for(;r[a]===` `||r[a]===`
|
|
3
|
+
`||r[a]===` `||r[a]===`\r`;)a+=1;if(r[a]!==`"`)return null;let e=R(r,a);if(e<0)return null;let t=L(r.slice(a,e));if(t===null)return null;for(i.push(t),a=e;r[a]===` `||r[a]===`
|
|
4
|
+
`||r[a]===` `||r[a]===`\r`;)a+=1;if(a>=r.length)break;if(r[a]!==`,`)return null;a+=1}return i}function V(e,t){return e?.extensionElements?.values?.find(e=>e.$type===t)}function H(e){let t=/* @__PURE__ */ new Map;for(let n of V(e,`zeebe:IoMapping`)?.inputParameters??[])typeof n.target==`string`&&!t.has(n.target)&&t.set(n.target,typeof n.source==`string`?n.source:``);return t}function U(e){let t=e?.$attrs??{},n=e?.modelerTemplate??t[`zeebe:modelerTemplate`]??null,r=e?.modelerTemplateVersion??t[`zeebe:modelerTemplateVersion`],i=r==null||r===``?null:Number(r);return{id:typeof n==`string`?n:null,version:i!==null&&Number.isFinite(i)?i:null}}function W(e){let t=/* @__PURE__ */ new Map;for(let n of V(e,`zeebe:Properties`)?.properties??[])typeof n.name==`string`&&t.set(n.name,typeof n.value==`string`?n.value:``);return t}function Ke(e){let t=(e?.documentation??[]).map(e=>typeof e.text==`string`?e.text:``).join(`
|
|
5
|
+
`).trim();return t===``?null:t}function qe(e){return e===void 0||e.trim()===``?null:{source:e,text:L(e)}}function G(e){return e===void 0||e.trim()===``?null:e}function Je(e){return e.replace(/^bpmn:/,``)}function K(e,t,n,r,i){if(typeof e==`string`){e.includes(`fromAi`)&&n.push({text:e,where:t});return}if(typeof e!=`object`||!e||i>12||r.has(e))return;if(r.add(e),Array.isArray(e)){for(let a of e)K(a,t,n,r,i+1);return}let a=e,o=typeof a.target==`string`?a.target:typeof a.key==`string`?a.key:typeof a.name==`string`?a.name:t;for(let[e,t]of Object.entries(a))e.startsWith(`$`)||K(t,o,n,r,i+1)}function Ye(e){let t=[];K(e.extensionElements,``,t,/* @__PURE__ */ new WeakSet,0);let n=/* @__PURE__ */ new Map,r=[];for(let{text:e,where:i}of t)for(let t of B(e)){let e=t.description!==null&&t.type!==null,a={name:t.name,description:t.description,type:t.type,schema:t.schema,where:i,complete:e},o=n.get(t.name);o?(o.description===null&&a.description!==null&&(o.description=a.description),o.type===null&&a.type!==null&&(o.type=a.type),o.schema=o.schema||a.schema,o.complete=o.description!==null&&o.type!==null):(n.set(t.name,a),r.push(a))}return r}function Xe(e){let t=[];return K(e.extensionElements,``,t,/* @__PURE__ */ new WeakSet,0),t.flatMap(({text:e,where:t})=>B(e).map(e=>({call:e,where:t})))}function Ze(e,t){let n=e.get(t);if(n===void 0||n.trim()===``)return{kind:`none`};let r=Ge(n);return r===null?{kind:`dynamic`}:{kind:`list`,names:r}}function Qe(e){let t=[];for(let[n,r]of[[`tool`,`data.connectorMode.toolModeFilters`],[`standalone`,`data.connectorMode.standaloneModeFilters`]])for(let i of[`tools`,`resources`,`prompts`]){let a=Ze(e,`${r}.${i}.included`),o=Ze(e,`${r}.${i}.excluded`);(a.kind!==`none`||o.kind!==`none`)&&t.push({scope:i,mode:n,included:a,excluded:o})}return t}function $e(e){if(e===void 0||e.trim()===``)return{id:null,dynamic:!1};let t=e.trim();if(!t.startsWith(`=`))return{id:t,dynamic:!1};let n=L(t);return n===null?{id:null,dynamic:!0}:{id:n,dynamic:!1}}function q(e){let t=U(e).id,n=H(e),r=W(e).get(`io.camunda.agenticai.gateway.type`)===`mcpClient`,i=t!==null&&je.has(t);if(!i&&!(r&&(n.has(`data.client.clientId`)||[...n.keys()].some(e=>e.startsWith(`data.transport.`)))))return null;let a=t===`io.camunda.connectors.agenticai.mcp.remoteclient.v0`||!i&&[...n.keys()].some(e=>e.startsWith(`data.transport.`)),o=$e(n.get(`data.client.clientId`)),s=n.get(`data.transport.type`),c=a?s===`sse`?`sse`:`http`:null,l=a?G(n.get(`data.transport.${c}.url`)):null;return{elementId:e.id,name:typeof e.name==`string`&&e.name.trim()!==``?e.name:e.id,remote:a,clientId:a?null:o.id,dynamicClientId:!a&&o.dynamic,transport:c,url:l,filters:Qe(n)}}function et(e){return/^bpmn:(?:\w*Task|SubProcess|AdHocSubProcess|Transaction|CallActivity)$/.test(e)}function tt(e){let t=G(e.get(`provider.type`)),n=null,r=null;for(let[t,i]of e)n===null&&/^provider\.[^.]+\.model\.(?:model|deploymentName)$/.test(t)&&(n=G(i)),r===null&&/^provider\.[^.]+\.backend\.type$/.test(t)&&(r=G(i));return{provider:t,model:n,backend:r}}const nt=/(?:apiKey|secretKey|accessKey|clientSecret|jsonKey|token|password)$/;function rt(e){let t=e.trim();return t===``||/\{\{\s*secrets\./.test(t)||/camunda\.secrets/.test(t)?!1:!t.startsWith(`=`)||L(t)!==null&&L(t).trim()!==``}function it(e){let t=[];for(let[n,r]of e)nt.test(n)&&r.trim()!==``&&t.push({target:n,plain:rt(r)});return t}function J(e){let t=[],n=e=>{for(let r of e.flowElements??[])t.push(r),r.flowElements&&n(r)};return n(e),t}function at(e,t){let n=[];for(let r of e.flowElements??[])r.id!==t&&et(r.$type)&&r.triggeredByEvent!==!0&&((r.incoming??[]).length>0||q(r)===null&&W(r).get(`io.camunda.agenticai.gateway.type`)!==`mcpClient`&&n.push({id:r.id,name:typeof r.name==`string`&&r.name.trim()!==``?r.name:r.id,kind:Je(r.$type),template:U(r).id,description:Ke(r),parameters:Ye(r)}));return n}function ot(e){let t=V(e,`zeebe:AgentDefinition`)?.agentType;if(t===`aiAgentSubProcess`)return`subprocess`;if(t===`aiAgentTask`)return`task`;let n=U(e).id;return n===null||!Ae.has(n)?null:n===`io.camunda.connectors.agenticai.aiagent.jobworker.v1`||n===`io.camunda.connectors.agenticai.ai-agent-subprocess.v2`?`subprocess`:`task`}function st(e){return e.some(e=>e.$type===`bpmn:UserTask`&&(e.incoming??[]).length>0)}function Y(e){return typeof e.name==`string`&&e.name.trim()!==``?e.name:e.id}function ct(e){let t=e?.$attrs??{},n=Object.keys(t).find(e=>e.endsWith(`:executionPlatformVersion`)),r=n?t[n]:null;return typeof r==`string`&&r.trim()!==``?r.trim():null}function lt(e){let t=[];for(let n of e?.rootElements??[])if(n.$type===`bpmn:Process`&&t.push(n),n.$type===`bpmn:Collaboration`)for(let e of n.participants??[])e.processRef&&t.push(e.processRef);return[...new Set(t)]}function ut(e,t,n,r){let i=H(e),a=U(e),o=t===`task`?G(i.get(`data.tools.containerElementId`)):null,s=o!==null&&!o.trim().startsWith(`=`)?o.trim():null,c=t===`subprocess`?e:s===null?null:r.get(s)??null,l=c?J(c):[],u=l.map(q).filter(e=>e!==null),d=tt(i);return{id:e.id,name:Y(e),kind:t,processId:n.id,template:a,legacyTemplate:a.id!==null&&ke.has(a.id),provider:d.provider,model:d.model,backend:d.backend,systemPrompt:qe(i.get(`data.systemPrompt.prompt`)),userPrompt:qe(i.get(`data.userPrompt.prompt`)),maxModelCalls:G(i.get(`data.limits.maxModelCalls`)),memory:{storage:G(i.get(`data.memory.storage.type`)),contextWindowSize:G(i.get(`data.memory.contextWindowSize`))},response:{format:G(i.get(`data.response.format.type`)),parseJson:G(i.get(`data.response.format.parseJson`)),schema:G(i.get(`data.response.format.schema`))!==null},humanApproval:st(l),container:c?{id:c.id,name:Y(c)}:null,containerDynamic:t===`task`&&o!==null&&s===null,containerMissing:t===`task`&&s!==null&&c===null,tools:c?at(c,e.id):[],mcpClients:u,credentials:it(i)}}function dt(e){return e.$type===`bpmn:AdHocSubProcess`?W(e).get(`io.camunda.agenticai.toolContainer`)===`true`||J(e).some(e=>q(e)!==null||Xe(e).length>0):!1}function ft(e){return J(e)}function pt(e){let t=[],n=[],r=[];for(let i of lt(e)){let e=ft(i),a=new Map(e.filter(e=>typeof e.id==`string`).map(e=>[e.id,e])),o=/* @__PURE__ */ new Set,s=!1;for(let n of e){let e=ot(n);if(e===null)continue;let r=ut(n,e,i,a);t.push(r),r.container&&o.add(r.container.id),(r.containerDynamic||r.containerMissing)&&(s=!0)}for(let t of e)ot(t)===null&&!s&&!o.has(t.id)&&dt(t)&&n.push({id:t.id,name:Y(t),processId:i.id});let c=new Set(t.filter(e=>e.processId===i.id).flatMap(e=>e.mcpClients.map(e=>e.elementId)));for(let t of e){let e=q(t);e!==null&&!c.has(e.elementId)&&r.push(e)}}return{agents:t,orphans:n,standaloneMcp:r,platformVersion:ct(e)}}function mt(e,t){let n=t?.get(e);if(n)return n;let r=()=>`unverifiable`;try{let t=new Map(re(e).rows.filter(e=>e.kind===`mcp-client`).map(e=>[e.name,e.status]));r=e=>t.get(e)??`unverifiable`}catch{r=()=>`unverifiable`}return t?.set(e,r),r}function ht(e,t){return{file:e,rule:t.rule,message:Ee(t),severity:t.severity,ruleId:`agents/${t.rule}`,docs:l(`agents/${t.rule}`),title:g(`agents`,t.rule),elements:[t.elementId]}}async function gt(e,n){let r=await h(k(e));if(!r)return[];let i=pt(r);if(i.agents.length===0&&i.orphans.length===0)return[];let a=i.agents.some(e=>e.mcpClients.length>0)?mt(t(e).root,n):void 0;return Re(i,a?{mcpStatus:a}:{}).map(t=>ht(e,t))}const _t={"connections/mcp-client-undefined":`agents/mcp-client-no-config`,"agents/tool-without-description":`compat/agent-tool-documentation`};function vt(e){let t=/* @__PURE__ */ new Set;for(let n of e)for(let e of n.elements??[])t.add(`${n.ruleId??n.rule}\0${e}`);return e.filter(e=>{let n=_t[e.ruleId??``];return n===void 0||!(e.elements??[]).some(e=>t.has(`${n}\0${e}`))})}async function yt(){return import(`./chunk-diagram-jfVu0sT3.js`)}const X=[`drawing`,`rules`,`flow`,`variables`,`connections`];function bt(e){if(e===void 0)return{sections:X};let t=e.split(`,`).map(e=>e.trim()).filter(e=>e.length>0),n=[],r;for(let e of t)X.includes(e)?n.push(e):r===void 0&&(r=e);return{sections:n,unknown:r}}const Z=/\.bpmn(\.xml|20\.xml)?$/i,xt=/\.form$/i,St=/\.(cmmn|cmmn11\.xml)$/i;async function Ct(e){let t=/* @__PURE__ */ new Map,n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new Map,i=e=>{for(let a of e??[]){if(!a?.id)continue;let e=typeof a.name==`string`?a.name.trim():``;e&&t.set(a.id,e),n.set(a.id,_(String(a.$type??``))),a.sourceRef&&a.targetRef&&r.set(a.id,[a.sourceRef.id,a.targetRef.id]),i(a.flowElements)}};try{let n=await h(k(e));for(let e of n?.rootElements??[]){e.id&&t.set(e.id,typeof e.name==`string`&&e.name.trim()||``);for(let n of e.participants??[])n.id&&n.name&&t.set(n.id,String(n.name).trim()),i(n.processRef?.flowElements);i(e.flowElements)}}catch{return e=>e}let o=e=>t.get(e)||(n.get(e)?a(`app.rules.drawing.theElement`,{type:n.get(e)}):e);return e=>{let n=t.get(e);if(n)return n;let i=r.get(e);return i?a(`app.rules.drawing.theConnection`,{from:o(i[0]),to:o(i[1])}):o(e)}}async function Q(e){let t=k(e);if(!S(t)&&await h(t))return[];let{measureDiagram:n}=await yt(),r=await n(e,{asAuthored:!0}),i=await Ct(e);return r.defects.map(t=>{let n=t.elements??[];return c(`drawing`,{file:e,rule:t.kind,message:t.detail,severity:d(`drawing`,t.kind)?.severity===`warning`?`warning`:`error`,title:g(`drawing`,t.kind),...n.length>0?{where:E(n.map(i)),elements:n}:{}})})}const wt={error:0,warning:1,note:2};function $(e){let t=e.elements??[],n=t.length>0?` (${t.join(`, `)})`:``,r=e.message.endsWith(n)&&n?e.message.slice(0,-n.length):e.message,i=e.title?`${e.title}${e.where?` - ${e.where}`:``}`:r;return[` ${x(e.severity).padEnd(7)} ${i}`,` ${` `.repeat(7)} ${e.ruleId??e.rule}${t.length>0?` ${t.join(`, `)}`:``}${e.policy?` ${a(`app.policy.findingTag`,{name:e.policy})}`:``}`]}function Tt(e,t){let n=!1;try{n=k(e).trim()===``}catch{n=!1}let o=m(e),s=C(t);return{file:e,rule:`file-unreadable`,message:w(t)?te(e):s===null?n?a(`app.output.theFileIsEmpty`):a(`app.output.notValidFile`,{what:o,reason:r(i(t))}):`${e}: ${s}`,severity:`error`}}async function Et(n,r){let{ruleFindings:i}=await import(`./chunk-lint-CnEhoYRB.js`),{flowFindings:a,unreadableDmn:o}=await import(`./chunk-analyze-ClE2LBCj.js`),{allows:s,upsell:c}=await import(`./chunk-features-DzAP8JmI.js`),{currentLicense:l}=await import(`./chunk-license-C9ZOkCg8.js`),u=new Set(r.sections??X),d=await l(r.offline?{fetch:(()=>Promise.reject(/* @__PURE__ */ Error(`offline`)))}:{}),f=r.flowAllowed??s(d),p=r.variablesAllowed??s(d),m=[],h=/* @__PURE__ */ new Map,g=/* @__PURE__ */ new Map,_=/* @__PURE__ */ new Map,v=[],y=[],x=0,S=!1;for(let s of n){let n=[];try{if(St.test(s))u.has(`rules`)&&n.push(...(await import(`./chunk-cmmnFindings-DKpYqUZN.js`)).cmmnFindingsOf(s));else{if(Z.test(s)&&u.has(`drawing`)&&n.push(...await Q(s)),Z.test(s)&&u.has(`rules`)&&(n.push(...await i(s,{builtInOnly:r.builtInRulesOnly===!0})),n.push(...await gt(s,_))),u.has(`flow`)){let e=/\.dmn$/i.test(s)?await o(s):null;e?n.push(e):f||xt.test(s)?n.push(...await a(s)):S=!0}if(Z.test(s)&&u.has(`variables`)){let e=t(s).values,r=fe(e);r.mode!==`off`&&p?n.push(...await At(s,r,h)):r.mode!==`off`&&typeof e.variables?.check==`string`&&m.length===0&&await kt(s,h)&&m.push(...c(d,`variable-checks`))}Z.test(s)&&u.has(`connections`)&&n.push(...Dt(s,g).filter(e=>A.resolve(e.file)===A.resolve(s)))}}catch(e){n.splice(0,n.length,Tt(s,e))}n.splice(0,n.length,...vt(n));let l=n.filter(e=>e.elements&&e.title),C=ee(n.filter(e=>!(e.elements&&e.title)).map(e=>({...e,elements:e.elements??[]})),l.map(e=>({kind:e.rule,elements:e.elements??[]})));n.splice(0,n.length,...[...l,...C].sort((e,t)=>wt[e.severity]-wt[t.severity])),v.push(...n);let w=n.filter(e=>e.severity===`error`);if(n.length===0)y.push(`${b(`ok`).padEnd(5)} ${e(s)}`);else{w.length>0&&(x+=1),y.push(`${(w.length>0?b(`fail`):b(`note`)).padEnd(5)} ${e(s)}`);for(let e of n.slice(0,40))y.push(...$(e))}}if(u.has(`connections`)){let t=new Set(n.map(e=>A.resolve(e))),r=/* @__PURE__ */ new Map;for(let e of[...g.values()].flat())t.has(A.resolve(e.file))||Z.test(e.file)||/\.json$/i.test(e.file)||r.set(e.file,[...r.get(e.file)??[],e]);for(let[t,n]of r){v.push(...n),y.push(`${b(`note`).padEnd(5)} ${e(t)}`);for(let e of n.slice(0,40))y.push(...$(e))}}let C=n.length>0?t(n[0]).root:process.cwd(),w=n.length>0?t(n[0]).policy:null,te=w&&w.manifest&&w.refused.length===0?w.manifest.baselines.map(e=>`${w.dir}/${e}`):[],T=v,E=[];for(let e of te){let t=N(C,T,e);E.push(...t.known),T=t.fresh}let D=r.baseline?N(C,T):null,O=D?{...D,known:[...D.known,...E]}:E.length>0?{fresh:T,known:E,fixed:[]}:null;return{findings:v,reported:O?O.fresh:v,comparison:O,failed:x,flowSkipped:S,offer:m,lines:y,root:C,policy:w}}function Dt(e,n){let r=t(e).root,i=n.get(r);if(i)return i;let a=[];try{a=Te(r,re(r).findings)}catch{a=[]}return n.set(r,a),a}function Ot(e,n){let r=t(e),i=n.get(r.root);if(i)return i;let a=[r.root,...D(r.root,ne(r.values))].flatMap(e=>O(e)).map(e=>({path:e,text:j(e,`utf8`)}));return n.set(r.root,a),a}async function kt(e,t){let n=j(e,`utf8`),r=await p(e,n);if(r.workers.length===0)return!1;let i=r.workers.map(e=>({kind:e.kind===`JAVA_CLASS`?`CLASS`:e.kind,value:e.value,elementId:e.elementId}));return(await se(Ot(e,t),i)).fetches.length>0}async function At(e,t,n){let r=j(e,`utf8`),i=await p(e,r);if(i.workers.length===0)return[];let a=await h(r),o=i.workers.map(e=>({kind:e.kind===`JAVA_CLASS`?`CLASS`:e.kind,value:e.value,elementId:e.elementId})),s=await se(Ot(e,n),o),l=ue({model:oe(i,s),definitions:a,order:f(a),types:s.types??[],inputs:t.inputs,linked:new Set(s.fetches.map(e=>e.elementId)),mode:t.mode,entitled:!0});return[...l.fields.map(t=>c(`code`,{file:e,rule:`variable-field`,message:pe(t),severity:`warning`,title:g(`code`,`variable-field`),where:le(t),elements:[t.elementId]})),...l.names.map(t=>c(`code`,{file:e,rule:`variable-unknown`,message:de(t.name),severity:`warning`,title:g(`code`,`variable-unknown`),where:ce(),elements:[t.elementId]}))]}async function jt(t,n){let r=await Et(t,n),i=n.format===`text`&&r.policy?me(r.policy):null,c=[...i?[i,``]:[],...r.lines];if(r.offer.length>0&&n.format===`text`&&c.push(``,...r.offer),n.format===`text`&&r.findings.some(e=>e.docs)&&c.push(``,a(`app.output.everyRuleHasAPage`,{url:u})),r.flowSkipped&&n.format===`text`&&c.push(``,a(`app.output.flowAnalysisLeftOut`)),n.updateBaseline){let t=we(r.root,r.findings);return{ok:!0,lines:[a(`app.output.wroteFindings`,{file:e(t),findings:y(r.findings.length,`app.output.count.finding`)})]}}let l=r.comparison?r.reported.some(e=>e.severity===`error`):r.failed>0;if(n.format===`sarif`)return{ok:!l,refused:!1,lines:[s(r.reported,`check`)]};if(n.format===`github`)return{ok:!l,refused:!1,lines:o(r.reported)};if(n.format===`json`)return{ok:!l,refused:!1,lines:[JSON.stringify(r.reported,null,2)]};if(r.comparison){let e=[r.reported.length>0?a(`app.output.newFindings`,{count:r.reported.length}):a(`app.output.nothingNew`),a(`app.output.accepted`,{count:r.comparison.known.length}),r.comparison.fixed.length>0?a(`app.output.fixedSinceTheBaseline`,{count:r.comparison.fixed.length}):``].filter(Boolean);c.push(``,e.join(`, `)),r.comparison.fixed.length>0&&c.push(a(`app.output.runUpdateBaseline`))}return{ok:!l,refused:!1,lines:c}}async function Mt(t,n){let{measureDiagram:r}=await yt(),i=[],o=0,s=0,c=n?``:_e(A.join(he(),`penstock-layout-`));try{for(let[l,u]of t.entries()){let t=n?u:A.join(c,`${l}.bpmn`),d,f;try{d=j(u,`utf8`),await r(u,{outPath:t}),f=j(t,`utf8`)}catch(t){s+=1,i.push({status:b(`fail`),file:e(u),details:T(e(u),t)});continue}f===d?i.push({status:b(`same`),file:e(u),details:a(`app.output.noChange`)}):(o+=1,i.push({status:b(n?`wrote`:`change`),file:e(u),details:a(n?`app.output.reflowedLayout`:`app.output.wouldReflowLayout`)}))}}finally{c&&ve(c,{recursive:!0,force:!0})}let l=v(i,{columns:[{name:`status`,header:a(`app.cli.header.status`),minWidth:6},{name:`file`,header:a(`app.cli.header.file`),minWidth:24},{name:`details`,header:a(`app.cli.header.details`)}]});return!n&&o>0&&l.push(``,a(`app.output.layoutAlwaysReflows`)),{ok:s===0,refused:!1,lines:l}}export{N as _,$ as a,H as c,Re as d,F as f,be as g,Te as h,Q as i,pt as l,Ee as m,jt as n,Mt as o,P as p,Et as r,bt as s,X as t,U as u,we as v};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{n as checkCommand,s as sectionsOf}from"./chunk-commands-
|
|
1
|
+
export{n as checkCommand,s as sectionsOf}from"./chunk-commands-B8YVT41b.js";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{r as e}from"./chunk-commands-B8YVT41b.js";import{r as t}from"./chunk-translator-DNm9zRpP.js";import{t as n}from"./chunk-diff-Dp3fUALc.js";import r from"node:path";const i=`<!-- penstock-report -->`;function a(e){return e.map(e=>`- ${e}`).join(`
|
|
2
|
+
`)}async function o(o){let s=[i,t(`app.cli.report.heading`),``];if(o.changed.length===0&&o.removed.length===0)return s.push(t(`app.cli.report.nothingChanged`)),{markdown:`${s.join(`
|
|
3
|
+
`)}\n`,clean:!0};o.removed.length>0&&s.push(t(`app.cli.report.removed`),``,a(o.removed),``);let c=new Map(o.changed.map(e=>[e.after,e.relative])),l=(await e(o.changed.map(e=>e.after),{format:`json`,baseline:!0,updateBaseline:!1})).reported;if(s.push(t(`app.cli.report.check`),``),l.length===0)s.push(t(`app.cli.report.cleanAgainstTheBaseline`),``);else{let e=/* @__PURE__ */ new Map;for(let t of l){let n=c.get(t.file)??r.basename(t.file);e.set(n,[...e.get(n)??[],`\`${t.rule}\` ${t.message}`])}for(let[t,n]of e)s.push(`**${t}**`,``,a(n),``)}let u=/* @__PURE__ */ new Map;s.push(t(`app.cli.report.whatChanged`),``);for(let e of o.changed){if(!e.before){s.push(`**${e.relative}** - ${t(`app.cli.report.newFile`)}`,``);continue}let r=await n(e.before,e.after,!0);if(!r.ok){s.push(`**${e.relative}**`,``,a(r.lines),``);continue}let i=r.summary?.lines??[];r.summary&&u.set(e.relative,r.summary.markersAfter),s.push(`**${e.relative}**`,``,i.length>0?a(i):t(`app.cli.report.onlyTheDrawingMoved`),``)}let d=[];for(let e of o.changed){let t=await o.picture(e,u.get(e.relative)??{});t&&d.push({relative:e.relative,url:t})}if(s.push(t(`app.cli.report.howItLooks`),``),d.length===0&&o.picturesLink)s.push(t(`app.cli.report.thePicturesLink`,{link:o.picturesLink}),``);else if(d.length===0)s.push(t(`app.cli.report.noPictures`),``);else{s.push(t(`app.cli.report.outlined`),``);for(let e of d)s.push(`**${e.relative}**`,``,``,``)}return{markdown:`${s.join(`
|
|
4
|
+
`)}\n`,clean:l.length===0}}export{o as n,i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,t}from"./chunk-context-rCJvBM9p.js";import{s as n,t as r}from"./chunk-features-C6o8of19.js";import{u as i}from"./chunk-license-BG88gpDZ.js";import{t as a}from"./chunk-connections-D_wC6d0W.js";import{a as o,h as s}from"./chunk-commands-B8YVT41b.js";import{t as c}from"./chunk-plural-Dn-7ulHf.js";import{t as l}from"./chunk-table-BOiaGWwY.js";import{t as u}from"./chunk-list-XuNpvC6j.js";import{r as d}from"./chunk-translator-DNm9zRpP.js";import{i as f}from"./chunk-workerVariables-CulLc3YH.js";import p from"node:path";import{existsSync as m,statSync as h}from"node:fs";function g(e,t){return`${e.file}:${e.line}${t?` (${t})`:``}`}function _(e){return e.length<=2?e.join(`, `):`${e.slice(0,2).join(`, `)} +${e.length-2}`}function v(e){return l(e,{columns:[{name:`name`,header:d(`app.cli.connections.header.name`),value:e=>e.name},{name:`status`,header:d(`app.cli.connections.header.status`),value:e=>d(`app.cli.connections.status.${e.status}`)},{name:`uses`,header:d(`app.cli.connections.header.usedIn`),value:e=>_(e.uses.map(e=>g(e,e.elementId)))},{name:`defined`,header:d(`app.cli.connections.header.definedIn`),value:e=>_(e.definedIn.map(e=>g(e)))}]})}function y(t,n,r){let i=[t.environment===null?d(`app.cli.connections.title`,{folder:e(n)}):d(`app.cli.connections.titleIn`,{folder:e(n),environment:t.environment})];i.push(t.environments.length>0?d(`app.cli.connections.environments`,{list:u(t.environments)}):d(`app.cli.connections.noEnvironments`));let a=t.rows.filter(e=>e.kind===`secret`),s=t.rows.filter(e=>e.kind===`mcp-client`);t.rows.length===0&&i.push(``,d(`app.cli.connections.nothingReferenced`)),a.length>0&&i.push(``,d(`app.cli.connections.secrets`),...v(a)),s.length>0&&i.push(``,d(`app.cli.connections.clients`),...v(s)),t.rows.length>0&&!t.providesSecrets&&a.length>0&&i.push(``,d(`app.cli.connections.noSources`)),t.rows.length>0&&!t.providesClients&&s.length>0&&i.push(``,d(`app.cli.connections.noClientSources`));for(let e of t.opaque)i.push(d(`app.cli.connections.opaque`,{from:e.from,place:g(e)}));if(t.unused.length>0){i.push(``,d(`app.cli.connections.unused`));for(let e of t.unused)i.push(` ${f(e.kind)} ${e.name} ${g(e)}`)}if(t.reconcile){let{target:e,against:n,missing:r,onlyInTarget:a}=t.reconcile;if(i.push(``,d(`app.cli.connections.reconcile`,{target:e,against:n})),r.length===0)i.push(d(`app.cli.connections.nothingMissing`,{target:e}));else{i.push(d(`app.cli.connections.missingHeading`,{target:e,against:n}));for(let e of r)i.push(` ${f(e.kind)} ${e.name}${e.referenced?` ${d(`app.cli.connections.usedByDiagram`)}`:``}`)}if(a.length>0){i.push(d(`app.cli.connections.onlyHeading`,{target:e}));for(let e of a)i.push(` ${f(e.kind)} ${e.name}`)}}if(r.length>0){i.push(``,d(`app.cli.connections.findings`,{count:r.length}));for(let e of r.slice(0,60))i.push(` ${g({file:p.relative(n,e.file).split(p.sep).join(`/`),line:e.line??1})}`,...o(e))}return i.push(``,c(t.sources.length,`app.cli.connections.count.file`)),i}async function b(e,o,c){if(!m(e)||!h(e).isDirectory())return{ok:!1,lines:[d(`app.cli.web.notAFolder`,{folder:e})]};if(o.against!==void 0&&o.environment===void 0)return{ok:!1,lines:[d(`app.cli.connections.againstNeedsEnvironment`)]};if(o.against!==void 0){let e=c??await i();if(!r(e))return{ok:!1,lines:n(e,`connections-environments`)}}let l=t(e).root,f=a(l,{environment:o.environment??null,against:o.against??null});for(let e of[o.environment,o.against])if(e!==void 0&&!f.environments.includes(e))return{ok:!1,lines:[f.environments.length>0?d(`app.cli.connections.unknownEnvironment`,{environment:e,known:u(f.environments)}):d(`app.cli.connections.noEnvironmentsKnown`,{environment:e})]};let p=s(l,f.findings),g=!f.findings.some(e=>e.severity===`error`);return o.format===`json`?{ok:g,refused:!1,lines:[JSON.stringify({...f,findings:f.findings.map((e,t)=>({...e,message:p[t].message,docs:p[t].docs}))},null,2)]}:{ok:g,refused:!1,lines:y(f,l,p)}}export{b as connectionsCommand};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as e}from"./chunk-license-BG88gpDZ.js";import{a as t,i as n,n as r,o as i,r as a,t as o}from"./chunk-connectors-Dk9qoDwI.js";import{t as s}from"./chunk-table-BOiaGWwY.js";import{r as c}from"./chunk-translator-DNm9zRpP.js";import l from"node:path";import{closeSync as u,constants as d,lstatSync as f,mkdirSync as p,openSync as m,readFileSync as h,readdirSync as g,realpathSync as _,renameSync as v,rmSync as y,writeFileSync as b}from"node:fs";import x from"node:http";const S=/^[A-Za-z0-9._-]{1,128}$/,C=d.O_NOFOLLOW??0;let w=!1;function T(){if(w)return;w=!0;let e=process.env;if(!(e.HTTPS_PROXY||e.https_proxy||e.HTTP_PROXY||e.http_proxy))return;let t=x.setGlobalProxyFromEnv;typeof t==`function`&&t.call(x)}async function E(e,t){let n=e.body?.getReader();if(!n)return/* @__PURE__ */ new Uint8Array;let r=[],i=0;for(;;){let{done:e,value:a}=await n.read();if(e)break;if(i+=a.byteLength,i>t)return await n.cancel().catch(()=>void 0),null;r.push(a)}let a=new Uint8Array(i),o=0;for(let e of r)a.set(e,o),o+=e.byteLength;return a}function D(e){return{status:0,body:/* @__PURE__ */ new Uint8Array,failure:e}}function O(t,n=fetch,r=2e4){let i=l.join(t??e(process.env),`connectors`);function s(){return p(i,{recursive:!0}),_(i)}function x(e,t){return t===e||t.startsWith(e+l.sep)}function w(e){let t=e.split(`/`);if(t.length>16||t.some(e=>!S.test(e)||e===`.`||e===`..`))throw Error(c(`app.cli.connectors.notInside`,{path:e}));let n=s(),r=n;for(let i of t){r=l.join(r,i);let t=f(r,{throwIfNoEntry:!1});if(!t)break;if(t.isSymbolicLink())throw Error(c(`app.cli.connectors.linkAt`,{path:e}));if(!x(n,_(r)))throw Error(c(`app.cli.connectors.notInside`,{path:e}))}return l.join(n,...t)}function O(e){let t=s(),n=t;for(let r of l.relative(t,e).split(l.sep).filter(Boolean)){n=l.join(n,r);let e=f(n,{throwIfNoEntry:!1});if(e?.isSymbolicLink())throw Error(c(`app.cli.connectors.holdsALink`));if(!e)p(n);else if(!e.isDirectory())throw Error(c(`app.cli.connectors.fileInTheWay`))}}function k(e){return{entries:f(e,{throwIfNoEntry:!1})?.isDirectory()?g(e).sort():[]}}function A(e){let t=f(e,{throwIfNoEntry:!1});if(!t?.isFile())return{content:null};if(t.size>67108864)throw Error(c(`app.cli.connectors.tooLarge`));let n=m(e,d.O_RDONLY|C);try{return{content:h(n)}}finally{u(n)}}function j(e,t){let n=t??/* @__PURE__ */ new Uint8Array;if(n.byteLength>67108864)throw Error(c(`app.cli.connectors.contentTooLarge`));if(f(e,{throwIfNoEntry:!1})?.isDirectory())throw Error(c(`app.cli.connectors.directoryInTheWay`));O(l.dirname(e));let r=m(e,d.O_WRONLY|d.O_CREAT|d.O_TRUNC|C,420);try{b(r,n)}finally{u(r)}return{}}function M(e,t){if(!f(e,{throwIfNoEntry:!1}))throw Error(c(`app.cli.connectors.nothingToMove`));if(f(t,{throwIfNoEntry:!1}))throw Error(c(`app.cli.connectors.destinationExists`));return O(l.dirname(t)),v(e,t),{}}return{async fetch(e){if(!a(e))throw Error(c(`app.cli.connectors.notACatalogueUrl`,{url:e}));T();let t;try{t=await n(e,{redirect:`manual`,headers:{"User-Agent":`Penstock CLI`},signal:AbortSignal.timeout(r)})}catch(e){let t=e.cause?.message;return D(t??(e instanceof Error?e.message:c(`app.cli.connectors.githubUnreachable`)))}if(t.status>=300&&t.status<400)return await t.body?.cancel().catch(()=>void 0),D(c(`app.cli.connectors.redirect`));if(Number(t.headers.get(`content-length`)??0)>67108864)return await t.body?.cancel().catch(()=>void 0),D(c(`app.cli.connectors.responseTooLarge`));try{let e=await E(t,o);return e?{status:t.status,body:e}:D(c(`app.cli.connectors.responseTooLarge`))}catch(e){return D(e instanceof Error?e.message:c(`app.cli.connectors.interrupted`))}},async file(e,t,n,r){if(t===``){if(e!==`list`)throw Error(c(`app.cli.connectors.listOnly`));return k(s())}let i=w(t);switch(e){case`exists`:return{pathExists:f(i,{throwIfNoEntry:!1})!==void 0};case`read`:return A(i);case`write`:return j(i,n);case`delete`:return y(i,{recursive:!0,force:!0}),{};case`list`:return k(i);case`mkdirs`:return O(i),{};case`rename`:if(!r)throw Error(c(`app.cli.connectors.renameNeedsTarget`));return M(i,w(r));default:throw Error(c(`app.cli.connectors.unknownOperation`,{operation:String(e)}))}}}}async function k(e,a,o=O()){if(e[0]===`resolve`){if(!e[1])return{ok:!1,lines:[c(`app.cli.connectors.resolveUsage`)]};if(e[2]!==void 0&&!Number.isInteger(Number(e[2])))return{ok:!1,lines:[c(`app.cli.connectors.notAVersion`,{version:e[2]})]}}let{catalog:l,error:u,nextAttempt:d}=await r(o,{forceRefresh:a.has(`--refresh`)});if(!l)return{ok:!1,lines:[c(`app.cli.connectors.downloadFailed`,{reason:u??c(`app.cli.connectors.unknownReason`),when:d?c(`app.cli.connectors.retriedAfter`,{when:d}):``})]};let f=u?[c(`app.cli.connectors.usingOlder`,{ref:l.ref,reason:u})]:[];if(e[0]===`resolve`){let r=e[1],a=e[2]===void 0?void 0:Number(e[2]),s=a===void 0?t(l,r):i(l,r,a);if(!s){let e=a===void 0?r:c(`app.cli.connectors.idVersion`,{id:r,version:a});return{ok:!1,lines:[...f,c(`app.cli.connectors.noTemplate`,{which:e,ref:l.ref})]}}let u=await n(o,s);return u?{ok:!0,lines:[...f,JSON.stringify(u,null,2)]}:{ok:!1,lines:[...f,c(`app.cli.connectors.cacheMissing`,{id:s.id})]}}let p=[...f,c(`app.cli.connectors.summary`,{ref:l.ref,current:l.newest.length,older:l.templates.length})],m=s(l.newest,{columns:[{name:`name`,header:c(`app.cli.header.name`)},{name:`id`,header:c(`app.cli.header.id`)},{name:`version`,header:c(`app.cli.header.version`),value:e=>e.version===null?``:`v${e.version}`},{name:`elementType`,header:c(`app.cli.header.type`),value:e=>e.elementType??``},{name:`engine`,header:c(`app.cli.header.engine`),value:e=>e.engines?.camunda?`Camunda ${e.engines.camunda}`:``}]});return{ok:!0,lines:[...p,``,...m]}}export{k as connectorsCommand};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{f as e,n as t}from"./chunk-model-BulEKnY1.js";import{i as n,r}from"./chunk-translator-DNm9zRpP.js";import{t as i}from"./chunk-own-Cn7Ki4ij.js";import{a}from"./chunk-sections-Co5ovFf4.js";import{a as o,r as s,s as c,t as l}from"./chunk-moddle-D3Ym38EZ.js";import{i as u,n as d,t as f}from"./chunk-types-mxHL9XQt.js";import{n as p,r as m,t as h}from"./chunk-juel-CgGCf_MV.js";import{o as g}from"./chunk-xml-rMelkRIV.js";const _=`https://docs.camunda.io/docs/guides/migrating-from-camunda-7/`,v=`${_}migration-journey/migrate/`,y=`${_}code-conversion/`,b=`https://docs.camunda.io/docs/components/modeler/bpmn/bpmn-coverage/`,x=`https://docs.camunda.io/docs/components/concepts/job-workers/`,S=`https://docs.camunda.io/docs/components/modeler/feel/what-is-feel/`,C=`https://docs.camunda.io/docs/components/concepts/execution-listeners/`,w=`https://docs.camunda.io/docs/components/concepts/user-task-listeners/`,T=`https://docs.camunda.io/docs/components/modeler/forms/camunda-forms-reference/`,E=`https://docs.camunda.io/docs/components/modeler/bpmn/user-tasks/`,D=`https://docs.camunda.io/docs/components/concepts/messages/`,O=`https://docs.camunda.io/docs/components/modeler/dmn/`,k=`https://docs.camunda.io/docs/guides/migrating-from-camunda-7/migration-tooling/data-migrator/`,A={"java-class":{severity:`error`,conversion:`automatic`,title:`Java class {className} becomes the job type {jobType}`,detail:`Camunda 8 does not run Java inside the engine. A service task creates a job, and a job worker in your application picks it up.`,action:`Write a job worker for {jobType}; Penstock generates one from the class.`,link:x},"delegate-expression":{severity:`error`,conversion:`automatic`,title:`Delegate {delegate} becomes the job type {jobType}`,detail:`Camunda 8 cannot look up a Spring bean. The task creates a job, and a job worker picks it up.`,action:`Write a job worker for {jobType}; Penstock generates one from the bean.`,link:x},"delegate-expression-dynamic":{severity:`error`,conversion:`manual`,title:`The delegate is chosen by the expression {expression}`,detail:`The bean is decided while the process runs, and a Camunda 8 job type is fixed or a FEEL expression over variables.`,action:`Give the task a job type, or a FEEL expression that picks one from a variable.`,link:x},expression:{severity:`error`,conversion:`automatic`,title:`The expression {expression} becomes the job type {jobType}`,detail:`Camunda 8 cannot call a bean method from the diagram. The call moves into a job worker.`,action:`Write a job worker for {jobType} that makes the call {expression} made.`,link:x},"expression-unknown":{severity:`error`,conversion:`manual`,title:`The expression {expression} runs code inside the engine`,detail:`Camunda 8 evaluates FEEL and nothing else in the diagram, so this expression has no counterpart.`,action:`Move what it does into a job worker, or into a FEEL output mapping if it only computes a value.`,link:x},"external-task":{severity:`warning`,conversion:`automatic`,title:`The external task topic {topic} becomes the job type {jobType}`,detail:`External tasks and jobs are the same idea. The worker changes client: the Camunda 7 external task client becomes a Camunda 8 job worker.`,action:`Move the handler for {topic} to a job worker; Penstock generates one from the handler.`,link:y},"external-task-priority":{severity:`info`,conversion:`automatic`,title:`The external task priority is dropped`,detail:`Camunda 8 jobs of one type are handed out in the order they are created.`,action:`Nothing to do, unless the order mattered; then give urgent work its own job type.`},connector:{severity:`error`,conversion:`manual`,title:`The Camunda 7 connector {connector} has no Camunda 8 counterpart`,detail:`Camunda 7 connectors (http-connector, soap-http-connector) are not part of Camunda 8. Camunda 8 has its own connectors, configured through element templates.`,action:`Apply the Camunda 8 REST or SOAP connector template to the task, or write a job worker.`,link:`https://docs.camunda.io/docs/components/connectors/protocol/rest/`},"field-injection":{severity:`warning`,conversion:`review`,title:`The injected fields {fields} become task headers`,detail:`Camunda 8 has no field injection. Fixed values travel with the job as custom headers, which the worker reads.`,action:`Read them in the worker from the job's custom headers.`,link:x},"field-injection-expression":{severity:`error`,conversion:`manual`,title:`The injected field {field} is an expression`,detail:`A task header is a fixed text; it cannot be evaluated while the process runs.`,action:`Pass the value as an input mapping with a FEEL expression, and read it in the worker as a variable.`,link:x},async:{severity:`info`,conversion:`automatic`,title:`Asynchronous continuation is dropped`,detail:`Camunda 8 has no transactions spanning steps: every job and every wait is its own unit, so asyncBefore and asyncAfter mean nothing there.`,action:`Nothing to do.`,link:v},retries:{severity:`warning`,conversion:`review`,title:`The retry cycle {cycle} becomes {retries} retries`,detail:`Camunda 8 counts retries on the task; how long to wait between them is decided by the worker when it fails the job.`,action:`Set the back-off in the worker's fail command if the interval mattered.`,link:x},"retries-dropped":{severity:`warning`,conversion:`automatic`,title:`The retry cycle {cycle} is dropped`,detail:`Only tasks that create a job carry retries in Camunda 8.`,action:`Nothing to do, unless this element relied on retrying; then check how it fails on Camunda 8.`},"job-priority":{severity:`info`,conversion:`automatic`,title:`The job priority {priority} is carried over`,detail:`Camunda 8 has job priorities from 8.8.`,action:`Nothing to do.`,since:`8.8`},"job-priority-dropped":{severity:`warning`,conversion:`automatic`,title:`The job priority {priority} is dropped`,detail:`The Camunda 8 version this converts for has no job priorities.`,action:`Nothing to do, unless the order mattered; then give urgent work its own job type.`},"input-output":{severity:`info`,conversion:`automatic`,title:`The input and output mapping becomes a FEEL mapping`,detail:`Camunda 8 maps variables with FEEL expressions; each Camunda 7 parameter becomes one.`,action:`Nothing to do.`,link:`https://docs.camunda.io/docs/components/concepts/variables/`},"input-output-manual":{severity:`error`,conversion:`manual`,title:`The mapping of {name} cannot be converted`,detail:`{reason}`,action:`Write the mapping as a FEEL expression.`,link:S},"input-output-script":{severity:`error`,conversion:`manual`,title:`The mapping of {name} runs a {format} script`,detail:`Camunda 8 maps variables with FEEL only.`,action:`Write the mapping as a FEEL expression, or compute the value in a job worker.`,link:S},condition:{severity:`info`,conversion:`automatic`,title:`The condition {expression} becomes {feel}`,detail:`Camunda 8 conditions are FEEL expressions.`,action:`Nothing to do.`,link:S},"expression-review":{severity:`warning`,conversion:`review`,title:`{expression} became {feel}`,detail:`{reason}`,action:`Check the FEEL expression means the same with the values this process sees.`,link:S},"expression-manual":{severity:`error`,conversion:`manual`,title:`The expression {expression} cannot be converted`,detail:`The converter stopped because {reason}.`,action:`Write it as a FEEL expression.`,link:S},"script-condition":{severity:`error`,conversion:`manual`,title:`The condition is a {format} script`,detail:`Camunda 8 conditions are FEEL expressions only.`,action:`Write the condition in FEEL.`,link:S},"script-task":{severity:`error`,conversion:`manual`,title:`The {format} script cannot run in Camunda 8`,detail:`Camunda 8 runs a script task as a FEEL expression or as a job. Groovy, JavaScript and Python scripts have no engine to run in.`,action:`Rewrite the script as a FEEL expression, or turn the task into a job worker that runs the code.`,link:`https://docs.camunda.io/docs/components/modeler/bpmn/script-tasks/`},"script-task-feel":{severity:`info`,conversion:`automatic`,title:`The FEEL script becomes a FEEL expression`,detail:`Camunda 8 runs a FEEL script task inside the engine, with its result in {variable}.`,action:`Nothing to do.`,link:`https://docs.camunda.io/docs/components/modeler/bpmn/script-tasks/`},"script-resource":{severity:`error`,conversion:`manual`,title:`The script is read from {resource}`,detail:`Camunda 8 does not load scripts from resources.`,action:`Rewrite the script as a FEEL expression, or turn the task into a job worker.`,link:`https://docs.camunda.io/docs/components/modeler/bpmn/script-tasks/`},"execution-listener":{severity:`error`,conversion:`automatic`,title:`The {event} listener {name} becomes the job type {jobType}`,detail:`Camunda 8 execution listeners are jobs as well: the process waits until a worker completes them.`,action:`Write a job worker for {jobType}; it runs before the element continues, so keep it quick.`,since:`8.6`,link:C},"execution-listener-unsupported":{severity:`error`,conversion:`manual`,title:`The {event} listener {name} has no Camunda 8 counterpart`,detail:`{reason}`,action:`Move what the listener does into a task of its own or into the worker before it.`,link:C},"task-listener":{severity:`error`,conversion:`automatic`,title:`The {event} task listener {name} becomes the job type {jobType}`,detail:`Camunda 8 task listeners are jobs that the user task waits for, and they can correct or deny what happens.`,action:`Write a job worker for {jobType}.`,since:`8.8`,link:w},"task-listener-unsupported":{severity:`error`,conversion:`manual`,title:`The {event} task listener {name} has no Camunda 8 counterpart`,detail:`{reason}`,action:`Move what the listener does into a job worker around the task, or into the application that works the task.`,link:w},"user-task":{severity:`info`,conversion:`automatic`,title:`The user task becomes a Camunda user task`,detail:`Camunda 8 manages the task in the engine, with its assignee, candidates, dates and priority.`,action:`Nothing to do in the diagram; the task list application changes to Tasklist or to the Camunda 8 user task API.`,link:E},"user-task-expression":{severity:`warning`,conversion:`review`,title:`The {name} {expression} became {feel}`,detail:`{reason}`,action:`Check the value on Camunda 8.`,link:E},"user-task-priority-range":{severity:`warning`,conversion:`review`,title:`The priority {priority} is outside 0 to 100`,detail:`Camunda 8 user task priorities run from 0 to 100.`,action:`Rescale the priority.`,link:E},"user-task-priority-dropped":{severity:`warning`,conversion:`automatic`,title:`The priority {priority} is dropped`,detail:`The Camunda 8 version this converts for has no user task priority.`,action:`Nothing to do, unless the task list sorted by it.`},"form-embedded":{severity:`error`,conversion:`manual`,title:`The embedded form {formKey} has no Camunda 8 counterpart`,detail:`Camunda 8 Tasklist shows Camunda Forms only; HTML forms and their JavaScript do not carry over.`,action:`Rebuild the form as a Camunda Form and link it, or keep your own task list application and pass the key as an external reference.`,link:T},"form-generated":{severity:`warning`,conversion:`review`,title:`The generated form becomes the Camunda Form {form}`,detail:`Penstock writes a Camunda Form with one field per form field, and links it. Validation and properties the form fields had are carried over where Camunda Forms have them.`,action:`Open {form} and check it looks and validates as the old one did.`,link:T},"form-generated-partly":{severity:`warning`,conversion:`review`,title:`Part of the generated form did not carry over: {lost}`,detail:`Camunda Forms have no counterpart for it.`,action:`Rebuild that part in the form editor.`,link:T},"form-camunda":{severity:`info`,conversion:`automatic`,title:`The Camunda Form {form} is linked by its id`,detail:`Camunda 8 links a form by its id and deploys it with the diagram.`,action:`Deploy the form with the diagram.`,link:T},"form-camunda-unknown":{severity:`warning`,conversion:`review`,title:`The Camunda Form {form} was not found in the project`,detail:`Camunda 8 links a form by the id inside it, and Penstock could not read that id. The file name was used instead.`,action:`Check the form id in the diagram matches the id inside the form.`,link:T},"form-binding-version":{severity:`error`,conversion:`manual`,title:`The form is bound to version {version}`,detail:`Camunda 8 binds a form by latest, by deployment or by version tag, not by version number.`,action:`Bind it by deployment or give the form a version tag.`,link:T},"form-external":{severity:`warning`,conversion:`review`,title:`The form key {formKey} becomes an external reference`,detail:`Camunda 8 passes an external reference through to the task list, as Camunda 7 passed the form key.`,action:`Check your task list application reads the external reference.`,since:`8.4`,link:T},"assignment-review":{severity:`warning`,conversion:`review`,title:`The {name} {expression} is a list in Camunda 7`,detail:`Camunda 8 wants candidates as a FEEL list or a comma-separated text.`,action:`Check the expression gives a list or a comma-separated text.`,link:E},initiator:{severity:`warning`,conversion:`manual`,title:`The starter is kept in {variable} only in Camunda 7`,detail:`Camunda 8 does not record who started an instance in a variable.`,action:`Set {variable} as a variable when the process is started.`,link:v},"multi-instance":{severity:`info`,conversion:`automatic`,title:`The multi-instance loop over {collection} becomes an input collection`,detail:`Camunda 8 loops over an input collection, with each item in the input element.`,action:`Nothing to do.`,link:`https://docs.camunda.io/docs/components/modeler/bpmn/multi-instance/`},"multi-instance-cardinality":{severity:`warning`,conversion:`review`,title:`The loop cardinality {cardinality} becomes a collection of numbers`,detail:`Camunda 8 has no loop cardinality: it loops over a collection. The converter loops over the numbers 1 to {cardinality}.`,action:`Check the loop runs as often as it did.`,link:`https://docs.camunda.io/docs/components/modeler/bpmn/multi-instance/`},"multi-instance-missing":{severity:`error`,conversion:`manual`,title:`The multi-instance loop has neither a collection nor a cardinality`,detail:`Camunda 8 needs an input collection to loop over.`,action:`Give the loop an input collection.`,link:`https://docs.camunda.io/docs/components/modeler/bpmn/multi-instance/`},"call-activity":{severity:`info`,conversion:`automatic`,title:`The call of {process} carries over`,detail:`Camunda 8 calls the process by its id; the variables passed in and out become mappings.`,action:`Nothing to do.`,link:`https://docs.camunda.io/docs/components/modeler/bpmn/call-activities/`},"call-activity-business-key":{severity:`error`,conversion:`manual`,title:`The business key is passed to {process}`,detail:`Camunda 8 has no business key.`,action:`Pass the value as a variable, and correlate messages on it.`,link:v},"call-activity-local":{severity:`warning`,conversion:`review`,title:`Only local variables were passed to or from {process}`,detail:`Camunda 8 passes the variables its mappings name; it has no local-only mode.`,action:`Check the mappings pass exactly what the called process needs.`,link:`https://docs.camunda.io/docs/components/modeler/bpmn/call-activities/`},"call-activity-mapping-class":{severity:`error`,conversion:`manual`,title:`Variables for {process} are mapped by Java code`,detail:`Camunda 8 maps variables with FEEL only.`,action:`Write the mapping as FEEL input and output mappings.`,link:S},"binding-version":{severity:`error`,conversion:`manual`,title:`{what} is bound to version {version}`,detail:`Camunda 8 binds by latest, by deployment or by version tag, not by version number.`,action:`Bind it by deployment, or give the target a version tag and bind by that.`,since:`8.6`,link:`https://docs.camunda.io/docs/components/best-practices/modeling/choosing-the-resource-binding-type/`},"binding-dropped":{severity:`warning`,conversion:`automatic`,title:`The binding {binding} of {target} is dropped`,detail:`The Camunda 8 version this converts for always takes the latest version.`,action:`Convert for 8.6 or later to keep the binding.`,since:`8.6`},tenant:{severity:`warning`,conversion:`manual`,title:`The tenant {tenant} is fixed in the diagram`,detail:`Camunda 8 decides the tenant from the deployment, not from the diagram.`,action:`Deploy the diagram to the tenant instead.`,link:`https://docs.camunda.io/docs/components/concepts/multi-tenancy/`},cmmn:{severity:`error`,conversion:`manual`,title:`The case {case} is called`,detail:`Camunda 8 has no CMMN.`,action:`Model the case as a process, an ad-hoc subprocess or a set of user tasks.`,link:_},decision:{severity:`info`,conversion:`automatic`,title:`The decision {decision} is called, its result in {result}`,detail:`Camunda 8 evaluates the decision in the engine and stores the whole result in one variable.`,action:`Nothing to do.`,link:O},"decision-result":{severity:`warning`,conversion:`review`,title:`The decision result was mapped as {mapping}`,detail:`Camunda 8 stores the result the way the decision gives it: one value for one output of one rule, a context for several outputs, a list for several rules. The Camunda 7 mapping {mapping} may have a different shape.`,action:`Check what reads {result} expects the Camunda 8 shape.`,link:O},"decision-result-variable":{severity:`warning`,conversion:`review`,title:`The decision result goes to {result}`,detail:`Camunda 8 needs a result variable, and the Camunda 7 task had none.`,action:`Rename {result} if something else should read the result.`,link:O},"message-catch":{severity:`error`,conversion:`manual`,title:`The message {message} needs a correlation key`,detail:`Camunda 8 correlates a message to a waiting instance by a key the instance computes from its variables. Camunda 7 correlated through the API, with the business key or variables.`,action:`Add a correlation key to the message: a FEEL expression over a variable the sender also knows, such as =orderId.`,link:D},"message-name-expression":{severity:`info`,conversion:`automatic`,title:`The message name {name} becomes {feel}`,detail:`Camunda 8 message names can be FEEL expressions.`,action:`Nothing to do.`,link:D},"message-throw":{severity:`error`,conversion:`automatic`,title:`The message is sent by {implementation}, which becomes the job type {jobType}`,detail:`Camunda 8 sends a message from a throw event through a job worker, like a send task.`,action:`Write a job worker for {jobType} that publishes the message.`,link:D},"message-throw-empty":{severity:`error`,conversion:`manual`,title:`The message throw event has no implementation`,detail:`Camunda 8 needs a job type on a message throw event; a worker sends the message.`,action:`Give the event a job type and write the worker that publishes the message.`,link:D},"signal-variables":{severity:`warning`,conversion:`review`,title:`Variables passed with the signal {signal}`,detail:`Camunda 8 broadcasts a signal with the variables its input mappings give it.`,action:`Check the signal carries the variables its catchers read.`,link:`https://docs.camunda.io/docs/components/modeler/bpmn/signal-events/`},timer:{severity:`info`,conversion:`automatic`,title:`The timer {timer} carries over`,detail:`Camunda 8 reads the same ISO 8601 dates, durations and cycles.`,action:`Nothing to do.`,link:`https://docs.camunda.io/docs/components/modeler/bpmn/timer-events/`},"timer-cron":{severity:`warning`,conversion:`review`,title:`The timer cycle {cycle} is a cron expression`,detail:`Camunda 8 reads cron expressions in the Spring format; Camunda 7 read them in the Quartz format, which allows fields Spring does not.`,action:`Check the cron expression is valid Spring cron.`,link:`https://docs.camunda.io/docs/components/modeler/bpmn/timer-events/`},"error-code-variable":{severity:`info`,conversion:`automatic`,title:`The caught error code goes to {variable} through an output mapping`,detail:`Camunda 8 gives a caught error to the output mappings as errorCode and errorMessage.`,action:`Nothing to do.`,link:`https://docs.camunda.io/docs/components/modeler/bpmn/error-events/`},"error-message":{severity:`info`,conversion:`automatic`,title:`The error message {message} is dropped`,detail:`In Camunda 8 the worker that throws the error gives its message.`,action:`Give the message in the worker when it throws the error.`,link:`https://docs.camunda.io/docs/components/modeler/bpmn/error-events/`},"external-error":{severity:`error`,conversion:`manual`,title:`The external task decides errors by the expression {expression}`,detail:`Camunda 8 has no error event definitions on a task; the job worker throws the error itself.`,action:`Throw the BPMN error from the job worker when the condition holds.`,link:x},"escalation-code-variable":{severity:`warning`,conversion:`manual`,title:`The escalation code was kept in {variable}`,detail:`Camunda 8 does not store a caught escalation code in a variable.`,action:`Pass the value as a variable when the escalation is thrown.`,link:`https://docs.camunda.io/docs/components/modeler/bpmn/escalation-events/`},"unsupported-element":{severity:`error`,conversion:`manual`,title:`Camunda 8 cannot run a {what}`,detail:`{reason}`,action:`{action}`,link:b},"element-since":{severity:`error`,conversion:`manual`,title:`A {what} needs Camunda {version} or later`,detail:`The Camunda 8 version this converts for, {target}, cannot run it.`,action:`Convert for Camunda {version} or later, or remodel it.`,link:b},"conditional-event":{severity:`warning`,conversion:`review`,title:`The conditional event waits for {variables}`,detail:`Camunda 8 evaluates a condition when the variables it names change, like Camunda 7 did when variableName was set.`,action:`Check the condition is triggered by the variables you expect.`,since:`8.9`,link:`https://docs.camunda.io/docs/components/modeler/bpmn/conditional-events/`},properties:{severity:`info`,conversion:`automatic`,title:`The extension properties carry over`,detail:`Camunda 8 keeps them as zeebe properties, read the same way by tools.`,action:`Nothing to do.`},"version-tag":{severity:`info`,conversion:`automatic`,title:`The version tag {tag} carries over`,detail:`Camunda 8 keeps version tags from 8.6.`,action:`Nothing to do.`,since:`8.6`},"history-time-to-live":{severity:`info`,conversion:`automatic`,title:`The history time to live {ttl} is dropped`,detail:`Camunda 8 keeps history in its secondary storage, cleaned up by retention settings of the cluster, not of the diagram.`,action:`Set the retention in the cluster configuration if it mattered.`,link:k},"starter-groups":{severity:`warning`,conversion:`manual`,title:`Who may start the process ({groups}) is dropped`,detail:`Camunda 8 decides who may start a process through authorizations, not the diagram.`,action:`Grant the start permission to {groups} in Camunda 8 identity.`,link:`https://docs.camunda.io/docs/components/concepts/access-control/authorizations/`},"startable-in-tasklist":{severity:`info`,conversion:`automatic`,title:`Whether Tasklist may start the process is dropped`,detail:`Camunda 8 Tasklist offers every process a user may start.`,action:`Nothing to do.`},template:{severity:`warning`,conversion:`review`,title:`The element template {template} is a Camunda 7 template`,detail:`The template no longer applies; the converted properties stay.`,action:`Apply the Camunda 8 version of the template, if there is one.`,link:`https://docs.camunda.io/docs/components/modeler/desktop-modeler/element-templates/about-templates/`},"unknown-attribute":{severity:`warning`,conversion:`manual`,title:`The Camunda 7 setting {attribute} is left as it is`,detail:`Penstock does not know what Camunda 8 should do with it, so it stays in the diagram, where Camunda 8 ignores it.`,action:`Check whether anything depended on it, then remove it.`,link:v},"dmn-version":{severity:`warning`,conversion:`manual`,title:`The decisions are DMN {version}`,detail:`Camunda 8 reads DMN 1.3. Penstock and the DMN editor move an older file to 1.3.`,action:`Open the file in the DMN editor and save it, then convert it.`,link:O},"dmn-expression-language":{severity:`error`,conversion:`manual`,title:`{what} is written in {language}`,detail:`Camunda 8 evaluates DMN in FEEL only.`,action:`Write it in FEEL.`,link:O},"dmn-juel":{severity:`info`,conversion:`automatic`,title:`{what} becomes the FEEL expression {feel}`,detail:`Camunda 8 evaluates DMN in FEEL only.`,action:`Nothing to do.`,link:O},"dmn-input-variable":{severity:`error`,conversion:`manual`,title:`The input {input} names its value {variable}`,detail:`Camunda 8 refers to the input value in a rule as ?, not by a name.`,action:`Replace {variable} with ? in the rules of this input, then remove the name.`,link:`https://docs.camunda.io/docs/components/modeler/feel/language-guide/feel-unary-tests/`},"dmn-history-time-to-live":{severity:`info`,conversion:`automatic`,title:`The history time to live of {decision} is dropped`,detail:`Camunda 8 keeps history in its secondary storage, cleaned up by retention settings of the cluster.`,action:`Nothing to do.`},"dmn-carries-over":{severity:`info`,conversion:`automatic`,title:`The decisions carry over`,detail:`Camunda 8 evaluates DMN 1.3 in FEEL, and these decisions use nothing else.`,action:`Nothing to do.`,link:O},"form-platform":{severity:`info`,conversion:`automatic`,title:`The form carries over`,detail:`Camunda Forms have the same format on both; only the platform it names changes.`,action:`Nothing to do.`,link:T},platform:{severity:`info`,conversion:`automatic`,title:`The diagram names Camunda {target} as its platform`,detail:`Camunda Modeler and Penstock read the platform from the file.`,action:`Nothing to do.`},"data-migration":{severity:`warning`,conversion:`manual`,title:`Running instances and history stay on Camunda 7`,detail:`Converting a diagram does not move its instances. Instances can finish on Camunda 7, or be moved with Camunda's Data Migrator, which needs the element ids to stay as they are; the converter keeps them.`,action:`Decide whether to drain Camunda 7 or to run the Data Migrator.`,link:k}},j=[`title`,`detail`,`action`];function M(e,t,n){return`app.migration.rules.${e}${n?`.${n}`:``}.${t}`}function N(e,t,i={},a){let o={},s={};for(let c of j){s[c]=n(t[c],i);let l=a?M(e,c,a):``,u=l?r(l,i):``;o[c]=l&&u!==l?u:r(M(e,c),i)}return{text:o,english:s}}const P=`textfield`;function F(e){return typeof e==`string`&&e!==``?e:void 0}function I(e){let t=Number(e);return e!==void 0&&e.trim()!==``&&Number.isFinite(t)?t:void 0}function ee(e,t){let n=F(e.id)??`field`,i=F(e.type)??`string`,a={id:`Field_${n}`,key:n,label:F(e.label)??n},o={};(e.validation?.constraints??[]).forEach(e=>{let i=F(e.name)??``,a=I(F(e.config));i===`required`?o.required=!0:i===`minlength`&&a!==void 0?o.minLength=a:i===`maxlength`&&a!==void 0?o.maxLength=a:i===`min`&&a!==void 0?o.min=a:i===`max`&&a!==void 0?o.max=a:i===`readonly`?o.readonly=!0:t.push(r(`app.migration.form.keptOut`,{name:i,id:n}))});let s=o.readonly===!0;delete o.readonly;let c={...Object.keys(o).length>0?{validate:o}:{},...s?{readonly:!0}:{}},l=F(e.defaultValue),u=Object.fromEntries((e.properties?.values??[]).filter(e=>F(e.name)).map(e=>[e.name,e.value??``]));switch(Object.keys(u).length>0&&(c.properties=u),i){case`string`:return{...a,type:P,...l?{defaultValue:l}:{},...c};case`long`:return{...a,type:`number`,...I(l)===void 0?{}:{defaultValue:I(l)},...c};case`boolean`:return{...a,type:`checkbox`,...l?{defaultValue:l===`true`}:{},...c};case`date`:return{...a,type:`datetime`,subtype:`date`,dateLabel:a.label,...c};case`enum`:return{...a,type:`select`,values:(e.values??[]).map(e=>({label:F(e.name)??F(e.id)??``,value:F(e.id)??``})),...l?{defaultValue:l}:{},...c};default:return t.push(r(`app.migration.form.lostType`,{type:i,id:n})),{...a,type:P,...c}}}function te(e,t){let n=[],r={components:(t.fields??[]).map(e=>ee(e,n)),type:`default`,id:e,executionPlatform:d,executionPlatformVersion:`8.8.0`,schemaVersion:16};return{json:`${JSON.stringify(r,null,2)}\n`,lost:n}}const L=`http://camunda.org/schema/zeebe/1.0`,R=`http://camunda.org/schema/conversion/1.0`,z=/* @__PURE__ */ new Set([`bpmn:IntermediateCatchEvent`,`bpmn:BoundaryEvent`,`bpmn:ReceiveTask`]),B=/* @__PURE__ */ new Set([`bpmn:ServiceTask`,`bpmn:SendTask`,`bpmn:BusinessRuleTask`,`bpmn:ScriptTask`,`bpmn:EndEvent`,`bpmn:IntermediateThrowEvent`]),V=/* @__PURE__ */ new Set([...B,`bpmn:CallActivity`,`bpmn:SubProcess`,`bpmn:UserTask`]),ne=/* @__PURE__ */ new Set([...V,`bpmn:IntermediateCatchEvent`,`bpmn:BoundaryEvent`,`bpmn:StartEvent`,`bpmn:ReceiveTask`]),re=/^bpmn:(?:\w*Task|SubProcess|CallActivity|Transaction|\w*Event|ExclusiveGateway|InclusiveGateway|ParallelGateway|EventBasedGateway|Process)$/,H={create:`creating`,assignment:`assigning`,update:`updating`,complete:`completing`,delete:`canceling`},ie=/* @__PURE__ */ new Set([`groovy`,`javascript`,`ecmascript`,`js`]);function ae(e){let t=e.trim();return t===``||/[\n\r;`$]/.test(t)||/(?<![=!<>])=(?!=)|\+\+|--|->|\?\.|<<|>>|=~/.test(t)?!1:!/\.\s*(?:length|size)\b(?!\s*\()/.test(t)}const oe=/* @__PURE__ */ new Set([`camunda:InputOutput`,`camunda:ExecutionListener`,`camunda:TaskListener`,`camunda:Properties`,`camunda:In`,`camunda:Out`,`camunda:FailedJobRetryTimeCycle`,`camunda:Field`,`camunda:FormData`]);function U(e,t){return r(`app.migration.detail.${e}`,t)}function W(e){return(e.split(`:`).pop()??e).replace(/([a-z])([A-Z])/g,`$1 $2`).toLowerCase()}function G(e){return(typeof e?.name==`string`?e.name.replace(/\s+/g,` `).trim():``)||e?.id||W(e?.$type??`element`)}function K(e){if(typeof e==`string`)return e.trim()?e:void 0;if(typeof e==`boolean`||typeof e==`number`)return String(e)}function se(e){let t=/^\s*R(\d+)\//.exec(e);if(t)return t[1];let n=e.split(`,`).map(e=>e.trim()).filter(Boolean);return n.length>0&&n.every(e=>/^P/.test(e))?String(n.length):null}function ce(e){let t=e.trim().split(/\s+/);return t.length>=5&&t.length<=7&&!e.trim().startsWith(`R`)&&!e.trim().startsWith(`P`)}var le=class{findings=[];changes=[];extraFiles=[];delegates=[];definitions;moddle;target;options;kept=/* @__PURE__ */ new WeakMap;keptCount=0;keptValues=/* @__PURE__ */ new WeakSet;marks=/* @__PURE__ */ new Map;process=null;constructor(e,t={}){this.definitions=e,this.moddle=s(e),this.options=t,this.target=t.target??`8.8`}run(){this.removeMarkers(this.definitions),this.take(this.definitions,`camunda:diagramRelationId`);let e=this.definitions.rootElements??[];e.filter(e=>e.$type===`bpmn:Error`&&!this.skipped(e)).forEach(e=>this.error(e)),e.filter(e=>e.$type===`bpmn:Message`&&!this.skipped(e)).forEach(e=>this.messageName(e)),e.filter(e=>e.$type===`bpmn:Process`).forEach(e=>{this.process=e,this.skipped(e)||(this.processAttributes(e),this.common(e)),(e.flowElements??[]).forEach(e=>this.flowElement(e)),(e.laneSets??[]).forEach(e=>this.common(e))}),this.process=null,(this.options.skip?.size??0)>0&&(this.keptCount+=1),this.leftovers(),this.writeMarkers(),this.platform()}skipped(e){return typeof e?.id==`string`&&this.options.skip?.has(e.id)===!0}found(e,t,n={},r={}){let{variant:i,...a}=r,o=this.anchor(e),s={...A[t],...a},{text:c,english:l}=N(t,s,n,i),u={rule:`migration/${t}`,severity:s.severity,conversion:s.conversion,title:c.title,detail:c.detail,action:c.action,elements:o?.id?[o.id]:[],where:G(o),...s.since?{since:s.since}:{},...s.link?{link:s.link}:{}};return this.findings.push(u),u.conversion!==`automatic`&&o&&this.marks.set(o,[...this.marks.get(o)??[],{conversion:u.conversion,...l}]),u}changed(e,t,n,r){this.changes.push({elementId:e?.id??``,where:G(e),before:t,after:n,...r?{plain:r}:{}})}get(e,t){return K(e?.get?.(t))??K(e?.$attrs?.[t])}take(e,t){let n=this.get(e,t);if(n!==void 0)return e.$attrs&&t in e.$attrs?delete e.$attrs[t]:e.set(t,void 0),n}keep(e,t){let n=this.kept.get(e)??/* @__PURE__ */ new Set;n.add(t),this.kept.set(e,n),this.keptCount+=1}isKept(e,t){return this.kept.get(e)?.has(t)===!0}anchor(e){let t=e;for(;t?.$parent&&(!t.id||/EventDefinition$|LoopCharacteristics$|^bpmn:(?:Formal)?Expression$|^bpmn:ExtensionElements$/.test(t.$type));)t=t.$parent;return t}values(e){return e?.extensionElements?.values??[]}extensions(e,t){return this.values(e).filter(e=>e.$type===t)}remove(e,t){e.extensionElements&&(e.extensionElements.values=this.values(e).filter(e=>e!==t),e.extensionElements.values.length===0&&(e.extensionElements=void 0))}add(e,t,n={}){e.extensionElements||(e.extensionElements=this.moddle.create(`bpmn:ExtensionElements`,{values:[]}),e.extensionElements.$parent=e);let r=this.moddle.create(t,n);return r.$parent=e.extensionElements,e.extensionElements.values=[...this.values(e),r],r}single(e,t){return this.extensions(e,t)[0]??this.add(e,t)}feel(e,t,n,r={}){if(!h(n))return n;let i=p(n,r);return i.ok?(i.review.length>0?this.found(e,`expression-review`,{expression:n,feel:i.feel,reason:i.review.join(`; `)}):t===`condition`&&this.found(e,`condition`,{expression:n,feel:i.feel}),i.feel):(this.found(e,`expression-manual`,{expression:n,reason:i.reason}),null)}feelOrLiteral(e,t,n){return n===void 0?`=null`:h(n)?this.feel(e,t,n):`=${JSON.stringify(n)}`}since(e,t,n,r){return u(this.target,n)?!0:(this.found(e,`element-since`,{what:t,version:n,target:this.target},r?{detail:r,variant:`withDetail`}:{}),!1)}delegate(e,t){this.delegates.push({...t,elementId:e.id,where:G(e)})}common(e){let t=[`camunda:asyncBefore`,`camunda:asyncAfter`,`camunda:async`].map(t=>this.take(e,t)).some(e=>e===`true`);this.take(e,`camunda:exclusive`),t&&(this.found(e,`async`),this.changed(e,r(`app.migration.change.asyncBefore`),r(`app.migration.change.removed`),r(`app.migration.change.async`)));let n=this.take(e,`camunda:modelerTemplate`);this.take(e,`camunda:modelerTemplateVersion`),n&&this.found(e,`template`,{template:n}),this.executionListeners(e),this.properties(e)}processAttributes(e){let t=this.take(e,`camunda:versionTag`);t&&(u(this.target,`8.6`)?(this.single(e,`zeebe:VersionTag`).value=t,this.found(e,`version-tag`,{tag:t}),this.changed(e,`camunda:versionTag="${t}"`,`zeebe:versionTag value="${t}"`,r(`app.migration.change.versionTag`,{tag:t}))):this.found(e,`version-tag`,{tag:t},{severity:`warning`,variant:`dropped`,title:`The version tag {tag} is dropped`,detail:`Camunda 8 keeps version tags from 8.6.`}));let n=this.take(e,`camunda:historyTimeToLive`);n&&this.found(e,`history-time-to-live`,{ttl:n}),this.take(e,`camunda:isStartableInTasklist`)!==void 0&&this.found(e,`startable-in-tasklist`),[`camunda:candidateStarterGroups`,`camunda:candidateStarterUsers`].forEach(t=>{let n=this.get(e,t);n&&(this.keep(e,t),this.found(e,`starter-groups`,{groups:n}))}),this.priority(e),this.take(e,`camunda:taskPriority`)&&this.found(e,`external-task-priority`)}priority(e){let t=this.take(e,`camunda:jobPriority`);if(t){if(u(this.target,`8.8`)&&(e.$type===`bpmn:Process`||B.has(e.$type))){let n=this.feelOrLiteral(e,`job priority`,t);if(n===null)return;this.single(e,`zeebe:JobPriorityDefinition`).priority=n.startsWith(`="`)?JSON.parse(n.slice(1)):n,this.found(e,`job-priority`,{priority:t})}else this.found(e,`job-priority-dropped`,{priority:t})}}properties(e){this.extensions(e,`camunda:Properties`).forEach(t=>{let n=this.single(e,`zeebe:Properties`),r=(t.values??[]).map(e=>this.moddle.create(`zeebe:Property`,{name:e.name,value:e.value}));n.properties=[...n.properties??[],...r],this.remove(e,t),this.found(e,`properties`)})}flowElement(e){if(this.skipped(e)){(e.flowElements??[]).forEach(e=>this.flowElement(e));return}let t=e.$type;switch(this.common(e),t){case`bpmn:ServiceTask`:case`bpmn:SendTask`:this.implementation(e,e);break;case`bpmn:BusinessRuleTask`:this.get(e,`camunda:decisionRef`)?this.decision(e):this.implementation(e,e);break;case`bpmn:ScriptTask`:this.script(e);break;case`bpmn:UserTask`:this.userTask(e);break;case`bpmn:CallActivity`:this.callActivity(e);break;case`bpmn:ReceiveTask`:e.messageRef&&this.found(e,`message-catch`,{message:G(e.messageRef)});break;case`bpmn:ComplexGateway`:this.found(e,`unsupported-element`,{what:a(`bpmn:ComplexGateway`),reason:U(`complexGateway`),action:U(`complexGatewayAction`)});break;case`bpmn:InclusiveGateway`:(e.incoming??[]).length>1&&this.since(e,`joining inclusive gateway`,`8.6`);break;case`bpmn:Transaction`:this.found(e,`unsupported-element`,{what:a(`bpmn:Transaction`),reason:U(`transaction`),action:U(`transactionAction`)});break;case`bpmn:AdHocSubProcess`:this.since(e,a(`bpmn:AdHocSubProcess`),`8.7`);break;case`bpmn:SequenceFlow`:this.condition(e);break;case`bpmn:StartEvent`:this.startEvent(e)}t.endsWith(`Event`)&&this.event(e),this.loop(e),this.inputOutput(e),this.retries(e),this.fields(e),this.priority(e),this.taskListeners(e),(e.flowElements??[]).forEach(e=>this.flowElement(e))}implementation(e,t){let n=this.values(t).find(e=>e.$type===`camunda:Connector`);if(n)return this.keptValues.add(n),this.found(e,`connector`,{connector:K(n.connectorId)??`connector`}),!1;let i=this.get(t,`camunda:topic`),a=this.get(t,`camunda:type`)===`external`||i!==void 0;this.values(t).filter(e=>e.$type===`camunda:ErrorEventDefinition`).forEach(t=>{this.keptValues.add(t),this.found(e,`external-error`,{expression:K(t.expression)??``})});let o=null;if(a){if(!i)return!1;if(h(i)){let n=this.feel(e,`topic`,i);if(n===null)return this.keep(t,`camunda:topic`),!1;o=n}else o=i;this.take(t,`camunda:type`),this.take(t,`camunda:topic`),this.found(e,`external-task`,{topic:i,jobType:o}),this.delegate(e,{kind:`topic`,value:i,role:`task`,jobType:o}),this.take(t,`camunda:taskPriority`)&&this.found(e,`external-task-priority`)}else{let n=this.get(t,`camunda:class`),r=this.get(t,`camunda:delegateExpression`),i=this.get(t,`camunda:expression`),a=this.get(t,`camunda:resultVariable`);if(n)o=m(`class`,n),this.take(t,`camunda:class`),this.found(e,`java-class`,{className:n,jobType:o}),this.delegate(e,{kind:`class`,value:n,role:`task`,jobType:o});else if(r){let n=/^[$#]\{\s*([A-Za-z_][\w]*)\s*\}$/.exec(r.trim())?.[1];if(!n)return this.keep(t,`camunda:delegateExpression`),this.found(e,`delegate-expression-dynamic`,{expression:r}),!1;o=m(`bean`,n),this.take(t,`camunda:delegateExpression`),this.found(e,`delegate-expression`,{delegate:r,jobType:o}),this.delegate(e,{kind:`bean`,value:n,role:`task`,jobType:o})}else if(i){let n=/^[$#]\{\s*([A-Za-z_]\w*)\s*\.\s*([A-Za-z_]\w*)\s*\([^]*\)\s*\}$/.exec(i.trim());if(!n||n[1]===`execution`)return this.keep(t,`camunda:expression`),a&&this.keep(t,`camunda:resultVariable`),this.found(e,`expression-unknown`,{expression:i}),!1;o=m(`expression`,`${n[1]}.${n[2]}`),this.take(t,`camunda:expression`),this.take(t,`camunda:resultVariable`),this.found(e,`expression`,{expression:i,jobType:o},a?{variant:`withResult`,action:`Write a job worker for {jobType} that makes the call {expression} made and completes the job with the variable {result}.`}:{}),this.delegate(e,{kind:`expression`,value:i,role:`task`,jobType:o})}a&&this.get(t,`camunda:resultVariable`)&&this.take(t,`camunda:resultVariable`)}if(!o)return!1;let s=this.single(e,`zeebe:TaskDefinition`);return s.type=o,this.changed(e,r(`app.migration.change.camunda7Implementation`),`zeebe:taskDefinition type="${o}"`,r(`app.migration.change.jobWorkerTask`,{jobType:o})),!0}retries(e){[e,e.loopCharacteristics].filter(Boolean).forEach(t=>{this.extensions(t,`camunda:FailedJobRetryTimeCycle`).forEach(n=>{let i=K(n.body)??``;this.remove(t,n);let a=this.extensions(e,`zeebe:TaskDefinition`)[0],o=se(i);a&&o&&t===e?(a.retries=o,this.found(e,`retries`,{cycle:i,retries:o}),this.changed(e,`camunda:failedJobRetryTimeCycle ${i}`,`retries="${o}"`,r(`app.migration.change.retries`,{retries:o}))):this.found(e,`retries-dropped`,{cycle:i})})})}fields(e){let t=this.extensions(e,`camunda:Field`);if(t.length===0)return;let n=this.extensions(e,`zeebe:TaskDefinition`)[0],i=[];t.forEach(t=>{let r=K(t.stringValue)??K(t.string),a=K(t.expression);if(!n||a!==void 0||r===void 0){this.keptValues.add(t),this.found(e,`field-injection-expression`,{field:t.name});return}let o=this.single(e,`zeebe:TaskHeaders`);o.values=[...o.values??[],this.moddle.create(`zeebe:Header`,{key:t.name,value:r})],this.remove(e,t),i.push(t.name)}),i.length>0&&(this.found(e,`field-injection`,{fields:i.join(`, `)}),this.changed(e,`camunda:field ${i.join(`, `)}`,`zeebe:taskHeaders ${i.join(`, `)}`,r(`app.migration.change.fieldHeaders`,{fields:i.join(`, `)})))}parameter(e,t){let n=t.definition;return n?this.definitionValue(e,t.name,n):this.feelOrLiteral(e,`mapping`,K(t.value))}definitionValue(e,t,n){switch(n.$type){case`camunda:Script`:return this.found(e,`input-output-script`,{name:t,format:K(n.scriptFormat)??`script`}),null;case`camunda:List`:{let r=(n.items??[]).map(n=>this.item(e,t,n));return r.some(e=>e===null)?null:`=[${r.join(`, `)}]`}case`camunda:Map`:{let r=(n.entries??[]).map(n=>{let r=n.definition?this.definitionValue(e,t,n.definition):this.feelOrLiteral(e,`mapping`,K(n.value));return r===null?null:`${JSON.stringify(n.key??``)}: ${r.slice(1)}`});return r.some(e=>e===null)?null:`={${r.join(`, `)}}`}default:return this.found(e,`input-output-manual`,{name:t,reason:U(`mappingValue`,{type:W(n.$type)})}),null}}item(e,t,n){if(n.$type===`camunda:Value`){let t=this.feelOrLiteral(e,`mapping`,K(n.value));return t===null?null:t.slice(1)}let r=this.definitionValue(e,t,n);return r===null?null:r.slice(1)}inputOutput(e){this.extensions(e,`camunda:InputOutput`).forEach(t=>{let n=(t,n,r)=>t.filter(t=>{if(!r)return this.found(e,`input-output-manual`,{name:t.name,reason:U(`noMapping`,{kind:n,element:W(e.$type)})}),!0;let i=this.parameter(e,t);if(i===null)return!0;let a=this.single(e,`zeebe:IoMapping`),o=this.moddle.create(n===`input`?`zeebe:Input`:`zeebe:Output`,{source:i,target:t.name});return n===`input`?a.inputParameters=[...a.inputParameters??[],o]:a.outputParameters=[...a.outputParameters??[],o],!1}),i=n(t.inputParameters??[],`input`,V.has(e.$type)),a=n(t.outputParameters??[],`output`,ne.has(e.$type)),o=(t.inputParameters?.length??0)+(t.outputParameters?.length??0)-i.length-a.length;o>0&&(this.found(e,`input-output`),this.changed(e,`camunda:inputOutput`,`zeebe:ioMapping, ${o} parameter${o===1?``:`s`}`,r(`app.migration.change.ioMapping`,{count:o}))),i.length+a.length===0?this.remove(e,t):(t.inputParameters=i,t.outputParameters=a,this.keptValues.add(t))})}condition(e){let t=e.conditionExpression;if(!t)return;let n=K(t.language),i=this.get(t,`camunda:resource`);if(i){this.keep(t,`camunda:resource`),this.found(e,`script-resource`,{resource:i});return}if(n&&!/^(juel|feel)$/i.test(n)){this.found(e,`script-condition`,{format:n});return}let a=K(t.body);if(!a)return;if(n?.toLowerCase()===`feel`){t.body=a.startsWith(`=`)?a:`=${a}`,t.language=void 0,this.changed(e,a,t.body,r(`app.migration.change.conditionFeel`));return}let o=this.feel(e,`condition`,a);o!==null&&(t.body=o,t.language=void 0,this.changed(e,a,o,r(`app.migration.change.conditionRewritten`)))}loop(e){let t=e.loopCharacteristics;if(t?.$type!==`bpmn:MultiInstanceLoopCharacteristics`){t?.$type===`bpmn:StandardLoopCharacteristics`&&this.found(e,`unsupported-element`,{what:`standard loop`,reason:U(`standardLoop`),action:U(`standardLoopAction`)});return}this.common(t);let n=this.get(t,`camunda:collection`),i=this.get(t,`camunda:elementVariable`),a=K(t.loopCardinality?.body),o=()=>this.single(t,`zeebe:LoopCharacteristics`);if(n){let a=h(n)?this.feel(e,`collection`,n,{multiInstance:!0}):`=${n}`;if(a===null)this.keep(t,`camunda:collection`),i&&this.keep(t,`camunda:elementVariable`);else{this.take(t,`camunda:collection`),this.take(t,`camunda:elementVariable`);let s=o();s.inputCollection=a,i&&(s.inputElement=i),this.found(e,`multi-instance`,{collection:n}),this.changed(e,`camunda:collection="${n}"`,`inputCollection="${a}"`,r(`app.migration.change.collection`,{collection:n}))}}else if(a){let n=h(a)?this.feel(e,`cardinality`,a,{multiInstance:!0}):`=${a.trim()}`;if(n!==null){t.loopCardinality=void 0;let i=/^[\w.]+$/.test(n.slice(1))?n.slice(1):`(${n.slice(1)})`;o().inputCollection=`=for i in 1..${i} return i`,this.found(e,`multi-instance-cardinality`,{cardinality:a}),this.changed(e,`loopCardinality ${a}`,`inputCollection="=for i in 1..${i} return i"`,r(`app.migration.change.loopCount`,{cardinality:a}))}}else this.extensions(t,`zeebe:LoopCharacteristics`)[0]?.inputCollection||this.found(e,`multi-instance-missing`);let s=K(t.completionCondition?.body);if(s&&h(s)){let n=this.feel(e,`completion condition`,s,{multiInstance:!0});n!==null&&(t.completionCondition.body=n,t.completionCondition.language=void 0,this.changed(e,s,n,r(`app.migration.change.completionCondition`)))}}startEvent(e){let t=this.get(e,`camunda:initiator`);t&&(this.keep(e,`camunda:initiator`),this.found(e,`initiator`,{variable:t})),this.form(e)}event(e){(e.eventDefinitions??[]).forEach(t=>{switch(this.common(t),t.$type){case`bpmn:MessageEventDefinition`:this.messageEvent(e,t);break;case`bpmn:TimerEventDefinition`:this.timer(e,t);break;case`bpmn:ErrorEventDefinition`:this.errorEvent(e,t);break;case`bpmn:EscalationEventDefinition`:{let n=this.get(t,`camunda:escalationCodeVariable`);n&&(this.keep(t,`camunda:escalationCodeVariable`),this.found(e,`escalation-code-variable`,{variable:n}));break}case`bpmn:SignalEventDefinition`:this.signal(e,t);break;case`bpmn:ConditionalEventDefinition`:this.conditional(e,t);break;case`bpmn:CompensateEventDefinition`:this.since(e,`compensation event`,`8.5`);break;case`bpmn:CancelEventDefinition`:this.found(e,`unsupported-element`,{what:`cancel event`,reason:U(`cancelEvent`),action:U(`cancelEventAction`)})}})}messageEvent(e,t){if(e.$type===`bpmn:EndEvent`||e.$type===`bpmn:IntermediateThrowEvent`){if(![`camunda:class`,`camunda:delegateExpression`,`camunda:expression`,`camunda:topic`].some(e=>this.get(t,e))){this.found(e,`message-throw-empty`);return}let n=this.findings.length;if(this.implementation(e,t)){let t=this.extensions(e,`zeebe:TaskDefinition`)[0]?.type,r=/* @__PURE__ */ new Set([`migration/java-class`,`migration/delegate-expression`,`migration/expression`,`migration/external-task`]),i=this.findings.findIndex((e,t)=>t>=n&&r.has(e.rule));i>=0&&this.findings.splice(i,1);let a=this.delegates[this.delegates.length-1];this.found(e,`message-throw`,{implementation:a?.value??`the implementation`,jobType:t??``})}}else(z.has(e.$type)||e.$type===`bpmn:StartEvent`&&e.$parent?.$type===`bpmn:SubProcess`)&&t.messageRef&&this.found(e,`message-catch`,{message:G(t.messageRef)})}messageName(e){let t=K(e.name);if(!t||!h(t))return;let n=p(t);n.ok?(n.review.length>0?this.found(e,`expression-review`,{expression:t,feel:n.feel,reason:n.review.join(`; `)}):this.found(e,`message-name-expression`,{name:t,feel:n.feel}),this.changed(e,t,n.feel,r(`app.migration.change.messageName`,{name:t})),e.name=n.feel):this.found(e,`expression-manual`,{expression:t,reason:n.reason})}timer(e,t){[`timeDate`,`timeDuration`,`timeCycle`].forEach(n=>{let i=t[n],a=K(i?.body);if(a){if(h(a)){let t=this.feel(e,`timer`,a);if(t===null)return;i.body=t,this.found(e,`timer`,{timer:a}),this.changed(e,a,t,r(`app.migration.change.timer`))}else n===`timeCycle`&&ce(a)&&this.found(e,`timer-cron`,{cycle:a})}})}errorEvent(e,t){let n=this.take(t,`camunda:errorCodeVariable`),i=this.take(t,`camunda:errorMessageVariable`);[[n,`errorCode`],[i,`errorMessage`]].forEach(([t,n])=>{if(!t||!n)return;let i=this.single(e,`zeebe:IoMapping`);i.outputParameters=[...i.outputParameters??[],this.moddle.create(`zeebe:Output`,{source:`=${n}`,target:t})],this.found(e,`error-code-variable`,{variable:t}),this.changed(e,`camunda:${n}Variable="${t}"`,`zeebe:output source="=${n}" target="${t}"`,r(`app.migration.change.errorVariable`,{source:n,variable:t}))})}error(e){let t=this.take(e,`camunda:errorMessage`);t&&this.found(e,`error-message`,{message:t});let n=K(e.errorCode);n&&h(n)&&this.found(e,`expression-manual`,{expression:n,reason:U(`errorCode`)})}signal(e,t){let n=this.extensions(t,`camunda:In`);if(n.length===0)return;let r=e.$type===`bpmn:EndEvent`||e.$type===`bpmn:IntermediateThrowEvent`,i=G(t.signalRef);n.forEach(n=>{let i=K(n.source)??K(n.sourceExpression),a=K(n.target);if(!r||!i||!a||K(n.variables)){this.keptValues.add(n);return}let o=K(n.sourceExpression)?this.feel(e,`signal variable`,i):`=${i}`;if(o===null){this.keptValues.add(n);return}let s=this.single(e,`zeebe:IoMapping`);s.inputParameters=[...s.inputParameters??[],this.moddle.create(`zeebe:Input`,{source:o,target:a})],this.remove(t,n)}),this.found(e,`signal-variables`,{signal:i})}conditional(e,t){if(!this.since(e,`conditional event`,`8.9`)){this.keep(t,`camunda:variableName`),this.keep(t,`camunda:variableEvents`);return}let n=K(t.condition?.body),r=this.take(t,`camunda:variableName`),i=this.take(t,`camunda:variableEvents`);if(n){let r=this.feel(e,`condition`,n);r!==null&&(t.condition.body=r,t.condition.language=void 0)}if(r||i){let e=this.single(t,`zeebe:ConditionalFilter`);r&&(e.variableNames=r),i&&(e.variableEvents=i)}this.found(e,`conditional-event`,{variables:r??`any variable`})}script(e){let t=K(e.scriptFormat)?.toLowerCase(),n=this.get(e,`camunda:resource`),r=this.get(e,`camunda:resultVariable`);if(n){this.keep(e,`camunda:resource`),r&&this.keep(e,`camunda:resultVariable`),this.found(e,`script-resource`,{resource:n});return}let i=K(e.script);if(t===`feel`&&i)this.feelScript(e,t,i.trim().startsWith(`=`)?i.trim():`=${i.trim()}`,r);else if(t===`juel`&&i&&h(i)){let n=this.feel(e,`script`,i);if(n===null){r&&this.keep(e,`camunda:resultVariable`);return}this.feelScript(e,t,n,r)}else{if(i&&t&&ie.has(t)&&ae(i)){let n=p(`\${${i.trim()}}`);if(n.ok){this.found(e,`expression-review`,{expression:i.trim(),feel:n.feel,reason:[U(`scriptExpression`,{format:t}),...n.review].join(`; `)}),this.feelScript(e,t,n.feel,r);return}}r&&this.keep(e,`camunda:resultVariable`),this.found(e,`script-task`,{format:t??`script`})}}feelScript(e,t,n,i){let a=i??`result`;e.scriptFormat=void 0,e.script=void 0,this.take(e,`camunda:resultVariable`);let o=this.single(e,`zeebe:Script`);o.expression=n,o.resultVariable=a,this.found(e,`script-task-feel`,{variable:a},i?{}:{severity:`warning`,conversion:`review`,variant:`noResult`,title:`The FEEL script's result goes to {variable}`,detail:`Camunda 8 needs a result variable for a FEEL script task, and the Camunda 7 task had none.`,action:`Rename {variable} if something should read the result.`}),this.changed(e,`${t} script`,`zeebe:script expression`,r(`app.migration.change.feelScript`))}userTask(e){u(this.target,`8.5`)&&this.extensions(e,`zeebe:UserTask`).length===0&&(this.add(e,`zeebe:UserTask`),this.found(e,`user-task`),this.changed(e,r(`app.migration.change.userTaskBefore`),`zeebe:userTask`,r(`app.migration.change.userTask`)));let t={};[`assignee`,`candidateUsers`,`candidateGroups`].forEach(n=>{let r=this.get(e,`camunda:${n}`);if(!r)return;let i=this.userTaskValue(e,n,r,n!==`assignee`);i===null?this.keep(e,`camunda:${n}`):(this.take(e,`camunda:${n}`),t[n]=i)}),Object.keys(t).length>0&&(Object.assign(this.single(e,`zeebe:AssignmentDefinition`),t),this.changed(e,`camunda assignment`,`zeebe:assignmentDefinition ${Object.keys(t).join(`, `)}`,r(`app.migration.change.assignment`)));let n={};[`dueDate`,`followUpDate`].forEach(t=>{let r=this.get(e,`camunda:${t}`);if(!r)return;let i=this.userTaskValue(e,t,r,!1);i===null?this.keep(e,`camunda:${t}`):(this.take(e,`camunda:${t}`),n[t]=i)}),Object.keys(n).length>0&&Object.assign(this.single(e,`zeebe:TaskSchedule`),n);let i=this.get(e,`camunda:priority`);if(i){if(!u(this.target,`8.6`))this.take(e,`camunda:priority`),this.found(e,`user-task-priority-dropped`,{priority:i});else{let t=this.userTaskValue(e,`priority`,i,!1);if(t===null)this.keep(e,`camunda:priority`);else{this.take(e,`camunda:priority`),this.single(e,`zeebe:PriorityDefinition`).priority=t;let n=Number(t);!h(i)&&(!Number.isInteger(n)||n<0||n>100)&&this.found(e,`user-task-priority-range`,{priority:i})}}}this.form(e)}userTaskValue(e,t,n,r){if(!h(n))return n;let i=p(n);return i.ok?(i.review.length>0?this.found(e,`user-task-expression`,{name:t,expression:n,feel:i.feel,reason:i.review.join(`; `)}):r&&this.found(e,`assignment-review`,{name:t,expression:n}),i.feel):(this.found(e,`expression-manual`,{expression:n,reason:i.reason}),null)}form(e){let t=this.get(e,`camunda:formKey`),n=this.get(e,`camunda:formRef`),i=this.get(e,`camunda:formRefBinding`),a=this.get(e,`camunda:formRefVersion`),o=this.extensions(e,`camunda:FormData`)[0];this.get(e,`camunda:formHandlerClass`)&&this.keep(e,`camunda:formHandlerClass`);let s=e.$type===`bpmn:StartEvent`;if(n){if(i===`version`){this.keep(e,`camunda:formRef`),this.keep(e,`camunda:formRefBinding`),this.keep(e,`camunda:formRefVersion`),this.found(e,`form-binding-version`,{version:a??``});return}let t=this.single(e,`zeebe:FormDefinition`);t.formId=n,i&&i!==`latest`&&u(this.target,`8.6`)&&(t.bindingType=i,i===`versionTag`&&a&&(t.versionTag=a)),[`camunda:formRef`,`camunda:formRefBinding`,`camunda:formRefVersion`].forEach(t=>this.take(e,t)),this.found(e,`form-camunda`,{form:n}),this.changed(e,`camunda:formRef="${n}"`,`zeebe:formDefinition formId="${n}"`,r(`app.migration.change.formRef`,{form:n}))}else if(t){let n=/^camunda-forms:(deployment|app):(.+)$/.exec(t);if(n){let i=n[2],a=i.split(`/`).pop()??i,o=this.options.forms?.get(a)??this.options.forms?.get(i),s=o??a.replace(/\.form$/,``),c=this.single(e,`zeebe:FormDefinition`);c.formId=s,n[1]===`deployment`&&u(this.target,`8.6`)&&(c.bindingType=`deployment`),this.take(e,`camunda:formKey`),this.found(e,o?`form-camunda`:`form-camunda-unknown`,{form:o?s:i}),this.changed(e,`camunda:formKey="${t}"`,`zeebe:formDefinition formId="${s}"`,r(`app.migration.change.formRef`,{form:s}));return}if(/^embedded:/.test(t)){this.keep(e,`camunda:formKey`),this.found(e,`form-embedded`,{formKey:t});return}if(s||!u(this.target,`8.4`)){this.keep(e,`camunda:formKey`),this.found(e,`form-embedded`,{formKey:t},{variant:`here`,title:`The form key {formKey} has no Camunda 8 counterpart here`});return}this.single(e,`zeebe:FormDefinition`).externalReference=t,this.take(e,`camunda:formKey`),this.found(e,`form-external`,{formKey:t}),this.changed(e,`camunda:formKey="${t}"`,`zeebe:formDefinition externalReference="${t}"`,r(`app.migration.change.externalForm`,{formKey:t}))}else if(o){let t=`${this.process?.id??`process`}-${e.id}`,n=te(t,o);this.extraFiles.push({name:`${t}.form`,content:n.json,reason:r(`app.migration.extraFile.form`,{where:G(e)})}),this.single(e,`zeebe:FormDefinition`).formId=t,this.remove(e,o),this.found(e,`form-generated`,{form:`${t}.form`}),n.lost.length>0&&this.found(e,`form-generated-partly`,{lost:n.lost.join(`, `)}),this.changed(e,`camunda:formData`,`zeebe:formDefinition formId="${t}" and ${t}.form`,r(`app.migration.change.generatedForm`,{form:t}))}}decision(e){let t=this.get(e,`camunda:decisionRef`)??``,n=this.get(e,`camunda:decisionRefBinding`),i=this.get(e,`camunda:decisionRefVersion`),a=this.get(e,`camunda:decisionRefTenantId`),o=this.get(e,`camunda:resultVariable`),s=this.get(e,`camunda:mapDecisionResult`);if(n===`version`){this.keep(e,`camunda:decisionRefBinding`),this.keep(e,`camunda:decisionRefVersion`),this.keep(e,`camunda:decisionRef`),this.found(e,`binding-version`,{what:U(`decisionBound`,{name:t}),version:i??``});return}let c=h(t)?this.feel(e,`decision`,t):t;if(c===null){this.keep(e,`camunda:decisionRef`);return}let l=this.single(e,`zeebe:CalledDecision`);l.decisionId=c,l.resultVariable=o??`result`,n&&n!==`latest`&&(u(this.target,`8.6`)?(l.bindingType=n,n===`versionTag`&&i&&(l.versionTag=i)):this.found(e,`binding-dropped`,{binding:n,target:t})),[`camunda:decisionRef`,`camunda:decisionRefBinding`,`camunda:decisionRefVersion`,`camunda:resultVariable`,`camunda:mapDecisionResult`].forEach(t=>this.take(e,t)),this.found(e,`decision`,{decision:t,result:l.resultVariable}),o||this.found(e,`decision-result-variable`,{result:`result`}),s!==`singleEntry`&&o&&this.found(e,`decision-result`,{mapping:s??`resultList`,result:o}),a&&(this.keep(e,`camunda:decisionRefTenantId`),this.found(e,`tenant`,{tenant:a})),this.changed(e,`camunda:decisionRef="${t}"`,`zeebe:calledDecision decisionId="${c}" resultVariable="${l.resultVariable}"`,r(`app.migration.change.calledDecision`,{decision:c,result:l.resultVariable}))}callActivity(e){let t=K(e.calledElement),n=this.get(e,`camunda:calledElementBinding`),i=this.get(e,`camunda:calledElementVersion`),a=this.get(e,`camunda:calledElementVersionTag`),o=this.get(e,`camunda:calledElementTenantId`),s=this.get(e,`camunda:caseRef`);s&&([`camunda:caseRef`,`camunda:caseBinding`,`camunda:caseVersion`,`camunda:caseTenantId`].forEach(t=>this.keep(e,t)),this.found(e,`cmmn`,{case:s})),[`camunda:variableMappingClass`,`camunda:variableMappingDelegateExpression`].forEach(n=>{this.get(e,n)&&(this.keep(e,n),this.found(e,`call-activity-mapping-class`,{process:t??`the called process`}))}),o&&(this.keep(e,`camunda:calledElementTenantId`),this.found(e,`tenant`,{tenant:o}));let c=t??this.extensions(e,`zeebe:CalledElement`)[0]?.processId??`the called process`;if(this.extensions(e,`camunda:In`).filter(e=>K(e.businessKey)).forEach(t=>{this.keptValues.add(t),this.found(e,`call-activity-business-key`,{process:c})}),!t)return;if(n===`version`){this.keep(e,`camunda:calledElementBinding`),this.keep(e,`camunda:calledElementVersion`),this.found(e,`binding-version`,{what:U(`callBound`,{name:t}),version:i??``});return}let l=h(t)?this.feel(e,`called element`,t):t;if(l===null)return;let d=this.single(e,`zeebe:CalledElement`);d.processId=l,e.calledElement=void 0,n&&n!==`latest`&&(u(this.target,`8.6`)?(d.bindingType=n,n===`versionTag`&&a&&(d.versionTag=a)):this.found(e,`binding-dropped`,{binding:n,target:t})),[`camunda:calledElementBinding`,`camunda:calledElementVersion`,`camunda:calledElementVersionTag`].forEach(t=>this.take(e,t)),this.variables(e,d,t),this.found(e,`call-activity`,{process:t}),this.changed(e,`calledElement="${t}"`,`zeebe:calledElement processId="${l}"`,r(`app.migration.change.calledProcess`,{process:l}))}variables(e,t,n){let r=this.extensions(e,`camunda:In`),i=this.extensions(e,`camunda:Out`),a=e=>e.some(e=>K(e.variables)===`all`);t.propagateAllParentVariables=a(r),t.propagateAllChildVariables=a(i);let o=(t,r)=>t.forEach(t=>{if(K(t.variables)===`all`){t.local===!0&&this.found(e,`call-activity-local`,{process:n}),this.remove(e,t);return}if(K(t.businessKey))return;let i=K(t.target),a=K(t.sourceExpression),o=a?this.feel(e,`variable`,a):K(t.source)?`=${K(t.source)}`:`=null`;if(!i||o===null){this.keptValues.add(t),i||this.found(e,`input-output-manual`,{name:n,reason:U(`noTarget`)});return}t.local===!0&&this.found(e,`call-activity-local`,{process:n});let s=this.single(e,`zeebe:IoMapping`),c=this.moddle.create(r===`input`?`zeebe:Input`:`zeebe:Output`,{source:o,target:i});r===`input`?s.inputParameters=[...s.inputParameters??[],c]:s.outputParameters=[...s.outputParameters??[],c],this.remove(e,t)});o(r,`input`),o(i,`output`)}executionListeners(e){let t=this.extensions(e,`camunda:ExecutionListener`);t.length!==0&&t.forEach(t=>{let n=K(t.event)??`start`,i=K(t.class)??K(t.delegateExpression)??K(t.expression)??(t.script?`${K(t.script.scriptFormat)??``} script`:`listener`),a=(r,a)=>{this.keptValues.add(t),this.found(e,`execution-listener-unsupported`,{event:n,name:i,reason:U(r,a)})};if(!u(this.target,`8.6`))return a(`listenersOldTarget`,{target:this.target});if(n===`take`||e.$type===`bpmn:SequenceFlow`)return a(`listenersNoSequenceFlow`);if(!re.test(e.$type))return a(`listenersNoOn`,{element:W(e.$type)});if(n===`start`&&(e.$type===`bpmn:BoundaryEvent`||e.$type===`bpmn:StartEvent`&&e.$parent?.$type!==`bpmn:SubProcess`))return a(`listenersEndOnly`,{element:W(e.$type)});if((t.fields??[]).length>0)return a(`listenersFields`);let o=this.listenerJob(e,t,`executionListener`,n);if(!o)return a(`listenersExpression`);let s=this.single(e,`zeebe:ExecutionListeners`);s.listeners=[...s.listeners??[],this.moddle.create(`zeebe:ExecutionListener`,{eventType:n,type:o})],this.remove(e,t),this.found(e,`execution-listener`,{event:n,name:i,jobType:o}),this.changed(e,`camunda:executionListener ${n} ${i}`,`zeebe:executionListener ${n} type="${o}"`,r(`app.migration.change.listener`,{event:n,name:i,jobType:o}))})}taskListeners(e){this.extensions(e,`camunda:TaskListener`).forEach(t=>{let n=K(t.event)??`create`,a=K(t.class)??K(t.delegateExpression)??K(t.expression)??(t.script?`${K(t.script.scriptFormat)??``} script`:`listener`),o=(r,i)=>{this.keptValues.add(t),this.found(e,`task-listener-unsupported`,{event:n,name:a,reason:U(r,i)})},s=i(H,n);if(!u(this.target,`8.8`))return o(`taskListenersOldTarget`,{target:this.target});if(!s)return o(`taskListenersNoEvent`,{event:n});if((t.fields??[]).length>0)return o(`listenersFields`);let c=this.listenerJob(e,t,`taskListener`,n);if(!c)return o(`listenersExpression`);let l=this.single(e,`zeebe:TaskListeners`);l.listeners=[...l.listeners??[],this.moddle.create(`zeebe:TaskListener`,{eventType:s,type:c})],this.remove(e,t),this.found(e,`task-listener`,{event:n,name:a,jobType:c}),this.changed(e,`camunda:taskListener ${n} ${a}`,`zeebe:taskListener ${s} type="${c}"`,r(`app.migration.change.listener`,{event:n,name:a,jobType:c}))})}listenerJob(e,t,n,r){let i=K(t.class);if(i){let t=m(`class`,i);return this.delegate(e,{kind:`class`,value:i,role:n,jobType:t,event:r}),t}let a=/^[$#]\{\s*([A-Za-z_]\w*)\s*\}$/.exec(K(t.delegateExpression)?.trim()??``)?.[1];if(a){let t=m(`bean`,a);return this.delegate(e,{kind:`bean`,value:a,role:n,jobType:t,event:r}),t}return null}removeMarkers(e){let t=(e,n)=>{e&&typeof e==`object`&&!n.has(e)&&(n.add(e),e.extensionElements?.values&&(e.extensionElements.values=e.extensionElements.values.filter(e=>e.$type!==`conversion:message`),e.extensionElements.values.length===0&&(e.extensionElements=void 0)),[`rootElements`,`flowElements`,`eventDefinitions`,`laneSets`,`lanes`,`artifacts`].forEach(r=>(e[r]??[]).forEach(e=>t(e,n))),e.loopCharacteristics&&t(e.loopCharacteristics,n))};t(e,/* @__PURE__ */ new Set)}leftovers(){let e=/* @__PURE__ */ new Set,t=n=>{n&&typeof n==`object`&&!e.has(n)&&n.$descriptor&&(e.add(n),(n.$descriptor.properties??[]).forEach(e=>{if(e.ns?.prefix!==`camunda`||!e.isAttr||this.skipped(this.anchor(n)))return;let t=n.get(e.name);t==null||t===``||this.isKept(n,e.ns.name)||(e.default===void 0||t!==e.default)&&(this.found(n,`unknown-attribute`,{attribute:`${e.ns.name}="${String(t)}"`}),this.keep(n,e.ns.name))}),Object.keys(n.$attrs??{}).filter(e=>e.startsWith(`camunda:`)).forEach(e=>{this.isKept(n,e)||this.skipped(this.anchor(n))||(this.found(n,`unknown-attribute`,{attribute:`${e}="${n.$attrs[e]}"`}),this.keep(n,e))}),(n.extensionElements?.values??[]).forEach(e=>{if(typeof e.$type==`string`&&e.$type.startsWith(`camunda:`)&&!this.keptValues.has(e)&&!this.skipped(this.anchor(n))){let t=oe.has(e.$type)?`left after conversion`:W(e.$type);this.found(n,`unknown-attribute`,{attribute:`camunda:${e.$type.slice(8).replace(/^./,e=>e.toLowerCase())} (${t})`}),this.keptValues.add(e)}}),[`rootElements`,`flowElements`,`eventDefinitions`,`laneSets`,`lanes`,`artifacts`].forEach(e=>(n[e]??[]).forEach(t)),[`loopCharacteristics`,`conditionExpression`,`completionCondition`,`loopCardinality`,`timeDate`,`timeDuration`,`timeCycle`,`condition`].forEach(e=>t(n[e])))};t(this.definitions)}writeMarkers(){this.marks.size!==0&&(this.marks.forEach((e,t)=>{t.extensionElements||(t.extensionElements=this.moddle.create(`bpmn:ExtensionElements`,{values:[]}),t.extensionElements.$parent=t);let n=e.map(e=>{let n=this.moddle.createAny(`conversion:message`,R,{severity:e.conversion===`manual`?`TASK`:`REVIEW`,$body:`${e.title}. ${e.action}`});return n.$parent=t.extensionElements,n});t.extensionElements.values=[...this.values(t),...n]}),this.definitions.$attrs[`xmlns:conversion`]=R)}platform(){let e=this.definitions.$attrs??(this.definitions.$attrs={});if((this.options.skip?.size??0)>0){e[`xmlns:zeebe`]=L;return}let t=e[`modeler:executionPlatform`];e[`xmlns:modeler`]=`http://camunda.org/schema/modeler/1.0`,e[`modeler:executionPlatform`]=d,e[`modeler:executionPlatformVersion`]=`${this.target}.0`,e[`xmlns:zeebe`]=L,this.findings.some(e=>e.conversion===`manual`)||this.keptCount>0||delete e[`xmlns:camunda`],this.found(this.definitions,`platform`,{target:this.target}),this.changed(this.definitions,`executionPlatform ${t??`unset`}`,`${d} ${this.target}.0`,r(`app.migration.change.platform`,{target:this.target})),this.changes[this.changes.length-1].file=!0}};function q(e){return e.includes(`executionPlatform="Camunda Cloud"`)?!1:e.includes(`http://camunda.org/schema/1.0/bpmn`)||e.includes(`http://operaton.org/schema/1.0/bpmn`)||e.includes(`executionPlatform="${f}"`)}function ue(e){return e.includes(`http://operaton.org/schema/1.0/bpmn`)?e.split(`http://operaton.org/schema/1.0/bpmn`).join(`http://camunda.org/schema/1.0/bpmn`).replace(/<[^>]*>/g,e=>e.replace(/(^<\/?|\s)operaton:(?=[A-Za-z])/g,`$1camunda:`).replace(/xmlns:operaton=/g,`xmlns:camunda=`)):e}async function de(e,t={}){if(!q(e)&&/<(?:\w+:)?definitions\b/.test(e))return{ok:!0,source:!1,text:e,changes:[],open:[],extraFiles:[],findings:[],delegates:[]};let n=await o(ue(e),`migration`);if(!n)return{ok:!1,source:!1,text:e,changes:[],open:[],extraFiles:[],findings:[],delegates:[],failure:r(`app.migration.failure.notBpmn`)};if(!q(e))return{ok:!0,source:!1,text:e,changes:[],open:[],extraFiles:[],findings:[],delegates:[]};let i=new le(n,t);return i.run(),{ok:!0,source:!0,text:await c(n),changes:i.changes,open:i.findings.filter(e=>e.conversion!==`automatic`),extraFiles:i.extraFiles,findings:i.findings,delegates:i.delegates}}const fe={"http://www.omg.org/spec/DMN/20151101/dmn.xsd":`1.1`,"http://www.omg.org/spec/DMN/20180521/MODEL/":`1.2`,"https://www.omg.org/spec/DMN/20180521/MODEL/":`1.2`};function J(e,t,n,r,i){let{variant:a,...o}=n,s={...A[e],...o};return{rule:`migration/${e}`,severity:s.severity,conversion:s.conversion,...N(e,s,t,a).text,elements:i?[i]:[],where:r,...s.link?{link:s.link}:{}}}function Y(e){let t=typeof e?.name==`string`?e.name.replace(/\s+/g,` `).trim():``,n=typeof e?.label==`string`?e.label.trim():``;return t||n||e?.id||`the decisions`}function X(e){return typeof e!=`string`||e===``||/feel/i.test(e)}function pe(e){try{let t=g(e);return t.local===`definitions`?t.attrs:{}}catch{return{}}}async function me(t,n={}){let a=n.target??`8.8`,o=l(`migration`),{xml:s,from:c}=await e(t),u=pe(s),m=u.xmlns??``;if(!c&&m&&m!==`https://www.omg.org/spec/DMN/20191111/MODEL/`){let e={id:u.id,name:u.name},n=[];return n.push(J(`dmn-version`,{version:i(fe,m)??m},{},e.name??e.id??`the decisions`,e.id)),{ok:!0,source:!0,text:t,findings:n,changes:[]}}let g;try{({rootElement:g}=await o.fromXML(s,`dmn:Definitions`))}catch{g=null}if(!g)return{ok:!1,source:!1,text:t,findings:[],changes:[],failure:r(`app.migration.failure.notDmn`)};let _=g.$attrs??{},v=_[`modeler:executionPlatform`];if(v!==f)return{ok:!0,source:!1,text:t,findings:[],changes:[]};let y=[],b=[];c&&(y.push(J(`dmn-version`,{version:c},{severity:`info`,conversion:`automatic`,variant:`converted`,detail:`Camunda 8 reads DMN 1.3, so the file is written as DMN 1.3.`,action:`Nothing to do.`},Y(g),g.id)),b.push({elementId:g.id??``,where:Y(g),before:`DMN ${c}`,after:`DMN 1.3`,plain:r(`app.migration.change.dmnVersion`)}));let x=(e,t,n={})=>{y.push(J(t,n,{},Y(e),e?.id))},S=(e,t,n,r)=>{b.push({elementId:e?.id??``,where:Y(e),before:t,after:n,...r?{plain:r}:{}})};X(g.expressionLanguage)||x(g,`dmn-expression-language`,{what:`The decision file`,language:String(g.expressionLanguage)});let C=(e,t,n,i)=>{let a=t?.expressionLanguage;if(X(a))return;let o=t.text??``;if(i||!/^juel$/i.test(String(a))||!h(o)){x(e,`dmn-expression-language`,{what:n,language:String(a)});return}let s=p(o);if(!s.ok){x(e,`expression-manual`,{expression:o,reason:s.reason});return}let c=s.feel.replace(/^=/,``);t.text=c,t.expressionLanguage=void 0,x(e,`dmn-juel`,{what:n,feel:c}),S(e,o,c,r(`app.migration.change.expressionRewritten`))};(g.drgElement??[]).filter(e=>e.$type===`dmn:Decision`).forEach(e=>{let t=e.get(`camunda:historyTimeToLive`);t!==void 0&&(e.set(`camunda:historyTimeToLive`,void 0),x(e,`dmn-history-time-to-live`,{decision:Y(e)}),S(e,`camunda:historyTimeToLive="${t}"`,r(`app.migration.change.removed`),r(`app.migration.change.dmnHistoryTimeToLive`)));let n=e.decisionLogic;n?.$type===`dmn:LiteralExpression`&&C(e,n,r(`app.migration.detail.decisionNamed`,{name:Y(e)}),!1),n?.$type===`dmn:DecisionTable`&&((n.input??[]).forEach(e=>{let t=e.get(`camunda:inputVariable`);t&&x(e,`dmn-input-variable`,{input:Y(e),variable:t}),e.inputExpression&&C(e,e.inputExpression,r(`app.migration.detail.inputNamed`,{name:Y(e)}),!1)}),(n.rule??[]).forEach(e=>{(e.inputEntry??[]).forEach(t=>C(e,t,r(`app.migration.detail.ruleCondition`,{rule:e.id}),!0)),(e.outputEntry??[]).forEach(t=>C(e,t,r(`app.migration.detail.ruleOutput`,{rule:e.id}),!1))}))});let w=y.some(e=>e.conversion===`manual`);y.every(e=>e.rule===`migration/dmn-version`)&&x(g,`dmn-carries-over`),_[`xmlns:modeler`]=_[`xmlns:modeler`]??`http://camunda.org/schema/modeler/1.0`,S(g,`executionPlatform ${v}`,`Camunda Cloud ${a}.0`,r(`app.migration.change.dmnPlatform`,{target:a})),_[`modeler:executionPlatform`]=d,_[`modeler:executionPlatformVersion`]=`${a}.0`,!w&&g.$attrs?.[`xmlns:camunda`]&&delete g.$attrs[`xmlns:camunda`];let{xml:T}=await o.toXML(g,{format:!0});return{ok:!0,source:!0,text:T,findings:y,changes:b}}function he(e,t={}){let n=t.target??`8.8`,i;try{let t=JSON.parse(e);if(!t||typeof t!=`object`||Array.isArray(t))throw Error(`not a form`);i=t}catch{return{ok:!1,source:!1,text:e,findings:[],changes:[],failure:r(`app.migration.failure.notForm`)}}if(i.executionPlatform!==f)return{ok:!0,source:!1,text:e,findings:[],changes:[]};let a=A[`form-platform`],o=typeof i.id==`string`?i.id:``,s={rule:`migration/form-platform`,severity:a.severity,conversion:a.conversion,...N(`form-platform`,a).text,elements:o?[o]:[],where:o||`the form`,link:a.link},c=/^\{\n( +)"/.exec(e)?.[1].length??2,l={...i,executionPlatform:d,executionPlatformVersion:`${n}.0`};return{ok:!0,source:!0,text:`${JSON.stringify(l,null,c)}${e.endsWith(`
|
|
2
|
+
`)?`
|
|
3
|
+
`:``}`,findings:[s],changes:[{elementId:o,where:o||`the form`,before:`executionPlatform ${String(i.executionPlatform)}`,after:`Camunda Cloud ${n}.0`,plain:r(`app.migration.change.formPlatform`,{target:n})}]}}function ge(e){return t(e)}async function Z(e,t,n={}){let r=ge(e);switch(r){case`bpmn`:{let i=await de(t,n);return{path:e,kind:r,ok:i.ok,source:i.source,text:i.text,changes:i.changes,findings:i.findings,open:i.open,delegates:i.delegates,extraFiles:i.extraFiles,failure:i.failure}}case`dmn`:{let i=await me(t,n);return{path:e,kind:r,ok:i.ok,source:i.source,text:i.text,changes:i.changes,findings:i.findings,open:i.findings.filter(e=>e.conversion!==`automatic`),delegates:[],extraFiles:[],failure:i.failure}}case`form`:{let i=he(t,n);return{path:e,kind:r,ok:i.ok,source:i.source,text:i.text,changes:i.changes,findings:i.findings,open:i.findings.filter(e=>e.conversion!==`automatic`),delegates:[],extraFiles:[],failure:i.failure}}default:return null}}function _e(e){let t=/^(.*?)((?:\.bpmn(?:20)?\.xml)|\.bpmn|\.dmn|\.form)$/i.exec(e);return t?`${t[1]}.c8${t[2]}`:`${e}.c8`}function Q(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t<0?``:e.slice(0,t)}function $(e,t){let n=Q(e);return n?`${n}/${t}`:t}async function ve(e,t,n={}){let r=await Z(e,t,n);return r?{...r,changed:r.ok&&r.source&&r.text!==t,copy:_e(e),files:r.extraFiles.map(t=>({path:$(e,t.name),content:t.content,reason:t.reason}))}:null}function ye(e){let t=/* @__PURE__ */ new Map;return e.filter(e=>/\.form$/i.test(e.path)).forEach(e=>{try{let n=JSON.parse(e.text).id;typeof n==`string`&&n&&t.set(e.path.split(/[\\/]/).pop()??e.path,n)}catch{return}}),t}export{Z as a,$ as i,Q as n,A as o,ye as r,N as s,ve as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./chunk-atomicWrite-C6J1gDtO.js";import{r as t}from"./chunk-context-rCJvBM9p.js";import{t as n}from"./chunk-table-BOiaGWwY.js";import{n as r}from"./chunk-status-CmYxwOCn.js";import{s as i}from"./chunk-failure-BRyRvObj.js";import{_ as a,f as o,n as s,r as c}from"./chunk-engine-CxgdJ2wO.js";import{r as l}from"./chunk-translator-DNm9zRpP.js";import{readFileSync as u}from"node:fs";const d=o(`camunda-7`),f=o(`operaton`),p=[[c[`camunda-7`].bpmn,c.operaton.bpmn],[c[`camunda-7`].dmn,c.operaton.dmn]],m=`${a(`operaton`)}.`,h=[...new Set(s.map(e=>`${a(e)}.`))],g=new RegExp(String.raw`(<${d}:[^>]*[^/]>)([^<]*)(</${d}:)`,`g`),_=new RegExp(String.raw`(^</?|\s)${d}:(?=[A-Za-z])`,`g`),v=RegExp(`xmlns:${d}=`,`g`);function y(e){return h.reduce((e,t)=>e.split(t).join(m),e)}function b(e){return p.some(([t])=>e.includes(`xmlns:${d}="${t}"`))?p.reduce((e,[t,n])=>e.split(t).join(n),e.replace(g,(e,t,n,r)=>`${t}${y(n)}${r}`)).replace(/<[^>]*>/g,e=>y(e).replace(_,`$1${f}:`).replace(v,`xmlns:${f}=`)):e}async function x(a,o,s){if(o===void 0)return{ok:!1,lines:[l(`app.cli.convert.targetMissing`)]};if(o!==`operaton`)return{ok:!1,lines:[l(`app.cli.convert.unknownTarget`,{target:o})]};let c=[],d=!1;for(let n of a){let a;try{a=u(n,`utf8`)}catch(e){d=!0,c.push({status:r(`fail`),file:t(n),details:i(t(n),e)});continue}let o=b(a);o===a?c.push({status:r(`skip`),file:t(n),details:l(`app.cli.convert.unchanged`)}):s?(e(n,o),c.push({status:r(`updated`),file:t(n),details:l(`app.cli.convert.changed`)})):c.push({status:r(`skip`),file:t(n),details:l(`app.cli.convert.wouldChange`)})}let f=n(c,{columns:[{name:`status`,minWidth:8},{name:`file`},{name:`details`,wrap:!0}],headers:!1});return{ok:!d,lines:f}}export{x as convertCommand};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{s as deployCommand}from"./chunk-deploy-DZgCTgaY.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{o as e}from"./chunk-failure-BRyRvObj.js";import{L as t}from"./chunk-load-rfn3E0t5.js";import{a as n,i as r,n as i,r as a,t as o}from"./chunk-context-rCJvBM9p.js";import{r as s}from"./chunk-translator-DNm9zRpP.js";import{g as c,h as l,l as u,u as d}from"./chunk-engine-CxgdJ2wO.js";import{a as f}from"./chunk-moddle-D3Ym38EZ.js";import{_ as p,o as m}from"./chunk-tests-DNkORsqB.js";import{u as h}from"./chunk-file-1YhfNmPn.js";import{l as g}from"./chunk-model-BulEKnY1.js";import{t as _}from"./chunk-diagrams-CtGMGTa8.js";import{t as ee}from"./chunk-plural-Dn-7ulHf.js";import{n as v}from"./chunk-status-CmYxwOCn.js";import{t as y}from"./chunk-table-BOiaGWwY.js";import{p as te}from"./chunk-license-BG88gpDZ.js";import b from"node:path";import{readFileSync as x}from"node:fs";const S=1e3;function C(e){return/\.form$/i.test(e)?`application/json`:`application/xml`}function w(e,t){let n=(e,t)=>({name:e,content:t}),r=[];return e.engine===`CAMUNDA_8`?e.tenantId&&r.push(n(`tenantId`,e.tenantId)):(r.push(n(`deployment-name`,e.name),n(`deployment-source`,e.source)),r.push(n(`enable-duplicate-filtering`,String(e.changedOnly)),n(`deploy-changed-only`,String(e.changedOnly))),e.tenantId&&r.push(n(`tenant-id`,e.tenantId)),e.activationTime&&r.push(n(`deployment-activation-time`,e.activationTime))),t.forEach(t=>r.push({name:e.engine===`CAMUNDA_8`?`resources`:t.name,filename:t.name,contentType:C(t.name),content:t.content})),{method:`POST`,path:e.engine===`CAMUNDA_8`?`/deployments`:`/deployment/create`,parts:r}}function T(e){let t=Number(e??0);return Number.isFinite(t)?t:0}function ne(e,t){try{let n=JSON.parse(t);if(e===`CAMUNDA_8`)return(n.deployments??[]).flatMap(e=>[...e.processDefinition?[{kind:`process`,id:String(e.processDefinition.processDefinitionKey??``),key:String(e.processDefinition.processDefinitionId??``),version:T(e.processDefinition.processDefinitionVersion)}]:[],...e.decisionDefinition?[{kind:`decision`,id:String(e.decisionDefinition.decisionDefinitionKey??``),key:String(e.decisionDefinition.decisionDefinitionId??``),version:T(e.decisionDefinition.version)}]:[]]);let r=(e,t)=>Object.values(n[e]??{}).map(e=>({kind:t,id:String(e?.id??``),key:String(e?.key??``),version:T(e?.version)}));return[...r(`deployedProcessDefinitions`,`process`),...r(`deployedDecisionDefinitions`,`decision`)]}catch{return[]}}function re(e,t){let n=t.kind===`decision`?`decision`:`process`;return{method:`GET`,path:e===`CAMUNDA_8`?`/${n}-definitions/${encodeURIComponent(t.id)}`:`/${n}-definition/${encodeURIComponent(t.id)}`}}function E(e){return typeof e.body==`string`?e.body:``}function D(e){return e instanceof Error?e.message:String(e)}function O(e){let t=E(e);if(e.status===0)return t;try{let e=JSON.parse(t),n=[e.message,e.detail,e.title].find(e=>typeof e==`string`);if(typeof n==`string`)return n}catch{return t}return t}function ie(e){let t=O(e);return t===E(e)?t.slice(0,300):t}function ae(e){let t=[],n=null,r=null;for(let i of e.split(`
|
|
2
|
+
`)){let e=i.trim(),a=/^'([^']+)':\s*(.*)$/.exec(e);a&&(n=a[1],r=null,e=a[2]);let o=/^-?\s*Element:\s*(\S+)/.exec(e);if(o){r=o[1];continue}let s=/^-?\s*ERROR:\s*(.+)$/.exec(e);s&&t.push({file:n,element:r,text:s[1].trim(),line:null})}return t}function k(e){let t=e.split(`
|
|
3
|
+
`)[0].trim(),n=t.indexOf(`. `);return(n>0?t.slice(0,n):t).replace(/:$/,``)}function A(e){try{let t=JSON.parse(e).details??{};return Object.entries(t).flatMap(([e,t])=>(t.errors??[]).map(t=>({file:e,element:null,text:k(String(t.message??``)),line:typeof t.line==`number`?t.line:null})))}catch{return[]}}function oe(e){let t=[];for(let n of e.split(`Warnings:`)[0].split(`
|
|
4
|
+
`)){let e=n.trim();if(!e.startsWith(`*`))continue;let r=e.slice(1).split(`|`).map(e=>e.trim());if(r.length<2||!r[1])continue;let i=/line\s+(\d+)/.exec(r[2]??``);t.push({file:r[1].replace(/^resource\s+/,``),element:null,text:k(r[0]),line:i?Number(i[1]):null})}return t}function se(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function ce(e,t,n,r=``){let i=e===`CAMUNDA_8`?[]:A(r),a=e===`CAMUNDA_8`?ae(n):i.length>0?i:oe(n),o=t.map(e=>e.name),c=/* @__PURE__ */ new Map;for(let e of a){let n=(e.file&&o.find(t=>t===e.file||e.file?.endsWith(`/${t}`)))??(e.element?t.find(t=>RegExp(`\\bid=["']${se(e.element)}["']`).test(t.content))?.name:void 0);n&&c.set(n,[...c.get(n)??[],e])}return[...c].map(([e,t])=>{let[n,...r]=t,i=[n.line===null?``:s(`app.deploy.problemLine`,{line:n.line}),r.length>0?s(`app.deploy.andNMore`,{number:r.length}):``].filter(Boolean),a=`${n.element?`${n.element}: `:``}${n.text}`;return{file:e,reason:i.length>0?`${a} (${i.join(`, `)})`:a}})}async function le(e,t,n,r){let i=n.sleep??(e=>new Promise(t=>setTimeout(t,e))),a=n.now??(()=>performance.now());for(let o of t){let t=a()+30*S,c=!1;for(let r=0;r<30&&!c&&a()<t;r+=1){let t=await n.ask(re(e,o)).catch(()=>({status:0,body:``}));c=t.status>=200&&t.status<300,c||await i(S)}if(r.push(c?s(`app.deploy.definitionIsLive`,{key:o.key,version:o.version}):s(`app.deploy.notConfirmedInTime`,{seconds:30,key:o.key})),!c)return!1}return!0}async function j(e,t,n){let r=t.map(e=>e.name),i=[],a=async e=>{if(!n.hook)return{ok:!0,lines:[]};try{return await n.hook(e,r)}catch(e){return{ok:!1,lines:[D(e)]}}},o=await a(`preDeploy`);if(i.push(...o.lines),!o.ok)return{ok:!1,status:0,message:s(`app.deploy.preDeployHookFailed`),definitions:[],lines:i};let c;try{c=await n.ask(w(e,t))}catch(e){return{ok:!1,status:0,message:s(`app.deploy.unableToDeploy`,{reason:D(e)}),definitions:[],lines:i}}if(c.status<200||c.status>=300){let n=c.status===0?[]:ce(e.engine,t,O(c),E(c)),r=c.status===0?E(c):n.length>0?[s(`app.deploy.refusedNothingDeployed`,{count:n.length}),...n.map(e=>`${e.file}: ${e.reason}`)].join(`
|
|
5
|
+
`):s(`app.deploy.answeredStatus`,{status:c.status,reason:ie(c)});return{ok:!1,status:c.status,message:r,definitions:[],lines:i,refused:n}}let l=ne(e.engine,E(c)),u=!n.wait||await le(e.engine,l,n,i);n.hook&&i.push(...(await a(`postDeploy`)).lines);let d=l.map(e=>`${e.key} v${e.version}`).join(`, `);return{ok:u,status:c.status,message:u?d?s(`app.deploy.deployedAs`,{files:r.join(`, `),definitions:d}):s(`app.deploy.deployedFiles`,{files:r.join(`, `)}):s(`app.deploy.definitionsNotShownInTime`),definitions:l,lines:i}}const M=/\.(bpmn20\.xml|bpmn\.xml|bpmn)$/i,N=[`process`,`decision`,`form`];function P(e){return e.replace(/\\/g,`/`)}function F(e){return P(e).split(`/`).pop()??e}function ue(e){return M.test(e)?`process`:/\.dmn$/i.test(e)?`decision`:/\.form$/i.test(e)?`form`:null}function I(e,t){let n=P(e).split(`/`).slice(0,-1),r=P(t).split(`/`).slice(0,-1),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i+=1;return i}async function L(e){let t=[...g(await f(e)).values()],n=e=>[...new Set(t.map(e).filter(e=>!!e))];return{process:n(e=>e.calledProcess),decision:n(e=>e.decision),form:n(e=>e.form)}}async function R(e,t){let n=[{path:e.path,name:F(e.path),content:e.content}],r=/* @__PURE__ */ new Set([P(e.path)]),i={process:/* @__PURE__ */ new Set,decision:/* @__PURE__ */ new Set,form:/* @__PURE__ */ new Set},a=await L(e.content);p(`process`,e.content).forEach(e=>i.process.add(e));let o=/* @__PURE__ */ new Map,s=async e=>{let n=[];for(let i of t){if(ue(i.path)!==e||r.has(P(i.path)))continue;let t=o.get(i.path);if(!t){let n=await i.read().catch(()=>``);t={content:n,ids:p(e,n)},o.set(i.path,t)}n.push({path:i.path,...t})}return n};for(;N.some(e=>a[e].some(t=>!i[e].has(t)));)for(let t of N){let o=a[t].filter(e=>!i[t].has(e));if(a[t]=[],o.length===0)continue;let c=await s(t);for(let s of o){i[t].add(s);let o=c.filter(e=>e.ids.includes(s)&&!r.has(P(e.path))).sort((t,n)=>I(e.path,n.path)-I(e.path,t.path))[0];if(o&&(r.add(P(o.path)),n.push({path:o.path,name:F(o.path),content:o.content}),o.ids.forEach(e=>i[t].add(e)),t===`process`)){let e=await L(o.content);N.forEach(t=>a[t].push(...e[t]))}}}return n}function de(e,t){let n=P(e),r=F(e).replace(/\.json$/i,``);return t.find(e=>P(h(e))===n)??t.find(e=>F(e).replace(M,``)===r)??null}async function fe(e,t){let n=[],r=/* @__PURE__ */ new Set,i=e=>{let t=P(e.path);r.has(t)||(r.add(t),n.push(e))};for(let n of e)M.test(n.path)?(await R(n,t)).forEach(i):i({path:n.path,name:F(n.path),content:n.content});return n}function z(e){return e!=null&&e!==!1}function B(e){return V(o(e).values)}function V(e){let i=r(e.deployment),a=t(n(i.url)??``);return a?{engine:n(e.engine)??`camunda-7`,url:a.replace(/\/$/,``),name:n(i.name)??`Penstock deployment`,tenantId:n(i.tenantId),source:n(i.source)??`penstock`,changedOnly:i.changedOnly!==!1,forTests:i.forTests===!0,protected:z(i.protected),auth:r(i.auth)}:null}const H=15e3;async function pe(r,i,a){let o=t(n(r.tokenUrl)??``),c=n(r.clientId),l=i.PENSTOCK_CLIENT_SECRET;if(!o||!c||!l)throw Error(s(`app.output.authProblem.oauthNeedsKeys`));let u=new URLSearchParams({grant_type:`client_credentials`,client_id:c,client_secret:l}),d=n(r.audience);d&&u.set(`audience`,d);let f=AbortSignal.timeout(a),p,m;try{p=await fetch(o,{method:`POST`,body:u,signal:f}),m=await p.text()}catch(t){throw Error(s(`app.output.authProblem.oauthUnreachable`,{url:o,reason:e(t)}))}if(!p.ok)throw Error(s(`app.output.authProblem.oauthFailed`,{status:p.status,body:m.slice(0,300)}));let h=null;try{h=JSON.parse(m)}catch{h=null}let g=h?.access_token;if(typeof g!=`string`)throw Error(s(`app.output.authProblem.oauthNoToken`));return g}function U(e,t){let r=`password`in e?[s(`app.output.authNote.passwordNotRead`)]:[];if(t.PENSTOCK_TOKEN)return{problem:null,notes:r};let i=n(e.type)??`none`;if(i===`basic`){if(!n(e.username))return{problem:s(`app.output.authProblem.basicWithoutUsername`),notes:r};if(!t.PENSTOCK_PASSWORD)return{problem:s(`app.output.authProblem.basicWithoutPassword`),notes:r}}return i===`oauth`&&(!n(e.tokenUrl)||!n(e.clientId)||!t.PENSTOCK_CLIENT_SECRET)?{problem:s(`app.output.authProblem.oauthWithoutKeys`),notes:r}:{problem:null,notes:r}}function W(e){let t=n(e.type)??`none`;return s(t===`basic`?`app.output.authHint.basic`:t===`oauth`?`app.output.authHint.oauth`:`app.output.authHint.setIt`)}async function G(e,t,r=H){if(t.PENSTOCK_TOKEN)return{Authorization:`Bearer ${t.PENSTOCK_TOKEN}`};let i=n(e.type)??`none`;if(i===`basic`){let r=n(e.username)??``,i=t.PENSTOCK_PASSWORD??``;return{Authorization:`Basic ${Buffer.from(`${r}:${i}`).toString(`base64`)}`}}return i===`oauth`?{Authorization:`Bearer ${await pe(e,t,r)}`}:{}}function me(e){return/\.form$/i.test(e)?`form`:/\.dmn$/i.test(e)?`decision`:`process`}function K(e,t){let n=t.trim().replace(/\/+$/,``);return l(e)?n.endsWith(`/v2/deployments`)?n:n.endsWith(`/v2`)?`${n}/deployments`:`${n}/v2/deployments`:n.endsWith(`/deployment/create`)?n:`${n}/deployment/create`}function he(e){return K(e.engine,e.url).replace(l(e.engine)?/\/deployments$/:/\/deployment\/create$/,``)}function q(e){return u(e.engine)}function ge(e){return{engine:q(e),name:e.name,source:e.source,tenantId:e.tenantId??null,changedOnly:e.changedOnly}}const J=2e3,Y=3e4;function X(t,n=Y){return async r=>{let i=await G(t.auth,process.env,n),a=r.body;if(r.parts){let e=new FormData;r.parts.forEach(t=>{t.filename?e.append(t.name,new Blob([t.content],{type:t.contentType}),t.filename):e.append(t.name,t.content)}),a=e}else r.body!==void 0&&(i[`Content-Type`]=`application/json`);try{let e=await fetch(`${he(t)}${r.path}`,{method:r.method,headers:i,body:a,signal:AbortSignal.timeout(n)}),o=await e.text();return{status:e.status,body:e.ok||o.length<=J?o:`${o.slice(0,J)}...`}}catch(t){return{status:0,body:e(t)}}}}async function Z(e){let t=/* @__PURE__ */ new Map;for(let n of e)t.set(b.resolve(n),o(n).root);let n=/* @__PURE__ */ new Map;for(let e of new Set(t.values()))for(let t of[..._(e),...m(e)])n.set(b.resolve(t),{path:b.resolve(t),read:async()=>x(t,`utf8`)});let r=await fe([...t.keys()].map(e=>({path:e,content:x(e,`utf8`)})),[...n.values()]),i=new Map(e.map(e=>[b.resolve(e),e]));return r.map(e=>i.get(e.path)??e.path)}function Q(e){return{status:``,endpoint:``,files:``,target:``,details:e}}function $(e){return{...Q(e),status:v(`note`)}}function _e(e){return y(e,{columns:[{name:`status`,header:s(`app.cli.header.status`),minWidth:6},{name:`endpoint`,header:s(`app.cli.header.endpoint`)},{name:`files`,header:s(`app.cli.header.files`)},{name:`target`,header:s(`app.cli.header.target`)},{name:`details`,header:s(`app.cli.header.details`)}]})}async function ve(e,t,n,r={}){let l=e.filter(e=>B(e)===null),u=e.filter(e=>{let t=B(e);return t!==null&&c(t.engine)}),f=e.filter(e=>{let t=B(e);return t!==null&&!c(t.engine)}),p=i(f,e=>{let t=B(e);return t?`${t.engine}|${t.url}|${t.name}|${t.tenantId??``}`:``},e=>B(e)),m=[],h=0;for(let e of l)m.push({status:v(`skip`),endpoint:``,files:a(e),target:``,details:s(`app.output.noDeploymentUrl`)});for(let e of u)m.push({status:v(`skip`),endpoint:``,files:a(e),target:``,details:s(`app.output.noDeployFor`,{engine:d(B(e)?.engine)})});for(let{key:e,files:i}of p.values()){let c=K(e.engine,e.url),l=await Z(i),u=U(e.auth,process.env),d=await import(`./chunk-promotion-NeRj4uTP.js`),f=o(i[0]).root,p=d.environmentName(f),g=l;if(r.onlyChanged&&!u.problem){let t=await d.onlyChanged(f,p,e,l);g=t.send,t.note&&m.push($(t.note));for(let n of t.skipped)m.push({status:v(`skip`),endpoint:c,files:a(n.file),target:e.name,details:n.reason});if(g.length===0)continue}let _={endpoint:c,files:ee(g.length,`app.output.count.file`),target:e.name},y=g.map(e=>a(e)).join(`, `);if(t){u.problem&&m.push($(u.problem)),m.push(...u.notes.map($)),m.push({status:v(`wouldSend`),..._,details:y});continue}if(u.problem){h+=1,m.push({status:v(`fail`),..._,details:u.problem},...u.notes.map(Q));continue}let S=g.map(e=>({name:b.basename(e),content:x(e,`utf8`)}));if(e.protected&&te(process.env)){let{requireFeature:e}=await import(`./chunk-features-DzAP8JmI.js`),t=await e(`promotion`);if(t){h+=1,m.push({status:v(`fail`),..._,details:t.lines[0]},...t.lines.slice(1).map(Q),Q(s(`app.promotion.deploy.protectedNothingSent`,{name:p})));continue}}if(e.protected){let{contentHash:e}=await import(`./chunk-normalise-7rDhUUFJ.js`),t=d.protect({root:f,name:p,isProtected:!0,confirm:r.confirm,approveFile:r.approveFile,files:g.map((t,n)=>({name:b.relative(f,b.resolve(t)).split(b.sep).join(`/`),hash:e(me(t),S[n].content).hash}))});if(t.blockers.length>0){h+=1,m.push({status:v(`fail`),..._,details:t.blockers[0]},...t.blockers.slice(1).map(Q),Q(s(`app.promotion.deploy.protectedNothingSent`,{name:p})));continue}}let C=await j(ge(e),S,{ask:X(e),wait:n});if(C.status<200||C.status>=300){h+=1;let[t,...n]=C.message.split(`
|
|
6
|
+
`);m.push({status:v(`fail`),..._,details:t},...n.map(Q)),(C.status===401||C.status===403)&&m.push(Q(s(`app.output.credentialsRefused`,{hint:W(e.auth)})))}else m.push({status:v(`sent`),..._,details:y},...[...C.lines,...u.notes].map(Q)),C.ok&&d.recordAfterDeploy(f,p,g,C),C.ok||(h+=1)}let g=m.length>0?_e(m):[];return f.length===0?{ok:!1,lines:[...g,s(`app.output.nothingToDeploy`)]}:{ok:h===0,refused:!1,lines:g}}export{w as _,G as a,K as c,z as d,B as f,j as g,R as h,U as i,q as l,de as m,H as n,W as o,V as p,X as r,ve as s,Y as t,Z as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./chunk-codeScan-C09My9xv.js";import{a as t}from"./chunk-analyze-
|
|
1
|
+
import{t as e}from"./chunk-codeScan-C09My9xv.js";import{a as t}from"./chunk-analyze-DgQqzEgb.js";import{i as n,r}from"./chunk-folders-C7ae1oPV.js";import i from"node:path";import{existsSync as a,readdirSync as o,statSync as s}from"node:fs";const c={process:/\.bpmn(\.xml|20\.xml)?$/i,decision:/\.dmn$/i,form:/\.form$/i},l=/\.(cmmn|cmmn11\.xml)$/i;function u(e){let t=i.basename(e);return Object.keys(c).find(e=>c[e].test(t))??null}function d(u,d=[`process`],f){if(!a(u))return[];if(s(u).isFile())return[u];let p=n(u,f),m=[],h=n=>{for(let a of o(n,{withFileTypes:!0})){if(p(),e.has(a.name)||a.name.startsWith(`.`))continue;let o=i.join(n,a.name);a.isDirectory()?r(o)&&h(o):d.some(e=>e===`case`?l.test(a.name):c[e].test(a.name)&&(e!==`form`||t(o)))&&m.push(o)}};return h(u),m.sort()}export{u as n,d as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{t as diffCommand,r as formatCommand}from"./chunk-diff-Dp3fUALc.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./chunk-atomicWrite-C6J1gDtO.js";import{r as t}from"./chunk-context-rCJvBM9p.js";import{t as n}from"./chunk-table-BOiaGWwY.js";import{t as r}from"./chunk-plural-Dn-7ulHf.js";import{n as i}from"./chunk-status-CmYxwOCn.js";import{s as a}from"./chunk-failure-BRyRvObj.js";import{f as o,p as s}from"./chunk-model-BulEKnY1.js";import{n as c}from"./chunk-diagrams-CtGMGTa8.js";import{r as l}from"./chunk-translator-DNm9zRpP.js";import{readFileSync as u}from"node:fs";async function d(){let e=await import(`bpmn-moddle`),t=e.BpmnModdle??e.default;if(!t)throw Error(`bpmn-moddle did not export a constructor`);return new t}async function f(){let{dmnModdleByFlavour:e}=await import(`./chunk-moddle-DQIWChLZ.js`);return e(`plain`)}function p(e,t){return Object.entries(t).map(([t,n])=>{let r=n,i=r?.model??r;return{change:e,id:t,type:i?.$type?i.$type.replace(/^[a-z]+:/,``):``,...i?.name?{name:i.name}:{}}})}function m(e,t){return Object.entries(t).map(([t,n])=>{let r=n,i=r?.model??r,a=i?.name?` "${i.name}"`:``,o=i?.$type?i.$type.replace(/^[a-z]+:/,``):``,s=r?.attrs?` (${Object.keys(r.attrs).join(`, `)})`:``;return`${e.padEnd(8)} ${o}${a} ${t}${s}`.trimEnd()})}async function h(e,t){if(e===`form`)return JSON.parse(t);if(e===`decision`){let e=await o(t);return(await(await f()).fromXML(e.xml,`dmn:Definitions`)).rootElement}return(await(await d()).fromXML(t)).rootElement}async function g(e,t){return h(e,u(t,`utf8`))}async function _(e,t,n){try{let r=(await v(e))(await h(e,t),await h(e,n));return{entries:[...p(`added`,r._added),...p(`removed`,r._removed),...p(`changed`,r._changed)],moved:Object.keys(r._layoutChanged).length}}catch{return null}}async function v(e){return e===`decision`?(await import(`./chunk-diffModels-DYtf3au1.js`)).diffDecisions:e===`form`?(await import(`./chunk-diffModels-DYtf3au1.js`)).diffForms:(await import(`bpmn-js-differ`)).diff}async function y(e,n,i=!1){let o=[e,n].map(e=>c(e)??`process`);if(o[0]!==o[1])return{ok:!1,lines:[l(`app.cli.diff.differentKinds`,{before:t(e),after:t(n)})]};let s=await v(o[0]),u=[];for(let r of[e,n])try{u.push(await g(o[0],r))}catch(e){return{ok:!1,lines:[a(t(r),e)]}}let d;try{d=s(u[0],u[1])}catch(r){let i=[e,n].find((e,t)=>{try{return s(u[t],u[t]),!1}catch{return!0}});return{ok:!1,lines:[a(t(i??n),r)]}}let f={},h={};Object.keys(d._removed).forEach(e=>f[e]=`removed`),Object.keys(d._added).forEach(e=>h[e]=`added`),Object.keys(d._changed).forEach(e=>{f[e]=`changed`,h[e]=`changed`});let _=[...m(l(`app.cli.diff.added`),d._added),...m(l(`app.cli.diff.removed`),d._removed),...m(l(`app.cli.diff.changed`),d._changed)],y=Object.keys(d._layoutChanged).length,b=[...p(`added`,d._added),...p(`removed`,d._removed),...p(`changed`,d._changed)],x={lines:[..._],entries:b,movedIds:Object.keys(d._layoutChanged),moved:y,markersBefore:f,markersAfter:h};if(_.length===0){let e=y>0?l(`app.cli.diff.onlyMoved`,{elements:r(y,`app.cli.diff.count.element`)}):l(`app.cli.diff.noDifferenceFound`);return i?{ok:!0,lines:[e],summary:x}:{ok:!0,lines:[e]}}y>0&&_.push(``,l(`app.cli.diff.movedOnCanvas`,{elements:r(y,`app.cli.diff.count.element`)}));let S=[`${t(e)} -> ${t(n)}`,``,..._];return i?{ok:!0,lines:S,summary:x}:{ok:!0,lines:S}}async function b(r,c){let p=await d(),m=[],h=0,g=0;for(let n of r){if(/\.form$/i.test(n)){m.push({status:i(`skip`),file:t(n),details:l(`app.cli.fmt.formLeftAlone`)});continue}let r,d,_=null;try{r=u(n,`utf8`);let e=/\.dmn$/i.test(n),t=e?await o(r):{xml:r,from:null};_=t.from;let i=e?await f():p,{rootElement:a}=await i.fromXML(t.xml,e?`dmn:Definitions`:void 0);({xml:d}=await i.toXML(a,{format:!0}))}catch(e){g+=1,m.push({status:i(`fail`),file:t(n),details:a(t(n),e)});continue}if(d===r){m.push({status:i(`same`),file:t(n),details:l(`app.cli.fmt.alreadyFormatted`)});continue}h+=1;let v=_?s(_,t(n)):null;c?(e(n,d),m.push({status:i(`wrote`),file:t(n),details:v??l(`app.cli.fmt.formattedXml`)})):m.push({status:i(`change`),file:t(n),details:v??l(`app.cli.fmt.wouldFormat`)})}let _=n(m,{columns:[{name:`status`,header:l(`app.cli.header.status`),minWidth:6},{name:`file`,header:l(`app.cli.header.file`),minWidth:24},{name:`details`,header:l(`app.cli.header.details`)}]});return{ok:g===0&&(c||h===0),refused:!1,lines:_}}export{_ as n,b as r,y as t};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{n as e,o as t,s as n,t as r}from"./chunk-commands-B8YVT41b.js";import{n as i,r as a,t as o}from"./chunk-table-BOiaGWwY.js";import{n as s,r as c}from"./chunk-codeIndex-vStNh6Bm.js";import{t as l}from"./chunk-cacheDirectory-7sa0970e.js";import{a as u,n as d,o as f,u as p}from"./chunk-load-rfn3E0t5.js";import{p as m,u as h}from"./chunk-license-BG88gpDZ.js";import{a as g,t as _}from"./chunk-features-C6o8of19.js";import{n as v}from"./chunk-model-BulEKnY1.js";import{t as y}from"./chunk-apiTemplatesPath-vIrQ4ODR.js";import{a as b,i as x,n as S,r as C,s as w,t as T}from"./chunk-failure-BRyRvObj.js";import{t as E}from"./chunk-diagrams-CtGMGTa8.js";import{r as D,t as O}from"./chunk-context-rCJvBM9p.js";import{r as k}from"./chunk-preferencesFile-F6bAlNrk.js";import{t as A}from"./chunk-migrate-DwWg0k5_.js";import{i as j,r as M}from"./chunk-help-CxU1lT1Y.js";import{t as N}from"./chunk-own-CX-3lIbf.js";import{r as P}from"./chunk-translator-DNm9zRpP.js";import{n as F}from"./chunk-status-CmYxwOCn.js";import I from"node:path";import{existsSync as L,readFileSync as R,statSync as z,writeFileSync as B}from"node:fs";import{createInterface as V}from"node:readline/promises";function H(e){return e.length>0&&e.every(e=>v(e)===`form`)}function U(e,t,n,r,i,a=[],o=`generate`){switch(e){case`migrate`:return i===`convert`?`migration`:i===`apply`?t.has(`--write`)?`migration`:null:i===`agents`?t.has(`--write`)?`agent-tools`:null:i===`report`||i===`plan`||i===`verify`?null:n===`sarif`||n===`github`?`ci-annotations`:t.has(`--baseline`)||t.has(`--update-baseline`)?`baseline`:null;case`layout`:return`auto-layout`;case`analyze`:return H(a)?null:`flow-analysis`;case`docs`:return`docs`;case`paths`:return`paths`;case`tests`:return`tests`;case`test`:return a[0]===`task`?`test-runs`:null;case`test-cases`:return t.has(`--generate`)?`test-case-generation`:`test-runs`;case`code`:case`facts`:return`code-links`;case`templates`:return o===`check`?null:a.some(y)?t.has(`--write`)?`api-templates`:null:`element-templates`;case`incident`:return t.has(`--write`)||t.has(`--run`)?`incident-scenario`:null;case`policy`:return a[0]===void 0||a[0]===`show`?null:`policy-pack`;case`receipt`:return a[0]===`check`||t.has(`--write`)?`ai-receipt`:null;case`agents`:return t.has(`--write`)&&a[0]===`scenario`?`agent-tools`:null;case`drift`:return t.has(`--against`)?`promotion`:null;case`promote`:return`promotion`;case`evidence`:return a[0]===`build`?`audit-evidence`:null;case`refactor`:return a[0]===`bulk`||a[0]===`extract`?`refactor-bulk`:null;case`connections`:return t.has(`--against`)?`connections-environments`:null;case`edit`:return t.has(`--schema`)?null:`edit`;case`diff`:return t.has(`--images`)?`changes-pictures`:null;case`report`:return`pr-report`;case`bot`:return`bot`;case`check`:return t.has(`--require-receipt`)?`ai-receipt`:n===`sarif`||n===`github`?`ci-annotations`:r===`flow`?H(a)?null:`flow-analysis`:t.has(`--baseline`)||t.has(`--update-baseline`)?`baseline`:null;default:return null}}const W={check:[`process`,`decision`,`form`,`case`],export:[`process`,`case`],docs:[`process`,`decision`,`form`],deploy:[`process`,`decision`,`form`]},G=[`generate`,`check`],K=[`check`,`paths`,`tests`,`code`,`docs`,`layout`,`deploy`,`fmt`,`convert`,`export`],ee={check:[`text`,`json`,`sarif`,`github`],migrate:[`text`,`json`,`sarif`,`github`],doctor:[`text`,`json`],templates:[`text`,`json`],connections:[`text`,`json`],agents:[`text`,`json`],incident:[`text`,`json`],policy:[`text`,`json`],drift:[`text`,`json`],promote:[`text`,`json`],evidence:[`text`,`json`,`zip`,`dir`],refactor:[`text`,`json`],receipt:[`text`,`json`],test:[`text`,`json`,`junit`],show:[`text`,`json`],code:[`text`,`json`],import:[`text`,`json`],paths:[`text`,`json`,`md`],export:[`svg`,`png`],docs:[`html`,`md`,`docx`,`pdf`]};function q(e,t){if(t instanceof d)throw t;return w(D(e),t)}const te={async show({words:e,format:t}){let n=e[0];if(!n)return{ok:!1,lines:[P(`app.cli.show.needsDiagram`)]};let r=x(n);if(r)return{ok:!1,lines:[r]};try{return await(await import(`./chunk-command-aMxPQdiV.js`)).showCommand(n,t===`json`)}catch(e){return{ok:!1,lines:[q(n,e)]}}},async edit({words:e,flags:t,option:n,options:r}){let i=e[0];if(!i)return{ok:!1,lines:[P(`app.cli.edit.needsDiagram`)]};if(t.has(`--schema`))try{return(await import(`./chunk-command-aMxPQdiV.js`)).schemaCommand(i)}catch(e){return{ok:!1,lines:[q(i,e)]}}let a=n(`ops`),o=n(`ops-file`),s;if(a!==void 0||o!==void 0)try{s=JSON.parse(a===void 0?R(o===`-`?0:o,`utf8`):a)}catch(e){let t=a===void 0?o===`-`?`--ops-file -`:D(o):`--ops`;return{ok:!1,lines:[S(e)?C(t):T(e)?P(`app.cli.edit.isAFolder`,{from:t}):P(`app.cli.edit.notJson`,{from:t,reason:e instanceof Error?e.message:String(e)}),P(`app.cli.nothingWritten`)]}}else try{s=(await import(`./chunk-command-aMxPQdiV.js`)).operationFromWords((await import(`./chunk-command-aMxPQdiV.js`)).engineOf(i,R(i,`utf8`)),{words:e.slice(1),option:n,options:r})}catch(e){if(e instanceof d)throw e;return{ok:!1,lines:[b(e)===null?e instanceof Error?e.message:String(e):w(D(i),e),P(`app.cli.nothingWritten`)]}}try{return await(await import(`./chunk-command-aMxPQdiV.js`)).applyOperations(i,s,{dryRun:t.has(`--dry-run`),force:t.has(`--force`)})}catch(e){return{ok:!1,lines:[q(i,e),P(`app.cli.nothingWritten`)]}}},async trust({words:e,flags:t}){if(t.has(`--list`)){let e=(await import(`./chunk-trust-DSX-k3by.js`)).trustedProjects(process.env);return e.length===0?{ok:!0,lines:[P(`app.cli.trust.noneTrusted`)]}:{ok:!0,lines:o(e,{columns:[{name:`path`,header:P(`app.cli.trust.headerProject`)},{name:`on`,header:P(`app.cli.trust.headerSince`)}]})}}let n=e[0]??process.cwd();if(!L(n))return{ok:!1,lines:[C(n)]};let r=f(n);if(t.has(`--forget`)){let e=(await import(`./chunk-trust-DSX-k3by.js`)).canonicalProject(r);return(await import(`./chunk-trust-DSX-k3by.js`)).forgetTrust(r,process.env)?{ok:!0,lines:[`${F(`removed`).padEnd(7)} ${e} - ${P(`app.cli.trust.mayNotRun`)}`]}:{ok:!0,lines:[`${F(`kept`).padEnd(7)} ${e} - ${P(`app.cli.trust.notTrustedBefore`)}`]}}let i=J(!0),a=await(await import(`./chunk-trust-DSX-k3by.js`)).trustCommand(r,i,t.has(`--yes`)||i===void 0,process.env);return{ok:a.allowed,lines:a.lines}},async license({words:e}){let[t,...n]=e;return t===`buy`?(await import(`./chunk-account-BaYNvO18.js`)).upgradeCommand(n):t===`login`?(await import(`./chunk-account-BaYNvO18.js`)).loginCommand(n):t===`logout`?(await import(`./chunk-account-BaYNvO18.js`)).logoutCommand():(await import(`./chunk-account-BaYNvO18.js`)).licenseCommand(e)},async update({words:e,option:t}){return(await import(`./chunk-wrapper-CGYED7G2.js`)).updateCommand(process.cwd(),{version:e[0],distribution:t(`distribution`)})},async connectors({words:e,flags:t}){return(await import(`./chunk-connectors-DcMqy0u8.js`)).connectorsCommand(e,t)},async agent({words:e,flags:t,option:n,passthrough:r}){let i=e.slice(0,e.length-r.length);return i[0]===`serve`?i.length===1?(await import(`./chunk-agentServe-BeOh1rjE.js`)).agentServeCommand(n(`project`),void 0,{detach:t.has(`--detach`)}):{ok:!1,lines:[P(`app.cli.agentLaunch.extraWords`,{agent:`serve`})],code:1}:i.length>1?{ok:!1,lines:[P(`app.cli.agentLaunch.extraWords`,{agent:i[0]})],code:1}:(await import(`./chunk-agentLaunch-BnrpVME4.js`)).launchAgent({agent:i[0],project:n(`project`),passthrough:r,env:process.env,home:k(process.env),cwd:process.cwd()})},async web({words:e,flags:t,option:n}){return(await import(`./chunk-command-8s6m3ZUw.js`)).webCommand(e[0],{port:n(`port`),host:n(`host`),open:!t.has(`--no-open`)})},async init({targets:e,flags:t,option:n}){let r=n(`example`),i=n(`engine`);if(i===void 0&&r===void 0&&process.stdin.isTTY&&process.stdout.isTTY){let t=V({input:process.stdin,output:process.stderr});try{i=await(await import(`./chunk-init-D34Q4YA8.js`)).chooseEngine(f(e[0]),e=>t.question(e))??void 0}finally{t.close()}}return(await import(`./chunk-init-D34Q4YA8.js`)).initCommand(e[0],n(`ci`),t.has(`--hooks`),(await h()).tier===`team`,r,i)},async doctor({targets:e,format:t}){return L(e[0])?(await import(`./chunk-doctor-CRxbsAm7.js`)).doctorCommand(e[0],t===`json`):{ok:!1,lines:[C(e[0])]}},async check({files:t,format:n,flags:r,sections:i,targets:a,option:o}){let s=await e(t,{format:n,baseline:r.has(`--baseline`),updateBaseline:r.has(`--update-baseline`),sections:i}),c=O(a[0]),l=(await import(`./chunk-aiVerify-Bx0ME7O6.js`)).aiVerifyOf(c.values),u=[],d=await import(`./chunk-policy-BVb7c7G_.js`);if(d.enforcing(r.has(`--ci`))&&!r.has(`--update-baseline`)){let e=await d.enforcePolicy({target:a[0],checkOk:s.ok,settings:l,base:o(`base`)??`origin/main`});if(e&&`refused`in e)return e.refused;e&&u.push(e)}if(r.has(`--require-receipt`)||l.requireReceipt){let e=await g(`ai-receipt`);if(e)return e;u.push((await import(`./chunk-receiptGate-DRcw327y.js`)).requireReceiptGate(c.root,o(`base`)??`origin/main`,l))}if(u.length===0)return s;let f=s.ok&&u.every(e=>e.ok),p=u.flatMap(e=>e.lines);return n===`text`?{...s,ok:f,lines:[...s.lines,``,...p]}:(process.stderr.write(`${p.join(`
|
|
2
|
+
`)}\n`),{...s,ok:f})},async policy({words:e,format:t,option:n,flags:r}){return(await import(`./chunk-policy-BVb7c7G_.js`)).policyCommand(e,{format:t,project:n(`project`),name:n(`name`),severity:n(`severity`),forced:r.has(`--forced`),source:n(`source`),allowLocal:r.has(`--allow-local-source`)})},async paths({files:e,format:t}){return(await import(`./chunk-analyze-ClE2LBCj.js`)).pathsCommand(e,t)},async tests({files:e,option:t}){return(await import(`./chunk-tests-Cy325OGw.js`)).testsCommand(e,{out:t(`out`),pkg:t(`package`)})},async"test-cases"({targets:e,flags:t,option:n}){let r=Number(n(`timeout`)),i=new AbortController,a=()=>{i.signal.aborted&&process.exit(130),process.stderr.write(`${P(`app.cli.stopping`)}\n`),i.abort()};process.on(`SIGINT`,a),process.on(`SIGTERM`,a);try{let a=await(await import(`./chunk-testCases-DO2Rkyvd.js`)).testCasesCommand(e,{signal:i.signal,teamcity:t.has(`--teamcity`),junitXml:n(`junit-xml`),generate:t.has(`--generate`),junit:t.has(`--junit`),stepTimeoutMs:Number.isFinite(r)&&r>0?r*1e3:void 0});return t.has(`--generate`)||t.has(`--junit`)||i.signal.aborted||(await import(`./chunk-policy-BVb7c7G_.js`)).recordRun(e[0],`scenarios`,a),a}finally{process.off(`SIGINT`,a),process.off(`SIGTERM`,a)}},async test({words:e,flags:t,option:n,format:r}){if(e[0]===`dmn`){let t=n(`min-rule-coverage`)!==void 0||r===`junit`||m(process.env);if(t){let e=await g(`dmn-tests`);if(e)return e}let i=e.length>1?e.slice(1):[process.cwd()],a=await(await import(`./chunk-dmnTests-BOxutoRs.js`)).dmnTestCommand(i,{format:r,minCoverage:n(`min-rule-coverage`),licensed:t||_(await h())});return(await import(`./chunk-policy-BVb7c7G_.js`)).recordRun(i[0],`dmnTests`,a),a}if(e[0]!==`task`)return{ok:!1,lines:[P(`app.cli.dmnTests.unknownTest`)]};let i=(e,t)=>{if(t!==void 0)try{let n=JSON.parse(e===`--variables-file`?R(t===`-`?0:t,`utf8`):t);return typeof n==`object`&&n&&!Array.isArray(n)?n:P(`app.output.taskTest.badVariables`,{flag:e,reason:P(`app.cli.test.notAnObject`)})}catch(t){return P(`app.output.taskTest.badVariables`,{flag:e,reason:t instanceof Error?t.message:String(t)})}},a=i(`--variables`,n(`variables`))??i(`--variables-file`,n(`variables-file`)),o=i(`--complete`,n(`complete`));for(let e of[a,o])if(typeof e==`string`)return{ok:!1,lines:[e]};let s=n(`error`);if([t.has(`--complete`),s!==void 0,t.has(`--hold`)].filter(Boolean).length>1)return{ok:!1,lines:[P(`app.output.taskTest.oneMode`)]};let c=t.has(`--hold`)?{kind:`hold`}:s===void 0?{kind:`complete`,variables:o}:{kind:`error`,errorCode:s},l=Number(n(`timeout`)),u=new AbortController,d=()=>{u.signal.aborted&&process.exit(130),process.stderr.write(`${P(`app.cli.stopping`)}\n`),u.abort()};process.on(`SIGINT`,d),process.on(`SIGTERM`,d);try{return await(await import(`./chunk-taskTest-JErgWO6t.js`)).taskTestCommand(e[1],{element:n(`element`),variables:a,mode:c,process:n(`id`),signal:u.signal,stepTimeoutMs:Number.isFinite(l)&&l>0?l*1e3:void 0})}finally{process.off(`SIGINT`,d),process.off(`SIGTERM`,d)}},async migrate({action:e,targets:t,format:n,flags:r,option:i,options:a}){let o=t.filter(e=>!L(e));return o.length>0?{ok:!1,lines:o.map(e=>C(e))}:(await import(`./chunk-migrate-DVfXC-iJ.js`)).migrateCommand(e??`analyze`,t,{format:n,failOn:i(`fail-on`)===`warning`?`warning`:`error`,baseline:r.has(`--baseline`),updateBaseline:r.has(`--update-baseline`),dryRun:r.has(`--dry-run`),verbose:r.has(`--verbose`),out:i(`out`),target:i(`target`),write:r.has(`--write`),workers:i(`workers`),...a(`only`).length>0?{only:X(a(`only`))}:{},...a(`exclude`).length>0?{exclude:X(a(`exclude`))}:{},saved:r.has(`--saved`),saveSelection:r.has(`--save-selection`),scenarios:i(`scenarios`),runUnreviewed:r.has(`--run-unreviewed`),originalProfile:i(`original-profile`),convertedProfile:i(`converted-profile`)})},async code({targets:e,files:t,format:n}){return(await import(`./chunk-codeLinks-BVpn4_Sr.js`)).codeCommand(O(e[0]).root,t,n)},async facts(){return(await import(`./chunk-facts-Dl5lLriU.js`)).factsCommand(await(await import(`./chunk-facts-Dl5lLriU.js`)).readStandardInput())},async templates({words:e,templateAction:t,format:n,flags:r,option:i}){let a=e.find(e=>!G.includes(e));return(await import(`./chunk-templates-Y3xfCO_3.js`)).templatesCommand(a??process.cwd(),t,n,{write:r.has(`--write`),out:i(`out`),secretPrefix:i(`secret-prefix`)})},async incident({words:e,format:t,flags:n}){return(await import(`./chunk-incident-LJe2-ohi.js`)).incidentCommand(e,{write:n.has(`--write`),run:n.has(`--run`),format:t})},async receipt({words:e,format:t,flags:n,option:r}){return(await import(`./chunk-receipt-C4NqnSkH.js`)).receiptCommand(e,{against:r(`against`),format:t,write:n.has(`--write`),licensed:_(await h()),runScenarios:n.has(`--run-scenarios`)})},async agents({words:e,format:t,flags:n,option:r}){return(await import(`./chunk-agents-CZJoU2u2.js`)).agentsCommand(e,{write:n.has(`--write`),agent:r(`agent`),format:t})},async connections({words:e,format:t,option:n}){return(await import(`./chunk-connections-Drr67X9U.js`)).connectionsCommand(e[0]??process.cwd(),{environment:n(`env`),against:n(`against`),format:t})},async share({words:e,option:t}){return(await import(`./chunk-share-rsL0itIM.js`)).shareCommand(e[0],t(`out`))},async import({words:e,flags:t,format:n,option:r}){return(await import(`./chunk-importCommand-Dhikkmo0.js`)).importCommand(e[0],r(`out`),{force:t.has(`--force`),json:n===`json`,from:r(`from`),to:r(`to`),report:t.has(`--report`),modelerData:r(`modeler-data`)})},async docs({files:e,format:t,option:n}){return(await import(`./chunk-docs-B3C3pZpY.js`)).docsCommand(e,n(`out`),t===`text`?`html`:t)},async layout({files:e,flags:n}){let r=n.has(`--write`),i=r?e.flatMap(e=>{try{return[[e,R(e)]]}catch{return[]}}):[];try{return await t(e,r)}finally{for(let[e,t]of i)L(e)||B(e,t)}},async deploy({files:e,flags:t,option:n}){return(await import(`./chunk-deploy-BHg8pB9x.js`)).deployCommand(e,t.has(`--dry-run`),t.has(`--wait`),{onlyChanged:t.has(`--only-changed`),confirm:n(`confirm`),approveFile:n(`approve-file`)})},async drift({words:e,format:t,option:n}){return(await import(`./chunk-promotion-CTMPjXjZ.js`)).driftCommand(e[0]??process.cwd(),{environment:n(`env`),against:n(`against`),format:t})},async promote({words:e,format:t,option:n,flags:r}){return(await import(`./chunk-promotion-CTMPjXjZ.js`)).promoteCommand(e[0]??process.cwd(),{from:n(`from`),to:n(`to`),write:r.has(`--write`),dryRun:r.has(`--dry-run`),confirm:n(`confirm`),approveFile:n(`approve-file`),format:t})},async evidence({words:e,format:t,option:n,flags:r}){return(await import(`./chunk-evidence-ny_2ltVe.js`)).evidenceCommand(e,{format:t,out:n(`out`),since:n(`since`),force:r.has(`--force`)})},async refactor({words:e,format:t,option:n,flags:r}){return(await import(`./chunk-refactor-CWeCOl7w.js`)).refactorCommand(e,{project:n(`project`),format:t,name:n(`name`),apply:r.has(`--apply`),force:r.has(`--force`),acknowledge:r.has(`--acknowledge`)})},async export({files:e,format:t,option:n}){return(await import(`./chunk-export-Blwjf23H.js`)).exportCommand(e,t,n(`out`))},async report({targets:e,option:t}){return(await import(`./chunk-pr-1jKcTNnP.js`)).reportCommand(e[0],{base:t(`base`)??`origin/main`,out:t(`out`)??`penstock-report.md`,imagesDir:t(`images-dir`)??`.penstock/images`,imageBase:t(`image-base`),imagesLink:t(`images-link`)})},async bot({targets:e,option:t}){let n=t(`stage`);return n&&n!==`draw`&&n!==`post`?{ok:!1,lines:[P(`app.cli.bot.unknownStage`,{stage:n})]}:(await import(`./chunk-bot-C2k8yaXA.js`)).botCommand(e[0],n)},async fmt({files:e,flags:t}){return(await import(`./chunk-diff-9hjavV6V.js`)).formatCommand(e,t.has(`--write`))},async convert({files:e,flags:t,option:n}){return(await import(`./chunk-convert-FkMnlxyi.js`)).convertCommand(e,n(`to`),t.has(`--write`))},async diff({words:e,flags:t,option:n}){return e.length===2&&e.every(e=>L(e)&&z(e).isFile())?(await import(`./chunk-diff-9hjavV6V.js`)).diffCommand(e[0],e[1]):(await import(`./chunk-review-DYMgFDSy.js`)).againstCommand(process.cwd(),e.slice(1).flatMap(e=>E(e,[`process`,`decision`,`form`])),{base:e[0]??`HEAD~1`,images:t.has(`--images`),outDir:n(`out`)??`.penstock/images`})}};function J(e){if(e&&process.stdin.isTTY===!0&&process.stderr.isTTY===!0)return async e=>{let t=V({input:process.stdin,output:process.stderr});try{return await t.question(e)}finally{t.close()}}}const ne=/* @__PURE__ */ new Set([`mcp`,`web`,`agent`,`lsp`]);async function Y(e,t){if(c({workers:ne.has(e.command)?1:s,cacheDirectory:l(),remember:!1}),e.command===`lsp`)return(await import(`./chunk-lsp-BzeJkpmf.js`)).lspCommand(e.tokens,e.flags.has(`--stdio`));if(e.command===`mcp`){if(e.flags.has(`--config`))return process.stderr.write(`${P(`app.cli.mcpConfigHint`)}\n`),process.stdout.write(`${(await import(`./chunk-mcp-B_B9bet5.js`)).mcpConfig()}\n`),0;let t=e.option(`project`);if(t!==void 0){let e=I.resolve(t);if(!L(e))return process.stderr.write(`${C(e)}\n`),1;if(!z(e).isDirectory())return process.stderr.write(`${P(`app.cli.web.notAFolder`,{folder:e})}\n`),1}return(await import(`./chunk-mcp-B_B9bet5.js`)).mcpCommand(t??null)}let o=e.option(`profile`);o&&(process.env.PENSTOCK_PROFILE=o),j(t);let u=e.option(`format`)??`text`,d=e.words,f=e.command===`migrate`?A.includes(d[0])?d[0]:`analyze`:void 0,p=e.command===`check`?e.option(`ci`):void 0,m=e.command===`migrate`&&d[0]===f?d.slice(1):d,h=p!==void 0&&L(p)?[p,...m]:m,_=e.command===`migrate`?void 0:e.option(`only`),v=n(_),y=v.unknown??(_!==void 0&&v.sections.length===0?JSON.stringify(_.trim()):void 0);if(y!==void 0)return process.stderr.write(`${P(`app.cli.checkUnknownSection`,{section:y,sections:r.join(`, `)})}\n`),1;let b=N(ee,e.command),x=e.option(`format`);if(b&&x!==void 0&&!b.includes(x))return process.stderr.write(`${P(`app.cli.badFormat`,{value:x,values:b.join(`, `)})}\n`),2;let S=e.option(`fail-on`);if(S!==void 0&&S!==`error`&&S!==`warning`)return process.stderr.write(`${P(`app.cli.badFailOn`,{value:S})}\n`),1;let w=e.option(`timeout`);if(w!==void 0&&!(Number.isFinite(Number(w))&&Number(w)>0))return process.stderr.write(`${P(`app.cli.badTimeout`)}\n`),1;let T=d.find(e=>G.includes(e)),D=e.flags.has(`--check`)?`check`:T??`generate`,O=U(e.command,e.flags,u,_,f,h,D),k=O?await g(O):null;if(k)return process.stderr.write(`${(i()?k.lines.map(a):k.lines).join(`
|
|
3
|
+
`)}\n`),1;let F=h.length>0?h:[process.cwd()],R=K.includes(e.command);if(R){let e=F.filter(e=>!L(e));if(e.length>0)return process.stderr.write(`${e.map(e=>C(e)).join(`
|
|
4
|
+
`)}\n`),1}let B=R?F.flatMap(t=>E(t,N(W,e.command))):[];if(R&&B.length===0)return process.stderr.write(`${P(`app.cli.noDiagrams`,{paths:F.join(`, `)})}\n`),1;e.command!==`doctor`&&re(F);let V={check:`Check`,layout:`Layout`,deploy:`Deploy`}[e.command],H=J(e.command===`trust`||V!==void 0),q=e.flags.has(`--trust-project`),Y=V?await(await import(`./chunk-stages-B2sBBxUc.js`)).runHook(F[0],`pre`,V,B,H,process.env,q):{ran:!1,ok:!0,lines:[]};if(!Y.ok)return process.stderr.write(`${[...Y.lines,P(`app.cli.preHookStopped`,{stage:V})].join(`
|
|
5
|
+
`)}\n`),1;let X=N(te,e.command);if(!X)return process.stderr.write(`${P(`app.cli.unknownCommand`,{command:e.command})}\n\n${M()}`),1;let Z=await X({command:e.command,action:f,words:h,targets:F,files:B,format:u,sections:v.sections,templateAction:D,passthrough:(await import(`./chunk-agentLaunch-BnrpVME4.js`)).passthroughOf(e.tokens),flags:e.flags,option:e.option,options:e.options}),Q=V&&Z.ok?await(await import(`./chunk-stages-B2sBBxUc.js`)).runHook(F[0],`post`,V,B,H,process.env,q):{ran:!1,ok:!0,lines:[]},$=[...Y.lines,...Z.lines],ie=![`json`,`sarif`,`github`].includes(u)&&i(),ae=Z.refused??!Z.ok;return $.length>0&&(ae?process.stderr:process.stdout).write(`${(ie?$.map(a):$).join(`
|
|
6
|
+
`)}\n`),Q.ok||process.stderr.write(`${[...Q.lines,P(`app.cli.postHookStopped`,{stage:V})].join(`
|
|
7
|
+
`)}\n`),Z.code??(Z.ok&&Q.ok?0:1)}function X(e){return e.flatMap(e=>e.split(`,`)).map(e=>e.trim()).filter(e=>e!==``)}function re(e){let t=/* @__PURE__ */ new Set;for(let n of e){let e;try{e=O(n)}catch{continue}for(let{file:n,problems:r}of u(e.files))if(!t.has(n)){t.add(n);for(let e of r)process.stderr.write(`${p(e,D(n))}\n`)}}}export{Y as dispatch};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./chunk-context-rCJvBM9p.js";import{n as t,t as n}from"./chunk-dmnTests-BzNA-u2k.js";import{r}from"./chunk-failure-BRyRvObj.js";import{i,n as a,r as o,t as s}from"./chunk-report-BxZNhZ_G.js";import{r as c}from"./chunk-translator-DNm9zRpP.js";import{existsSync as l}from"node:fs";function u(e){if(e===void 0)return null;if(!/^\d+(\.\d+)?$/.test(e.trim()))return`bad`;let t=Number(e);return t>=0&&t<=100?t:`bad`}async function d(d,f){let p=u(f.minCoverage);if(p===`bad`)return{ok:!1,lines:[c(`app.cli.dmnTests.badCoverage`,{value:String(f.minCoverage).slice(0,40)})]};let m=d.filter(e=>!l(e));if(m.length>0)return{ok:!1,lines:m.map(e=>r(e))};let h=n(d);if(h.length===0)return{ok:!1,lines:[c(`app.cli.dmnTests.noFiles`,{targets:d.join(`, `)})]};let g=[];for(let e of h)g.push(await t(e,{licensed:f.licensed}));let _=g.reduce((e,t)=>e+t.total.covered,0),v=g.reduce((e,t)=>e+t.total.total,0),y=i(_,v),b=g.some(e=>e.problem!==null),x=g.some(e=>e.failed>0||e.errors>0),S=p!==null&&(v===0?100:_/v*100)<p,C=g.reduce((e,t)=>e+t.skipped,0),w=S?c(`app.cli.dmnTests.coverageBelow`,{percent:y,min:p}):null,T=!b&&!x&&!S;if(f.format===`json`){let t=s(g,e);return{ok:T,refused:!1,lines:[JSON.stringify({...t,...w===null?{}:{gate:w}},null,2)]}}if(f.format===`junit`)return{ok:T,refused:!1,lines:[a(g,e).trimEnd()]};let E=o(g,e);return w!==null&&E.push(w),C>0&&!f.licensed&&E.push(c(`app.cli.dmnTests.preview`)),{ok:T,refused:!1,lines:E}}export{d as dmnTestCommand};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./chunk-translator-DNm9zRpP.js";import{n as t,t as n}from"./chunk-validate-Byn3Pkaa.js";import{t as r}from"./chunk-moddle-D3Ym38EZ.js";import{d as i}from"./chunk-model-f8AzYUK7.js";import{d as a}from"./chunk-analyze-pgzR-Cx-.js";import{_ as o,o as s,v as c}from"./chunk-load-rfn3E0t5.js";import{t as l}from"./chunk-diagrams-BukAOL0g.js";import{a as u}from"./chunk-safeWrite-RgLbdyzl.js";import{n as d}from"./chunk-say-CYb4HeJD.js";import f from"node:path";import{existsSync as p,lstatSync as m,readFileSync as h,statSync as g}from"node:fs";function _(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function v(e,t){if(Object.hasOwn(e,t))return e[t];let n=e;for(let e of t.split(`.`)){if(!_(n)||!Object.hasOwn(n,e))return;n=n[e]}return n}function y(e){return typeof e==`string`?`"${e}"`:e===void 0?`not set`:JSON.stringify(e)}async function b(t,n){let i;try{i=(await r(`plain`).fromXML(t)).rootElement}catch{return[]}let a=[];for(let t of i?.drgElement??[]){let r=t.decisionLogic;t.$type===`dmn:Decision`&&r?.$type===`dmn:DecisionTable`&&t.id&&a.push({decisionId:t.id,name:t.name?.trim()||t.id,hitPolicy:(r.hitPolicy??`UNIQUE`).toUpperCase(),aggregation:r.aggregation?.toUpperCase(),file:n,inputs:(r.input??[]).map((t,n)=>({label:t.label?.trim()||t.inputExpression?.text?.trim()||e(`app.scenarios.dmn.unnamedInput`,{number:n+1}),expression:t.inputExpression?.text?.trim()??``,...t.inputExpression?.typeRef?{type:t.inputExpression.typeRef}:{}})),outputs:(r.output??[]).map((t,n)=>({name:t.name?.trim()||t.label?.trim()||e(`app.scenarios.dmn.unnamedOutput`,{number:n+1}),typeRef:t.typeRef,...t.outputValues?.text?{values:S(t.outputValues.text)}:{}})),rules:(r.rule??[]).map((e,t)=>({id:e.id??`rule-${t+1}`,inputs:(e.inputEntry??[]).map(e=>(e.text??``).trim()),outputs:(e.outputEntry??[]).map(e=>(e.text??``).trim())}))})}return a}function x(e,t){if(e===`true`)return!0;if(e===`false`)return!1;if(e===`null`)return null;let n=/^"((?:[^"\\]|\\.)*)"$/.exec(e);return n?n[1]:/^-?\d+(\.\d+)?$/.test(e)?Number(e):t&&/int|long|double|number|decimal/i.test(t)?Number.isNaN(Number(e))?e:Number(e):e}function S(e){return[...e.matchAll(/"(?:[^"\\]|\\.)*"|[^,\s][^,]*/g)].map(e=>e[0].trim())}const C=/* @__PURE__ */ new Set([`COLLECT`,`RULE ORDER`,`OUTPUT ORDER`]),ee=/* @__PURE__ */ new Set([`COLLECT`,`RULE ORDER`,`OUTPUT ORDER`]),w={SUM:e=>e.reduce((e,t)=>e+t,0),COUNT:e=>e.length,MIN:e=>e.reduce((e,t)=>Math.min(e,t),1/0),MAX:e=>e.reduce((e,t)=>Math.max(e,t),-1/0),MEAN:e=>e.length===0?NaN:e.reduce((e,t)=>e+t,0)/e.length,MEDIAN:e=>{let t=[...e].sort((e,t)=>e-t),n=Math.floor(t.length/2);return t.length%2==0?(t[n-1]+t[n])/2:t[n]},MODE:e=>{let t=/* @__PURE__ */ new Map,n=e[0]??NaN,r=0;for(let i of e){let e=(t.get(i)??0)+1;t.set(i,e),e>r&&(n=i,r=e)}return n}};function T(e,t){let n=e.rules[t],r={};return e.outputs.forEach((e,t)=>{r[e.name]=x(n.outputs[t]??``,e.typeRef)}),r}function E(e,t){return(e.outputs[0]?.values??[]).indexOf((e.rules[t].outputs[0]??``).trim())}function te(t,n){let r=/* @__PURE__ */ new Set,i=[],o=[],s=[],c=!1,l=[],u=t.inputs.map(e=>/^[A-Za-z_][\w.]*$/.test(e.expression)?v(n,e.expression):Symbol.for(`unreadable`));if(t.inputs.forEach((e,t)=>{u[t]===Symbol.for(`unreadable`)?i.push(e.expression):u[t]===void 0&&r.add(e.expression)}),i.length>0)return{rules:[],matching:[],outputs:{},why:e(`app.scenarios.dmn.cannotReadInput`,{inputs:i.join(`, `)}),missing:[],unread:!0,unreadInputs:i,unreadCells:s,problems:[]};t.rules.forEach((e,n)=>{t.inputs.every((t,n)=>{let r=e.inputs[n],i=a(r);if(!i){c=!0;let e=(r??``).trim()||`-`;return s.includes(e)||s.push(e),!1}if(i.kind===`any`)return!0;let l=u[n];if(l===void 0)return!1;if(typeof l==`string`&&i.kind===`number`)return o.includes(t.expression)||o.push(t.expression),!1;let d=typeof l==`number`||typeof l==`string`||typeof l==`boolean`?l:String(l);return i.test(d)})&&l.push(n+1)});let d=[],f=t.hitPolicy;if(l.length===0){let a=o.map(t=>e(`app.scenarios.dmn.textAsNumber`,{name:t,value:JSON.stringify(v(n,t))})),l=r.size>0?e(`app.scenarios.dmn.chooseVariablesFor`,{names:[...r].join(`, `)}):a.length>0?a.join(`; `):e(`app.scenarios.dmn.noRuleMatches`);return{rules:[],matching:[],outputs:{},why:e(`app.scenarios.dmn.tableBecause`,{table:t.name,because:l}),missing:[...r],unread:c,unreadInputs:i,unreadCells:s,problems:d}}let p=l;if(f===`UNIQUE`&&l.length>1&&d.push(e(`app.scenarios.dmn.hitPolicyUnique`,{first:l.slice(0,-1).join(`, `),last:l[l.length-1]})),f===`ANY`&&new Set(l.map(e=>JSON.stringify(T(t,e-1)))).size>1&&d.push(e(`app.scenarios.dmn.hitPolicyAny`,{rules:l.join(`, `)})),f===`PRIORITY`||f===`OUTPUT ORDER`){if((t.outputs[0]?.values??[]).length===0)d.push(e(`app.scenarios.dmn.hitPolicyNeedsValues`,{policy:e(f===`PRIORITY`?`app.scenarios.dmn.hitPolicy.priority`:`app.scenarios.dmn.hitPolicy.outputOrder`)}));else{let e=[...l].sort((e,n)=>E(t,e-1)-E(t,n-1));p=f===`PRIORITY`?e.slice(0,1):e}}else!C.has(f)&&f!==`UNIQUE`&&f!==`ANY`&&(p=l.slice(0,1));let m=p.map(e=>T(t,e-1)),h=C.has(f)||f===`OUTPUT ORDER`?Object.fromEntries(t.outputs.map(e=>[e.name,m.map(t=>t[e.name])])):m[0],g=t.aggregation?w[t.aggregation]:void 0;if(ee.has(f)&&g&&t.outputs.length>0){let e=t.outputs[0].name,n=h[e].filter(e=>typeof e==`number`);h={[e]:g(n)}}d.length>0&&(h={});let _=t.rules[p[0]-1],b=t.inputs.flatMap((t,r)=>{let i=_.inputs[r];return!i||i===`-`?[]:[e(`app.scenarios.dmn.inputFits`,{input:t.label,value:y(v(n,t.expression)),cell:i})]}),x=d.length>0?e(`app.scenarios.dmn.raisesAnError`):e(`app.scenarios.dmn.returnsOutputs`,{outputs:t.outputs.map(e=>`${e.name} = ${y(h[e.name])}`).join(`, `)}),S=p.length>1?e(`app.scenarios.dmn.rulesMatch`,{rules:p.join(`, `)}):e(`app.scenarios.dmn.ruleMatches`,{rule:p[0]});return{rules:p,matching:l,outputs:h,why:b.length>0?e(`app.scenarios.dmn.whyWithReasons`,{which:S,reasons:b.join(`, `),returns:x}):e(`app.scenarios.dmn.why`,{which:S,returns:x}),missing:[...r],unread:c,unreadInputs:i,unreadCells:s,problems:d}}const D=/^[A-Za-z_][\w.]*$/,ne=/^\d{4}-\d{2}-\d{2}(?:T[\d:.]+(?:Z|[+-]\d{2}:?\d{2})?)?$/;function re(e){let t=(e??``).toLowerCase();return/bool/.test(t)?`boolean`:/date|time/.test(t)?`date`:/int|long|double|number|decimal/.test(t)?`number`:`string`}function O(e){let t=(e??``).trim();if(t)return[...t.matchAll(/"(?:[^"\\]|\\.)*"|[^,\s][^,]*/g)].map(e=>e[0].trim())}function k(e,t){let n=e.name?.trim()||e.label?.trim()||`output ${t+1}`,r=O(e.outputValues?.text);return{name:n,...e.typeRef?{typeRef:e.typeRef}:{},...r?{values:r}:{}}}function A(e){let t=e.decisionLogic;return e.$type!==`dmn:Decision`||t?.$type!==`dmn:DecisionTable`||!e.id?null:{decisionId:e.id,name:e.name?.trim()||e.id,hitPolicy:(t.hitPolicy??`UNIQUE`).toUpperCase(),...t.aggregation?{aggregation:t.aggregation.toUpperCase()}:{},inputs:(t.input??[]).map((e,t)=>{let n=e.inputExpression?.text?.trim()??``;return{label:e.label?.trim()||n||`input ${t+1}`,expression:n,type:re(e.inputExpression?.typeRef)}}),outputs:(t.output??[]).map(k),rules:(t.rule??[]).map((e,t)=>({id:e.id??`rule-${t+1}`,inputs:(e.inputEntry??[]).map(e=>(e.text??``).trim()),outputs:(e.outputEntry??[]).map(e=>(e.text??``).trim()),...e.description?{description:e.description}:{}})).filter(e=>[...e.inputs,...e.outputs].some(e=>e!==``))}}function j(e){return((e??{}).drgElement??[]).flatMap(e=>{let t=A(e);return t?[t]:[]})}function M(e){return new Map(((e??{}).drgElement??[]).flatMap(e=>e.id?[[e.id,e]]:[]))}function N(e){let t=e?.href;return typeof t==`string`?t.replace(/^#/,``):null}function P(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function F(e,t,n){if(!D.test(t))return;let r=t.split(`.`),i=e;for(let e of r.slice(0,-1)){if(!P(i))return;e in i||(i[e]={}),i=i[e]}P(i)&&(i[r[r.length-1]]=n)}function ie(e,t){let n=e.trim();if(n!==``){if(t===`number`){let e=Number(n);return Number.isFinite(e)?e:null}return t===`boolean`?/^true$/i.test(n)?!0:!/^false$/i.test(n)&&null:t===`date`?ne.test(n)?n:null:n}}function ae(e,t){let n={},r=[],i=[];for(let a of e.inputs){if(!D.test(a.expression)){i.push(a.expression);continue}let e=v(t,a.expression);if(e===void 0)continue;let o=ie(String(e),a.type);o===null?i.push(a.expression):(n[a.expression]=o,r.push({name:a.expression,type:a.type,text:String(e)}))}return{values:n,typed:r,wrong:i}}function I(e,t){return(M(e).get(t)?.informationRequirement??[]).flatMap(e=>{let t=N(e.requiredDecision);return t?[{decision:t,input:N(e.requiredInput)}]:[]})}function oe(e,t,n){let r=new Map(t.map(e=>[e.decisionId,e])),i=/* @__PURE__ */ new Set,a=[],o=t=>{if(!i.has(t)&&r.has(t)){i.add(t);for(let n of I(e,t))o(n.decision);a.push(r.get(t))}};return o(n),a}function se(t,n){let r=t.inputs.filter(e=>D.test(e.expression)&&v(n,e.expression)===void 0).map(e=>e.expression),{values:i,typed:a,wrong:o}=ae(t,n),s=te(t,i);if(o.length>0){s.rules=[],s.matching=[],s.outputs={};let n=o.map(n=>{let r=t.inputs.find(e=>e.expression===n);return e(`app.try.shouldBe`,{name:n,wanted:D.test(n)?e(`app.try.aValueOf`,{type:r?.type??e(`app.try.value`)}):e(`app.try.aNamePenstockCanRead`)})}).join(`; `);s.why=e(`app.try.noRuleWasCompared`,{table:t.name,names:n}),s.problems=[]}let c=[...new Set(s.unreadCells)];return c.length>0&&(s.why=e(`app.try.penstockCannotEvaluateHere`,{why:s.why,cells:c.join(`, `)})),{match:s,typed:a,unreadable:c,wrong:o,needs:r}}function ce(e,t,n,r){for(let i of I(e,n)){let e=t.find(e=>e.decisionId===i.decision)?.outputs[0];e&&i.input&&F(r,i.input,v(r,e.name))}}function le(t,n,r,i){let a={...i},o=[],s=[];for(let i of oe(t,n,r)){ce(t,n,i.decisionId,a);let c=se(i,a);if(c.needs.length>0){let t=e(`app.try.needsAValueFor`,{names:c.needs.join(`, `)});if(s.push(e(`app.try.tableNeeds`,{table:i.name,skipped:t})),o.push({decisionId:i.decisionId,name:i.name,table:i,match:c.match,skipped:t,unreadable:[]}),i.decisionId===r)return{order:o,result:o[o.length-1],unreadable:[],typed:[],outputs:[],waiting:s};continue}if(i.decisionId===r){let e={decisionId:i.decisionId,name:i.name,table:i,match:c.match,skipped:null,unreadable:c.unreadable};return o.push(e),{order:o,result:e,unreadable:c.unreadable,typed:c.typed,outputs:i.outputs.map(e=>({name:e.name,value:c.match.outputs[e.name],type:e.typeRef})),waiting:s}}let l=i.outputs[0]?c.match.outputs[i.outputs[0].name]:void 0;l!==void 0&&i.outputs.length===1&&F(a,i.outputs[0].name,l),o.push({decisionId:i.decisionId,name:i.name,table:i,match:c.match,skipped:null,unreadable:c.unreadable})}return{order:o,result:null,unreadable:[],typed:[],outputs:[],waiting:s}}const L=`penstock-dmn-tests/1`,R=1e3;function z(e){return`${e.replace(/\.dmn$/i,``)}.dmn.tests.json`}function B(){return{schema:L,cases:[]}}function V(e){return typeof e==`number`?e:typeof e==`string`&&/^-?\d+(\.\d+)?$/.test(e.trim())?Number(e):null}function H(e,t){if(e===t)return!0;let n=V(e),r=V(t);if(n!==null&&r!==null)return n===r;if(Array.isArray(e)||Array.isArray(t))return Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((e,n)=>H(e,t[n]));if(typeof e==`object`&&e&&typeof t==`object`&&t){let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>Object.hasOwn(t,n)&&H(e[n],t[n]))}return!1}function U(e,t){let n=[...e].sort((e,t)=>e-t),r=[...t].sort((e,t)=>e-t);return n.length===r.length&&n.every((e,t)=>e===r[t])}function ue(e){return structuredClone(Object.fromEntries(Object.entries(e)))}function de(t,n,r){let i=/* @__PURE__ */ new Map,a=/* @__PURE__ */ new Map,o={name:r.name,decision:r.decision,status:`error`,rules:[],matching:[],actual:{},diffs:[],rulesDiff:null,why:``,message:null};if(!n.some(e=>e.decisionId===r.decision))return{result:{...o,message:e(`app.dmnTests.unknownDecision`,{decision:r.decision})},applied:i,hit:a};let s=le(t,n,r.decision,ue(r.inputs)),c=s.result;if(c===null)return{result:{...o,message:e(`app.dmnTests.notEvaluated`,{decision:r.decision})},applied:i,hit:a};if(s.waiting.length>0)return{result:{...o,why:c.match.why,message:s.waiting.join(`; `)},applied:i,hit:a};if(c.unreadable.length>0)return{result:{...o,why:c.match.why,message:e(`app.dmnTests.unreadableCells`,{cells:c.unreadable.join(`, `)})},applied:i,hit:a};if(c.match.problems.length>0)return{result:{...o,why:c.match.why,message:c.match.problems.join(` `)},applied:i,hit:a};for(let e of s.order)e.skipped===null&&(i.set(e.decisionId,e.match.rules),a.set(e.decisionId,e.match.matching));let l=c.match.outputs,u=[],d=Object.keys(r.expected);for(let e of d)H(r.expected[e],l[e])||u.push({output:e,expected:r.expected[e],...l[e]===void 0?{}:{actual:l[e]}});if(d.length===0)for(let e of Object.keys(l))u.push({output:e,actual:l[e]});let f=r.rules!==void 0&&!U(r.rules,c.match.rules)?{expected:r.rules,actual:c.match.rules}:null,p=u.length>0||f!==null,m=p?fe(u,f):null;return{result:{...o,status:p?`failed`:`passed`,rules:c.match.rules,matching:c.match.matching,actual:l,diffs:u,rulesDiff:f,why:c.match.why,message:m},applied:i,hit:a}}function fe(t,n){let r=t.map(t=>e(`app.dmnTests.outputDiffers`,{output:t.output,expected:t.expected===void 0?e(`app.dmnTests.nothing`):y(t.expected),actual:t.actual===void 0?e(`app.dmnTests.nothing`):y(t.actual)}));return n&&r.push(e(`app.dmnTests.rulesDiffer`,{expected:n.expected.join(`, `)||e(`app.dmnTests.nothing`),actual:n.actual.join(`, `)||e(`app.dmnTests.nothing`)})),r.join(`; `)}const W=e=>[...new Set(e)].sort((e,t)=>e-t);function G(e,t){let n=t.filter(e=>e.result.status!==`error`),r=e.map(e=>{let t=/* @__PURE__ */ new Set,r=/* @__PURE__ */ new Set;for(let i of n){for(let n of i.applied.get(e.decisionId)??[])t.add(n);for(let t of i.hit.get(e.decisionId)??[])r.add(t)}let i=e.rules.map((e,t)=>t+1),a=W(i.filter(e=>t.has(e)));return{decisionId:e.decisionId,name:e.name,hitPolicy:e.hitPolicy,aggregation:e.aggregation??null,rules:i.length,covered:a,notCovered:i.filter(e=>!t.has(e)),shadowed:W([...r].filter(e=>!t.has(e))),percent:i.length===0?100:Math.round(a.length/i.length*1e3)/10}}),i=r.reduce((e,t)=>e+t.rules,0),a=r.reduce((e,t)=>e+t.covered.length,0);return{coverage:r,total:{covered:a,total:i,percent:i===0?100:Math.round(a/i*1e3)/10}}}function pe(e,t){if(t)return{run:e,skipped:0};let n=/* @__PURE__ */ new Map,r=e.filter(e=>{let t=n.get(e.decision)??0;return n.set(e.decision,t+1),t<3});return{run:r,skipped:e.length-r.length}}function me(e,t,n={licensed:!0}){let r=j(e),i=pe(t.cases,n.licensed),a=n.only===void 0?null:t.cases[n.only],o=a==null?i.run:i.run.filter(e=>e===a),s=a==null?i.skipped:+(a!==void 0&&!o.includes(a)),c=o.map(t=>de(e,r,t)),{coverage:l,total:u}=G(r,c);return{results:c.map(e=>e.result),coverage:l,total:u,skipped:s}}const K={type:`object`,maxProperties:100,propertyNames:{maxLength:200},additionalProperties:{}},q={$schema:`http://json-schema.org/draft-07/schema#`,$id:`https://raw.githubusercontent.com/kern0x1b/penstock-release/main/docs/schema/penstock-dmn-tests.schema.json`,title:`Penstock DMN test cases`,description:`Saved test cases for the decision tables of a DMN file, kept next to it as <name>.dmn.tests.json. Penstock runs them on the decision table and shows which rules each case matched.`,type:`object`,additionalProperties:!1,required:[`schema`,`cases`],properties:{$schema:{type:`string`,maxLength:300,description:`The address of this schema, for editors.`},schema:{const:L,description:`The version of this format.`},cases:{type:`array`,maxItems:R,description:`One entry per test case, run in this order.`,items:{type:`object`,additionalProperties:!1,required:[`name`,`decision`,`inputs`,`expected`],properties:{name:{type:`string`,minLength:1,maxLength:200,description:`What the case shows.`},decision:{type:`string`,minLength:1,maxLength:200,description:`The id of the decision, which can be a decision table or a decision that requires others.`},inputs:{...K,description:`The values the decision starts with, by the input expression of each decision table; a name with a dot reaches into an object.`},expected:{...K,description:`The outputs the decision must give, by output name. Only the outputs listed are compared; none listed means no rule may match.`},rules:{type:`array`,maxItems:500,items:{type:`integer`,minimum:1,maximum:500},description:`Optional: the numbers of the rules that must be the ones applied, counted from 1.`}}}}}},he=/* @__PURE__ */ new Set([`__proto__`,`constructor`,`prototype`]);function J(e,t){if(!(t>8)){if(e===null||typeof e==`boolean`||typeof e==`string`)return e;if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(Array.isArray(e)){if(e.length>100)return;let n=[];for(let r of e){let e=J(r,t+1);if(e===void 0)return;n.push(e)}return n}if(typeof e==`object`){let n=Object.keys(e);if(n.length>100)return;let r=Object.create(null);for(let i of n){if(he.has(i))return;let n=J(e[i],t+1);if(n===void 0)return;r[i]=n}return r}}}function Y(e){let t=J(e,0);return t!==void 0&&typeof t==`object`&&t&&!Array.isArray(t)?t:null}function X(e){let r=n(e,2097152);if(`problem`in r)return{problems:[{at:`$`,code:r.problem}]};let i=t(q,r.value);if(i.length>0)return{problems:i};let a=[],o=r.value.cases;for(let[e,t]of o.entries()){let n=Y(t.inputs),r=Y(t.expected);if(n===null||r===null)return{problems:[{at:`cases[${e}]`,code:`deep`}]};a.push({name:t.name,decision:t.decision,inputs:n,expected:r,...Array.isArray(t.rules)?{rules:t.rules}:{}})}return{file:{schema:L,cases:a}}}function Z(e){let t={$schema:q.$id,schema:L,cases:e.cases.map(e=>({name:e.name,decision:e.decision,inputs:e.inputs,expected:e.expected,...e.rules&&e.rules.length>0?{rules:e.rules}:{}}))};return`${JSON.stringify(t,null,2)}\n`}function ge(e){let t=/* @__PURE__ */ new Set;for(let n of e)for(let e of l(n,[`decision`]))/\.dmn$/i.test(e)&&t.add(f.resolve(e));return[...t].sort()}function Q(t){let n=c(s(f.dirname(f.resolve(t)))),r=z(f.resolve(t));if(!p(r))return{file:B(),path:r,exists:!1};let i=c(r);if(!o(i,[n]))return{problem:e(`app.dmnTests.outside`,{file:f.basename(r)})};let a;try{let t=m(i);if(!t.isFile())return{problem:e(`app.dmnTests.unreadable`,{file:f.basename(r)})};if(t.size>2097152)return{problem:e(`app.dmnTests.tooLarge`,{file:f.basename(r)})};a=h(i,`utf8`)}catch{return{problem:e(`app.dmnTests.unreadable`,{file:f.basename(r)})}}let l=X(a);return`problems`in l?{problem:e(`app.dmnTests.invalid`,{file:f.basename(r),problems:d(l.problems)})}:{file:l.file,path:r,exists:!0}}function $(e,t,n){return{file:e,testsFile:n,cases:[],coverage:[],total:{covered:0,total:0,percent:100},passed:0,failed:0,errors:0,skipped:0,problem:t}}async function _e(t,n){let r=f.resolve(t),a;try{let t=g(r);if(!t.isFile()||t.size>33554432)return $(r,e(`app.dmnTests.dmnUnreadable`,{file:f.basename(r)}),null);a=h(r,`utf8`)}catch{return $(r,e(`app.dmnTests.dmnUnreadable`,{file:f.basename(r)}),null)}let o;try{o=(await i(a)).rootElement}catch(e){return $(r,e instanceof Error?e.message:String(e),null)}let s=Q(r);if(`problem`in s)return $(r,s.problem,z(r));let c=me(o,s.file,n),l=j(o),u=c.results.length===0?G(l,[]):{coverage:c.coverage,total:c.total};return{file:r,testsFile:s.exists?s.path:null,cases:c.results,coverage:u.coverage,total:u.total,passed:c.results.filter(e=>e.status===`passed`).length,failed:c.results.filter(e=>e.status===`failed`).length,errors:c.results.filter(e=>e.status===`error`).length,skipped:c.skipped,problem:null}}function ve(t,n){let r=f.resolve(t);if(!p(r))return{problem:e(`app.dmnTests.dmnUnreadable`,{file:f.basename(r)})};let i=Q(r);if(`problem`in i)return i;let a=i.file.cases.findIndex(e=>e.decision===n.decision&&e.name===n.name);if(a<0&&i.file.cases.length>=1e3)return{problem:e(`app.dmnTests.tooMany`,{max:R})};let o=a<0?[...i.file.cases,n]:i.file.cases.map((e,t)=>t===a?n:e),l=c(s(f.dirname(r)));return u([{path:i.path,content:Z({...i.file,cases:o})}],l,{replace:!0}),{path:i.path,replaced:a>=0,total:o.length}}export{L as a,X as i,_e as n,z as o,ve as r,b as s,ge as t};
|
|
1
|
+
import{d as e}from"./chunk-model-BulEKnY1.js";import{r as t}from"./chunk-translator-DNm9zRpP.js";import{t as n}from"./chunk-moddle-D3Ym38EZ.js";import{d as r}from"./chunk-analyze-DgQqzEgb.js";import{n as i,t as a}from"./chunk-validate-Byn3Pkaa.js";import{n as o}from"./chunk-say-CP1IyOSv.js";import{t as s}from"./chunk-diagrams-CtGMGTa8.js";import{_ as c,o as l,v as u}from"./chunk-load-rfn3E0t5.js";import{a as d}from"./chunk-safeWrite-RgLbdyzl.js";import f from"node:path";import{existsSync as p,lstatSync as m,readFileSync as h,statSync as g}from"node:fs";function _(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function v(e,t){if(Object.hasOwn(e,t))return e[t];let n=e;for(let e of t.split(`.`)){if(!_(n)||!Object.hasOwn(n,e))return;n=n[e]}return n}function y(e){return typeof e==`string`?`"${e}"`:e===void 0?`not set`:JSON.stringify(e)}async function b(e,r){let i;try{i=(await n(`plain`).fromXML(e)).rootElement}catch{return[]}let a=[];for(let e of i?.drgElement??[]){let n=e.decisionLogic;e.$type===`dmn:Decision`&&n?.$type===`dmn:DecisionTable`&&e.id&&a.push({decisionId:e.id,name:e.name?.trim()||e.id,hitPolicy:(n.hitPolicy??`UNIQUE`).toUpperCase(),aggregation:n.aggregation?.toUpperCase(),file:r,inputs:(n.input??[]).map((e,n)=>({label:e.label?.trim()||e.inputExpression?.text?.trim()||t(`app.scenarios.dmn.unnamedInput`,{number:n+1}),expression:e.inputExpression?.text?.trim()??``,...e.inputExpression?.typeRef?{type:e.inputExpression.typeRef}:{}})),outputs:(n.output??[]).map((e,n)=>({name:e.name?.trim()||e.label?.trim()||t(`app.scenarios.dmn.unnamedOutput`,{number:n+1}),typeRef:e.typeRef,...e.outputValues?.text?{values:S(e.outputValues.text)}:{}})),rules:(n.rule??[]).map((e,t)=>({id:e.id??`rule-${t+1}`,inputs:(e.inputEntry??[]).map(e=>(e.text??``).trim()),outputs:(e.outputEntry??[]).map(e=>(e.text??``).trim())}))})}return a}function x(e,t){if(e===`true`)return!0;if(e===`false`)return!1;if(e===`null`)return null;let n=/^"((?:[^"\\]|\\.)*)"$/.exec(e);return n?n[1]:/^-?\d+(\.\d+)?$/.test(e)?Number(e):t&&/int|long|double|number|decimal/i.test(t)?Number.isNaN(Number(e))?e:Number(e):e}function S(e){return[...e.matchAll(/"(?:[^"\\]|\\.)*"|[^,\s][^,]*/g)].map(e=>e[0].trim())}const C=/* @__PURE__ */ new Set([`COLLECT`,`RULE ORDER`,`OUTPUT ORDER`]),ee=/* @__PURE__ */ new Set([`COLLECT`,`RULE ORDER`,`OUTPUT ORDER`]),w={SUM:e=>e.reduce((e,t)=>e+t,0),COUNT:e=>e.length,MIN:e=>e.reduce((e,t)=>Math.min(e,t),1/0),MAX:e=>e.reduce((e,t)=>Math.max(e,t),-1/0),MEAN:e=>e.length===0?NaN:e.reduce((e,t)=>e+t,0)/e.length,MEDIAN:e=>{let t=[...e].sort((e,t)=>e-t),n=Math.floor(t.length/2);return t.length%2==0?(t[n-1]+t[n])/2:t[n]},MODE:e=>{let t=/* @__PURE__ */ new Map,n=e[0]??NaN,r=0;for(let i of e){let e=(t.get(i)??0)+1;t.set(i,e),e>r&&(n=i,r=e)}return n}};function T(e,t){let n=e.rules[t],r={};return e.outputs.forEach((e,t)=>{r[e.name]=x(n.outputs[t]??``,e.typeRef)}),r}function E(e,t){return(e.outputs[0]?.values??[]).indexOf((e.rules[t].outputs[0]??``).trim())}function te(e,n){let i=/* @__PURE__ */ new Set,a=[],o=[],s=[],c=!1,l=[],u=e.inputs.map(e=>/^[A-Za-z_][\w.]*$/.test(e.expression)?v(n,e.expression):Symbol.for(`unreadable`));if(e.inputs.forEach((e,t)=>{u[t]===Symbol.for(`unreadable`)?a.push(e.expression):u[t]===void 0&&i.add(e.expression)}),a.length>0)return{rules:[],matching:[],outputs:{},why:t(`app.scenarios.dmn.cannotReadInput`,{inputs:a.join(`, `)}),missing:[],unread:!0,unreadInputs:a,unreadCells:s,problems:[]};e.rules.forEach((t,n)=>{e.inputs.every((e,n)=>{let i=t.inputs[n],a=r(i);if(!a){c=!0;let e=(i??``).trim()||`-`;return s.includes(e)||s.push(e),!1}if(a.kind===`any`)return!0;let l=u[n];if(l===void 0)return!1;if(typeof l==`string`&&a.kind===`number`)return o.includes(e.expression)||o.push(e.expression),!1;let d=typeof l==`number`||typeof l==`string`||typeof l==`boolean`?l:String(l);return a.test(d)})&&l.push(n+1)});let d=[],f=e.hitPolicy;if(l.length===0){let r=o.map(e=>t(`app.scenarios.dmn.textAsNumber`,{name:e,value:JSON.stringify(v(n,e))})),l=i.size>0?t(`app.scenarios.dmn.chooseVariablesFor`,{names:[...i].join(`, `)}):r.length>0?r.join(`; `):t(`app.scenarios.dmn.noRuleMatches`);return{rules:[],matching:[],outputs:{},why:t(`app.scenarios.dmn.tableBecause`,{table:e.name,because:l}),missing:[...i],unread:c,unreadInputs:a,unreadCells:s,problems:d}}let p=l;if(f===`UNIQUE`&&l.length>1&&d.push(t(`app.scenarios.dmn.hitPolicyUnique`,{first:l.slice(0,-1).join(`, `),last:l[l.length-1]})),f===`ANY`&&new Set(l.map(t=>JSON.stringify(T(e,t-1)))).size>1&&d.push(t(`app.scenarios.dmn.hitPolicyAny`,{rules:l.join(`, `)})),f===`PRIORITY`||f===`OUTPUT ORDER`){if((e.outputs[0]?.values??[]).length===0)d.push(t(`app.scenarios.dmn.hitPolicyNeedsValues`,{policy:t(f===`PRIORITY`?`app.scenarios.dmn.hitPolicy.priority`:`app.scenarios.dmn.hitPolicy.outputOrder`)}));else{let t=[...l].sort((t,n)=>E(e,t-1)-E(e,n-1));p=f===`PRIORITY`?t.slice(0,1):t}}else!C.has(f)&&f!==`UNIQUE`&&f!==`ANY`&&(p=l.slice(0,1));let m=p.map(t=>T(e,t-1)),h=C.has(f)||f===`OUTPUT ORDER`?Object.fromEntries(e.outputs.map(e=>[e.name,m.map(t=>t[e.name])])):m[0],g=e.aggregation?w[e.aggregation]:void 0;if(ee.has(f)&&g&&e.outputs.length>0){let t=e.outputs[0].name,n=h[t].filter(e=>typeof e==`number`);h={[t]:g(n)}}d.length>0&&(h={});let _=e.rules[p[0]-1],b=e.inputs.flatMap((e,r)=>{let i=_.inputs[r];return!i||i===`-`?[]:[t(`app.scenarios.dmn.inputFits`,{input:e.label,value:y(v(n,e.expression)),cell:i})]}),x=d.length>0?t(`app.scenarios.dmn.raisesAnError`):t(`app.scenarios.dmn.returnsOutputs`,{outputs:e.outputs.map(e=>`${e.name} = ${y(h[e.name])}`).join(`, `)}),S=p.length>1?t(`app.scenarios.dmn.rulesMatch`,{rules:p.join(`, `)}):t(`app.scenarios.dmn.ruleMatches`,{rule:p[0]});return{rules:p,matching:l,outputs:h,why:b.length>0?t(`app.scenarios.dmn.whyWithReasons`,{which:S,reasons:b.join(`, `),returns:x}):t(`app.scenarios.dmn.why`,{which:S,returns:x}),missing:[...i],unread:c,unreadInputs:a,unreadCells:s,problems:d}}const D=/^[A-Za-z_][\w.]*$/,ne=/^\d{4}-\d{2}-\d{2}(?:T[\d:.]+(?:Z|[+-]\d{2}:?\d{2})?)?$/;function re(e){let t=(e??``).toLowerCase();return/bool/.test(t)?`boolean`:/date|time/.test(t)?`date`:/int|long|double|number|decimal/.test(t)?`number`:`string`}function O(e){let t=(e??``).trim();if(t)return[...t.matchAll(/"(?:[^"\\]|\\.)*"|[^,\s][^,]*/g)].map(e=>e[0].trim())}function k(e,t){let n=e.name?.trim()||e.label?.trim()||`output ${t+1}`,r=O(e.outputValues?.text);return{name:n,...e.typeRef?{typeRef:e.typeRef}:{},...r?{values:r}:{}}}function A(e){let t=e.decisionLogic;return e.$type!==`dmn:Decision`||t?.$type!==`dmn:DecisionTable`||!e.id?null:{decisionId:e.id,name:e.name?.trim()||e.id,hitPolicy:(t.hitPolicy??`UNIQUE`).toUpperCase(),...t.aggregation?{aggregation:t.aggregation.toUpperCase()}:{},inputs:(t.input??[]).map((e,t)=>{let n=e.inputExpression?.text?.trim()??``;return{label:e.label?.trim()||n||`input ${t+1}`,expression:n,type:re(e.inputExpression?.typeRef)}}),outputs:(t.output??[]).map(k),rules:(t.rule??[]).map((e,t)=>({id:e.id??`rule-${t+1}`,inputs:(e.inputEntry??[]).map(e=>(e.text??``).trim()),outputs:(e.outputEntry??[]).map(e=>(e.text??``).trim()),...e.description?{description:e.description}:{}})).filter(e=>[...e.inputs,...e.outputs].some(e=>e!==``))}}function j(e){return((e??{}).drgElement??[]).flatMap(e=>{let t=A(e);return t?[t]:[]})}function M(e){return new Map(((e??{}).drgElement??[]).flatMap(e=>e.id?[[e.id,e]]:[]))}function N(e){let t=e?.href;return typeof t==`string`?t.replace(/^#/,``):null}function P(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function F(e,t,n){if(!D.test(t))return;let r=t.split(`.`),i=e;for(let e of r.slice(0,-1)){if(!P(i))return;e in i||(i[e]={}),i=i[e]}P(i)&&(i[r[r.length-1]]=n)}function ie(e,t){let n=e.trim();if(n!==``){if(t===`number`){let e=Number(n);return Number.isFinite(e)?e:null}return t===`boolean`?/^true$/i.test(n)?!0:!/^false$/i.test(n)&&null:t===`date`?ne.test(n)?n:null:n}}function ae(e,t){let n={},r=[],i=[];for(let a of e.inputs){if(!D.test(a.expression)){i.push(a.expression);continue}let e=v(t,a.expression);if(e===void 0)continue;let o=ie(String(e),a.type);o===null?i.push(a.expression):(n[a.expression]=o,r.push({name:a.expression,type:a.type,text:String(e)}))}return{values:n,typed:r,wrong:i}}function I(e,t){return(M(e).get(t)?.informationRequirement??[]).flatMap(e=>{let t=N(e.requiredDecision);return t?[{decision:t,input:N(e.requiredInput)}]:[]})}function oe(e,t,n){let r=new Map(t.map(e=>[e.decisionId,e])),i=/* @__PURE__ */ new Set,a=[],o=t=>{if(!i.has(t)&&r.has(t)){i.add(t);for(let n of I(e,t))o(n.decision);a.push(r.get(t))}};return o(n),a}function se(e,n){let r=e.inputs.filter(e=>D.test(e.expression)&&v(n,e.expression)===void 0).map(e=>e.expression),{values:i,typed:a,wrong:o}=ae(e,n),s=te(e,i);if(o.length>0){s.rules=[],s.matching=[],s.outputs={};let n=o.map(n=>{let r=e.inputs.find(e=>e.expression===n);return t(`app.try.shouldBe`,{name:n,wanted:D.test(n)?t(`app.try.aValueOf`,{type:r?.type??t(`app.try.value`)}):t(`app.try.aNamePenstockCanRead`)})}).join(`; `);s.why=t(`app.try.noRuleWasCompared`,{table:e.name,names:n}),s.problems=[]}let c=[...new Set(s.unreadCells)];return c.length>0&&(s.why=t(`app.try.penstockCannotEvaluateHere`,{why:s.why,cells:c.join(`, `)})),{match:s,typed:a,unreadable:c,wrong:o,needs:r}}function ce(e,t,n,r){for(let i of I(e,n)){let e=t.find(e=>e.decisionId===i.decision)?.outputs[0];e&&i.input&&F(r,i.input,v(r,e.name))}}function le(e,n,r,i){let a={...i},o=[],s=[];for(let i of oe(e,n,r)){ce(e,n,i.decisionId,a);let c=se(i,a);if(c.needs.length>0){let e=t(`app.try.needsAValueFor`,{names:c.needs.join(`, `)});if(s.push(t(`app.try.tableNeeds`,{table:i.name,skipped:e})),o.push({decisionId:i.decisionId,name:i.name,table:i,match:c.match,skipped:e,unreadable:[]}),i.decisionId===r)return{order:o,result:o[o.length-1],unreadable:[],typed:[],outputs:[],waiting:s};continue}if(i.decisionId===r){let e={decisionId:i.decisionId,name:i.name,table:i,match:c.match,skipped:null,unreadable:c.unreadable};return o.push(e),{order:o,result:e,unreadable:c.unreadable,typed:c.typed,outputs:i.outputs.map(e=>({name:e.name,value:c.match.outputs[e.name],type:e.typeRef})),waiting:s}}let l=i.outputs[0]?c.match.outputs[i.outputs[0].name]:void 0;l!==void 0&&i.outputs.length===1&&F(a,i.outputs[0].name,l),o.push({decisionId:i.decisionId,name:i.name,table:i,match:c.match,skipped:null,unreadable:c.unreadable})}return{order:o,result:null,unreadable:[],typed:[],outputs:[],waiting:s}}const L=`penstock-dmn-tests/1`,R=1e3;function z(e){return`${e.replace(/\.dmn$/i,``)}.dmn.tests.json`}function B(){return{schema:L,cases:[]}}function V(e){return typeof e==`number`?e:typeof e==`string`&&/^-?\d+(\.\d+)?$/.test(e.trim())?Number(e):null}function H(e,t){if(e===t)return!0;let n=V(e),r=V(t);if(n!==null&&r!==null)return n===r;if(Array.isArray(e)||Array.isArray(t))return Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((e,n)=>H(e,t[n]));if(typeof e==`object`&&e&&typeof t==`object`&&t){let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>Object.hasOwn(t,n)&&H(e[n],t[n]))}return!1}function U(e,t){let n=[...e].sort((e,t)=>e-t),r=[...t].sort((e,t)=>e-t);return n.length===r.length&&n.every((e,t)=>e===r[t])}function ue(e){return structuredClone(Object.fromEntries(Object.entries(e)))}function de(e,n,r){let i=/* @__PURE__ */ new Map,a=/* @__PURE__ */ new Map,o={name:r.name,decision:r.decision,status:`error`,rules:[],matching:[],actual:{},diffs:[],rulesDiff:null,why:``,message:null};if(!n.some(e=>e.decisionId===r.decision))return{result:{...o,message:t(`app.dmnTests.unknownDecision`,{decision:r.decision})},applied:i,hit:a};let s=le(e,n,r.decision,ue(r.inputs)),c=s.result;if(c===null)return{result:{...o,message:t(`app.dmnTests.notEvaluated`,{decision:r.decision})},applied:i,hit:a};if(s.waiting.length>0)return{result:{...o,why:c.match.why,message:s.waiting.join(`; `)},applied:i,hit:a};if(c.unreadable.length>0)return{result:{...o,why:c.match.why,message:t(`app.dmnTests.unreadableCells`,{cells:c.unreadable.join(`, `)})},applied:i,hit:a};if(c.match.problems.length>0)return{result:{...o,why:c.match.why,message:c.match.problems.join(` `)},applied:i,hit:a};for(let e of s.order)e.skipped===null&&(i.set(e.decisionId,e.match.rules),a.set(e.decisionId,e.match.matching));let l=c.match.outputs,u=[],d=Object.keys(r.expected);for(let e of d)H(r.expected[e],l[e])||u.push({output:e,expected:r.expected[e],...l[e]===void 0?{}:{actual:l[e]}});if(d.length===0)for(let e of Object.keys(l))u.push({output:e,actual:l[e]});let f=r.rules!==void 0&&!U(r.rules,c.match.rules)?{expected:r.rules,actual:c.match.rules}:null,p=u.length>0||f!==null,m=p?fe(u,f):null;return{result:{...o,status:p?`failed`:`passed`,rules:c.match.rules,matching:c.match.matching,actual:l,diffs:u,rulesDiff:f,why:c.match.why,message:m},applied:i,hit:a}}function fe(e,n){let r=e.map(e=>t(`app.dmnTests.outputDiffers`,{output:e.output,expected:e.expected===void 0?t(`app.dmnTests.nothing`):y(e.expected),actual:e.actual===void 0?t(`app.dmnTests.nothing`):y(e.actual)}));return n&&r.push(t(`app.dmnTests.rulesDiffer`,{expected:n.expected.join(`, `)||t(`app.dmnTests.nothing`),actual:n.actual.join(`, `)||t(`app.dmnTests.nothing`)})),r.join(`; `)}const W=e=>[...new Set(e)].sort((e,t)=>e-t);function G(e,t){let n=t.filter(e=>e.result.status!==`error`),r=e.map(e=>{let t=/* @__PURE__ */ new Set,r=/* @__PURE__ */ new Set;for(let i of n){for(let n of i.applied.get(e.decisionId)??[])t.add(n);for(let t of i.hit.get(e.decisionId)??[])r.add(t)}let i=e.rules.map((e,t)=>t+1),a=W(i.filter(e=>t.has(e)));return{decisionId:e.decisionId,name:e.name,hitPolicy:e.hitPolicy,aggregation:e.aggregation??null,rules:i.length,covered:a,notCovered:i.filter(e=>!t.has(e)),shadowed:W([...r].filter(e=>!t.has(e))),percent:i.length===0?100:Math.round(a.length/i.length*1e3)/10}}),i=r.reduce((e,t)=>e+t.rules,0),a=r.reduce((e,t)=>e+t.covered.length,0);return{coverage:r,total:{covered:a,total:i,percent:i===0?100:Math.round(a/i*1e3)/10}}}function pe(e,t){if(t)return{run:e,skipped:0};let n=/* @__PURE__ */ new Map,r=e.filter(e=>{let t=n.get(e.decision)??0;return n.set(e.decision,t+1),t<3});return{run:r,skipped:e.length-r.length}}function me(e,t,n={licensed:!0}){let r=j(e),i=pe(t.cases,n.licensed),a=n.only===void 0?null:t.cases[n.only],o=a==null?i.run:i.run.filter(e=>e===a),s=a==null?i.skipped:+(a!==void 0&&!o.includes(a)),c=o.map(t=>de(e,r,t)),{coverage:l,total:u}=G(r,c);return{results:c.map(e=>e.result),coverage:l,total:u,skipped:s}}const K={type:`object`,maxProperties:100,propertyNames:{maxLength:200},additionalProperties:{}},q={$schema:`http://json-schema.org/draft-07/schema#`,$id:`https://raw.githubusercontent.com/kern0x1b/penstock-release/main/docs/schema/penstock-dmn-tests.schema.json`,title:`Penstock DMN test cases`,description:`Saved test cases for the decision tables of a DMN file, kept next to it as <name>.dmn.tests.json. Penstock runs them on the decision table and shows which rules each case matched.`,type:`object`,additionalProperties:!1,required:[`schema`,`cases`],properties:{$schema:{type:`string`,maxLength:300,description:`The address of this schema, for editors.`},schema:{const:L,description:`The version of this format.`},cases:{type:`array`,maxItems:R,description:`One entry per test case, run in this order.`,items:{type:`object`,additionalProperties:!1,required:[`name`,`decision`,`inputs`,`expected`],properties:{name:{type:`string`,minLength:1,maxLength:200,description:`What the case shows.`},decision:{type:`string`,minLength:1,maxLength:200,description:`The id of the decision, which can be a decision table or a decision that requires others.`},inputs:{...K,description:`The values the decision starts with, by the input expression of each decision table; a name with a dot reaches into an object.`},expected:{...K,description:`The outputs the decision must give, by output name. Only the outputs listed are compared; none listed means no rule may match.`},rules:{type:`array`,maxItems:500,items:{type:`integer`,minimum:1,maximum:500},description:`Optional: the numbers of the rules that must be the ones applied, counted from 1.`}}}}}},he=/* @__PURE__ */ new Set([`__proto__`,`constructor`,`prototype`]);function J(e,t){if(!(t>8)){if(e===null||typeof e==`boolean`||typeof e==`string`)return e;if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(Array.isArray(e)){if(e.length>100)return;let n=[];for(let r of e){let e=J(r,t+1);if(e===void 0)return;n.push(e)}return n}if(typeof e==`object`){let n=Object.keys(e);if(n.length>100)return;let r=Object.create(null);for(let i of n){if(he.has(i))return;let n=J(e[i],t+1);if(n===void 0)return;r[i]=n}return r}}}function Y(e){let t=J(e,0);return t!==void 0&&typeof t==`object`&&t&&!Array.isArray(t)?t:null}function X(e){let t=a(e,2097152);if(`problem`in t)return{problems:[{at:`$`,code:t.problem}]};let n=i(q,t.value);if(n.length>0)return{problems:n};let r=[],o=t.value.cases;for(let[e,t]of o.entries()){let n=Y(t.inputs),i=Y(t.expected);if(n===null||i===null)return{problems:[{at:`cases[${e}]`,code:`deep`}]};r.push({name:t.name,decision:t.decision,inputs:n,expected:i,...Array.isArray(t.rules)?{rules:t.rules}:{}})}return{file:{schema:L,cases:r}}}function Z(e){let t={$schema:q.$id,schema:L,cases:e.cases.map(e=>({name:e.name,decision:e.decision,inputs:e.inputs,expected:e.expected,...e.rules&&e.rules.length>0?{rules:e.rules}:{}}))};return`${JSON.stringify(t,null,2)}\n`}function ge(e){let t=/* @__PURE__ */ new Set;for(let n of e)for(let e of s(n,[`decision`]))/\.dmn$/i.test(e)&&t.add(f.resolve(e));return[...t].sort()}function Q(e){let n=u(l(f.dirname(f.resolve(e)))),r=z(f.resolve(e));if(!p(r))return{file:B(),path:r,exists:!1};let i=u(r);if(!c(i,[n]))return{problem:t(`app.dmnTests.outside`,{file:f.basename(r)})};let a;try{let e=m(i);if(!e.isFile())return{problem:t(`app.dmnTests.unreadable`,{file:f.basename(r)})};if(e.size>2097152)return{problem:t(`app.dmnTests.tooLarge`,{file:f.basename(r)})};a=h(i,`utf8`)}catch{return{problem:t(`app.dmnTests.unreadable`,{file:f.basename(r)})}}let s=X(a);return`problems`in s?{problem:t(`app.dmnTests.invalid`,{file:f.basename(r),problems:o(s.problems)})}:{file:s.file,path:r,exists:!0}}function $(e,t,n){return{file:e,testsFile:n,cases:[],coverage:[],total:{covered:0,total:0,percent:100},passed:0,failed:0,errors:0,skipped:0,problem:t}}async function _e(n,r){let i=f.resolve(n),a;try{let e=g(i);if(!e.isFile()||e.size>33554432)return $(i,t(`app.dmnTests.dmnUnreadable`,{file:f.basename(i)}),null);a=h(i,`utf8`)}catch{return $(i,t(`app.dmnTests.dmnUnreadable`,{file:f.basename(i)}),null)}let o;try{o=(await e(a)).rootElement}catch(e){return $(i,e instanceof Error?e.message:String(e),null)}let s=Q(i);if(`problem`in s)return $(i,s.problem,z(i));let c=me(o,s.file,r),l=j(o),u=c.results.length===0?G(l,[]):{coverage:c.coverage,total:c.total};return{file:i,testsFile:s.exists?s.path:null,cases:c.results,coverage:u.coverage,total:u.total,passed:c.results.filter(e=>e.status===`passed`).length,failed:c.results.filter(e=>e.status===`failed`).length,errors:c.results.filter(e=>e.status===`error`).length,skipped:c.skipped,problem:null}}function ve(e,n){let r=f.resolve(e);if(!p(r))return{problem:t(`app.dmnTests.dmnUnreadable`,{file:f.basename(r)})};let i=Q(r);if(`problem`in i)return i;let a=i.file.cases.findIndex(e=>e.decision===n.decision&&e.name===n.name);if(a<0&&i.file.cases.length>=1e3)return{problem:t(`app.dmnTests.tooMany`,{max:R})};let o=a<0?[...i.file.cases,n]:i.file.cases.map((e,t)=>t===a?n:e),s=u(l(f.dirname(r)));return d([{path:i.path,content:Z({...i.file,cases:o})}],s,{replace:!0}),{path:i.path,replaced:a>=0,total:o.length}}export{L as a,X as i,_e as n,z as o,ve as r,b as s,ge as t};
|