@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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-B5oVsX-F2.mjs","names":["POLICY_SKILL_MD","POLICY_SETUP_TOOLING_REFERENCE_MD","POLICY_AUTHORING_REFERENCE_MD","POLICY_TESTING_DEBUGGING_REFERENCE_MD","POLICY_PUBLISHING_REFERENCE_MD","CLI_VERSION"],"sources":["../src/lib/policy/policy-project-discovery.ts","../src/lib/policy/policy-scaffold-model.ts","../../../skills/transcend-policy-engine/references/authoring.md","../../../skills/transcend-policy-engine/references/publishing.md","../../../skills/transcend-policy-engine/references/setup-tooling.md","../../../skills/transcend-policy-engine/references/testing-debugging.md","../../../skills/transcend-policy-engine/SKILL.md","../src/lib/policy/policy-skill.ts","../src/lib/policy/policy-scaffold-output.ts","../src/lib/policy/policy-scaffold-templates.ts","../src/lib/policy/policy-scaffold-artifacts.ts","../src/lib/policy/policy-scaffold-config.ts","../src/lib/policy/policy-scaffold-planning.ts","../src/commands/policy/init/impl.ts"],"sourcesContent":["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';\n\n/** Default local policy project directory. */\nexport const DEFAULT_POLICY_PROJECT_DIRECTORY = 'transcend/policy';\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 = resolve(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 bundle manifest path for a discovered project.\n *\n * @param state - Policy project state\n * @returns Absolute manifest path\n */\nexport function getPolicyManifestPath(state: PolicyProjectState): string {\n return join(state.targetDirectory, 'manifest.json');\n}\n","import type { ExistingProjectSkillDirectory } from '../scaffolding/agent-skill.js';\nimport type { ProjectPlan } from '../scaffolding/project-plan.js';\n\n/** Version of the stable policy initialization JSON result. */\nexport const POLICY_INIT_RESULT_VERSION = 1 as const;\n\n/** Optional repository integrations for policy authoring. */\nexport const PolicySetupFeature = {\n /** Repository-level editor configuration. */\n Editor: 'editor',\n /** Managed policy authoring skill. */\n Skill: 'skill',\n /** Credential-free continuous integration. */\n Ci: 'ci',\n} as const;\n\n/** Optional repository integration for policy authoring. */\nexport type PolicySetupFeature = (typeof PolicySetupFeature)[keyof typeof PolicySetupFeature];\n\n/** Repository and target state collected before policy planning. */\nexport interface PolicyProjectState {\n /** Directory from which the CLI was invoked. */\n invocationDirectory: string;\n /** Absolute user-selected policy directory. */\n targetDirectory: string;\n /** Repository or invocation root that owns setup artifacts. */\n projectRoot: string;\n /** Nearest repository root, when present. */\n repositoryRoot?: string;\n /** Existing project-level skill directories. */\n existingSkillDirectories: ExistingProjectSkillDirectory[];\n /** Whether the repository appears to use GitHub. */\n usesGithub: boolean;\n /** Case-preserving relative paths below the policy directory. */\n relativePaths: string[];\n /** Relative file and link paths below the policy directory. */\n relativeFilePaths: string[];\n}\n\n/** A complete, validated policy initialization plan. */\nexport interface PolicyInitProjectPlan extends ProjectPlan {\n /** JSON contract version. */\n version: typeof POLICY_INIT_RESULT_VERSION;\n /** Command that produced the plan. */\n command: 'init';\n /** Absolute policy project directory. */\n targetDirectory: string;\n /** Absolute policy manifest path. */\n manifestPath: string;\n /** Files inspected and deliberately left unchanged. */\n unchanged: string[];\n /** Non-fatal plan warnings. */\n warnings: string[];\n /** Raw commands shown after a successful apply. */\n nextSteps: string[];\n /** Exact generated example that remains safe to replace. */\n disposableExamplePath?: string;\n /** Selected repository integrations. */\n features: PolicySetupFeature[];\n}\n",null,null,null,null,null,"import POLICY_AUTHORING_REFERENCE_MD from '../../../../../skills/transcend-policy-engine/references/authoring.md';\nimport POLICY_PUBLISHING_REFERENCE_MD from '../../../../../skills/transcend-policy-engine/references/publishing.md';\nimport POLICY_SETUP_TOOLING_REFERENCE_MD from '../../../../../skills/transcend-policy-engine/references/setup-tooling.md';\nimport POLICY_TESTING_DEBUGGING_REFERENCE_MD from '../../../../../skills/transcend-policy-engine/references/testing-debugging.md';\nimport POLICY_SKILL_MD from '../../../../../skills/transcend-policy-engine/SKILL.md';\nimport type { AgentSkillFile } from '../scaffolding/agent-skill.js';\n\n/** Namespaced directory and frontmatter name for the installed Agent Skill. */\nexport const POLICY_SKILL_NAME = 'transcend-policy-engine';\n\nexport {\n POLICY_AUTHORING_REFERENCE_MD,\n POLICY_PUBLISHING_REFERENCE_MD,\n POLICY_SETUP_TOOLING_REFERENCE_MD,\n POLICY_SKILL_MD,\n POLICY_TESTING_DEBUGGING_REFERENCE_MD,\n};\n\n/** Complete portable Policy Engine Agent Skill file set. */\nexport const POLICY_SKILL_FILES: readonly AgentSkillFile[] = [\n { path: 'SKILL.md', contents: POLICY_SKILL_MD },\n { path: 'references/setup-tooling.md', contents: POLICY_SETUP_TOOLING_REFERENCE_MD },\n { path: 'references/authoring.md', contents: POLICY_AUTHORING_REFERENCE_MD },\n { path: 'references/testing-debugging.md', contents: POLICY_TESTING_DEBUGGING_REFERENCE_MD },\n { path: 'references/publishing.md', contents: POLICY_PUBLISHING_REFERENCE_MD },\n];\n","import {\n toPublicPlannedChange,\n type PublicPlannedChange,\n} from '../scaffolding/project-plan-output.js';\nimport type { PolicyInitProjectPlan, PolicySetupFeature } from './policy-scaffold-model.js';\nimport { POLICY_SKILL_NAME } from './policy-skill.js';\n\n/** Detected local policy tool versions. */\nexport interface PolicyInitToolVersions {\n /** OPA version, or null when missing or incompatible. */\n opa: string | null;\n /** Regal version, or null when missing or incompatible. */\n regal: string | null;\n}\n\n/** Stable machine-readable policy initialization result. */\nexport interface PolicyInitPlanResult {\n /** JSON contract version. */\n version: number;\n /** Command that produced the result. */\n command: 'init';\n /** Whether the plan was applied. */\n applied: boolean;\n /** Whether this was a dry run. */\n dryRun: boolean;\n /** Absolute policy target directory. */\n targetDirectory: string;\n /** Absolute policy manifest path. */\n manifestPath: string;\n /** Planned mutations without file contents. */\n changes: PublicPlannedChange[];\n /** Non-fatal preservation and runtime warnings. */\n warnings: string[];\n /** Suggested raw one-line follow-up commands. */\n nextSteps: string[];\n /** Explicitly selected repository integrations. */\n features: PolicySetupFeature[];\n /** Compact prompt for continuing with a coding agent. */\n aiHandoff: string;\n /** Compatible local policy tool versions. */\n tools: PolicyInitToolVersions;\n}\n\n/**\n * Build the compact policy implementation and CI handoff.\n *\n * @param options - Portable example path and lint command\n * @returns Raw one-line prompt\n */\nexport function buildPolicyInitAiHandoff(options: {\n /** Display path to the policy project. */\n projectPath: string;\n /** Display path to an exact disposable example. */\n examplePath?: string;\n /** Whether the policy authoring skill was installed. */\n hasSkill: boolean;\n /** Copyable lint command. */\n lintCommand: string;\n}): string {\n if (!options.examplePath) {\n const instruction = options.hasSkill\n ? `Use the \\`${POLICY_SKILL_NAME}\\` skill to review`\n : 'Review';\n return (\n `${instruction} the existing policy project in ${options.projectPath}, ` +\n `align its document tree and input/output contract with the intended application, adapt ` +\n `repository validation as needed, and rerun ${options.lintCommand}.`\n );\n }\n const instruction = options.hasSkill\n ? `Use the \\`${POLICY_SKILL_NAME}\\` skill to replace`\n : 'Replace';\n return (\n `${instruction} the disposable example in ${options.examplePath} with ` +\n `the intended policy document tree and input/output contract, adapt repository validation ` +\n `to local conventions, and rerun ${options.lintCommand}.`\n );\n}\n\n/**\n * Build the stable machine-readable initialization result.\n *\n * @param plan - Policy project plan\n * @param options - Apply and runtime state\n * @returns Public JSON result\n */\nexport function buildPolicyInitPlanResult(\n plan: PolicyInitProjectPlan,\n options: {\n /** Whether the plan was applied. */\n applied: boolean;\n /** Whether this was a dry run. */\n dryRun: boolean;\n /** Working directory for portable paths. */\n cwd: string;\n /** Compact coding-agent prompt. */\n aiHandoff: string;\n /** Compatible local policy tool versions. */\n tools: PolicyInitToolVersions;\n },\n): PolicyInitPlanResult {\n return {\n version: plan.version,\n command: plan.command,\n applied: options.applied,\n dryRun: options.dryRun,\n targetDirectory: plan.targetDirectory,\n manifestPath: plan.manifestPath,\n changes: plan.changes.map((change) => toPublicPlannedChange(options.cwd, change)),\n warnings: plan.warnings,\n nextSteps: plan.nextSteps,\n features: [...plan.features],\n aiHandoff: options.aiHandoff,\n tools: options.tools,\n };\n}\n","/** OPA version targeted by generated policy authoring configuration. */\nexport const POLICY_STARTER_OPA_VERSION = '1.13.1';\n\n/** One deterministic file in the safe policy starter. */\nexport interface PolicyStarterFile {\n /** POSIX-style path relative to the policy 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/** Publishable Policy Engine bundle manifest. */\nexport const POLICY_MANIFEST_TEMPLATE = `{\n \"roots\": [\"policy_engine\"]\n}\n`;\n\n/** Strict Regal project configuration pinned to the deployed OPA capabilities. */\nexport const POLICY_REGAL_CONFIG_TEMPLATE = `capabilities:\n from:\n engine: opa\n version: v${POLICY_STARTER_OPA_VERSION}\nproject:\n roots:\n - .\n rego-version: 1\n`;\n\n/** Disposable, fail-closed example policy. */\nexport const POLICY_RESULT_REGO_TEMPLATE = `package policy_engine.example\n\nimport rego.v1\n\n# 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# entrypoint: true\ndefault result := {\n\t\"decision\": \"deny\",\n\t\"reason_code\": \"untrusted_or_invalid_input\",\n}\n\nresult := {\n\t\"decision\": \"allow\",\n\t\"reason_code\": \"trusted_subject\",\n} if {\n\tinput.subject.trusted == true\n}\n`;\n\n/** Executable tests adjacent to the disposable example policy. */\nexport const POLICY_RESULT_TEST_REGO_TEMPLATE = `package policy_engine.example_test\n\nimport data.policy_engine.example\nimport rego.v1\n\ntest_denies_untrusted_subject if {\n\tresult := example.result with input as {\"subject\": {\"trusted\": false}}\n\tresult == {\n\t\t\"decision\": \"deny\",\n\t\t\"reason_code\": \"untrusted_or_invalid_input\",\n\t}\n}\n\ntest_fails_closed_for_missing_subject if {\n\tresult := example.result with input as {}\n\tresult == {\n\t\t\"decision\": \"deny\",\n\t\t\"reason_code\": \"untrusted_or_invalid_input\",\n\t}\n}\n\ntest_allows_trusted_subject if {\n\tresult := example.result with input as {\"subject\": {\"trusted\": true}}\n\tresult == {\n\t\t\"decision\": \"allow\",\n\t\t\"reason_code\": \"trusted_subject\",\n\t}\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/** Target-local ignore rules for private evaluation input only. */\nexport const POLICY_GITIGNORE_TEMPLATE = `# Local policy evaluation input.\n/input.json\n`;\n\n/** Concise project-local authoring guide. */\nexport const POLICY_README_TEMPLATE = `# Transcend Policy Project\n\nThis directory is an OPA document tree that can be published to Transcend Policy Engine.\n\nThe 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\\`.\n\nValidate formatting, strict Rego v1 compatibility, Regal lint, tests, and the publish contract:\n\n\\`\\`\\`sh\ntranscend policy lint --dir .\n\\`\\`\\`\n`;\n\n/** Complete safe starter in deterministic plan order. */\nconst POLICY_STARTER_FILES: readonly PolicyStarterFile[] = [\n {\n path: 'manifest.json',\n contents: POLICY_MANIFEST_TEMPLATE,\n description: 'Create the publishable Policy Engine manifest',\n },\n {\n path: '.regal/config.yaml',\n contents: POLICY_REGAL_CONFIG_TEMPLATE,\n description: 'Pin strict Rego v1 linting to OPA 1.13.1 capabilities',\n },\n {\n path: 'policy_engine/example/result.rego',\n contents: POLICY_RESULT_REGO_TEMPLATE,\n description: 'Create a documented fail-closed result entrypoint',\n },\n {\n path: 'policy_engine/example/result_test.rego',\n contents: POLICY_RESULT_TEST_REGO_TEMPLATE,\n description: 'Create executable tests for allow and fail-closed decisions',\n },\n {\n path: 'input.example.json',\n contents: POLICY_INPUT_EXAMPLE_TEMPLATE,\n description: 'Create a sanitized local evaluation input',\n },\n {\n path: '.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","import { posix } from 'node:path';\n\nimport { POLICY_STARTER_OPA_VERSION } from './policy-scaffold-templates.js';\n\n/** Regal version pinned by generated policy validation. */\nexport const POLICY_STARTER_REGAL_VERSION = '0.42.0';\n\n/** Repository-relative generated workflow path. */\nexport const POLICY_CI_WORKFLOW_PATH = '.github/workflows/transcend-policy.yml';\n\n/** Immutable actions/checkout v6 release commit. */\nexport const ACTIONS_CHECKOUT_SHA = 'd23441a48e516b6c34aea4fa41551a30e30af803';\n\n/** Immutable open-policy-agent/setup-opa v2.4.0 release commit. */\nexport const SETUP_OPA_SHA = 'b2b258e089860efaadaaf71bf6e3aecb4a3eeff1';\n\n/** Immutable open-policy-agent/setup-regal v2.0.0 release commit. */\nexport const SETUP_REGAL_SHA = '761188c3b435761fa254beca508a44875619648f';\n\n/**\n * Prefix a path below the repository-relative policy target.\n *\n * @param targetDirectory - POSIX repository-relative target\n * @param child - POSIX target-relative path or pattern\n * @returns Repository-relative path or pattern\n */\nfunction targetPath(targetDirectory: string, child: string): string {\n return targetDirectory === '.' ? child : posix.join(targetDirectory, child);\n}\n\n/**\n * Generate credential-free, validation-only Policy Engine CI.\n *\n * @param options - Repository paths and exact CLI release\n * @returns Complete GitHub Actions workflow YAML\n */\nexport function generatePolicyGithubActionsWorkflow(options: {\n /** Exact released Transcend CLI version. */\n cliVersion: string;\n /** Policy directory relative to the repository root. */\n targetDirectory: string;\n}): string {\n const watchedPaths = [\n targetPath(options.targetDirectory, '**/*.rego'),\n targetPath(options.targetDirectory, '**/*.json'),\n targetPath(options.targetDirectory, '**/*.yaml'),\n targetPath(options.targetDirectory, '**/*.yml'),\n targetPath(options.targetDirectory, '.regal/config.yaml'),\n targetPath(options.targetDirectory, '.regal.yaml'),\n POLICY_CI_WORKFLOW_PATH,\n ];\n const pathFilters = watchedPaths.map((path) => ` - ${JSON.stringify(path)}`).join('\\n');\n\n return `# Generated by transcend policy init.\nname: Transcend Policy\n\non:\n pull_request:\n paths:\n${pathFilters}\n push:\n paths:\n${pathFilters}\n\npermissions:\n contents: read\n\njobs:\n lint:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@${ACTIONS_CHECKOUT_SHA} # v6\n - name: Set up OPA\n uses: open-policy-agent/setup-opa@${SETUP_OPA_SHA} # v2.4.0\n with:\n version: ${JSON.stringify(POLICY_STARTER_OPA_VERSION)}\n - name: Set up Regal\n uses: open-policy-agent/setup-regal@${SETUP_REGAL_SHA} # v2.0.0\n with:\n version: ${JSON.stringify(POLICY_STARTER_REGAL_VERSION)}\n - name: Install the Transcend CLI\n run: npm install --global @transcend-io/cli@${options.cliVersion}\n - name: Validate Policy Engine project\n env:\n POLICY_DIRECTORY: ${JSON.stringify(options.targetDirectory)}\n run: >-\n transcend policy lint\n --dir \"$POLICY_DIRECTORY\"\n --noInteractive\n --json\n`;\n}\n","import { relative, sep } from 'node:path';\n\nimport {\n mergeJsonc,\n mergeStringArray,\n parseJsoncObject,\n type JsoncUpdate,\n} from '../scaffolding/jsonc.js';\n\n/** Recommended VS Code extension for OPA and Regal authoring. */\nexport const POLICY_VSCODE_EXTENSION = 'tsandall.opa';\n\n/** Conflicting syntax-only VS Code extension. */\nexport const CONFLICTING_POLICY_VSCODE_EXTENSION = 'glebbash.opa-highlight-only';\n\n/** Result of safely merging one repository editor artifact. */\nexport interface PolicyEditorMergeResult {\n /** Complete merged contents, or the unchanged original when unsafe. */\n contents: string;\n /** Actionable preservation warnings. */\n warnings: string[];\n}\n\n/** One desired scalar setting that must not replace a customization. */\ninterface DesiredSetting {\n /** JSONC object path. */\n path: string[];\n /** Desired generated value. */\n value: unknown;\n /** Human-readable setting key. */\n label: string;\n}\n\n/**\n * Compare JSON-compatible configuration values.\n *\n * @param left - Existing value\n * @param right - Desired value\n * @returns Whether the values are structurally equal\n */\nfunction configurationValuesEqual(left: unknown, right: unknown): boolean {\n return JSON.stringify(left) === JSON.stringify(right);\n}\n\n/**\n * Parse an editor object while preserving malformed existing content.\n *\n * @param contents - Existing JSONC, or null\n * @param label - Configuration label\n * @returns Parsed object or a preservation result\n */\nfunction parseEditorObject(\n contents: string | null,\n label: string,\n):\n | {\n /** Parsed JSONC object. */\n current: Record<string, unknown>;\n }\n | {\n /** Complete unchanged contents. */\n contents: string;\n /** Actionable warning. */\n warning: string;\n } {\n try {\n return { current: parseJsoncObject(contents ?? '{}\\n', label) };\n } catch (error) {\n return {\n contents: contents ?? '{}\\n',\n warning: `${error instanceof Error ? error.message : String(error)} Existing content was left unchanged.`,\n };\n }\n}\n\n/**\n * Apply safe JSONC updates or preserve the existing file when comments prevent it.\n *\n * @param contents - Existing JSONC\n * @param updates - Proven-safe updates\n * @param label - Configuration label\n * @param warnings - Existing merge warnings\n * @returns Complete contents and warnings\n */\nfunction applyEditorUpdates(\n contents: string | null,\n updates: readonly JsoncUpdate[],\n label: string,\n warnings: string[],\n): PolicyEditorMergeResult {\n if (updates.length === 0) {\n return { contents: contents ?? '{}\\n', warnings };\n }\n try {\n return {\n contents: mergeJsonc(contents, updates, label),\n warnings,\n };\n } catch (error) {\n return {\n contents: contents ?? '{}\\n',\n warnings: [\n ...warnings,\n `${error instanceof Error ? error.message : String(error)} Existing content was left unchanged.`,\n ],\n };\n }\n}\n\n/**\n * Add absent scalar settings without replacing repository customizations.\n *\n * @param current - Parsed editor object\n * @param desired - Desired settings\n * @param updates - Safe updates to append to\n * @param warnings - Conflict warnings to append to\n */\nfunction collectSafeScalarUpdates(\n current: Record<string, unknown>,\n desired: readonly DesiredSetting[],\n updates: JsoncUpdate[],\n warnings: string[],\n): void {\n desired.forEach(({ path, value, label }) => {\n const existing = path.reduce<unknown>((parent, key) => {\n return parent && typeof parent === 'object' && !Array.isArray(parent)\n ? (parent as Record<string, unknown>)[key]\n : undefined;\n }, current);\n if (existing === undefined) {\n updates.push({ path, value });\n } else if (!configurationValuesEqual(existing, value)) {\n warnings.push(\n `VS Code setting \"${label}\" has a repository-specific value and was left unchanged.`,\n );\n }\n });\n}\n\n/**\n * Build the workspace-relative OPA bundle root.\n *\n * @param repositoryRoot - Root that owns `.vscode`\n * @param targetDirectory - Selected policy project directory\n * @returns VS Code workspace path\n */\nfunction buildOpaWorkspaceRoot(repositoryRoot: string, targetDirectory: string): string {\n const target = relative(repositoryRoot, targetDirectory).split(sep).join('/') || '.';\n return target === '.' ? '${workspaceFolder}' : `\\${workspaceFolder}/${target}`;\n}\n\n/**\n * Merge strict target-scoped OPA and Rego editor settings.\n *\n * Setting names match the authoritative `open-policy-agent/vscode-opa`\n * extension metadata. Existing conflicting values are preserved and reported.\n *\n * @param contents - Existing `.vscode/settings.json` JSONC\n * @param repositoryRoot - Root that owns `.vscode`\n * @param targetDirectory - Selected policy project directory\n * @returns Merged settings and conflict warnings\n */\nexport function mergePolicyEditorSettings(\n contents: string | null,\n repositoryRoot: string,\n targetDirectory: string,\n): PolicyEditorMergeResult {\n const parsed = parseEditorObject(contents, 'VS Code policy settings');\n if ('warning' in parsed) {\n return { contents: parsed.contents, warnings: [parsed.warning] };\n }\n const { current } = parsed;\n const updates: JsoncUpdate[] = [];\n const warnings: string[] = [];\n\n const roots = current['opa.roots'];\n const desiredRoot = buildOpaWorkspaceRoot(repositoryRoot, targetDirectory);\n if (roots === undefined) {\n updates.push({ path: ['opa.roots'], value: [desiredRoot] });\n } else if (Array.isArray(roots) && roots.every((value) => typeof value === 'string')) {\n const merged = mergeStringArray(roots, [desiredRoot]);\n if (!configurationValuesEqual(merged, roots)) {\n updates.push({ path: ['opa.roots'], value: merged });\n }\n } else {\n warnings.push('VS Code setting \"opa.roots\" is customized and was left unchanged.');\n }\n\n collectSafeScalarUpdates(\n current,\n [\n { path: ['opa.checkOnSave'], value: true, label: 'opa.checkOnSave' },\n { path: ['opa.strictMode'], value: true, label: 'opa.strictMode' },\n { path: ['opa.bundleMode'], value: true, label: 'opa.bundleMode' },\n { path: ['opa.formatter'], value: 'opa-fmt-rego-v1', label: 'opa.formatter' },\n ],\n updates,\n warnings,\n );\n\n const regoSettings = current['[rego]'];\n if (regoSettings === undefined) {\n updates.push({\n path: ['[rego]'],\n value: {\n 'editor.defaultFormatter': POLICY_VSCODE_EXTENSION,\n 'editor.formatOnSave': true,\n 'editor.insertSpaces': false,\n 'editor.tabSize': 4,\n },\n });\n } else if (\n regoSettings !== null &&\n typeof regoSettings === 'object' &&\n !Array.isArray(regoSettings)\n ) {\n collectSafeScalarUpdates(\n current,\n [\n {\n path: ['[rego]', 'editor.defaultFormatter'],\n value: POLICY_VSCODE_EXTENSION,\n label: '[rego].editor.defaultFormatter',\n },\n {\n path: ['[rego]', 'editor.formatOnSave'],\n value: true,\n label: '[rego].editor.formatOnSave',\n },\n {\n path: ['[rego]', 'editor.insertSpaces'],\n value: false,\n label: '[rego].editor.insertSpaces',\n },\n {\n path: ['[rego]', 'editor.tabSize'],\n value: 4,\n label: '[rego].editor.tabSize',\n },\n ],\n updates,\n warnings,\n );\n } else {\n warnings.push('VS Code language setting \"[rego]\" is customized and was left unchanged.');\n }\n\n return applyEditorUpdates(contents, updates, 'VS Code policy settings', warnings);\n}\n\n/**\n * Merge OPA extension recommendations without disturbing unknown entries.\n *\n * VS Code's `extensions.json` schema supports `unwantedRecommendations`, so\n * the syntax-only extension can be removed from recommendations and discouraged.\n *\n * @param contents - Existing `.vscode/extensions.json` JSONC\n * @returns Merged extension recommendations and warnings\n */\nexport function mergePolicyEditorExtensions(contents: string | null): PolicyEditorMergeResult {\n const parsed = parseEditorObject(contents, 'VS Code policy extension recommendations');\n if ('warning' in parsed) {\n return { contents: parsed.contents, warnings: [parsed.warning] };\n }\n const { current } = parsed;\n const updates: JsoncUpdate[] = [];\n const warnings: string[] = [];\n\n const recommendations = current.recommendations;\n if (\n recommendations === undefined ||\n (Array.isArray(recommendations) && recommendations.every((value) => typeof value === 'string'))\n ) {\n const existing = recommendations ?? [];\n const desired = mergeStringArray(existing, [POLICY_VSCODE_EXTENSION]).filter(\n (value) => value !== CONFLICTING_POLICY_VSCODE_EXTENSION,\n );\n if (!configurationValuesEqual(existing, desired)) {\n updates.push({ path: ['recommendations'], value: desired });\n }\n } else {\n warnings.push(\n 'VS Code extension recommendations use an unknown shape and were left unchanged.',\n );\n }\n\n const unwanted = current.unwantedRecommendations;\n if (\n unwanted === undefined ||\n (Array.isArray(unwanted) && unwanted.every((value) => typeof value === 'string'))\n ) {\n const existing = unwanted ?? [];\n const desired = mergeStringArray(existing, [CONFLICTING_POLICY_VSCODE_EXTENSION]);\n if (!configurationValuesEqual(existing, desired)) {\n updates.push({ path: ['unwantedRecommendations'], value: desired });\n }\n } else {\n warnings.push(\n 'VS Code unwanted extension recommendations use an unknown shape and were left unchanged.',\n );\n }\n\n return applyEditorUpdates(\n contents,\n updates,\n 'VS Code policy extension recommendations',\n warnings,\n );\n}\n\n/**\n * Build the generated target-scoped VS Code lint task.\n *\n * @param repositoryRoot - Root that owns `.vscode`\n * @param targetDirectory - Selected policy project directory\n * @returns VS Code task object\n */\nexport function buildPolicyLintTask(\n repositoryRoot: string,\n targetDirectory: string,\n): Record<string, unknown> {\n const target = relative(repositoryRoot, targetDirectory).split(sep).join('/') || '.';\n return {\n label: 'policy: lint',\n type: 'process',\n command: 'transcend',\n args: ['policy', 'lint', '--dir', target, '--noInteractive'],\n group: {\n kind: 'test',\n isDefault: true,\n },\n problemMatcher: [],\n };\n}\n\n/**\n * Merge the default policy lint task while preserving custom tasks.\n *\n * @param contents - Existing `.vscode/tasks.json` JSONC\n * @param repositoryRoot - Root that owns `.vscode`\n * @param targetDirectory - Selected policy project directory\n * @returns Merged task configuration and warnings\n */\nexport function mergePolicyEditorTasks(\n contents: string | null,\n repositoryRoot: string,\n targetDirectory: string,\n): PolicyEditorMergeResult {\n const parsed = parseEditorObject(contents, 'VS Code policy tasks');\n if ('warning' in parsed) {\n return { contents: parsed.contents, warnings: [parsed.warning] };\n }\n const { current } = parsed;\n const updates: JsoncUpdate[] = [];\n const warnings: string[] = [];\n const version = current.version;\n if (version === undefined) {\n updates.push({ path: ['version'], value: '2.0.0' });\n } else if (version !== '2.0.0') {\n warnings.push('VS Code task schema version is customized and was left unchanged.');\n }\n\n const desiredTask = buildPolicyLintTask(repositoryRoot, targetDirectory);\n const tasks = current.tasks;\n if (tasks === undefined) {\n updates.push({ path: ['tasks'], value: [desiredTask] });\n } else if (Array.isArray(tasks)) {\n const matchingTask = tasks.find(\n (task) =>\n task !== null &&\n typeof task === 'object' &&\n !Array.isArray(task) &&\n (task as Record<string, unknown>).label === 'policy: lint',\n );\n if (matchingTask === undefined) {\n updates.push({ path: ['tasks'], value: [...tasks, desiredTask] });\n } else if (!configurationValuesEqual(matchingTask, desiredTask)) {\n warnings.push(\n 'VS Code task \"policy: lint\" has repository-specific customization and was left unchanged.',\n );\n }\n } else {\n warnings.push('VS Code tasks use an unknown shape and were left unchanged.');\n }\n\n return applyEditorUpdates(contents, updates, 'VS Code policy tasks', warnings);\n}\n","import { isAbsolute, join, posix, relative, sep } from 'node:path';\n\nimport {\n getManagedAgentSkillCandidatePaths,\n planManagedAgentSkill,\n type ManagedAgentSkillDefinition,\n} from '../scaffolding/agent-skill.js';\nimport { displayProjectPath, quoteShellArgument } from '../scaffolding/project-plan-output.js';\nimport {\n getPlanningPathSnapshot,\n getPlanningFileSnapshot,\n planFileChange,\n type PlanningPathSnapshot,\n} from '../scaffolding/project-plan.js';\nimport { getPolicyManifestPath } from './policy-project-discovery.js';\nimport {\n generatePolicyGithubActionsWorkflow,\n POLICY_CI_WORKFLOW_PATH,\n} from './policy-scaffold-artifacts.js';\nimport {\n mergePolicyEditorExtensions,\n mergePolicyEditorSettings,\n mergePolicyEditorTasks,\n type PolicyEditorMergeResult,\n} from './policy-scaffold-config.js';\nimport {\n POLICY_INIT_RESULT_VERSION,\n PolicySetupFeature,\n type PolicyInitProjectPlan,\n type PolicyProjectState,\n type PolicySetupFeature as PolicySetupFeatureType,\n} from './policy-scaffold-model.js';\nimport { generatePolicyStarterFiles, type PolicyStarterFile } from './policy-scaffold-templates.js';\nimport { POLICY_SKILL_FILES, POLICY_SKILL_NAME } from './policy-skill.js';\n\n/** Managed Policy Engine Agent Skill definition. */\nconst POLICY_MANAGED_SKILL: ManagedAgentSkillDefinition = {\n name: POLICY_SKILL_NAME,\n displayName: 'Policy Engine',\n owner: '@transcend-io/cli',\n files: POLICY_SKILL_FILES,\n};\n\n/** In-memory input consumed by the pure policy initializer. */\nexport interface PolicyInitPlanningInput {\n /** Project discovery state. */\n state: PolicyProjectState;\n /** Potential mutation paths keyed by absolute path. */\n snapshots: Readonly<Record<string, PlanningPathSnapshot>>;\n}\n\n/** Optional repository setup selected for policy initialization. */\nexport interface PolicyInitPlanOptions {\n /** Selected setup features. */\n features: readonly PolicySetupFeatureType[];\n /** Exact released Transcend CLI version for generated CI. */\n cliVersion: string;\n}\n\n/**\n * Build the copyable policy lint command for one target.\n *\n * @param state - Discovered project state\n * @returns Raw one-line command\n */\nexport function buildPolicyLintCommand(state: PolicyProjectState): string {\n const directory = displayProjectPath(state.invocationDirectory, state.targetDirectory);\n return `transcend policy lint --dir ${quoteShellArgument(directory)} --noInteractive`;\n}\n\n/**\n * Enumerate all core starter paths that could be created.\n *\n * @param state - Policy project state\n * @param options - Selected repository setup\n * @returns Absolute candidate paths\n */\nexport function getPolicyInitPlanningCandidatePaths(\n state: PolicyProjectState,\n options: Pick<PolicyInitPlanOptions, 'features'>,\n): string[] {\n const paths = new Set(\n generatePolicyStarterFiles().map(({ path }) => join(state.targetDirectory, path)),\n );\n const selected = new Set(options.features);\n if (selected.has(PolicySetupFeature.Editor)) {\n paths.add(join(state.projectRoot, '.vscode', 'settings.json'));\n paths.add(join(state.projectRoot, '.vscode', 'extensions.json'));\n paths.add(join(state.projectRoot, '.vscode', 'tasks.json'));\n }\n if (selected.has(PolicySetupFeature.Skill)) {\n getManagedAgentSkillCandidatePaths(\n state.projectRoot,\n state.existingSkillDirectories,\n POLICY_MANAGED_SKILL,\n ).forEach((path) => paths.add(path));\n }\n if (selected.has(PolicySetupFeature.Ci) && state.repositoryRoot && state.usesGithub) {\n paths.add(join(state.repositoryRoot, POLICY_CI_WORKFLOW_PATH));\n }\n return [...paths].sort((left, right) => left.localeCompare(right));\n}\n\n/**\n * Ensure a destination stays below an approved project root.\n *\n * @param root - Approved root\n * @param path - Candidate path\n */\nfunction assertContained(root: string, path: string): void {\n const child = relative(root, path);\n if (child === '..' || child.startsWith(`..${sep}`) || isAbsolute(child)) {\n throw new Error(`Refusing to modify path outside project root: ${path}`);\n }\n}\n\n/**\n * Enumerate generated file and directory paths allowed in an exact starter.\n *\n * @param files - Starter files\n * @returns POSIX relative paths\n */\nfunction starterRelativePaths(files: readonly PolicyStarterFile[]): Set<string> {\n const paths = new Set<string>(['input.json']);\n files.forEach(({ path }) => {\n paths.add(path);\n let parent = posix.dirname(path);\n while (parent !== '.') {\n paths.add(parent);\n parent = posix.dirname(parent);\n }\n });\n return paths;\n}\n\n/**\n * Add or classify one regular-file mutation.\n *\n * @param plan - Policy plan being assembled\n * @param input - Collected snapshots\n * @param options - Desired file\n */\nfunction addFileChange(\n plan: PolicyInitProjectPlan,\n input: PolicyInitPlanningInput,\n options: {\n /** Absolute destination path. */\n path: string;\n /** Complete desired contents. */\n contents: string;\n /** Human-readable plan description. */\n description: string;\n /** Refuse existing contents. */\n createOnly?: boolean;\n },\n): void {\n const change = planFileChange({\n snapshot: getPlanningFileSnapshot(input.snapshots, options.path),\n after: options.contents,\n description: options.description,\n ...(options.createOnly === undefined ? {} : { createOnly: options.createOnly }),\n });\n if (change) {\n plan.changes.push(change);\n } else {\n plan.unchanged.push(options.path);\n }\n}\n\n/**\n * Add one safe editor merge and its preservation warnings.\n *\n * @param plan - Policy plan being assembled\n * @param input - Collected snapshots\n * @param path - Absolute editor artifact path\n * @param result - Pure JSONC merge result\n * @param description - Human-readable plan description\n * @param cwd - Invocation directory for portable warning paths\n */\nfunction addEditorMerge(\n plan: PolicyInitProjectPlan,\n input: PolicyInitPlanningInput,\n path: string,\n result: PolicyEditorMergeResult,\n description: string,\n cwd: string,\n): void {\n addFileChange(plan, input, {\n path,\n contents: result.contents,\n description,\n });\n plan.warnings.push(\n ...result.warnings.map((warning) => `${warning} (${displayProjectPath(cwd, path)})`),\n );\n}\n\n/**\n * Build a safe policy project plan without reading the filesystem.\n *\n * Empty targets receive the complete starter. Existing targets are classified\n * only; no domain file is added, merged, or overwritten.\n *\n * @param input - Collected project state and path snapshots\n * @param options - Selected setup and pinned CLI version\n * @returns Validated policy initialization plan\n */\nexport function buildPolicyInitPlan(\n input: PolicyInitPlanningInput,\n options: PolicyInitPlanOptions,\n): PolicyInitProjectPlan {\n const { state } = input;\n const files = generatePolicyStarterFiles();\n const manifestPath = getPolicyManifestPath(state);\n const lintCommand = buildPolicyLintCommand(state);\n const resultPath = join(state.targetDirectory, 'policy_engine', 'example', 'result.rego');\n const plan: PolicyInitProjectPlan = {\n version: POLICY_INIT_RESULT_VERSION,\n command: 'init',\n rootDirectory: state.projectRoot,\n targetDirectory: state.targetDirectory,\n manifestPath,\n changes: [],\n unchanged: [],\n warnings: [],\n nextSteps: [lintCommand],\n features: [...options.features],\n };\n\n const candidatePaths = getPolicyInitPlanningCandidatePaths(state, options);\n assertContained(state.projectRoot, state.targetDirectory);\n candidatePaths.forEach((path) => assertContained(state.projectRoot, path));\n\n let hasDisposableExample = false;\n if (state.relativeFilePaths.length === 0) {\n hasDisposableExample = true;\n plan.directoryPreconditions = [\n {\n path: state.targetDirectory,\n relativePaths: [...state.relativePaths],\n },\n ];\n files.forEach((file) => {\n const path = join(state.targetDirectory, file.path);\n const snapshot = getPlanningPathSnapshot(input.snapshots, path);\n if (snapshot.kind !== 'absent') {\n throw new Error(`Expected an empty policy target, but found an entry at: ${path}`);\n }\n addFileChange(plan, input, {\n path,\n contents: file.contents,\n description: file.description,\n createOnly: true,\n });\n });\n } else {\n let allStarterFilesMatch = true;\n files.forEach((file) => {\n const path = join(state.targetDirectory, file.path);\n const snapshot = getPlanningPathSnapshot(input.snapshots, path);\n if (snapshot.kind === 'file' && snapshot.contents === file.contents) {\n plan.unchanged.push(path);\n return;\n }\n allStarterFilesMatch = false;\n if (snapshot.kind !== 'absent') {\n plan.unchanged.push(path);\n plan.warnings.push(\n `Existing policy scaffold path was left unchanged: ${displayProjectPath(\n state.invocationDirectory,\n path,\n )}`,\n );\n }\n });\n hasDisposableExample = allStarterFilesMatch;\n\n const allowedPaths = starterRelativePaths(files);\n const hasCustomPaths = state.relativeFilePaths.some((path) => !allowedPaths.has(path));\n if (!allStarterFilesMatch || hasCustomPaths) {\n plan.warnings.push(\n `Existing policy target contains custom or partial content, so no starter files were added or overwritten. ` +\n `Review ${displayProjectPath(\n state.invocationDirectory,\n state.targetDirectory,\n )} manually, then run \\`${lintCommand}\\`.`,\n );\n }\n }\n if (hasDisposableExample) {\n plan.disposableExamplePath = resultPath;\n plan.nextSteps.push(\n `Edit ${quoteShellArgument(displayProjectPath(state.invocationDirectory, resultPath))}`,\n );\n }\n\n const selected = new Set(options.features);\n const root = state.projectRoot;\n if (selected.has(PolicySetupFeature.Editor)) {\n const settingsPath = join(root, '.vscode', 'settings.json');\n const extensionsPath = join(root, '.vscode', 'extensions.json');\n const tasksPath = join(root, '.vscode', 'tasks.json');\n const editorArtifacts = [\n {\n path: settingsPath,\n description: 'Merge strict target-scoped OPA and Rego editor settings',\n merge: mergePolicyEditorSettings,\n },\n {\n path: extensionsPath,\n description: 'Recommend the OPA extension and discourage its syntax-only conflict',\n merge: (\n contents: string | null,\n _repositoryRoot: string,\n _targetDirectory: string,\n ): PolicyEditorMergeResult => mergePolicyEditorExtensions(contents),\n },\n {\n path: tasksPath,\n description: 'Add the default target-scoped policy lint task',\n merge: mergePolicyEditorTasks,\n },\n ];\n editorArtifacts.forEach(({ path, description, merge }) => {\n const snapshot = getPlanningPathSnapshot(input.snapshots, path);\n if (snapshot.kind !== 'absent' && snapshot.kind !== 'file') {\n plan.unchanged.push(path);\n plan.warnings.push(\n `Existing VS Code artifact is not a regular file and was left unchanged: ${displayProjectPath(\n state.invocationDirectory,\n path,\n )}`,\n );\n return;\n }\n addEditorMerge(\n plan,\n input,\n path,\n merge(snapshot.kind === 'file' ? snapshot.contents : null, root, state.targetDirectory),\n description,\n state.invocationDirectory,\n );\n });\n }\n\n if (selected.has(PolicySetupFeature.Skill)) {\n const skillPlan = planManagedAgentSkill({\n rootDirectory: root,\n existingDirectories: state.existingSkillDirectories,\n snapshots: input.snapshots,\n skill: POLICY_MANAGED_SKILL,\n preserveModified: true,\n });\n plan.changes.push(...skillPlan.changes);\n plan.unchanged.push(...skillPlan.unchanged);\n plan.warnings.push(\n ...skillPlan.warnings.map((warning) => {\n return skillPlan.unchanged.reduce(\n (rendered, path) =>\n rendered.replace(path, displayProjectPath(state.invocationDirectory, path)),\n warning,\n );\n }),\n );\n }\n\n if (selected.has(PolicySetupFeature.Ci)) {\n if (!state.repositoryRoot || !state.usesGithub) {\n plan.warnings.push(\n 'GitHub Actions setup was selected, but this target is not inside a detected GitHub repository.',\n );\n } else {\n const workflowPath = join(state.repositoryRoot, POLICY_CI_WORKFLOW_PATH);\n const target =\n relative(state.repositoryRoot, state.targetDirectory).split(sep).join('/') || '.';\n const workflowContents = generatePolicyGithubActionsWorkflow({\n cliVersion: options.cliVersion,\n targetDirectory: target,\n });\n const workflowSnapshot = getPlanningPathSnapshot(input.snapshots, workflowPath);\n if (workflowSnapshot.kind === 'absent') {\n addFileChange(plan, input, {\n path: workflowPath,\n contents: workflowContents,\n description: 'Add credential-free Policy Engine validation',\n createOnly: true,\n });\n } else if (\n workflowSnapshot.kind === 'file' &&\n workflowSnapshot.contents === workflowContents\n ) {\n plan.unchanged.push(workflowPath);\n } else {\n plan.unchanged.push(workflowPath);\n plan.warnings.push(\n `Existing GitHub Actions workflow was left unchanged: ${displayProjectPath(\n state.invocationDirectory,\n workflowPath,\n )}. Adapt it manually to run \\`${lintCommand}\\`.`,\n );\n }\n }\n }\n\n plan.changes.forEach(({ path }) => assertContained(state.projectRoot, path));\n return plan;\n}\n","import colors from 'colors';\n\nimport { version as CLI_VERSION } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport {\n runCapturedProcess,\n type CapturedProcessResult,\n type CapturedProcessRunner,\n} from '../../../lib/cli/run-captured-process.js';\nimport {\n DEFAULT_POLICY_PROJECT_DIRECTORY,\n discoverPolicyProject,\n} from '../../../lib/policy/policy-project-discovery.js';\nimport {\n OPA_INSTALL_URL,\n OPA_MISSING_MESSAGE,\n parsePolicyToolVersion,\n MINIMUM_POLICY_STARTER_REGAL_VERSION,\n REGAL_INSTALL_URL,\n REGAL_MISSING_MESSAGE,\n unsupportedOpaVersionMessage,\n unsupportedRegalVersionMessage,\n} from '../../../lib/policy/policy-runtime.js';\nimport {\n PolicySetupFeature,\n type PolicySetupFeature as PolicySetupFeatureType,\n} from '../../../lib/policy/policy-scaffold-model.js';\nimport {\n buildPolicyInitAiHandoff,\n buildPolicyInitPlanResult,\n type PolicyInitToolVersions,\n} from '../../../lib/policy/policy-scaffold-output.js';\nimport {\n buildPolicyInitPlan,\n getPolicyInitPlanningCandidatePaths,\n} from '../../../lib/policy/policy-scaffold-planning.js';\nimport { collectPlanningSnapshots } from '../../../lib/scaffolding/project-discovery.js';\nimport { applyProjectPlan } from '../../../lib/scaffolding/project-plan-apply.js';\nimport {\n displayProjectPath,\n quoteShellArgument,\n renderProjectPlan,\n} from '../../../lib/scaffolding/project-plan-output.js';\nimport {\n PromptCancelledError,\n type PromptChoice,\n ScaffoldPrompts,\n} from '../../../lib/scaffolding/prompts.js';\n\n/** Flags for `transcend policy init`. */\nexport interface PolicyInitFlags {\n /** Install repository-level VS Code setup. */\n editor?: boolean;\n /** Install the Policy Engine Agent Skill. */\n skill?: boolean;\n /** Install validation-only GitHub Actions CI. */\n ci?: boolean;\n /** Disable prompts. */\n noInteractive: boolean;\n /** Render but do not apply the plan. */\n dryRun: boolean;\n /** Approve the final displayed plan. */\n yes: boolean;\n /** Emit one stable JSON result on stdout. */\n json: boolean;\n}\n\n/** User-facing optional setup labels. */\nconst SETUP_LABELS: Readonly<Record<PolicySetupFeatureType, string>> = {\n [PolicySetupFeature.Editor]: 'VS Code settings and lint task',\n [PolicySetupFeature.Skill]: 'Policy Engine Agent Skill',\n [PolicySetupFeature.Ci]: 'Validation-only GitHub Actions',\n};\n\n/** All optional setup features in stable prompt order. */\nconst ALL_SETUP_FEATURES = Object.values(PolicySetupFeature);\n\n/** Runtime compatibility detected before policy planning. */\ninterface PolicyRuntimeProbe {\n /** Compatible tool versions. */\n tools: PolicyInitToolVersions;\n /** Missing or incompatible runtime guidance. */\n warnings: string[];\n}\n\n/**\n * Whether this invocation can ask questions.\n *\n * @param flags - Interaction flags\n * @param stdinIsTTY - Whether standard input is interactive\n * @param stderrIsTTY - Whether prompt output is interactive\n * @returns Whether prompts are enabled\n */\nfunction isInteractiveInvocation(\n flags: Pick<PolicyInitFlags, 'json' | 'noInteractive'>,\n stdinIsTTY: boolean | undefined,\n stderrIsTTY: boolean | undefined,\n): boolean {\n return !flags.json && !flags.noInteractive && Boolean(stdinIsTTY && stderrIsTTY);\n}\n\n/**\n * Resolve setup from explicit flags or one default-selected checklist.\n *\n * @param prompts - Prompt adapters\n * @param flags - Setup flags\n * @param options - Interaction state\n * @returns Explicitly selected setup features\n */\nasync function resolveFeatures(\n prompts: ScaffoldPrompts,\n flags: PolicyInitFlags,\n options: {\n /** Whether prompts are available. */\n interactive: boolean;\n },\n): Promise<PolicySetupFeatureType[]> {\n const enabled: Readonly<Record<PolicySetupFeatureType, boolean | undefined>> = {\n [PolicySetupFeature.Editor]: flags.editor,\n [PolicySetupFeature.Skill]: flags.skill,\n [PolicySetupFeature.Ci]: flags.ci,\n };\n if (!options.interactive) {\n return ALL_SETUP_FEATURES.filter((feature) => enabled[feature] === true);\n }\n const choices: PromptChoice<PolicySetupFeatureType>[] = ALL_SETUP_FEATURES.map((feature) => ({\n name: SETUP_LABELS[feature],\n value: feature,\n checked: enabled[feature] !== false,\n }));\n return prompts.checkbox('Choose repository setup:', choices);\n}\n\n/**\n * Explain a failed version subprocess with official installation guidance.\n *\n * @param tool - Policy tool name\n * @param result - Failed captured process\n * @returns Actionable warning\n */\nfunction failedVersionProbeMessage(tool: 'OPA' | 'Regal', result: CapturedProcessResult): string {\n const detail = [result.stdout.trim(), result.stderr.trim()].filter(Boolean).join('\\n');\n const url = tool === 'OPA' ? OPA_INSTALL_URL : REGAL_INSTALL_URL;\n const requirement =\n tool === 'OPA' ? 'OPA 1.x' : `Regal ${MINIMUM_POLICY_STARTER_REGAL_VERSION} or newer`;\n return (\n `${requirement} is required, but \\`${tool.toLowerCase()} version\\` exited with code ` +\n `${result.code}${detail ? `: ${detail}` : '.'} ` +\n `Install or upgrade it using the official instructions: ${url}`\n );\n}\n\n/**\n * Probe both local policy runtimes without installing or modifying them.\n *\n * @param context - CLI context\n * @param cwd - Invocation working directory\n * @param runner - Captured subprocess runner\n * @returns Compatible versions and exact runtime guidance\n */\nasync function probePolicyRuntimes(\n context: LocalContext,\n cwd: string,\n runner: CapturedProcessRunner,\n): Promise<PolicyRuntimeProbe> {\n const tools: PolicyInitToolVersions = { opa: null, regal: null };\n const warnings: string[] = [];\n\n const opaResult = await runner('opa', ['version'], { cwd }, context);\n if (opaResult.error?.code === 'ENOENT') {\n warnings.push(OPA_MISSING_MESSAGE);\n } else {\n const output = `${opaResult.stdout}\\n${opaResult.stderr}`;\n const unsupported = unsupportedOpaVersionMessage(output);\n if (opaResult.code !== 0) {\n warnings.push(unsupported ?? failedVersionProbeMessage('OPA', opaResult));\n } else if (unsupported) {\n warnings.push(unsupported);\n } else {\n tools.opa = parsePolicyToolVersion(output)!.version;\n }\n }\n\n const regalResult = await runner('regal', ['version'], { cwd }, context);\n if (regalResult.error?.code === 'ENOENT') {\n warnings.push(REGAL_MISSING_MESSAGE);\n } else {\n const output = `${regalResult.stdout}\\n${regalResult.stderr}`;\n const unsupported = unsupportedRegalVersionMessage(\n output,\n MINIMUM_POLICY_STARTER_REGAL_VERSION,\n 'the generated OPA 1.13.1 capabilities configuration',\n );\n if (regalResult.code !== 0) {\n warnings.push(unsupported ?? failedVersionProbeMessage('Regal', regalResult));\n } else if (unsupported) {\n warnings.push(unsupported);\n } else {\n tools.regal = parsePolicyToolVersion(output)!.version;\n }\n }\n\n return { tools, warnings };\n}\n\n/**\n * Initialize a credential-free local Policy Engine project.\n *\n * @param this - CLI context\n * @param flags - Scaffold and interaction flags\n * @param directory - Target policy directory\n * @param runner - Captured policy tool runner\n */\nexport async function init(\n this: LocalContext,\n flags: PolicyInitFlags,\n directory: string = DEFAULT_POLICY_PROJECT_DIRECTORY,\n runner: CapturedProcessRunner = runCapturedProcess,\n): Promise<void> {\n doneInputValidation(this.process);\n try {\n const runtime = await probePolicyRuntimes(this, this.process.cwd(), runner);\n const state = discoverPolicyProject(this, directory);\n const prompts = new ScaffoldPrompts(this);\n const interactive = isInteractiveInvocation(\n flags,\n this.process.stdin.isTTY,\n this.process.stderr.isTTY,\n );\n const features = await resolveFeatures(prompts, flags, { interactive });\n const candidatePaths = getPolicyInitPlanningCandidatePaths(state, { features });\n const snapshots = collectPlanningSnapshots(this, state.projectRoot, candidatePaths);\n\n const plan = buildPolicyInitPlan(\n { state, snapshots },\n {\n features,\n cliVersion: CLI_VERSION,\n },\n );\n plan.warnings.push(...runtime.warnings);\n\n if (!flags.json) {\n this.logger.info(\n renderProjectPlan(plan, {\n cwd: this.process.cwd(),\n title: 'Policy initialization plan',\n details: [\n { label: 'Target', path: plan.targetDirectory },\n { label: 'Manifest', path: plan.manifestPath },\n ],\n }),\n );\n }\n\n let approved = plan.changes.length === 0 || flags.dryRun;\n if (plan.changes.length > 0 && !flags.dryRun) {\n if (flags.yes) {\n approved = true;\n } else if (interactive) {\n approved = await prompts.confirm('Apply this complete plan?', true);\n } else {\n throw new Error(\n 'The plan requires approval in a non-interactive invocation. Review with --dryRun, then pass --yes.',\n );\n }\n }\n\n if (approved && !flags.dryRun && plan.changes.length > 0) {\n await applyProjectPlan(this, plan);\n }\n const applied = approved && !flags.dryRun && plan.changes.length > 0;\n const setupAvailable = approved && !flags.dryRun;\n const aiHandoff = buildPolicyInitAiHandoff({\n projectPath: quoteShellArgument(\n displayProjectPath(this.process.cwd(), state.targetDirectory),\n ),\n ...(plan.disposableExamplePath\n ? {\n examplePath: quoteShellArgument(\n displayProjectPath(this.process.cwd(), plan.disposableExamplePath),\n ),\n }\n : {}),\n hasSkill: setupAvailable && features.includes(PolicySetupFeature.Skill),\n lintCommand: plan.nextSteps[0]!,\n });\n const result = buildPolicyInitPlanResult(plan, {\n applied,\n dryRun: flags.dryRun,\n cwd: this.process.cwd(),\n aiHandoff,\n tools: runtime.tools,\n });\n if (flags.json) {\n this.process.stdout.write(`${JSON.stringify(result)}\\n`);\n return;\n }\n if (flags.dryRun) {\n this.logger.info(colors.yellow('Dry run complete. No changes were written.'));\n return;\n }\n if (!approved) {\n this.logger.info(colors.yellow('No changes applied.'));\n return;\n }\n if (plan.changes.length === 0) {\n const message =\n plan.warnings.length === runtime.warnings.length\n ? 'Policy project is already initialized.'\n : 'Existing policy project was left unchanged.';\n this.logger.info(colors.green(message));\n } else {\n this.logger.info(colors.green('Policy project initialized.'));\n }\n if (plan.nextSteps.length > 0) {\n this.logger.info(`\\n${colors.bold('Next steps')}`);\n plan.nextSteps.forEach((step) => this.logger.info(step));\n }\n this.logger.info(`\\n${colors.bold('AI handoff — paste into your coding agent')}`);\n this.logger.info(aiHandoff);\n } catch (error) {\n if (error instanceof PromptCancelledError) {\n return this.process.exit(130);\n }\n throw error;\n }\n}\n"],"mappings":"umBAUA,MAAa,EAAmC,mBAShD,SAAgB,GACd,EACA,EAAoB,EACA,CACpB,IAAM,EAAsB,EAAQ,QAAQ,KAAK,CAC3C,EAAkB,GAAQ,EAAqB,EAAU,CAC/D,GACE,EAAQ,GAAG,WAAW,EAAgB,EACtC,CAAC,EAAQ,GAAG,SAAS,EAAgB,CAAC,aAAa,CAEnD,MAAU,MAAM,qCAAqC,IAAkB,CAOzE,MAAO,CACL,sBACA,kBACA,GARiB,EAA0B,EAAS,CACpD,sBACA,kBACA,sBAAuB,EACxB,CAIc,CACb,cAAe,EAA4B,EAAS,EAAgB,CACpE,kBAAmB,EAA4B,EAAS,EAAiB,CACvE,mBAAoB,GACrB,CAAC,CACH,CASH,SAAgB,GAAsB,EAAmC,CACvE,OAAO,EAAK,EAAM,gBAAiB,gBAAgB,CC/CrD,MAAa,EAAqB,CAEhC,OAAQ,SAER,MAAO,QAEP,GAAI,KACL,QCdD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KCAA;;;;;;;;;;;;;;;;;;;;KCAA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EAE1D,KAAK,OAAO,KAAK,KAAK,EAAO,KAAK,4CAA4C,GAAG,CACjF,KAAK,OAAO,KAAK,EAAU,OACpB,EAAO,CACd,GAAI,aAAiB,GACnB,OAAO,KAAK,QAAQ,KAAK,IAAI,CAE/B,MAAM"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-BEA5cQOT2.mjs","names":[],"sources":["../src/commands/request/cron/pull-identifiers/impl.ts"],"sourcesContent":["import { RequestAction } from '@transcend-io/privacy-types';\nimport colors from 'colors';\nimport { uniq } from 'lodash-es';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport {\n CsvFormattedIdentifier,\n pullChunkedCustomSiloOutstandingIdentifiers,\n} from '../../../../lib/cron/index.js';\nimport { parseFilePath, writeLargeCsv } from '../../../../lib/helpers/index.js';\n\nexport interface PullIdentifiersCommandFlags {\n file: string;\n transcendUrl: string;\n auth: string;\n sombraAuth?: string;\n dataSiloId: string;\n actions: RequestAction[];\n pageLimit: number;\n skipRequestCount: boolean;\n chunkSize: number;\n}\n\nexport async function pullIdentifiers(\n this: LocalContext,\n {\n file,\n transcendUrl,\n auth,\n sombraAuth,\n dataSiloId,\n actions,\n pageLimit,\n skipRequestCount,\n chunkSize,\n }: PullIdentifiersCommandFlags,\n): Promise<void> {\n if (skipRequestCount) {\n this.logger.info(\n colors.yellow('Skipping request count as requested. This may help speed up the call.'),\n );\n }\n\n if (Number.isNaN(chunkSize) || chunkSize <= 0 || chunkSize % pageLimit !== 0) {\n this.logger.error(\n colors.red(\n `Invalid chunk size: \"${chunkSize}\". Must be a positive integer that is a multiple of ${pageLimit}.`,\n ),\n );\n this.process.exit(1);\n }\n\n doneInputValidation(this.process);\n\n const { baseName, extension } = parseFilePath(file);\n let fileCount = 0;\n\n const onSave = async (chunk: CsvFormattedIdentifier[]): Promise<void> => {\n const numberedFileName = `${baseName}-${fileCount}${extension}`;\n this.logger.info(\n colors.blue(`Saving ${chunk.length} identifiers to file \"${numberedFileName}\"`),\n );\n\n const headers = uniq(chunk.map((d) => Object.keys(d)).flat());\n await writeLargeCsv(numberedFileName, chunk, headers);\n this.logger.info(\n colors.green(`Successfully wrote ${chunk.length} identifiers to file \"${numberedFileName}\"`),\n );\n fileCount += 1;\n return Promise.resolve();\n };\n\n // Pull down outstanding identifiers\n await pullChunkedCustomSiloOutstandingIdentifiers({\n transcendUrl,\n apiPageSize: pageLimit,\n savePageSize: chunkSize,\n onSave,\n actions,\n auth,\n sombraAuth,\n dataSiloId,\n skipRequestCount,\n });\n}\n"],"mappings":"kPAwBA,eAAsB,EAEpB,CACE,OACA,eACA,OACA,aACA,aACA,UACA,YACA,mBACA,aAEa,CACX,GACF,KAAK,OAAO,KACV,EAAO,OAAO,wEAAwE,CACvF,EAGC,OAAO,MAAM,EAAU,EAAI,GAAa,GAAK,EAAY,IAAc,KACzE,KAAK,OAAO,MACV,EAAO,IACL,wBAAwB,EAAU,sDAAsD,EAAU,GACnG,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAGtB,EAAoB,KAAK,QAAQ,CAEjC,GAAM,CAAE,WAAU,aAAc,EAAc,EAAK,CAC/C,EAAY,EAkBhB,MAAM,EAA4C,CAChD,eACA,YAAa,EACb,aAAc,EACd,YApBoB,IAAmD,CACvE,IAAM,EAAmB,GAAG,EAAS,GAAG,IAAY,IAWpD,OAVA,KAAK,OAAO,KACV,EAAO,KAAK,UAAU,EAAM,OAAO,wBAAwB,EAAiB,GAAG,CAChF,CAGD,MAAM,EAAc,EAAkB,EADtB,EAAK,EAAM,IAAK,GAAM,OAAO,KAAK,EAAE,CAAC,CAAC,MAAM,CACR,CAAC,CACrD,KAAK,OAAO,KACV,EAAO,MAAM,sBAAsB,EAAM,OAAO,wBAAwB,EAAiB,GAAG,CAC7F,CACD,GAAa,EACN,QAAQ,SAAS,EASxB,UACA,OACA,aACA,aACA,mBACD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-BhfxcCgN2.mjs","names":[],"sources":["../src/commands/request/cancel/impl.ts"],"sourcesContent":["import { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { cancelPrivacyRequests } from '../../../lib/requests/index.js';\n\nexport interface CancelCommandFlags {\n auth: string;\n actions: RequestAction[];\n statuses?: RequestStatus[];\n requestIds?: string[];\n silentModeBefore?: Date;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n cancellationTitle: string;\n transcendUrl: string;\n concurrency: number;\n}\n\nexport async function cancel(\n this: LocalContext,\n {\n auth,\n actions,\n statuses = [],\n requestIds,\n silentModeBefore,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n cancellationTitle,\n transcendUrl,\n concurrency,\n }: CancelCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await cancelPrivacyRequests({\n transcendUrl,\n requestActions: actions,\n auth,\n cancellationTitle,\n requestIds,\n statuses,\n concurrency,\n silentModeBefore: silentModeBefore ? new Date(silentModeBefore) : undefined,\n createdAtBefore: createdAtBefore ? new Date(createdAtBefore) : undefined,\n createdAtAfter: createdAtAfter ? new Date(createdAtAfter) : undefined,\n updatedAtBefore: updatedAtBefore ? new Date(updatedAtBefore) : undefined,\n updatedAtAfter: updatedAtAfter ? new Date(updatedAtAfter) : undefined,\n });\n}\n"],"mappings":"6GAqBA,eAAsB,EAEpB,CACE,OACA,UACA,WAAW,EAAE,CACb,aACA,mBACA,kBACA,iBACA,kBACA,iBACA,oBACA,eACA,eAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAM,EAAsB,CAC1B,eACA,eAAgB,EAChB,OACA,oBACA,aACA,WACA,cACA,iBAAkB,EAAmB,IAAI,KAAK,EAAiB,CAAG,IAAA,GAClE,gBAAiB,EAAkB,IAAI,KAAK,EAAgB,CAAG,IAAA,GAC/D,eAAgB,EAAiB,IAAI,KAAK,EAAe,CAAG,IAAA,GAC5D,gBAAiB,EAAkB,IAAI,KAAK,EAAgB,CAAG,IAAA,GAC/D,eAAgB,EAAiB,IAAI,KAAK,EAAe,CAAG,IAAA,GAC7D,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-BppXJ1AD2.mjs","names":[],"sources":["../src/commands/request/cron/pull-profiles/impl.ts"],"sourcesContent":["import type { RequestAction } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient, fetchRequestFilesForRequest } from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport colors from 'colors';\nimport { uniq, chunk } from 'lodash-es';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport {\n pullChunkedCustomSiloOutstandingIdentifiers,\n type CsvFormattedIdentifier,\n} from '../../../../lib/cron/index.js';\nimport { parseFilePath, writeLargeCsv } from '../../../../lib/helpers/index.js';\n\nexport interface PullProfilesCommandFlags {\n file: string;\n fileTarget: string;\n transcendUrl: string;\n auth: string;\n sombraAuth?: string;\n cronDataSiloId: string;\n targetDataSiloId: string;\n actions: RequestAction[];\n skipRequestCount: boolean;\n pageLimit: number;\n chunkSize: number;\n}\n\nexport async function pullProfiles(\n this: LocalContext,\n {\n file,\n fileTarget,\n transcendUrl,\n auth,\n sombraAuth,\n cronDataSiloId,\n targetDataSiloId,\n actions,\n skipRequestCount,\n pageLimit,\n chunkSize,\n }: PullProfilesCommandFlags,\n): Promise<void> {\n if (skipRequestCount) {\n this.logger.info(\n colors.yellow('Skipping request count as requested. This may help speed up the call.'),\n );\n }\n\n if (Number.isNaN(chunkSize) || chunkSize <= 0 || chunkSize % pageLimit !== 0) {\n this.logger.error(\n colors.red(\n `Invalid chunk size: \"${chunkSize}\". Must be a positive integer that is a multiple of ${pageLimit}.`,\n ),\n );\n this.process.exit(1);\n }\n\n doneInputValidation(this.process);\n\n // Create GraphQL client to connect to Transcend backend\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const { baseName, extension } = parseFilePath(file);\n const { baseName: baseNameTarget, extension: extensionTarget } = parseFilePath(fileTarget);\n\n let allIdentifiersCount = 0;\n let allTargetIdentifiersCount = 0;\n let fileCount = 0;\n // Create onSave callback to handle chunked processing\n const onSave = async (chunkToSave: CsvFormattedIdentifier[]): Promise<void> => {\n // Add to all identifiers\n allIdentifiersCount += chunkToSave.length;\n\n // Get unique request IDs from this chunk\n const requestIds = chunkToSave.map((d) => d.requestId as string);\n const uniqueRequestIds = uniq(requestIds);\n\n // Pull down target identifiers for this chunk\n const chunkedRequestIds = chunk(uniqueRequestIds, pageLimit);\n const results = await map(\n chunkedRequestIds,\n async (requestIds) => {\n this.logger.info(\n colors.magenta(`Fetching target identifiers for ${requestIds.length} requests`),\n );\n const results = await fetchRequestFilesForRequest(client, {\n logger: this.logger,\n pageSize: pageLimit * 2,\n filterBy: {\n requestIds,\n dataSiloIds: [targetDataSiloId],\n },\n });\n return results.map(({ fileName, remoteId }) => {\n if (!remoteId) {\n throw new Error(`Failed to find remoteId for ${fileName}`);\n }\n return {\n RecordId: remoteId,\n Object: fileName.replace('.json', '').split('/').pop()?.replace(' Information', ''),\n Comment: 'Customer data deletion request submitted via transcend.io',\n };\n });\n },\n // We are grabbing all the request files for the 'pageLimit' # of requests at a time\n {\n concurrency: 1,\n },\n );\n\n allTargetIdentifiersCount += results.flat().length;\n\n // Write the identifiers and target identifiers to CSV\n const headers = uniq(chunkToSave.map((d) => Object.keys(d)).flat());\n const numberedFileName = `${baseName}-${fileCount}${extension}`;\n const numberedFileNameTarget = `${baseNameTarget}-${fileCount}${extensionTarget}`;\n await writeLargeCsv(numberedFileName, chunkToSave, headers);\n this.logger.info(\n colors.green(`Successfully wrote ${chunkToSave.length} identifiers to file \"${file}\"`),\n );\n\n const targetIdentifiers = results.flat();\n const headers2 = uniq(targetIdentifiers.map((d) => Object.keys(d)).flat());\n await writeLargeCsv(numberedFileNameTarget, targetIdentifiers, headers2);\n this.logger.info(\n colors.green(\n `Successfully wrote ${targetIdentifiers.length} identifiers to file \"${fileTarget}\"`,\n ),\n );\n\n this.logger.info(\n colors.blue(\n `Processed chunk of ${chunk.length} identifiers, found ${targetIdentifiers.length} target identifiers`,\n ),\n );\n fileCount += 1;\n };\n\n // Pull down outstanding identifiers using the new chunked function\n await pullChunkedCustomSiloOutstandingIdentifiers({\n dataSiloId: cronDataSiloId,\n auth,\n sombraAuth,\n actions,\n apiPageSize: pageLimit,\n savePageSize: chunkSize,\n onSave,\n transcendUrl,\n skipRequestCount,\n });\n\n this.logger.info(\n colors.green(`Successfully wrote ${allIdentifiersCount} identifiers to file \"${file}\"`),\n );\n this.logger.info(\n colors.green(\n `Successfully wrote ${allTargetIdentifiersCount} identifiers to file \"${fileTarget}\"`,\n ),\n );\n}\n"],"mappings":"wYA4BA,eAAsB,EAEpB,CACE,OACA,aACA,eACA,OACA,aACA,iBACA,mBACA,UACA,mBACA,YACA,aAEa,CACX,GACF,KAAK,OAAO,KACV,EAAO,OAAO,wEAAwE,CACvF,EAGC,OAAO,MAAM,EAAU,EAAI,GAAa,GAAK,EAAY,IAAc,KACzE,KAAK,OAAO,MACV,EAAO,IACL,wBAAwB,EAAU,sDAAsD,EAAU,GACnG,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAGtB,EAAoB,KAAK,QAAQ,CAGjC,IAAM,EAAS,EAA4B,EAAc,EAAK,CACxD,CAAE,WAAU,aAAc,EAAc,EAAK,CAC7C,CAAE,SAAU,EAAgB,UAAW,GAAoB,EAAc,EAAW,CAEtF,EAAsB,EACtB,EAA4B,EAC5B,EAAY,EAwEhB,MAAM,EAA4C,CAChD,WAAY,EACZ,OACA,aACA,UACA,YAAa,EACb,aAAc,EACd,YA7EoB,IAAyD,CAE7E,GAAuB,EAAY,OAQnC,IAAM,EAAU,MAAM,EADI,EAHD,EAD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KAAK,OAAO,KACV,EAAO,MACL,sBAAsB,EAA0B,wBAAwB,EAAW,GACpF,CACF"}
|
package/dist/impl-C6HtWd1t.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./parseVariablesFromString-BOSfQ4QF.mjs";import{t}from"./validateTranscendAuth-D6Wr1cxY.mjs";import{t as n}from"./done-input-validation-BUz-aVC5.mjs";import{t as r}from"./path-safety-D5Qwl40b.mjs";import{a as i,o as a}from"./manifest-BNIpO_zW.mjs";import{CustomFunctionPayloadType as o,CustomFunctionType as s}from"@transcend-io/privacy-types";import{dirname as c,resolve as l}from"node:path";import u from"colors";import{buildTranscendGraphQLClient as d,createSombraGotInstance as f,fetchAllCustomFunctions as p,resolveEffectiveSombraId as m,resolveExistingCustomFunction as h,syncCustomFunction as g}from"@transcend-io/sdk";import{mapSeries as _}from"@transcend-io/utils";async function v({auth:v,sombraAuth:y,transcendUrl:b,file:x=`./transcend-functions.yml`,variables:S,dryRun:C,promote:w,force:T,skipTests:E,updateManifest:D,sombraId:O}){if(n(this.process),!this.fs.existsSync(x)){let e=`./transcend/custom-functions/transcend-functions.yml`,t=this.fs.existsSync(e)?` Did you mean --file=${e}?`:` You can specify the file path using --file=./transcend-functions.yml`;this.logger.error(u.red(`The manifest file does not exist on disk: ${x}.${t}`)),this.process.exit(1)}let k=t(v,this);Array.isArray(k)&&(this.logger.error(u.red(`transcend custom-functions push does not support a list of API keys — pass a single API key.`)),this.process.exit(1));let A=k,j=e(S);this.logger.info(u.magenta(`Reading manifest "${x}"...`));let M=c(l(x)),N=i(x,j,e=>r(this,M,e));this.logger.info(u.green(`Found ${N.length} custom function(s) in "${x}"`));let P=d(b,A),F=await p(P,{logger:this.logger}),I=new Map,L=async(e,t)=>{let n=`${e??``}\u0000${t??``}`,r=I.get(n);if(r)return r;this.logger.info(u.magenta(`Connecting to the ${e?`Sombra gateway "${e}"`:`primary Sombra gateway`} to sign code...`));let i=await f(b,A,{logger:this.logger,sombraApiKey:t,...e?{sombraId:e}:{}});return I.set(n,i),i},R=e=>{if(!e.sombraAuthEnv)return y;let t=this.process.env[e.sombraAuthEnv];if(!t)throw Error(`Custom function "${e.name}" sets sombra-auth-env: ${e.sombraAuthEnv}, but that environment variable is not set. Export it (e.g. from a CI secret) before pushing.`);return t},z=[];if(await _(N,async e=>{try{let t=m(e,h(F,e),O),n=await g(P,{input:e,sombra:C?void 0:await L(t,R(e)),defaultSombraId:O,existing:F,promote:w,dryRun:C,force:T,...!E&&e.testPayloads!==void 0?{testPayloads:e.testPayloads}:{},logger:this.logger});z.push({name:e.name,result:n});let r=n.versionNumber?` (version ${n.versionNumber})`:``,i=n.changedFields.length>0?` [${n.changedFields.join(`, `)}]`:``;switch(n.outcome){case`created`:n.createdDataSilo&&n.dataSiloId&&this.logger.info(u.green(`Created DSR integration (data silo ${n.dataSiloId}) for "${e.name}"`)),this.logger.info(u.green(`Created custom function "${e.name}"${r}`));break;case`updated`:this.logger.info(u.green(`Pushed new revision to "${e.name}"${r}${i}${n.promoted?` and promoted to active`:` as a draft`}`));break;case`metadata-updated`:this.logger.info(u.green(`Updated metadata for "${e.name}"${i} — code unchanged, no new revision`));break;case`skipped`:this.logger.info(u.yellow(`Skipped "${e.name}" — no changes detected (env variable values cannot be diffed; use --force if only values changed)`));break;case`would-create`:this.logger.info(u.cyan(`[dry run] Would create custom function "${e.name}"${e.type===s.Dsr&&!e.dataSiloId?` and its DSR integration (data silo)`:``}`));break;case`would-update`:this.logger.info(u.cyan(`[dry run] Would push a new revision to "${e.name}"${i}`));break;case`test-failed`:{let t=(n.testResults??[]).filter(({passed:e})=>!e);this.logger.error(u.red(`Rejected "${e.name}" — ${t.length} of ${n.testResults?.length??0} test run(s) failed`)),t.forEach(({payloadType:e,result:t})=>{let n=e?`[${e}] `:``;this.logger.error(u.red(` ${n}${t.error?t.error.message:`failed with exit code ${t.exitCode}`}`)),t.logs.forEach(({file:e,message:t})=>{this.logger.error(u.red(` [${e}] ${t}`))})}),n.createdDataSilo&&this.logger.error(u.red(` The DSR integration (data silo) created for "${e.name}" was rolled back.`));break}}if(!E&&(e.testPayloads===void 0||e.testPayloads.length===0)&&(n.outcome===`created`||n.outcome===`updated`)&&this.logger.warn(u.yellow(`Custom function "${e.name}" was pushed without a test run — add a test-payload to its manifest entry to enable test-before-promote.`)),!E&&e.type===s.Dsr&&e.testPayloads!==void 0&&e.testPayloads.length>0&&(n.outcome===`created`||n.outcome===`updated`)){let t=new Set(e.testPayloads.map(({payloadType:e})=>e??o.DataPoint));if(t.size===1){let[n]=t,r=n===o.DataPoint?o.RequestEnricher:o.DataPoint;this.logger.warn(u.yellow(`DSR custom function "${e.name}" only tests its ${n} export — if it also implements the ${r} export, add a test payload with payload-type: ${r} so both entry points are tested on every push.`))}}}catch(t){z.push({name:e.name,error:t}),this.logger.error(u.red(`Failed to sync custom function "${e.name}": ${t.message}`))}}),D&&!C){let e=a(x,N.map((e,t)=>{let n=z[t]?.result;if(!n)return;let r={...!e.id&&n.customFunctionId?{id:n.customFunctionId}:{},...!e.dataSiloId&&n.dataSiloId?{dataSiloId:n.dataSiloId}:{}};return Object.keys(r).length>0?r:void 0}));e>0&&this.logger.info(u.green(`Wrote assigned id(s) back to ${e} manifest entr(ies) in "${x}" — commit this change so future pushes match by ID.`))}let B=e=>z.filter(({result:t})=>t?.outcome===e).length,V=z.filter(({error:e})=>e!==void 0),H=B(`test-failed`);this.logger.info(u.magenta(`Custom function sync complete: ${B(`created`)+B(`would-create`)} created, ${B(`updated`)+B(`would-update`)} updated, ${B(`metadata-updated`)} metadata-only, ${B(`skipped`)} skipped, ${H} rejected (test failed), ${V.length} failed${C?` (dry run)`:``}`)),(V.length>0||H>0)&&this.process.exit(1)}export{v as push};
|
|
2
|
-
//# sourceMappingURL=impl-C6HtWd1t.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-C6HtWd1t.mjs","names":[],"sources":["../src/commands/custom-functions/push/impl.ts"],"sourcesContent":["import { dirname, resolve } from 'node:path';\n\nimport { CustomFunctionPayloadType, CustomFunctionType } from '@transcend-io/privacy-types';\nimport {\n buildTranscendGraphQLClient,\n createSombraGotInstance,\n fetchAllCustomFunctions,\n resolveEffectiveSombraId,\n resolveExistingCustomFunction,\n syncCustomFunction,\n type CustomFunctionSyncResult,\n} from '@transcend-io/sdk';\nimport { mapSeries } from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { validateTranscendAuth } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport {\n readCustomFunctionsManifest,\n writeCustomFunctionIdsToManifest,\n} from '../../../lib/custom-functions/manifest.js';\nimport { parseVariablesFromString } from '../../../lib/helpers/parseVariablesFromString.js';\nimport { assertPathPhysicallyContained } from '../../../lib/scaffolding/path-safety.js';\n\nexport interface CustomFunctionsPushCommandFlags {\n auth: string;\n sombraAuth?: string;\n transcendUrl: string;\n file: string;\n variables: string;\n dryRun: boolean;\n promote: boolean;\n force: boolean;\n skipTests: boolean;\n updateManifest: boolean;\n sombraId?: string;\n}\n\nexport async function push(\n this: LocalContext,\n {\n auth,\n sombraAuth,\n transcendUrl,\n file = './transcend-functions.yml',\n variables,\n dryRun,\n promote,\n force,\n skipTests,\n updateManifest,\n sombraId,\n }: CustomFunctionsPushCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n // Read and validate the manifest before performing auth or network setup.\n if (!this.fs.existsSync(file)) {\n const scaffoldedManifest = './transcend/custom-functions/transcend-functions.yml';\n const suggestion = this.fs.existsSync(scaffoldedManifest)\n ? ` Did you mean --file=${scaffoldedManifest}?`\n : ' You can specify the file path using --file=./transcend-functions.yml';\n this.logger.error(\n colors.red(`The manifest file does not exist on disk: ${file}.${suggestion}`),\n );\n this.process.exit(1);\n }\n\n // This command operates on a single Transcend instance\n const apiKeyOrList = validateTranscendAuth(auth, this);\n if (Array.isArray(apiKeyOrList)) {\n this.logger.error(\n colors.red(\n 'transcend custom-functions push does not support a list of API keys — pass a single API key.',\n ),\n );\n this.process.exit(1);\n }\n const apiKey = apiKeyOrList as string;\n\n const vars = parseVariablesFromString(variables);\n this.logger.info(colors.magenta(`Reading manifest \"${file}\"...`));\n const manifestDirectory = dirname(resolve(file));\n const configs = readCustomFunctionsManifest(file, vars, (path) =>\n assertPathPhysicallyContained(this, manifestDirectory, path),\n );\n this.logger.info(colors.green(`Found ${configs.length} custom function(s) in \"${file}\"`));\n\n const client = buildTranscendGraphQLClient(transcendUrl, apiKey);\n\n // Fetch existing functions once to diff against\n const existing = await fetchAllCustomFunctions(client, { logger: this.logger });\n\n // Each custom function belongs to a single Sombra gateway whose keys sign\n // its code, so code must be signed against that specific gateway's customer\n // ingress. Cache one connection per distinct gateway + internal key across\n // the run.\n type SombraGot = Awaited<ReturnType<typeof createSombraGotInstance>>;\n const sombraByGateway = new Map<string, SombraGot>();\n const getSombraForGateway = async (\n gatewaySombraId: string | undefined,\n sombraApiKey: string | undefined,\n ): Promise<SombraGot> => {\n const key = `${gatewaySombraId ?? ''}\\u0000${sombraApiKey ?? ''}`;\n const cached = sombraByGateway.get(key);\n if (cached) {\n return cached;\n }\n this.logger.info(\n colors.magenta(\n `Connecting to the ${\n gatewaySombraId ? `Sombra gateway \"${gatewaySombraId}\"` : 'primary Sombra gateway'\n } to sign code...`,\n ),\n );\n const sombra = await createSombraGotInstance(transcendUrl, apiKey, {\n logger: this.logger,\n sombraApiKey,\n ...(gatewaySombraId ? { sombraId: gatewaySombraId } : {}),\n });\n sombraByGateway.set(key, sombra);\n return sombra;\n };\n\n /**\n * Resolve the Sombra internal key for a manifest entry: the env variable\n * named by `sombra-auth-env` when set (which must be exported), else the\n * `--sombraAuth` flag.\n *\n * @param input - The manifest entry\n * @returns The internal key to authenticate with, if any\n */\n const resolveEntrySombraAuth = (input: {\n /** Function name, for error messages */\n name: string;\n /** Env variable name holding the gateway's internal key */\n sombraAuthEnv?: string;\n }): string | undefined => {\n if (!input.sombraAuthEnv) {\n return sombraAuth;\n }\n const value = this.process.env[input.sombraAuthEnv];\n if (!value) {\n throw new Error(\n `Custom function \"${input.name}\" sets sombra-auth-env: ${input.sombraAuthEnv}, ` +\n 'but that environment variable is not set. Export it (e.g. from a CI secret) ' +\n 'before pushing.',\n );\n }\n return value;\n };\n\n // Sync each function in order\n const results: { name: string; result?: CustomFunctionSyncResult; error?: Error }[] = [];\n await mapSeries(configs, async (input) => {\n try {\n // Resolve the gateway this function belongs to: manifest sombra-id,\n // else the existing function's gateway, else --sombraId, else primary.\n // Also validates manifest-vs-existing gateway mismatches.\n const effectiveSombraId = resolveEffectiveSombraId(\n input,\n resolveExistingCustomFunction(existing, input),\n sombraId,\n );\n const result = await syncCustomFunction(client, {\n input,\n sombra: dryRun\n ? undefined\n : await getSombraForGateway(effectiveSombraId, resolveEntrySombraAuth(input)),\n defaultSombraId: sombraId,\n existing,\n promote,\n dryRun,\n force,\n // Test the freshly signed code before pushing; every payload must\n // pass or the function is rejected. Dry runs never sign, so nothing\n // is tested either.\n ...(!skipTests && input.testPayloads !== undefined\n ? { testPayloads: input.testPayloads }\n : {}),\n logger: this.logger,\n });\n results.push({ name: input.name, result });\n\n const suffix = result.versionNumber ? ` (version ${result.versionNumber})` : '';\n const changes =\n result.changedFields.length > 0 ? ` [${result.changedFields.join(', ')}]` : '';\n switch (result.outcome) {\n case 'created':\n if (result.createdDataSilo && result.dataSiloId) {\n this.logger.info(\n colors.green(\n `Created DSR integration (data silo ${result.dataSiloId}) for \"${input.name}\"`,\n ),\n );\n }\n this.logger.info(colors.green(`Created custom function \"${input.name}\"${suffix}`));\n break;\n case 'updated':\n this.logger.info(\n colors.green(\n `Pushed new revision to \"${input.name}\"${suffix}${changes}${\n result.promoted ? ' and promoted to active' : ' as a draft'\n }`,\n ),\n );\n break;\n case 'metadata-updated':\n this.logger.info(\n colors.green(\n `Updated metadata for \"${input.name}\"${changes} — code unchanged, no new revision`,\n ),\n );\n break;\n case 'skipped':\n this.logger.info(\n colors.yellow(\n `Skipped \"${input.name}\" — no changes detected ` +\n '(env variable values cannot be diffed; use --force if only values changed)',\n ),\n );\n break;\n case 'would-create':\n this.logger.info(\n colors.cyan(\n `[dry run] Would create custom function \"${input.name}\"${\n input.type === CustomFunctionType.Dsr && !input.dataSiloId\n ? ' and its DSR integration (data silo)'\n : ''\n }`,\n ),\n );\n break;\n case 'would-update':\n this.logger.info(\n colors.cyan(`[dry run] Would push a new revision to \"${input.name}\"${changes}`),\n );\n break;\n case 'test-failed': {\n const failed = (result.testResults ?? []).filter(({ passed }) => !passed);\n this.logger.error(\n colors.red(\n `Rejected \"${input.name}\" — ${failed.length} of ${\n result.testResults?.length ?? 0\n } test run(s) failed`,\n ),\n );\n failed.forEach(({ payloadType, result: execution }) => {\n const label = payloadType ? `[${payloadType}] ` : '';\n this.logger.error(\n colors.red(\n ` ${label}${\n execution.error\n ? execution.error.message\n : `failed with exit code ${execution.exitCode}`\n }`,\n ),\n );\n execution.logs.forEach(({ file: logFile, message }) => {\n this.logger.error(colors.red(` [${logFile}] ${message}`));\n });\n });\n if (result.createdDataSilo) {\n this.logger.error(\n colors.red(\n ` The DSR integration (data silo) created for \"${input.name}\" was rolled back.`,\n ),\n );\n }\n break;\n }\n }\n\n // Anything that reached the push path without a test payload was\n // promoted untested — call it out so payloads get added over time\n if (\n !skipTests &&\n (input.testPayloads === undefined || input.testPayloads.length === 0) &&\n (result.outcome === 'created' || result.outcome === 'updated')\n ) {\n this.logger.warn(\n colors.yellow(\n `Custom function \"${input.name}\" was pushed without a test run — add a ` +\n 'test-payload to its manifest entry to enable test-before-promote.',\n ),\n );\n }\n\n // DSR functions have two entry points (default export = DATA_POINT,\n // enricher export = REQUEST_ENRICHER); nudge toward covering both\n if (\n !skipTests &&\n input.type === CustomFunctionType.Dsr &&\n input.testPayloads !== undefined &&\n input.testPayloads.length > 0 &&\n (result.outcome === 'created' || result.outcome === 'updated')\n ) {\n const coveredTypes = new Set(\n input.testPayloads.map(\n ({ payloadType }) => payloadType ?? CustomFunctionPayloadType.DataPoint,\n ),\n );\n if (coveredTypes.size === 1) {\n const [covered] = coveredTypes;\n const uncovered =\n covered === CustomFunctionPayloadType.DataPoint\n ? CustomFunctionPayloadType.RequestEnricher\n : CustomFunctionPayloadType.DataPoint;\n this.logger.warn(\n colors.yellow(\n `DSR custom function \"${input.name}\" only tests its ${covered} export — if it ` +\n `also implements the ${uncovered} export, add a test payload with ` +\n `payload-type: ${uncovered} so both entry points are tested on every push.`,\n ),\n );\n }\n }\n } catch (err) {\n results.push({ name: input.name, error: err as Error });\n this.logger.error(\n colors.red(`Failed to sync custom function \"${input.name}\": ${(err as Error).message}`),\n );\n }\n });\n\n // Write assigned IDs back into the manifest so future pushes match by ID\n // instead of by (potentially non-unique) name, and DSR entries keep\n // pointing at their (possibly auto-created) integration\n if (updateManifest && !dryRun) {\n const idsByIndex = configs.map((input, index) => {\n const result = results[index]?.result;\n if (!result) {\n return undefined;\n }\n const ids = {\n ...(!input.id && result.customFunctionId ? { id: result.customFunctionId } : {}),\n ...(!input.dataSiloId && result.dataSiloId ? { dataSiloId: result.dataSiloId } : {}),\n };\n return Object.keys(ids).length > 0 ? ids : undefined;\n });\n const updatedCount = writeCustomFunctionIdsToManifest(file, idsByIndex);\n if (updatedCount > 0) {\n this.logger.info(\n colors.green(\n `Wrote assigned id(s) back to ${updatedCount} manifest entr(ies) in \"${file}\" — ` +\n 'commit this change so future pushes match by ID.',\n ),\n );\n }\n }\n\n // Summarize\n const count = (outcome: CustomFunctionSyncResult['outcome']): number =>\n results.filter(({ result }) => result?.outcome === outcome).length;\n const failures = results.filter(({ error }) => error !== undefined);\n const rejected = count('test-failed');\n this.logger.info(\n colors.magenta(\n `Custom function sync complete: ${count('created') + count('would-create')} created, ${\n count('updated') + count('would-update')\n } updated, ${count('metadata-updated')} metadata-only, ${count(\n 'skipped',\n )} skipped, ${rejected} rejected (test failed), ${failures.length} failed${\n dryRun ? ' (dry run)' : ''\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CACrC,KAAK,OAAO,KACV,EAAO,QACL,kCAAkC,EAAM,UAAU,CAAG,EAAM,eAAe,CAAC,YACzE,EAAM,UAAU,CAAG,EAAM,eAAe,CACzC,YAAY,EAAM,mBAAmB,CAAC,kBAAkB,EACvD,UACD,CAAC,YAAY,EAAS,2BAA2B,EAAS,OAAO,SAChE,EAAS,aAAe,KAE3B,CACF,EAEG,EAAS,OAAS,GAAK,EAAW,IACpC,KAAK,QAAQ,KAAK,EAAE"}
|
package/dist/impl-CO4ZqlLV.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./policyEngineCliError-DY8V-qkK.mjs";import{i as n,r,t as i}from"./printResult-CHe3nRN4.mjs";import{t as a}from"./formatPolicyBundleVersionSummary-CJmMCLtJ.mjs";import{n as o}from"./resolveBundleIdByName-qXZBrUz_.mjs";import{t as s}from"./done-input-validation-BUz-aVC5.mjs";import c from"colors";async function l({"bundle-name":l,auth:u,"transcend-url":d,json:f,debug:p=!1}){s(this.process),e(p);let m=n(d,u),h=await o(m,l);if(!h)throw Error(`Policy bundle "${l}" was not found for this organization.`);this.logger.info(c.green(`Deactivating active version for bundle "${l}"...`));let g;try{g=await m.post(`v1/policy-engine/policy-bundles/${h}/deactivate`).json()}catch(e){if(e?.response?.statusCode===409)throw new t(`Policy bundle "${l}" has no active version.`,{cause:e});r(e)}i(this.process.stdout,{json:f,data:g,renderTable:()=>[`bundleId ${g.bundle.id}`,`bundleName ${g.bundle.bundleName}`,a(g.version)].join(`
|
|
2
|
-
`)}),this.logger.info(c.green(`Policy bundle version deactivated.`))}export{l as deactivate};
|
|
3
|
-
//# sourceMappingURL=impl-CO4ZqlLV.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-CO4ZqlLV.mjs","names":[],"sources":["../src/commands/policy/deactivate/impl.ts"],"sourcesContent":["import colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport {\n buildPolicyEngineClient,\n formatPolicyBundleVersionSummary,\n printResult,\n resolveBundleIdByName,\n setPolicyEngineCliDebug,\n throwPolicyEngineRequestError,\n PolicyEngineCliError,\n} from '../helpers/index.js';\nimport type { DeactivatePolicyBundleResponse } from '../types.js';\n\n/** CLI flags for `transcend policy deactivate`. */\nexport interface DeactivateCommandFlags {\n /** Logical bundle name to deactivate */\n 'bundle-name': string;\n /** Transcend API key */\n auth: string;\n /** Transcend API URL */\n 'transcend-url': string;\n /** Print raw JSON response */\n json: boolean;\n /** Include technical error details when a command fails */\n debug?: boolean;\n}\n\n/**\n * Deactivate the currently active version of a policy bundle.\n *\n * Resolves `--bundle-name` to the parent bundle UUID internally, then calls the\n * Policy Engine deactivate endpoint. The bundle is addressed by name only -- the\n * UUID is never exposed to the operator.\n *\n * @param this - CLI context\n * @param flags - Command flags\n */\nexport async function deactivate(\n this: LocalContext,\n {\n 'bundle-name': bundleName,\n auth,\n 'transcend-url': transcendUrl,\n json,\n debug = false,\n }: DeactivateCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n setPolicyEngineCliDebug(debug);\n\n const client = buildPolicyEngineClient(transcendUrl, auth);\n\n const resolvedBundleId = await resolveBundleIdByName(client, bundleName);\n if (!resolvedBundleId) {\n throw new Error(`Policy bundle \"${bundleName}\" was not found for this organization.`);\n }\n\n this.logger.info(colors.green(`Deactivating active version for bundle \"${bundleName}\"...`));\n\n let body: DeactivatePolicyBundleResponse;\n try {\n body = await client\n .post(`v1/policy-engine/policy-bundles/${resolvedBundleId}/deactivate`)\n .json<DeactivatePolicyBundleResponse>();\n } catch (err) {\n // The monolith 409 references the internal bundle UUID; rewrite it to the\n // user-supplied bundle name so the error is actionable.\n const statusCode = (err as { response?: { statusCode?: number } })?.response?.statusCode;\n if (statusCode === 409) {\n throw new PolicyEngineCliError(`Policy bundle \"${bundleName}\" has no active version.`, {\n cause: err,\n });\n }\n throwPolicyEngineRequestError(err);\n }\n\n printResult(this.process.stdout, {\n json,\n data: body,\n renderTable: () =>\n [\n `bundleId ${body.bundle.id}`,\n `bundleName ${body.bundle.bundleName}`,\n formatPolicyBundleVersionSummary(body.version),\n ].join('\\n'),\n });\n\n this.logger.info(colors.green('Policy bundle version deactivated.'));\n}\n"],"mappings":"8TAuCA,eAAsB,EAEpB,CACE,cAAe,EACf,OACA,gBAAiB,EACjB,OACA,QAAQ,IAEK,CACf,EAAoB,KAAK,QAAQ,CACjC,EAAwB,EAAM,CAE9B,IAAM,EAAS,EAAwB,EAAc,EAAK,CAEpD,EAAmB,MAAM,EAAsB,EAAQ,EAAW,CACxE,GAAI,CAAC,EACH,MAAU,MAAM,kBAAkB,EAAW,wCAAwC,CAGvF,KAAK,OAAO,KAAK,EAAO,MAAM,2CAA2C,EAAW,MAAM,CAAC,CAE3F,IAAI,EACJ,GAAI,CACF,EAAO,MAAM,EACV,KAAK,mCAAmC,EAAiB,aAAa,CACtE,MAAsC,OAClC,EAAK,CAIZ,GADoB,GAAgD,UAAU,aAC3D,IACjB,MAAM,IAAI,EAAqB,kBAAkB,EAAW,0BAA2B,CACrF,MAAO,EACR,CAAC,CAEJ,EAA8B,EAAI,CAGpC,EAAY,KAAK,QAAQ,OAAQ,CAC/B,OACA,KAAM,EACN,gBACE,CACE,eAAe,EAAK,OAAO,KAC3B,eAAe,EAAK,OAAO,aAC3B,EAAiC,EAAK,QAAQ,CAC/C,CAAC,KAAK;EAAK,CACf,CAAC,CAEF,KAAK,OAAO,KAAK,EAAO,MAAM,qCAAqC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-COujMWgp.mjs","names":["consentManagersToBusinessEntitiesHelper"],"sources":["../src/commands/inventory/consent-managers-to-business-entities/impl.ts"],"sourcesContent":["import path from 'node:path';\n\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { filterFileNames } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { consentManagersToBusinessEntities as consentManagersToBusinessEntitiesHelper } from '../../../lib/consent-manager/index.js';\nimport { parseTranscendYaml, serializeTranscendYaml } from '../../../lib/readTranscendYaml.js';\n\nexport interface ConsentManagersToBusinessEntitiesCommandFlags {\n consentManagerYmlFolder: string;\n output: string;\n}\n\nexport function consentManagersToBusinessEntities(\n this: LocalContext,\n { consentManagerYmlFolder, output }: ConsentManagersToBusinessEntitiesCommandFlags,\n): void {\n doneInputValidation(this.process);\n\n // Ensure folder is passed\n if (\n !this.fs.existsSync(consentManagerYmlFolder) ||\n !this.fs.lstatSync(consentManagerYmlFolder).isDirectory()\n ) {\n this.logger.error(colors.red(`Folder does not exist: \"${consentManagerYmlFolder}\"`));\n this.process.exit(1);\n }\n\n // Read in each consent manager configuration\n const inputs = filterFileNames(this.fs.readdirSync(consentManagerYmlFolder)).map((directory) => {\n const inputPath = path.join(consentManagerYmlFolder, directory);\n const { 'consent-manager': consentManager } = parseTranscendYaml(\n this.fs.readFileSync(inputPath, 'utf8'),\n {},\n inputPath,\n );\n return { name: directory, input: consentManager };\n });\n\n // Convert to business entities\n const businessEntities = consentManagersToBusinessEntitiesHelper(inputs);\n\n this.logger.info('\\n\\n~~~~~~~~~~~\\nAirgap scripts to host:');\n businessEntities.forEach(({ attributes, title }, index) => {\n attributes\n ?.find((attribute) => attribute.key === 'Airgap Production URL')\n ?.values?.forEach((url) => {\n this.logger.info(`${index}) ${title} - ${url}`);\n });\n });\n\n this.fs.writeFileSync(\n output,\n serializeTranscendYaml({\n 'business-entities': businessEntities,\n }),\n );\n\n this.logger.info(\n colors.green(\n `Successfully wrote ${businessEntities.length} business entities to file \"${output}\"`,\n ),\n );\n}\n"],"mappings":"sRAeA,SAAgB,EAEd,CAAE,0BAAyB,UACrB,CACN,EAAoB,KAAK,QAAQ,EAI/B,CAAC,KAAK,GAAG,WAAW,EAAwB,EAC5C,CAAC,KAAK,GAAG,UAAU,EAAwB,CAAC,aAAa,IAEzD,KAAK,OAAO,MAAM,EAAO,IAAI,2BAA2B,EAAwB,GAAG,CAAC,CACpF,KAAK,QAAQ,KAAK,EAAE,EAetB,IAAM,EAAmBA,EAXV,EAAgB,KAAK,GAAG,YAAY,EAAwB,CAAC,CAAC,IAAK,GAAc,CAC9F,IAAM,EAAY,EAAK,KAAK,EAAyB,EAAU,CACzD,CAAE,kBAAmB,GAAmB,EAC5C,KAAK,GAAG,aAAa,EAAW,OAAO,CACvC,EAAE,CACF,EACD,CACD,MAAO,CAAE,KAAM,EAAW,MAAO,EAAgB,EAIoB,CAAC,CAExE,KAAK,OAAO,KAAK;;;yBAA2C,CAC5D,EAAiB,SAAS,CAAE,aAAY,SAAS,IAAU,CACzD,GACI,KAAM,GAAc,EAAU,MAAQ,wBAAwB,EAC9D,QAAQ,QAAS,GAAQ,CACzB,KAAK,OAAO,KAAK,GAAG,EAAM,IAAI,EAAM,KAAK,IAAM,EAC/C,EACJ,CAEF,KAAK,GAAG,cACN,EACA,EAAuB,CACrB,oBAAqB,EACtB,CAAC,CACH,CAED,KAAK,OAAO,KACV,EAAO,MACL,sBAAsB,EAAiB,OAAO,8BAA8B,EAAO,GACpF,CACF"}
|
package/dist/impl-CUOVJsRg.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./policyEngineCliError-DY8V-qkK.mjs";import{i as t,n,t as r}from"./printResult-CHe3nRN4.mjs";import{t as i}from"./resolveBundleIdByName-qXZBrUz_.mjs";import{t as a}from"./resolvePolicyBundleVersion-BG7XqBBP.mjs";import{t as o}from"./done-input-validation-BUz-aVC5.mjs";import s from"node:path";import c from"got";import l from"colors";function u(e,t){return`${e}-${t}.tar.gz`}function d(e,t){return[`bundleName ${e.bundleName}`,`version ${e.version}`,`output ${t}`,`sha256 ${e.sha256}`,`sizeBytes ${e.sizeBytes}`,`uploadedAt ${e.uploadedAt}`,`activatedAt ${e.activatedAt??`-`}`].join(`
|
|
2
|
-
`)}async function f({"bundle-name":f,version:p,output:m,auth:h,"transcend-url":g,json:_,debug:v=!1}){o(this.process),e(v);let y=t(g,h),b=await i(y,f);if(!b)throw Error(`Policy bundle "${f}" was not found for this organization.`);let x;if(p)x=(await a(y,b.id,{version:p})).id;else{if(!b.activeVersionId)throw Error(`Policy bundle "${f}" has no active version.`);x=b.activeVersionId}this.logger.info(l.green(p?`Fetching download URL for bundle "${f}" version "${p}"...`:`Fetching download URL for active version of bundle "${f}"...`));let S=await n(y.get(`v1/policy-engine/policy-bundles/${b.id}/versions/${x}`).json());if(_){r(this.process.stdout,{json:!0,data:S});return}let C=s.resolve(m??u(f,S.version));this.logger.info(l.green(`Downloading policy bundle to ${C}...`));let w;try{w=await c(S.downloadUrl).buffer()}catch(e){throw Error(`Failed to download policy bundle from the presigned URL: ${e instanceof Error?e.message:String(e)}`,{cause:e})}let T=s.dirname(C);this.fs.mkdirSync(T,{recursive:!0}),this.fs.writeFileSync(C,w),r(this.process.stdout,{json:!1,data:S,renderTable:()=>d(S,C)}),this.logger.info(l.green(`Policy bundle downloaded successfully.`))}export{f as download};
|
|
3
|
-
//# sourceMappingURL=impl-CUOVJsRg.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-CUOVJsRg.mjs","names":[],"sources":["../src/commands/policy/download/impl.ts"],"sourcesContent":["import path from 'node:path';\n\nimport colors from 'colors';\nimport got from 'got';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { EMPTY_CELL } from '../constants.js';\nimport {\n buildPolicyEngineClient,\n policyEngineRequest,\n printResult,\n resolveBundleByName,\n resolvePolicyBundleVersion,\n setPolicyEngineCliDebug,\n} from '../helpers/index.js';\nimport type { GetPolicyBundleVersionResponse } from '../types.js';\n\n/** CLI flags for `transcend policy download`. */\nexport interface DownloadCommandFlags {\n /** Tenant-unique bundle name */\n 'bundle-name': string;\n /**\n * Caller-supplied version label to download.\n * When omitted, downloads the bundle's currently active version.\n */\n version?: string;\n /** Destination file path; defaults to `{bundleName}-{version}.tar.gz` */\n output?: string;\n /** Transcend API key */\n auth: string;\n /** Transcend API URL */\n 'transcend-url': string;\n /** Print metadata + presigned URL as JSON without writing a file */\n json: boolean;\n /** Include technical error details when a command fails */\n debug?: boolean;\n}\n\n/**\n * Builds the default output path for a downloaded policy bundle.\n *\n * @param bundleName - Tenant-unique bundle name\n * @param version - Caller-supplied version label\n * @returns Relative path `{bundleName}-{version}.tar.gz`\n */\nexport function defaultPolicyDownloadOutputPath(bundleName: string, version: string): string {\n return `${bundleName}-${version}.tar.gz`;\n}\n\n/**\n * Formats download metadata for human-readable CLI output.\n *\n * @param body - Version metadata from the Policy Engine API\n * @param outputPath - Destination path written (or that would be written)\n * @returns Summary lines\n */\nfunction formatDownloadSummary(body: GetPolicyBundleVersionResponse, outputPath: string): string {\n return [\n `bundleName ${body.bundleName}`,\n `version ${body.version}`,\n `output ${outputPath}`,\n `sha256 ${body.sha256}`,\n `sizeBytes ${body.sizeBytes}`,\n `uploadedAt ${body.uploadedAt}`,\n `activatedAt ${body.activatedAt ?? EMPTY_CELL}`,\n ].join('\\n');\n}\n\n/**\n * Download a compiled policy bundle version to disk.\n *\n * Resolves `--bundle-name` and an optional `--version` to IDs, fetches a\n * short-lived presigned S3 URL from the monolith, then downloads the `.tar.gz`\n * bytes directly from S3 (the monolith does not proxy the artifact).\n *\n * When `--version` is omitted, downloads the bundle's currently active version.\n * If the bundle has no active version, exits with an error.\n *\n * @param this - CLI context\n * @param flags - Command flags\n */\nexport async function download(\n this: LocalContext,\n {\n 'bundle-name': bundleName,\n version,\n output,\n auth,\n 'transcend-url': transcendUrl,\n json,\n debug = false,\n }: DownloadCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n setPolicyEngineCliDebug(debug);\n\n const client = buildPolicyEngineClient(transcendUrl, auth);\n\n const bundle = await resolveBundleByName(client, bundleName);\n if (!bundle) {\n throw new Error(`Policy bundle \"${bundleName}\" was not found for this organization.`);\n }\n\n let versionId: string;\n if (version) {\n const resolvedVersion = await resolvePolicyBundleVersion(client, bundle.id, { version });\n versionId = resolvedVersion.id;\n } else {\n if (!bundle.activeVersionId) {\n throw new Error(`Policy bundle \"${bundleName}\" has no active version.`);\n }\n versionId = bundle.activeVersionId;\n }\n\n this.logger.info(\n colors.green(\n version\n ? `Fetching download URL for bundle \"${bundleName}\" version \"${version}\"...`\n : `Fetching download URL for active version of bundle \"${bundleName}\"...`,\n ),\n );\n\n const body = await policyEngineRequest(\n client\n .get(`v1/policy-engine/policy-bundles/${bundle.id}/versions/${versionId}`)\n .json<GetPolicyBundleVersionResponse>(),\n );\n\n if (json) {\n printResult(this.process.stdout, {\n json: true,\n data: body,\n });\n return;\n }\n\n const outputPath = path.resolve(\n output ?? defaultPolicyDownloadOutputPath(bundleName, body.version),\n );\n\n this.logger.info(colors.green(`Downloading policy bundle to ${outputPath}...`));\n\n let bundleBytes: Uint8Array;\n try {\n bundleBytes = await got(body.downloadUrl).buffer();\n } catch (err) {\n throw new Error(\n `Failed to download policy bundle from the presigned URL: ${\n err instanceof Error ? err.message : String(err)\n }`,\n { cause: err },\n );\n }\n\n const outputDir = path.dirname(outputPath);\n this.fs.mkdirSync(outputDir, { recursive: true });\n this.fs.writeFileSync(outputPath, bundleBytes);\n\n printResult(this.process.stdout, {\n json: false,\n data: body,\n renderTable: () => formatDownloadSummary(body, outputPath),\n });\n\n this.logger.info(colors.green('Policy bundle downloaded successfully.'));\n}\n"],"mappings":"kWA8CA,SAAgB,EAAgC,EAAoB,EAAyB,CAC3F,MAAO,GAAG,EAAW,GAAG,EAAQ,SAUlC,SAAS,EAAsB,EAAsC,EAA4B,CAC/F,MAAO,CACL,eAAe,EAAK,aACpB,eAAe,EAAK,UACpB,eAAe,IACf,eAAe,EAAK,SACpB,eAAe,EAAK,YACpB,eAAe,EAAK,aACpB,eAAe,EAAK,aAAA,MACrB,CAAC,KAAK;EAAK,CAgBd,eAAsB,EAEpB,CACE,cAAe,EACf,U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EF,KAAK,OAAO,KAAK,EAAO,MAAM,yCAAyC,CAAC"}
|
package/dist/impl-CUiYbk6G.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./policyEngineCliError-DY8V-qkK.mjs";import{i as n,n as r,t as i}from"./printResult-CHe3nRN4.mjs";import{t as a}from"./formatPolicyBundleVersionSummary-CJmMCLtJ.mjs";import{n as o}from"./resolveBundleIdByName-qXZBrUz_.mjs";import{t as s}from"./resolvePolicyBundleVersion-BG7XqBBP.mjs";import{t as c}from"./done-input-validation-BUz-aVC5.mjs";import l from"colors";async function u({"bundle-name":u,version:d,auth:f,"transcend-url":p,"dry-run":m,json:h,debug:g=!1}){c(this.process),e(g);let _=n(p,f),v=await o(_,u);if(!v)throw Error(`Policy bundle "${u}" was not found for this organization.`);let y=await s(_,v,{version:d});this.logger.info(l.green(m?`Validating activation for version "${y.version}"...`:`Activating version "${y.version}"...`));let b;try{b=await r(_.post(`v1/policy-engine/policy-bundles/${v}/versions/${y.id}/activate`,{json:m?{dryRun:!0}:{}}).json())}catch(e){throw(e instanceof t?e.cause:void 0)?.response?.statusCode===409?new t(`Version "${y.version}" of policy bundle "${u}" is already the active version.`,{cause:e}):e}i(this.process.stdout,{json:h,data:b,renderTable:()=>[`bundleId ${b.bundle.id}`,`bundleName ${b.bundle.bundleName}`,a(b.version)].join(`
|
|
2
|
-
`)}),this.logger.info(l.green(m?`Activation validation succeeded.`:`Policy bundle version activated.`))}export{u as activate};
|
|
3
|
-
//# sourceMappingURL=impl-CUiYbk6G.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-CUiYbk6G.mjs","names":[],"sources":["../src/commands/policy/activate/impl.ts"],"sourcesContent":["import colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport {\n buildPolicyEngineClient,\n formatPolicyBundleVersionSummary,\n policyEngineRequest,\n PolicyEngineCliError,\n printResult,\n resolveBundleIdByName,\n resolvePolicyBundleVersion,\n setPolicyEngineCliDebug,\n} from '../helpers/index.js';\nimport type { ActivatePolicyBundleVersionResponse } from '../types.js';\n\n/** CLI flags for `transcend policy activate`. */\nexport interface ActivateCommandFlags {\n /** Logical bundle name to activate */\n 'bundle-name': string;\n /** Caller-supplied version label to activate */\n version?: string;\n /** Transcend API key */\n auth: string;\n /** Transcend API URL */\n 'transcend-url': string;\n /** Validate activation without flipping */\n 'dry-run': boolean;\n /** Print raw JSON response */\n json: boolean;\n /** Include technical error details when a command fails */\n debug?: boolean;\n}\n\n/**\n * Activate an uploaded policy bundle version.\n *\n * Resolves `--bundle-name` to the parent bundle UUID internally, then calls the\n * Policy Engine activate endpoint. The bundle is addressed by name only -- the\n * UUID is never exposed to the operator.\n *\n * @param this - CLI context\n * @param flags - Command flags\n */\nexport async function activate(\n this: LocalContext,\n {\n 'bundle-name': bundleName,\n version,\n auth,\n 'transcend-url': transcendUrl,\n 'dry-run': dryRun,\n json,\n debug = false,\n }: ActivateCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n setPolicyEngineCliDebug(debug);\n\n const client = buildPolicyEngineClient(transcendUrl, auth);\n const resolvedBundleId = await resolveBundleIdByName(client, bundleName);\n if (!resolvedBundleId) {\n throw new Error(`Policy bundle \"${bundleName}\" was not found for this organization.`);\n }\n const resolvedVersion = await resolvePolicyBundleVersion(client, resolvedBundleId, { version });\n\n this.logger.info(\n colors.green(\n dryRun\n ? `Validating activation for version \"${resolvedVersion.version}\"...`\n : `Activating version \"${resolvedVersion.version}\"...`,\n ),\n );\n\n let body: ActivatePolicyBundleVersionResponse;\n try {\n body = await policyEngineRequest(\n client\n .post(\n `v1/policy-engine/policy-bundles/${resolvedBundleId}/versions/${resolvedVersion.id}/activate`,\n {\n json: dryRun ? { dryRun: true } : {},\n },\n )\n .json<ActivatePolicyBundleVersionResponse>(),\n );\n } catch (err) {\n // A 409 here means the requested version is already the active version --\n // surface that specifically (referencing the operator-facing bundle name\n // and version label) rather than the generic conflict fallback.\n const statusCode = (\n err instanceof PolicyEngineCliError\n ? (err.cause as { response?: { statusCode?: number } } | undefined)\n : undefined\n )?.response?.statusCode;\n if (statusCode === 409) {\n throw new PolicyEngineCliError(\n `Version \"${resolvedVersion.version}\" of policy bundle \"${bundleName}\" is already the active version.`,\n { cause: err },\n );\n }\n throw err;\n }\n\n printResult(this.process.stdout, {\n json,\n data: body,\n renderTable: () =>\n [\n `bundleId ${body.bundle.id}`,\n `bundleName ${body.bundle.bundleName}`,\n formatPolicyBundleVersionSummary(body.version),\n ].join('\\n'),\n });\n\n this.logger.info(\n colors.green(dryRun ? 'Activation validation succeeded.' : 'Policy bundle version activated.'),\n );\n}\n"],"mappings":"iYA4CA,eAAsB,EAEpB,CACE,cAAe,EACf,UACA,OACA,gBAAiB,EACjB,UAAW,EACX,OACA,QAAQ,IAEK,CACf,EAAoB,KAAK,QAAQ,CACjC,EAAwB,EAAM,CAE9B,IAAM,EAAS,EAAwB,EAAc,EAAK,CACpD,EAAmB,MAAM,EAAsB,EAAQ,EAAW,CACxE,GAAI,CAAC,EACH,MAAU,MAAM,kBAAkB,EAAW,wCAAwC,CAEvF,IAAM,EAAkB,MAAM,EAA2B,EAAQ,EAAkB,CAAE,UAAS,CAAC,CAE/F,KAAK,OAAO,KACV,EAAO,MACL,EACI,sCAAsC,EAAgB,QAAQ,MAC9D,uBAAuB,EAAgB,QAAQ,MACpD,CACF,CAED,IAAI,EACJ,GAAI,CACF,EAAO,MAAM,EACX,EACG,KACC,mCAAmC,EAAiB,YAAY,EAAgB,GAAG,WACnF,CACE,KAAM,EAAS,CAAE,OAAQ,GAAM,CAAG,EAAE,CACrC,CACF,CACA,MAA2C,CAC/C,OACM,EAAK,CAeZ,MAVE,aAAe,EACV,EAAI,MACL,IAAA,KACH,UAAU,aACM,IACX,IAAI,EACR,YAAY,EAAgB,QAAQ,sBAAsB,EAAW,kCACrE,CAAE,MAAO,EAAK,CACf,CAEG,EAGR,EAAY,KAAK,QAAQ,OAAQ,CAC/B,OACA,KAAM,EACN,gBACE,CACE,eAAe,EAAK,OAAO,KAC3B,eAAe,EAAK,OAAO,aAC3B,EAAiC,EAAK,QAAQ,CAC/C,CAAC,KAAK;EAAK,CACf,CAAC,CAEF,KAAK,OAAO,KACV,EAAO,MAAM,EAAS,mCAAqC,mCAAmC,CAC/F"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-CfvxD3RI.mjs","names":[],"sources":["../src/commands/inventory/consent-manager-service-json-to-yml/impl.ts"],"sourcesContent":["import { ConsentTrackerStatus, DataFlowScope } from '@transcend-io/privacy-types';\nimport { decodeCodec } from '@transcend-io/type-utils';\nimport colors from 'colors';\nimport * as t from 'io-ts';\n\nimport { ConsentManagerServiceMetadata, CookieInput, DataFlowInput } from '../../../codecs.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { serializeTranscendYaml } from '../../../lib/readTranscendYaml.js';\n\nexport interface ConsentManagerServiceJsonToYmlCommandFlags {\n file: string;\n output: string;\n}\n\nexport function consentManagerServiceJsonToYml(\n this: LocalContext,\n { file, output }: ConsentManagerServiceJsonToYmlCommandFlags,\n): void {\n doneInputValidation(this.process);\n\n // Ensure files exist\n if (!this.fs.existsSync(file)) {\n this.logger.error(colors.red(`File does not exist: --file=\"${file}\"`));\n this.process.exit(1);\n }\n\n // Read in each consent manager configuration\n const services = decodeCodec(\n t.array(ConsentManagerServiceMetadata),\n this.fs.readFileSync(file, 'utf-8'),\n );\n\n // Create data flows and cookie configurations\n const dataFlows: DataFlowInput[] = [];\n const cookies: CookieInput[] = [];\n services.forEach((service) => {\n service.dataFlows\n .filter(({ type }) => type !== DataFlowScope.CSP)\n .forEach((dataFlow) => {\n dataFlows.push({\n value: dataFlow.value,\n type: dataFlow.type,\n status: ConsentTrackerStatus.Live,\n trackingPurposes: dataFlow.trackingPurposes,\n });\n });\n\n service.cookies.forEach((cookie) => {\n cookies.push({\n name: cookie.name,\n status: ConsentTrackerStatus.Live,\n trackingPurposes: cookie.trackingPurposes,\n });\n });\n });\n\n this.fs.writeFileSync(\n output,\n serializeTranscendYaml({\n 'data-flows': dataFlows,\n cookies,\n }),\n );\n\n this.logger.info(\n colors.green(\n `Successfully wrote ${dataFlows.length} data flows and ${cookies.length} cookies to file \"${output}\"`,\n ),\n );\n}\n"],"mappings":"mVAeA,SAAgB,EAEd,CAAE,OAAM,UACF,CACN,EAAoB,KAAK,QAAQ,CAG5B,KAAK,GAAG,WAAW,EAAK,GAC3B,KAAK,OAAO,MAAM,EAAO,IAAI,gCAAgC,EAAK,GAAG,CAAC,CACtE,KAAK,QAAQ,KAAK,EAAE,EAItB,IAAM,EAAW,EACf,EAAE,MAAM,EAA8B,CACtC,KAAK,GAAG,aAAa,EAAM,QAAQ,CACpC,CAGK,EAA6B,EAAE,CAC/B,EAAyB,EAAE,CACjC,EAAS,QAAS,GAAY,CAC5B,EAAQ,UACL,QAAQ,CAAE,UAAW,IAAS,EAAc,IAAI,CAChD,QAAS,GAAa,CACrB,EAAU,KAAK,CACb,MAAO,EAAS,MAChB,KAAM,EAAS,KACf,OAAQ,EAAqB,KAC7B,iBAAkB,EAAS,iBAC5B,CAAC,EACF,CAEJ,EAAQ,QAAQ,QAAS,GAAW,CAClC,EAAQ,KAAK,CACX,KAAM,EAAO,KACb,OAAQ,EAAqB,KAC7B,iBAAkB,EAAO,iBAC1B,CAAC,EACF,EACF,CAEF,KAAK,GAAG,cACN,EACA,EAAuB,CACrB,aAAc,EACd,UACD,CAAC,CACH,CAED,KAAK,OAAO,KACV,EAAO,MACL,sBAAsB,EAAU,OAAO,kBAAkB,EAAQ,OAAO,oBAAoB,EAAO,GACpG,CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-CiBT9-GH2.mjs","names":[],"sources":["../src/commands/request/cron/mark-identifiers-completed/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport { pushCronIdentifiersFromCsv } from '../../../../lib/cron/index.js';\n\nexport interface MarkIdentifiersCompletedCommandFlags {\n file: string;\n transcendUrl: string;\n auth: string;\n sombraAuth?: string;\n dataSiloId: string;\n}\n\nexport async function markIdentifiersCompleted(\n this: LocalContext,\n { file, transcendUrl, auth, sombraAuth, dataSiloId }: MarkIdentifiersCompletedCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await pushCronIdentifiersFromCsv({\n file,\n transcendUrl,\n auth,\n sombraAuth,\n dataSiloId,\n });\n}\n"],"mappings":"kHAYA,eAAsB,EAEpB,CAAE,OAAM,eAAc,OAAM,aAAY,cACzB,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAM,EAA2B,CAC/B,OACA,eACA,OACA,aACA,aACD,CAAC"}
|
package/dist/impl-Cli2XRp02.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./policyEngineCliError-DY8V-qkK.mjs";import{i as t,n,t as r}from"./printResult-CHe3nRN4.mjs";import{t as i}from"./renderTable-D68QasPc.mjs";import{n as a}from"./resolveBundleIdByName-qXZBrUz_.mjs";import{t as o}from"./done-input-validation-BUz-aVC5.mjs";import s from"colors";async function c({"bundle-name":c,auth:l,"transcend-url":u,limit:d,after:f,json:p,debug:m=!1}){o(this.process),e(m);let h=t(u,l),g=await a(h,c);if(!g)throw Error(`Policy bundle "${c}" was not found for this organization.`);this.logger.info(s.green(`Listing versions for bundle "${c}"...`));let _={limit:d};f&&(_.after=f);let v=await n(h.get(`v1/policy-engine/policy-bundles/${g}/versions`,{searchParams:_}).json());r(this.process.stdout,{json:p,data:v,renderTable:()=>{if(v.nodes.length===0)return f?`No more versions for bundle "${c}" (end of results).`:`No versions found for bundle "${c}".`;let e=i([`id`,`version`,`createdAt`,`activatedAt`,`deactivatedAt`],v.nodes.map(e=>[e.id,e.version,e.createdAt,e.activatedAt??`-`,e.deactivatedAt??`-`]));return v.pageInfo.endCursor&&(e+=`\n\nafter: ${v.pageInfo.endCursor}`),e}})}export{c as versions};
|
|
2
|
-
//# sourceMappingURL=impl-Cli2XRp02.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-Cli2XRp02.mjs","names":[],"sources":["../src/commands/policy/versions/impl.ts"],"sourcesContent":["import colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { EMPTY_CELL } from '../constants.js';\nimport {\n buildPolicyEngineClient,\n policyEngineRequest,\n printResult,\n renderTable,\n resolveBundleIdByName,\n setPolicyEngineCliDebug,\n} from '../helpers/index.js';\nimport type { PolicyBundleVersionListResponse } from '../types.js';\n\n/** CLI flags for `transcend policy versions`. */\nexport interface VersionsCommandFlags {\n /** Tenant-unique bundle name */\n 'bundle-name': string;\n /** Transcend API key */\n auth: string;\n /** Transcend API URL */\n 'transcend-url': string;\n /** Page size */\n limit: number;\n /** Cursor from a previous page's pageInfo.endCursor */\n after?: string;\n /** Print raw JSON response */\n json: boolean;\n /** Include technical error details when a command fails */\n debug?: boolean;\n}\n\n/**\n * List versions for a policy bundle.\n *\n * @param this - CLI context\n * @param flags - Command flags\n */\nexport async function versions(\n this: LocalContext,\n {\n 'bundle-name': bundleName,\n auth,\n 'transcend-url': transcendUrl,\n limit,\n after,\n json,\n debug = false,\n }: VersionsCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n setPolicyEngineCliDebug(debug);\n\n const client = buildPolicyEngineClient(transcendUrl, auth);\n const bundleId = await resolveBundleIdByName(client, bundleName);\n\n if (!bundleId) {\n throw new Error(`Policy bundle \"${bundleName}\" was not found for this organization.`);\n }\n\n this.logger.info(colors.green(`Listing versions for bundle \"${bundleName}\"...`));\n\n const searchParams: Record<string, string | number> = { limit };\n if (after) {\n searchParams.after = after;\n }\n\n const body = await policyEngineRequest(\n client\n .get(`v1/policy-engine/policy-bundles/${bundleId}/versions`, {\n searchParams,\n })\n .json<PolicyBundleVersionListResponse>(),\n );\n\n printResult(this.process.stdout, {\n json,\n data: body,\n renderTable: () => {\n if (body.nodes.length === 0) {\n // Distinguish \"this page is empty because you paginated past the end\"\n // from \"the bundle genuinely has no versions\" — the latter is already\n // surfaced during version resolution upstream.\n return after\n ? `No more versions for bundle \"${bundleName}\" (end of results).`\n : `No versions found for bundle \"${bundleName}\".`;\n }\n\n const rows = body.nodes.map((version) => [\n version.id,\n version.version,\n version.createdAt,\n version.activatedAt ?? EMPTY_CELL,\n version.deactivatedAt ?? EMPTY_CELL,\n ]);\n\n let table = renderTable(['id', 'version', 'createdAt', 'activatedAt', 'deactivatedAt'], rows);\n if (body.pageInfo.endCursor) {\n table += `\\n\\nafter: ${body.pageInfo.endCursor}`;\n }\n return table;\n },\n });\n}\n"],"mappings":"uSAuCA,eAAsB,EAEpB,CACE,cAAe,EACf,OACA,gBAAiB,EACjB,QACA,QACA,OACA,QAAQ,IAEK,CACf,EAAoB,KAAK,QAAQ,CACjC,EAAwB,EAAM,CAE9B,IAAM,EAAS,EAAwB,EAAc,EAAK,CACpD,EAAW,MAAM,EAAsB,EAAQ,EAAW,CAEhE,GAAI,CAAC,EACH,MAAU,MAAM,kBAAkB,EAAW,wCAAwC,CAGvF,KAAK,OAAO,KAAK,EAAO,MAAM,gCAAgC,EAAW,MAAM,CAAC,CAEhF,IAAM,EAAgD,CAAE,QAAO,CAC3D,IACF,EAAa,MAAQ,GAGvB,IAAM,EAAO,MAAM,EACjB,EACG,IAAI,mCAAmC,EAAS,WAAY,CAC3D,eACD,CAAC,CACD,MAAuC,CAC3C,CAED,EAAY,KAAK,QAAQ,OAAQ,CAC/B,OACA,KAAM,EACN,gBAAmB,CACjB,GAAI,EAAK,MAAM,SAAW,EAIxB,OAAO,EACH,gCAAgC,EAAW,qBAC3C,iCAAiC,EAAW,IAWlD,IAAI,EAAQ,EAAY,CAAC,KAAM,UAAW,YAAa,cAAe,gBAAgB,CARzE,EAAK,MAAM,IAAK,GAAY,CACvC,EAAQ,GACR,EAAQ,QACR,EAAQ,UACR,EAAQ,aAAA,IACR,EAAQ,eAAA,IACT,CAE2F,CAAC,CAI7F,OAHI,EAAK,SAAS,YAChB,GAAS,cAAc,EAAK,SAAS,aAEhC,GAEV,CAAC"}
|
package/dist/impl-D-AHlqlD2.mjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./constants-Upxn_rQF.mjs";import{t}from"./logger-zplFSeXU.mjs";import{t as n}from"./done-input-validation-BUz-aVC5.mjs";import{n as r}from"./constants-DXzsg2CQ.mjs";import i from"fast-glob";import a from"colors";import{buildTranscendGraphQLClient as o,fetchActiveSiloDiscoPlugin as s,uploadSiloDiscoveryResults as c}from"@transcend-io/sdk";import{stringify as l}from"query-string";async function u({scanPath:e,fileGlobs:n,ignoreDirs:r,config:a}){let{ignoreDirs:o,supportedFiles:s,scanFunction:c}=a,l=n===``?s:s.concat(n.split(`,`)),d=[...r.split(`,`),...o].filter(e=>e.length>0);try{let n=await i(`${e}/**/${l.join(`|`)}`,{ignore:d.map(t=>`${e}/**/${t}`),unique:!0,onlyFiles:!0});t.info(`Scanning: ${n.length} files`);let r=n.map(e=>c(e)).flat().map(e=>e.softwareDevelopmentKits||[]).flat(),a=[...new Set(r.map(e=>e.name))];return t.info(`Found: ${a.length} unique dependencies`),a.map(t=>({name:t,resourceId:`${e}/**/${t}`,useStrictClassifier:!0}))}catch(e){throw Error(`Error scanning globs ${u} with error: ${e}`)}}async function d({scanPath:t,dataSiloId:i,auth:d,fileGlobs:f,ignoreDirs:p,transcendUrl:m}){n(this.process);let h=o(m,d),g=await s(h,{logger:this.logger,filterBy:{dataSiloId:i}}),_=r[g.dataSilo.type];_||(this.logger.error(a.red(`This plugin "${g.dataSilo.type}" is not supported for offline silo discovery.`)),this.process.exit(1));let v=await u({scanPath:t,fileGlobs:f,ignoreDirs:p,config:_});await c(h,{pluginId:g.id,results:v,logger:this.logger});let y=new URL(e);y.pathname=`/data-map/data-inventory/silo-discovery/triage`,y.search=l({filters:JSON.stringify({pluginIds:[g.id]})}),this.logger.info(a.green(`Scan found ${v.length} potential data silos at ${t}! View at '${y.href}'
|
|
2
|
-
|
|
3
|
-
NOTE: it may take 2-3 minutes for scan results to appear in the UI.`))}export{d as discoverSilos};
|
|
4
|
-
//# sourceMappingURL=impl-D-AHlqlD2.mjs.map
|
package/dist/impl-DPN1En7L.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{g as e}from"./constants-Upxn_rQF.mjs";import{t}from"./done-input-validation-BUz-aVC5.mjs";import{h as n,n as r,p as i,r as a,t as o}from"./prompts-ClBXdELk.mjs";import{a as s,r as c,t as l}from"./deno-runtime-DV52X8-P.mjs";import{t as u}from"./run-captured-process-BXwWXuTh.mjs";import{t as d}from"./scaffold-model-BAbYTR0q.mjs";import{t as f}from"./project-plan-apply-Dvndx455.mjs";import{c as p,i as m,n as h,s as g}from"./scaffold-planning-CNv83t_v.mjs";import _ from"colors";import{CUSTOM_FUNCTION_TYPES_VERSION as v}from"@transcend-io/custom-function-types";const y={[d.Deno]:`Deno configuration`,[d.Editor]:`VS Code settings`,[d.Skill]:`Agent skill`,[d.Ci]:`GitHub Actions`},b=Object.values(d);function x(e,t,n){return!e.json&&!e.noInteractive&&!!(t&&n)}async function S(e,t,n){let r={[d.Deno]:t.deno,[d.Editor]:t.editor,[d.Skill]:t.skill,[d.Ci]:t.ci};if(!n.interactive)return b.filter(e=>r[e]===!0);let i=b.map(e=>({name:y[e],value:e,checked:r[e]!==!1}));return e.checkbox(`Choose repository setup:`,i)}async function C(y,b){t(this.process);try{let t=s(this,{...b?{directory:b}:{},...y.manifest?{manifest:y.manifest}:{}}),o=new r(this),C=x(y,this.process.stdin.isTTY,this.process.stderr.isTTY),w=await S(o,y,{interactive:C}),T=h({state:t,snapshots:a(this,t.projectRoot,m(t,{features:w})),contractVersion:v,cliVersion:e},{features:w});if(w.includes(d.Deno)){let e=await u(`deno`,[`--version`],{cwd:this.process.cwd()},this);if(e.error?.code===`ENOENT`)T.warnings.push(`Deno 2.x is not installed. Install it from ${l}`);else if(e.code!==0)T.warnings.push(`Deno was found, but its version could not be determined. Deno 2.x is required. See ${l}`);else{let t=c(e.stdout);t.level!==`compatible`&&T.warnings.push(t.message)}}y.json||this.logger.info(n(T,{cwd:this.process.cwd(),title:`Custom Function plan`,details:[{label:`Target`,path:T.targetDirectory},{label:`Manifest`,path:T.manifestPath}]}));let E=T.changes.length===0||y.dryRun;if(T.changes.length>0&&!y.dryRun)if(y.yes)E=!0;else if(C)E=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.`);E&&!y.dryRun&&T.changes.length>0&&await f(this,T);let D=E&&!y.dryRun&&T.changes.length>0,O=E&&!y.dryRun,k=p({targetDirectory:i(this.process.cwd(),t.targetDirectory),manifestPath:i(this.process.cwd(),t.manifestPath),cliVersion:e,hasSkill:O&&w.includes(d.Skill),hasGithubWorkflow:O&&w.includes(d.Ci)&&!!(t.repositoryRoot&&t.usesGithub)}),A=g(T,{applied:D,dryRun:y.dryRun,cwd:this.process.cwd(),aiHandoff:k});if(y.json){this.process.stdout.write(`${JSON.stringify(A)}\n`);return}if(y.dryRun){this.logger.info(_.yellow(`Dry run complete. No changes were written.`));return}if(!E){this.logger.info(_.yellow(`No changes applied.`));return}if(T.changes.length===0){this.logger.info(_.green(`Custom Function project is already initialized.`));return}this.logger.info(_.green(`Custom Function project initialized.`)),T.nextSteps.length>0&&(this.logger.info(`\n${_.bold(`Next steps`)}`),T.nextSteps.forEach(e=>this.logger.info(e))),this.logger.info(`\n${_.bold(`AI handoff — paste into your coding agent`)}`),this.logger.info(k)}catch(e){throw e instanceof o&&this.process.exit(130),e}}export{C as init};
|
|
2
|
-
//# sourceMappingURL=impl-DPN1En7L.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-DPN1En7L.mjs","names":["CLI_VERSION"],"sources":["../src/commands/custom-functions/init/impl.ts"],"sourcesContent":["import { CUSTOM_FUNCTION_TYPES_VERSION } from '@transcend-io/custom-function-types';\nimport colors from 'colors';\n\nimport { version as CLI_VERSION } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { runCapturedProcess } from '../../../lib/cli/run-captured-process.js';\nimport { buildInitAiHandoff } from '../../../lib/custom-functions/ai-handoff.js';\nimport {\n DENO_INSTALL_URL,\n getDenoRuntimeCompatibility,\n SUPPORTED_DENO_MAJOR_VERSION,\n} from '../../../lib/custom-functions/deno-runtime.js';\nimport { discoverCustomFunctionProject } from '../../../lib/custom-functions/project-discovery.js';\nimport {\n CustomFunctionSetupFeature,\n type CustomFunctionSetupFeature as CustomFunctionSetupFeatureType,\n} from '../../../lib/custom-functions/scaffold-model.js';\nimport { buildPlanResult } from '../../../lib/custom-functions/scaffold-output.js';\nimport {\n buildInitPlan,\n getInitPlanningCandidatePaths,\n} from '../../../lib/custom-functions/scaffold-planning.js';\nimport { collectPlanningSnapshots } from '../../../lib/scaffolding/project-discovery.js';\nimport { applyProjectPlan } from '../../../lib/scaffolding/project-plan-apply.js';\nimport {\n displayProjectPath,\n renderProjectPlan,\n} from '../../../lib/scaffolding/project-plan-output.js';\nimport {\n PromptCancelledError,\n type PromptChoice,\n ScaffoldPrompts,\n} from '../../../lib/scaffolding/prompts.js';\n\n/** Flags for `custom-functions init`. */\nexport interface CustomFunctionInitFlags {\n /** Explicit manifest path. */\n manifest?: string;\n /** Install Deno configuration. */\n deno?: boolean;\n /** Install editor recommendations. */\n editor?: boolean;\n /** Install the coding-agent skill. */\n skill?: boolean;\n /** Install GitHub Actions validation. */\n ci?: boolean;\n /** Disable prompts. */\n noInteractive: boolean;\n /** Render but do not apply. */\n dryRun: boolean;\n /** Approve the final displayed plan. */\n yes: boolean;\n /** Emit one stable JSON result on stdout. */\n json: boolean;\n}\n\n/** User-facing setup labels. */\nconst SETUP_LABELS: Readonly<Record<CustomFunctionSetupFeatureType, string>> = {\n [CustomFunctionSetupFeature.Deno]: 'Deno configuration',\n [CustomFunctionSetupFeature.Editor]: 'VS Code settings',\n [CustomFunctionSetupFeature.Skill]: 'Agent skill',\n [CustomFunctionSetupFeature.Ci]: 'GitHub Actions',\n};\n\n/** All optional setup features in stable prompt order. */\nconst ALL_SETUP_FEATURES = Object.values(CustomFunctionSetupFeature);\n\n/**\n * Whether this invocation can ask questions.\n *\n * @param context - CLI context\n * @param flags - Interaction flags\n * @returns Whether prompts are enabled\n */\nfunction isInteractiveInvocation(\n flags: Pick<CustomFunctionInitFlags, 'json' | 'noInteractive'>,\n stdinIsTTY: boolean | undefined,\n stderrIsTTY: boolean | undefined,\n): boolean {\n return !flags.json && !flags.noInteractive && Boolean(stdinIsTTY && stderrIsTTY);\n}\n\n/**\n * Resolve setup directly from individual flags or one checkbox prompt.\n *\n * @param context - CLI context\n * @param prompts - Prompt adapters\n * @param flags - Setup flags\n * @param options - Interaction state\n * @returns Selected setup features\n */\nasync function resolveFeatures(\n prompts: ScaffoldPrompts,\n flags: CustomFunctionInitFlags,\n options: {\n /** Whether prompts are available. */\n interactive: boolean;\n },\n): Promise<CustomFunctionSetupFeatureType[]> {\n const enabled: Readonly<Record<CustomFunctionSetupFeatureType, boolean | undefined>> = {\n [CustomFunctionSetupFeature.Deno]: flags.deno,\n [CustomFunctionSetupFeature.Editor]: flags.editor,\n [CustomFunctionSetupFeature.Skill]: flags.skill,\n [CustomFunctionSetupFeature.Ci]: flags.ci,\n };\n if (!options.interactive) {\n return ALL_SETUP_FEATURES.filter((feature) => enabled[feature] === true);\n }\n const choices: PromptChoice<CustomFunctionSetupFeatureType>[] = ALL_SETUP_FEATURES.map(\n (feature) => ({\n name: SETUP_LABELS[feature],\n value: feature,\n checked: enabled[feature] !== false,\n }),\n );\n return prompts.checkbox('Choose repository setup:', choices);\n}\n\n/**\n * Initialize a credential-free local Custom Function project.\n *\n * @param this - CLI context\n * @param flags - Scaffold and interaction flags\n * @param directory - Optional target directory\n */\nexport async function init(\n this: LocalContext,\n flags: CustomFunctionInitFlags,\n directory?: string,\n): Promise<void> {\n doneInputValidation(this.process);\n try {\n const state = discoverCustomFunctionProject(this, {\n ...(directory ? { directory } : {}),\n ...(flags.manifest ? { manifest: flags.manifest } : {}),\n });\n const prompts = new ScaffoldPrompts(this);\n const interactive = isInteractiveInvocation(\n flags,\n this.process.stdin.isTTY,\n this.process.stderr.isTTY,\n );\n const features = await resolveFeatures(prompts, flags, { interactive });\n const snapshots = collectPlanningSnapshots(\n this,\n state.projectRoot,\n getInitPlanningCandidatePaths(state, { features }),\n );\n const plan = buildInitPlan(\n {\n state,\n snapshots,\n contractVersion: CUSTOM_FUNCTION_TYPES_VERSION,\n cliVersion: CLI_VERSION,\n },\n { features },\n );\n if (features.includes(CustomFunctionSetupFeature.Deno)) {\n const denoVersion = await runCapturedProcess(\n 'deno',\n ['--version'],\n { cwd: this.process.cwd() },\n this,\n );\n if (denoVersion.error?.code === 'ENOENT') {\n plan.warnings.push(\n `Deno ${SUPPORTED_DENO_MAJOR_VERSION}.x is not installed. Install it from ${DENO_INSTALL_URL}`,\n );\n } else if (denoVersion.code !== 0) {\n plan.warnings.push(\n `Deno was found, but its version could not be determined. Deno ${SUPPORTED_DENO_MAJOR_VERSION}.x is required. See ${DENO_INSTALL_URL}`,\n );\n } else {\n const compatibility = getDenoRuntimeCompatibility(denoVersion.stdout);\n if (compatibility.level !== 'compatible') {\n plan.warnings.push(compatibility.message);\n }\n }\n }\n if (!flags.json) {\n this.logger.info(\n renderProjectPlan(plan, {\n cwd: this.process.cwd(),\n title: 'Custom Function plan',\n details: [\n { label: 'Target', path: plan.targetDirectory },\n { label: 'Manifest', path: plan.manifestPath },\n ],\n }),\n );\n }\n\n let approved = plan.changes.length === 0 || flags.dryRun;\n if (plan.changes.length > 0 && !flags.dryRun) {\n if (flags.yes) {\n approved = true;\n } else if (interactive) {\n approved = await prompts.confirm('Apply this complete plan?', true);\n } else {\n throw new Error(\n 'The plan requires approval in a non-interactive invocation. Review with --dryRun, then pass --yes.',\n );\n }\n }\n\n if (approved && !flags.dryRun && plan.changes.length > 0) {\n await applyProjectPlan(this, plan);\n }\n const applied = approved && !flags.dryRun && plan.changes.length > 0;\n const setupAvailable = approved && !flags.dryRun;\n const aiHandoff = buildInitAiHandoff({\n targetDirectory: displayProjectPath(this.process.cwd(), state.targetDirectory),\n manifestPath: displayProjectPath(this.process.cwd(), state.manifestPath),\n cliVersion: CLI_VERSION,\n hasSkill: setupAvailable && features.includes(CustomFunctionSetupFeature.Skill),\n hasGithubWorkflow:\n setupAvailable &&\n features.includes(CustomFunctionSetupFeature.Ci) &&\n Boolean(state.repositoryRoot && state.usesGithub),\n });\n const result = buildPlanResult(plan, {\n applied,\n dryRun: flags.dryRun,\n cwd: this.process.cwd(),\n aiHandoff,\n });\n if (flags.json) {\n this.process.stdout.write(`${JSON.stringify(result)}\\n`);\n return;\n }\n if (flags.dryRun) {\n this.logger.info(colors.yellow('Dry run complete. No changes were written.'));\n return;\n }\n if (!approved) {\n this.logger.info(colors.yellow('No changes applied.'));\n return;\n }\n if (plan.changes.length === 0) {\n this.logger.info(colors.green('Custom Function project is already initialized.'));\n return;\n }\n this.logger.info(colors.green('Custom Function project initialized.'));\n if (plan.nextSteps.length > 0) {\n this.logger.info(`\\n${colors.bold('Next steps')}`);\n plan.nextSteps.forEach((step) => this.logger.info(step));\n }\n this.logger.info(`\\n${colors.bold('AI handoff — paste into your coding agent')}`);\n this.logger.info(aiHandoff);\n } catch (error) {\n if (error instanceof PromptCancelledError) {\n this.process.exit(130);\n }\n throw error;\n }\n}\n"],"mappings":"0jBA0DA,MAAM,EAAyE,EAC5E,EAA2B,MAAO,sBAClC,EAA2B,QAAS,oBACpC,EAA2B,OAAQ,eACnC,EAA2B,IAAK,iBAClC,CAGK,EAAqB,OAA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OAAQ,CAChB,KAAK,OAAO,KAAK,EAAO,OAAO,6CAA6C,CAAC,CAC7E,OAEF,GAAI,CAAC,EAAU,CACb,KAAK,OAAO,KAAK,EAAO,OAAO,sBAAsB,CAAC,CACtD,OAEF,GAAI,EAAK,QAAQ,SAAW,EAAG,CAC7B,KAAK,OAAO,KAAK,EAAO,MAAM,kDAAkD,CAAC,CACjF,OAEF,KAAK,OAAO,KAAK,EAAO,MAAM,uCAAuC,CAAC,CAClE,EAAK,UAAU,OAAS,IAC1B,KAAK,OAAO,KAAK,KAAK,EAAO,KAAK,aAAa,GAAG,CAClD,EAAK,UAAU,QAAS,GAAS,KAAK,OAAO,KAAK,EAAK,CAAC,EAE1D,KAAK,OAAO,KAAK,KAAK,EAAO,KAAK,4CAA4C,GAAG,CACjF,KAAK,OAAO,KAAK,EAAU,OACpB,EAAO,CAId,MAHI,aAAiB,GACnB,KAAK,QAAQ,KAAK,IAAI,CAElB"}
|
package/dist/impl-DPtx5iZO.mjs
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./done-input-validation-BUz-aVC5.mjs";import{spawn as t}from"node:child_process";import{createReadStream as n}from"node:fs";import r from"node:path";import i from"fast-glob";import a from"colors";function o(e,t,r){return new Promise((i,a)=>{let o=n(e),s=Buffer.alloc(0),c=t.length,l=0;o.on(`data`,e=>{let n=typeof e==`string`?Buffer.from(e):e;if(r){let e=r-l;if(e<=0){o.destroy(),i(!1);return}n.length>e&&(n=n.subarray(0,e)),l+=n.length}let a=s.length?Buffer.concat([s,n]):n;if(a.toString(`utf8`).toLowerCase().includes(t.toString(`utf8`))){o.destroy(),i(!0);return}s=c>1?Buffer.from(a.subarray(Math.max(0,a.length-(c-1)))):Buffer.alloc(0)}),o.on(`error`,a),o.on(`close`,()=>i(!1)),o.on(`end`,()=>i(!1))})}async function s(e,t,n){let r=0,i=Array.from({length:Math.min(t,e.length)},async()=>{for(;;){let t=r;if(r+=1,t>=e.length)return;await n(e[t])}});await Promise.all(i)}function c(e,n){return new Promise((r,i)=>{let a=t(e,[`-noheader`,`-batch`,`-cmd`,n],{stdio:[`ignore`,`pipe`,`pipe`]}),o=``,s=``;a.stdout.on(`data`,e=>{o+=String(e)}),a.stderr.on(`data`,e=>{s+=String(e)}),a.on(`error`,i),a.on(`close`,e=>{e===0?r(o):i(Error(`duckdb exited ${e}: ${s}`))})})}async function l(e,t){return(await c(e,[`SELECT column_name`,`FROM parquet_schema('${t.replace(/'/g,`''`)}')`,`WHERE lower(column_type) LIKE '%varchar%'`,` OR lower(column_type) LIKE '%string%';`].join(`
|
|
2
|
-
`))).split(`
|
|
3
|
-
`).map(e=>e.trim()).filter(Boolean)}async function u(e,t,n){let r=await l(e,t);if(r.length===0)return!1;let i=t.replace(/'/g,`''`),a=r.map(e=>`"${e.replace(/"/g,`""`)}" = '${n.replace(/'/g,`''`)}'`).join(` OR `);return(await c(e,[`SELECT 1 AS hit FROM read_parquet('${i}')`,`WHERE ${a}`,`LIMIT 1;`].join(`
|
|
4
|
-
`))).trim().length>0}async function d(t){e(this.process);let{needle:n,root:c,exts:l,noParquet:d,concurrency:f,maxBytes:p}=t,m=r.resolve(c),h=new Set(l.split(`,`).map(e=>e.trim().replace(/^\./,``).toLowerCase()).filter(Boolean)),g=Array.from(h).map(e=>`**/*.${e}`);this.logger.info(a.green(`Searching for "${n}" in ${m} (exts: ${[...h].join(`, `)})`));let _=await i(g,{cwd:m,absolute:!0,onlyFiles:!0,followSymbolicLinks:!1,suppressErrors:!0}),v=Buffer.from(n.toLowerCase(),`utf8`),y=[];if(await s(_,f,async e=>{try{await o(e,v,p)&&(y.push(e),this.process.stdout.write(`${e}\n`))}catch{}}),!d){let e=await i([`**/*.parquet`],{cwd:m,absolute:!0,onlyFiles:!0,followSymbolicLinks:!1,suppressErrors:!0});e.length>0&&(this.logger.info(a.green(`Scanning ${e.length} parquet file(s) via DuckDB...`)),await s(e,Math.max(2,Math.floor(f/4)),async e=>{try{await u(`duckdb`,e,n)&&(y.push(e),this.process.stdout.write(`${e}\n`))}catch{}}))}this.logger.info(a.green(`Done. Found ${y.length} matching file(s).`))}export{d as findTextInFolder};
|
|
5
|
-
//# sourceMappingURL=impl-DPtx5iZO.mjs.map
|
package/dist/impl-DQPmSYSE.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./retryRequestDataSilos-CEgUW6Fx.mjs";import{t}from"./done-input-validation-BUz-aVC5.mjs";async function n({auth:n,dataSiloId:r,actions:i,transcendUrl:a}){t(this.process),await e({requestActions:i,transcendUrl:a,auth:n,dataSiloId:r})}export{n as retryRequestDataSilos};
|
|
2
|
-
//# sourceMappingURL=impl-DQPmSYSE.mjs.map
|
package/dist/impl-DXRDWiB1.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./validateTranscendAuth-D6Wr1cxY.mjs";import{t}from"./done-input-validation-BUz-aVC5.mjs";import n from"colors";import{buildTranscendGraphQLClient as r,fetchAllCustomFunctions as i}from"@transcend-io/sdk";async function a({auth:a,transcendUrl:o}){t(this.process);let s=e(a,this);Array.isArray(s)&&(this.logger.error(n.red(`transcend custom-functions list does not support a list of API keys — pass a single API key.`)),this.process.exit(1));let c=await i(r(o,s),{logger:this.logger});if(c.length===0){this.logger.info(n.yellow(`No custom functions found in this organization.`));return}this.logger.info(n.magenta(`Found ${c.length} custom function(s):`)),c.forEach(e=>{let t=e.activeVersion?`active v${e.activeVersion.versionNumber}`:`no active version`,r=e.hasPendingDraft&&e.draftVersion?`, pending draft v${e.draftVersion.versionNumber}`:``;this.logger.info(` - ${n.green(e.name)} [${e.type}] (${e.lifecycleState.toLowerCase()}, ${t}${r}) `+n.dim(`id: ${e.id}`))})}export{a as list};
|
|
2
|
-
//# sourceMappingURL=impl-DXRDWiB1.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-DXRDWiB1.mjs","names":[],"sources":["../src/commands/custom-functions/list/impl.ts"],"sourcesContent":["import { buildTranscendGraphQLClient, fetchAllCustomFunctions } from '@transcend-io/sdk';\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { validateTranscendAuth } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\n\nexport interface CustomFunctionsListCommandFlags {\n auth: string;\n transcendUrl: string;\n}\n\nexport async function list(\n this: LocalContext,\n { auth, transcendUrl }: CustomFunctionsListCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n const apiKeyOrList = validateTranscendAuth(auth, this);\n if (Array.isArray(apiKeyOrList)) {\n this.logger.error(\n colors.red(\n 'transcend custom-functions list does not support a list of API keys — pass a single API key.',\n ),\n );\n this.process.exit(1);\n }\n\n const client = buildTranscendGraphQLClient(transcendUrl, apiKeyOrList as string);\n const customFunctions = await fetchAllCustomFunctions(client, { logger: this.logger });\n\n if (customFunctions.length === 0) {\n this.logger.info(colors.yellow('No custom functions found in this organization.'));\n return;\n }\n\n this.logger.info(colors.magenta(`Found ${customFunctions.length} custom function(s):`));\n customFunctions.forEach((customFunction) => {\n const active = customFunction.activeVersion\n ? `active v${customFunction.activeVersion.versionNumber}`\n : 'no active version';\n const draft =\n customFunction.hasPendingDraft && customFunction.draftVersion\n ? `, pending draft v${customFunction.draftVersion.versionNumber}`\n : '';\n this.logger.info(\n ` - ${colors.green(customFunction.name)} [${customFunction.type}] ` +\n `(${customFunction.lifecycleState.toLowerCase()}, ${active}${draft}) ` +\n colors.dim(`id: ${customFunction.id}`),\n );\n });\n}\n"],"mappings":"gOAYA,eAAsB,EAEpB,CAAE,OAAM,gBACO,CACf,EAAoB,KAAK,QAAQ,CAEjC,IAAM,EAAe,EAAsB,EAAM,KAAK,CAClD,MAAM,QAAQ,EAAa,GAC7B,KAAK,OAAO,MACV,EAAO,IACL,+FACD,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAItB,IAAM,EAAkB,MAAM,EADf,EAA4B,EAAc,EACG,CAAE,CAAE,OAAQ,KAAK,OAAQ,CAAC,CAEtF,GAAI,EAAgB,SAAW,EAAG,CAChC,KAAK,OAAO,KAAK,EAAO,OAAO,kDAAkD,CAAC,CAClF,OAGF,KAAK,OAAO,KAAK,EAAO,QAAQ,SAAS,EAAgB,OAAO,sBAAsB,CAAC,CACvF,EAAgB,QAAS,GAAmB,CAC1C,IAAM,EAAS,EAAe,cAC1B,WAAW,EAAe,cAAc,gBACxC,oBACE,EACJ,EAAe,iBAAmB,EAAe,aAC7C,oBAAoB,EAAe,aAAa,gBAChD,GACN,KAAK,OAAO,KACV,OAAO,EAAO,MAAM,EAAe,KAAK,CAAC,IAAI,EAAe,KAAK,KAC3D,EAAe,eAAe,aAAa,CAAC,IAAI,IAAS,EAAM,IACnE,EAAO,IAAI,OAAO,EAAe,KAAK,CACzC,EACD"}
|
package/dist/impl-DdIa0zla.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./policyEngineCliError-DY8V-qkK.mjs";import{i as t,n,t as r}from"./printResult-CHe3nRN4.mjs";import{t as i}from"./renderTable-D68QasPc.mjs";import{t as a}from"./done-input-validation-BUz-aVC5.mjs";import o from"colors";async function s({auth:s,"transcend-url":c,limit:l,offset:u,json:d,debug:f=!1}){a(this.process),e(f);let p=t(c,s);this.logger.info(o.green(`Listing policy bundles...`));let m=await n(p.get(`v1/policy-engine/policy-bundles`,{searchParams:{limit:l,offset:u}}).json());r(this.process.stdout,{json:d,data:m,renderTable:()=>{if(m.nodes.length===0)return`No policy bundles found.`;let e=i([`id`,`bundleName`,`activeVersionId`,`lastActivatedAt`,`createdAt`],m.nodes.map(e=>[e.id,e.bundleName,e.activeVersionId??`-`,e.lastActivatedAt??`-`,e.createdAt]));return e+=`\n\ntotalCount: ${m.totalCount}`,u+m.nodes.length<m.totalCount&&(e+=`\nnextOffset: ${u+m.nodes.length}`),e}})}export{s as bundles};
|
|
2
|
-
//# sourceMappingURL=impl-DdIa0zla.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-DdIa0zla.mjs","names":[],"sources":["../src/commands/policy/bundles/impl.ts"],"sourcesContent":["import colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { EMPTY_CELL } from '../constants.js';\nimport {\n buildPolicyEngineClient,\n policyEngineRequest,\n printResult,\n renderTable,\n setPolicyEngineCliDebug,\n} from '../helpers/index.js';\nimport type { PolicyBundleListResponse } from '../types.js';\n\n/** CLI flags for `transcend policy bundles`. */\nexport interface BundlesCommandFlags {\n /** Transcend API key */\n auth: string;\n /** Transcend API URL */\n 'transcend-url': string;\n /** Page size */\n limit: number;\n /** Number of records to skip */\n offset: number;\n /** Print raw JSON response */\n json: boolean;\n /** Include technical error details when a command fails */\n debug?: boolean;\n}\n\n/**\n * List policy bundles for the current organization.\n *\n * @param this - CLI context\n * @param flags - Command flags\n */\nexport async function bundles(\n this: LocalContext,\n { auth, 'transcend-url': transcendUrl, limit, offset, json, debug = false }: BundlesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n setPolicyEngineCliDebug(debug);\n\n const client = buildPolicyEngineClient(transcendUrl, auth);\n\n this.logger.info(colors.green('Listing policy bundles...'));\n\n const body = await policyEngineRequest(\n client\n .get('v1/policy-engine/policy-bundles', {\n searchParams: { limit, offset },\n })\n .json<PolicyBundleListResponse>(),\n );\n\n printResult(this.process.stdout, {\n json,\n data: body,\n renderTable: () => {\n if (body.nodes.length === 0) {\n return 'No policy bundles found.';\n }\n\n const rows = body.nodes.map((bundle) => [\n bundle.id,\n bundle.bundleName,\n bundle.activeVersionId ?? EMPTY_CELL,\n bundle.lastActivatedAt ?? EMPTY_CELL,\n bundle.createdAt,\n ]);\n\n let table = renderTable(\n ['id', 'bundleName', 'activeVersionId', 'lastActivatedAt', 'createdAt'],\n rows,\n );\n table += `\\n\\ntotalCount: ${body.totalCount}`;\n if (offset + body.nodes.length < body.totalCount) {\n table += `\\nnextOffset: ${offset + body.nodes.length}`;\n }\n return table;\n },\n });\n}\n"],"mappings":"8OAoCA,eAAsB,EAEpB,CAAE,OAAM,gBAAiB,EAAc,QAAO,SAAQ,OAAM,QAAQ,IACrD,CACf,EAAoB,KAAK,QAAQ,CACjC,EAAwB,EAAM,CAE9B,IAAM,EAAS,EAAwB,EAAc,EAAK,CAE1D,KAAK,OAAO,KAAK,EAAO,MAAM,4BAA4B,CAAC,CAE3D,IAAM,EAAO,MAAM,EACjB,EACG,IAAI,kCAAmC,CACtC,aAAc,CAAE,QAAO,SAAQ,CAChC,CAAC,CACD,MAAgC,CACpC,CAED,EAAY,KAAK,QAAQ,OAAQ,CAC/B,OACA,KAAM,EACN,gBAAmB,CACjB,GAAI,EAAK,MAAM,SAAW,EACxB,MAAO,2BAWT,IAAI,EAAQ,EACV,CAAC,KAAM,aAAc,kBAAmB,kBAAmB,YAAY,CAT5D,EAAK,MAAM,IAAK,GAAW,CACtC,EAAO,GACP,EAAO,WACP,EAAO,iBAAA,IACP,EAAO,iBAAA,IACP,EAAO,UACR,CAIK,CACL,CAKD,MAJA,IAAS,mBAAmB,EAAK,aAC7B,EAAS,EAAK,MAAM,OAAS,EAAK,aACpC,GAAS,iBAAiB,EAAS,EAAK,MAAM,UAEzC,GAEV,CAAC"}
|
package/dist/impl-Dp4bZvAV.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./buildExamples-DOopJFYY.mjs";import{r as t}from"./policyEngineCliError-DY8V-qkK.mjs";import{r as n,t as r}from"./runOpa-CswzJxIs.mjs";import{t as i}from"./policy-bundle-manifest-D6dkbjNi.mjs";import{a,i as o,n as s,o as c,t as l}from"./printResult-CHe3nRN4.mjs";import{t as u}from"./formatPolicyBundleVersionSummary-CJmMCLtJ.mjs";import{n as d}from"./resolveBundleIdByName-qXZBrUz_.mjs";import{n as f}from"./inquirer-BeaBetMO.mjs";import{t as p}from"./done-input-validation-BUz-aVC5.mjs";import{spawnSync as m}from"node:child_process";import h from"node:fs";import g from"node:os";import _ from"node:path";import{gunzipSync as v}from"node:zlib";import y from"fast-glob";import b from"colors";function x(e){let t=y.sync(`**/*.rego`,{cwd:e,onlyFiles:!0,dot:!1}).sort(),n=_.join(e,`manifest.json`),{publishableRegoPaths:r}=i(h.existsSync(n)?h.readFileSync(n,`utf8`):void 0,t.map(t=>({path:t,contents:h.readFileSync(_.join(e,t),`utf8`)})));return{entries:[`manifest.json`,...r]}}async function S(e){let t=_.join(g.tmpdir(),`transcend-policy-bundle-build-${Date.now()}-${Math.random().toString(36).slice(2)}.tar.gz`);try{let{code:n,stderr:i}=await r([`build`,`--v0-compatible`,`--ignore`,`*_test.rego`,`-o`,t,`.`],{cwd:e});if(n!==0)throw Error(i.trim()||`opa build failed with exit code ${n}`)}finally{h.existsSync(t)&&h.unlinkSync(t)}}function C(e){if(e<1024)return`${e} B`;let t=e/1024;if(t<1024)return`${t%1==0?t.toFixed(0):t.toFixed(1)} KiB`;let n=t/1024;return`${n%1==0?n.toFixed(0):n.toFixed(1)} MiB`}async function w(e){n();let t=_.resolve(e);if(!h.existsSync(t)||!h.statSync(t).isDirectory())throw Error(`Policy directory does not exist or is not a directory: ${t}`);let{entries:i}=x(t),{code:o,stderr:s}=await r([`check`,`--strict`,`--v0-compatible`,t]);if(o!==0)throw Error(s.trim()||`opa check failed with exit code ${o}`);await S(t);let l=_.join(g.tmpdir(),`transcend-policy-bundle-${Date.now()}-${Math.random().toString(36).slice(2)}.tar.gz`),u=m(`tar`,[`-czf`,l,`-C`,t,...i],{env:{...process.env,COPYFILE_DISABLE:`1`},encoding:`utf8`});if(u.status!==0)throw Error(`Failed to create policy bundle archive: ${u.stderr.trim()||`tar failed`}`);let d=h.readFileSync(l);if(d.byteLength>5120)throw h.unlinkSync(l),Error(`Policy bundle exceeds the ${C(a)} compressed upload limit (bundle is ${C(d.byteLength)}). The server also rejects decompressed bundles larger than ${C(c)}.`);let f=v(d);if(f.byteLength>51200)throw h.unlinkSync(l),Error(`Policy bundle exceeds the ${C(c)} decompressed upload limit (bundle is ${C(f.byteLength)} decompressed).`);return l}function T(e){let t=h.readFileSync(e.bundlePath),n=new FormData;return n.append(`bundle`,new Blob([t],{type:`application/gzip`}),_.basename(e.bundlePath)),n.append(`version`,e.version),e.description&&n.append(`description`,e.description),e.bundleName&&n.append(`bundleName`,e.bundleName),n}function E(e){return e.toISOString().slice(0,19).replace(/[T:]/g,`-`)}function D(e,t=new Date){return`${e}-${E(t)}`}async function O({dir:n,"bundle-name":r,auth:i,"transcend-url":a,version:c,description:m,json:h,yes:g,debug:v=!1}){p(this.process),t(v);let y=_.resolve(n),x=c??D(r),S=o(a,i),C;try{this.logger.info(b.green(`Building policy bundle from ${y}...`)),C=await w(y);let t=await d(S,r),n;if(t){this.logger.info(b.green(`Uploading new version for bundle "${r}"...`));let e=T({bundlePath:C,version:x,description:m});n=await s(S.post(`v1/policy-engine/policy-bundles/${t}/versions`,{body:e}).json())}else{if(!this.process.stdin.isTTY&&!g){this.logger.error(b.red(`Cannot create a new bundle in a non-interactive environment; pass --yes to confirm.`)),this.process.exit(1);return}if(!g&&(this.logger.warn(b.yellow(`No policy bundle named "${r}" exists for this organization.`)),!await f({message:`No policy bundle named "${r}" exists. Create a new bundle and upload its first version?`}))){this.logger.info(b.yellow(`Publish cancelled.`));return}this.logger.info(b.green(`Creating bundle "${r}" and uploading first version...`));let e=T({bundlePath:C,version:x,description:m,bundleName:r});n=await s(S.post(`v1/policy-engine/policy-bundles`,{body:e}).json())}l(this.process.stdout,{json:h,data:n,renderTable:()=>u(n.version)}),this.logger.info(b.green(`Policy bundle version uploaded successfully.`));let i=e([`policy`,`activate`],{version:n.version.version,"bundle-name":r});this.logger.info(b.yellow(`Publishing a policy does not activate it. To activate this version, run:\n ${i}`))}finally{C&&this.fs.existsSync(C)&&this.fs.unlinkSync(C)}}export{O as publish};
|
|
2
|
-
//# sourceMappingURL=impl-Dp4bZvAV.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"impl-Dp4bZvAV.mjs","names":["fg"],"sources":["../src/commands/policy/helpers/buildOpaBundleTarball.ts","../src/commands/policy/helpers/buildPolicyBundleFormData.ts","../src/commands/policy/helpers/defaultPolicyVersionLabel.ts","../src/commands/policy/publish/impl.ts"],"sourcesContent":["import { spawnSync } from 'node:child_process';\nimport fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\nimport { gunzipSync } from 'node:zlib';\n\nimport fg from 'fast-glob';\n\nimport { validatePolicyBundleContents } from '../../../lib/policy/policy-bundle-manifest.js';\nimport { MAX_BUNDLE_COMPRESSED_BYTES, MAX_BUNDLE_DECOMPRESSED_BYTES } from '../constants.js';\nimport { assertOpaInstalled } from './assertOpaInstalled.js';\nimport { runOPACapture } from './runOpa.js';\n\n/** Result of collecting publishable entries from a policy bundle directory. */\ninterface PolicyBundleArchiveContents {\n /** Relative paths to include in the upload tarball (manifest first, then rego) */\n entries: string[];\n}\n\n/**\n * Collects `manifest.json` and publishable `.rego` files from a policy directory.\n *\n * @param dir - Absolute path to the policy bundle directory\n * @returns Validated archive entries\n */\nfunction collectPolicyBundleArchiveEntries(dir: string): PolicyBundleArchiveContents {\n const regoFiles = fg\n .sync('**/*.rego', {\n cwd: dir,\n onlyFiles: true,\n dot: false,\n })\n .sort();\n const manifestPath = path.join(dir, 'manifest.json');\n const { publishableRegoPaths } = validatePolicyBundleContents(\n fs.existsSync(manifestPath) ? fs.readFileSync(manifestPath, 'utf8') : undefined,\n regoFiles.map((relativePath) => ({\n path: relativePath,\n contents: fs.readFileSync(path.join(dir, relativePath), 'utf8'),\n })),\n );\n\n return {\n entries: ['manifest.json', ...publishableRegoPaths],\n };\n}\n\n/**\n * Verifies that a policy directory compiles end-to-end with `opa build`.\n *\n * The compiled output is discarded — the server receives the `manifest.json` +\n * `.rego` archive produced by {@link buildOpaBundleTarball}, not the OPA bundle\n * — but a successful build guarantees the policies compile and link, surfacing\n * errors (syntax, missing imports, undefined references, etc.) before upload.\n *\n * @param dir - Absolute path to the policy bundle directory\n */\nasync function assertBundleCompiles(dir: string): Promise<void> {\n const buildOutputPath = path.join(\n os.tmpdir(),\n `transcend-policy-bundle-build-${Date.now()}-${Math.random().toString(36).slice(2)}.tar.gz`,\n );\n try {\n // Run with `cwd` set to the bundle directory and pass `.` so `opa build`\n // resolves the bundle root correctly. `*_test.rego` files are local-only.\n const { code, stderr } = await runOPACapture(\n ['build', '--v0-compatible', '--ignore', '*_test.rego', '-o', buildOutputPath, '.'],\n { cwd: dir },\n );\n if (code !== 0) {\n throw new Error(stderr.trim() || `opa build failed with exit code ${code}`);\n }\n } finally {\n if (fs.existsSync(buildOutputPath)) {\n fs.unlinkSync(buildOutputPath);\n }\n }\n}\n\n/**\n * Formats a byte count as a human-readable size with binary units.\n *\n * @param bytes - Number of bytes\n * @returns Human-readable size, e.g. `14 MiB` or `4 KiB`\n */\nfunction formatBytes(bytes: number): string {\n if (bytes < 1024) {\n return `${bytes} B`;\n }\n const kib = bytes / 1024;\n if (kib < 1024) {\n return `${kib % 1 === 0 ? kib.toFixed(0) : kib.toFixed(1)} KiB`;\n }\n const mib = kib / 1024;\n return `${mib % 1 === 0 ? mib.toFixed(0) : mib.toFixed(1)} MiB`;\n}\n\n/**\n * Builds a gzip-compressed policy bundle tarball for upload to Transcend.\n *\n * The Policy Engine API expects a plain archive containing `manifest.json` and\n * one or more `.rego` files. This differs from `opa build` output, which embeds\n * `.manifest`, `data.json`, and other OPA bundle metadata that the server\n * rejects. Before packaging, the manifest is validated (shape + root coverage)\n * and the bundle is validated with `opa check` (strict Rego linting) and\n * `opa build` (full compilation) so failures surface client-side rather than\n * after upload.\n *\n * @param dir - Directory containing `manifest.json` and `.rego` policy files\n * @returns Absolute path to the generated `.tar.gz` bundle\n */\nexport async function buildOpaBundleTarball(dir: string): Promise<string> {\n assertOpaInstalled();\n\n const resolvedDir = path.resolve(dir);\n if (!fs.existsSync(resolvedDir) || !fs.statSync(resolvedDir).isDirectory()) {\n throw new Error(`Policy directory does not exist or is not a directory: ${resolvedDir}`);\n }\n\n // Validate the manifest shape and that roots cover every Rego package before\n // invoking OPA, so invalid manifests surface a clear error instead of an\n // opaque `opa build failed with exit code 1`.\n const { entries: archiveEntries } = collectPolicyBundleArchiveEntries(resolvedDir);\n\n // Match the Rego v1 validation the Policy Engine API runs on upload.\n const { code: checkCode, stderr: checkStderr } = await runOPACapture([\n 'check',\n '--strict',\n '--v0-compatible',\n resolvedDir,\n ]);\n if (checkCode !== 0) {\n throw new Error(checkStderr.trim() || `opa check failed with exit code ${checkCode}`);\n }\n\n // Ensure the bundle compiles end-to-end before packaging for upload.\n await assertBundleCompiles(resolvedDir);\n\n const outputPath = path.join(\n os.tmpdir(),\n `transcend-policy-bundle-${Date.now()}-${Math.random().toString(36).slice(2)}.tar.gz`,\n );\n\n const tarResult = spawnSync('tar', ['-czf', outputPath, '-C', resolvedDir, ...archiveEntries], {\n env: { ...process.env, COPYFILE_DISABLE: '1' },\n encoding: 'utf8',\n });\n if (tarResult.status !== 0) {\n throw new Error(\n `Failed to create policy bundle archive: ${tarResult.stderr.trim() || 'tar failed'}`,\n );\n }\n\n const compressedBytes = fs.readFileSync(outputPath);\n if (compressedBytes.byteLength > MAX_BUNDLE_COMPRESSED_BYTES) {\n fs.unlinkSync(outputPath);\n throw new Error(\n `Policy bundle exceeds the ${formatBytes(MAX_BUNDLE_COMPRESSED_BYTES)} compressed upload limit ` +\n `(bundle is ${formatBytes(compressedBytes.byteLength)}). ` +\n `The server also rejects decompressed bundles larger than ${formatBytes(MAX_BUNDLE_DECOMPRESSED_BYTES)}.`,\n );\n }\n\n const decompressedBytes = gunzipSync(compressedBytes);\n if (decompressedBytes.byteLength > MAX_BUNDLE_DECOMPRESSED_BYTES) {\n fs.unlinkSync(outputPath);\n throw new Error(\n `Policy bundle exceeds the ${formatBytes(MAX_BUNDLE_DECOMPRESSED_BYTES)} decompressed upload limit ` +\n `(bundle is ${formatBytes(decompressedBytes.byteLength)} decompressed).`,\n );\n }\n\n return outputPath;\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\n\n/** Fields for building a policy bundle upload form. */\nexport interface BuildPolicyBundleFormDataOptions {\n /** Absolute path to the bundle tarball */\n bundlePath: string;\n /** Version label */\n version: string;\n /** Optional description */\n description?: string;\n /** Bundle name (only for create) */\n bundleName?: string;\n}\n\n/**\n * Builds multipart form data for a policy bundle upload.\n *\n * @param options - Upload fields\n * @returns FormData ready for POST\n */\nexport function buildPolicyBundleFormData(options: BuildPolicyBundleFormDataOptions): FormData {\n const bundleBytes = fs.readFileSync(options.bundlePath);\n const form = new FormData();\n form.append(\n 'bundle',\n new Blob([bundleBytes], { type: 'application/gzip' }),\n path.basename(options.bundlePath),\n );\n form.append('version', options.version);\n if (options.description) {\n form.append('description', options.description);\n }\n if (options.bundleName) {\n form.append('bundleName', options.bundleName);\n }\n return form;\n}\n","/**\n * Formats a date as `yyyy-mm-dd-hh-mm-ss` in UTC.\n *\n * @param date - Date to format\n * @returns Timestamp label\n */\nfunction formatPolicyVersionTimestamp(date: Date): string {\n return date.toISOString().slice(0, 19).replace(/[T:]/g, '-');\n}\n\n/**\n * Returns a default version label from the bundle name and current UTC timestamp.\n *\n * @param bundleName - Tenant-unique policy bundle name\n * @param now - Current time (for testing)\n * @returns Version label in `{bundleName}-yyyy-mm-dd-hh-mm-ss` form\n */\nexport function defaultPolicyVersionLabel(bundleName: string, now: Date = new Date()): string {\n return `${bundleName}-${formatPolicyVersionTimestamp(now)}`;\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 { buildExampleCommand } from '../../../lib/docgen/buildExamples.js';\nimport { inquirerConfirmBoolean } from '../../../lib/helpers/inquirer.js';\nimport type { ActivateCommandFlags } from '../activate/impl.js';\nimport {\n buildPolicyBundleFormData,\n buildPolicyEngineClient,\n buildOpaBundleTarball,\n defaultPolicyVersionLabel,\n formatPolicyBundleVersionSummary,\n policyEngineRequest,\n printResult,\n resolveBundleIdByName,\n setPolicyEngineCliDebug,\n} from '../helpers/index.js';\nimport type { CreatePolicyBundleResponse, CreatePolicyBundleVersionResponse } from '../types.js';\n\n/** CLI flags for `transcend policy publish`. */\nexport interface PublishCommandFlags {\n /** Directory containing Rego policy files */\n dir: string;\n /** Tenant-unique bundle name */\n 'bundle-name': string;\n /** Transcend API key */\n auth: string;\n /** Transcend API URL */\n 'transcend-url': string;\n /** Version label (defaults to `{bundleName}-yyyy-mm-dd-hh-mm-ss`) */\n version?: string;\n /** Optional version description */\n description?: string;\n /** Print raw JSON response */\n json: boolean;\n /** Skip the \"create new bundle\" confirmation */\n yes: boolean;\n /** Include technical error details when a command fails */\n debug?: boolean;\n}\n\n/**\n * Build and upload a new immutable policy bundle version.\n *\n * @param this - CLI context\n * @param flags - Command flags\n */\nexport async function publish(\n this: LocalContext,\n {\n dir,\n 'bundle-name': bundleName,\n auth,\n 'transcend-url': transcendUrl,\n version,\n description,\n json,\n yes,\n debug = false,\n }: PublishCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n setPolicyEngineCliDebug(debug);\n\n const resolvedDir = path.resolve(dir);\n const versionLabel = version ?? defaultPolicyVersionLabel(bundleName);\n const client = buildPolicyEngineClient(transcendUrl, auth);\n\n let bundlePath: string | undefined;\n try {\n this.logger.info(colors.green(`Building policy bundle from ${resolvedDir}...`));\n bundlePath = await buildOpaBundleTarball(resolvedDir);\n\n const existingBundleId = await resolveBundleIdByName(client, bundleName);\n\n let responseBody: CreatePolicyBundleResponse | CreatePolicyBundleVersionResponse;\n\n if (existingBundleId) {\n this.logger.info(colors.green(`Uploading new version for bundle \"${bundleName}\"...`));\n const form = buildPolicyBundleFormData({\n bundlePath,\n version: versionLabel,\n description,\n });\n responseBody = await policyEngineRequest(\n client\n .post(`v1/policy-engine/policy-bundles/${existingBundleId}/versions`, { body: form })\n .json<CreatePolicyBundleVersionResponse>(),\n );\n } else {\n if (!this.process.stdin.isTTY && !yes) {\n this.logger.error(\n colors.red(\n 'Cannot create a new bundle in a non-interactive environment; pass --yes to confirm.',\n ),\n );\n this.process.exit(1);\n return;\n }\n\n if (!yes) {\n this.logger.warn(\n colors.yellow(`No policy bundle named \"${bundleName}\" exists for this organization.`),\n );\n const shouldCreate = await inquirerConfirmBoolean({\n message: `No policy bundle named \"${bundleName}\" exists. Create a new bundle and upload its first version?`,\n });\n if (!shouldCreate) {\n this.logger.info(colors.yellow('Publish cancelled.'));\n return;\n }\n }\n\n this.logger.info(\n colors.green(`Creating bundle \"${bundleName}\" and uploading first version...`),\n );\n const createForm = buildPolicyBundleFormData({\n bundlePath,\n version: versionLabel,\n description,\n bundleName,\n });\n responseBody = await policyEngineRequest(\n client\n .post('v1/policy-engine/policy-bundles', {\n body: createForm,\n })\n .json<CreatePolicyBundleResponse>(),\n );\n }\n\n printResult(this.process.stdout, {\n json,\n data: responseBody,\n renderTable: () => formatPolicyBundleVersionSummary(responseBody.version),\n });\n\n this.logger.info(colors.green('Policy bundle version uploaded successfully.'));\n\n const activateCommand = buildExampleCommand<ActivateCommandFlags>(['policy', 'activate'], {\n version: responseBody.version.version,\n 'bundle-name': bundleName,\n });\n this.logger.info(\n colors.yellow(\n `Publishing a policy does not activate it. To activate this version, run:\\n ${activateCommand}`,\n ),\n );\n } finally {\n if (bundlePath && this.fs.existsSync(bundlePath)) {\n this.fs.unlinkSync(bundlePath);\n }\n }\n}\n"],"mappings":"wsBAyBA,SAAS,EAAkC,EAA0C,CACnF,IAAM,EAAYA,EACf,KAAK,YAAa,CACjB,IAAK,EACL,UAAW,GACX,IAAK,GACN,CAAC,CACD,MAAM,CACH,EAAe,EAAK,KAAK,EAAK,gBAAgB,CAC9C,CAAE,wBAAyB,EAC/B,EAAG,WAAW,EAAa,CAAG,EAAG,aAAa,EAAc,OAAO,CAAG,IAAA,GACtE,EAAU,IAAK,IAAkB,CAC/B,KAAM,EACN,SA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,CAAC,CACF,EAAe,MAAM,EACnB,EACG,KAAK,kCAAmC,CACvC,KAAM,EACP,CAAC,CACD,MAAkC,CACtC,CAGH,EAAY,KAAK,QAAQ,OAAQ,CAC/B,OACA,KAAM,EACN,gBAAmB,EAAiC,EAAa,QAAQ,CAC1E,CAAC,CAEF,KAAK,OAAO,KAAK,EAAO,MAAM,+CAA+C,CAAC,CAE9E,IAAM,EAAkB,EAA0C,CAAC,SAAU,WAAW,CAAE,CACxF,QAAS,EAAa,QAAQ,QAC9B,cAAe,EAChB,CAAC,CACF,KAAK,OAAO,KACV,EAAO,OACL,+EAA+E,IAChF,CACF,QACO,CACJ,GAAc,KAAK,GAAG,WAAW,EAAW,EAC9C,KAAK,GAAG,WAAW,EAAW"}
|
package/dist/impl-DryC3OJu.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({pkg:a,input:o,bundle:s}){n(this.process),t();let c=r.resolve(o);if(!this.fs.existsSync(c))throw Error(`Input file not found: ${c}`);let l=[`eval`,`--format`,`pretty`,`--input`,c];s&&l.push(`-b`,r.resolve(s)),l.push(a),this.logger.info(i.green(`Evaluating ${a} with input ${c}...`));let u=await e(l);u!==0&&this.process.exit(u)}export{a as _eval};
|
|
2
|
-
//# sourceMappingURL=impl-DryC3OJu.mjs.map
|