@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
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
import{n as e,r as t}from"./project-discovery-CWRjlFnC.mjs";import{join as n,resolve as r}from"node:path";import i from"js-yaml";var a=`https://raw.githubusercontent.com/transcend-io/tools/main/packages/cli/schema/permissions-policy-input.json`,o=[{preferences:[{name:`Analytics`,choice:!0,days_since_choice:42},{name:`SaleOfInfo`,choice:null}],context:{region:`US-CA`}}],s={$schema:`http://json-schema.org/draft-07/schema#`,$id:a,title:`Permissions API policy input`,description:"JSON document Sombra posts as `{ input }` when evaluating a Permissions policy bundle via the OPA Data API.",type:`object`,additionalProperties:!1,required:[`preferences`,`context`],properties:{preferences:{type:`array`,description:`Purpose preference rows from Preference Store for the current subject.`,items:{type:`object`,additionalProperties:!1,required:[`name`,`choice`],properties:{name:{type:`string`,description:`Purpose slug (for example Analytics or SaleOfInfo).`},choice:{type:[`boolean`,`null`],description:`true when opted in, false when opted out, or null when unset.`},days_since_choice:{type:`integer`,minimum:0,description:`Whole days since the preference was last set. Omitted when no timestamp is available.`}}}},context:{type:`object`,description:`Caller-supplied context for the decision (for example region). Use an empty object when none is provided.`,additionalProperties:!0}},examples:o};const c=`1.18.2`,l=`example`,u=`${l}-bundle`,d=`.manifest`,f=`permissions`,p=`transcend.io`,m=[`generic`,`permissions`];function h(e,t=`generic`){return`{
|
|
2
|
+
"$schema": "https://openpolicyagent.org/schemas/bundle/v1/manifest.schema.json",
|
|
3
|
+
"revision": "",
|
|
4
|
+
"roots": ["${e}"],
|
|
5
|
+
"rego_version": 1,
|
|
6
|
+
"metadata": {
|
|
7
|
+
"${p}": {
|
|
8
|
+
"template": "${t}"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
`}h(l,`generic`);function g(e){return`# Workspace-level Regal config for both publishable bundles under this tree.
|
|
13
|
+
# \`project.roots\` are package-path prefixes (same meaning as OPA \`.manifest\`
|
|
14
|
+
# roots), not filesystem folders. Each bundle also has its own \`.manifest\`.
|
|
15
|
+
capabilities:
|
|
16
|
+
from:
|
|
17
|
+
engine: opa
|
|
18
|
+
version: v${c}
|
|
19
|
+
project:
|
|
20
|
+
${e.length===0?` roots: []`:` roots:\n${e.map(e=>` - ${e}`).join(`
|
|
21
|
+
`)}`}
|
|
22
|
+
rego-version: 1
|
|
23
|
+
`}function _(e,t){if(e.trim().length===0){let e=[t];return{contents:g(e),roots:e}}let n;try{n=i.load(e)}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`.regal/config.yaml is not valid YAML: ${t}`)}if(n==null){let e=[t];return{contents:g(e),roots:e}}if(typeof n!=`object`||Array.isArray(n))throw Error(`.regal/config.yaml must be a YAML mapping at the top level.`);let r={...n},a=r.project;if(a!=null&&(typeof a!=`object`||Array.isArray(a)))throw Error(`.regal/config.yaml project must be a YAML mapping when present.`);let o={...a??{}},s=o.roots,l;if(s===void 0)l=[t];else if(Array.isArray(s)&&s.every(e=>typeof e==`string`))l=[...new Set([...s,t])].sort((e,t)=>e.localeCompare(t));else throw Error(".regal/config.yaml project.roots must be an array of strings. Fix the Regal config before running `transcend policy new`.");o.roots=l,o[`rego-version`]===void 0&&(o[`rego-version`]=1),r.project=o,r.capabilities===void 0&&(r.capabilities={from:{engine:`opa`,version:`v${c}`}});let u=i.dump(r,{lineWidth:-1,noRefs:!0,sortKeys:!1});return{contents:u.endsWith(`
|
|
24
|
+
`)?u:`${u}\n`,roots:l}}g([l]);const v=g([]);`${l}${l}`,`${l}${l}`;const y=`{
|
|
25
|
+
"subject": {
|
|
26
|
+
"trusted": false
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
`;`${l}`;const b=`# Local policy evaluation input (VS Code / Regal look for input.json here).
|
|
30
|
+
/input.json
|
|
31
|
+
`,x=`# Transcend Policy
|
|
32
|
+
|
|
33
|
+
Multi-bundle workspace for [Transcend Policy Engine](https://docs.transcend.io) bundles
|
|
34
|
+
(OPA / Rego v1). Requires **Transcend CLI ≥ 11** (\`transcend policy --help\`
|
|
35
|
+
should list \`init\`, \`new\`, and positional \`[directory]\` args).
|
|
36
|
+
|
|
37
|
+
Each \`*-bundle/\` directory is a separate publishable unit (own \`.manifest\`,
|
|
38
|
+
input, and query path). Add a new bundle with:
|
|
39
|
+
|
|
40
|
+
\`\`\`sh
|
|
41
|
+
transcend policy new
|
|
42
|
+
\`\`\`
|
|
43
|
+
|
|
44
|
+
## Quick start
|
|
45
|
+
|
|
46
|
+
\`\`\`sh
|
|
47
|
+
transcend policy init # create the workspace
|
|
48
|
+
transcend policy new --template generic # add a bundle from a template
|
|
49
|
+
|
|
50
|
+
transcend policy lint --noInteractive
|
|
51
|
+
transcend policy test
|
|
52
|
+
transcend policy eval transcend/policy/example-bundle \\
|
|
53
|
+
--package data.example.result \\
|
|
54
|
+
--input transcend/policy/example-bundle/input.json
|
|
55
|
+
\`\`\`
|
|
56
|
+
|
|
57
|
+
\`policy new\` also writes a gitignored \`input.json\` (copy of \`input.example.json\`)
|
|
58
|
+
for local Evaluate. \`policy lint\` / \`policy test\` default to every child with a
|
|
59
|
+
\`.manifest\` and use bundle-mode \`opa test -b\`, so both input files can coexist
|
|
60
|
+
without a merge error.
|
|
61
|
+
|
|
62
|
+
## Layout
|
|
63
|
+
|
|
64
|
+
\`\`\`
|
|
65
|
+
transcend/policy/
|
|
66
|
+
example-bundle/ # publish directory (added by policy new)
|
|
67
|
+
example/ # package root (matches .manifest roots)
|
|
68
|
+
input.example.json
|
|
69
|
+
input.json # local only (gitignored)
|
|
70
|
+
schemas/ # input JSON Schemas (editor + opa check -s)
|
|
71
|
+
.regal/config.yaml
|
|
72
|
+
\`\`\`
|
|
73
|
+
|
|
74
|
+
Replace or delete example bundles when you have a real policy. Publish each
|
|
75
|
+
bundle separately (\`transcend policy publish --bundle-name … <dir>\`).
|
|
76
|
+
|
|
77
|
+
## Bundle names and Permissions
|
|
78
|
+
|
|
79
|
+
Upload does **not** distinguish bundle kinds. What makes a bundle “Permissions”
|
|
80
|
+
is the remote name plus where Sombra queries it:
|
|
81
|
+
|
|
82
|
+
- **Permissions API** always loads the fixed remote bundle name
|
|
83
|
+
\`${f}\`. Publish that starter with
|
|
84
|
+
\`--bundle-name=${f}\`.
|
|
85
|
+
- **Generic / decide** bundles use any other \`--bundle-name\` and the decide
|
|
86
|
+
path.
|
|
87
|
+
|
|
88
|
+
Scaffolded \`.manifest\` files may include \`metadata.transcend.io.template\`
|
|
89
|
+
(\`generic\` or \`permissions\`) as an authoring hint. Upload ignores it;
|
|
90
|
+
\`policy publish\` may warn when the hint and \`--bundle-name\` disagree.
|
|
91
|
+
`;`${u}${l}`,`${u}${l}`,`${u}${d}`,`${c}`,`${l}`,`${u}`,`${u}`;const S=[{path:`.regal/config.yaml`,contents:v,description:`Pin strict Rego v1 linting to OPA ${c} capabilities`},{path:`README.md`,contents:x,description:`Create the concise multi-bundle workspace guide`}];function C(){return S.map(e=>({...e}))}const w={generic:`Generic example`,permissions:`Permission API starter`},T={generic:`example`,permissions:f};function E(e){return`${e}-bundle`}function D(e){let t=E(e);return[{path:`${t}/${d}`,contents:h(e,`generic`),description:`Create the OPA bundle .manifest`},{path:`schemas/${e}/input.json`,contents:`{
|
|
92
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
93
|
+
"$id": "https://transcend.io/policy-schemas/${e}/input.json",
|
|
94
|
+
"title": "${e===`example`?`Example policy input`:`${e} policy input`}",
|
|
95
|
+
"description": "${e===`example`?`Disposable teaching envelope for the example bundle.`:`Input envelope for the ${e} bundle.`}",
|
|
96
|
+
"type": "object",
|
|
97
|
+
"additionalProperties": true,
|
|
98
|
+
"properties": {
|
|
99
|
+
"subject": {
|
|
100
|
+
"type": "object",
|
|
101
|
+
"additionalProperties": true,
|
|
102
|
+
"properties": {
|
|
103
|
+
"trusted": {
|
|
104
|
+
"type": "boolean",
|
|
105
|
+
"description": "When true, the ${e===`example`?`example`:e} policy allows; otherwise it denies."
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
`,description:`Create the input JSON Schema for the ${e} bundle`},{path:`${t}/${e}/result/result.rego`,contents:`# METADATA
|
|
112
|
+
# title: ${e===`example`?`Disposable example result`:`${e} result`}
|
|
113
|
+
# description: |
|
|
114
|
+
# A fail-closed ${e===`example`?`teaching `:``}entrypoint. Replace this ${e===`example`?`example `:``}with the document
|
|
115
|
+
# tree and result contract required by your application.
|
|
116
|
+
# scope: package
|
|
117
|
+
# schemas:
|
|
118
|
+
# - input: schema.${e}.input
|
|
119
|
+
# entrypoint: true
|
|
120
|
+
package ${e}.result
|
|
121
|
+
|
|
122
|
+
import rego.v1
|
|
123
|
+
|
|
124
|
+
default decision := "deny"
|
|
125
|
+
|
|
126
|
+
decision := "allow" if {
|
|
127
|
+
\tinput.subject.trusted == true
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
default reason_code := "untrusted_or_invalid_input"
|
|
131
|
+
|
|
132
|
+
reason_code := "trusted_subject" if {
|
|
133
|
+
\tdecision == "allow"
|
|
134
|
+
}
|
|
135
|
+
`,description:`Create a documented fail-closed result entrypoint`},{path:`${t}/${e}/result/result_test.rego`,contents:`package ${e}.result_test
|
|
136
|
+
|
|
137
|
+
import data.${e}.result
|
|
138
|
+
import rego.v1
|
|
139
|
+
|
|
140
|
+
test_denies_untrusted_subject if {
|
|
141
|
+
\tresult.decision == "deny" with input as {"subject": {"trusted": false}}
|
|
142
|
+
\tresult.reason_code == "untrusted_or_invalid_input" with input as {"subject": {"trusted": false}}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
test_fails_closed_for_missing_subject if {
|
|
146
|
+
\tresult.decision == "deny" with input as {}
|
|
147
|
+
\tresult.reason_code == "untrusted_or_invalid_input" with input as {}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
test_allows_trusted_subject if {
|
|
151
|
+
\tresult.decision == "allow" with input as {"subject": {"trusted": true}}
|
|
152
|
+
\tresult.reason_code == "trusted_subject" with input as {"subject": {"trusted": true}}
|
|
153
|
+
}
|
|
154
|
+
`,description:`Create executable tests for allow and fail-closed decisions`},{path:`${t}/input.example.json`,contents:y,description:`Create a sanitized local evaluation input example`},{path:`${t}/input.json`,contents:y,description:`Create a local evaluation input (gitignored copy of the example)`},{path:`${t}/.gitignore`,contents:b,description:`Ignore only the private local input file`}]}function O(){return`${JSON.stringify(s,null,2)}\n`}function k(){let[e]=o;if(!e)throw Error(`permissions-policy-input.json must declare at least one example`);return`${JSON.stringify(e,null,2)}\n`}function A(e){let t=E(e),n=k();return[{path:`${t}/${d}`,contents:h(e,`permissions`),description:`Create the OPA bundle .manifest`},{path:`schemas/${e}/input.json`,contents:O(),description:`Create the input JSON Schema for the ${e} bundle (from published permissions-policy-input.json)`},{path:`${t}/${e}/config/config.rego`,contents:`# METADATA
|
|
155
|
+
# title: Permissions config
|
|
156
|
+
# description: |
|
|
157
|
+
# Static bundle configuration. Values come from data.json in this directory.
|
|
158
|
+
package ${e}.config
|
|
159
|
+
|
|
160
|
+
import rego.v1
|
|
161
|
+
`,description:`Create the static bundle configuration package`},{path:`${t}/${e}/config/data.json`,contents:`{
|
|
162
|
+
"default_consent_allowed": true,
|
|
163
|
+
"purposes": [
|
|
164
|
+
"Analytics",
|
|
165
|
+
"SaleOfInfo",
|
|
166
|
+
"Marketing",
|
|
167
|
+
"Personalization"
|
|
168
|
+
],
|
|
169
|
+
"default_consent": {}
|
|
170
|
+
}
|
|
171
|
+
`,description:`Create the static purpose configuration data`},{path:`${t}/${e}/helpers/preference/preference.rego`,contents:`# METADATA
|
|
172
|
+
# title: Purpose preference resolution
|
|
173
|
+
# description: |
|
|
174
|
+
# Resolves the subject's recorded choice for one purpose from the OPA
|
|
175
|
+
# \`input.preferences\` array Sombra injects (one \`{name, choice,
|
|
176
|
+
# days_since_choice?}\` entry per purpose; \`choice\` may be null when unset).
|
|
177
|
+
package ${e}.helpers.preference
|
|
178
|
+
|
|
179
|
+
import rego.v1
|
|
180
|
+
|
|
181
|
+
import data.${e}.config
|
|
182
|
+
|
|
183
|
+
raw_preferences := object.get(input, "preferences", [])
|
|
184
|
+
|
|
185
|
+
source_available if {
|
|
186
|
+
\tis_array(raw_preferences)
|
|
187
|
+
\tevery entry in raw_preferences {
|
|
188
|
+
\t\tis_object(entry)
|
|
189
|
+
\t\tis_string(entry.name)
|
|
190
|
+
\t\tentry.name != ""
|
|
191
|
+
\t}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
# Boolean choice for a purpose, last-wins across duplicate entries (matching
|
|
195
|
+
# Sombra's own dedup semantics). Returns the boolean only when a usable choice
|
|
196
|
+
# exists; otherwise the rule is undefined and the purpose is undecided.
|
|
197
|
+
choice(name) := choice if {
|
|
198
|
+
\tsource_available
|
|
199
|
+
\tmatching := [entry | some entry in raw_preferences; entry.name == name]
|
|
200
|
+
\tcount(matching) > 0
|
|
201
|
+
\tlast := matching[count(matching) - 1]
|
|
202
|
+
\tchoice := object.get(last, "choice", null)
|
|
203
|
+
\tis_boolean(choice)
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
enabled(name) if choice(name) == true
|
|
207
|
+
|
|
208
|
+
disabled(name) if choice(name) == false
|
|
209
|
+
|
|
210
|
+
decided(name) if enabled(name)
|
|
211
|
+
|
|
212
|
+
decided(name) if disabled(name)
|
|
213
|
+
|
|
214
|
+
# A configured purpose with no usable boolean choice is undecided: the subject
|
|
215
|
+
# never chose, so the resolved default applies (not an opt-out).
|
|
216
|
+
undecided(name) if {
|
|
217
|
+
\tname in config.purposes
|
|
218
|
+
\tnot enabled(name)
|
|
219
|
+
\tnot disabled(name)
|
|
220
|
+
}
|
|
221
|
+
`,description:`Create purpose preference resolution helpers`},{path:`${t}/${e}/helpers/preference/preference_test.rego`,contents:`# Mechanical tests for purpose preference resolution.
|
|
222
|
+
# Policy outcomes are tested beside the public entrypoint.
|
|
223
|
+
package ${e}.helpers.preference_test
|
|
224
|
+
|
|
225
|
+
import rego.v1
|
|
226
|
+
|
|
227
|
+
import data.${e}.helpers.preference
|
|
228
|
+
|
|
229
|
+
given(preferences) := {"preferences": preferences}
|
|
230
|
+
|
|
231
|
+
test_treats_an_absent_preferences_array_as_no_recorded_choices if {
|
|
232
|
+
\tfixture := {}
|
|
233
|
+
|
|
234
|
+
\tpreference.source_available with input as fixture
|
|
235
|
+
\tpreference.undecided("Marketing") with input as fixture
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
test_accepts_an_empty_preferences_array if {
|
|
239
|
+
\tfixture := given([])
|
|
240
|
+
|
|
241
|
+
\tpreference.source_available with input as fixture
|
|
242
|
+
\tpreference.undecided("Marketing") with input as fixture
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
test_reports_a_non_array_preferences_as_unavailable if {
|
|
246
|
+
\tnot preference.source_available with input as {"preferences": {"Marketing": true}}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
test_reports_entries_without_a_usable_name_as_unavailable if {
|
|
250
|
+
\tnot preference.source_available with input as {"preferences": [{}]}
|
|
251
|
+
\tnot preference.source_available with input as {"preferences": [{"name": ""}]}
|
|
252
|
+
\tnot preference.source_available with input as {"preferences": [{"choice": true}]}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
test_distinguishes_enabled_and_disabled_choices if {
|
|
256
|
+
\tfixture := given([
|
|
257
|
+
\t\t{"name": "Marketing", "choice": true},
|
|
258
|
+
\t\t{"name": "Analytics", "choice": false},
|
|
259
|
+
\t])
|
|
260
|
+
|
|
261
|
+
\tpreference.enabled("Marketing") with input as fixture
|
|
262
|
+
\tpreference.disabled("Analytics") with input as fixture
|
|
263
|
+
\tpreference.decided("Marketing") with input as fixture
|
|
264
|
+
\tpreference.decided("Analytics") with input as fixture
|
|
265
|
+
\tnot preference.undecided("Marketing") with input as fixture
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
test_treats_a_null_choice_as_undecided if {
|
|
269
|
+
\tfixture := given([{"name": "Marketing", "choice": null}])
|
|
270
|
+
|
|
271
|
+
\tpreference.undecided("Marketing") with input as fixture
|
|
272
|
+
\tnot preference.decided("Marketing") with input as fixture
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
test_treats_an_absent_choice_key_as_undecided if {
|
|
276
|
+
\tfixture := given([{"name": "Marketing", "channel": "email"}])
|
|
277
|
+
|
|
278
|
+
\tpreference.undecided("Marketing") with input as fixture
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
test_treats_a_non_boolean_choice_as_undecided if {
|
|
282
|
+
\tfixture := given([{"name": "Personalization", "choice": "Daily"}])
|
|
283
|
+
|
|
284
|
+
\tpreference.undecided("Personalization") with input as fixture
|
|
285
|
+
\tnot preference.decided("Personalization") with input as fixture
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
# Sombra dedupes by purpose before sending; last-wins keeps the bundle correct
|
|
289
|
+
# against hand-crafted input that names the same purpose twice.
|
|
290
|
+
test_last_wins_on_duplicate_entries if {
|
|
291
|
+
\tfixture := given([
|
|
292
|
+
\t\t{"name": "SaleOfInfo", "choice": true},
|
|
293
|
+
\t\t{"name": "SaleOfInfo", "choice": false},
|
|
294
|
+
\t])
|
|
295
|
+
|
|
296
|
+
\tpreference.disabled("SaleOfInfo") with input as fixture
|
|
297
|
+
\tnot preference.enabled("SaleOfInfo") with input as fixture
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
# Extra fields on an entry (evidence, days_since_choice, channel) are ignored
|
|
301
|
+
# rather than treated as a choice.
|
|
302
|
+
test_ignores_fields_beyond_the_recorded_choice if {
|
|
303
|
+
\tfixture := given([{
|
|
304
|
+
\t\t"name": "Marketing",
|
|
305
|
+
\t\t"choice": true,
|
|
306
|
+
\t\t"evidence": "consent_banner",
|
|
307
|
+
\t\t"days_since_choice": 45,
|
|
308
|
+
\t\t"channel": "email",
|
|
309
|
+
\t}])
|
|
310
|
+
|
|
311
|
+
\tpreference.enabled("Marketing") with input as fixture
|
|
312
|
+
}
|
|
313
|
+
`,description:`Create preference resolution tests`},{path:`${t}/${e}/main.rego`,contents:`# METADATA
|
|
314
|
+
# title: Permissions bundle root
|
|
315
|
+
# description: |
|
|
316
|
+
# Declares the Permissions envelope schema for this package and all
|
|
317
|
+
# subpackages (helpers, purposes, and static config data).
|
|
318
|
+
# scope: subpackages
|
|
319
|
+
# schemas:
|
|
320
|
+
# - input: schema.${e}.input
|
|
321
|
+
package ${e}
|
|
322
|
+
|
|
323
|
+
import rego.v1
|
|
324
|
+
`,description:`Create the bundle root package with schema declaration`},{path:`${t}/${e}/purposes/analytics/analytics.rego`,contents:`# METADATA
|
|
325
|
+
# title: Analytics purpose decision
|
|
326
|
+
# description: |
|
|
327
|
+
# The Analytics purpose's verdict as a \`result\` document
|
|
328
|
+
# (\`data.${e}.purposes.analytics.result\`).
|
|
329
|
+
package ${e}.purposes.analytics
|
|
330
|
+
|
|
331
|
+
import rego.v1
|
|
332
|
+
|
|
333
|
+
import data.${e}.helpers.preference
|
|
334
|
+
|
|
335
|
+
default result := {
|
|
336
|
+
\t"decision": "deny",
|
|
337
|
+
\t"reason_code": "default_deny",
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
result := {
|
|
341
|
+
\t"decision": "allow",
|
|
342
|
+
\t"reason_code": "explicit_allow",
|
|
343
|
+
} if {
|
|
344
|
+
\tpreference.enabled("Analytics")
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
result := {
|
|
348
|
+
\t"decision": "deny",
|
|
349
|
+
\t"reason_code": "explicit_deny",
|
|
350
|
+
} if {
|
|
351
|
+
\tpreference.disabled("Analytics")
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
result := {
|
|
355
|
+
\t"decision": "allow",
|
|
356
|
+
\t"reason_code": "default_allow",
|
|
357
|
+
} if {
|
|
358
|
+
\tpreference.undecided("Analytics")
|
|
359
|
+
}
|
|
360
|
+
`,description:`Create the analytics purpose decision rule`},{path:`${t}/${e}/purposes/analytics/analytics_test.rego`,contents:`# Policy outcomes for the Analytics purpose (the queried document).
|
|
361
|
+
package ${e}.purposes.analytics_test
|
|
362
|
+
|
|
363
|
+
import rego.v1
|
|
364
|
+
|
|
365
|
+
import data.${e}.purposes.analytics
|
|
366
|
+
|
|
367
|
+
given(preferences) := {"preferences": preferences}
|
|
368
|
+
|
|
369
|
+
test_explicit_allow if {
|
|
370
|
+
\tresult := analytics.result with input as given([{"name": "Analytics", "choice": true}])
|
|
371
|
+
\tresult == {
|
|
372
|
+
\t\t"decision": "allow",
|
|
373
|
+
\t\t"reason_code": "explicit_allow",
|
|
374
|
+
\t}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
test_explicit_deny if {
|
|
378
|
+
\tresult := analytics.result with input as given([{"name": "Analytics", "choice": false}])
|
|
379
|
+
\tresult == {
|
|
380
|
+
\t\t"decision": "deny",
|
|
381
|
+
\t\t"reason_code": "explicit_deny",
|
|
382
|
+
\t}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
test_undecided_resolves_to_default_allow if {
|
|
386
|
+
\tresult := analytics.result with input as given([])
|
|
387
|
+
\tresult == {
|
|
388
|
+
\t\t"decision": "allow",
|
|
389
|
+
\t\t"reason_code": "default_allow",
|
|
390
|
+
\t}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
test_missing_preferences_resolves_to_default_allow if {
|
|
394
|
+
\tresult := analytics.result with input as {}
|
|
395
|
+
\tresult == {
|
|
396
|
+
\t\t"decision": "allow",
|
|
397
|
+
\t\t"reason_code": "default_allow",
|
|
398
|
+
\t}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
test_non_boolean_choice_falls_back_to_default_allow if {
|
|
402
|
+
\tresult := analytics.result with input as given([{"name": "Analytics", "choice": "yes"}])
|
|
403
|
+
\tresult == {
|
|
404
|
+
\t\t"decision": "allow",
|
|
405
|
+
\t\t"reason_code": "default_allow",
|
|
406
|
+
\t}
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
test_malformed_preferences_are_treated_as_undecided if {
|
|
410
|
+
\t# source_available is false, so enabled/disabled never fire; undecided still
|
|
411
|
+
\t# holds for configured purposes (not enabled and not disabled).
|
|
412
|
+
\tresult := analytics.result with input as {"preferences": {"Analytics": true}}
|
|
413
|
+
\tresult == {
|
|
414
|
+
\t\t"decision": "allow",
|
|
415
|
+
\t\t"reason_code": "default_allow",
|
|
416
|
+
\t}
|
|
417
|
+
}
|
|
418
|
+
`,description:`Create analytics purpose decision tests`},{path:`${t}/${e}/purposes/entrypoint.rego`,contents:`# METADATA
|
|
419
|
+
# title: Purpose decisions
|
|
420
|
+
# description: Returns each purpose's decision and reason code.
|
|
421
|
+
# scope: package
|
|
422
|
+
# entrypoint: true
|
|
423
|
+
package ${e}.purposes
|
|
424
|
+
|
|
425
|
+
import rego.v1
|
|
426
|
+
`,description:`Create the purposes entrypoint`},{path:`${t}/input.example.json`,contents:n,description:`Create a sanitized permissions evaluation input example`},{path:`${t}/input.json`,contents:n,description:`Create a local evaluation input (gitignored copy of the example)`},{path:`${t}/.gitignore`,contents:b,description:`Ignore only the private local input file`}]}function j(e,t){switch(e){case`generic`:return D(t);case`permissions`:return A(t);default:throw Error(`Unknown policy template: ${String(e)}`)}}const M=`transcend/policy`;function N(e,t=M){return r(e,t)}function P(e,t){if(!e.fs.existsSync(t)||!e.fs.statSync(t).isDirectory())return[];let r=n(t,d);return e.fs.existsSync(r)&&e.fs.statSync(r).isFile()?[t]:e.fs.readdirSync(t,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>n(t,e.name)).filter(t=>{let r=n(t,d);return e.fs.existsSync(r)&&e.fs.statSync(r).isFile()}).sort((e,t)=>e.localeCompare(t))}function F(n,r=M){let i=n.process.cwd(),a=N(i,r);if(n.fs.existsSync(a)&&!n.fs.statSync(a).isDirectory())throw Error(`Policy target is not a directory: ${a}`);return{invocationDirectory:i,targetDirectory:a,...t(n,{invocationDirectory:i,targetDirectory:a,standaloneProjectRoot:i}),relativePaths:e(n,a),relativeFilePaths:e(n,a,{includeDirectories:!1})}}export{_,f as a,u as c,T as d,m as f,C as g,j as h,N as i,c as l,E as m,P as n,d as o,w as p,F as r,p as s,M as t,l as u};
|
|
427
|
+
//# sourceMappingURL=policy-project-discovery-C29UxWwt.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy-project-discovery-C29UxWwt.mjs","names":["permissionsPolicyInputSchema.$id","permissionsPolicyInputSchema","permissionsPolicyInputSchema.examples"],"sources":["../schema/permissions-policy-input.json","../src/lib/policy/policy-scaffold-templates.ts","../src/lib/policy/policy-project-discovery.ts"],"sourcesContent":["","import yaml from 'js-yaml';\n\nimport permissionsPolicyInputSchema from '../../../schema/permissions-policy-input.json' with { type: 'json' };\n\n/** Published Permissions API OPA input schema `$id` (raw GitHub URL). */\nexport const PERMISSIONS_POLICY_INPUT_SCHEMA_ID = permissionsPolicyInputSchema.$id;\n\n/** OPA version targeted by generated policy authoring configuration. */\nexport const POLICY_STARTER_OPA_VERSION = '1.18.2';\n\n/**\n * Package-path prefix for the disposable starter bundle.\n *\n * Matches OPA `.manifest` `roots` and Regal `project.roots` (not a filesystem\n * folder name by itself). The publish directory is `{root}-bundle/`.\n */\nexport const POLICY_STARTER_ROOT = 'example';\n\n/** Publish directory name for the disposable starter (`{root}-bundle`). */\nexport const POLICY_STARTER_BUNDLE_DIRECTORY = `${POLICY_STARTER_ROOT}-bundle`;\n\n/** One deterministic file in the safe policy starter. */\nexport interface PolicyStarterFile {\n /** POSIX-style path relative to the policy workspace directory. */\n path: string;\n /** Complete UTF-8 file contents. */\n contents: string;\n /** Human-readable reason shown in the plan. */\n description: string;\n}\n\n/** OPA bundle manifest filename used for local authoring and upload. */\nexport const POLICY_MANIFEST_FILENAME = '.manifest';\n\n/**\n * Remote bundle name reserved for Permissions API.\n *\n * Upload treats every bundle the same; Sombra's Permissions API always queries\n * this fixed name (never taken from the request body).\n */\nexport const PERMISSIONS_POLICY_BUNDLE_NAME = 'permissions';\n\n/** OPA `.manifest` `metadata` key for Transcend authoring hints. */\nexport const POLICY_MANIFEST_TRANSCEND_METADATA_KEY = 'transcend.io';\n\n/** Supported policy bundle template names. */\nexport const POLICY_TEMPLATE_NAMES = ['generic', 'permissions'] as const;\n\n/** A supported policy bundle template name. */\nexport type PolicyTemplateName = (typeof POLICY_TEMPLATE_NAMES)[number];\n\n/**\n * Build an OPA bundle manifest for a given root and scaffold template.\n *\n * `metadata.transcend.io.template` is an authoring hint only — Policy Engine\n * upload does not branch on it. Permissions API still keys off the remote\n * bundle name {@link PERMISSIONS_POLICY_BUNDLE_NAME}.\n *\n * @param root - Package root\n * @param template - Scaffold template that produced this bundle\n * @returns Manifest JSON\n */\nexport function buildPolicyManifestTemplate(\n root: string,\n template: PolicyTemplateName = 'generic',\n): string {\n return `{\n \"$schema\": \"https://openpolicyagent.org/schemas/bundle/v1/manifest.schema.json\",\n \"revision\": \"\",\n \"roots\": [\"${root}\"],\n \"rego_version\": 1,\n \"metadata\": {\n \"${POLICY_MANIFEST_TRANSCEND_METADATA_KEY}\": {\n \"template\": \"${template}\"\n }\n }\n}\n`;\n}\n\n/** OPA bundle manifest for the disposable starter publish directory. */\nexport const POLICY_MANIFEST_TEMPLATE = buildPolicyManifestTemplate(POLICY_STARTER_ROOT, 'generic');\n\n/**\n * Build workspace-level Regal configuration for given roots.\n *\n * `project.roots` are package-path prefixes (same meaning as OPA `.manifest`\n * roots), not filesystem folders.\n *\n * @param roots - Package-path roots\n * @returns YAML configuration\n */\nexport function buildPolicyRegalConfigTemplate(roots: readonly string[]): string {\n const rootsSection =\n roots.length === 0\n ? ' roots: []'\n : ` roots:\\n${roots.map((root) => ` - ${root}`).join('\\n')}`;\n return `# Workspace-level Regal config for both publishable bundles under this tree.\n# \\`project.roots\\` are package-path prefixes (same meaning as OPA \\`.manifest\\`\n# roots), not filesystem folders. Each bundle also has its own \\`.manifest\\`.\ncapabilities:\n from:\n engine: opa\n version: v${POLICY_STARTER_OPA_VERSION}\nproject:\n${rootsSection}\n rego-version: 1\n`;\n}\n\n/**\n * Merge one package-path root into an existing Regal config without wiping\n * unrelated keys (custom rules, ignores, etc.).\n *\n * Comments and key order may be reformatted by the YAML serializer. Invalid\n * `project.roots` shapes throw instead of silently dropping prior roots.\n *\n * @param existingContents - Current `.regal/config.yaml` contents\n * @param rootToAdd - Package-path root to include\n * @returns Updated file contents and the full roots list\n */\nexport function mergePolicyRegalConfigRoots(\n existingContents: string,\n rootToAdd: string,\n): { contents: string; roots: string[] } {\n const trimmed = existingContents.trim();\n if (trimmed.length === 0) {\n const roots = [rootToAdd];\n return { contents: buildPolicyRegalConfigTemplate(roots), roots };\n }\n\n let parsed: unknown;\n try {\n parsed = yaml.load(existingContents);\n } catch (error) {\n const detail = error instanceof Error ? error.message : String(error);\n throw new Error(`.regal/config.yaml is not valid YAML: ${detail}`);\n }\n\n if (parsed === null || parsed === undefined) {\n const roots = [rootToAdd];\n return { contents: buildPolicyRegalConfigTemplate(roots), roots };\n }\n if (typeof parsed !== 'object' || Array.isArray(parsed)) {\n throw new Error('.regal/config.yaml must be a YAML mapping at the top level.');\n }\n\n const config = { ...(parsed as Record<string, unknown>) };\n const existingProject = config.project;\n if (\n existingProject !== undefined &&\n existingProject !== null &&\n (typeof existingProject !== 'object' || Array.isArray(existingProject))\n ) {\n throw new Error('.regal/config.yaml project must be a YAML mapping when present.');\n }\n\n const project: Record<string, unknown> = {\n ...((existingProject as Record<string, unknown> | undefined) ?? {}),\n };\n const existingRoots = project.roots;\n let roots: string[];\n if (existingRoots === undefined) {\n roots = [rootToAdd];\n } else if (\n Array.isArray(existingRoots) &&\n existingRoots.every((root): root is string => typeof root === 'string')\n ) {\n roots = [...new Set([...existingRoots, rootToAdd])].sort((left, right) =>\n left.localeCompare(right),\n );\n } else {\n throw new Error(\n '.regal/config.yaml project.roots must be an array of strings. ' +\n 'Fix the Regal config before running `transcend policy new`.',\n );\n }\n\n project.roots = roots;\n if (project['rego-version'] === undefined) {\n project['rego-version'] = 1;\n }\n config.project = project;\n\n if (config.capabilities === undefined) {\n config.capabilities = {\n from: {\n engine: 'opa',\n version: `v${POLICY_STARTER_OPA_VERSION}`,\n },\n };\n }\n\n const dumped = yaml.dump(config, {\n lineWidth: -1,\n noRefs: true,\n sortKeys: false,\n });\n return {\n contents: dumped.endsWith('\\n') ? dumped : `${dumped}\\n`,\n roots,\n };\n}\n\n/**\n * Workspace-level Regal configuration.\n *\n * `project.roots` are package-path prefixes (same meaning as OPA `.manifest`\n * roots), not filesystem folders.\n */\nexport const POLICY_REGAL_CONFIG_TEMPLATE = buildPolicyRegalConfigTemplate([POLICY_STARTER_ROOT]);\n\n/** Regal config for an empty workspace with no bundles yet. */\nexport const POLICY_REGAL_CONFIG_EMPTY_TEMPLATE = buildPolicyRegalConfigTemplate([]);\n\n/** Disposable, fail-closed example policy. */\nexport const POLICY_RESULT_REGO_TEMPLATE = `# METADATA\n# title: Disposable example result\n# description: |\n# A fail-closed teaching entrypoint. Replace this example with the document\n# tree and result contract required by your application.\n# scope: package\n# schemas:\n# - input: schema.${POLICY_STARTER_ROOT}.input\n# entrypoint: true\npackage ${POLICY_STARTER_ROOT}.result\n\nimport rego.v1\n\ndefault decision := \"deny\"\n\ndecision := \"allow\" if {\n\tinput.subject.trusted == true\n}\n\ndefault reason_code := \"untrusted_or_invalid_input\"\n\nreason_code := \"trusted_subject\" if {\n\tdecision == \"allow\"\n}\n`;\n\n/** Executable tests adjacent to the disposable example policy. */\nexport const POLICY_RESULT_TEST_REGO_TEMPLATE = `package ${POLICY_STARTER_ROOT}.result_test\n\nimport data.${POLICY_STARTER_ROOT}.result\nimport rego.v1\n\ntest_denies_untrusted_subject if {\n\tresult.decision == \"deny\" with input as {\"subject\": {\"trusted\": false}}\n\tresult.reason_code == \"untrusted_or_invalid_input\" with input as {\"subject\": {\"trusted\": false}}\n}\n\ntest_fails_closed_for_missing_subject if {\n\tresult.decision == \"deny\" with input as {}\n\tresult.reason_code == \"untrusted_or_invalid_input\" with input as {}\n}\n\ntest_allows_trusted_subject if {\n\tresult.decision == \"allow\" with input as {\"subject\": {\"trusted\": true}}\n\tresult.reason_code == \"trusted_subject\" with input as {\"subject\": {\"trusted\": true}}\n}\n`;\n\n/** Sanitized local input example containing no credentials or personal data. */\nexport const POLICY_INPUT_EXAMPLE_TEMPLATE = `{\n \"subject\": {\n \"trusted\": false\n }\n}\n`;\n\n/** Input JSON Schema for the disposable starter (editor + \\`opa check -s\\`). */\nexport const POLICY_INPUT_SCHEMA_TEMPLATE = `{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": \"https://transcend.io/policy-schemas/${POLICY_STARTER_ROOT}/input.json\",\n \"title\": \"Example policy input\",\n \"description\": \"Disposable teaching envelope for the example bundle.\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"subject\": {\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"trusted\": {\n \"type\": \"boolean\",\n \"description\": \"When true, the example policy allows; otherwise it denies.\"\n }\n }\n }\n }\n}\n`;\n\n/** Target-local ignore rules for private evaluation input only. */\nexport const POLICY_GITIGNORE_TEMPLATE = `# Local policy evaluation input (VS Code / Regal look for input.json here).\n/input.json\n`;\n\n/** Concise workspace-local authoring guide (multi-bundle, empty workspace). */\nexport const POLICY_README_TEMPLATE = `# Transcend Policy\n\nMulti-bundle workspace for [Transcend Policy Engine](https://docs.transcend.io) bundles\n(OPA / Rego v1). Requires **Transcend CLI ≥ 11** (\\`transcend policy --help\\`\nshould list \\`init\\`, \\`new\\`, and positional \\`[directory]\\` args).\n\nEach \\`*-bundle/\\` directory is a separate publishable unit (own \\`.manifest\\`,\ninput, and query path). Add a new bundle with:\n\n\\`\\`\\`sh\ntranscend policy new\n\\`\\`\\`\n\n## Quick start\n\n\\`\\`\\`sh\ntranscend policy init # create the workspace\ntranscend policy new --template generic # add a bundle from a template\n\ntranscend policy lint --noInteractive\ntranscend policy test\ntranscend policy eval transcend/policy/example-bundle \\\\\n --package data.example.result \\\\\n --input transcend/policy/example-bundle/input.json\n\\`\\`\\`\n\n\\`policy new\\` also writes a gitignored \\`input.json\\` (copy of \\`input.example.json\\`)\nfor local Evaluate. \\`policy lint\\` / \\`policy test\\` default to every child with a\n\\`.manifest\\` and use bundle-mode \\`opa test -b\\`, so both input files can coexist\nwithout a merge error.\n\n## Layout\n\n\\`\\`\\`\ntranscend/policy/\n example-bundle/ # publish directory (added by policy new)\n example/ # package root (matches .manifest roots)\n input.example.json\n input.json # local only (gitignored)\n schemas/ # input JSON Schemas (editor + opa check -s)\n .regal/config.yaml\n\\`\\`\\`\n\nReplace or delete example bundles when you have a real policy. Publish each\nbundle separately (\\`transcend policy publish --bundle-name … <dir>\\`).\n\n## Bundle names and Permissions\n\nUpload does **not** distinguish bundle kinds. What makes a bundle “Permissions”\nis the remote name plus where Sombra queries it:\n\n- **Permissions API** always loads the fixed remote bundle name\n \\`${PERMISSIONS_POLICY_BUNDLE_NAME}\\`. Publish that starter with\n \\`--bundle-name=${PERMISSIONS_POLICY_BUNDLE_NAME}\\`.\n- **Generic / decide** bundles use any other \\`--bundle-name\\` and the decide\n path.\n\nScaffolded \\`.manifest\\` files may include \\`metadata.transcend.io.template\\`\n(\\`generic\\` or \\`permissions\\`) as an authoring hint. Upload ignores it;\n\\`policy publish\\` may warn when the hint and \\`--bundle-name\\` disagree.\n`;\n\n/** Workspace-relative path to the disposable example entrypoint. */\nexport const POLICY_STARTER_RESULT_REGO_PATH = `${POLICY_STARTER_BUNDLE_DIRECTORY}/${POLICY_STARTER_ROOT}/result/result.rego`;\n\n/** Workspace-relative path to the disposable example tests. */\nexport const POLICY_STARTER_RESULT_TEST_REGO_PATH = `${POLICY_STARTER_BUNDLE_DIRECTORY}/${POLICY_STARTER_ROOT}/result/result_test.rego`;\n\n/** Complete safe starter in deterministic plan order. */\nconst POLICY_STARTER_FILES: readonly PolicyStarterFile[] = [\n {\n path: `${POLICY_STARTER_BUNDLE_DIRECTORY}/${POLICY_MANIFEST_FILENAME}`,\n contents: POLICY_MANIFEST_TEMPLATE,\n description: 'Create the OPA bundle .manifest',\n },\n {\n path: '.regal/config.yaml',\n contents: POLICY_REGAL_CONFIG_TEMPLATE,\n description: `Pin strict Rego v1 linting to OPA ${POLICY_STARTER_OPA_VERSION} capabilities`,\n },\n {\n path: `schemas/${POLICY_STARTER_ROOT}/input.json`,\n contents: POLICY_INPUT_SCHEMA_TEMPLATE,\n description: 'Create the input JSON Schema for the example bundle',\n },\n {\n path: POLICY_STARTER_RESULT_REGO_PATH,\n contents: POLICY_RESULT_REGO_TEMPLATE,\n description: 'Create a documented fail-closed result entrypoint',\n },\n {\n path: POLICY_STARTER_RESULT_TEST_REGO_PATH,\n contents: POLICY_RESULT_TEST_REGO_TEMPLATE,\n description: 'Create executable tests for allow and fail-closed decisions',\n },\n {\n path: `${POLICY_STARTER_BUNDLE_DIRECTORY}/input.example.json`,\n contents: POLICY_INPUT_EXAMPLE_TEMPLATE,\n description: 'Create a sanitized local evaluation input',\n },\n {\n path: `${POLICY_STARTER_BUNDLE_DIRECTORY}/.gitignore`,\n contents: POLICY_GITIGNORE_TEMPLATE,\n description: 'Ignore only the private local input file',\n },\n {\n path: 'README.md',\n contents: POLICY_README_TEMPLATE,\n description: 'Create the concise policy project guide',\n },\n];\n\n/**\n * Generate an independent copy of the safe policy starter.\n *\n * @returns Deterministic relative files\n */\nexport function generatePolicyStarterFiles(): PolicyStarterFile[] {\n return POLICY_STARTER_FILES.map((file) => ({ ...file }));\n}\n\n// ---------------------------------------------------------------------------\n// Workspace-only init files (no bundles)\n// ---------------------------------------------------------------------------\n\n/** Files created by `policy init` — empty workspace only. */\nconst POLICY_INIT_WORKSPACE_FILES: readonly PolicyStarterFile[] = [\n {\n path: '.regal/config.yaml',\n contents: POLICY_REGAL_CONFIG_EMPTY_TEMPLATE,\n description: `Pin strict Rego v1 linting to OPA ${POLICY_STARTER_OPA_VERSION} capabilities`,\n },\n {\n path: 'README.md',\n contents: POLICY_README_TEMPLATE,\n description: 'Create the concise multi-bundle workspace guide',\n },\n];\n\n/**\n * Generate files for an empty workspace (init without bundles).\n *\n * @returns Deterministic workspace files\n */\nexport function generatePolicyWorkspaceFiles(): PolicyStarterFile[] {\n return POLICY_INIT_WORKSPACE_FILES.map((file) => ({ ...file }));\n}\n\n// ---------------------------------------------------------------------------\n// Policy bundle templates (used by `policy new`)\n// ---------------------------------------------------------------------------\n\n/** Interactive labels for each policy template. */\nexport const POLICY_TEMPLATE_PROMPT_LABELS: Record<PolicyTemplateName, string> = {\n generic: 'Generic example',\n permissions: 'Permission API starter',\n};\n\n/** Default root names for each template. */\nexport const POLICY_TEMPLATE_DEFAULT_ROOTS: Record<PolicyTemplateName, string> = {\n generic: 'example',\n permissions: PERMISSIONS_POLICY_BUNDLE_NAME,\n};\n\n/**\n * Build the bundle directory name from a root.\n *\n * @param root - Package root\n * @returns Bundle directory name\n */\nexport function buildBundleDirectoryName(root: string): string {\n return `${root}-bundle`;\n}\n\n/**\n * Generate bundle files for the generic template.\n *\n * @param root - Package root name\n * @returns Bundle files relative to the workspace\n */\nexport function generateGenericBundleFiles(root: string): PolicyStarterFile[] {\n const bundle = buildBundleDirectoryName(root);\n return [\n {\n path: `${bundle}/${POLICY_MANIFEST_FILENAME}`,\n contents: buildPolicyManifestTemplate(root, 'generic'),\n description: 'Create the OPA bundle .manifest',\n },\n {\n path: `schemas/${root}/input.json`,\n contents: `{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": \"https://transcend.io/policy-schemas/${root}/input.json\",\n \"title\": \"${root === 'example' ? 'Example policy input' : `${root} policy input`}\",\n \"description\": \"${root === 'example' ? 'Disposable teaching envelope for the example bundle.' : `Input envelope for the ${root} bundle.`}\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"subject\": {\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"trusted\": {\n \"type\": \"boolean\",\n \"description\": \"When true, the ${root === 'example' ? 'example' : root} policy allows; otherwise it denies.\"\n }\n }\n }\n }\n}\n`,\n description: `Create the input JSON Schema for the ${root} bundle`,\n },\n {\n path: `${bundle}/${root}/result/result.rego`,\n contents: `# METADATA\n# title: ${root === 'example' ? 'Disposable example result' : `${root} result`}\n# description: |\n# A fail-closed ${root === 'example' ? 'teaching ' : ''}entrypoint. Replace this ${root === 'example' ? 'example ' : ''}with the document\n# tree and result contract required by your application.\n# scope: package\n# schemas:\n# - input: schema.${root}.input\n# entrypoint: true\npackage ${root}.result\n\nimport rego.v1\n\ndefault decision := \"deny\"\n\ndecision := \"allow\" if {\n\\tinput.subject.trusted == true\n}\n\ndefault reason_code := \"untrusted_or_invalid_input\"\n\nreason_code := \"trusted_subject\" if {\n\\tdecision == \"allow\"\n}\n`,\n description: 'Create a documented fail-closed result entrypoint',\n },\n {\n path: `${bundle}/${root}/result/result_test.rego`,\n contents: `package ${root}.result_test\n\nimport data.${root}.result\nimport rego.v1\n\ntest_denies_untrusted_subject if {\n\\tresult.decision == \"deny\" with input as {\"subject\": {\"trusted\": false}}\n\\tresult.reason_code == \"untrusted_or_invalid_input\" with input as {\"subject\": {\"trusted\": false}}\n}\n\ntest_fails_closed_for_missing_subject if {\n\\tresult.decision == \"deny\" with input as {}\n\\tresult.reason_code == \"untrusted_or_invalid_input\" with input as {}\n}\n\ntest_allows_trusted_subject if {\n\\tresult.decision == \"allow\" with input as {\"subject\": {\"trusted\": true}}\n\\tresult.reason_code == \"trusted_subject\" with input as {\"subject\": {\"trusted\": true}}\n}\n`,\n description: 'Create executable tests for allow and fail-closed decisions',\n },\n {\n path: `${bundle}/input.example.json`,\n contents: POLICY_INPUT_EXAMPLE_TEMPLATE,\n description: 'Create a sanitized local evaluation input example',\n },\n {\n path: `${bundle}/input.json`,\n contents: POLICY_INPUT_EXAMPLE_TEMPLATE,\n description: 'Create a local evaluation input (gitignored copy of the example)',\n },\n {\n path: `${bundle}/.gitignore`,\n contents: POLICY_GITIGNORE_TEMPLATE,\n description: 'Ignore only the private local input file',\n },\n ];\n}\n\n/**\n * Generate bundle files for the permissions template.\n *\n * @param root - Package root name\n * @returns Bundle files relative to the workspace\n */\n/**\n * Serialize the published Permissions input schema for a local OPA schema path.\n *\n * OPA maps `schemas/{root}/input.json` → `schema.{root}.input`; the file is a\n * copy of the published schema so type-checking works offline.\n *\n * @returns Schema file contents ending in a trailing newline\n */\nexport function buildPermissionsInputSchemaContents(): string {\n return `${JSON.stringify(permissionsPolicyInputSchema, null, 2)}\\n`;\n}\n\n/**\n * Serialize the published Permissions input example for local evaluation.\n *\n * @returns Example input JSON ending in a trailing newline\n */\nexport function buildPermissionsInputExampleContents(): string {\n const [example] = permissionsPolicyInputSchema.examples;\n if (!example) {\n throw new Error('permissions-policy-input.json must declare at least one example');\n }\n return `${JSON.stringify(example, null, 2)}\\n`;\n}\n\n/**\n * Generate bundle files for the permissions template.\n *\n * @param root - Package root name\n * @returns Bundle files relative to the workspace\n */\nexport function generatePermissionsBundleFiles(root: string): PolicyStarterFile[] {\n const bundle = buildBundleDirectoryName(root);\n const inputExample = buildPermissionsInputExampleContents();\n return [\n {\n path: `${bundle}/${POLICY_MANIFEST_FILENAME}`,\n contents: buildPolicyManifestTemplate(root, 'permissions'),\n description: 'Create the OPA bundle .manifest',\n },\n {\n path: `schemas/${root}/input.json`,\n contents: buildPermissionsInputSchemaContents(),\n description: `Create the input JSON Schema for the ${root} bundle (from published permissions-policy-input.json)`,\n },\n {\n path: `${bundle}/${root}/config/config.rego`,\n contents: `# METADATA\n# title: Permissions config\n# description: |\n# Static bundle configuration. Values come from data.json in this directory.\npackage ${root}.config\n\nimport rego.v1\n`,\n description: 'Create the static bundle configuration package',\n },\n {\n path: `${bundle}/${root}/config/data.json`,\n contents: `{\n \"default_consent_allowed\": true,\n \"purposes\": [\n \"Analytics\",\n \"SaleOfInfo\",\n \"Marketing\",\n \"Personalization\"\n ],\n \"default_consent\": {}\n}\n`,\n description: 'Create the static purpose configuration data',\n },\n {\n path: `${bundle}/${root}/helpers/preference/preference.rego`,\n contents: `# METADATA\n# title: Purpose preference resolution\n# description: |\n# Resolves the subject's recorded choice for one purpose from the OPA\n# \\`input.preferences\\` array Sombra injects (one \\`{name, choice,\n# days_since_choice?}\\` entry per purpose; \\`choice\\` may be null when unset).\npackage ${root}.helpers.preference\n\nimport rego.v1\n\nimport data.${root}.config\n\nraw_preferences := object.get(input, \"preferences\", [])\n\nsource_available if {\n\\tis_array(raw_preferences)\n\\tevery entry in raw_preferences {\n\\t\\tis_object(entry)\n\\t\\tis_string(entry.name)\n\\t\\tentry.name != \"\"\n\\t}\n}\n\n# Boolean choice for a purpose, last-wins across duplicate entries (matching\n# Sombra's own dedup semantics). Returns the boolean only when a usable choice\n# exists; otherwise the rule is undefined and the purpose is undecided.\nchoice(name) := choice if {\n\\tsource_available\n\\tmatching := [entry | some entry in raw_preferences; entry.name == name]\n\\tcount(matching) > 0\n\\tlast := matching[count(matching) - 1]\n\\tchoice := object.get(last, \"choice\", null)\n\\tis_boolean(choice)\n}\n\nenabled(name) if choice(name) == true\n\ndisabled(name) if choice(name) == false\n\ndecided(name) if enabled(name)\n\ndecided(name) if disabled(name)\n\n# A configured purpose with no usable boolean choice is undecided: the subject\n# never chose, so the resolved default applies (not an opt-out).\nundecided(name) if {\n\\tname in config.purposes\n\\tnot enabled(name)\n\\tnot disabled(name)\n}\n`,\n description: 'Create purpose preference resolution helpers',\n },\n {\n path: `${bundle}/${root}/helpers/preference/preference_test.rego`,\n contents: `# Mechanical tests for purpose preference resolution.\n# Policy outcomes are tested beside the public entrypoint.\npackage ${root}.helpers.preference_test\n\nimport rego.v1\n\nimport data.${root}.helpers.preference\n\ngiven(preferences) := {\"preferences\": preferences}\n\ntest_treats_an_absent_preferences_array_as_no_recorded_choices if {\n\\tfixture := {}\n\n\\tpreference.source_available with input as fixture\n\\tpreference.undecided(\"Marketing\") with input as fixture\n}\n\ntest_accepts_an_empty_preferences_array if {\n\\tfixture := given([])\n\n\\tpreference.source_available with input as fixture\n\\tpreference.undecided(\"Marketing\") with input as fixture\n}\n\ntest_reports_a_non_array_preferences_as_unavailable if {\n\\tnot preference.source_available with input as {\"preferences\": {\"Marketing\": true}}\n}\n\ntest_reports_entries_without_a_usable_name_as_unavailable if {\n\\tnot preference.source_available with input as {\"preferences\": [{}]}\n\\tnot preference.source_available with input as {\"preferences\": [{\"name\": \"\"}]}\n\\tnot preference.source_available with input as {\"preferences\": [{\"choice\": true}]}\n}\n\ntest_distinguishes_enabled_and_disabled_choices if {\n\\tfixture := given([\n\\t\\t{\"name\": \"Marketing\", \"choice\": true},\n\\t\\t{\"name\": \"Analytics\", \"choice\": false},\n\\t])\n\n\\tpreference.enabled(\"Marketing\") with input as fixture\n\\tpreference.disabled(\"Analytics\") with input as fixture\n\\tpreference.decided(\"Marketing\") with input as fixture\n\\tpreference.decided(\"Analytics\") with input as fixture\n\\tnot preference.undecided(\"Marketing\") with input as fixture\n}\n\ntest_treats_a_null_choice_as_undecided if {\n\\tfixture := given([{\"name\": \"Marketing\", \"choice\": null}])\n\n\\tpreference.undecided(\"Marketing\") with input as fixture\n\\tnot preference.decided(\"Marketing\") with input as fixture\n}\n\ntest_treats_an_absent_choice_key_as_undecided if {\n\\tfixture := given([{\"name\": \"Marketing\", \"channel\": \"email\"}])\n\n\\tpreference.undecided(\"Marketing\") with input as fixture\n}\n\ntest_treats_a_non_boolean_choice_as_undecided if {\n\\tfixture := given([{\"name\": \"Personalization\", \"choice\": \"Daily\"}])\n\n\\tpreference.undecided(\"Personalization\") with input as fixture\n\\tnot preference.decided(\"Personalization\") with input as fixture\n}\n\n# Sombra dedupes by purpose before sending; last-wins keeps the bundle correct\n# against hand-crafted input that names the same purpose twice.\ntest_last_wins_on_duplicate_entries if {\n\\tfixture := given([\n\\t\\t{\"name\": \"SaleOfInfo\", \"choice\": true},\n\\t\\t{\"name\": \"SaleOfInfo\", \"choice\": false},\n\\t])\n\n\\tpreference.disabled(\"SaleOfInfo\") with input as fixture\n\\tnot preference.enabled(\"SaleOfInfo\") with input as fixture\n}\n\n# Extra fields on an entry (evidence, days_since_choice, channel) are ignored\n# rather than treated as a choice.\ntest_ignores_fields_beyond_the_recorded_choice if {\n\\tfixture := given([{\n\\t\\t\"name\": \"Marketing\",\n\\t\\t\"choice\": true,\n\\t\\t\"evidence\": \"consent_banner\",\n\\t\\t\"days_since_choice\": 45,\n\\t\\t\"channel\": \"email\",\n\\t}])\n\n\\tpreference.enabled(\"Marketing\") with input as fixture\n}\n`,\n description: 'Create preference resolution tests',\n },\n {\n path: `${bundle}/${root}/main.rego`,\n contents: `# METADATA\n# title: Permissions bundle root\n# description: |\n# Declares the Permissions envelope schema for this package and all\n# subpackages (helpers, purposes, and static config data).\n# scope: subpackages\n# schemas:\n# - input: schema.${root}.input\npackage ${root}\n\nimport rego.v1\n`,\n description: 'Create the bundle root package with schema declaration',\n },\n {\n path: `${bundle}/${root}/purposes/analytics/analytics.rego`,\n contents: `# METADATA\n# title: Analytics purpose decision\n# description: |\n# The Analytics purpose's verdict as a \\`result\\` document\n# (\\`data.${root}.purposes.analytics.result\\`).\npackage ${root}.purposes.analytics\n\nimport rego.v1\n\nimport data.${root}.helpers.preference\n\ndefault result := {\n\\t\"decision\": \"deny\",\n\\t\"reason_code\": \"default_deny\",\n}\n\nresult := {\n\\t\"decision\": \"allow\",\n\\t\"reason_code\": \"explicit_allow\",\n} if {\n\\tpreference.enabled(\"Analytics\")\n}\n\nresult := {\n\\t\"decision\": \"deny\",\n\\t\"reason_code\": \"explicit_deny\",\n} if {\n\\tpreference.disabled(\"Analytics\")\n}\n\nresult := {\n\\t\"decision\": \"allow\",\n\\t\"reason_code\": \"default_allow\",\n} if {\n\\tpreference.undecided(\"Analytics\")\n}\n`,\n description: 'Create the analytics purpose decision rule',\n },\n {\n path: `${bundle}/${root}/purposes/analytics/analytics_test.rego`,\n contents: `# Policy outcomes for the Analytics purpose (the queried document).\npackage ${root}.purposes.analytics_test\n\nimport rego.v1\n\nimport data.${root}.purposes.analytics\n\ngiven(preferences) := {\"preferences\": preferences}\n\ntest_explicit_allow if {\n\\tresult := analytics.result with input as given([{\"name\": \"Analytics\", \"choice\": true}])\n\\tresult == {\n\\t\\t\"decision\": \"allow\",\n\\t\\t\"reason_code\": \"explicit_allow\",\n\\t}\n}\n\ntest_explicit_deny if {\n\\tresult := analytics.result with input as given([{\"name\": \"Analytics\", \"choice\": false}])\n\\tresult == {\n\\t\\t\"decision\": \"deny\",\n\\t\\t\"reason_code\": \"explicit_deny\",\n\\t}\n}\n\ntest_undecided_resolves_to_default_allow if {\n\\tresult := analytics.result with input as given([])\n\\tresult == {\n\\t\\t\"decision\": \"allow\",\n\\t\\t\"reason_code\": \"default_allow\",\n\\t}\n}\n\ntest_missing_preferences_resolves_to_default_allow if {\n\\tresult := analytics.result with input as {}\n\\tresult == {\n\\t\\t\"decision\": \"allow\",\n\\t\\t\"reason_code\": \"default_allow\",\n\\t}\n}\n\ntest_non_boolean_choice_falls_back_to_default_allow if {\n\\tresult := analytics.result with input as given([{\"name\": \"Analytics\", \"choice\": \"yes\"}])\n\\tresult == {\n\\t\\t\"decision\": \"allow\",\n\\t\\t\"reason_code\": \"default_allow\",\n\\t}\n}\n\ntest_malformed_preferences_are_treated_as_undecided if {\n\\t# source_available is false, so enabled/disabled never fire; undecided still\n\\t# holds for configured purposes (not enabled and not disabled).\n\\tresult := analytics.result with input as {\"preferences\": {\"Analytics\": true}}\n\\tresult == {\n\\t\\t\"decision\": \"allow\",\n\\t\\t\"reason_code\": \"default_allow\",\n\\t}\n}\n`,\n description: 'Create analytics purpose decision tests',\n },\n {\n path: `${bundle}/${root}/purposes/entrypoint.rego`,\n contents: `# METADATA\n# title: Purpose decisions\n# description: Returns each purpose's decision and reason code.\n# scope: package\n# entrypoint: true\npackage ${root}.purposes\n\nimport rego.v1\n`,\n description: 'Create the purposes entrypoint',\n },\n {\n path: `${bundle}/input.example.json`,\n contents: inputExample,\n description: 'Create a sanitized permissions evaluation input example',\n },\n {\n path: `${bundle}/input.json`,\n contents: inputExample,\n description: 'Create a local evaluation input (gitignored copy of the example)',\n },\n {\n path: `${bundle}/.gitignore`,\n contents: POLICY_GITIGNORE_TEMPLATE,\n description: 'Ignore only the private local input file',\n },\n ];\n}\n\n/**\n * Generate bundle files for a given template and root.\n *\n * @param template - Template name\n * @param root - Package root name\n * @returns Bundle files relative to the workspace\n */\nexport function generatePolicyBundleFiles(\n template: PolicyTemplateName,\n root: string,\n): PolicyStarterFile[] {\n switch (template) {\n case 'generic':\n return generateGenericBundleFiles(root);\n case 'permissions':\n return generatePermissionsBundleFiles(root);\n default:\n throw new Error(`Unknown policy template: ${String(template)}`);\n }\n}\n","import { join, resolve } from 'node:path';\n\nimport type { LocalContext } from '../../context.js';\nimport {\n collectProjectRelativePaths,\n discoverProjectRepository,\n} from '../scaffolding/project-discovery.js';\nimport type { PolicyProjectState } from './policy-scaffold-model.js';\nimport {\n POLICY_MANIFEST_FILENAME,\n POLICY_STARTER_BUNDLE_DIRECTORY,\n} from './policy-scaffold-templates.js';\n\n/** Default local policy workspace directory (shared Regal + schemas). */\nexport const DEFAULT_POLICY_PROJECT_DIRECTORY = 'transcend/policy';\n\n/**\n * Resolve a selected policy project relative to the invocation directory.\n *\n * @param invocationDirectory - CLI working directory\n * @param directory - User-selected project directory\n * @returns Absolute policy project directory\n */\nexport function resolvePolicyProjectDirectory(\n invocationDirectory: string,\n directory: string = DEFAULT_POLICY_PROJECT_DIRECTORY,\n): string {\n return resolve(invocationDirectory, directory);\n}\n\n/**\n * Absolute path to the disposable starter publish directory under a workspace.\n *\n * @param workspaceDirectory - Absolute policy workspace directory\n * @returns Absolute starter bundle directory\n */\nexport function getPolicyStarterBundleDirectory(workspaceDirectory: string): string {\n return join(workspaceDirectory, POLICY_STARTER_BUNDLE_DIRECTORY);\n}\n\n/**\n * Resolve publishable bundle directories under a path.\n *\n * - If `directory` itself contains a `.manifest`, it is treated as one bundle.\n * - Otherwise immediate child directories that contain a `.manifest` are\n * returned in sorted order (multi-bundle workspace). Folder names are not\n * required to end in `-bundle`; that suffix is only the `policy new`\n * scaffolding convention.\n *\n * @param context - Filesystem-bearing CLI context\n * @param directory - Absolute workspace or bundle directory\n * @returns Absolute bundle directories to lint / test\n */\nexport function discoverPolicyBundleDirectories(\n context: Pick<LocalContext, 'fs'>,\n directory: string,\n): string[] {\n if (!context.fs.existsSync(directory) || !context.fs.statSync(directory).isDirectory()) {\n return [];\n }\n const manifestAtRoot = join(directory, POLICY_MANIFEST_FILENAME);\n if (context.fs.existsSync(manifestAtRoot) && context.fs.statSync(manifestAtRoot).isFile()) {\n return [directory];\n }\n return context.fs\n .readdirSync(directory, { withFileTypes: true })\n .filter((entry) => entry.isDirectory())\n .map((entry) => join(directory, entry.name))\n .filter((bundleDirectory) => {\n const manifestPath = join(bundleDirectory, POLICY_MANIFEST_FILENAME);\n return context.fs.existsSync(manifestPath) && context.fs.statSync(manifestPath).isFile();\n })\n .sort((left, right) => left.localeCompare(right));\n}\n\n/**\n * Collect repository state required by the pure policy planner.\n *\n * @param context - CLI context\n * @param directory - User-selected target directory\n * @returns Policy project discovery state\n */\nexport function discoverPolicyProject(\n context: LocalContext,\n directory: string = DEFAULT_POLICY_PROJECT_DIRECTORY,\n): PolicyProjectState {\n const invocationDirectory = context.process.cwd();\n const targetDirectory = resolvePolicyProjectDirectory(invocationDirectory, directory);\n if (\n context.fs.existsSync(targetDirectory) &&\n !context.fs.statSync(targetDirectory).isDirectory()\n ) {\n throw new Error(`Policy target is not a directory: ${targetDirectory}`);\n }\n const repository = discoverProjectRepository(context, {\n invocationDirectory,\n targetDirectory,\n standaloneProjectRoot: invocationDirectory,\n });\n return {\n invocationDirectory,\n targetDirectory,\n ...repository,\n relativePaths: collectProjectRelativePaths(context, targetDirectory),\n relativeFilePaths: collectProjectRelativePaths(context, targetDirectory, {\n includeDirectories: false,\n }),\n };\n}\n\n/**\n * Resolve the starter bundle manifest path for a discovered workspace.\n *\n * @param state - Policy project state\n * @returns Absolute manifest path under the starter `{root}-bundle/`\n */\nexport function getPolicyManifestPath(state: PolicyProjectState): string {\n return join(getPolicyStarterBundleDirectory(state.targetDirectory), POLICY_MANIFEST_FILENAME);\n}\n"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"semver";const t=`0.
|
|
2
|
-
//# sourceMappingURL=policy-runtime-
|
|
1
|
+
import e from"semver";const t=`0.42.0`,n=`https://www.openpolicyagent.org/docs#1-download-opa`,r=`https://www.openpolicyagent.org/projects/regal#installing-regal`,i=`OPA 1.x is required but \`opa\` was not found on PATH. Install or upgrade it using the official instructions: ${n}`,a=`The Open Policy Agent CLI (\`opa\`) is required but was not found on PATH. Install it using the official instructions: ${n}`,o=`Regal is required but \`regal\` was not found on PATH. Install or upgrade it using the official instructions: ${r}`;function s(t){let n=t.match(/^\s*Version:\s+v?(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?)\s*$/imu);if(!(!n||!e.valid(n[1])))return{version:n[1],major:e.major(n[1])}}function c(e){let t=s(e);if(t?.major!==1)return`OPA 1.x is required${t?`; found ${t.version}`:`; unable to parse the installed version`}. Install or upgrade it using the official instructions: ${n}`}function l(t,n=`0.30.0`,i=`OPA 1 support`){let a=s(t);if(!(a&&e.gte(a.version,n)))return`Regal ${n} or newer is required for ${i}${a?`; found ${a.version}`:`; unable to parse the installed version`}. Install or upgrade it using the official instructions: ${r}`}export{r as a,c,i,l,a as n,o,n as r,s,t};
|
|
2
|
+
//# sourceMappingURL=policy-runtime-6jmkXlBk.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy-runtime-
|
|
1
|
+
{"version":3,"file":"policy-runtime-6jmkXlBk.mjs","names":[],"sources":["../src/lib/policy/policy-runtime.ts"],"sourcesContent":["import semver from 'semver';\n\n/** Supported local OPA major version. */\nexport const SUPPORTED_OPA_MAJOR_VERSION = 1;\n\n/** Oldest Regal release with first-class OPA 1.0 support. */\nexport const MINIMUM_REGAL_VERSION = '0.30.0';\n\n/** Oldest Regal release containing OPA 1.18.2 capabilities. */\nexport const MINIMUM_POLICY_STARTER_REGAL_VERSION = '0.42.0';\n\n/** Official OPA installation instructions. */\nexport const OPA_INSTALL_URL = 'https://www.openpolicyagent.org/docs#1-download-opa';\n\n/** Official Regal installation instructions. */\nexport const REGAL_INSTALL_URL = 'https://www.openpolicyagent.org/projects/regal#installing-regal';\n\n/** Missing OPA guidance shared by policy commands. */\nexport const OPA_MISSING_MESSAGE =\n 'OPA 1.x is required but `opa` was not found on PATH. ' +\n `Install or upgrade it using the official instructions: ${OPA_INSTALL_URL}`;\n\n/** Missing OPA guidance for commands that support multiple OPA releases. */\nexport const OPA_CLI_MISSING_MESSAGE =\n 'The Open Policy Agent CLI (`opa`) is required but was not found on PATH. ' +\n `Install it using the official instructions: ${OPA_INSTALL_URL}`;\n\n/** Missing Regal guidance for policy verification. */\nexport const REGAL_MISSING_MESSAGE =\n 'Regal is required but `regal` was not found on PATH. ' +\n `Install or upgrade it using the official instructions: ${REGAL_INSTALL_URL}`;\n\n/** Parsed policy tool version. */\nexport interface PolicyToolVersion {\n /** Complete semantic version reported by the tool. */\n version: string;\n /** Semantic major version. */\n major: number;\n}\n\n/**\n * Parse the version field from OPA or Regal version output.\n *\n * Both tools emit a `Version:` line and may prefix the value with `v`.\n *\n * @param output - Captured version output\n * @returns Parsed semantic version\n */\nexport function parsePolicyToolVersion(output: string): PolicyToolVersion | undefined {\n const match = output.match(\n /^\\s*Version:\\s+v?(\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?)\\s*$/imu,\n );\n if (!match || !semver.valid(match[1])) {\n return undefined;\n }\n return {\n version: match[1],\n major: semver.major(match[1]),\n };\n}\n\n/**\n * Explain why an OPA version cannot run policy verification.\n *\n * @param output - Captured `opa version` output\n * @returns Requirement error, or undefined for supported OPA\n */\nexport function unsupportedOpaVersionMessage(output: string): string | undefined {\n const runtime = parsePolicyToolVersion(output);\n if (runtime?.major === SUPPORTED_OPA_MAJOR_VERSION) {\n return undefined;\n }\n const found = runtime ? `; found ${runtime.version}` : '; unable to parse the installed version';\n return (\n `OPA ${SUPPORTED_OPA_MAJOR_VERSION}.x is required${found}. ` +\n `Install or upgrade it using the official instructions: ${OPA_INSTALL_URL}`\n );\n}\n\n/**\n * Explain why a Regal version cannot run OPA 1 policy verification.\n *\n * @param output - Captured `regal version` output\n * @param minimumVersion - Oldest accepted Regal release\n * @param compatibilityTarget - Capability requiring the minimum version\n * @returns Requirement error, or undefined for supported Regal\n */\nexport function unsupportedRegalVersionMessage(\n output: string,\n minimumVersion: string = MINIMUM_REGAL_VERSION,\n compatibilityTarget = 'OPA 1 support',\n): string | undefined {\n const runtime = parsePolicyToolVersion(output);\n if (runtime && semver.gte(runtime.version, minimumVersion)) {\n return undefined;\n }\n const found = runtime ? `; found ${runtime.version}` : '; unable to parse the installed version';\n return (\n `Regal ${minimumVersion} or newer is required for ${compatibilityTarget}${found}. ` +\n `Install or upgrade it using the official instructions: ${REGAL_INSTALL_URL}`\n );\n}\n"],"mappings":"sBAMA,MAGa,EAAuC,SAGvC,EAAkB,sDAGlB,EAAoB,kEAGpB,EACX,iHAC0D,IAG/C,EACX,0HAC+C,IAGpC,EACX,iHAC0D,IAkB5D,SAAgB,EAAuB,EAA+C,CACpF,IAAM,EAAQ,EAAO,MACnB,mFACD,CACG,MAAC,GAAS,CAAC,EAAO,MAAM,EAAM,GAAG,EAGrC,MAAO,CACL,QAAS,EAAM,GACf,MAAO,EAAO,MAAM,EAAM,GAAG,CAC9B,CASH,SAAgB,EAA6B,EAAoC,CAC/E,IAAM,EAAU,EAAuB,EAAO,CAC1C,MAAS,QAAA,EAIb,MACE,sBAFY,EAAU,WAAW,EAAQ,UAAY,0CAEI,2DACC,IAY9D,SAAgB,EACd,EACA,EAAyB,SACzB,EAAsB,gBACF,CACpB,IAAM,EAAU,EAAuB,EAAO,CAC1C,QAAW,EAAO,IAAI,EAAQ,QAAS,EAAe,EAI1D,MACE,SAAS,EAAe,4BAA4B,IAFxC,EAAU,WAAW,EAAQ,UAAY,0CAE2B,2DACtB"}
|