@transcend-io/cli 11.0.0 → 12.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +229 -84
- package/dist/app-CR3U95JW.mjs +148 -0
- package/dist/app-CR3U95JW.mjs.map +1 -0
- package/dist/{approvePrivacyRequests-C165wLBa.mjs → approvePrivacyRequests-BDG82nlp.mjs} +2 -2
- package/dist/{approvePrivacyRequests-C165wLBa.mjs.map → approvePrivacyRequests-BDG82nlp.mjs.map} +1 -1
- package/dist/bin/bash-complete.mjs +1 -1
- package/dist/bin/cli.mjs +1 -1
- package/dist/bin/deprecated-command.mjs +1 -1
- package/dist/{buildExamples-DOopJFYY.mjs → buildExamples-B6BdW0FD.mjs} +2 -2
- package/dist/{buildExamples-DOopJFYY.mjs.map → buildExamples-B6BdW0FD.mjs.map} +1 -1
- package/dist/{buildXdiSyncEndpoint-DeStnIit.mjs → buildXdiSyncEndpoint-FExEagKc.mjs} +2 -2
- package/dist/{buildXdiSyncEndpoint-DeStnIit.mjs.map → buildXdiSyncEndpoint-FExEagKc.mjs.map} +1 -1
- package/dist/{bulkRestartRequests-_Mu1rwZQ.mjs → bulkRestartRequests-OKwKXc52.mjs} +2 -2
- package/dist/{bulkRestartRequests-_Mu1rwZQ.mjs.map → bulkRestartRequests-OKwKXc52.mjs.map} +1 -1
- package/dist/{bulkRetryEnrichers-C2keTKuQ.mjs → bulkRetryEnrichers-Dl-n8AFF.mjs} +2 -2
- package/dist/{bulkRetryEnrichers-C2keTKuQ.mjs.map → bulkRetryEnrichers-Dl-n8AFF.mjs.map} +1 -1
- package/dist/{cancelPrivacyRequests-DwQr18Fk.mjs → cancelPrivacyRequests-BIgX5SDz.mjs} +2 -2
- package/dist/{cancelPrivacyRequests-DwQr18Fk.mjs.map → cancelPrivacyRequests-BIgX5SDz.mjs.map} +1 -1
- package/dist/{codecs-CTxFjCg4.mjs → codecs-CfcaFoZR.mjs} +1 -1
- package/dist/{codecs-CTxFjCg4.mjs.map → codecs-CfcaFoZR.mjs.map} +1 -1
- package/dist/{collectCsvFilesOrExit-B1VOVGWN.mjs → collectCsvFilesOrExit-BindZ0dF.mjs} +1 -1
- package/dist/{collectCsvFilesOrExit-B1VOVGWN.mjs.map → collectCsvFilesOrExit-BindZ0dF.mjs.map} +1 -1
- package/dist/{collectParquetFilesOrExit-DVlv5ctt.mjs → collectParquetFilesOrExit-CbNQ9CJc.mjs} +1 -1
- package/dist/{collectParquetFilesOrExit-DVlv5ctt.mjs.map → collectParquetFilesOrExit-CbNQ9CJc.mjs.map} +1 -1
- package/dist/command-X7lkPELf.mjs +9 -0
- package/dist/command-X7lkPELf.mjs.map +1 -0
- package/dist/command-output-BJcDRXNr.mjs +2 -0
- package/dist/command-output-BJcDRXNr.mjs.map +1 -0
- package/dist/command-output-BRfF3YFv.mjs +2 -0
- package/dist/command-output-BRfF3YFv.mjs.map +1 -0
- package/dist/commands/admin/chunk-csv/worker.mjs +1 -1
- package/dist/commands/admin/parquet-to-csv/worker.mjs +1 -1
- package/dist/{consentManagersToBusinessEntities-CBJ81aGO.mjs → consentManagersToBusinessEntities-DG0_eby5.mjs} +1 -1
- package/dist/{consentManagersToBusinessEntities-CBJ81aGO.mjs.map → consentManagersToBusinessEntities-DG0_eby5.mjs.map} +1 -1
- package/dist/{constants-Upxn_rQF.mjs → constants-BRsj50Nb.mjs} +2 -2
- package/dist/{constants-Upxn_rQF.mjs.map → constants-BRsj50Nb.mjs.map} +1 -1
- package/dist/{constants-DXzsg2CQ.mjs → constants-DC_bBO09.mjs} +3 -3
- package/dist/{constants-DXzsg2CQ.mjs.map → constants-DC_bBO09.mjs.map} +1 -1
- package/dist/{constants-D_HVDaOy.mjs → constants-qvGk0wlN.mjs} +1 -1
- package/dist/{constants-D_HVDaOy.mjs.map → constants-qvGk0wlN.mjs.map} +1 -1
- package/dist/{context-B33NT3ki.mjs → context-D0A0LxsP.mjs} +1 -1
- package/dist/{context-B33NT3ki.mjs.map → context-D0A0LxsP.mjs.map} +1 -1
- package/dist/{createPoolingCommandUi-CKH-24w5.mjs → createPoolingCommandUi-CyPZ3GqN.mjs} +5 -5
- package/dist/{createPoolingCommandUi-CKH-24w5.mjs.map → createPoolingCommandUi-CyPZ3GqN.mjs.map} +1 -1
- package/dist/{dataFlowsToDataSilos-BF6fzWcm.mjs → dataFlowsToDataSilos-CRqbNjZ0.mjs} +1 -1
- package/dist/{dataFlowsToDataSilos-BF6fzWcm.mjs.map → dataFlowsToDataSilos-CRqbNjZ0.mjs.map} +1 -1
- package/dist/deno-runtime-CB2HBach.mjs +2 -0
- package/dist/deno-runtime-CB2HBach.mjs.map +1 -0
- package/dist/{done-input-validation-BUz-aVC5.mjs → done-input-validation-LiTaCEzF.mjs} +1 -1
- package/dist/{done-input-validation-BUz-aVC5.mjs.map → done-input-validation-LiTaCEzF.mjs.map} +1 -1
- package/dist/{downloadPrivacyRequestFiles-D3bzcegH.mjs → downloadPrivacyRequestFiles-EBySRnvd.mjs} +2 -2
- package/dist/{downloadPrivacyRequestFiles-D3bzcegH.mjs.map → downloadPrivacyRequestFiles-EBySRnvd.mjs.map} +1 -1
- package/dist/{extractClientError-HZ2U7yqV.mjs → extractClientError-DUJxHv07.mjs} +1 -1
- package/dist/{extractClientError-HZ2U7yqV.mjs.map → extractClientError-DUJxHv07.mjs.map} +1 -1
- package/dist/{fetchAllRequests-2TZr-LfT.mjs → fetchAllRequests-BI0tFl_a.mjs} +2 -2
- package/dist/{fetchAllRequests-2TZr-LfT.mjs.map → fetchAllRequests-BI0tFl_a.mjs.map} +1 -1
- package/dist/{formatPolicyBundleVersionSummary-CJmMCLtJ.mjs → formatPolicyBundleVersionSummary-DCHl1Vhy.mjs} +1 -1
- package/dist/{formatPolicyBundleVersionSummary-CJmMCLtJ.mjs.map → formatPolicyBundleVersionSummary-DCHl1Vhy.mjs.map} +1 -1
- package/dist/{fuzzyMatchColumns-CQCzpjWC.mjs → fuzzyMatchColumns-2NmQqCZI.mjs} +2 -2
- package/dist/{fuzzyMatchColumns-CQCzpjWC.mjs.map → fuzzyMatchColumns-2NmQqCZI.mjs.map} +1 -1
- package/dist/{generateCrossAccountApiKeys-DWfJtB3t.mjs → generateCrossAccountApiKeys-pWTrIUE6.mjs} +2 -2
- package/dist/{generateCrossAccountApiKeys-DWfJtB3t.mjs.map → generateCrossAccountApiKeys-pWTrIUE6.mjs.map} +1 -1
- package/dist/impl-0-_oxvck.mjs +2 -0
- package/dist/impl-0-_oxvck.mjs.map +1 -0
- package/dist/{impl-ByFyaZkK.mjs → impl-1SsreZWo.mjs} +2 -2
- package/dist/{impl-ByFyaZkK.mjs.map → impl-1SsreZWo.mjs.map} +1 -1
- package/dist/{impl-D4Ne3Vbg.mjs → impl-7rdGuHOC.mjs} +2 -2
- package/dist/{impl-D4Ne3Vbg.mjs.map → impl-7rdGuHOC.mjs.map} +1 -1
- package/dist/{impl-DRpK-QLC.mjs → impl-ApZGIx6l.mjs} +2 -2
- package/dist/{impl-DRpK-QLC.mjs.map → impl-ApZGIx6l.mjs.map} +1 -1
- package/dist/{impl-DVeGQCrr.mjs → impl-Ay6JeH-7.mjs} +2 -2
- package/dist/{impl-DVeGQCrr.mjs.map → impl-Ay6JeH-7.mjs.map} +1 -1
- package/dist/{impl-C2sSZ8qF.mjs → impl-B2ZXtnpX.mjs} +2 -2
- package/dist/{impl-C2sSZ8qF.mjs.map → impl-B2ZXtnpX.mjs.map} +1 -1
- package/dist/impl-B440iuvL.mjs +3 -0
- package/dist/impl-B440iuvL.mjs.map +1 -0
- package/dist/{impl-BhfxcCgN2.mjs → impl-B7l4bLG5.mjs} +2 -2
- package/dist/impl-B7l4bLG5.mjs.map +1 -0
- package/dist/{impl-BPoEH3Nf2.mjs → impl-B94dMG4x2.mjs} +2 -2
- package/dist/{impl-BPoEH3Nf2.mjs.map → impl-B94dMG4x2.mjs.map} +1 -1
- package/dist/{impl-DXowiNOz.mjs → impl-BH1fCPDh.mjs} +2 -2
- package/dist/{impl-DXowiNOz.mjs.map → impl-BH1fCPDh.mjs.map} +1 -1
- package/dist/{impl-CfvxD3RI.mjs → impl-BLOhoP-b2.mjs} +2 -2
- package/dist/impl-BLOhoP-b2.mjs.map +1 -0
- package/dist/{impl-CHUxKOz_.mjs → impl-BLQDgwxL.mjs} +2 -2
- package/dist/{impl-CHUxKOz_.mjs.map → impl-BLQDgwxL.mjs.map} +1 -1
- package/dist/{impl-Dqqb0lVN.mjs → impl-BWPPVXG3.mjs} +3 -3
- package/dist/{impl-Dqqb0lVN.mjs.map → impl-BWPPVXG3.mjs.map} +1 -1
- package/dist/{impl-Cw0L2xEU.mjs → impl-BdTxFv63.mjs} +2 -2
- package/dist/{impl-Cw0L2xEU.mjs.map → impl-BdTxFv63.mjs.map} +1 -1
- package/dist/impl-BpVe6fMe.mjs +3 -0
- package/dist/{impl--JGnR3wp.mjs.map → impl-BpVe6fMe.mjs.map} +1 -1
- package/dist/impl-BqTMPbwc2.mjs +2 -0
- package/dist/impl-BqTMPbwc2.mjs.map +1 -0
- package/dist/impl-CAoIp9Nl2.mjs +3 -0
- package/dist/impl-CAoIp9Nl2.mjs.map +1 -0
- package/dist/{impl-C_62Z4ED.mjs → impl-CU38kdj8.mjs} +2 -2
- package/dist/{impl-C_62Z4ED.mjs.map → impl-CU38kdj8.mjs.map} +1 -1
- package/dist/{impl-BppXJ1AD2.mjs → impl-CWP6AXSb.mjs} +2 -2
- package/dist/impl-CWP6AXSb.mjs.map +1 -0
- package/dist/impl-CY8C-Fvj2.mjs +2 -0
- package/dist/impl-CY8C-Fvj2.mjs.map +1 -0
- package/dist/{impl-BJyzyrZD.mjs → impl-C_Ifcb00.mjs} +2 -2
- package/dist/{impl-BJyzyrZD.mjs.map → impl-C_Ifcb00.mjs.map} +1 -1
- package/dist/{impl-CPSEzCc9.mjs → impl-Cb42aI60.mjs} +2 -2
- package/dist/{impl-CPSEzCc9.mjs.map → impl-Cb42aI60.mjs.map} +1 -1
- package/dist/impl-Cee7Q1Ne.mjs +2 -0
- package/dist/impl-Cee7Q1Ne.mjs.map +1 -0
- package/dist/impl-CieztjdM.mjs +2 -0
- package/dist/impl-CieztjdM.mjs.map +1 -0
- package/dist/{impl-DqhZR11m.mjs → impl-ClqrQo1M.mjs} +2 -2
- package/dist/{impl-DqhZR11m.mjs.map → impl-ClqrQo1M.mjs.map} +1 -1
- package/dist/impl-CnHfn7rr.mjs +5 -0
- package/dist/{impl-DPtx5iZO.mjs.map → impl-CnHfn7rr.mjs.map} +1 -1
- package/dist/{impl-BpMQYnbR.mjs → impl-CrdqsTUy.mjs} +2 -2
- package/dist/{impl-BpMQYnbR.mjs.map → impl-CrdqsTUy.mjs.map} +1 -1
- package/dist/{impl-DzUTmaID2.mjs → impl-CsaT3aM2.mjs} +2 -2
- package/dist/impl-CsaT3aM2.mjs.map +1 -0
- package/dist/{impl-BEA5cQOT2.mjs → impl-CspH2ZWx.mjs} +2 -2
- package/dist/impl-CspH2ZWx.mjs.map +1 -0
- package/dist/{impl-lsmXIGSo2.mjs → impl-CudSYx-g.mjs} +2 -2
- package/dist/impl-CudSYx-g.mjs.map +1 -0
- package/dist/{impl-DXQHLpMw.mjs → impl-Cxprr2hw.mjs} +2 -2
- package/dist/{impl-DXQHLpMw.mjs.map → impl-Cxprr2hw.mjs.map} +1 -1
- package/dist/{impl-gs5wJ1BK.mjs → impl-D-a5xGld.mjs} +2 -2
- package/dist/{impl-gs5wJ1BK.mjs.map → impl-D-a5xGld.mjs.map} +1 -1
- package/dist/{impl-D94m3EPp.mjs → impl-D1UogVAq.mjs} +2 -2
- package/dist/{impl-D94m3EPp.mjs.map → impl-D1UogVAq.mjs.map} +1 -1
- package/dist/{impl-B5df-igZ.mjs → impl-D1f9mJL_.mjs} +2 -2
- package/dist/{impl-B5df-igZ.mjs.map → impl-D1f9mJL_.mjs.map} +1 -1
- package/dist/{impl-CSk_okwj.mjs → impl-DJcNhpbx.mjs} +2 -2
- package/dist/{impl-CSk_okwj.mjs.map → impl-DJcNhpbx.mjs.map} +1 -1
- package/dist/impl-DQG1pMzD2.mjs +2 -0
- package/dist/impl-DQG1pMzD2.mjs.map +1 -0
- package/dist/impl-DQcgEx7V2.mjs +298 -0
- package/dist/impl-DQcgEx7V2.mjs.map +1 -0
- package/dist/impl-DRKPx_I9.mjs +2 -0
- package/dist/impl-DRKPx_I9.mjs.map +1 -0
- package/dist/{impl-DhxDp4GN.mjs → impl-DTadLabu.mjs} +2 -2
- package/dist/{impl-DhxDp4GN.mjs.map → impl-DTadLabu.mjs.map} +1 -1
- package/dist/{impl-CD2R3L0v.mjs → impl-DXbxO2VJ.mjs} +2 -2
- package/dist/{impl-CD2R3L0v.mjs.map → impl-DXbxO2VJ.mjs.map} +1 -1
- package/dist/{impl-nz1MyjX22.mjs → impl-DcL-8NEa2.mjs} +2 -2
- package/dist/{impl-nz1MyjX22.mjs.map → impl-DcL-8NEa2.mjs.map} +1 -1
- package/dist/{impl-DKepRc812.mjs → impl-DeCRXfAh2.mjs} +2 -2
- package/dist/{impl-DKepRc812.mjs.map → impl-DeCRXfAh2.mjs.map} +1 -1
- package/dist/impl-DezV3QMo.mjs +3 -0
- package/dist/impl-DezV3QMo.mjs.map +1 -0
- package/dist/{impl-COujMWgp.mjs → impl-Dg7XSQdO2.mjs} +2 -2
- package/dist/impl-Dg7XSQdO2.mjs.map +1 -0
- package/dist/{impl-a_Y8bnSn.mjs → impl-DhXzxQDN2.mjs} +5 -5
- package/dist/impl-DhXzxQDN2.mjs.map +1 -0
- package/dist/impl-DiwxYcux.mjs +2 -0
- package/dist/{impl-GytUVAMP.mjs.map → impl-DiwxYcux.mjs.map} +1 -1
- package/dist/{impl-C9OmNI49.mjs → impl-Do2TNA3-.mjs} +2 -2
- package/dist/{impl-C9OmNI49.mjs.map → impl-Do2TNA3-.mjs.map} +1 -1
- package/dist/{impl-DaH1_ZzK.mjs → impl-DqHEIzpj.mjs} +2 -2
- package/dist/{impl-DaH1_ZzK.mjs.map → impl-DqHEIzpj.mjs.map} +1 -1
- package/dist/{impl-CzdUHruN.mjs → impl-Dr_l_SLd.mjs} +2 -2
- package/dist/{impl-CzdUHruN.mjs.map → impl-Dr_l_SLd.mjs.map} +1 -1
- package/dist/{impl-CTwyYUw3.mjs → impl-Ds-gQfdc.mjs} +2 -2
- package/dist/{impl-CTwyYUw3.mjs.map → impl-Ds-gQfdc.mjs.map} +1 -1
- package/dist/{impl-C8jjYvgu.mjs → impl-DtnYcktN.mjs} +2 -2
- package/dist/{impl-C8jjYvgu.mjs.map → impl-DtnYcktN.mjs.map} +1 -1
- package/dist/impl-DtpgD_as.mjs +2 -0
- package/dist/{impl-DQPmSYSE.mjs.map → impl-DtpgD_as.mjs.map} +1 -1
- package/dist/{impl-D2Q4nxUO.mjs → impl-DxQ9yj3H.mjs} +2 -2
- package/dist/{impl-D2Q4nxUO.mjs.map → impl-DxQ9yj3H.mjs.map} +1 -1
- package/dist/impl-FerHBNJx2.mjs +4 -0
- package/dist/{impl-D-AHlqlD2.mjs.map → impl-FerHBNJx2.mjs.map} +1 -1
- package/dist/{impl-CiBT9-GH2.mjs → impl-HUfaARep.mjs} +2 -2
- package/dist/impl-HUfaARep.mjs.map +1 -0
- package/dist/impl-btKJ1-VJ.mjs +3 -0
- package/dist/impl-btKJ1-VJ.mjs.map +1 -0
- package/dist/impl-eeS2lVi5.mjs +2 -0
- package/dist/impl-eeS2lVi5.mjs.map +1 -0
- package/dist/impl-iD6Fknfe.mjs +2 -0
- package/dist/impl-iD6Fknfe.mjs.map +1 -0
- package/dist/impl-ijoNwhGI.mjs +2 -0
- package/dist/impl-ijoNwhGI.mjs.map +1 -0
- package/dist/{impl-zRAjMVgz.mjs → impl-vmLq6HCI.mjs} +2 -2
- package/dist/{impl-zRAjMVgz.mjs.map → impl-vmLq6HCI.mjs.map} +1 -1
- package/dist/{impl-a0BFtbna.mjs → impl-wBcVYHlA.mjs} +2 -2
- package/dist/{impl-a0BFtbna.mjs.map → impl-wBcVYHlA.mjs.map} +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/{initializeCliRuntime-6wI_VIHV.mjs → initializeCliRuntime-BaATMO1X.mjs} +1 -1
- package/dist/{initializeCliRuntime-6wI_VIHV.mjs.map → initializeCliRuntime-BaATMO1X.mjs.map} +1 -1
- package/dist/{inquirer-BeaBetMO.mjs → inquirer-BU5IpgA8.mjs} +2 -2
- package/dist/{inquirer-BeaBetMO.mjs.map → inquirer-BU5IpgA8.mjs.map} +1 -1
- package/dist/{jsonc-D9dDWb1J.mjs → jsonc-CdTubr53.mjs} +1 -1
- package/dist/{jsonc-D9dDWb1J.mjs.map → jsonc-CdTubr53.mjs.map} +1 -1
- package/dist/{listFiles-BdFUbX5x.mjs → listFiles-DDGCBdtx.mjs} +1 -1
- package/dist/{listFiles-BdFUbX5x.mjs.map → listFiles-DDGCBdtx.mjs.map} +1 -1
- package/dist/logger-CPu6zbyQ.mjs +2 -0
- package/dist/logger-CPu6zbyQ.mjs.map +1 -0
- package/dist/{mapConsentCsvRowsToInputs-Dqb6WL4r.mjs → mapConsentCsvRowsToInputs-CkLfxaIf.mjs} +1 -1
- package/dist/{mapConsentCsvRowsToInputs-Dqb6WL4r.mjs.map → mapConsentCsvRowsToInputs-CkLfxaIf.mjs.map} +1 -1
- package/dist/{markRequestDataSiloIdsCompleted-Br5gIS3S.mjs → markRequestDataSiloIdsCompleted-BYNMCkhy.mjs} +2 -2
- package/dist/{markRequestDataSiloIdsCompleted-Br5gIS3S.mjs.map → markRequestDataSiloIdsCompleted-BYNMCkhy.mjs.map} +1 -1
- package/dist/{markSilentPrivacyRequests-Cs_iZNJs.mjs → markSilentPrivacyRequests-gKYivzH1.mjs} +2 -2
- package/dist/{markSilentPrivacyRequests-Cs_iZNJs.mjs.map → markSilentPrivacyRequests-gKYivzH1.mjs.map} +1 -1
- package/dist/{mergeTranscendInputs-DFQcbh8b.mjs → mergeTranscendInputs-D1CvxQu0.mjs} +2 -2
- package/dist/{mergeTranscendInputs-DFQcbh8b.mjs.map → mergeTranscendInputs-D1CvxQu0.mjs.map} +1 -1
- package/dist/missing-manifest-D8y1VL4p.mjs +2 -0
- package/dist/missing-manifest-D8y1VL4p.mjs.map +1 -0
- package/dist/{module-graph-Cb0g74Ft.mjs → module-graph-CAT8_JCG.mjs} +1 -1
- package/dist/{module-graph-Cb0g74Ft.mjs.map → module-graph-CAT8_JCG.mjs.map} +1 -1
- package/dist/{notifyPrivacyRequestsAdditionalTime-kPXTdjgT.mjs → notifyPrivacyRequestsAdditionalTime-DbERhQ1Q.mjs} +2 -2
- package/dist/{notifyPrivacyRequestsAdditionalTime-kPXTdjgT.mjs.map → notifyPrivacyRequestsAdditionalTime-DbERhQ1Q.mjs.map} +1 -1
- package/dist/{parquetToCsvOneFile-ChmPC6dL.mjs → parquetToCsvOneFile-DtbCFm08.mjs} +3 -3
- package/dist/{parquetToCsvOneFile-ChmPC6dL.mjs.map → parquetToCsvOneFile-DtbCFm08.mjs.map} +1 -1
- package/dist/{parseAttributesFromString-CO16oAlx.mjs → parseAttributesFromString-C5hJMRvt.mjs} +2 -2
- package/dist/{parseAttributesFromString-CO16oAlx.mjs.map → parseAttributesFromString-C5hJMRvt.mjs.map} +1 -1
- package/dist/{parseVariablesFromString-BOSfQ4QF.mjs → parseVariablesFromString-6TYW65LF.mjs} +1 -1
- package/dist/{parseVariablesFromString-BOSfQ4QF.mjs.map → parseVariablesFromString-6TYW65LF.mjs.map} +1 -1
- package/dist/paths-J5KScOaQ.mjs +2 -0
- package/dist/paths-J5KScOaQ.mjs.map +1 -0
- package/dist/policy-bundle-manifest-BZnBMZQq.mjs +7 -0
- package/dist/policy-bundle-manifest-BZnBMZQq.mjs.map +1 -0
- package/dist/policy-project-discovery-C29UxWwt.mjs +427 -0
- package/dist/policy-project-discovery-C29UxWwt.mjs.map +1 -0
- package/dist/{policy-runtime-BMKa-Upy.mjs → policy-runtime-6jmkXlBk.mjs} +2 -2
- package/dist/{policy-runtime-BMKa-Upy.mjs.map → policy-runtime-6jmkXlBk.mjs.map} +1 -1
- package/dist/policy-scaffold-config-BUKAyPad.mjs +76 -0
- package/dist/policy-scaffold-config-BUKAyPad.mjs.map +1 -0
- package/dist/{policyEngineCliError-DY8V-qkK.mjs → policyEngineCliError-CZrOHhLv.mjs} +1 -1
- package/dist/{policyEngineCliError-DY8V-qkK.mjs.map → policyEngineCliError-CZrOHhLv.mjs.map} +1 -1
- package/dist/{printResult-CHe3nRN4.mjs → printResult-C2K9ODeE.mjs} +3 -3
- package/dist/printResult-C2K9ODeE.mjs.map +1 -0
- package/dist/project-discovery-BkHpTXDx.mjs +2 -0
- package/dist/project-discovery-BkHpTXDx.mjs.map +1 -0
- package/dist/project-discovery-CWRjlFnC.mjs +2 -0
- package/dist/project-discovery-CWRjlFnC.mjs.map +1 -0
- package/dist/project-plan-apply-Bg_1eMX9.mjs +3 -0
- package/dist/{project-plan-apply-Dvndx455.mjs.map → project-plan-apply-Bg_1eMX9.mjs.map} +1 -1
- package/dist/project-plan-output-BHHlkLxe.mjs +4 -0
- package/dist/project-plan-output-BHHlkLxe.mjs.map +1 -0
- package/dist/prompts-BhXfYD6g.mjs +2 -0
- package/dist/prompts-BhXfYD6g.mjs.map +1 -0
- package/dist/{pullAllDatapoints-uk5ggk6O.mjs → pullAllDatapoints-Bm-Orhse.mjs} +2 -2
- package/dist/{pullAllDatapoints-uk5ggk6O.mjs.map → pullAllDatapoints-Bm-Orhse.mjs.map} +1 -1
- package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-DbFFXAVM.mjs → pullChunkedCustomSiloOutstandingIdentifiers-DTGQOw--.mjs} +2 -2
- package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-DbFFXAVM.mjs.map → pullChunkedCustomSiloOutstandingIdentifiers-DTGQOw--.mjs.map} +1 -1
- package/dist/{pullConsentManagerMetrics-Dv5n1ZGp.mjs → pullConsentManagerMetrics-DKCkfbCB.mjs} +2 -2
- package/dist/{pullConsentManagerMetrics-Dv5n1ZGp.mjs.map → pullConsentManagerMetrics-DKCkfbCB.mjs.map} +1 -1
- package/dist/{pullManualEnrichmentIdentifiersToCsv-D5is0Nrs.mjs → pullManualEnrichmentIdentifiersToCsv-DMC5CQtE.mjs} +2 -2
- package/dist/{pullManualEnrichmentIdentifiersToCsv-D5is0Nrs.mjs.map → pullManualEnrichmentIdentifiersToCsv-DMC5CQtE.mjs.map} +1 -1
- package/dist/{pullTranscendConfiguration-B63M3ild.mjs → pullTranscendConfiguration-CDUDqxpm.mjs} +2 -2
- package/dist/{pullTranscendConfiguration-B63M3ild.mjs.map → pullTranscendConfiguration-CDUDqxpm.mjs.map} +1 -1
- package/dist/{pullUnstructuredSubDataPointRecommendations-YTBzfkRZ.mjs → pullUnstructuredSubDataPointRecommendations-Ci4AOxyH.mjs} +2 -2
- package/dist/{pullUnstructuredSubDataPointRecommendations-YTBzfkRZ.mjs.map → pullUnstructuredSubDataPointRecommendations-Ci4AOxyH.mjs.map} +1 -1
- package/dist/{pushCronIdentifiersFromCsv-Ctq38wAY.mjs → pushCronIdentifiersFromCsv-DhS2z8IG.mjs} +2 -2
- package/dist/{pushCronIdentifiersFromCsv-Ctq38wAY.mjs.map → pushCronIdentifiersFromCsv-DhS2z8IG.mjs.map} +1 -1
- package/dist/{pushManualEnrichmentIdentifiersFromCsv-0WHf6d_m.mjs → pushManualEnrichmentIdentifiersFromCsv-BTJGOmdU.mjs} +2 -2
- package/dist/{pushManualEnrichmentIdentifiersFromCsv-0WHf6d_m.mjs.map → pushManualEnrichmentIdentifiersFromCsv-BTJGOmdU.mjs.map} +1 -1
- package/dist/{readCsv-DLg8pwjd.mjs → readCsv-DNcJ_UfU.mjs} +1 -1
- package/dist/{readCsv-DLg8pwjd.mjs.map → readCsv-DNcJ_UfU.mjs.map} +1 -1
- package/dist/{readTranscendYaml-BNn6-Ofi.mjs → readTranscendYaml-BfqQbPiT.mjs} +3 -3
- package/dist/{readTranscendYaml-BNn6-Ofi.mjs.map → readTranscendYaml-BfqQbPiT.mjs.map} +1 -1
- package/dist/{removeUnverifiedRequestIdentifiers-Do3Pus6m.mjs → removeUnverifiedRequestIdentifiers-BkAcUZZN.mjs} +2 -2
- package/dist/{removeUnverifiedRequestIdentifiers-Do3Pus6m.mjs.map → removeUnverifiedRequestIdentifiers-BkAcUZZN.mjs.map} +1 -1
- package/dist/{renderTable-D68QasPc.mjs → renderTable-CZP2roD1.mjs} +1 -1
- package/dist/{renderTable-D68QasPc.mjs.map → renderTable-CZP2roD1.mjs.map} +1 -1
- package/dist/{request-BiPv6jmP.mjs → request-BpKyN9Xm.mjs} +1 -1
- package/dist/{request-BiPv6jmP.mjs.map → request-BpKyN9Xm.mjs.map} +1 -1
- package/dist/{resolveBundleIdByName-qXZBrUz_.mjs → resolveBundleIdByName-Dm_o5_bg.mjs} +2 -2
- package/dist/{resolveBundleIdByName-qXZBrUz_.mjs.map → resolveBundleIdByName-Dm_o5_bg.mjs.map} +1 -1
- package/dist/{resolvePolicyBundleVersion-BG7XqBBP.mjs → resolvePolicyBundleVersion-DRUwe7fA.mjs} +2 -2
- package/dist/{resolvePolicyBundleVersion-BG7XqBBP.mjs.map → resolvePolicyBundleVersion-DRUwe7fA.mjs.map} +1 -1
- package/dist/{retryRequestDataSilos-CEgUW6Fx.mjs → retryRequestDataSilos-BoPmcB8-.mjs} +2 -2
- package/dist/{retryRequestDataSilos-CEgUW6Fx.mjs.map → retryRequestDataSilos-BoPmcB8-.mjs.map} +1 -1
- package/dist/{run-captured-process-BXwWXuTh.mjs → run-captured-process-BjaSDWXG.mjs} +1 -1
- package/dist/{run-captured-process-BXwWXuTh.mjs.map → run-captured-process-BjaSDWXG.mjs.map} +1 -1
- package/dist/{runOpa-CswzJxIs.mjs → runOpa-ojIqU1tO.mjs} +2 -2
- package/dist/{runOpa-CswzJxIs.mjs.map → runOpa-ojIqU1tO.mjs.map} +1 -1
- package/dist/{scaffold-model-BAbYTR0q.mjs → scaffold-model-CUZER0BC.mjs} +1 -1
- package/dist/scaffold-model-CUZER0BC.mjs.map +1 -0
- package/dist/{scaffold-planning-CNv83t_v.mjs → scaffold-planning-CaetLfv8.mjs} +9 -9
- package/dist/{scaffold-planning-CNv83t_v.mjs.map → scaffold-planning-CaetLfv8.mjs.map} +1 -1
- package/dist/{scaffold-templates-DzDGTZie.mjs → scaffold-templates-CUL82Zf8.mjs} +1 -1
- package/dist/{scaffold-templates-DzDGTZie.mjs.map → scaffold-templates-CUL82Zf8.mjs.map} +1 -1
- package/dist/{skipPreflightJobs-D_1mZ9mr.mjs → skipPreflightJobs-DkBdYw-r.mjs} +2 -2
- package/dist/{skipPreflightJobs-D_1mZ9mr.mjs.map → skipPreflightJobs-DkBdYw-r.mjs.map} +1 -1
- package/dist/{skipRequestDataSilos-CcGl9Z8M.mjs → skipRequestDataSilos-BRFiokix.mjs} +2 -2
- package/dist/{skipRequestDataSilos-CcGl9Z8M.mjs.map → skipRequestDataSilos-BRFiokix.mjs.map} +1 -1
- package/dist/{streamPrivacyRequestsToCsv-1l8RAcnK.mjs → streamPrivacyRequestsToCsv-Bt-H5J-y.mjs} +2 -2
- package/dist/{streamPrivacyRequestsToCsv-1l8RAcnK.mjs.map → streamPrivacyRequestsToCsv-Bt-H5J-y.mjs.map} +1 -1
- package/dist/{syncCodePackages-BHE2Tn1Q.mjs → syncCodePackages-CPkEukDm.mjs} +2 -2
- package/dist/{syncCodePackages-BHE2Tn1Q.mjs.map → syncCodePackages-CPkEukDm.mjs.map} +1 -1
- package/dist/{updateConsentManagerVersionToLatest-yZhBDcv8.mjs → updateConsentManagerVersionToLatest-DWblAwus.mjs} +2 -2
- package/dist/{updateConsentManagerVersionToLatest-yZhBDcv8.mjs.map → updateConsentManagerVersionToLatest-DWblAwus.mjs.map} +1 -1
- package/dist/{uploadConsents-DQqApEaH.mjs → uploadConsents-D7Vg8ZRW.mjs} +2 -2
- package/dist/{uploadConsents-DQqApEaH.mjs.map → uploadConsents-D7Vg8ZRW.mjs.map} +1 -1
- package/dist/{uploadPrivacyRequestsFromCsv-ntuK0eSR.mjs → uploadPrivacyRequestsFromCsv-B_hQwIn6.mjs} +2 -2
- package/dist/{uploadPrivacyRequestsFromCsv-ntuK0eSR.mjs.map → uploadPrivacyRequestsFromCsv-B_hQwIn6.mjs.map} +1 -1
- package/dist/validateTranscendAuth-D-dDINof.mjs +2 -0
- package/dist/{validateTranscendAuth-D6Wr1cxY.mjs.map → validateTranscendAuth-D-dDINof.mjs.map} +1 -1
- package/dist/{writeCsv-D-2siSwE.mjs → writeCsv-CNZrq3zU.mjs} +1 -1
- package/dist/{writeCsv-D-2siSwE.mjs.map → writeCsv-CNZrq3zU.mjs.map} +1 -1
- package/package.json +6 -5
- package/dist/app-DhG-JhT3.mjs +0 -148
- package/dist/app-DhG-JhT3.mjs.map +0 -1
- package/dist/command-Ds6oNo0v.mjs +0 -9
- package/dist/command-Ds6oNo0v.mjs.map +0 -1
- package/dist/deno-runtime-DV52X8-P.mjs +0 -2
- package/dist/deno-runtime-DV52X8-P.mjs.map +0 -1
- package/dist/impl--JGnR3wp.mjs +0 -3
- package/dist/impl-7UqkSO3x2.mjs +0 -2
- package/dist/impl-7UqkSO3x2.mjs.map +0 -1
- package/dist/impl-B4BgGuF_.mjs +0 -3
- package/dist/impl-B4BgGuF_.mjs.map +0 -1
- package/dist/impl-B5oVsX-F2.mjs +0 -303
- package/dist/impl-B5oVsX-F2.mjs.map +0 -1
- package/dist/impl-BEA5cQOT2.mjs.map +0 -1
- package/dist/impl-BhfxcCgN2.mjs.map +0 -1
- package/dist/impl-BppXJ1AD2.mjs.map +0 -1
- package/dist/impl-C6HtWd1t.mjs +0 -2
- package/dist/impl-C6HtWd1t.mjs.map +0 -1
- package/dist/impl-CO4ZqlLV.mjs +0 -3
- package/dist/impl-CO4ZqlLV.mjs.map +0 -1
- package/dist/impl-COujMWgp.mjs.map +0 -1
- package/dist/impl-CUOVJsRg.mjs +0 -3
- package/dist/impl-CUOVJsRg.mjs.map +0 -1
- package/dist/impl-CUiYbk6G.mjs +0 -3
- package/dist/impl-CUiYbk6G.mjs.map +0 -1
- package/dist/impl-CfvxD3RI.mjs.map +0 -1
- package/dist/impl-CiBT9-GH2.mjs.map +0 -1
- package/dist/impl-Cli2XRp02.mjs +0 -2
- package/dist/impl-Cli2XRp02.mjs.map +0 -1
- package/dist/impl-D-AHlqlD2.mjs +0 -4
- package/dist/impl-DPN1En7L.mjs +0 -2
- package/dist/impl-DPN1En7L.mjs.map +0 -1
- package/dist/impl-DPtx5iZO.mjs +0 -5
- package/dist/impl-DQPmSYSE.mjs +0 -2
- package/dist/impl-DXRDWiB1.mjs +0 -2
- package/dist/impl-DXRDWiB1.mjs.map +0 -1
- package/dist/impl-DdIa0zla.mjs +0 -2
- package/dist/impl-DdIa0zla.mjs.map +0 -1
- package/dist/impl-Dp4bZvAV.mjs +0 -2
- package/dist/impl-Dp4bZvAV.mjs.map +0 -1
- package/dist/impl-DryC3OJu.mjs +0 -2
- package/dist/impl-DryC3OJu.mjs.map +0 -1
- package/dist/impl-DzUTmaID2.mjs.map +0 -1
- package/dist/impl-GytUVAMP.mjs +0 -2
- package/dist/impl-Z8oWVENM.mjs +0 -2
- package/dist/impl-Z8oWVENM.mjs.map +0 -1
- package/dist/impl-a_Y8bnSn.mjs.map +0 -1
- package/dist/impl-lsmXIGSo2.mjs.map +0 -1
- package/dist/logger-zplFSeXU.mjs +0 -2
- package/dist/logger-zplFSeXU.mjs.map +0 -1
- package/dist/manifest-BNIpO_zW.mjs +0 -2
- package/dist/manifest-BNIpO_zW.mjs.map +0 -1
- package/dist/missing-manifest-DgcukXfg.mjs +0 -2
- package/dist/missing-manifest-DgcukXfg.mjs.map +0 -1
- package/dist/path-safety-D5Qwl40b.mjs +0 -2
- package/dist/path-safety-D5Qwl40b.mjs.map +0 -1
- package/dist/policy-bundle-manifest-D6dkbjNi.mjs +0 -7
- package/dist/policy-bundle-manifest-D6dkbjNi.mjs.map +0 -1
- package/dist/printResult-CHe3nRN4.mjs.map +0 -1
- package/dist/project-plan-apply-Dvndx455.mjs +0 -3
- package/dist/prompts-ClBXdELk.mjs +0 -4
- package/dist/prompts-ClBXdELk.mjs.map +0 -1
- package/dist/scaffold-model-BAbYTR0q.mjs.map +0 -1
- package/dist/validateTranscendAuth-D6Wr1cxY.mjs +0 -2
package/dist/impl--JGnR3wp.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./readTranscendYaml-BNn6-Ofi.mjs";import{t}from"./parseVariablesFromString-BOSfQ4QF.mjs";import{t as n}from"./done-input-validation-BUz-aVC5.mjs";import{n as r,t as i}from"./prompts-ClBXdELk.mjs";import{t as a}from"./missing-manifest-DgcukXfg.mjs";import{c as o,i as s,r as c,t as l}from"./deno-runtime-DV52X8-P.mjs";import{n as u,t as d}from"./path-safety-D5Qwl40b.mjs";import{n as f,r as p,s as m}from"./manifest-BNIpO_zW.mjs";import{t as h}from"./run-captured-process-BXwWXuTh.mjs";import{t as g}from"./module-graph-Cb0g74Ft.mjs";import{t as _}from"./project-plan-apply-Dvndx455.mjs";import{dirname as v,extname as y,join as b,relative as x,resolve as S,sep as C}from"node:path";import w from"colors";import{createTwoFilesPatch as T}from"diff";import{DSR_DATAPOINT_CUSTOM_FUNCTION_PAYLOAD_SCHEMA as E,DSR_REQUEST_ENRICHER_CUSTOM_FUNCTION_PAYLOAD_SCHEMA as D,GENERAL_CUSTOM_FUNCTION_PAYLOAD_SCHEMA as O}from"@transcend-io/custom-function-types";import k from"ajv";import{parse as A}from"jsonc-parser";function j(e,t){e.push({severity:`error`,...t})}function M(e,t){return x(e,t).split(C).join(`/`)||`.`}function N(e){let t=t=>e.type===`DSR`?t===`REQUEST_ENRICHER`?`dsr-enricher`:`dsr-datapoint`:`general`;return e[`test-payload`]?[{entry:e,path:e[`test-payload`],type:t(e[`test-payload-type`])}]:(e[`test-payloads`]??[]).map(n=>({entry:e,path:n.payload,type:t(n[`payload-type`])}))}function P(e,t){let n=N(e).map(({type:e})=>e),r=e.type===`DSR`&&n.length===0;return{entry:e,path:S(t,e.code),needsDefault:e.type!==`DSR`||n.includes(`dsr-datapoint`),needsEnricher:n.includes(`dsr-enricher`),needsAnyDsrExport:r}}function F(){let e=new k({allErrors:!0,strict:!1});return{general:e.compile(O),"dsr-datapoint":e.compile(E),"dsr-enricher":e.compile(D)}}function I(e){return`${e.instancePath||`/`} ${e.message??`is invalid`}`}function L(e,t,n,r){let i=F(),a=[],o=[];return n.forEach(n=>{if(/<<parameters\.[^>]+>>/u.test(n.code))j(r,{code:`manifest.unresolved-code-path`,message:`Code paths cannot contain unresolved parameter placeholders.`,path:n.code,functionName:n.name});else if(f(n.code)){let i=P(n,t);e.fs.existsSync(i.path)?u(e,t,i.path)?e.fs.statSync(i.path).isFile()?a.push(i):j(r,{code:`source.not-file`,message:`Referenced source path is not a regular file.`,path:n.code,functionName:n.name}):j(r,{code:`source.outside-project`,message:`Referenced source resolves outside the manifest directory through a symlink.`,path:n.code,functionName:n.name}):j(r,{code:`source.missing`,message:`Referenced source file does not exist.`,path:n.code,functionName:n.name})}N(n).forEach(a=>{if(/<<parameters\.[^>]+>>/u.test(a.path)){j(r,{code:`manifest.unresolved-payload-path`,message:`Payload paths cannot contain unresolved parameter placeholders.`,path:a.path,functionName:n.name});return}let s=S(t,a.path);if(!e.fs.existsSync(s)){j(r,{code:`payload.missing`,message:`Referenced test payload does not exist.`,path:a.path,functionName:n.name});return}if(!u(e,t,s)){j(r,{code:`payload.outside-project`,message:`Referenced test payload resolves outside the manifest directory through a symlink.`,path:a.path,functionName:n.name});return}if(!e.fs.statSync(s).isFile()){j(r,{code:`payload.not-file`,message:`Referenced test payload is not a regular file.`,path:a.path,functionName:n.name});return}o.push(s);let c;try{c=JSON.parse(e.fs.readFileSync(s,`utf8`))}catch(e){j(r,{code:`payload.invalid-json`,message:`Invalid JSON: ${e.message}`,path:a.path,functionName:n.name});return}let l=i[a.type];l(c)||(l.errors??[]).forEach(e=>j(r,{code:`payload.schema`,message:I(e),path:a.path,functionName:n.name}))})}),{sources:a,payloadPaths:[...new Set(o)]}}function R(e){try{let t=JSON.parse(e),n=Array.isArray(t)?t:t&&typeof t==`object`&&Array.isArray(t.nodes)?t.nodes:void 0;return n?new Set(n.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e.name;return typeof t==`string`?[t]:[]})):new Set}catch{return new Set}}function z(e){switch(y(e)){case`.ts`:case`.tsx`:return`ts`;case`.json`:case`.jsonc`:return`json`;case`.yaml`:case`.yml`:return`yaml`;default:return`ts`}}function B(e,t,n){if(!n)return;let r=A(e.fs.readFileSync(n,`utf8`));if(typeof r?.importMap==`string`){if(/^[a-z][a-z\d+.-]*:/iu.test(r.importMap))return r.importMap;let i=S(v(n),r.importMap);return d(e,t,i),i}let i={};if(r.imports!==void 0&&(i.imports=r.imports),r.scopes!==void 0&&(i.scopes=r.scopes),Object.keys(i).length!==0)return`data:application/json,${encodeURIComponent(JSON.stringify(i))}`}async function V(e,t,n,r,i){let a=[],o=[];for(let s of i){d(e,n,s);let i=e.fs.readFileSync(s,`utf8`),c=await t(`deno`,[`fmt`,...r,`--ext=${z(s)}`,`-`],{cwd:n,input:i},e);if(c.code!==0)throw Error(`Deno could not preview formatting for ${M(n,s)}.${c.stderr.trim()?`\n${c.stderr.trim()}`:``}`);if(c.stdout!==i){let t=M(n,s);a.push(T(t,t,i,c.stdout,``,``,{context:3})),o.push({kind:`file`,path:s,before:i,after:c.stdout,description:`Format ${t}`,mode:e.fs.statSync(s).mode})}}return{patch:a.join(`
|
|
2
|
-
`),changes:o}}function H(e,t,n,r){j(e,{code:t,message:`${n}${r.stderr.trim()?`\n${r.stderr.trim()}`:``}`})}async function U(t,n,r=h){let i=S(n.manifestPath),a=v(i),o=[],s=new Map([[`manifest`,`passed`],[`files`,`passed`],[`payloads`,`passed`],[`runtime`,`passed`],[`exports`,`passed`],[`typecheck`,`passed`],[`lint`,`passed`],[`format`,`passed`]]),f=()=>({version:1,status:o.some(({severity:e})=>e===`error`)?`failed`:`passed`,manifestPath:i,checks:[...s].map(([e,t])=>({name:e,status:t})),diagnostics:o});if(!t.fs.existsSync(i))return j(o,{code:`manifest.missing`,message:`Custom Function manifest does not exist.`,path:M(t.process.cwd(),i)}),s.set(`manifest`,`failed`),[`files`,`payloads`,`runtime`,`exports`,`typecheck`,`lint`,`format`].forEach(e=>s.set(e,`skipped`)),f();let y=[];try{y=p(e(t.fs.readFileSync(i,`utf8`),n.variables??{})).functions}catch(e){return j(o,{code:`manifest.invalid`,message:e.message,path:M(a,i)}),s.set(`manifest`,`failed`),[`files`,`payloads`,`runtime`,`exports`,`typecheck`,`lint`,`format`].forEach(e=>s.set(e,`skipped`)),f()}y.forEach(e=>{try{m({...e.env?{env:e.env}:{},...e[`allowed-hosts`]?{allowedHosts:e[`allowed-hosts`]}:{}})}catch(t){s.set(`manifest`,`failed`),j(o,{code:`manifest.execution-context`,message:t.message,path:M(a,i),functionName:e.name})}});let{sources:x,payloadPaths:C}=L(t,a,y,o);o.some(({code:e})=>[`source.`,`manifest.unresolved-code-path`].some(t=>e.startsWith(t)))&&(s.set(`files`,`failed`),[`exports`,`typecheck`,`lint`].forEach(e=>s.set(e,`failed`))),o.some(({code:e})=>[`payload.`,`manifest.unresolved-payload-path`].some(t=>e.startsWith(t)))&&s.set(`payloads`,`failed`);let w=b(a,`deno.jsonc`),T=b(a,`deno.json`),E=t.fs.existsSync(w)?w:t.fs.existsSync(T)?T:void 0,D=E!==void 0&&!u(t,a,E),O=D,k;if(D)j(o,{code:`deno.config-outside-project`,message:`Deno configuration resolves outside the manifest directory through a symlink.`,path:M(a,E)}),[`exports`,`typecheck`,`lint`,`format`].forEach(e=>s.set(e,`failed`));else try{k=B(t,a,E)}catch(e){O=!0,j(o,{code:`deno.import-map-outside-project`,message:e.message}),[`exports`,`typecheck`,`lint`,`format`].forEach(e=>s.set(e,`failed`))}let A=E&&!O?[`--config=${E}`]:[`--no-config`],N=()=>{[`exports`,`typecheck`,`lint`,`format`].forEach(e=>{s.get(e)!==`failed`&&s.set(e,`skipped`)})},P=await r(`deno`,[`--version`],{cwd:a},t),F=P.code===0?c(P.stdout):void 0;if(F?.level===`warning`&&o.push({code:`deno.version-mismatch`,severity:`warning`,message:F.message}),P.error?.code===`ENOENT`)s.set(`runtime`,`failed`),N(),j(o,{code:`deno.missing`,message:`Deno 2.x is required for export, type, lint, and format checks. Install it from ${l}`});else if(P.code!==0)s.set(`runtime`,`failed`),N(),H(o,`deno.unavailable`,`Deno could not be started.`,P);else if(F?.level===`error`)s.set(`runtime`,`failed`),N(),j(o,{code:`deno.unsupported-version`,message:F.message});else if(!O){for(let e of x){let n=await r(`deno`,[`info`,`--json`,...A,e.path],{cwd:a},t);if(n.code!==0)s.set(`files`,`failed`),H(o,`source.module-graph`,`Could not inspect runtime imports for ${M(a,e.path)}.`,n);else try{let t=g(n.stdout);t.length>0&&(s.set(`files`,`failed`),j(o,{code:`source.local-runtime-import`,message:`Custom Functions must be self-contained. Local or import-map runtime dependencies are not deployed: `+t.join(`, `),path:M(a,e.path),functionName:e.entry.name}))}catch(t){s.set(`files`,`failed`),j(o,{code:`source.module-graph`,message:t.message,path:M(a,e.path),functionName:e.entry.name})}let i=await r(`deno`,[`doc`,`--json`,...k?[`--import-map`,k]:[],e.path],{cwd:a},t);if(i.code!==0){s.set(`exports`,`failed`),H(o,`exports.inspect`,`Could not inspect exports for ${M(a,e.path)}.`,i);continue}let c=R(i.stdout);e.needsDefault&&!c.has(`default`)&&(s.set(`exports`,`failed`),j(o,{code:`exports.default-missing`,message:`The manifest fixtures require a default export.`,path:M(a,e.path),functionName:e.entry.name})),e.needsEnricher&&!c.has(`enricher`)&&(s.set(`exports`,`failed`),j(o,{code:`exports.enricher-missing`,message:"A REQUEST_ENRICHER fixture requires an `enricher` export.",path:M(a,e.path),functionName:e.entry.name})),e.needsAnyDsrExport&&!c.has(`default`)&&!c.has(`enricher`)&&(s.set(`exports`,`failed`),j(o,{code:`exports.dsr-missing`,message:"A DSR Custom Function requires a `default` or `enricher` export.",path:M(a,e.path),functionName:e.entry.name}))}let e=[...new Set(x.map(({path:e})=>e))];if(e.length>0){let n=await r(`deno`,[`check`,...A,...e],{cwd:a},t);n.code!==0&&(s.set(`typecheck`,`failed`),H(o,`deno.typecheck`,`Deno type checking failed.`,n));let i=await r(`deno`,[`lint`,...A,...e],{cwd:a},t);i.code!==0&&(s.set(`lint`,`failed`),H(o,`deno.lint`,`Deno linting failed.`,i))}let c=[...e,...C,i,...E?[E]:[],...k&&k!==E&&!/^[a-z][a-z\d+.-]*:/iu.test(k)?[k]:[]];c.forEach(e=>d(t,a,e));let l=await r(`deno`,[`fmt`,`--check`,...A,...c],{cwd:a},t);if(l.code!==0){let e;try{e=await V(t,r,a,A,c)}catch(e){return s.set(`format`,`failed`),j(o,{code:`deno.format-preview`,message:e.message}),f()}if(e.changes.length===0)return s.set(`format`,`failed`),H(o,`deno.format`,`Deno reported a formatting failure but did not produce a repair.`,l),f();if(n.fix||n.confirmFormat&&await n.confirmFormat(e.patch))try{await _(t,{rootDirectory:a,changes:e.changes})}catch(e){s.set(`format`,`failed`),j(o,{code:`deno.format-fix`,message:`Could not apply formatting transaction: ${e.message}`})}else s.set(`format`,`failed`),e.changes.forEach((t,r)=>{j(o,{code:`deno.format`,message:`Referenced file is not formatted.`+(r===0&&n.includeFormatPatchInDiagnostics&&e.patch?`\n${e.patch}`:``),path:M(a,t.path)})})}}return f()}async function W(e,c){n(this.process);let{manifestPath:l}=o(this.process.cwd(),{...c?{directory:c}:{},...e.manifest?{manifest:e.manifest}:{}}),u=this.fs.existsSync(l)?void 0:a({cwd:this.process.cwd(),manifestPath:l,discoveredManifestPaths:s(this,this.process.cwd()),command:`check`}),d=!e.json&&!e.noInteractive&&!!(this.process.stdin.isTTY&&this.process.stderr.isTTY),f=new r(this);try{let n=await U(this,{manifestPath:l,variables:t(e.variables),fix:e.fix,includeFormatPatchInDiagnostics:!e.json,...d&&!e.fix?{confirmFormat:async e=>(e&&this.logger.error(e),f.confirm(`Format the files shown above?`,!0))}:{}});u&&n.diagnostics.forEach(e=>{e.code===`manifest.missing`&&(e.message=u)}),e.json?this.process.stdout.write(`${JSON.stringify(n)}\n`):(this.logger.info(`${w.bold(`Custom Function checks`)}\n`),n.checks.forEach(({name:e,status:t})=>{let n=t===`passed`?`PASS`:t===`failed`?`FAIL`:`SKIP`,r=t===`passed`?w.green(n):t===`failed`?w.red(n):w.yellow(n);this.logger.info(`${r} ${e[0].toUpperCase()}${e.slice(1)}`)}),n.diagnostics.length>0&&this.logger.error(``),n.diagnostics.forEach(e=>{let t=e.path?`${e.path}: `:``,n=e.functionName?`[${e.functionName}] `:``,r=`${e.severity}: ${t}${n}${e.message}`;e.severity===`warning`?this.logger.warn(w.yellow(r)):this.logger.error(w.red(r))}),n.status===`passed`?(this.logger.info(``),this.logger.info(w.green(`Custom Function checks passed.`))):(this.logger.error(``),this.logger.error(w.red(`Custom Function checks failed.`)))),n.status===`failed`&&(this.process.exitCode=1)}catch(e){throw e instanceof i&&this.process.exit(130),e}}export{W as check};
|
|
3
|
-
//# sourceMappingURL=impl--JGnR3wp.mjs.map
|
package/dist/impl-7UqkSO3x2.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t}from"./runOpa-CswzJxIs.mjs";import{t as n}from"./done-input-validation-BUz-aVC5.mjs";import r from"node:path";import i from"colors";async function a({dir:a}){n(this.process),t();let o=r.resolve(a);this.logger.info(i.green(`Running policy tests in ${o}...`));let s=await e([`test`,o]);s!==0&&this.process.exit(s),this.logger.info(i.green(`Policy tests passed.`))}export{a as test};
|
|
2
|
-
//# sourceMappingURL=impl-7UqkSO3x2.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-7UqkSO3x2.mjs","names":[],"sources":["../src/commands/policy/test/impl.ts"],"sourcesContent":["import path from 'node:path';\n\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { assertOpaInstalled, runOpa } from '../helpers/index.js';\n\n/** CLI flags for `transcend policy test`. */\nexport interface TestCommandFlags {\n /** Directory containing Rego policy files and tests */\n dir: string;\n}\n\n/**\n * Run OPA tests against a local policy bundle.\n *\n * @param this - CLI context\n * @param flags - Command flags\n */\nexport async function test(this: LocalContext, { dir }: TestCommandFlags): Promise<void> {\n doneInputValidation(this.process);\n\n assertOpaInstalled();\n const resolvedDir = path.resolve(dir);\n\n this.logger.info(colors.green(`Running policy tests in ${resolvedDir}...`));\n\n const exitCode = await runOpa(['test', resolvedDir]);\n if (exitCode !== 0) {\n this.process.exit(exitCode);\n }\n\n this.logger.info(colors.green('Policy tests passed.'));\n}\n"],"mappings":"yJAoBA,eAAsB,EAAyB,CAAE,OAAwC,CACvF,EAAoB,KAAK,QAAQ,CAEjC,GAAoB,CACpB,IAAM,EAAc,EAAK,QAAQ,EAAI,CAErC,KAAK,OAAO,KAAK,EAAO,MAAM,2BAA2B,EAAY,KAAK,CAAC,CAE3E,IAAM,EAAW,MAAM,EAAO,CAAC,OAAQ,EAAY,CAAC,CAChD,IAAa,GACf,KAAK,QAAQ,KAAK,EAAS,CAG7B,KAAK,OAAO,KAAK,EAAO,MAAM,uBAAuB,CAAC"}
|
package/dist/impl-B4BgGuF_.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{c as e,i as t,l as n,o as r,s as i}from"./policy-runtime-BMKa-Upy.mjs";import{t as a}from"./policy-bundle-manifest-D6dkbjNi.mjs";import{n as o}from"./inquirer-BeaBetMO.mjs";import{t as s}from"./done-input-validation-BUz-aVC5.mjs";import{t as c}from"./run-captured-process-BXwWXuTh.mjs";import l from"node:path";import u from"colors";const d=[`manifest`,`opa-version`,`regal-version`,`format`,`opa-check`,`regal-lint`,`opa-test`],f={manifest:`Manifest and package roots`,"opa-version":`OPA 1.x`,"regal-version":`Regal`,format:`OPA formatting`,"opa-check":`OPA strict check`,"regal-lint":`Regal lint`,"opa-test":`OPA tests`};function p(e,t){return[e.stdout.trim(),e.stderr.trim()].filter(Boolean).join(`
|
|
2
|
-
`)||t}function m(e,t){return[...new Set(e.split(/\r?\n/gu).map(e=>e.trim()).filter(Boolean).map(e=>l.isAbsolute(e)?l.relative(t,e).split(l.sep).join(`/`):e.split(l.sep).join(`/`)))].sort()}function h(e,t,n=t){return e.fs.readdirSync(n,{withFileTypes:!0}).sort((e,t)=>e.name.localeCompare(t.name)).flatMap(r=>{let i=l.join(n,r.name);return r.isDirectory()?h(e,t,i):!r.isFile()||!r.name.endsWith(`.rego`)?[]:[{path:l.relative(t,i).split(l.sep).join(`/`),contents:e.fs.readFileSync(i,`utf8`)}]})}function g(e,t){e.logger.info(`${u.bold(`Policy verification`)}\n`),t.checks.forEach(({name:n,status:r})=>{let i=r===`passed`?`PASS`:r===`failed`?`FAIL`:`SKIP`,a=r===`passed`?u.green(i):r===`failed`?u.red(i):u.yellow(i),o=n===`opa-version`&&t.tools.opa?` (${t.tools.opa})`:n===`regal-version`&&t.tools.regal?` (${t.tools.regal})`:``;e.logger.info(`${a} ${f[n]}${o}`)}),t.diagnostics.length>0&&e.logger.error(``),t.diagnostics.forEach(t=>{let n=t.path?`${t.path}: `:``;e.logger.error(u.red(`error [${t.code}]: ${n}${t.message}`))}),t.status===`passed`?(e.logger.info(``),e.logger.info(u.green(`Policy verification passed.`))):(e.logger.error(``),e.logger.error(u.red(`Policy verification failed.`)))}async function _({dir:f=`transcend/policy`,fix:_=!1,noInteractive:v=!1,json:y=!1},b=c){s(this.process);let x=l.resolve(this.process.cwd(),f),S=d.map(e=>({name:e,status:`skipped`})),C=[],w={version:1,status:`passed`,directory:x,fix:_,tools:{opa:null,regal:null},checks:S,unformattedFiles:[],fixedFiles:[],diagnostics:C},T=(e,t)=>{S.find(t=>t.name===e).status=t},E=(e,t,n)=>{C.push({code:e,severity:`error`,message:t,...n?{path:n}:{}})};if(!this.fs.existsSync(x)||!this.fs.statSync(x).isDirectory())T(`manifest`,`failed`),E(`project.directory`,`Policy directory does not exist or is not a directory: ${x}`,l.relative(this.process.cwd(),x));else{let s=l.join(x,`manifest.json`);try{a(this.fs.existsSync(s)?this.fs.readFileSync(s,`utf8`):void 0,h(this,x)),T(`manifest`,`passed`)}catch(e){T(`manifest`,`failed`),E(`manifest.invalid`,e instanceof Error?e.message:String(e),l.relative(this.process.cwd(),s))}let c=await b(`opa`,[`version`],{cwd:x},this);if(c.error?.code===`ENOENT`)T(`opa-version`,`failed`),E(`opa.missing`,t);else{let t=`${c.stdout}\n${c.stderr}`,n=e(t);c.code!==0||n?(T(`opa-version`,`failed`),E(`opa.version`,n??p(c,`Unable to determine the installed OPA version.`))):(w.tools.opa=i(t).version,T(`opa-version`,`passed`))}let d=await b(`regal`,[`version`],{cwd:x},this);if(d.error?.code===`ENOENT`)T(`regal-version`,`failed`),E(`regal.missing`,r);else{let e=`${d.stdout}\n${d.stderr}`,t=n(e);d.code!==0||t?(T(`regal-version`,`failed`),E(`regal.version`,t??p(d,`Unable to determine the installed Regal version.`))):(w.tools.regal=i(e).version,T(`regal-version`,`passed`))}if(w.tools.opa){let e=await b(`opa`,[`fmt`,`--list`,x],{cwd:x},this);if(e.code!==0)T(`format`,`failed`),E(`opa.format`,p(e,`opa fmt --list failed with exit code ${e.code}`));else if(w.unformattedFiles=m(e.stdout,x),w.unformattedFiles.length===0)T(`format`,`passed`);else{let e=_,t=!y&&!v&&!!this.process.stdin.isTTY;if(!y&&!_){this.logger.error(u.red(`Policy files are not formatted:`)),w.unformattedFiles.forEach(e=>{this.logger.error(u.red(` - ${e}`))});let e=await b(`opa`,[`fmt`,`--diff`,x],{cwd:x},this),t=e.stdout.trim()||e.stderr.trim();t&&(this.logger.error(``),this.logger.error(t))}if(!_&&t)try{e=await o({message:`Format the unformatted policy files listed above?`})}catch(e){let t=e instanceof Error?e.message:String(e);throw/force closed|prompt.*cancel|user.*close|SIGINT/iu.test(t)&&this.process.exit(130),e}if(e){let e=await b(`opa`,[`fmt`,`--write`,x],{cwd:x},this);e.code===0?(w.fixedFiles=[...w.unformattedFiles],T(`format`,`passed`)):(T(`format`,`failed`),E(`opa.format-fix`,p(e,`opa fmt --write failed with exit code ${e.code}`)))}else T(`format`,`failed`),E(`opa.format-required`,"Policy files are not formatted. Re-run `transcend policy lint --fix` to repair them.")}let t=await b(`opa`,[`check`,`--strict`,`--v0-compatible`,`--ignore`,`*_test.rego`,x],{cwd:x},this);t.code===0?T(`opa-check`,`passed`):(T(`opa-check`,`failed`),E(`opa.check`,p(t,`opa check failed with exit code ${t.code}`)))}if(w.tools.regal){let e=l.join(x,`.regal`,`config.yaml`),t=l.join(x,`.regal.yaml`),n=this.fs.existsSync(e)?e:this.fs.existsSync(t)?t:void 0,r=await b(`regal`,[`lint`,`--fail-level`,`warning`,...n?[`--config-file`,n]:[],x],{cwd:x},this);r.code===0?T(`regal-lint`,`passed`):(T(`regal-lint`,`failed`),E(`regal.lint`,p(r,`regal lint failed with exit code ${r.code}`)))}if(w.tools.opa){let e=await b(`opa`,[`test`,`--fail-on-empty`,x],{cwd:x},this);e.code===0?T(`opa-test`,`passed`):(T(`opa-test`,`failed`),E(`opa.test`,p(e,`opa test --fail-on-empty failed with exit code ${e.code}`)))}}w.status=S.some(({status:e})=>e===`failed`)?`failed`:`passed`,y?this.process.stdout.write(`${JSON.stringify(w)}\n`):g(this,w),w.status===`failed`&&(this.process.exitCode=1)}export{_ as lint};
|
|
3
|
-
//# sourceMappingURL=impl-B4BgGuF_.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-B4BgGuF_.mjs","names":[],"sources":["../src/lib/policy/policy-lint-model.ts","../src/lib/policy/policy-lint-output.ts","../src/commands/policy/lint/impl.ts"],"sourcesContent":["/** Stable policy lint result schema version. */\nexport const POLICY_LINT_RESULT_VERSION = 1;\n\n/** Status of the full gate or an individual verification. */\nexport type PolicyLintStatus = 'passed' | 'failed' | 'skipped';\n\n/** One named policy verification. */\nexport interface PolicyLintCheck {\n /** Stable verification name. */\n name:\n | 'manifest'\n | 'opa-version'\n | 'regal-version'\n | 'format'\n | 'opa-check'\n | 'regal-lint'\n | 'opa-test';\n /** Verification outcome. */\n status: PolicyLintStatus;\n}\n\n/** Stable verification execution order. */\nexport const POLICY_LINT_CHECK_NAMES: PolicyLintCheck['name'][] = [\n 'manifest',\n 'opa-version',\n 'regal-version',\n 'format',\n 'opa-check',\n 'regal-lint',\n 'opa-test',\n];\n\n/** User-facing verification labels. */\nexport const POLICY_LINT_CHECK_LABELS: Readonly<Record<PolicyLintCheck['name'], string>> = {\n manifest: 'Manifest and package roots',\n 'opa-version': 'OPA 1.x',\n 'regal-version': 'Regal',\n format: 'OPA formatting',\n 'opa-check': 'OPA strict check',\n 'regal-lint': 'Regal lint',\n 'opa-test': 'OPA tests',\n};\n\n/** One machine-readable policy lint diagnostic. */\nexport interface PolicyLintDiagnostic {\n /** Stable diagnostic identifier. */\n code: string;\n /** Diagnostic severity. */\n severity: 'error';\n /** Human-readable detail, including captured tool output when available. */\n message: string;\n /** Optional path relative to the invocation directory. */\n path?: string;\n}\n\n/** Detected local policy tool versions. */\nexport interface PolicyLintTools {\n /** Detected OPA version, or null when missing or unsupported. */\n opa: string | null;\n /** Detected Regal version, or null when missing or unsupported. */\n regal: string | null;\n}\n\n/** Stable result emitted by `transcend policy lint --json`. */\nexport interface PolicyLintResult {\n /** Result schema version. */\n version: typeof POLICY_LINT_RESULT_VERSION;\n /** Overall verification outcome. */\n status: Exclude<PolicyLintStatus, 'skipped'>;\n /** Absolute policy project directory. */\n directory: string;\n /** Whether formatting repair was explicitly requested. */\n fix: boolean;\n /** Detected supported tool versions. */\n tools: PolicyLintTools;\n /** Verification outcomes in stable execution order. */\n checks: PolicyLintCheck[];\n /** Files found to need OPA formatting, relative to the policy directory. */\n unformattedFiles: string[];\n /** Files repaired with OPA formatting, relative to the policy directory. */\n fixedFiles: string[];\n /** Ordered verification diagnostics. */\n diagnostics: PolicyLintDiagnostic[];\n}\n","import path from 'node:path';\n\nimport type { CapturedProcessResult } from '../cli/run-captured-process.js';\n\n/**\n * Use captured tool output as a concise diagnostic.\n *\n * @param result - Captured process result\n * @param fallback - Message used when the tool emitted no output\n * @returns Diagnostic message\n */\nexport function getPolicyProcessFailureMessage(\n result: CapturedProcessResult,\n fallback: string,\n): string {\n const output = [result.stdout.trim(), result.stderr.trim()].filter(Boolean).join('\\n');\n return output || fallback;\n}\n\n/**\n * Convert absolute OPA formatter paths to stable project-relative paths.\n *\n * @param stdout - `opa fmt --list` output\n * @param projectDirectory - Absolute policy directory\n * @returns Sorted unique paths\n */\nexport function parseUnformattedPolicyFiles(stdout: string, projectDirectory: string): string[] {\n return [\n ...new Set(\n stdout\n .split(/\\r?\\n/gu)\n .map((file) => file.trim())\n .filter(Boolean)\n .map((file) =>\n path.isAbsolute(file)\n ? path.relative(projectDirectory, file).split(path.sep).join('/')\n : file.split(path.sep).join('/'),\n ),\n ),\n ].sort();\n}\n","import path from 'node:path';\n\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport {\n runCapturedProcess,\n type CapturedProcessRunner,\n} from '../../../lib/cli/run-captured-process.js';\nimport { inquirerConfirmBoolean } from '../../../lib/helpers/inquirer.js';\nimport {\n type PolicyBundleRegoFile,\n validatePolicyBundleContents,\n} from '../../../lib/policy/policy-bundle-manifest.js';\nimport {\n type PolicyLintCheck,\n type PolicyLintDiagnostic,\n type PolicyLintResult,\n POLICY_LINT_CHECK_LABELS,\n POLICY_LINT_CHECK_NAMES,\n POLICY_LINT_RESULT_VERSION,\n} from '../../../lib/policy/policy-lint-model.js';\nimport {\n getPolicyProcessFailureMessage,\n parseUnformattedPolicyFiles,\n} from '../../../lib/policy/policy-lint-output.js';\nimport {\n OPA_MISSING_MESSAGE,\n parsePolicyToolVersion,\n REGAL_MISSING_MESSAGE,\n unsupportedOpaVersionMessage,\n unsupportedRegalVersionMessage,\n} from '../../../lib/policy/policy-runtime.js';\n\n/** CLI flags for `transcend policy lint`. */\nexport interface LintCommandFlags {\n /** Directory containing manifest.json, Rego policy files, and tests. */\n dir: string;\n /** Apply OPA formatting. */\n fix: boolean;\n /** Disable the optional formatting confirmation. */\n noInteractive: boolean;\n /** Emit one stable JSON result on stdout. */\n json: boolean;\n}\n\n/**\n * Collect Rego source snapshots without following symlinks.\n *\n * @param context - CLI context\n * @param projectDirectory - Absolute policy directory\n * @param currentDirectory - Current recursive directory\n * @returns Deterministically ordered Rego snapshots\n */\nfunction collectRegoFiles(\n context: LocalContext,\n projectDirectory: string,\n currentDirectory: string = projectDirectory,\n): PolicyBundleRegoFile[] {\n return context.fs\n .readdirSync(currentDirectory, { withFileTypes: true })\n .sort((left, right) => left.name.localeCompare(right.name))\n .flatMap((entry) => {\n const absolutePath = path.join(currentDirectory, entry.name);\n if (entry.isDirectory()) {\n return collectRegoFiles(context, projectDirectory, absolutePath);\n }\n if (!entry.isFile() || !entry.name.endsWith('.rego')) {\n return [];\n }\n return [\n {\n path: path.relative(projectDirectory, absolutePath).split(path.sep).join('/'),\n contents: context.fs.readFileSync(absolutePath, 'utf8'),\n },\n ];\n });\n}\n\n/**\n * Render the terminal summary for a policy verification result.\n *\n * @param context - CLI context\n * @param result - Completed verification result\n */\nfunction renderResult(context: LocalContext, result: PolicyLintResult): void {\n context.logger.info(`${colors.bold('Policy verification')}\\n`);\n result.checks.forEach(({ name, status }) => {\n const label = status === 'passed' ? 'PASS' : status === 'failed' ? 'FAIL' : 'SKIP';\n const styledLabel =\n status === 'passed'\n ? colors.green(label)\n : status === 'failed'\n ? colors.red(label)\n : colors.yellow(label);\n const version =\n name === 'opa-version' && result.tools.opa\n ? ` (${result.tools.opa})`\n : name === 'regal-version' && result.tools.regal\n ? ` (${result.tools.regal})`\n : '';\n context.logger.info(`${styledLabel} ${POLICY_LINT_CHECK_LABELS[name]}${version}`);\n });\n if (result.diagnostics.length > 0) {\n context.logger.error('');\n }\n result.diagnostics.forEach((diagnostic) => {\n const location = diagnostic.path ? `${diagnostic.path}: ` : '';\n context.logger.error(\n colors.red(`error [${diagnostic.code}]: ${location}${diagnostic.message}`),\n );\n });\n if (result.status === 'passed') {\n context.logger.info('');\n context.logger.info(colors.green('Policy verification passed.'));\n } else {\n context.logger.error('');\n context.logger.error(colors.red('Policy verification failed.'));\n }\n}\n\n/**\n * Verify a local policy project with the shared upload contract, OPA, and Regal.\n *\n * @param this - CLI context\n * @param flags - Command flags\n * @param runner - Captured subprocess runner\n */\nexport async function lint(\n this: LocalContext,\n { dir = 'transcend/policy', fix = false, noInteractive = false, json = false }: LintCommandFlags,\n runner: CapturedProcessRunner = runCapturedProcess,\n): Promise<void> {\n doneInputValidation(this.process);\n\n const resolvedDir = path.resolve(this.process.cwd(), dir);\n const checks: PolicyLintCheck[] = POLICY_LINT_CHECK_NAMES.map((name) => ({\n name,\n status: 'skipped',\n }));\n const diagnostics: PolicyLintDiagnostic[] = [];\n const result: PolicyLintResult = {\n version: POLICY_LINT_RESULT_VERSION,\n status: 'passed',\n directory: resolvedDir,\n fix,\n tools: { opa: null, regal: null },\n checks,\n unformattedFiles: [],\n fixedFiles: [],\n diagnostics,\n };\n const setStatus = (name: PolicyLintCheck['name'], status: PolicyLintCheck['status']): void => {\n checks.find((check) => check.name === name)!.status = status;\n };\n const addError = (code: string, message: string, diagnosticPath?: string): void => {\n diagnostics.push({\n code,\n severity: 'error',\n message,\n ...(diagnosticPath ? { path: diagnosticPath } : {}),\n });\n };\n\n if (!this.fs.existsSync(resolvedDir) || !this.fs.statSync(resolvedDir).isDirectory()) {\n setStatus('manifest', 'failed');\n addError(\n 'project.directory',\n `Policy directory does not exist or is not a directory: ${resolvedDir}`,\n path.relative(this.process.cwd(), resolvedDir),\n );\n } else {\n const manifestPath = path.join(resolvedDir, 'manifest.json');\n try {\n validatePolicyBundleContents(\n this.fs.existsSync(manifestPath) ? this.fs.readFileSync(manifestPath, 'utf8') : undefined,\n collectRegoFiles(this, resolvedDir),\n );\n setStatus('manifest', 'passed');\n } catch (error) {\n setStatus('manifest', 'failed');\n addError(\n 'manifest.invalid',\n error instanceof Error ? error.message : String(error),\n path.relative(this.process.cwd(), manifestPath),\n );\n }\n\n const opaVersionResult = await runner('opa', ['version'], { cwd: resolvedDir }, this);\n if (opaVersionResult.error?.code === 'ENOENT') {\n setStatus('opa-version', 'failed');\n addError('opa.missing', OPA_MISSING_MESSAGE);\n } else {\n const opaVersionOutput = `${opaVersionResult.stdout}\\n${opaVersionResult.stderr}`;\n const unsupportedOpa = unsupportedOpaVersionMessage(opaVersionOutput);\n if (opaVersionResult.code !== 0 || unsupportedOpa) {\n setStatus('opa-version', 'failed');\n addError(\n 'opa.version',\n unsupportedOpa ??\n getPolicyProcessFailureMessage(\n opaVersionResult,\n 'Unable to determine the installed OPA version.',\n ),\n );\n } else {\n result.tools.opa = parsePolicyToolVersion(opaVersionOutput)!.version;\n setStatus('opa-version', 'passed');\n }\n }\n\n const regalVersionResult = await runner('regal', ['version'], { cwd: resolvedDir }, this);\n if (regalVersionResult.error?.code === 'ENOENT') {\n setStatus('regal-version', 'failed');\n addError('regal.missing', REGAL_MISSING_MESSAGE);\n } else {\n const regalVersionOutput = `${regalVersionResult.stdout}\\n${regalVersionResult.stderr}`;\n const unsupportedRegal = unsupportedRegalVersionMessage(regalVersionOutput);\n if (regalVersionResult.code !== 0 || unsupportedRegal) {\n setStatus('regal-version', 'failed');\n addError(\n 'regal.version',\n unsupportedRegal ??\n getPolicyProcessFailureMessage(\n regalVersionResult,\n 'Unable to determine the installed Regal version.',\n ),\n );\n } else {\n result.tools.regal = parsePolicyToolVersion(regalVersionOutput)!.version;\n setStatus('regal-version', 'passed');\n }\n }\n\n if (result.tools.opa) {\n const formatResult = await runner(\n 'opa',\n ['fmt', '--list', resolvedDir],\n { cwd: resolvedDir },\n this,\n );\n if (formatResult.code !== 0) {\n setStatus('format', 'failed');\n addError(\n 'opa.format',\n getPolicyProcessFailureMessage(\n formatResult,\n `opa fmt --list failed with exit code ${formatResult.code}`,\n ),\n );\n } else {\n result.unformattedFiles = parseUnformattedPolicyFiles(formatResult.stdout, resolvedDir);\n if (result.unformattedFiles.length === 0) {\n setStatus('format', 'passed');\n } else {\n let shouldFormat = fix;\n const interactive = !json && !noInteractive && Boolean(this.process.stdin.isTTY);\n if (!json && !fix) {\n this.logger.error(colors.red('Policy files are not formatted:'));\n result.unformattedFiles.forEach((file) => {\n this.logger.error(colors.red(` - ${file}`));\n });\n const diffResult = await runner(\n 'opa',\n ['fmt', '--diff', resolvedDir],\n { cwd: resolvedDir },\n this,\n );\n const diff = diffResult.stdout.trim() || diffResult.stderr.trim();\n if (diff) {\n this.logger.error('');\n this.logger.error(diff);\n }\n }\n if (!fix && interactive) {\n try {\n shouldFormat = await inquirerConfirmBoolean({\n message: 'Format the unformatted policy files listed above?',\n });\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n if (/force closed|prompt.*cancel|user.*close|SIGINT/iu.test(message)) {\n this.process.exit(130);\n }\n throw error;\n }\n }\n if (shouldFormat) {\n const writeResult = await runner(\n 'opa',\n ['fmt', '--write', resolvedDir],\n { cwd: resolvedDir },\n this,\n );\n if (writeResult.code === 0) {\n result.fixedFiles = [...result.unformattedFiles];\n setStatus('format', 'passed');\n } else {\n setStatus('format', 'failed');\n addError(\n 'opa.format-fix',\n getPolicyProcessFailureMessage(\n writeResult,\n `opa fmt --write failed with exit code ${writeResult.code}`,\n ),\n );\n }\n } else {\n setStatus('format', 'failed');\n addError(\n 'opa.format-required',\n 'Policy files are not formatted. Re-run `transcend policy lint --fix` to repair them.',\n );\n }\n }\n }\n\n const checkResult = await runner(\n 'opa',\n ['check', '--strict', '--v0-compatible', '--ignore', '*_test.rego', resolvedDir],\n { cwd: resolvedDir },\n this,\n );\n if (checkResult.code === 0) {\n setStatus('opa-check', 'passed');\n } else {\n setStatus('opa-check', 'failed');\n addError(\n 'opa.check',\n getPolicyProcessFailureMessage(\n checkResult,\n `opa check failed with exit code ${checkResult.code}`,\n ),\n );\n }\n }\n\n if (result.tools.regal) {\n const nestedRegalConfig = path.join(resolvedDir, '.regal', 'config.yaml');\n const rootRegalConfig = path.join(resolvedDir, '.regal.yaml');\n const regalConfig = this.fs.existsSync(nestedRegalConfig)\n ? nestedRegalConfig\n : this.fs.existsSync(rootRegalConfig)\n ? rootRegalConfig\n : undefined;\n const regalResult = await runner(\n 'regal',\n [\n 'lint',\n '--fail-level',\n 'warning',\n ...(regalConfig ? ['--config-file', regalConfig] : []),\n resolvedDir,\n ],\n { cwd: resolvedDir },\n this,\n );\n if (regalResult.code === 0) {\n setStatus('regal-lint', 'passed');\n } else {\n setStatus('regal-lint', 'failed');\n addError(\n 'regal.lint',\n getPolicyProcessFailureMessage(\n regalResult,\n `regal lint failed with exit code ${regalResult.code}`,\n ),\n );\n }\n }\n\n if (result.tools.opa) {\n const testResult = await runner(\n 'opa',\n ['test', '--fail-on-empty', resolvedDir],\n { cwd: resolvedDir },\n this,\n );\n if (testResult.code === 0) {\n setStatus('opa-test', 'passed');\n } else {\n setStatus('opa-test', 'failed');\n addError(\n 'opa.test',\n getPolicyProcessFailureMessage(\n testResult,\n `opa test --fail-on-empty failed with exit code ${testResult.code}`,\n ),\n );\n }\n }\n }\n\n result.status = checks.some(({ status }) => status === 'failed') ? 'failed' : 'passed';\n if (json) {\n this.process.stdout.write(`${JSON.stringify(result)}\\n`);\n } else {\n renderResult(this, result);\n }\n if (result.status === 'failed') {\n this.process.exitCode = 1;\n }\n}\n"],"mappings":"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"}
|
package/dist/impl-B5oVsX-F2.mjs
DELETED
|
@@ -1,303 +0,0 @@
|
|
|
1
|
-
import{g as e}from"./constants-Upxn_rQF.mjs";import{a as t,c as n,i as r,l as i,o as a,r as o,s,t as c}from"./policy-runtime-BMKa-Upy.mjs";import{t as l}from"./done-input-validation-BUz-aVC5.mjs";import{a as u,c as d,d as f,f as p,g as m,h,i as g,l as ee,m as _,n as v,p as y,r as te,t as ne,u as re}from"./prompts-ClBXdELk.mjs";import{t as ie}from"./run-captured-process-BXwWXuTh.mjs";import{t as ae}from"./project-plan-apply-Dvndx455.mjs";import{n as b,r as x,t as S}from"./jsonc-D9dDWb1J.mjs";import{isAbsolute as C,join as w,posix as T,relative as E,resolve as oe,sep as D}from"node:path";import O from"colors";const k=`transcend/policy`;function se(e,t=k){let n=e.process.cwd(),r=oe(n,t);if(e.fs.existsSync(r)&&!e.fs.statSync(r).isDirectory())throw Error(`Policy target is not a directory: ${r}`);return{invocationDirectory:n,targetDirectory:r,...u(e,{invocationDirectory:n,targetDirectory:r,standaloneProjectRoot:n}),relativePaths:g(e,r),relativeFilePaths:g(e,r,{includeDirectories:!1})}}function ce(e){return w(e.targetDirectory,`manifest.json`)}const A={Editor:`editor`,Skill:`skill`,Ci:`ci`};var le=`# Idiomatic Rego and document-tree authoring
|
|
2
|
-
|
|
3
|
-
## Start from the document tree
|
|
4
|
-
|
|
5
|
-
OPA evaluates queries against one document tree:
|
|
6
|
-
|
|
7
|
-
- \`input\` is the request-specific document supplied by the caller.
|
|
8
|
-
- \`data\` contains loaded policy packages and static data.
|
|
9
|
-
- A Rego \`package\` determines where a module contributes documents below \`data\`.
|
|
10
|
-
|
|
11
|
-
Choose package paths from the application's required query and ownership boundaries. Keep directory and package names aligned when practical, and cover every publishable package with a \`manifest.json\` root.
|
|
12
|
-
|
|
13
|
-
Use Rego v1 explicitly:
|
|
14
|
-
|
|
15
|
-
\`\`\`rego
|
|
16
|
-
package policy_engine.example
|
|
17
|
-
|
|
18
|
-
import rego.v1
|
|
19
|
-
\`\`\`
|
|
20
|
-
|
|
21
|
-
When one publishable package reads another package under the same manifest root, import it and use the local name:
|
|
22
|
-
|
|
23
|
-
\`\`\`rego
|
|
24
|
-
import data.policy_engine.facts
|
|
25
|
-
|
|
26
|
-
allow if facts.subject_is_trusted
|
|
27
|
-
\`\`\`
|
|
28
|
-
|
|
29
|
-
Do not use a fully qualified \`data.policy_engine...\` reference directly in a rule body. Policy Engine re-namespaces package declarations and imports during activation, and \`transcend policy lint\` rejects direct self-root references that would change meaning.
|
|
30
|
-
|
|
31
|
-
## Define the contract before implementation
|
|
32
|
-
|
|
33
|
-
Find the actual caller and document:
|
|
34
|
-
|
|
35
|
-
1. the query path below \`data\`;
|
|
36
|
-
2. required and optional \`input\` fields;
|
|
37
|
-
3. the result document consumed by the caller;
|
|
38
|
-
4. fail-closed behavior for absent, malformed, or unknown input;
|
|
39
|
-
5. stable reason codes and any fields reserved for later extension.
|
|
40
|
-
|
|
41
|
-
Do not infer a product contract from the generated example. Replace its package names and fields when the repository's contract is known.
|
|
42
|
-
|
|
43
|
-
## Prefer declarative result construction
|
|
44
|
-
|
|
45
|
-
String decisions inside an object remain readable and extensible. Keep one result document shape and derive its fields from named rules:
|
|
46
|
-
|
|
47
|
-
\`\`\`rego
|
|
48
|
-
default decision := "deny"
|
|
49
|
-
|
|
50
|
-
decision := "allow" if {
|
|
51
|
-
input.subject.trusted == true
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
default reason_code := "untrusted_or_invalid_input"
|
|
55
|
-
|
|
56
|
-
reason_code := "trusted_subject" if {
|
|
57
|
-
decision == "allow"
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
result := {
|
|
61
|
-
"decision": decision,
|
|
62
|
-
"reason_code": reason_code,
|
|
63
|
-
}
|
|
64
|
-
\`\`\`
|
|
65
|
-
|
|
66
|
-
Rego rules define documents; they are not an imperative sequence of variable assignments. Prefer small named predicates and one result constructor over repeated branch-specific copies of the full output object.
|
|
67
|
-
|
|
68
|
-
## Fail closed
|
|
69
|
-
|
|
70
|
-
- Give the externally queried decision or result a deny/error default.
|
|
71
|
-
- Treat missing fields and unknown enum values as non-authorizing.
|
|
72
|
-
- Avoid broad truthiness checks when exact values are required.
|
|
73
|
-
- Add tests for malformed and incomplete inputs, not only expected allow cases.
|
|
74
|
-
- Add result fields compatibly so existing consumers can continue reading the stable core.
|
|
75
|
-
`,ue=`# Publishing
|
|
76
|
-
|
|
77
|
-
## Validate the upload contract
|
|
78
|
-
|
|
79
|
-
\`manifest.json\` declares the document-tree roots included in the Policy Engine bundle. Each non-test Rego package must equal a root or be nested below one. Test modules remain local and are excluded from the upload archive.
|
|
80
|
-
|
|
81
|
-
Before publishing:
|
|
82
|
-
|
|
83
|
-
1. confirm the intended package and query paths with the consuming application;
|
|
84
|
-
2. run \`transcend policy lint --dir <policy-directory> --noInteractive\`;
|
|
85
|
-
3. review the generated bundle name, version, description, and target Transcend environment;
|
|
86
|
-
4. keep API keys in the environment or the repository's approved secret store.
|
|
87
|
-
|
|
88
|
-
The publish path validates strict Rego compatibility and bundle compilation before creating the upload tarball.
|
|
89
|
-
|
|
90
|
-
## Publish deliberately
|
|
91
|
-
|
|
92
|
-
Run \`transcend policy publish --help\` for the current required flags and authentication scopes. Publishing creates or updates remote Policy Engine bundle resources, so keep it out of pull-request validation and require the repository's normal deployment approval.
|
|
93
|
-
|
|
94
|
-
Do not add publishing, Transcend API credentials, or environment activation to the validation-only workflow generated by \`policy init\`. Treat those as separate deployment decisions.
|
|
95
|
-
`,de="# Setup and tooling\n\n## Install the CLI\n\nInstall the Transcend CLI:\n\n```sh\nnpm install --global @transcend-io/cli\n```\n\n## Initialize safely\n\nRun `transcend policy init --help` before choosing flags. The default target is `transcend/policy`.\n\nInteractive initialization offers VS Code setup, this Agent Skill, and validation-only GitHub Actions. Non-interactive automation enables only explicitly supplied `--editor`, `--skill`, and `--ci` flags:\n\n```sh\ntranscend policy init ./transcend/policy --editor --skill --ci --noInteractive --yes\n```\n\nUse `--dryRun` to inspect the complete transactional plan. Existing policy files, manifests, Regal configuration, workflows, and customized managed artifacts are preserved.\n\n## Required tools\n\n- Use OPA 1.x for Rego v1 parsing, formatting, checks, tests, and bundle compilation.\n- Use Regal for idiomatic Rego linting and editor language-server features.\n- Run `opa version` and `regal version` to confirm the active executables.\n\nThe generated Regal configuration targets OPA 1.13.1 capabilities. Generated CI installs OPA 1.13.1 and Regal 0.42.0; local tools only need to satisfy the compatible versions reported by `policy init` and `policy lint`. Follow their official installation links when a compatible tool is missing.\n\n## Editor and CI\n\nRepository-level VS Code files scope OPA bundle roots and the `policy: lint` task to the selected policy directory. Preserve custom settings and tasks when adapting them.\n\nGenerated GitHub Actions CI is read-only and credential-free: it installs pinned tools and the pinned Transcend CLI, then runs `transcend policy lint`. Adapt triggers, runner labels, dependency installation, and caching to established repository conventions without adding publish steps or secrets.\n",fe=`# Testing and debugging
|
|
96
|
-
|
|
97
|
-
## Write executable tests
|
|
98
|
-
|
|
99
|
-
Place tests next to the package they exercise and suffix test modules with \`_test.rego\`. A separate \`_test\` package makes the production API and test helpers easy to distinguish:
|
|
100
|
-
|
|
101
|
-
\`\`\`rego
|
|
102
|
-
package policy_engine.example_test
|
|
103
|
-
|
|
104
|
-
import data.policy_engine.example
|
|
105
|
-
import rego.v1
|
|
106
|
-
|
|
107
|
-
test_denies_missing_input if {
|
|
108
|
-
result := example.result with input as {}
|
|
109
|
-
result == {
|
|
110
|
-
"decision": "deny",
|
|
111
|
-
"reason_code": "untrusted_or_invalid_input",
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
\`\`\`
|
|
115
|
-
|
|
116
|
-
Cover at least:
|
|
117
|
-
|
|
118
|
-
- the ordinary allow case;
|
|
119
|
-
- explicit deny cases;
|
|
120
|
-
- absent, malformed, and unknown input;
|
|
121
|
-
- important result fields and reason codes;
|
|
122
|
-
- interactions between packages when one policy reads another document.
|
|
123
|
-
|
|
124
|
-
\`transcend policy lint\` invokes \`opa test --fail-on-empty\`, so an empty suite fails validation.
|
|
125
|
-
|
|
126
|
-
## Use local inputs safely
|
|
127
|
-
|
|
128
|
-
Keep a sanitized \`input.example.json\` in source control. Put realistic local data in the target-local \`input.json\`, which the generated \`.gitignore\` excludes. Do not put credentials, personal data, or production payloads in fixtures unless repository policy explicitly permits sanitized versions.
|
|
129
|
-
|
|
130
|
-
## Run the complete gate
|
|
131
|
-
|
|
132
|
-
\`\`\`sh
|
|
133
|
-
transcend policy lint --dir ./transcend/policy --noInteractive
|
|
134
|
-
\`\`\`
|
|
135
|
-
|
|
136
|
-
Use \`transcend policy lint --help\` to inspect \`--fix\` and JSON output. The lint gate checks:
|
|
137
|
-
|
|
138
|
-
- manifest shape and package-root coverage;
|
|
139
|
-
- compatible OPA and Regal versions;
|
|
140
|
-
- OPA formatting;
|
|
141
|
-
- a strict production-only OPA check that excludes local test modules;
|
|
142
|
-
- Regal lint with warnings treated as failures;
|
|
143
|
-
- non-empty OPA tests.
|
|
144
|
-
|
|
145
|
-
Use \`--fix\` only for OPA formatting. Review Regal findings deliberately instead of applying broad rewrites.
|
|
146
|
-
|
|
147
|
-
## Evaluate a query
|
|
148
|
-
|
|
149
|
-
Use \`transcend policy eval --help\` to construct a local query with a sanitized input file and optional bundle directory. Evaluate the exact query used by the caller. If the result differs from expectations, inspect package paths, imports, defaults, input field presence, and the selected bundle root before changing policy logic.
|
|
150
|
-
`,pe=`---
|
|
151
|
-
name: transcend-policy-engine
|
|
152
|
-
description: Sets up, authors, validates, tests, and publishes Transcend Policy Engine projects backed by OPA and Rego. Use for manifest.json roots, Rego v1 policy trees, Regal configuration, local policy inputs, Policy Engine CI, or transcend policy CLI commands.
|
|
153
|
-
compatibility: Requires OPA 1.x and Regal for local validation, plus the Transcend CLI.
|
|
154
|
-
---
|
|
155
|
-
|
|
156
|
-
# Transcend Policy Engine
|
|
157
|
-
|
|
158
|
-
Use the CLI for deterministic scaffolding and validation. Treat the generated example as disposable teaching material and derive the real policy contract from repository code and product requirements.
|
|
159
|
-
|
|
160
|
-
## Workflow
|
|
161
|
-
|
|
162
|
-
1. Locate the policy directory and its \`manifest.json\`.
|
|
163
|
-
2. For initialization, editor support, tools, or CI, read [references/setup-tooling.md](references/setup-tooling.md).
|
|
164
|
-
3. For package layout, document-tree design, decisions, and inputs, read [references/authoring.md](references/authoring.md).
|
|
165
|
-
4. For tests, local inputs, linting, and evaluation, read [references/testing-debugging.md](references/testing-debugging.md).
|
|
166
|
-
5. For bundle validation and publishing, read [references/publishing.md](references/publishing.md).
|
|
167
|
-
6. Preserve repository conventions and run \`transcend policy lint --dir <policy-directory> --noInteractive\` before finishing.
|
|
168
|
-
|
|
169
|
-
## Documentation
|
|
170
|
-
|
|
171
|
-
- Every Transcend CLI command and subcommand provides contextual help with \`transcend <command> --help\`.
|
|
172
|
-
- Use the [Transcend CLI README](https://github.com/transcend-io/tools/tree/main/packages/cli#readme) for command documentation and examples.
|
|
173
|
-
- Use the [Transcend documentation index](https://docs.transcend.io/llms.txt) to find current product documentation.
|
|
174
|
-
|
|
175
|
-
## Guardrails
|
|
176
|
-
|
|
177
|
-
- Do not invent an input shape, output contract, package tree, or deployment convention.
|
|
178
|
-
- Keep decisions fail-closed and make result documents extensible.
|
|
179
|
-
- Never commit credentials or a real local \`input.json\`.
|
|
180
|
-
- Keep every publishable Rego package covered by a \`manifest.json\` root.
|
|
181
|
-
`;const j=`transcend-policy-engine`,M=[{path:`SKILL.md`,contents:pe},{path:`references/setup-tooling.md`,contents:de},{path:`references/authoring.md`,contents:le},{path:`references/testing-debugging.md`,contents:fe},{path:`references/publishing.md`,contents:ue}];function N(e){return e.examplePath?`${e.hasSkill?`Use the \`${j}\` skill to replace`:`Replace`} the disposable example in ${e.examplePath} with the intended policy document tree and input/output contract, adapt repository validation to local conventions, and rerun ${e.lintCommand}.`:`${e.hasSkill?`Use the \`${j}\` skill to review`:`Review`} the existing policy project in ${e.projectPath}, align its document tree and input/output contract with the intended application, adapt repository validation as needed, and rerun ${e.lintCommand}.`}function P(e,t){return{version:e.version,command:e.command,applied:t.applied,dryRun:t.dryRun,targetDirectory:e.targetDirectory,manifestPath:e.manifestPath,changes:e.changes.map(e=>m(t.cwd,e)),warnings:e.warnings,nextSteps:e.nextSteps,features:[...e.features],aiHandoff:t.aiHandoff,tools:t.tools}}const F=`1.13.1`,I=[{path:`manifest.json`,contents:`{
|
|
182
|
-
"roots": ["policy_engine"]
|
|
183
|
-
}
|
|
184
|
-
`,description:`Create the publishable Policy Engine manifest`},{path:`.regal/config.yaml`,contents:`capabilities:
|
|
185
|
-
from:
|
|
186
|
-
engine: opa
|
|
187
|
-
version: v${F}
|
|
188
|
-
project:
|
|
189
|
-
roots:
|
|
190
|
-
- .
|
|
191
|
-
rego-version: 1
|
|
192
|
-
`,description:`Pin strict Rego v1 linting to OPA 1.13.1 capabilities`},{path:`policy_engine/example/result.rego`,contents:`package policy_engine.example
|
|
193
|
-
|
|
194
|
-
import rego.v1
|
|
195
|
-
|
|
196
|
-
# METADATA
|
|
197
|
-
# title: Disposable example result
|
|
198
|
-
# description: |
|
|
199
|
-
# A fail-closed teaching entrypoint. Replace this example with the document
|
|
200
|
-
# tree and result contract required by your application.
|
|
201
|
-
# entrypoint: true
|
|
202
|
-
default result := {
|
|
203
|
-
"decision": "deny",
|
|
204
|
-
"reason_code": "untrusted_or_invalid_input",
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
result := {
|
|
208
|
-
"decision": "allow",
|
|
209
|
-
"reason_code": "trusted_subject",
|
|
210
|
-
} if {
|
|
211
|
-
input.subject.trusted == true
|
|
212
|
-
}
|
|
213
|
-
`,description:`Create a documented fail-closed result entrypoint`},{path:`policy_engine/example/result_test.rego`,contents:`package policy_engine.example_test
|
|
214
|
-
|
|
215
|
-
import data.policy_engine.example
|
|
216
|
-
import rego.v1
|
|
217
|
-
|
|
218
|
-
test_denies_untrusted_subject if {
|
|
219
|
-
result := example.result with input as {"subject": {"trusted": false}}
|
|
220
|
-
result == {
|
|
221
|
-
"decision": "deny",
|
|
222
|
-
"reason_code": "untrusted_or_invalid_input",
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
test_fails_closed_for_missing_subject if {
|
|
227
|
-
result := example.result with input as {}
|
|
228
|
-
result == {
|
|
229
|
-
"decision": "deny",
|
|
230
|
-
"reason_code": "untrusted_or_invalid_input",
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
test_allows_trusted_subject if {
|
|
235
|
-
result := example.result with input as {"subject": {"trusted": true}}
|
|
236
|
-
result == {
|
|
237
|
-
"decision": "allow",
|
|
238
|
-
"reason_code": "trusted_subject",
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
`,description:`Create executable tests for allow and fail-closed decisions`},{path:`input.example.json`,contents:`{
|
|
242
|
-
"subject": {
|
|
243
|
-
"trusted": false
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
`,description:`Create a sanitized local evaluation input`},{path:`.gitignore`,contents:`# Local policy evaluation input.
|
|
247
|
-
/input.json
|
|
248
|
-
`,description:`Ignore only the private local input file`},{path:`README.md`,contents:`# Transcend Policy Project
|
|
249
|
-
|
|
250
|
-
This directory is an OPA document tree that can be published to Transcend Policy Engine.
|
|
251
|
-
|
|
252
|
-
The policy under \`policy_engine/example\` is disposable teaching material. Replace it with your intended package tree, input shape, and extensible result documents. Keep decisions fail-closed and cover every non-test package with \`manifest.json\`.
|
|
253
|
-
|
|
254
|
-
Validate formatting, strict Rego v1 compatibility, Regal lint, tests, and the publish contract:
|
|
255
|
-
|
|
256
|
-
\`\`\`sh
|
|
257
|
-
transcend policy lint --dir .
|
|
258
|
-
\`\`\`
|
|
259
|
-
`,description:`Create the concise policy project guide`}];function L(){return I.map(e=>({...e}))}const R=`.github/workflows/transcend-policy.yml`;function z(e,t){return e===`.`?t:T.join(e,t)}function B(e){let t=[z(e.targetDirectory,`**/*.rego`),z(e.targetDirectory,`**/*.json`),z(e.targetDirectory,`**/*.yaml`),z(e.targetDirectory,`**/*.yml`),z(e.targetDirectory,`.regal/config.yaml`),z(e.targetDirectory,`.regal.yaml`),R].map(e=>` - ${JSON.stringify(e)}`).join(`
|
|
260
|
-
`);return`# Generated by transcend policy init.
|
|
261
|
-
name: Transcend Policy
|
|
262
|
-
|
|
263
|
-
on:
|
|
264
|
-
pull_request:
|
|
265
|
-
paths:
|
|
266
|
-
${t}
|
|
267
|
-
push:
|
|
268
|
-
paths:
|
|
269
|
-
${t}
|
|
270
|
-
|
|
271
|
-
permissions:
|
|
272
|
-
contents: read
|
|
273
|
-
|
|
274
|
-
jobs:
|
|
275
|
-
lint:
|
|
276
|
-
runs-on: ubuntu-latest
|
|
277
|
-
steps:
|
|
278
|
-
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
|
279
|
-
- name: Set up OPA
|
|
280
|
-
uses: open-policy-agent/setup-opa@b2b258e089860efaadaaf71bf6e3aecb4a3eeff1 # v2.4.0
|
|
281
|
-
with:
|
|
282
|
-
version: ${JSON.stringify(F)}
|
|
283
|
-
- name: Set up Regal
|
|
284
|
-
uses: open-policy-agent/setup-regal@761188c3b435761fa254beca508a44875619648f # v2.0.0
|
|
285
|
-
with:
|
|
286
|
-
version: ${JSON.stringify(`0.42.0`)}
|
|
287
|
-
- name: Install the Transcend CLI
|
|
288
|
-
run: npm install --global @transcend-io/cli@${e.cliVersion}
|
|
289
|
-
- name: Validate Policy Engine project
|
|
290
|
-
env:
|
|
291
|
-
POLICY_DIRECTORY: ${JSON.stringify(e.targetDirectory)}
|
|
292
|
-
run: >-
|
|
293
|
-
transcend policy lint
|
|
294
|
-
--dir "$POLICY_DIRECTORY"
|
|
295
|
-
--noInteractive
|
|
296
|
-
--json
|
|
297
|
-
`}const V=`tsandall.opa`,H=`glebbash.opa-highlight-only`;function U(e,t){return JSON.stringify(e)===JSON.stringify(t)}function W(e,t){try{return{current:x(e??`{}
|
|
298
|
-
`,t)}}catch(t){return{contents:e??`{}
|
|
299
|
-
`,warning:`${t instanceof Error?t.message:String(t)} Existing content was left unchanged.`}}}function G(e,t,n,r){if(t.length===0)return{contents:e??`{}
|
|
300
|
-
`,warnings:r};try{return{contents:S(e,t,n),warnings:r}}catch(t){return{contents:e??`{}
|
|
301
|
-
`,warnings:[...r,`${t instanceof Error?t.message:String(t)} Existing content was left unchanged.`]}}}function K(e,t,n,r){t.forEach(({path:t,value:i,label:a})=>{let o=t.reduce((e,t)=>e&&typeof e==`object`&&!Array.isArray(e)?e[t]:void 0,e);o===void 0?n.push({path:t,value:i}):U(o,i)||r.push(`VS Code setting "${a}" has a repository-specific value and was left unchanged.`)})}function me(e,t){let n=E(e,t).split(D).join(`/`)||`.`;return n===`.`?"${workspaceFolder}":`\${workspaceFolder}/${n}`}function he(e,t,n){let r=W(e,`VS Code policy settings`);if(`warning`in r)return{contents:r.contents,warnings:[r.warning]};let{current:i}=r,a=[],o=[],s=i[`opa.roots`],c=me(t,n);if(s===void 0)a.push({path:[`opa.roots`],value:[c]});else if(Array.isArray(s)&&s.every(e=>typeof e==`string`)){let e=b(s,[c]);U(e,s)||a.push({path:[`opa.roots`],value:e})}else o.push(`VS Code setting "opa.roots" is customized and was left unchanged.`);K(i,[{path:[`opa.checkOnSave`],value:!0,label:`opa.checkOnSave`},{path:[`opa.strictMode`],value:!0,label:`opa.strictMode`},{path:[`opa.bundleMode`],value:!0,label:`opa.bundleMode`},{path:[`opa.formatter`],value:`opa-fmt-rego-v1`,label:`opa.formatter`}],a,o);let l=i[`[rego]`];return l===void 0?a.push({path:[`[rego]`],value:{"editor.defaultFormatter":V,"editor.formatOnSave":!0,"editor.insertSpaces":!1,"editor.tabSize":4}}):typeof l==`object`&&l&&!Array.isArray(l)?K(i,[{path:[`[rego]`,`editor.defaultFormatter`],value:V,label:`[rego].editor.defaultFormatter`},{path:[`[rego]`,`editor.formatOnSave`],value:!0,label:`[rego].editor.formatOnSave`},{path:[`[rego]`,`editor.insertSpaces`],value:!1,label:`[rego].editor.insertSpaces`},{path:[`[rego]`,`editor.tabSize`],value:4,label:`[rego].editor.tabSize`}],a,o):o.push(`VS Code language setting "[rego]" is customized and was left unchanged.`),G(e,a,`VS Code policy settings`,o)}function ge(e){let t=W(e,`VS Code policy extension recommendations`);if(`warning`in t)return{contents:t.contents,warnings:[t.warning]};let{current:n}=t,r=[],i=[],a=n.recommendations;if(a===void 0||Array.isArray(a)&&a.every(e=>typeof e==`string`)){let e=a??[],t=b(e,[V]).filter(e=>e!==H);U(e,t)||r.push({path:[`recommendations`],value:t})}else i.push(`VS Code extension recommendations use an unknown shape and were left unchanged.`);let o=n.unwantedRecommendations;if(o===void 0||Array.isArray(o)&&o.every(e=>typeof e==`string`)){let e=o??[],t=b(e,[H]);U(e,t)||r.push({path:[`unwantedRecommendations`],value:t})}else i.push(`VS Code unwanted extension recommendations use an unknown shape and were left unchanged.`);return G(e,r,`VS Code policy extension recommendations`,i)}function _e(e,t){return{label:`policy: lint`,type:`process`,command:`transcend`,args:[`policy`,`lint`,`--dir`,E(e,t).split(D).join(`/`)||`.`,`--noInteractive`],group:{kind:`test`,isDefault:!0},problemMatcher:[]}}function ve(e,t,n){let r=W(e,`VS Code policy tasks`);if(`warning`in r)return{contents:r.contents,warnings:[r.warning]};let{current:i}=r,a=[],o=[],s=i.version;s===void 0?a.push({path:[`version`],value:`2.0.0`}):s!==`2.0.0`&&o.push(`VS Code task schema version is customized and was left unchanged.`);let c=_e(t,n),l=i.tasks;if(l===void 0)a.push({path:[`tasks`],value:[c]});else if(Array.isArray(l)){let e=l.find(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&e.label===`policy: lint`);e===void 0?a.push({path:[`tasks`],value:[...l,c]}):U(e,c)||o.push(`VS Code task "policy: lint" has repository-specific customization and was left unchanged.`)}else o.push(`VS Code tasks use an unknown shape and were left unchanged.`);return G(e,a,`VS Code policy tasks`,o)}const q={name:j,displayName:`Policy Engine`,owner:`@transcend-io/cli`,files:M};function ye(e){return`transcend policy lint --dir ${_(y(e.invocationDirectory,e.targetDirectory))} --noInteractive`}function J(e,t){let n=new Set(L().map(({path:t})=>w(e.targetDirectory,t))),r=new Set(t.features);return r.has(A.Editor)&&(n.add(w(e.projectRoot,`.vscode`,`settings.json`)),n.add(w(e.projectRoot,`.vscode`,`extensions.json`)),n.add(w(e.projectRoot,`.vscode`,`tasks.json`))),r.has(A.Skill)&&d(e.projectRoot,e.existingSkillDirectories,q).forEach(e=>n.add(e)),r.has(A.Ci)&&e.repositoryRoot&&e.usesGithub&&n.add(w(e.repositoryRoot,R)),[...n].sort((e,t)=>e.localeCompare(t))}function Y(e,t){let n=E(e,t);if(n===`..`||n.startsWith(`..${D}`)||C(n))throw Error(`Refusing to modify path outside project root: ${t}`)}function be(e){let t=new Set([`input.json`]);return e.forEach(({path:e})=>{t.add(e);let n=T.dirname(e);for(;n!==`.`;)t.add(n),n=T.dirname(n)}),t}function X(e,t,n){let r=p({snapshot:re(t.snapshots,n.path),after:n.contents,description:n.description,...n.createOnly===void 0?{}:{createOnly:n.createOnly}});r?e.changes.push(r):e.unchanged.push(n.path)}function xe(e,t,n,r,i,a){X(e,t,{path:n,contents:r.contents,description:i}),e.warnings.push(...r.warnings.map(e=>`${e} (${y(a,n)})`))}function Se(e,t){let{state:n}=e,r=L(),i=ce(n),a=ye(n),o=w(n.targetDirectory,`policy_engine`,`example`,`result.rego`),s={version:1,command:`init`,rootDirectory:n.projectRoot,targetDirectory:n.targetDirectory,manifestPath:i,changes:[],unchanged:[],warnings:[],nextSteps:[a],features:[...t.features]},c=J(n,t);Y(n.projectRoot,n.targetDirectory),c.forEach(e=>Y(n.projectRoot,e));let l=!1;if(n.relativeFilePaths.length===0)l=!0,s.directoryPreconditions=[{path:n.targetDirectory,relativePaths:[...n.relativePaths]}],r.forEach(t=>{let r=w(n.targetDirectory,t.path);if(f(e.snapshots,r).kind!==`absent`)throw Error(`Expected an empty policy target, but found an entry at: ${r}`);X(s,e,{path:r,contents:t.contents,description:t.description,createOnly:!0})});else{let t=!0;r.forEach(r=>{let i=w(n.targetDirectory,r.path),a=f(e.snapshots,i);if(a.kind===`file`&&a.contents===r.contents){s.unchanged.push(i);return}t=!1,a.kind!==`absent`&&(s.unchanged.push(i),s.warnings.push(`Existing policy scaffold path was left unchanged: ${y(n.invocationDirectory,i)}`))}),l=t;let i=be(r),o=n.relativeFilePaths.some(e=>!i.has(e));(!t||o)&&s.warnings.push(`Existing policy target contains custom or partial content, so no starter files were added or overwritten. Review ${y(n.invocationDirectory,n.targetDirectory)} manually, then run \`${a}\`.`)}l&&(s.disposableExamplePath=o,s.nextSteps.push(`Edit ${_(y(n.invocationDirectory,o))}`));let u=new Set(t.features),d=n.projectRoot;if(u.has(A.Editor)){let t=w(d,`.vscode`,`settings.json`),r=w(d,`.vscode`,`extensions.json`),i=w(d,`.vscode`,`tasks.json`);[{path:t,description:`Merge strict target-scoped OPA and Rego editor settings`,merge:he},{path:r,description:`Recommend the OPA extension and discourage its syntax-only conflict`,merge:(e,t,n)=>ge(e)},{path:i,description:`Add the default target-scoped policy lint task`,merge:ve}].forEach(({path:t,description:r,merge:i})=>{let a=f(e.snapshots,t);if(a.kind!==`absent`&&a.kind!==`file`){s.unchanged.push(t),s.warnings.push(`Existing VS Code artifact is not a regular file and was left unchanged: ${y(n.invocationDirectory,t)}`);return}xe(s,e,t,i(a.kind===`file`?a.contents:null,d,n.targetDirectory),r,n.invocationDirectory)})}if(u.has(A.Skill)){let t=ee({rootDirectory:d,existingDirectories:n.existingSkillDirectories,snapshots:e.snapshots,skill:q,preserveModified:!0});s.changes.push(...t.changes),s.unchanged.push(...t.unchanged),s.warnings.push(...t.warnings.map(e=>t.unchanged.reduce((e,t)=>e.replace(t,y(n.invocationDirectory,t)),e)))}if(u.has(A.Ci))if(!n.repositoryRoot||!n.usesGithub)s.warnings.push(`GitHub Actions setup was selected, but this target is not inside a detected GitHub repository.`);else{let r=w(n.repositoryRoot,R),i=E(n.repositoryRoot,n.targetDirectory).split(D).join(`/`)||`.`,o=B({cliVersion:t.cliVersion,targetDirectory:i}),c=f(e.snapshots,r);c.kind===`absent`?X(s,e,{path:r,contents:o,description:`Add credential-free Policy Engine validation`,createOnly:!0}):c.kind===`file`&&c.contents===o?s.unchanged.push(r):(s.unchanged.push(r),s.warnings.push(`Existing GitHub Actions workflow was left unchanged: ${y(n.invocationDirectory,r)}. Adapt it manually to run \`${a}\`.`))}return s.changes.forEach(({path:e})=>Y(n.projectRoot,e)),s}const Z={[A.Editor]:`VS Code settings and lint task`,[A.Skill]:`Policy Engine Agent Skill`,[A.Ci]:`Validation-only GitHub Actions`},Q=Object.values(A);function Ce(e,t,n){return!e.json&&!e.noInteractive&&!!(t&&n)}async function we(e,t,n){let r={[A.Editor]:t.editor,[A.Skill]:t.skill,[A.Ci]:t.ci};if(!n.interactive)return Q.filter(e=>r[e]===!0);let i=Q.map(e=>({name:Z[e],value:e,checked:r[e]!==!1}));return e.checkbox(`Choose repository setup:`,i)}function $(e,n){let r=[n.stdout.trim(),n.stderr.trim()].filter(Boolean).join(`
|
|
302
|
-
`),i=e===`OPA`?o:t;return`${e===`OPA`?`OPA 1.x`:`Regal ${c} or newer`} is required, but \`${e.toLowerCase()} version\` exited with code ${n.code}${r?`: ${r}`:`.`} Install or upgrade it using the official instructions: ${i}`}async function Te(e,t,o){let l={opa:null,regal:null},u=[],d=await o(`opa`,[`version`],{cwd:t},e);if(d.error?.code===`ENOENT`)u.push(r);else{let e=`${d.stdout}\n${d.stderr}`,t=n(e);d.code===0?t?u.push(t):l.opa=s(e).version:u.push(t??$(`OPA`,d))}let f=await o(`regal`,[`version`],{cwd:t},e);if(f.error?.code===`ENOENT`)u.push(a);else{let e=`${f.stdout}\n${f.stderr}`,t=i(e,c,`the generated OPA 1.13.1 capabilities configuration`);f.code===0?t?u.push(t):l.regal=s(e).version:u.push(t??$(`Regal`,f))}return{tools:l,warnings:u}}async function Ee(t,n=k,r=ie){l(this.process);try{let i=await Te(this,this.process.cwd(),r),a=se(this,n),o=new v(this),s=Ce(t,this.process.stdin.isTTY,this.process.stderr.isTTY),c=await we(o,t,{interactive:s}),l=J(a,{features:c}),u=Se({state:a,snapshots:te(this,a.projectRoot,l)},{features:c,cliVersion:e});u.warnings.push(...i.warnings),t.json||this.logger.info(h(u,{cwd:this.process.cwd(),title:`Policy initialization plan`,details:[{label:`Target`,path:u.targetDirectory},{label:`Manifest`,path:u.manifestPath}]}));let d=u.changes.length===0||t.dryRun;if(u.changes.length>0&&!t.dryRun)if(t.yes)d=!0;else if(s)d=await o.confirm(`Apply this complete plan?`,!0);else throw Error(`The plan requires approval in a non-interactive invocation. Review with --dryRun, then pass --yes.`);d&&!t.dryRun&&u.changes.length>0&&await ae(this,u);let f=d&&!t.dryRun&&u.changes.length>0,p=d&&!t.dryRun,m=N({projectPath:_(y(this.process.cwd(),a.targetDirectory)),...u.disposableExamplePath?{examplePath:_(y(this.process.cwd(),u.disposableExamplePath))}:{},hasSkill:p&&c.includes(A.Skill),lintCommand:u.nextSteps[0]}),g=P(u,{applied:f,dryRun:t.dryRun,cwd:this.process.cwd(),aiHandoff:m,tools:i.tools});if(t.json){this.process.stdout.write(`${JSON.stringify(g)}\n`);return}if(t.dryRun){this.logger.info(O.yellow(`Dry run complete. No changes were written.`));return}if(!d){this.logger.info(O.yellow(`No changes applied.`));return}if(u.changes.length===0){let e=u.warnings.length===i.warnings.length?`Policy project is already initialized.`:`Existing policy project was left unchanged.`;this.logger.info(O.green(e))}else this.logger.info(O.green(`Policy project initialized.`));u.nextSteps.length>0&&(this.logger.info(`\n${O.bold(`Next steps`)}`),u.nextSteps.forEach(e=>this.logger.info(e))),this.logger.info(`\n${O.bold(`AI handoff — paste into your coding agent`)}`),this.logger.info(m)}catch(e){if(e instanceof ne)return this.process.exit(130);throw e}}export{Ee as init};
|
|
303
|
-
//# sourceMappingURL=impl-B5oVsX-F2.mjs.map
|