@transcend-io/cli 11.0.0 → 12.1.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 +286 -130
- package/dist/app-CfJlhIn8.mjs +148 -0
- package/dist/app-CfJlhIn8.mjs.map +1 -0
- package/dist/{approvePrivacyRequests-C165wLBa.mjs → approvePrivacyRequests-BWj6SsgX.mjs} +2 -2
- package/dist/{approvePrivacyRequests-C165wLBa.mjs.map → approvePrivacyRequests-BWj6SsgX.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-1I3xKR1X.mjs +2 -0
- package/dist/buildExamples-1I3xKR1X.mjs.map +1 -0
- package/dist/{buildXdiSyncEndpoint-DeStnIit.mjs → buildXdiSyncEndpoint-CAal3Xc4.mjs} +2 -2
- package/dist/{buildXdiSyncEndpoint-DeStnIit.mjs.map → buildXdiSyncEndpoint-CAal3Xc4.mjs.map} +1 -1
- package/dist/{bulkRestartRequests-_Mu1rwZQ.mjs → bulkRestartRequests-B3wupylo.mjs} +2 -2
- package/dist/{bulkRestartRequests-_Mu1rwZQ.mjs.map → bulkRestartRequests-B3wupylo.mjs.map} +1 -1
- package/dist/{bulkRetryEnrichers-C2keTKuQ.mjs → bulkRetryEnrichers-D801tBcB.mjs} +2 -2
- package/dist/{bulkRetryEnrichers-C2keTKuQ.mjs.map → bulkRetryEnrichers-D801tBcB.mjs.map} +1 -1
- package/dist/{cancelPrivacyRequests-DwQr18Fk.mjs → cancelPrivacyRequests-CAKTZF47.mjs} +2 -2
- package/dist/{cancelPrivacyRequests-DwQr18Fk.mjs.map → cancelPrivacyRequests-CAKTZF47.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-BDQOL_MQ.mjs +9 -0
- package/dist/command-BDQOL_MQ.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-BlKpAm3R.mjs} +2 -2
- package/dist/{constants-Upxn_rQF.mjs.map → constants-BlKpAm3R.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-JBOW5UxY.mjs} +5 -5
- package/dist/{createPoolingCommandUi-CKH-24w5.mjs.map → createPoolingCommandUi-JBOW5UxY.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-Cf14MQR4.mjs +2 -0
- package/dist/{downloadPrivacyRequestFiles-D3bzcegH.mjs.map → downloadPrivacyRequestFiles-Cf14MQR4.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-CVdsJFOe.mjs} +2 -2
- package/dist/{generateCrossAccountApiKeys-DWfJtB3t.mjs.map → generateCrossAccountApiKeys-CVdsJFOe.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-2sYR_UFO.mjs} +2 -2
- package/dist/{impl-ByFyaZkK.mjs.map → impl-2sYR_UFO.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-B-Oe7DcE2.mjs +421 -0
- package/dist/impl-B-Oe7DcE2.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-BEA5cQOT2.mjs → impl-BD03bzB-.mjs} +2 -2
- package/dist/impl-BD03bzB-.mjs.map +1 -0
- package/dist/{impl-BpMQYnbR.mjs → impl-BGtup1F9.mjs} +2 -2
- package/dist/{impl-BpMQYnbR.mjs.map → impl-BGtup1F9.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-BQRP9NIv.mjs +2 -0
- package/dist/impl-BQRP9NIv.mjs.map +1 -0
- package/dist/{impl-BppXJ1AD2.mjs → impl-BQe6vddz.mjs} +2 -2
- package/dist/impl-BQe6vddz.mjs.map +1 -0
- package/dist/impl-BQj1Ien4.mjs +3 -0
- package/dist/impl-BQj1Ien4.mjs.map +1 -0
- package/dist/{impl-C_62Z4ED.mjs → impl-BRFL8xp7.mjs} +2 -2
- package/dist/{impl-C_62Z4ED.mjs.map → impl-BRFL8xp7.mjs.map} +1 -1
- package/dist/impl-BTvZxws5.mjs +2 -0
- package/dist/impl-BTvZxws5.mjs.map +1 -0
- package/dist/{impl-D94m3EPp.mjs → impl-BVcy_GYa.mjs} +2 -2
- package/dist/{impl-D94m3EPp.mjs.map → impl-BVcy_GYa.mjs.map} +1 -1
- package/dist/{impl-zRAjMVgz.mjs → impl-B_CRtRo8.mjs} +2 -2
- package/dist/{impl-zRAjMVgz.mjs.map → impl-B_CRtRo8.mjs.map} +1 -1
- package/dist/{impl-D4Ne3Vbg.mjs → impl-BgD7TeMD.mjs} +2 -2
- package/dist/{impl-D4Ne3Vbg.mjs.map → impl-BgD7TeMD.mjs.map} +1 -1
- package/dist/{impl-Cw0L2xEU.mjs → impl-BgkovGOz.mjs} +2 -2
- package/dist/{impl-Cw0L2xEU.mjs.map → impl-BgkovGOz.mjs.map} +1 -1
- package/dist/{impl-C9OmNI49.mjs → impl-Bh02zrTq.mjs} +2 -2
- package/dist/{impl-C9OmNI49.mjs.map → impl-Bh02zrTq.mjs.map} +1 -1
- package/dist/{impl-CiBT9-GH2.mjs → impl-BopWGXnH.mjs} +2 -2
- package/dist/impl-BopWGXnH.mjs.map +1 -0
- package/dist/impl-BpVe6fMe.mjs +3 -0
- package/dist/{impl--JGnR3wp.mjs.map → impl-BpVe6fMe.mjs.map} +1 -1
- package/dist/impl-BxvKe9_7.mjs +2 -0
- package/dist/impl-BxvKe9_7.mjs.map +1 -0
- package/dist/{impl-C8jjYvgu.mjs → impl-BzIyVAg_.mjs} +2 -2
- package/dist/{impl-C8jjYvgu.mjs.map → impl-BzIyVAg_.mjs.map} +1 -1
- package/dist/{impl-DXQHLpMw.mjs → impl-C-PvYlFE.mjs} +2 -2
- package/dist/{impl-DXQHLpMw.mjs.map → impl-C-PvYlFE.mjs.map} +1 -1
- package/dist/impl-C36c5NfN.mjs +2 -0
- package/dist/impl-C36c5NfN.mjs.map +1 -0
- package/dist/{impl-BhfxcCgN2.mjs → impl-CC-yFYWt.mjs} +2 -2
- package/dist/impl-CC-yFYWt.mjs.map +1 -0
- package/dist/{impl-lsmXIGSo2.mjs → impl-CFB_508q.mjs} +2 -2
- package/dist/impl-CFB_508q.mjs.map +1 -0
- package/dist/{impl-D2Q4nxUO.mjs → impl-CG3f4B6u.mjs} +2 -2
- package/dist/{impl-D2Q4nxUO.mjs.map → impl-CG3f4B6u.mjs.map} +1 -1
- package/dist/{impl-DaH1_ZzK.mjs → impl-CVUD-7mJ.mjs} +5 -5
- package/dist/{impl-DaH1_ZzK.mjs.map → impl-CVUD-7mJ.mjs.map} +1 -1
- package/dist/impl-CY8C-Fvj2.mjs +2 -0
- package/dist/impl-CY8C-Fvj2.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-Dqqb0lVN.mjs → impl-CoqCyj7e.mjs} +3 -3
- package/dist/{impl-Dqqb0lVN.mjs.map → impl-CoqCyj7e.mjs.map} +1 -1
- package/dist/{impl-CHUxKOz_.mjs → impl-Cq-GARM1.mjs} +2 -2
- package/dist/{impl-CHUxKOz_.mjs.map → impl-Cq-GARM1.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-Cvyc-iTI2.mjs +2 -0
- package/dist/impl-Cvyc-iTI2.mjs.map +1 -0
- package/dist/impl-CwBa15M42.mjs +3 -0
- package/dist/impl-CwBa15M42.mjs.map +1 -0
- package/dist/impl-D3gqip90.mjs +2 -0
- package/dist/impl-D3gqip90.mjs.map +1 -0
- package/dist/{impl-nz1MyjX22.mjs → impl-D6Lzwd-R2.mjs} +2 -2
- package/dist/{impl-nz1MyjX22.mjs.map → impl-D6Lzwd-R2.mjs.map} +1 -1
- package/dist/impl-DG-041kN.mjs +3 -0
- package/dist/impl-DG-041kN.mjs.map +1 -0
- package/dist/{impl-CD2R3L0v.mjs → impl-DTvnDByz.mjs} +2 -2
- package/dist/{impl-CD2R3L0v.mjs.map → impl-DTvnDByz.mjs.map} +1 -1
- package/dist/{impl-CTwyYUw3.mjs → impl-DUg1sDwg.mjs} +2 -2
- package/dist/{impl-CTwyYUw3.mjs.map → impl-DUg1sDwg.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-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-C2sSZ8qF.mjs → impl-DldrBJEa.mjs} +2 -2
- package/dist/{impl-C2sSZ8qF.mjs.map → impl-DldrBJEa.mjs.map} +1 -1
- package/dist/{impl-gs5wJ1BK.mjs → impl-Dmn1CWts.mjs} +3 -3
- package/dist/{impl-gs5wJ1BK.mjs.map → impl-Dmn1CWts.mjs.map} +1 -1
- package/dist/impl-Dr9Jezjh2.mjs +2 -0
- package/dist/impl-Dr9Jezjh2.mjs.map +1 -0
- package/dist/impl-DtTfsHtL.mjs +2 -0
- package/dist/impl-DtTfsHtL.mjs.map +1 -0
- package/dist/impl-DzNEfRoS2.mjs +4 -0
- package/dist/{impl-D-AHlqlD2.mjs.map → impl-DzNEfRoS2.mjs.map} +1 -1
- package/dist/{impl-a0BFtbna.mjs → impl-HnrcGt_T.mjs} +2 -2
- package/dist/{impl-a0BFtbna.mjs.map → impl-HnrcGt_T.mjs.map} +1 -1
- package/dist/{impl-B5df-igZ.mjs → impl-QdSegO65.mjs} +2 -2
- package/dist/{impl-B5df-igZ.mjs.map → impl-QdSegO65.mjs.map} +1 -1
- package/dist/{impl-BJyzyrZD.mjs → impl-S90NUBGm.mjs} +2 -2
- package/dist/{impl-BJyzyrZD.mjs.map → impl-S90NUBGm.mjs.map} +1 -1
- package/dist/impl-Tr08dgdk.mjs +2 -0
- package/dist/{impl-DQPmSYSE.mjs.map → impl-Tr08dgdk.mjs.map} +1 -1
- package/dist/{impl-CPSEzCc9.mjs → impl-WJBuS_0m.mjs} +2 -2
- package/dist/{impl-CPSEzCc9.mjs.map → impl-WJBuS_0m.mjs.map} +1 -1
- package/dist/impl-b4KAEVci.mjs +2 -0
- package/dist/{impl-GytUVAMP.mjs.map → impl-b4KAEVci.mjs.map} +1 -1
- package/dist/impl-defjX-97.mjs +3 -0
- package/dist/impl-defjX-97.mjs.map +1 -0
- package/dist/{impl-DhxDp4GN.mjs → impl-fg0UZYw6.mjs} +2 -2
- package/dist/{impl-DhxDp4GN.mjs.map → impl-fg0UZYw6.mjs.map} +1 -1
- package/dist/{impl-CzdUHruN.mjs → impl-hRK54juc.mjs} +2 -2
- package/dist/{impl-CzdUHruN.mjs.map → impl-hRK54juc.mjs.map} +1 -1
- package/dist/{impl-CSk_okwj.mjs → impl-mjDxMEDR.mjs} +2 -2
- package/dist/{impl-CSk_okwj.mjs.map → impl-mjDxMEDR.mjs.map} +1 -1
- package/dist/index.d.mts +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-C6lV_My-.mjs +2 -0
- package/dist/{markRequestDataSiloIdsCompleted-Br5gIS3S.mjs.map → markRequestDataSiloIdsCompleted-C6lV_My-.mjs.map} +1 -1
- package/dist/{markSilentPrivacyRequests-Cs_iZNJs.mjs → markSilentPrivacyRequests-D3bFOMLh.mjs} +2 -2
- package/dist/{markSilentPrivacyRequests-Cs_iZNJs.mjs.map → markSilentPrivacyRequests-D3bFOMLh.mjs.map} +1 -1
- package/dist/{mergeTranscendInputs-DFQcbh8b.mjs → mergeTranscendInputs-B7WjxYMN.mjs} +3 -3
- package/dist/{mergeTranscendInputs-DFQcbh8b.mjs.map → mergeTranscendInputs-B7WjxYMN.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-BGUxsWLN.mjs} +2 -2
- package/dist/{notifyPrivacyRequestsAdditionalTime-kPXTdjgT.mjs.map → notifyPrivacyRequestsAdditionalTime-BGUxsWLN.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-RgsjPnfI.mjs +7 -0
- package/dist/policy-bundle-manifest-RgsjPnfI.mjs.map +1 -0
- package/dist/policy-project-discovery-B4cFXUlA.mjs +430 -0
- package/dist/policy-project-discovery-B4cFXUlA.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-CwlygiTz.mjs +76 -0
- package/dist/policy-scaffold-config-CwlygiTz.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-Dmwv78e7.mjs +33 -0
- package/dist/printResult-Dmwv78e7.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-CNqQSSmF.mjs} +3 -3
- package/dist/{pullAllDatapoints-uk5ggk6O.mjs.map → pullAllDatapoints-CNqQSSmF.mjs.map} +1 -1
- package/dist/pullChunkedCustomSiloOutstandingIdentifiers-BfNNWqeI.mjs +2 -0
- package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-DbFFXAVM.mjs.map → pullChunkedCustomSiloOutstandingIdentifiers-BfNNWqeI.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-B_lWa6Yg.mjs +2 -0
- package/dist/{pullManualEnrichmentIdentifiersToCsv-D5is0Nrs.mjs.map → pullManualEnrichmentIdentifiersToCsv-B_lWa6Yg.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-CDhlEf6n.mjs} +2 -2
- package/dist/{pushCronIdentifiersFromCsv-Ctq38wAY.mjs.map → pushCronIdentifiersFromCsv-CDhlEf6n.mjs.map} +1 -1
- package/dist/pushManualEnrichmentIdentifiersFromCsv-Bn_028w5.mjs +2 -0
- package/dist/{pushManualEnrichmentIdentifiersFromCsv-0WHf6d_m.mjs.map → pushManualEnrichmentIdentifiersFromCsv-Bn_028w5.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-DcI9ut4q.mjs} +2 -2
- package/dist/{removeUnverifiedRequestIdentifiers-Do3Pus6m.mjs.map → removeUnverifiedRequestIdentifiers-DcI9ut4q.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-BPrMkU0w.mjs +2 -0
- package/dist/resolveBundleIdByName-BPrMkU0w.mjs.map +1 -0
- package/dist/resolvePolicyBundleVersion-BrVz4LKN.mjs +2 -0
- package/dist/resolvePolicyBundleVersion-BrVz4LKN.mjs.map +1 -0
- package/dist/{retryRequestDataSilos-CEgUW6Fx.mjs → retryRequestDataSilos-ZdY2PM0S.mjs} +2 -2
- package/dist/{retryRequestDataSilos-CEgUW6Fx.mjs.map → retryRequestDataSilos-ZdY2PM0S.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-KdcSw8Td.mjs} +2 -2
- package/dist/{skipPreflightJobs-D_1mZ9mr.mjs.map → skipPreflightJobs-KdcSw8Td.mjs.map} +1 -1
- package/dist/{skipRequestDataSilos-CcGl9Z8M.mjs → skipRequestDataSilos-Cy2NfP47.mjs} +2 -2
- package/dist/{skipRequestDataSilos-CcGl9Z8M.mjs.map → skipRequestDataSilos-Cy2NfP47.mjs.map} +1 -1
- package/dist/{streamPrivacyRequestsToCsv-1l8RAcnK.mjs → streamPrivacyRequestsToCsv-ByRBG8Mb.mjs} +2 -2
- package/dist/{streamPrivacyRequestsToCsv-1l8RAcnK.mjs.map → streamPrivacyRequestsToCsv-ByRBG8Mb.mjs.map} +1 -1
- package/dist/{syncCodePackages-BHE2Tn1Q.mjs → syncCodePackages-DJnrcX5l.mjs} +2 -2
- package/dist/{syncCodePackages-BHE2Tn1Q.mjs.map → syncCodePackages-DJnrcX5l.mjs.map} +1 -1
- package/dist/updateConsentManagerVersionToLatest-KwMaAkwh.mjs +2 -0
- package/dist/{updateConsentManagerVersionToLatest-yZhBDcv8.mjs.map → updateConsentManagerVersionToLatest-KwMaAkwh.mjs.map} +1 -1
- package/dist/{uploadConsents-DQqApEaH.mjs → uploadConsents-C5LmI-9T.mjs} +2 -2
- package/dist/{uploadConsents-DQqApEaH.mjs.map → uploadConsents-C5LmI-9T.mjs.map} +1 -1
- package/dist/{uploadPrivacyRequestsFromCsv-ntuK0eSR.mjs → uploadPrivacyRequestsFromCsv-BsYnCgbl.mjs} +2 -2
- package/dist/{uploadPrivacyRequestsFromCsv-ntuK0eSR.mjs.map → uploadPrivacyRequestsFromCsv-BsYnCgbl.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 +8 -7
- package/dist/app-DhG-JhT3.mjs +0 -148
- package/dist/app-DhG-JhT3.mjs.map +0 -1
- package/dist/buildExamples-DOopJFYY.mjs +0 -2
- package/dist/buildExamples-DOopJFYY.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/downloadPrivacyRequestFiles-D3bzcegH.mjs +0 -2
- 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/markRequestDataSiloIdsCompleted-Br5gIS3S.mjs +0 -2
- 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 +0 -33
- 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/pullChunkedCustomSiloOutstandingIdentifiers-DbFFXAVM.mjs +0 -2
- package/dist/pullManualEnrichmentIdentifiersToCsv-D5is0Nrs.mjs +0 -2
- package/dist/pushManualEnrichmentIdentifiersFromCsv-0WHf6d_m.mjs +0 -2
- package/dist/resolveBundleIdByName-qXZBrUz_.mjs +0 -2
- package/dist/resolveBundleIdByName-qXZBrUz_.mjs.map +0 -1
- package/dist/resolvePolicyBundleVersion-BG7XqBBP.mjs +0 -2
- package/dist/resolvePolicyBundleVersion-BG7XqBBP.mjs.map +0 -1
- package/dist/scaffold-model-BAbYTR0q.mjs.map +0 -1
- package/dist/updateConsentManagerVersionToLatest-yZhBDcv8.mjs +0 -2
- package/dist/validateTranscendAuth-D6Wr1cxY.mjs +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl-D94m3EPp.mjs","names":[],"sources":["../src/commands/inventory/push/impl.ts"],"sourcesContent":["import path from 'node:path';\n\nimport { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport { mapSeries } from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport { TranscendInput } from '../../../codecs.js';\nimport { ADMIN_DASH_INTEGRATIONS } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { validateTranscendAuth, filterFileNames } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { syncConfigurationToTranscend } from '../../../lib/graphql/index.js';\nimport { parseVariablesFromString } from '../../../lib/helpers/parseVariablesFromString.js';\nimport { mergeTranscendInputs } from '../../../lib/mergeTranscendInputs.js';\nimport { parseTranscendYaml } from '../../../lib/readTranscendYaml.js';\n\n/**\n * Sync configuration to Transcend\n *\n * @param options - Options\n * @returns True if synced successfully, false if error occurs\n */\nasync function syncConfiguration({\n transcendUrl,\n auth,\n pageSize,\n publishToPrivacyCenter,\n contents,\n deleteExtraAttributeValues = false,\n classifyService = false,\n logger,\n}: {\n /** Transcend YAML */\n contents: TranscendInput;\n /** Transcend URL */\n transcendUrl: string;\n /** API key */\n auth: string;\n /** Page size */\n pageSize: number;\n /** Skip privacy center publish step */\n publishToPrivacyCenter: boolean;\n /** classify data flow service if missing */\n classifyService?: boolean;\n /** Delete attributes when syncing */\n deleteExtraAttributeValues?: boolean;\n /** Logger for reporting sync progress and errors */\n logger: LocalContext['logger'];\n}): Promise<boolean> {\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Sync to Transcend\n try {\n const result = await syncConfigurationToTranscend(contents, client, {\n pageSize,\n publishToPrivacyCenter,\n classifyService,\n deleteExtraAttributeValues,\n logger,\n });\n if (!result.success) {\n result.errors.forEach(({ resource, item, message }) => {\n logger.error(\n colors.red(`Failed to sync ${resource}${item ? ` \"${item}\"` : ''}: ${message}`),\n );\n });\n }\n return result.success;\n } catch (err) {\n logger.error(colors.red(`An unexpected error occurred syncing the schema: ${err.message}`));\n return false;\n }\n}\n\nexport interface PushCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n pageSize: number;\n variables: string;\n publishToPrivacyCenter: boolean;\n classifyService: boolean;\n deleteExtraAttributeValues: boolean;\n}\n\nexport async function push(\n this: LocalContext,\n {\n file = './transcend.yml',\n transcendUrl,\n auth,\n variables,\n pageSize,\n publishToPrivacyCenter,\n classifyService,\n deleteExtraAttributeValues,\n }: PushCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth, this);\n\n const vars = parseVariablesFromString(variables);\n\n // check if we are being passed a list of API keys and a list of files\n let fileList: string[];\n if (Array.isArray(apiKeyOrList) && this.fs.lstatSync(file).isDirectory()) {\n fileList = filterFileNames(this.fs.readdirSync(file)).map((filePath) =>\n path.join(file, filePath),\n );\n } else {\n fileList = file.split(',');\n }\n\n // Ensure at least one file is parsed\n if (fileList.length < 1) {\n throw new Error('No file specified!');\n }\n\n // eslint-disable-next-line array-callback-return,consistent-return\n const transcendInputs = fileList.map((filePath) => {\n // Ensure yaml file exists on disk\n if (!this.fs.existsSync(filePath)) {\n this.logger.error(\n colors.red(\n `The file path does not exist on disk: ${filePath}. You can specify the filepath using --file=./examples/transcend.yml`,\n ),\n );\n this.process.exit(1);\n } else {\n this.logger.info(colors.magenta(`Reading file \"${filePath}\"...`));\n }\n\n try {\n // Read in the yaml file and validate it's shape\n const newContents = parseTranscendYaml(\n this.fs.readFileSync(filePath, 'utf8'),\n vars,\n filePath,\n );\n this.logger.info(colors.green(`Successfully read in \"${filePath}\"`));\n return {\n content: newContents,\n name: filePath.split('/').pop()!.replace('.yml', ''),\n };\n } catch (err) {\n this.logger.error(\n colors.red(\n `The shape of your yaml file is invalid with the following errors: ${err.message}`,\n ),\n );\n this.process.exit(1);\n }\n });\n\n // process a single API key\n if (typeof apiKeyOrList === 'string') {\n // if passed multiple inputs, merge them together\n const [base, ...rest] = transcendInputs.map(({ content }) => content);\n const contents = mergeTranscendInputs(base, ...rest);\n\n // sync the configuration\n const success = await syncConfiguration({\n transcendUrl,\n auth: apiKeyOrList,\n contents,\n publishToPrivacyCenter,\n deleteExtraAttributeValues,\n pageSize,\n classifyService: !!classifyService,\n logger: this.logger,\n });\n\n // exist with error code\n if (!success) {\n this.logger.info(\n colors.red(\n `Sync encountered errors. View output above for more information, or check out ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n\n this.process.exit(1);\n }\n } else {\n // if passed multiple inputs, expect them to be one per instance\n if (transcendInputs.length !== 1 && transcendInputs.length !== apiKeyOrList.length) {\n throw new Error(\n 'Expected list of yml files to be equal to the list of API keys.' +\n `Got ${transcendInputs.length} YML file${\n transcendInputs.length === 1 ? '' : 's'\n } and ${apiKeyOrList.length} API key${apiKeyOrList.length === 1 ? '' : 's'}`,\n );\n }\n\n const encounteredErrors: string[] = [];\n await mapSeries(apiKeyOrList, async (apiKey, ind) => {\n const prefix = `[${ind + 1}/${apiKeyOrList.length}][${apiKey.organizationName}] `;\n this.logger.info(\n colors.magenta(`~~~\\n\\n${prefix}Attempting to push configuration...\\n\\n~~~`),\n );\n\n // use the merged contents if 1 yml passed, else use the contents that map to that organization\n const useContents =\n transcendInputs.length === 1\n ? transcendInputs[0].content\n : transcendInputs.find((input) => input.name === apiKey.organizationName)?.content;\n\n // Throw error if cannot find a yml file matching that organization name\n if (!useContents) {\n this.logger.error(\n colors.red(\n `${prefix}Failed to find transcend.yml file for organization: \"${apiKey.organizationName}\".`,\n ),\n );\n encounteredErrors.push(apiKey.organizationName);\n return;\n }\n\n const success = await syncConfiguration({\n transcendUrl,\n auth: apiKey.apiKey,\n contents: useContents,\n pageSize,\n publishToPrivacyCenter,\n deleteExtraAttributeValues,\n classifyService,\n logger: this.logger,\n });\n\n if (success) {\n this.logger.info(colors.green(`${prefix}Successfully pushed configuration!`));\n } else {\n this.logger.error(colors.red(`${prefix}Failed to sync configuration.`));\n encounteredErrors.push(apiKey.organizationName);\n }\n });\n\n if (encounteredErrors.length > 0) {\n this.logger.info(\n colors.red(\n `Sync encountered errors for \"${encounteredErrors.join(\n ',',\n )}\". View output above for more information, or check out ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n\n this.process.exit(1);\n }\n }\n\n // Indicate success\n this.logger.info(\n colors.green(`Successfully synced yaml file to Transcend! View at ${ADMIN_DASH_INTEGRATIONS}`),\n );\n}\n"],"mappings":"shBAsBA,eAAe,EAAkB,CAC/B,eACA,OACA,WACA,yBACA,WACA,6BAA6B,GAC7B,kBAAkB,GAClB,UAkBmB,CACnB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAG9D,GAAI,CACF,IAAM,EAAS,MAAM,EAA6B,EAAU,EAAQ,CAClE,WACA,yBACA,kBACA,6BACA,SACD,CAAC,CAQF,OAPK,EAAO,SACV,EAAO,OAAO,SAAS,CAAE,WAAU,OAAM,aAAc,CACrD,EAAO,MACL,EAAO,IAAI,kBAAkB,IAAW,EAAO,KAAK,EAAK,GAAK,GAAG,IAAI,IAAU,CAChF,EACD,CAEG,EAAO,cACP,EAAK,CAEZ,OADA,EAAO,MAAM,EAAO,IAAI,oDAAoD,EAAI,UAAU,CAAC,CACpF,IAeX,eAAsB,EAEpB,CACE,OAAO,kBACP,eACA,OACA,YACA,WACA,yBACA,kBACA,8BAEa,CACf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Content":["import path from 'node:path';\n\nimport { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport { mapSeries } from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport { TranscendInput } from '../../../codecs.js';\nimport { ADMIN_DASH_INTEGRATIONS } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { validateTranscendAuth, filterFileNames } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { syncConfigurationToTranscend } from '../../../lib/graphql/index.js';\nimport { parseVariablesFromString } from '../../../lib/helpers/parseVariablesFromString.js';\nimport { mergeTranscendInputs } from '../../../lib/mergeTranscendInputs.js';\nimport { parseTranscendYaml } from '../../../lib/readTranscendYaml.js';\n\n/**\n * Sync configuration to Transcend\n *\n * @param options - Options\n * @returns True if synced successfully, false if error occurs\n */\nasync function syncConfiguration({\n transcendUrl,\n auth,\n pageSize,\n publishToPrivacyCenter,\n contents,\n deleteExtraAttributeValues = false,\n classifyService = false,\n logger,\n}: {\n /** Transcend YAML */\n contents: TranscendInput;\n /** Transcend URL */\n transcendUrl: string;\n /** API key */\n auth: string;\n /** Page size */\n pageSize: number;\n /** Skip privacy center publish step */\n publishToPrivacyCenter: boolean;\n /** classify data flow service if missing */\n classifyService?: boolean;\n /** Delete attributes when syncing */\n deleteExtraAttributeValues?: boolean;\n /** Logger for reporting sync progress and errors */\n logger: LocalContext['logger'];\n}): Promise<boolean> {\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Sync to Transcend\n try {\n const result = await syncConfigurationToTranscend(contents, client, {\n pageSize,\n publishToPrivacyCenter,\n classifyService,\n deleteExtraAttributeValues,\n logger,\n });\n if (!result.success) {\n result.errors.forEach(({ resource, item, message }) => {\n logger.error(\n colors.red(`Failed to sync ${resource}${item ? ` \"${item}\"` : ''}: ${message}`),\n );\n });\n }\n return result.success;\n } catch (err) {\n logger.error(colors.red(`An unexpected error occurred syncing the schema: ${err.message}`));\n return false;\n }\n}\n\nexport interface PushCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n pageSize: number;\n variables: string;\n publishToPrivacyCenter: boolean;\n classifyService: boolean;\n deleteExtraAttributeValues: boolean;\n}\n\nexport async function push(\n this: LocalContext,\n {\n file = './transcend.yml',\n transcendUrl,\n auth,\n variables,\n pageSize,\n publishToPrivacyCenter,\n classifyService,\n deleteExtraAttributeValues,\n }: PushCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth, this);\n\n const vars = parseVariablesFromString(variables);\n\n // check if we are being passed a list of API keys and a list of files\n let fileList: string[];\n if (Array.isArray(apiKeyOrList) && this.fs.lstatSync(file).isDirectory()) {\n fileList = filterFileNames(this.fs.readdirSync(file)).map((filePath) =>\n path.join(file, filePath),\n );\n } else {\n fileList = file.split(',');\n }\n\n // Ensure at least one file is parsed\n if (fileList.length < 1) {\n throw new Error('No file specified!');\n }\n\n // eslint-disable-next-line array-callback-return,consistent-return\n const transcendInputs = fileList.map((filePath) => {\n // Ensure yaml file exists on disk\n if (!this.fs.existsSync(filePath)) {\n this.logger.error(\n colors.red(\n `The file path does not exist on disk: ${filePath}. You can specify the filepath using --file=./examples/transcend.yml`,\n ),\n );\n this.process.exit(1);\n } else {\n this.logger.info(colors.magenta(`Reading file \"${filePath}\"...`));\n }\n\n try {\n // Read in the yaml file and validate it's shape\n const newContents = parseTranscendYaml(\n this.fs.readFileSync(filePath, 'utf8'),\n vars,\n filePath,\n );\n this.logger.info(colors.green(`Successfully read in \"${filePath}\"`));\n return {\n content: newContents,\n name: filePath.split('/').pop()!.replace('.yml', ''),\n };\n } catch (err) {\n this.logger.error(\n colors.red(\n `The shape of your yaml file is invalid with the following errors: ${err.message}`,\n ),\n );\n this.process.exit(1);\n }\n });\n\n // process a single API key\n if (typeof apiKeyOrList === 'string') {\n // if passed multiple inputs, merge them together\n const [base, ...rest] = transcendInputs.map(({ content }) => content);\n const contents = mergeTranscendInputs(base, ...rest);\n\n // sync the configuration\n const success = await syncConfiguration({\n transcendUrl,\n auth: apiKeyOrList,\n contents,\n publishToPrivacyCenter,\n deleteExtraAttributeValues,\n pageSize,\n classifyService: !!classifyService,\n logger: this.logger,\n });\n\n // exist with error code\n if (!success) {\n this.logger.info(\n colors.red(\n `Sync encountered errors. View output above for more information, or check out ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n\n this.process.exit(1);\n }\n } else {\n // if passed multiple inputs, expect them to be one per instance\n if (transcendInputs.length !== 1 && transcendInputs.length !== apiKeyOrList.length) {\n throw new Error(\n 'Expected list of yml files to be equal to the list of API keys.' +\n `Got ${transcendInputs.length} YML file${\n transcendInputs.length === 1 ? '' : 's'\n } and ${apiKeyOrList.length} API key${apiKeyOrList.length === 1 ? '' : 's'}`,\n );\n }\n\n const encounteredErrors: string[] = [];\n await mapSeries(apiKeyOrList, async (apiKey, ind) => {\n const prefix = `[${ind + 1}/${apiKeyOrList.length}][${apiKey.organizationName}] `;\n this.logger.info(\n colors.magenta(`~~~\\n\\n${prefix}Attempting to push configuration...\\n\\n~~~`),\n );\n\n // use the merged contents if 1 yml passed, else use the contents that map to that organization\n const useContents =\n transcendInputs.length === 1\n ? transcendInputs[0].content\n : transcendInputs.find((input) => input.name === apiKey.organizationName)?.content;\n\n // Throw error if cannot find a yml file matching that organization name\n if (!useContents) {\n this.logger.error(\n colors.red(\n `${prefix}Failed to find transcend.yml file for organization: \"${apiKey.organizationName}\".`,\n ),\n );\n encounteredErrors.push(apiKey.organizationName);\n return;\n }\n\n const success = await syncConfiguration({\n transcendUrl,\n auth: apiKey.apiKey,\n contents: useContents,\n pageSize,\n publishToPrivacyCenter,\n deleteExtraAttributeValues,\n classifyService,\n logger: this.logger,\n });\n\n if (success) {\n this.logger.info(colors.green(`${prefix}Successfully pushed configuration!`));\n } else {\n this.logger.error(colors.red(`${prefix}Failed to sync configuration.`));\n encounteredErrors.push(apiKey.organizationName);\n }\n });\n\n if (encounteredErrors.length > 0) {\n this.logger.info(\n colors.red(\n `Sync encountered errors for \"${encounteredErrors.join(\n ',',\n )}\". View output above for more information, or check out ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n\n this.process.exit(1);\n }\n }\n\n // Indicate success\n this.logger.info(\n colors.green(`Successfully synced yaml file to Transcend! View at ${ADMIN_DASH_INTEGRATIONS}`),\n );\n}\n"],"mappings":"shBAsBA,eAAe,EAAkB,CAC/B,eACA,OACA,WACA,yBACA,WACA,6BAA6B,GAC7B,kBAAkB,GAClB,UAkBmB,CACnB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAG9D,GAAI,CACF,IAAM,EAAS,MAAM,EAA6B,EAAU,EAAQ,CAClE,WACA,yBACA,kBACA,6BACA,SACD,CAAC,CAQF,OAPK,EAAO,SACV,EAAO,OAAO,SAAS,CAAE,WAAU,OAAM,aAAc,CACrD,EAAO,MACL,EAAO,IAAI,kBAAkB,IAAW,EAAO,KAAK,EAAK,GAAK,GAAG,IAAI,IAAU,CAChF,EACD,CAEG,EAAO,cACP,EAAK,CAEZ,OADA,EAAO,MAAM,EAAO,IAAI,oDAAoD,EAAI,UAAU,CAAC,CACpF,IAeX,eAAsB,EAEpB,CACE,OAAO,kBACP,eACA,OACA,YACA,WACA,yBACA,kBACA,8BAEa,CACf,EAAoB,KAAK,QAAQ,CAGjC,IAAM,EAAe,MAAM,EAAsB,EAAM,KAAK,CAEtD,EAAO,EAAyB,EAAU,CAG5C,EAUJ,GATA,AAKE,EALE,MAAM,QAAQ,EAAa,EAAI,KAAK,GAAG,UAAU,EAAK,CAAC,aAAa,CAC3D,EAAgB,KAAK,GAAG,YAAY,EAAK,CAAC,CAAC,IAAK,GACzD,EAAK,KAAK,EAAM,EAAS,CAC1B,CAEU,EAAK,MAAM,IAAI,CAIxB,EAAS,OAAS,EACpB,MAAU,MAAM,qBAAqB,CAIvC,IAAM,EAAkB,EAAS,IAAK,GAAa,CAE5C,KAAK,GAAG,WAAW,EAAS,CAQ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E,CAGD,IAAM,EACJ,EAAgB,SAAW,EACvB,EAAgB,GAAG,QACnB,EAAgB,KAAM,GAAU,EAAM,OAAS,EAAO,iBAAiB,EAAE,QAG/E,GAAI,CAAC,EAAa,CAChB,KAAK,OAAO,MACV,EAAO,IACL,GAAG,EAAO,uDAAuD,EAAO,iBAAiB,IAC1F,CACF,CACD,EAAkB,KAAK,EAAO,iBAAiB,CAC/C,OAcE,MAXkB,EAAkB,CACtC,eACA,KAAM,EAAO,OACb,SAAU,EACV,WACA,yBACA,6BACA,kBACA,OAAQ,KAAK,OACd,CAAC,CAGA,KAAK,OAAO,KAAK,EAAO,MAAM,GAAG,EAAO,oCAAoC,CAAC,EAE7E,KAAK,OAAO,MAAM,EAAO,IAAI,GAAG,EAAO,+BAA+B,CAAC,CACvE,EAAkB,KAAK,EAAO,iBAAiB,GAEjD,CAEE,EAAkB,OAAS,IAC7B,KAAK,OAAO,KACV,EAAO,IACL,gCAAgC,EAAkB,KAChD,IACD,CAAC,0DAA0D,IAC7D,CACF,CAED,KAAK,QAAQ,KAAK,EAAE,EAKxB,KAAK,OAAO,KACV,EAAO,MAAM,uDAAuD,IAA0B,CAC/F"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./updateConsentManagerVersionToLatest-
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
import{t as e}from"./updateConsentManagerVersionToLatest-KwMaAkwh.mjs";import{t}from"./validateTranscendAuth-D-dDINof.mjs";import{t as n}from"./done-input-validation-LiTaCEzF.mjs";import{ConsentBundleType as r}from"@transcend-io/privacy-types";import i from"colors";import{mapSeries as a}from"@transcend-io/utils";async function o({auth:o,bundleTypes:s=[r.Production,r.Test],deploy:c,transcendUrl:l}){n(this.process);let u=await t(o,this);typeof u==`string`?(await e({deploy:c,transcendUrl:l,auth:u,bundleTypes:s}),this.logger.info(i.green(`Successfully updated Consent Manager!`))):(await a(u,async t=>{this.logger.info(i.magenta(`Updating Consent Manager for organization "${t.organizationName}"...`)),await e({deploy:c,transcendUrl:l,auth:t.apiKey,bundleTypes:s}),this.logger.info(i.green(`Successfully updated Consent Manager for organization "${t.organizationName}"!`))}),this.logger.info(i.green(`Successfully updated Consent Managers!`)))}export{o as updateConsentManager};
|
|
2
|
+
//# sourceMappingURL=impl-B_CRtRo8.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl-
|
|
1
|
+
{"version":3,"file":"impl-B_CRtRo8.mjs","names":[],"sources":["../src/commands/consent/update-consent-manager/impl.ts"],"sourcesContent":["import { ConsentBundleType } from '@transcend-io/privacy-types';\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 { updateConsentManagerVersionToLatest } from '../../../lib/consent-manager/index.js';\n\nexport interface UpdateConsentManagerCommandFlags {\n auth: string;\n bundleTypes: ConsentBundleType[];\n deploy: boolean;\n transcendUrl: string;\n}\n\nexport async function updateConsentManager(\n this: LocalContext,\n {\n auth,\n bundleTypes = [ConsentBundleType.Production, ConsentBundleType.Test],\n deploy,\n transcendUrl,\n }: UpdateConsentManagerCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth, this);\n\n // Handle single update\n if (typeof apiKeyOrList === 'string') {\n // Update consent manager\n await updateConsentManagerVersionToLatest({\n deploy,\n transcendUrl,\n auth: apiKeyOrList,\n bundleTypes,\n });\n this.logger.info(colors.green('Successfully updated Consent Manager!'));\n } else {\n await mapSeries(apiKeyOrList, async (apiKey) => {\n this.logger.info(\n colors.magenta(`Updating Consent Manager for organization \"${apiKey.organizationName}\"...`),\n );\n\n await updateConsentManagerVersionToLatest({\n deploy,\n transcendUrl,\n auth: apiKey.apiKey,\n bundleTypes,\n });\n\n this.logger.info(\n colors.green(\n `Successfully updated Consent Manager for organization \"${apiKey.organizationName}\"!`,\n ),\n );\n });\n this.logger.info(colors.green('Successfully updated Consent Managers!'));\n }\n}\n"],"mappings":"0TAgBA,eAAsB,EAEpB,CACE,OACA,cAAc,CAAC,EAAkB,WAAY,EAAkB,KAAK,CACpE,SACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,CAGjC,IAAM,EAAe,MAAM,EAAsB,EAAM,KAAK,CAGxD,OAAO,GAAiB,UAE1B,MAAM,EAAoC,CACxC,SACA,eACA,KAAM,EACN,cACD,CAAC,CACF,KAAK,OAAO,KAAK,EAAO,MAAM,wCAAwC,CAAC,GAEvE,MAAM,EAAU,EAAc,KAAO,IAAW,CAC9C,KAAK,OAAO,KACV,EAAO,QAAQ,8CAA8C,EAAO,iBAAiB,MAAM,CAC5F,CAED,MAAM,EAAoC,CACxC,SACA,eACA,KAAM,EAAO,OACb,cACD,CAAC,CAEF,KAAK,OAAO,KACV,EAAO,MACL,0DAA0D,EAAO,iBAAiB,IACnF,CACF,EACD,CACF,KAAK,OAAO,KAAK,EAAO,MAAM,yCAAyC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e}from"./enums-OiLcZ26O.mjs";import{r as t}from"./constants-
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
import{i as e}from"./enums-OiLcZ26O.mjs";import{r as t}from"./constants-BlKpAm3R.mjs";import{n,t as r}from"./command-BDQOL_MQ.mjs";import{o as i}from"./readTranscendYaml-BfqQbPiT.mjs";import{n as a}from"./pullTranscendConfiguration-CDUDqxpm.mjs";import{t as o}from"./validateTranscendAuth-D-dDINof.mjs";import{t as s}from"./done-input-validation-LiTaCEzF.mjs";import c from"node:path";import l from"colors";import{mapSeries as u}from"@transcend-io/utils";import{buildTranscendGraphQLClient as d}from"@transcend-io/sdk";async function f({auth:f,resources:p=n,file:m,transcendUrl:h,dataSiloIds:g=[],integrationNames:_=[],trackerStatuses:v=r,pageSize:y,skipDatapoints:b,skipSubDatapoints:x,includeGuessedCategories:S,debug:C}){s(this.process);let w=await o(f,this),T=p.includes(`all`)?Object.values(e):p;if(typeof w==`string`){try{let e=await a(d(h,w),{dataSiloIds:g,integrationNames:_,resources:T,pageSize:y,debug:C,skipDatapoints:b,skipSubDatapoints:x,includeGuessedCategories:S,trackerStatuses:v});this.logger.info(l.magenta(`Writing configuration to file "${m}"...`)),this.fs.writeFileSync(m,i(e))}catch(e){this.logger.error(l.red(`An error occurred syncing the schema: ${C?e.stack:e.message}`)),this.process.exit(1)}this.logger.info(l.green(`Successfully synced yaml file to disk at ${m}! View at ${t}`))}else{if(!this.fs.lstatSync(m).isDirectory())throw Error(`File is expected to be a folder when passing in a list of API keys to pull from. e.g. --file=./working/`);let e=[];await u(w,async(t,n)=>{let r=`[${n+1}/${w.length}][${t.organizationName}] `;this.logger.info(l.magenta(`~~~\n\n${r}Attempting to pull configuration...\n\n~~~`));let o=d(h,t.apiKey);try{let e=await a(o,{dataSiloIds:g,integrationNames:_,resources:T,pageSize:y,debug:C,skipDatapoints:b,skipSubDatapoints:x,includeGuessedCategories:S,trackerStatuses:v}),n=c.join(m,`${t.organizationName}.yml`);this.logger.info(l.magenta(`Writing configuration to file "${n}"...`)),this.fs.writeFileSync(n,i(e)),this.logger.info(l.green(`${r}Successfully pulled configuration!`))}catch(n){this.logger.error(l.red(`${r}Failed to sync configuration. - ${n.message}`)),e.push(t.organizationName)}}),e.length>0&&(this.logger.info(l.red(`Sync encountered errors for "${e.join(`,`)}". View output above for more information, or check out ${t}`)),this.process.exit(1))}}export{f as pull};
|
|
2
|
+
//# sourceMappingURL=impl-BgD7TeMD.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl-
|
|
1
|
+
{"version":3,"file":"impl-BgD7TeMD.mjs","names":[],"sources":["../src/commands/inventory/pull/impl.ts"],"sourcesContent":["import path from 'node:path';\n\nimport { ConsentTrackerStatus } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport { mapSeries } from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport { ADMIN_DASH_INTEGRATIONS } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { TranscendPullResource } from '../../../enums.js';\nimport { validateTranscendAuth } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { pullTranscendConfiguration } from '../../../lib/graphql/index.js';\nimport { serializeTranscendYaml } from '../../../lib/readTranscendYaml.js';\nimport { DEFAULT_CONSENT_TRACKER_STATUSES, DEFAULT_TRANSCEND_PULL_RESOURCES } from './command.js';\n\nexport interface PullCommandFlags {\n auth: string;\n resources?: (TranscendPullResource | 'all')[];\n file: string;\n transcendUrl: string;\n dataSiloIds?: string[];\n integrationNames?: string[];\n trackerStatuses?: ConsentTrackerStatus[];\n pageSize: number;\n skipDatapoints: boolean;\n skipSubDatapoints: boolean;\n includeGuessedCategories: boolean;\n debug: boolean;\n}\n\nexport async function pull(\n this: LocalContext,\n {\n auth,\n resources = DEFAULT_TRANSCEND_PULL_RESOURCES,\n file,\n transcendUrl,\n dataSiloIds = [],\n integrationNames = [],\n trackerStatuses = DEFAULT_CONSENT_TRACKER_STATUSES,\n pageSize,\n skipDatapoints,\n skipSubDatapoints,\n includeGuessedCategories,\n debug,\n }: PullCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth, this);\n\n const resourcesToPull: TranscendPullResource[] = resources.includes('all')\n ? Object.values(TranscendPullResource)\n : (resources as TranscendPullResource[]);\n\n // Sync to Disk\n if (typeof apiKeyOrList === 'string') {\n try {\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, apiKeyOrList);\n\n const configuration = await pullTranscendConfiguration(client, {\n dataSiloIds,\n integrationNames,\n resources: resourcesToPull,\n pageSize,\n debug,\n skipDatapoints,\n skipSubDatapoints,\n includeGuessedCategories,\n trackerStatuses,\n });\n\n this.logger.info(colors.magenta(`Writing configuration to file \"${file}\"...`));\n this.fs.writeFileSync(file, serializeTranscendYaml(configuration));\n } catch (err) {\n this.logger.error(\n colors.red(`An error occurred syncing the schema: ${debug ? err.stack : err.message}`),\n );\n this.process.exit(1);\n }\n\n // Indicate success\n this.logger.info(\n colors.green(\n `Successfully synced yaml file to disk at ${file}! View at ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n } else {\n if (!this.fs.lstatSync(file).isDirectory()) {\n throw new Error(\n 'File is expected to be a folder when passing in a list of API keys to pull from. e.g. --file=./working/',\n );\n }\n\n const encounteredErrors: string[] = [];\n await mapSeries(apiKeyOrList, async (apiKey, ind) => {\n const prefix = `[${ind + 1}/${apiKeyOrList.length}][${apiKey.organizationName}] `;\n this.logger.info(\n colors.magenta(`~~~\\n\\n${prefix}Attempting to pull configuration...\\n\\n~~~`),\n );\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, apiKey.apiKey);\n\n try {\n const configuration = await pullTranscendConfiguration(client, {\n dataSiloIds,\n integrationNames,\n resources: resourcesToPull,\n pageSize,\n debug,\n skipDatapoints,\n skipSubDatapoints,\n includeGuessedCategories,\n trackerStatuses,\n });\n\n const filePath = path.join(file, `${apiKey.organizationName}.yml`);\n this.logger.info(colors.magenta(`Writing configuration to file \"${filePath}\"...`));\n this.fs.writeFileSync(filePath, serializeTranscendYaml(configuration));\n\n this.logger.info(colors.green(`${prefix}Successfully pulled configuration!`));\n } catch (err) {\n this.logger.error(colors.red(`${prefix}Failed to sync configuration. - ${err.message}`));\n encounteredErrors.push(apiKey.organizationName);\n }\n });\n\n if (encounteredErrors.length > 0) {\n this.logger.info(\n colors.red(\n `Sync encountered errors for \"${encounteredErrors.join(\n ',',\n )}\". View output above for more information, or check out ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n\n this.process.exit(1);\n }\n }\n}\n"],"mappings":"ugBA+BA,eAAsB,EAEpB,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AClE,KAAK,OAAO,KAAK,EAAO,QAAQ,kCAAkC,EAAS,MAAM,CAAC,CAClF,KAAK,GAAG,cAAc,EAAU,EAAuB,EAAc,CAAC,CAEtE,KAAK,OAAO,KAAK,EAAO,MAAM,GAAG,EAAO,oCAAoC,CAAC,OACtE,EAAK,CACZ,KAAK,OAAO,MAAM,EAAO,IAAI,GAAG,EAAO,kCAAkC,EAAI,UAAU,CAAC,CACxF,EAAkB,KAAK,EAAO,iBAAiB,GAEjD,CAEE,EAAkB,OAAS,IAC7B,KAAK,OAAO,KACV,EAAO,IACL,gCAAgC,EAAkB,KAChD,IACD,CAAC,0DAA0D,IAC7D,CACF,CAED,KAAK,QAAQ,KAAK,EAAE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./readCsv-
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
import{t as e}from"./readCsv-DNcJ_UfU.mjs";import{t}from"./markRequestDataSiloIdsCompleted-C6lV_My-.mjs";import{t as n}from"./done-input-validation-LiTaCEzF.mjs";import r from"colors";import*as i from"io-ts";const a=i.type({"Request Id":i.string});async function o({auth:i,dataSiloId:o,file:s,transcendUrl:c}){n(this.process),this.logger.info(r.magenta(`Reading "${s}" from disk`)),await t({requestIds:e(this.fs.readFileSync(s,`utf8`),a).map(e=>e[`Request Id`]),transcendUrl:c,auth:i,dataSiloId:o})}export{o as markRequestDataSilosCompleted};
|
|
2
|
+
//# sourceMappingURL=impl-BgkovGOz.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl-
|
|
1
|
+
{"version":3,"file":"impl-BgkovGOz.mjs","names":[],"sources":["../src/commands/request/system/mark-request-data-silos-completed/impl.ts"],"sourcesContent":["import colors from 'colors';\nimport * as t from 'io-ts';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport { markRequestDataSiloIdsCompleted } from '../../../../lib/cron/index.js';\nimport { parseCsv } from '../../../../lib/requests/readCsv.js';\n\nconst RequestIdRow = t.type({\n 'Request Id': t.string,\n});\n\nexport interface MarkRequestDataSilosCompletedCommandFlags {\n auth: string;\n dataSiloId: string;\n file: string;\n transcendUrl: string;\n}\n\nexport async function markRequestDataSilosCompleted(\n this: LocalContext,\n { auth, dataSiloId, file, transcendUrl }: MarkRequestDataSilosCompletedCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n this.logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const activeResults = parseCsv(this.fs.readFileSync(file, 'utf8'), RequestIdRow);\n\n await markRequestDataSiloIdsCompleted({\n requestIds: activeResults.map((request) => request['Request Id']),\n transcendUrl,\n auth,\n dataSiloId,\n });\n}\n"],"mappings":"gNAQA,MAAM,EAAe,EAAE,KAAK,CAC1B,aAAc,EAAE,OACjB,CAAC,CASF,eAAsB,EAEpB,CAAE,OAAM,aAAY,OAAM,gBACX,CACf,EAAoB,KAAK,QAAQ,CAEjC,KAAK,OAAO,KAAK,EAAO,QAAQ,YAAY,EAAK,aAAa,CAAC,CAG/D,MAAM,EAAgC,CACpC,WAHoB,EAAS,KAAK,GAAG,aAAa,EAAM,OAAO,CAAE,EAGxC,CAAC,IAAK,GAAY,EAAQ,cAAc,CACjE,eACA,OACA,aACD,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./uploadPrivacyRequestsFromCsv-
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
import{t as e}from"./uploadPrivacyRequestsFromCsv-BsYnCgbl.mjs";import{t}from"./done-input-validation-LiTaCEzF.mjs";import{splitCsvToList as n}from"@transcend-io/utils";async function r({auth:r,file:i,transcendUrl:a,cacheFilepath:o,requestReceiptFolder:s,sombraAuth:c,concurrency:l,attributes:u,isTest:d,isSilent:f,skipSendingReceipt:p,emailIsVerified:m,skipFilterStep:h,dryRun:g,debug:_,defaultPhoneCountryCode:v}){t(this.process),await e({cacheFilepath:o,requestReceiptFolder:s,file:i,auth:r,sombraAuth:c,concurrency:l,transcendUrl:a,defaultPhoneCountryCode:v,attributes:n(u),debug:_,skipFilterStep:h,isSilent:f,skipSendingReceipt:p,emailIsVerified:m,isTest:d,dryRun:g})}export{r as upload};
|
|
2
|
+
//# sourceMappingURL=impl-Bh02zrTq.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl-
|
|
1
|
+
{"version":3,"file":"impl-Bh02zrTq.mjs","names":[],"sources":["../src/commands/request/upload/impl.ts"],"sourcesContent":["import { splitCsvToList } from '@transcend-io/utils';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { uploadPrivacyRequestsFromCsv } from '../../../lib/requests/index.js';\n\nexport interface UploadCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n cacheFilepath: string;\n requestReceiptFolder: string;\n sombraAuth?: string;\n concurrency: number;\n attributes: string;\n isTest: boolean;\n isSilent: boolean;\n skipSendingReceipt: boolean;\n emailIsVerified: boolean;\n skipFilterStep: boolean;\n dryRun: boolean;\n debug: boolean;\n defaultPhoneCountryCode: string;\n}\n\nexport async function upload(\n this: LocalContext,\n {\n auth,\n file,\n transcendUrl,\n cacheFilepath,\n requestReceiptFolder,\n sombraAuth,\n concurrency,\n attributes,\n isTest,\n isSilent,\n skipSendingReceipt,\n emailIsVerified,\n skipFilterStep,\n dryRun,\n debug,\n defaultPhoneCountryCode,\n }: UploadCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n await uploadPrivacyRequestsFromCsv({\n cacheFilepath,\n requestReceiptFolder,\n file,\n auth,\n sombraAuth,\n concurrency,\n transcendUrl,\n defaultPhoneCountryCode,\n attributes: splitCsvToList(attributes),\n debug,\n skipFilterStep,\n isSilent,\n skipSendingReceipt,\n emailIsVerified,\n isTest,\n dryRun,\n });\n}\n"],"mappings":"yKAyBA,eAAsB,EAEpB,CACE,OACA,OACA,eACA,gBACA,uBACA,aACA,cACA,aACA,SACA,WACA,qBACA,kBACA,iBACA,SACA,QACA,2BAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,MAAM,EAA6B,CACjC,gBACA,uBACA,OACA,OACA,aACA,cACA,eACA,0BACA,WAAY,EAAe,EAAW,CACtC,QACA,iBACA,WACA,qBACA,kBACA,SACA,SACD,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./pushCronIdentifiersFromCsv-
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
import{t as e}from"./pushCronIdentifiersFromCsv-CDhlEf6n.mjs";import{t}from"./done-input-validation-LiTaCEzF.mjs";async function n({file:n,transcendUrl:r,auth:i,sombraAuth:a,dataSiloId:o}){t(this.process),await e({file:n,transcendUrl:r,auth:i,sombraAuth:a,dataSiloId:o})}export{n as markIdentifiersCompleted};
|
|
2
|
+
//# sourceMappingURL=impl-BopWGXnH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impl-BopWGXnH.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"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{i as e}from"./paths-J5KScOaQ.mjs";import{o as t,s as n}from"./project-discovery-CWRjlFnC.mjs";import{a as r}from"./readTranscendYaml-BfqQbPiT.mjs";import{t as i}from"./parseVariablesFromString-6TYW65LF.mjs";import{t as a}from"./done-input-validation-LiTaCEzF.mjs";import{t as o}from"./missing-manifest-D8y1VL4p.mjs";import{a as s,i as c,l,t as u}from"./project-discovery-BkHpTXDx.mjs";import{n as d,r as f,t as p}from"./prompts-BhXfYD6g.mjs";import{t as m}from"./run-captured-process-BjaSDWXG.mjs";import{r as h,t as g}from"./deno-runtime-CB2HBach.mjs";import{t as _}from"./module-graph-CAT8_JCG.mjs";import{t as v}from"./project-plan-apply-Bg_1eMX9.mjs";import{dirname as y,extname as b,join as x,relative as S,resolve as C,sep as w}from"node:path";import T from"colors";import{createTwoFilesPatch as E}from"diff";import{DSR_DATAPOINT_CUSTOM_FUNCTION_PAYLOAD_SCHEMA as D,DSR_REQUEST_ENRICHER_CUSTOM_FUNCTION_PAYLOAD_SCHEMA as O,GENERAL_CUSTOM_FUNCTION_PAYLOAD_SCHEMA as k}from"@transcend-io/custom-function-types";import A from"ajv";import{parse as j}from"jsonc-parser";function M(e,t){e.push({severity:`error`,...t})}function N(e,t){return S(e,t).split(w).join(`/`)||`.`}function P(e){let t=t=>e.type===`DSR`?t===`REQUEST_ENRICHER`?`dsr-enricher`:`dsr-datapoint`:`general`;return e[`test-payload`]?[{entry:e,path:e[`test-payload`],type:t(e[`test-payload-type`])}]:(e[`test-payloads`]??[]).map(n=>({entry:e,path:n.payload,type:t(n[`payload-type`])}))}function F(e,t){let n=P(e).map(({type:e})=>e),r=e.type===`DSR`&&n.length===0;return{entry:e,path:C(t,e.code),needsDefault:e.type!==`DSR`||n.includes(`dsr-datapoint`),needsEnricher:n.includes(`dsr-enricher`),needsAnyDsrExport:r}}function I(){let e=new A({allErrors:!0,strict:!1});return{general:e.compile(k),"dsr-datapoint":e.compile(D),"dsr-enricher":e.compile(O)}}function L(e){return`${e.instancePath||`/`} ${e.message??`is invalid`}`}function R(e,t,r,i){let a=I(),o=[],s=[];return r.forEach(r=>{if(/<<parameters\.[^>]+>>/u.test(r.code))M(i,{code:`manifest.unresolved-code-path`,message:`Code paths cannot contain unresolved parameter placeholders.`,path:r.code,functionName:r.name});else if(c(r.code)){let a=F(r,t);e.fs.existsSync(a.path)?n(e,t,a.path)?e.fs.statSync(a.path).isFile()?o.push(a):M(i,{code:`source.not-file`,message:`Referenced source path is not a regular file.`,path:r.code,functionName:r.name}):M(i,{code:`source.outside-project`,message:`Referenced source resolves outside the manifest directory through a symlink.`,path:r.code,functionName:r.name}):M(i,{code:`source.missing`,message:`Referenced source file does not exist.`,path:r.code,functionName:r.name})}P(r).forEach(o=>{if(/<<parameters\.[^>]+>>/u.test(o.path)){M(i,{code:`manifest.unresolved-payload-path`,message:`Payload paths cannot contain unresolved parameter placeholders.`,path:o.path,functionName:r.name});return}let c=C(t,o.path);if(!e.fs.existsSync(c)){M(i,{code:`payload.missing`,message:`Referenced test payload does not exist.`,path:o.path,functionName:r.name});return}if(!n(e,t,c)){M(i,{code:`payload.outside-project`,message:`Referenced test payload resolves outside the manifest directory through a symlink.`,path:o.path,functionName:r.name});return}if(!e.fs.statSync(c).isFile()){M(i,{code:`payload.not-file`,message:`Referenced test payload is not a regular file.`,path:o.path,functionName:r.name});return}s.push(c);let l;try{l=JSON.parse(e.fs.readFileSync(c,`utf8`))}catch(e){M(i,{code:`payload.invalid-json`,message:`Invalid JSON: ${e.message}`,path:o.path,functionName:r.name});return}let u=a[o.type];u(l)||(u.errors??[]).forEach(e=>M(i,{code:`payload.schema`,message:L(e),path:o.path,functionName:r.name}))})}),{sources:o,payloadPaths:[...new Set(s)]}}function z(e){try{let t=JSON.parse(e),n=Array.isArray(t)?t:t&&typeof t==`object`&&Array.isArray(t.nodes)?t.nodes:void 0;return n?new Set(n.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e.name;return typeof t==`string`?[t]:[]})):new Set}catch{return new Set}}function B(e){switch(b(e)){case`.ts`:case`.tsx`:return`ts`;case`.json`:case`.jsonc`:return`json`;case`.yaml`:case`.yml`:return`yaml`;default:return`ts`}}function V(e,n,r){if(!r)return;let i=j(e.fs.readFileSync(r,`utf8`));if(typeof i?.importMap==`string`){if(/^[a-z][a-z\d+.-]*:/iu.test(i.importMap))return i.importMap;let a=C(y(r),i.importMap);return t(e,n,a),a}let a={};if(i.imports!==void 0&&(a.imports=i.imports),i.scopes!==void 0&&(a.scopes=i.scopes),Object.keys(a).length!==0)return`data:application/json,${encodeURIComponent(JSON.stringify(a))}`}async function H(e,n,r,i,a){let o=[],s=[];for(let c of a){t(e,r,c);let a=e.fs.readFileSync(c,`utf8`),l=await n(`deno`,[`fmt`,...i,`--ext=${B(c)}`,`-`],{cwd:r,input:a},e);if(l.code!==0)throw Error(`Deno could not preview formatting for ${N(r,c)}.${l.stderr.trim()?`\n${l.stderr.trim()}`:``}`);if(l.stdout!==a){let t=N(r,c);o.push(E(t,t,a,l.stdout,``,``,{context:3})),s.push({kind:`file`,path:c,before:a,after:l.stdout,description:`Format ${t}`,mode:e.fs.statSync(c).mode})}}return{patch:o.join(`
|
|
2
|
+
`),changes:s}}function U(e,t,n,r){M(e,{code:t,message:`${n}${r.stderr.trim()?`\n${r.stderr.trim()}`:``}`})}async function W(e,i,a=m){let o=C(i.manifestPath),c=y(o),u=[],d=new Map([[`manifest`,`passed`],[`files`,`passed`],[`payloads`,`passed`],[`runtime`,`passed`],[`exports`,`passed`],[`typecheck`,`passed`],[`lint`,`passed`],[`format`,`passed`]]),f=()=>({version:1,status:u.some(({severity:e})=>e===`error`)?`failed`:`passed`,manifestPath:o,checks:[...d].map(([e,t])=>({name:e,status:t})),diagnostics:u});if(!e.fs.existsSync(o))return M(u,{code:`manifest.missing`,message:`Custom Function manifest does not exist.`,path:N(e.process.cwd(),o)}),d.set(`manifest`,`failed`),[`files`,`payloads`,`runtime`,`exports`,`typecheck`,`lint`,`format`].forEach(e=>d.set(e,`skipped`)),f();let p=[];try{p=s(r(e.fs.readFileSync(o,`utf8`),i.variables??{})).functions}catch(e){return M(u,{code:`manifest.invalid`,message:e.message,path:N(c,o)}),d.set(`manifest`,`failed`),[`files`,`payloads`,`runtime`,`exports`,`typecheck`,`lint`,`format`].forEach(e=>d.set(e,`skipped`)),f()}p.forEach(e=>{try{l({...e.env?{env:e.env}:{},...e[`allowed-hosts`]?{allowedHosts:e[`allowed-hosts`]}:{}})}catch(t){d.set(`manifest`,`failed`),M(u,{code:`manifest.execution-context`,message:t.message,path:N(c,o),functionName:e.name})}});let{sources:b,payloadPaths:S}=R(e,c,p,u);u.some(({code:e})=>[`source.`,`manifest.unresolved-code-path`].some(t=>e.startsWith(t)))&&(d.set(`files`,`failed`),[`exports`,`typecheck`,`lint`].forEach(e=>d.set(e,`failed`))),u.some(({code:e})=>[`payload.`,`manifest.unresolved-payload-path`].some(t=>e.startsWith(t)))&&d.set(`payloads`,`failed`);let w=x(c,`deno.jsonc`),T=x(c,`deno.json`),E=e.fs.existsSync(w)?w:e.fs.existsSync(T)?T:void 0,D=E!==void 0&&!n(e,c,E),O=D,k;if(D)M(u,{code:`deno.config-outside-project`,message:`Deno configuration resolves outside the manifest directory through a symlink.`,path:N(c,E)}),[`exports`,`typecheck`,`lint`,`format`].forEach(e=>d.set(e,`failed`));else try{k=V(e,c,E)}catch(e){O=!0,M(u,{code:`deno.import-map-outside-project`,message:e.message}),[`exports`,`typecheck`,`lint`,`format`].forEach(e=>d.set(e,`failed`))}let A=E&&!O?[`--config=${E}`]:[`--no-config`],j=()=>{[`exports`,`typecheck`,`lint`,`format`].forEach(e=>{d.get(e)!==`failed`&&d.set(e,`skipped`)})},P=await a(`deno`,[`--version`],{cwd:c},e),F=P.code===0?h(P.stdout):void 0;if(F?.level===`warning`&&u.push({code:`deno.version-mismatch`,severity:`warning`,message:F.message}),P.error?.code===`ENOENT`)d.set(`runtime`,`failed`),j(),M(u,{code:`deno.missing`,message:`Deno 2.x is required for export, type, lint, and format checks. Install it from ${g}`});else if(P.code!==0)d.set(`runtime`,`failed`),j(),U(u,`deno.unavailable`,`Deno could not be started.`,P);else if(F?.level===`error`)d.set(`runtime`,`failed`),j(),M(u,{code:`deno.unsupported-version`,message:F.message});else if(!O){for(let t of b){let n=await a(`deno`,[`info`,`--json`,...A,t.path],{cwd:c},e);if(n.code!==0)d.set(`files`,`failed`),U(u,`source.module-graph`,`Could not inspect runtime imports for ${N(c,t.path)}.`,n);else try{let e=_(n.stdout);e.length>0&&(d.set(`files`,`failed`),M(u,{code:`source.local-runtime-import`,message:`Custom Functions must be self-contained. Local or import-map runtime dependencies are not deployed: `+e.join(`, `),path:N(c,t.path),functionName:t.entry.name}))}catch(e){d.set(`files`,`failed`),M(u,{code:`source.module-graph`,message:e.message,path:N(c,t.path),functionName:t.entry.name})}let r=await a(`deno`,[`doc`,`--json`,...k?[`--import-map`,k]:[],t.path],{cwd:c},e);if(r.code!==0){d.set(`exports`,`failed`),U(u,`exports.inspect`,`Could not inspect exports for ${N(c,t.path)}.`,r);continue}let i=z(r.stdout);t.needsDefault&&!i.has(`default`)&&(d.set(`exports`,`failed`),M(u,{code:`exports.default-missing`,message:`The manifest fixtures require a default export.`,path:N(c,t.path),functionName:t.entry.name})),t.needsEnricher&&!i.has(`enricher`)&&(d.set(`exports`,`failed`),M(u,{code:`exports.enricher-missing`,message:"A REQUEST_ENRICHER fixture requires an `enricher` export.",path:N(c,t.path),functionName:t.entry.name})),t.needsAnyDsrExport&&!i.has(`default`)&&!i.has(`enricher`)&&(d.set(`exports`,`failed`),M(u,{code:`exports.dsr-missing`,message:"A DSR Custom Function requires a `default` or `enricher` export.",path:N(c,t.path),functionName:t.entry.name}))}let n=[...new Set(b.map(({path:e})=>e))];if(n.length>0){let t=await a(`deno`,[`check`,...A,...n],{cwd:c},e);t.code!==0&&(d.set(`typecheck`,`failed`),U(u,`deno.typecheck`,`Deno type checking failed.`,t));let r=await a(`deno`,[`lint`,...A,...n],{cwd:c},e);r.code!==0&&(d.set(`lint`,`failed`),U(u,`deno.lint`,`Deno linting failed.`,r))}let r=[...n,...S,o,...E?[E]:[],...k&&k!==E&&!/^[a-z][a-z\d+.-]*:/iu.test(k)?[k]:[]];r.forEach(n=>t(e,c,n));let s=await a(`deno`,[`fmt`,`--check`,...A,...r],{cwd:c},e);if(s.code!==0){let t;try{t=await H(e,a,c,A,r)}catch(e){return d.set(`format`,`failed`),M(u,{code:`deno.format-preview`,message:e.message}),f()}if(t.changes.length===0)return d.set(`format`,`failed`),U(u,`deno.format`,`Deno reported a formatting failure but did not produce a repair.`,s),f();if(i.fix||i.confirmFormat&&await i.confirmFormat(t.patch))try{await v(e,{rootDirectory:c,changes:t.changes})}catch(e){d.set(`format`,`failed`),M(u,{code:`deno.format-fix`,message:`Could not apply formatting transaction: ${e.message}`})}else d.set(`format`,`failed`),t.changes.forEach((e,n)=>{M(u,{code:`deno.format`,message:`Referenced file is not formatted.`+(n===0&&i.includeFormatPatchInDiagnostics&&t.patch?`\n${t.patch}`:``),path:N(c,e.path)})})}}return f()}async function G(t,n){a(this.process);let{manifestPath:r}=e(this.process.cwd(),{...n?{directory:n}:{},...t.manifest?{manifest:t.manifest}:{}}),s=this.fs.existsSync(r)?void 0:o({cwd:this.process.cwd(),manifestPath:r,discoveredManifestPaths:u(this,this.process.cwd()),command:`check`}),c=f(t,this.process.stdin.isTTY,this.process.stderr.isTTY),l=new d(this);try{let e=await W(this,{manifestPath:r,variables:i(t.variables),fix:t.fix,includeFormatPatchInDiagnostics:!t.json,...c&&!t.fix?{confirmFormat:async e=>(e&&this.logger.error(e),l.confirm(`Format the files shown above?`,!0))}:{}});s&&e.diagnostics.forEach(e=>{e.code===`manifest.missing`&&(e.message=s)}),t.json?this.process.stdout.write(`${JSON.stringify(e)}\n`):(this.logger.info(`${T.bold(`Custom Function checks`)}\n`),e.checks.forEach(({name:e,status:t})=>{let n=t===`passed`?`PASS`:t===`failed`?`FAIL`:`SKIP`,r=t===`passed`?T.green(n):t===`failed`?T.red(n):T.yellow(n);this.logger.info(`${r} ${e[0].toUpperCase()}${e.slice(1)}`)}),e.diagnostics.length>0&&this.logger.error(``),e.diagnostics.forEach(e=>{let t=e.path?`${e.path}: `:``,n=e.functionName?`[${e.functionName}] `:``,r=`${e.severity}: ${t}${n}${e.message}`;e.severity===`warning`?this.logger.warn(T.yellow(r)):this.logger.error(T.red(r))}),e.status===`passed`?(this.logger.info(``),this.logger.info(T.green(`Custom Function checks passed.`))):(this.logger.error(``),this.logger.error(T.red(`Custom Function checks failed.`)))),e.status===`failed`&&(this.process.exitCode=1)}catch(e){throw e instanceof p&&this.process.exit(130),e}}export{G as check};
|
|
3
|
+
//# sourceMappingURL=impl-BpVe6fMe.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl--JGnR3wp.mjs","names":["parseJsonc"],"sources":["../src/commands/custom-functions/check/helpers.ts","../src/commands/custom-functions/check/impl.ts"],"sourcesContent":["import { dirname, extname, join, relative, resolve, sep } from 'node:path';\n\nimport {\n DSR_DATAPOINT_CUSTOM_FUNCTION_PAYLOAD_SCHEMA,\n DSR_REQUEST_ENRICHER_CUSTOM_FUNCTION_PAYLOAD_SCHEMA,\n GENERAL_CUSTOM_FUNCTION_PAYLOAD_SCHEMA,\n} from '@transcend-io/custom-function-types';\nimport Ajv, { type ErrorObject, type ValidateFunction } from 'ajv';\nimport { createTwoFilesPatch } from 'diff';\nimport { parse as parseJsonc } from 'jsonc-parser';\n\nimport type { LocalContext } from '../../../context.js';\nimport {\n runCapturedProcess,\n type CapturedProcessResult,\n type CapturedProcessRunner,\n} from '../../../lib/cli/run-captured-process.js';\nimport {\n type CustomFunctionCheckResult,\n type CustomFunctionCheckStatus,\n type CustomFunctionDiagnostic,\n} from '../../../lib/custom-functions/check-model.js';\nimport {\n DENO_INSTALL_URL,\n getDenoRuntimeCompatibility,\n SUPPORTED_DENO_MAJOR_VERSION,\n} from '../../../lib/custom-functions/deno-runtime.js';\nimport { validateCustomFunctionExecutionContext } from '../../../lib/custom-functions/execution-context.js';\nimport {\n isCustomFunctionManifestPathContained,\n parseCustomFunctionsManifest,\n type CustomFunctionManifestEntry,\n} from '../../../lib/custom-functions/manifest.js';\nimport { findNonSelfContainedRuntimeImports } from '../../../lib/custom-functions/module-graph.js';\nimport { CUSTOM_FUNCTION_RESULT_VERSION } from '../../../lib/custom-functions/scaffold-model.js';\nimport { replaceVariablesInYaml } from '../../../lib/readTranscendYaml.js';\nimport {\n assertPathPhysicallyContained,\n isPathPhysicallyContained,\n} from '../../../lib/scaffolding/path-safety.js';\nimport { applyProjectPlan } from '../../../lib/scaffolding/project-plan-apply.js';\nimport type { PlannedFileChange } from '../../../lib/scaffolding/project-plan.js';\n\n/** Payload file plus its validation contract. */\ninterface PayloadReference {\n /** Manifest entry. */\n entry: CustomFunctionManifestEntry;\n /** Manifest-relative payload path. */\n path: string;\n /** Schema variant. */\n type: 'general' | 'dsr-datapoint' | 'dsr-enricher';\n}\n\n/** Source file plus exports required by fixtures. */\ninterface SourceReference {\n /** Manifest entry. */\n entry: CustomFunctionManifestEntry;\n /** Absolute source path. */\n path: string;\n /** Whether a default export is required. */\n needsDefault: boolean;\n /** Whether an enricher export is required. */\n needsEnricher: boolean;\n /** Whether either DSR export is acceptable when no fixtures identify one. */\n needsAnyDsrExport: boolean;\n}\n\n/** Options for local validation. */\nexport interface RunCustomFunctionChecksOptions {\n /** Absolute manifest path. */\n manifestPath: string;\n /** Variables used to resolve manifest placeholders. */\n variables?: Record<string, string>;\n /** Apply Deno formatting. */\n fix: boolean;\n /** Ask for an interactive formatting repair after receiving a patch. */\n confirmFormat?: (patch: string) => Promise<boolean>;\n /** Include a unified format patch in human-oriented diagnostics. */\n includeFormatPatchInDiagnostics?: boolean;\n}\n\n/**\n * Add one diagnostic.\n *\n * @param diagnostics - Result collection\n * @param diagnostic - Diagnostic without severity\n */\nfunction addError(\n diagnostics: CustomFunctionDiagnostic[],\n diagnostic: Omit<CustomFunctionDiagnostic, 'severity'>,\n): void {\n diagnostics.push({ severity: 'error', ...diagnostic });\n}\n\n/**\n * Normalize an absolute path relative to the manifest.\n *\n * @param manifestDirectory - Manifest directory\n * @param path - Absolute path\n * @returns Portable display path\n */\nfunction relativePath(manifestDirectory: string, path: string): string {\n const value = relative(manifestDirectory, path).split(sep).join('/');\n return value || '.';\n}\n\n/**\n * Select all payload files and schema variants.\n *\n * @param entry - Manifest entry\n * @returns Payload references\n */\nfunction payloadReferences(entry: CustomFunctionManifestEntry): PayloadReference[] {\n const variant = (\n payloadType: 'DATA_POINT' | 'REQUEST_ENRICHER' | undefined,\n ): PayloadReference['type'] => {\n if (entry.type !== 'DSR') {\n return 'general';\n }\n return payloadType === 'REQUEST_ENRICHER' ? 'dsr-enricher' : 'dsr-datapoint';\n };\n if (entry['test-payload']) {\n return [\n {\n entry,\n path: entry['test-payload'],\n type: variant(entry['test-payload-type']),\n },\n ];\n }\n return (entry['test-payloads'] ?? []).map((item) => ({\n entry,\n path: item.payload,\n type: variant(item['payload-type']),\n }));\n}\n\n/**\n * Select export expectations from the registered fixtures.\n *\n * @param entry - Manifest entry\n * @param manifestDirectory - Manifest directory\n * @returns Source reference\n */\nfunction sourceReference(\n entry: CustomFunctionManifestEntry,\n manifestDirectory: string,\n): SourceReference {\n const payloadTypes = payloadReferences(entry).map(({ type }) => type);\n const dsrWithoutPayloads = entry.type === 'DSR' && payloadTypes.length === 0;\n return {\n entry,\n path: resolve(manifestDirectory, entry.code),\n needsDefault: entry.type !== 'DSR' || payloadTypes.includes('dsr-datapoint'),\n needsEnricher: payloadTypes.includes('dsr-enricher'),\n needsAnyDsrExport: dsrWithoutPayloads,\n };\n}\n\n/**\n * Compile published payload schemas.\n *\n * @returns Validators by local variant\n */\nfunction buildPayloadValidators(): Record<PayloadReference['type'], ValidateFunction> {\n const ajv = new Ajv({ allErrors: true, strict: false });\n return {\n general: ajv.compile(GENERAL_CUSTOM_FUNCTION_PAYLOAD_SCHEMA),\n 'dsr-datapoint': ajv.compile(DSR_DATAPOINT_CUSTOM_FUNCTION_PAYLOAD_SCHEMA),\n 'dsr-enricher': ajv.compile(DSR_REQUEST_ENRICHER_CUSTOM_FUNCTION_PAYLOAD_SCHEMA),\n };\n}\n\n/**\n * Format one Ajv failure.\n *\n * @param error - Ajv error\n * @returns Concise path and message\n */\nfunction formatSchemaError(error: ErrorObject): string {\n return `${error.instancePath || '/'} ${error.message ?? 'is invalid'}`;\n}\n\n/**\n * Validate referenced source and payload files without invoking Deno.\n *\n * @param context - CLI context\n * @param manifestDirectory - Manifest directory\n * @param entries - Parsed manifest entries\n * @param diagnostics - Result collection\n * @returns Existing source and format paths\n */\nfunction validateReferencedFiles(\n context: LocalContext,\n manifestDirectory: string,\n entries: readonly CustomFunctionManifestEntry[],\n diagnostics: CustomFunctionDiagnostic[],\n): {\n /** Existing source references. */\n sources: SourceReference[];\n /** Existing payload paths. */\n payloadPaths: string[];\n} {\n const validators = buildPayloadValidators();\n const sources: SourceReference[] = [];\n const payloadPaths: string[] = [];\n entries.forEach((entry) => {\n if (/<<parameters\\.[^>]+>>/u.test(entry.code)) {\n addError(diagnostics, {\n code: 'manifest.unresolved-code-path',\n message: 'Code paths cannot contain unresolved parameter placeholders.',\n path: entry.code,\n functionName: entry.name,\n });\n } else if (isCustomFunctionManifestPathContained(entry.code)) {\n const source = sourceReference(entry, manifestDirectory);\n if (!context.fs.existsSync(source.path)) {\n addError(diagnostics, {\n code: 'source.missing',\n message: 'Referenced source file does not exist.',\n path: entry.code,\n functionName: entry.name,\n });\n } else if (!isPathPhysicallyContained(context, manifestDirectory, source.path)) {\n addError(diagnostics, {\n code: 'source.outside-project',\n message: 'Referenced source resolves outside the manifest directory through a symlink.',\n path: entry.code,\n functionName: entry.name,\n });\n } else if (!context.fs.statSync(source.path).isFile()) {\n addError(diagnostics, {\n code: 'source.not-file',\n message: 'Referenced source path is not a regular file.',\n path: entry.code,\n functionName: entry.name,\n });\n } else {\n sources.push(source);\n }\n }\n\n payloadReferences(entry).forEach((reference) => {\n if (/<<parameters\\.[^>]+>>/u.test(reference.path)) {\n addError(diagnostics, {\n code: 'manifest.unresolved-payload-path',\n message: 'Payload paths cannot contain unresolved parameter placeholders.',\n path: reference.path,\n functionName: entry.name,\n });\n return;\n }\n const payloadPath = resolve(manifestDirectory, reference.path);\n if (!context.fs.existsSync(payloadPath)) {\n addError(diagnostics, {\n code: 'payload.missing',\n message: 'Referenced test payload does not exist.',\n path: reference.path,\n functionName: entry.name,\n });\n return;\n }\n if (!isPathPhysicallyContained(context, manifestDirectory, payloadPath)) {\n addError(diagnostics, {\n code: 'payload.outside-project',\n message:\n 'Referenced test payload resolves outside the manifest directory through a symlink.',\n path: reference.path,\n functionName: entry.name,\n });\n return;\n }\n if (!context.fs.statSync(payloadPath).isFile()) {\n addError(diagnostics, {\n code: 'payload.not-file',\n message: 'Referenced test payload is not a regular file.',\n path: reference.path,\n functionName: entry.name,\n });\n return;\n }\n payloadPaths.push(payloadPath);\n let payload: unknown;\n try {\n payload = JSON.parse(context.fs.readFileSync(payloadPath, 'utf8'));\n } catch (error) {\n addError(diagnostics, {\n code: 'payload.invalid-json',\n message: `Invalid JSON: ${(error as Error).message}`,\n path: reference.path,\n functionName: entry.name,\n });\n return;\n }\n const validate = validators[reference.type];\n if (!validate(payload)) {\n (validate.errors ?? []).forEach((error) =>\n addError(diagnostics, {\n code: 'payload.schema',\n message: formatSchemaError(error),\n path: reference.path,\n functionName: entry.name,\n }),\n );\n }\n });\n });\n return {\n sources,\n payloadPaths: [...new Set(payloadPaths)],\n };\n}\n\n/**\n * Read Deno's JSON documentation output for exported names.\n *\n * @param output - `deno doc --json` output\n * @returns Exported names\n */\nfunction exportedNames(output: string): Set<string> {\n try {\n const document = JSON.parse(output) as unknown;\n const nodes = Array.isArray(document)\n ? document\n : document &&\n typeof document === 'object' &&\n Array.isArray((document as Record<string, unknown>).nodes)\n ? ((document as Record<string, unknown>).nodes as unknown[])\n : undefined;\n if (!nodes) {\n return new Set();\n }\n return new Set(\n nodes.flatMap((node) => {\n if (!node || typeof node !== 'object') {\n return [];\n }\n const name = (node as Record<string, unknown>).name;\n return typeof name === 'string' ? [name] : [];\n }),\n );\n } catch {\n return new Set();\n }\n}\n\n/**\n * Choose the Deno formatter extension for stdin.\n *\n * @param path - Source path\n * @returns Deno extension\n */\nfunction denoExtension(path: string): string {\n switch (extname(path)) {\n case '.ts':\n case '.tsx':\n return 'ts';\n case '.json':\n case '.jsonc':\n return 'json';\n case '.yaml':\n case '.yml':\n return 'yaml';\n default:\n return 'ts';\n }\n}\n\n/**\n * Resolve the import-map input supported by `deno doc`.\n *\n * Deno 2.4 does not expose `--config` for `doc`. A full `deno.json` is not a\n * valid import map when it also has `tasks`, `lint`, `fmt`, or\n * `compilerOptions`, so inline `imports` / `scopes` are passed as a data URL.\n * An `importMap` reference is followed explicitly.\n *\n * @param context - CLI context\n * @param manifestDirectory - Approved project root\n * @param configPath - Selected Deno config\n * @returns Import map path or URL\n */\nfunction resolveDocImportMap(\n context: LocalContext,\n manifestDirectory: string,\n configPath: string | undefined,\n): string | undefined {\n if (!configPath) {\n return undefined;\n }\n const config = parseJsonc(context.fs.readFileSync(configPath, 'utf8')) as {\n /** Optional separate import map. */\n importMap?: unknown;\n /** Inline import map entries. */\n imports?: unknown;\n /** Inline import map scopes. */\n scopes?: unknown;\n };\n if (typeof config?.importMap === 'string') {\n if (/^[a-z][a-z\\d+.-]*:/iu.test(config.importMap)) {\n return config.importMap;\n }\n const importMapPath = resolve(dirname(configPath), config.importMap);\n assertPathPhysicallyContained(context, manifestDirectory, importMapPath);\n return importMapPath;\n }\n const importMap: {\n /** Bare-specifier remappings. */\n imports?: unknown;\n /** Scoped remappings. */\n scopes?: unknown;\n } = {};\n if (config.imports !== undefined) {\n importMap.imports = config.imports;\n }\n if (config.scopes !== undefined) {\n importMap.scopes = config.scopes;\n }\n if (Object.keys(importMap).length === 0) {\n return undefined;\n }\n return `data:application/json,${encodeURIComponent(JSON.stringify(importMap))}`;\n}\n\n/**\n * Render deterministic formatter patches without changing files.\n *\n * @param context - CLI context\n * @param runner - Process runner\n * @param manifestDirectory - Working directory\n * @param configArgs - Deno config arguments\n * @param paths - Target files\n * @returns Unified patches and transactional file changes\n */\nasync function buildFormatPlan(\n context: LocalContext,\n runner: CapturedProcessRunner,\n manifestDirectory: string,\n configArgs: readonly string[],\n paths: readonly string[],\n): Promise<{ patch: string; changes: PlannedFileChange[] }> {\n const patches: string[] = [];\n const changes: PlannedFileChange[] = [];\n for (const path of paths) {\n assertPathPhysicallyContained(context, manifestDirectory, path);\n const before = context.fs.readFileSync(path, 'utf8');\n const result = await runner(\n 'deno',\n ['fmt', ...configArgs, `--ext=${denoExtension(path)}`, '-'],\n { cwd: manifestDirectory, input: before },\n context,\n );\n if (result.code !== 0) {\n throw new Error(\n `Deno could not preview formatting for ${relativePath(manifestDirectory, path)}.${\n result.stderr.trim() ? `\\n${result.stderr.trim()}` : ''\n }`,\n );\n }\n if (result.stdout !== before) {\n const display = relativePath(manifestDirectory, path);\n patches.push(\n createTwoFilesPatch(display, display, before, result.stdout, '', '', { context: 3 }),\n );\n changes.push({\n kind: 'file',\n path,\n before,\n after: result.stdout,\n description: `Format ${display}`,\n mode: context.fs.statSync(path).mode,\n });\n }\n }\n return { patch: patches.join('\\n'), changes };\n}\n\n/**\n * Record one Deno command failure.\n *\n * @param diagnostics - Result collection\n * @param code - Stable code\n * @param message - Summary\n * @param result - Captured process result\n */\nfunction recordDenoFailure(\n diagnostics: CustomFunctionDiagnostic[],\n code: string,\n message: string,\n result: CapturedProcessResult,\n): void {\n addError(diagnostics, {\n code,\n message: `${message}${result.stderr.trim() ? `\\n${result.stderr.trim()}` : ''}`,\n });\n}\n\n/**\n * Run credential-free local validation without executing user modules.\n *\n * @param context - CLI context\n * @param options - Manifest and format behavior\n * @param runner - Captured process runner\n * @returns Stable check result\n */\nexport async function runCustomFunctionChecks(\n context: LocalContext,\n options: RunCustomFunctionChecksOptions,\n runner: CapturedProcessRunner = runCapturedProcess,\n): Promise<CustomFunctionCheckResult> {\n const manifestPath = resolve(options.manifestPath);\n const manifestDirectory = dirname(manifestPath);\n const diagnostics: CustomFunctionDiagnostic[] = [];\n const statuses = new Map<string, CustomFunctionCheckStatus>([\n ['manifest', 'passed'],\n ['files', 'passed'],\n ['payloads', 'passed'],\n ['runtime', 'passed'],\n ['exports', 'passed'],\n ['typecheck', 'passed'],\n ['lint', 'passed'],\n ['format', 'passed'],\n ]);\n const buildResult = (): CustomFunctionCheckResult => ({\n version: CUSTOM_FUNCTION_RESULT_VERSION,\n status: diagnostics.some(({ severity }) => severity === 'error') ? 'failed' : 'passed',\n manifestPath,\n checks: [...statuses].map(([name, status]) => ({ name, status })),\n diagnostics,\n });\n if (!context.fs.existsSync(manifestPath)) {\n addError(diagnostics, {\n code: 'manifest.missing',\n message: 'Custom Function manifest does not exist.',\n path: relativePath(context.process.cwd(), manifestPath),\n });\n statuses.set('manifest', 'failed');\n ['files', 'payloads', 'runtime', 'exports', 'typecheck', 'lint', 'format'].forEach((name) =>\n statuses.set(name, 'skipped'),\n );\n return buildResult();\n }\n\n let entries: readonly CustomFunctionManifestEntry[] = [];\n try {\n const manifestContents = replaceVariablesInYaml(\n context.fs.readFileSync(manifestPath, 'utf8'),\n options.variables ?? {},\n );\n entries = parseCustomFunctionsManifest(manifestContents).functions;\n } catch (error) {\n addError(diagnostics, {\n code: 'manifest.invalid',\n message: (error as Error).message,\n path: relativePath(manifestDirectory, manifestPath),\n });\n statuses.set('manifest', 'failed');\n ['files', 'payloads', 'runtime', 'exports', 'typecheck', 'lint', 'format'].forEach((name) =>\n statuses.set(name, 'skipped'),\n );\n return buildResult();\n }\n entries.forEach((entry) => {\n try {\n validateCustomFunctionExecutionContext({\n ...(entry.env ? { env: entry.env } : {}),\n ...(entry['allowed-hosts'] ? { allowedHosts: entry['allowed-hosts'] } : {}),\n });\n } catch (error) {\n statuses.set('manifest', 'failed');\n addError(diagnostics, {\n code: 'manifest.execution-context',\n message: (error as Error).message,\n path: relativePath(manifestDirectory, manifestPath),\n functionName: entry.name,\n });\n }\n });\n\n const { sources, payloadPaths } = validateReferencedFiles(\n context,\n manifestDirectory,\n entries,\n diagnostics,\n );\n if (\n diagnostics.some(({ code }) =>\n ['source.', 'manifest.unresolved-code-path'].some((prefix) => code.startsWith(prefix)),\n )\n ) {\n statuses.set('files', 'failed');\n ['exports', 'typecheck', 'lint'].forEach((name) => statuses.set(name, 'failed'));\n }\n if (\n diagnostics.some(({ code }) =>\n ['payload.', 'manifest.unresolved-payload-path'].some((prefix) => code.startsWith(prefix)),\n )\n ) {\n statuses.set('payloads', 'failed');\n }\n\n const denoJsonc = join(manifestDirectory, 'deno.jsonc');\n const denoJson = join(manifestDirectory, 'deno.json');\n const configPath = context.fs.existsSync(denoJsonc)\n ? denoJsonc\n : context.fs.existsSync(denoJson)\n ? denoJson\n : undefined;\n const unsafeConfig =\n configPath !== undefined && !isPathPhysicallyContained(context, manifestDirectory, configPath);\n let unsafeConfiguration = unsafeConfig;\n let docImportMap: string | undefined;\n if (unsafeConfig) {\n addError(diagnostics, {\n code: 'deno.config-outside-project',\n message: 'Deno configuration resolves outside the manifest directory through a symlink.',\n path: relativePath(manifestDirectory, configPath),\n });\n ['exports', 'typecheck', 'lint', 'format'].forEach((name) => statuses.set(name, 'failed'));\n } else {\n try {\n docImportMap = resolveDocImportMap(context, manifestDirectory, configPath);\n } catch (error) {\n unsafeConfiguration = true;\n addError(diagnostics, {\n code: 'deno.import-map-outside-project',\n message: (error as Error).message,\n });\n ['exports', 'typecheck', 'lint', 'format'].forEach((name) => statuses.set(name, 'failed'));\n }\n }\n const configArgs =\n configPath && !unsafeConfiguration ? [`--config=${configPath}`] : ['--no-config'];\n const skipPendingDenoChecks = (): void => {\n ['exports', 'typecheck', 'lint', 'format'].forEach((name) => {\n if (statuses.get(name) !== 'failed') {\n statuses.set(name, 'skipped');\n }\n });\n };\n const denoVersion = await runner('deno', ['--version'], { cwd: manifestDirectory }, context);\n const compatibility =\n denoVersion.code === 0 ? getDenoRuntimeCompatibility(denoVersion.stdout) : undefined;\n if (compatibility?.level === 'warning') {\n diagnostics.push({\n code: 'deno.version-mismatch',\n severity: 'warning',\n message: compatibility.message,\n });\n }\n if (denoVersion.error?.code === 'ENOENT') {\n statuses.set('runtime', 'failed');\n skipPendingDenoChecks();\n addError(diagnostics, {\n code: 'deno.missing',\n message: `Deno ${SUPPORTED_DENO_MAJOR_VERSION}.x is required for export, type, lint, and format checks. Install it from ${DENO_INSTALL_URL}`,\n });\n } else if (denoVersion.code !== 0) {\n statuses.set('runtime', 'failed');\n skipPendingDenoChecks();\n recordDenoFailure(diagnostics, 'deno.unavailable', 'Deno could not be started.', denoVersion);\n } else if (compatibility?.level === 'error') {\n statuses.set('runtime', 'failed');\n skipPendingDenoChecks();\n addError(diagnostics, {\n code: 'deno.unsupported-version',\n message: compatibility.message,\n });\n } else if (!unsafeConfiguration) {\n for (const source of sources) {\n const moduleGraph = await runner(\n 'deno',\n ['info', '--json', ...configArgs, source.path],\n { cwd: manifestDirectory },\n context,\n );\n if (moduleGraph.code !== 0) {\n statuses.set('files', 'failed');\n recordDenoFailure(\n diagnostics,\n 'source.module-graph',\n `Could not inspect runtime imports for ${relativePath(manifestDirectory, source.path)}.`,\n moduleGraph,\n );\n } else {\n try {\n const unsupportedImports = findNonSelfContainedRuntimeImports(moduleGraph.stdout);\n if (unsupportedImports.length > 0) {\n statuses.set('files', 'failed');\n addError(diagnostics, {\n code: 'source.local-runtime-import',\n message:\n 'Custom Functions must be self-contained. Local or import-map runtime dependencies are not deployed: ' +\n unsupportedImports.join(', '),\n path: relativePath(manifestDirectory, source.path),\n functionName: source.entry.name,\n });\n }\n } catch (error) {\n statuses.set('files', 'failed');\n addError(diagnostics, {\n code: 'source.module-graph',\n message: (error as Error).message,\n path: relativePath(manifestDirectory, source.path),\n functionName: source.entry.name,\n });\n }\n }\n const result = await runner(\n 'deno',\n ['doc', '--json', ...(docImportMap ? ['--import-map', docImportMap] : []), source.path],\n { cwd: manifestDirectory },\n context,\n );\n if (result.code !== 0) {\n statuses.set('exports', 'failed');\n recordDenoFailure(\n diagnostics,\n 'exports.inspect',\n `Could not inspect exports for ${relativePath(manifestDirectory, source.path)}.`,\n result,\n );\n continue;\n }\n const names = exportedNames(result.stdout);\n if (source.needsDefault && !names.has('default')) {\n statuses.set('exports', 'failed');\n addError(diagnostics, {\n code: 'exports.default-missing',\n message: 'The manifest fixtures require a default export.',\n path: relativePath(manifestDirectory, source.path),\n functionName: source.entry.name,\n });\n }\n if (source.needsEnricher && !names.has('enricher')) {\n statuses.set('exports', 'failed');\n addError(diagnostics, {\n code: 'exports.enricher-missing',\n message: 'A REQUEST_ENRICHER fixture requires an `enricher` export.',\n path: relativePath(manifestDirectory, source.path),\n functionName: source.entry.name,\n });\n }\n if (source.needsAnyDsrExport && !names.has('default') && !names.has('enricher')) {\n statuses.set('exports', 'failed');\n addError(diagnostics, {\n code: 'exports.dsr-missing',\n message: 'A DSR Custom Function requires a `default` or `enricher` export.',\n path: relativePath(manifestDirectory, source.path),\n functionName: source.entry.name,\n });\n }\n }\n\n const sourcePaths = [...new Set(sources.map(({ path }) => path))];\n if (sourcePaths.length > 0) {\n const typecheck = await runner(\n 'deno',\n ['check', ...configArgs, ...sourcePaths],\n { cwd: manifestDirectory },\n context,\n );\n if (typecheck.code !== 0) {\n statuses.set('typecheck', 'failed');\n recordDenoFailure(diagnostics, 'deno.typecheck', 'Deno type checking failed.', typecheck);\n }\n const lint = await runner(\n 'deno',\n ['lint', ...configArgs, ...sourcePaths],\n { cwd: manifestDirectory },\n context,\n );\n if (lint.code !== 0) {\n statuses.set('lint', 'failed');\n recordDenoFailure(diagnostics, 'deno.lint', 'Deno linting failed.', lint);\n }\n }\n\n const formatPaths = [\n ...sourcePaths,\n ...payloadPaths,\n manifestPath,\n ...(configPath ? [configPath] : []),\n ...(docImportMap && docImportMap !== configPath && !/^[a-z][a-z\\d+.-]*:/iu.test(docImportMap)\n ? [docImportMap]\n : []),\n ];\n formatPaths.forEach((path) => assertPathPhysicallyContained(context, manifestDirectory, path));\n const format = await runner(\n 'deno',\n ['fmt', '--check', ...configArgs, ...formatPaths],\n { cwd: manifestDirectory },\n context,\n );\n if (format.code !== 0) {\n let formatPlan: Awaited<ReturnType<typeof buildFormatPlan>>;\n try {\n formatPlan = await buildFormatPlan(\n context,\n runner,\n manifestDirectory,\n configArgs,\n formatPaths,\n );\n } catch (error) {\n statuses.set('format', 'failed');\n addError(diagnostics, {\n code: 'deno.format-preview',\n message: (error as Error).message,\n });\n return buildResult();\n }\n if (formatPlan.changes.length === 0) {\n statuses.set('format', 'failed');\n recordDenoFailure(\n diagnostics,\n 'deno.format',\n 'Deno reported a formatting failure but did not produce a repair.',\n format,\n );\n return buildResult();\n }\n const shouldFix =\n options.fix ||\n (options.confirmFormat ? await options.confirmFormat(formatPlan.patch) : false);\n if (shouldFix) {\n try {\n await applyProjectPlan(context, {\n rootDirectory: manifestDirectory,\n changes: formatPlan.changes,\n });\n } catch (error) {\n statuses.set('format', 'failed');\n addError(diagnostics, {\n code: 'deno.format-fix',\n message: `Could not apply formatting transaction: ${(error as Error).message}`,\n });\n }\n } else {\n statuses.set('format', 'failed');\n formatPlan.changes.forEach((change, index) => {\n addError(diagnostics, {\n code: 'deno.format',\n message:\n 'Referenced file is not formatted.' +\n (index === 0 && options.includeFormatPatchInDiagnostics && formatPlan.patch\n ? `\\n${formatPlan.patch}`\n : ''),\n path: relativePath(manifestDirectory, change.path),\n });\n });\n }\n }\n }\n\n return buildResult();\n}\n","import colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { formatMissingManifestMessage } from '../../../lib/custom-functions/missing-manifest.js';\nimport { resolveCustomFunctionProjectPaths } from '../../../lib/custom-functions/paths.js';\nimport { discoverCustomFunctionManifests } from '../../../lib/custom-functions/project-discovery.js';\nimport { parseVariablesFromString } from '../../../lib/helpers/parseVariablesFromString.js';\nimport { PromptCancelledError, ScaffoldPrompts } from '../../../lib/scaffolding/prompts.js';\nimport { runCustomFunctionChecks } from './helpers.js';\n\n/** CLI flags for `transcend custom-functions check`. */\nexport interface CustomFunctionsCheckFlags {\n /** Explicit manifest path. */\n manifest?: string;\n /** Manifest variable substitutions. */\n variables: string;\n /** Apply Deno formatting. */\n fix: boolean;\n /** Disable prompts. */\n noInteractive: boolean;\n /** Emit JSON on stdout. */\n json: boolean;\n}\n\n/**\n * Validate a local Custom Function project without credentials.\n *\n * @param this - CLI context\n * @param flags - Check and interaction flags\n * @param directory - Optional target directory\n */\nexport async function check(\n this: LocalContext,\n flags: CustomFunctionsCheckFlags,\n directory?: string,\n): Promise<void> {\n doneInputValidation(this.process);\n const { manifestPath } = resolveCustomFunctionProjectPaths(this.process.cwd(), {\n ...(directory ? { directory } : {}),\n ...(flags.manifest ? { manifest: flags.manifest } : {}),\n });\n const missingMessage = this.fs.existsSync(manifestPath)\n ? undefined\n : formatMissingManifestMessage({\n cwd: this.process.cwd(),\n manifestPath,\n discoveredManifestPaths: discoverCustomFunctionManifests(this, this.process.cwd()),\n command: 'check',\n });\n const interactive =\n !flags.json &&\n !flags.noInteractive &&\n Boolean(this.process.stdin.isTTY && this.process.stderr.isTTY);\n const prompts = new ScaffoldPrompts(this);\n try {\n const result = await runCustomFunctionChecks(this, {\n manifestPath,\n variables: parseVariablesFromString(flags.variables),\n fix: flags.fix,\n includeFormatPatchInDiagnostics: !flags.json,\n ...(interactive && !flags.fix\n ? {\n confirmFormat: async (patch: string): Promise<boolean> => {\n if (patch) {\n this.logger.error(patch);\n }\n return prompts.confirm('Format the files shown above?', true);\n },\n }\n : {}),\n });\n if (missingMessage) {\n result.diagnostics.forEach((diagnostic) => {\n if (diagnostic.code === 'manifest.missing') {\n diagnostic.message = missingMessage;\n }\n });\n }\n if (flags.json) {\n this.process.stdout.write(`${JSON.stringify(result)}\\n`);\n } else {\n this.logger.info(`${colors.bold('Custom Function checks')}\\n`);\n result.checks.forEach(({ name, status }) => {\n const label = status === 'passed' ? 'PASS' : status === 'failed' ? 'FAIL' : 'SKIP';\n const styledLabel =\n status === 'passed'\n ? colors.green(label)\n : status === 'failed'\n ? colors.red(label)\n : colors.yellow(label);\n this.logger.info(`${styledLabel} ${name[0]!.toUpperCase()}${name.slice(1)}`);\n });\n if (result.diagnostics.length > 0) {\n this.logger.error('');\n }\n result.diagnostics.forEach((diagnostic) => {\n const location = diagnostic.path ? `${diagnostic.path}: ` : '';\n const owner = diagnostic.functionName ? `[${diagnostic.functionName}] ` : '';\n const message = `${diagnostic.severity}: ${location}${owner}${diagnostic.message}`;\n if (diagnostic.severity === 'warning') {\n this.logger.warn(colors.yellow(message));\n } else {\n this.logger.error(colors.red(message));\n }\n });\n if (result.status === 'passed') {\n this.logger.info('');\n this.logger.info(colors.green('Custom Function checks passed.'));\n } else {\n this.logger.error('');\n this.logger.error(colors.red('Custom Function checks failed.'));\n }\n }\n if (result.status === 'failed') {\n this.process.exitCode = 1;\n }\n } catch (error) {\n if (error instanceof PromptCancelledError) {\n this.process.exit(130);\n }\n throw error;\n }\n}\n"],"mappings":"8/BAuFA,SAAS,EACP,EACA,EACM,CACN,EAAY,KAAK,CAAE,SAAU,QAAS,GAAG,EAAY,CAAC,CAUxD,SAAS,EAAa,EAA2B,EAAsB,CAErE,OADc,EAAS,EAAmB,EAAK,CAAC,MAAM,EAAI,CAAC,KAAK,IACpD,EAAI,IASlB,SAAS,EAAkB,EAAwD,CACjF,IAAM,EACJ,GAEI,EAAM,OAAS,MAGZ,IAAgB,mBAAqB,eAAiB,gBAFpD,UAaX,OATI,EAAM,gBACD,CACL,CACE,QACA,KAAM,EAAM,gBACZ,KAAM,EAAQ,EAAM,qBAAqB,CAC1C,CACF,EAEK,EAAM,kBAAoB,EAAE,EAAE,IAAK,IAAU,CACnD,QACA,K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functions/check/impl.ts"],"sourcesContent":["import { dirname, extname, join, relative, resolve, sep } from 'node:path';\n\nimport {\n DSR_DATAPOINT_CUSTOM_FUNCTION_PAYLOAD_SCHEMA,\n DSR_REQUEST_ENRICHER_CUSTOM_FUNCTION_PAYLOAD_SCHEMA,\n GENERAL_CUSTOM_FUNCTION_PAYLOAD_SCHEMA,\n} from '@transcend-io/custom-function-types';\nimport Ajv, { type ErrorObject, type ValidateFunction } from 'ajv';\nimport { createTwoFilesPatch } from 'diff';\nimport { parse as parseJsonc } from 'jsonc-parser';\n\nimport type { LocalContext } from '../../../context.js';\nimport {\n runCapturedProcess,\n type CapturedProcessResult,\n type CapturedProcessRunner,\n} from '../../../lib/cli/run-captured-process.js';\nimport {\n type CustomFunctionCheckResult,\n type CustomFunctionCheckStatus,\n type CustomFunctionDiagnostic,\n} from '../../../lib/custom-functions/check-model.js';\nimport {\n DENO_INSTALL_URL,\n getDenoRuntimeCompatibility,\n SUPPORTED_DENO_MAJOR_VERSION,\n} from '../../../lib/custom-functions/deno-runtime.js';\nimport { validateCustomFunctionExecutionContext } from '../../../lib/custom-functions/execution-context.js';\nimport {\n isCustomFunctionManifestPathContained,\n parseCustomFunctionsManifest,\n type CustomFunctionManifestEntry,\n} from '../../../lib/custom-functions/manifest.js';\nimport { findNonSelfContainedRuntimeImports } from '../../../lib/custom-functions/module-graph.js';\nimport { CUSTOM_FUNCTION_RESULT_VERSION } from '../../../lib/custom-functions/scaffold-model.js';\nimport { replaceVariablesInYaml } from '../../../lib/readTranscendYaml.js';\nimport {\n assertPathPhysicallyContained,\n isPathPhysicallyContained,\n} from '../../../lib/scaffolding/path-safety.js';\nimport { applyProjectPlan } from '../../../lib/scaffolding/project-plan-apply.js';\nimport type { PlannedFileChange } from '../../../lib/scaffolding/project-plan.js';\n\n/** Payload file plus its validation contract. */\ninterface PayloadReference {\n /** Manifest entry. */\n entry: CustomFunctionManifestEntry;\n /** Manifest-relative payload path. */\n path: string;\n /** Schema variant. */\n type: 'general' | 'dsr-datapoint' | 'dsr-enricher';\n}\n\n/** Source file plus exports required by fixtures. */\ninterface SourceReference {\n /** Manifest entry. */\n entry: CustomFunctionManifestEntry;\n /** Absolute source path. */\n path: string;\n /** Whether a default export is required. */\n needsDefault: boolean;\n /** Whether an enricher export is required. */\n needsEnricher: boolean;\n /** Whether either DSR export is acceptable when no fixtures identify one. */\n needsAnyDsrExport: boolean;\n}\n\n/** Options for local validation. */\nexport interface RunCustomFunctionChecksOptions {\n /** Absolute manifest path. */\n manifestPath: string;\n /** Variables used to resolve manifest placeholders. */\n variables?: Record<string, string>;\n /** Apply Deno formatting. */\n fix: boolean;\n /** Ask for an interactive formatting repair after receiving a patch. */\n confirmFormat?: (patch: string) => Promise<boolean>;\n /** Include a unified format patch in human-oriented diagnostics. */\n includeFormatPatchInDiagnostics?: boolean;\n}\n\n/**\n * Add one diagnostic.\n *\n * @param diagnostics - Result collection\n * @param diagnostic - Diagnostic without severity\n */\nfunction addError(\n diagnostics: CustomFunctionDiagnostic[],\n diagnostic: Omit<CustomFunctionDiagnostic, 'severity'>,\n): void {\n diagnostics.push({ severity: 'error', ...diagnostic });\n}\n\n/**\n * Normalize an absolute path relative to the manifest.\n *\n * @param manifestDirectory - Manifest directory\n * @param path - Absolute path\n * @returns Portable display path\n */\nfunction relativePath(manifestDirectory: string, path: string): string {\n const value = relative(manifestDirectory, path).split(sep).join('/');\n return value || '.';\n}\n\n/**\n * Select all payload files and schema variants.\n *\n * @param entry - Manifest entry\n * @returns Payload references\n */\nfunction payloadReferences(entry: CustomFunctionManifestEntry): PayloadReference[] {\n const variant = (\n payloadType: 'DATA_POINT' | 'REQUEST_ENRICHER' | undefined,\n ): PayloadReference['type'] => {\n if (entry.type !== 'DSR') {\n return 'general';\n }\n return payloadType === 'REQUEST_ENRICHER' ? 'dsr-enricher' : 'dsr-datapoint';\n };\n if (entry['test-payload']) {\n return [\n {\n entry,\n path: entry['test-payload'],\n type: variant(entry['test-payload-type']),\n },\n ];\n }\n return (entry['test-payloads'] ?? []).map((item) => ({\n entry,\n path: item.payload,\n type: variant(item['payload-type']),\n }));\n}\n\n/**\n * Select export expectations from the registered fixtures.\n *\n * @param entry - Manifest entry\n * @param manifestDirectory - Manifest directory\n * @returns Source reference\n */\nfunction sourceReference(\n entry: CustomFunctionManifestEntry,\n manifestDirectory: string,\n): SourceReference {\n const payloadTypes = payloadReferences(entry).map(({ type }) => type);\n const dsrWithoutPayloads = entry.type === 'DSR' && payloadTypes.length === 0;\n return {\n entry,\n path: resolve(manifestDirectory, entry.code),\n needsDefault: entry.type !== 'DSR' || payloadTypes.includes('dsr-datapoint'),\n needsEnricher: payloadTypes.includes('dsr-enricher'),\n needsAnyDsrExport: dsrWithoutPayloads,\n };\n}\n\n/**\n * Compile published payload schemas.\n *\n * @returns Validators by local variant\n */\nfunction buildPayloadValidators(): Record<PayloadReference['type'], ValidateFunction> {\n const ajv = new Ajv({ allErrors: true, strict: false });\n return {\n general: ajv.compile(GENERAL_CUSTOM_FUNCTION_PAYLOAD_SCHEMA),\n 'dsr-datapoint': ajv.compile(DSR_DATAPOINT_CUSTOM_FUNCTION_PAYLOAD_SCHEMA),\n 'dsr-enricher': ajv.compile(DSR_REQUEST_ENRICHER_CUSTOM_FUNCTION_PAYLOAD_SCHEMA),\n };\n}\n\n/**\n * Format one Ajv failure.\n *\n * @param error - Ajv error\n * @returns Concise path and message\n */\nfunction formatSchemaError(error: ErrorObject): string {\n return `${error.instancePath || '/'} ${error.message ?? 'is invalid'}`;\n}\n\n/**\n * Validate referenced source and payload files without invoking Deno.\n *\n * @param context - CLI context\n * @param manifestDirectory - Manifest directory\n * @param entries - Parsed manifest entries\n * @param diagnostics - Result collection\n * @returns Existing source and format paths\n */\nfunction validateReferencedFiles(\n context: LocalContext,\n manifestDirectory: string,\n entries: readonly CustomFunctionManifestEntry[],\n diagnostics: CustomFunctionDiagnostic[],\n): {\n /** Existing source references. */\n sources: SourceReference[];\n /** Existing payload paths. */\n payloadPaths: string[];\n} {\n const validators = buildPayloadValidators();\n const sources: SourceReference[] = [];\n const payloadPaths: string[] = [];\n entries.forEach((entry) => {\n if (/<<parameters\\.[^>]+>>/u.test(entry.code)) {\n addError(diagnostics, {\n code: 'manifest.unresolved-code-path',\n message: 'Code paths cannot contain unresolved parameter placeholders.',\n path: entry.code,\n functionName: entry.name,\n });\n } else if (isCustomFunctionManifestPathContained(entry.code)) {\n const source = sourceReference(entry, manifestDirectory);\n if (!context.fs.existsSync(source.path)) {\n addError(diagnostics, {\n code: 'source.missing',\n message: 'Referenced source file does not exist.',\n path: entry.code,\n functionName: entry.name,\n });\n } else if (!isPathPhysicallyContained(context, manifestDirectory, source.path)) {\n addError(diagnostics, {\n code: 'source.outside-project',\n message: 'Referenced source resolves outside the manifest directory through a symlink.',\n path: entry.code,\n functionName: entry.name,\n });\n } else if (!context.fs.statSync(source.path).isFile()) {\n addError(diagnostics, {\n code: 'source.not-file',\n message: 'Referenced source path is not a regular file.',\n path: entry.code,\n functionName: entry.name,\n });\n } else {\n sources.push(source);\n }\n }\n\n payloadReferences(entry).forEach((reference) => {\n if (/<<parameters\\.[^>]+>>/u.test(reference.path)) {\n addError(diagnostics, {\n code: 'manifest.unresolved-payload-path',\n message: 'Payload paths cannot contain unresolved parameter placeholders.',\n path: reference.path,\n functionName: entry.name,\n });\n return;\n }\n const payloadPath = resolve(manifestDirectory, reference.path);\n if (!context.fs.existsSync(payloadPath)) {\n addError(diagnostics, {\n code: 'payload.missing',\n message: 'Referenced test payload does not exist.',\n path: reference.path,\n functionName: entry.name,\n });\n return;\n }\n if (!isPathPhysicallyContained(context, manifestDirectory, payloadPath)) {\n addError(diagnostics, {\n code: 'payload.outside-project',\n message:\n 'Referenced test payload resolves outside the manifest directory through a symlink.',\n path: reference.path,\n functionName: entry.name,\n });\n return;\n }\n if (!context.fs.statSync(payloadPath).isFile()) {\n addError(diagnostics, {\n code: 'payload.not-file',\n message: 'Referenced test payload is not a regular file.',\n path: reference.path,\n functionName: entry.name,\n });\n return;\n }\n payloadPaths.push(payloadPath);\n let payload: unknown;\n try {\n payload = JSON.parse(context.fs.readFileSync(payloadPath, 'utf8'));\n } catch (error) {\n addError(diagnostics, {\n code: 'payload.invalid-json',\n message: `Invalid JSON: ${(error as Error).message}`,\n path: reference.path,\n functionName: entry.name,\n });\n return;\n }\n const validate = validators[reference.type];\n if (!validate(payload)) {\n (validate.errors ?? []).forEach((error) =>\n addError(diagnostics, {\n code: 'payload.schema',\n message: formatSchemaError(error),\n path: reference.path,\n functionName: entry.name,\n }),\n );\n }\n });\n });\n return {\n sources,\n payloadPaths: [...new Set(payloadPaths)],\n };\n}\n\n/**\n * Read Deno's JSON documentation output for exported names.\n *\n * @param output - `deno doc --json` output\n * @returns Exported names\n */\nfunction exportedNames(output: string): Set<string> {\n try {\n const document = JSON.parse(output) as unknown;\n const nodes = Array.isArray(document)\n ? document\n : document &&\n typeof document === 'object' &&\n Array.isArray((document as Record<string, unknown>).nodes)\n ? ((document as Record<string, unknown>).nodes as unknown[])\n : undefined;\n if (!nodes) {\n return new Set();\n }\n return new Set(\n nodes.flatMap((node) => {\n if (!node || typeof node !== 'object') {\n return [];\n }\n const name = (node as Record<string, unknown>).name;\n return typeof name === 'string' ? [name] : [];\n }),\n );\n } catch {\n return new Set();\n }\n}\n\n/**\n * Choose the Deno formatter extension for stdin.\n *\n * @param path - Source path\n * @returns Deno extension\n */\nfunction denoExtension(path: string): string {\n switch (extname(path)) {\n case '.ts':\n case '.tsx':\n return 'ts';\n case '.json':\n case '.jsonc':\n return 'json';\n case '.yaml':\n case '.yml':\n return 'yaml';\n default:\n return 'ts';\n }\n}\n\n/**\n * Resolve the import-map input supported by `deno doc`.\n *\n * Deno 2.4 does not expose `--config` for `doc`. A full `deno.json` is not a\n * valid import map when it also has `tasks`, `lint`, `fmt`, or\n * `compilerOptions`, so inline `imports` / `scopes` are passed as a data URL.\n * An `importMap` reference is followed explicitly.\n *\n * @param context - CLI context\n * @param manifestDirectory - Approved project root\n * @param configPath - Selected Deno config\n * @returns Import map path or URL\n */\nfunction resolveDocImportMap(\n context: LocalContext,\n manifestDirectory: string,\n configPath: string | undefined,\n): string | undefined {\n if (!configPath) {\n return undefined;\n }\n const config = parseJsonc(context.fs.readFileSync(configPath, 'utf8')) as {\n /** Optional separate import map. */\n importMap?: unknown;\n /** Inline import map entries. */\n imports?: unknown;\n /** Inline import map scopes. */\n scopes?: unknown;\n };\n if (typeof config?.importMap === 'string') {\n if (/^[a-z][a-z\\d+.-]*:/iu.test(config.importMap)) {\n return config.importMap;\n }\n const importMapPath = resolve(dirname(configPath), config.importMap);\n assertPathPhysicallyContained(context, manifestDirectory, importMapPath);\n return importMapPath;\n }\n const importMap: {\n /** Bare-specifier remappings. */\n imports?: unknown;\n /** Scoped remappings. */\n scopes?: unknown;\n } = {};\n if (config.imports !== undefined) {\n importMap.imports = config.imports;\n }\n if (config.scopes !== undefined) {\n importMap.scopes = config.scopes;\n }\n if (Object.keys(importMap).length === 0) {\n return undefined;\n }\n return `data:application/json,${encodeURIComponent(JSON.stringify(importMap))}`;\n}\n\n/**\n * Render deterministic formatter patches without changing files.\n *\n * @param context - CLI context\n * @param runner - Process runner\n * @param manifestDirectory - Working directory\n * @param configArgs - Deno config arguments\n * @param paths - Target files\n * @returns Unified patches and transactional file changes\n */\nasync function buildFormatPlan(\n context: LocalContext,\n runner: CapturedProcessRunner,\n manifestDirectory: string,\n configArgs: readonly string[],\n paths: readonly string[],\n): Promise<{ patch: string; changes: PlannedFileChange[] }> {\n const patches: string[] = [];\n const changes: PlannedFileChange[] = [];\n for (const path of paths) {\n assertPathPhysicallyContained(context, manifestDirectory, path);\n const before = context.fs.readFileSync(path, 'utf8');\n const result = await runner(\n 'deno',\n ['fmt', ...configArgs, `--ext=${denoExtension(path)}`, '-'],\n { cwd: manifestDirectory, input: before },\n context,\n );\n if (result.code !== 0) {\n throw new Error(\n `Deno could not preview formatting for ${relativePath(manifestDirectory, path)}.${\n result.stderr.trim() ? `\\n${result.stderr.trim()}` : ''\n }`,\n );\n }\n if (result.stdout !== before) {\n const display = relativePath(manifestDirectory, path);\n patches.push(\n createTwoFilesPatch(display, display, before, result.stdout, '', '', { context: 3 }),\n );\n changes.push({\n kind: 'file',\n path,\n before,\n after: result.stdout,\n description: `Format ${display}`,\n mode: context.fs.statSync(path).mode,\n });\n }\n }\n return { patch: patches.join('\\n'), changes };\n}\n\n/**\n * Record one Deno command failure.\n *\n * @param diagnostics - Result collection\n * @param code - Stable code\n * @param message - Summary\n * @param result - Captured process result\n */\nfunction recordDenoFailure(\n diagnostics: CustomFunctionDiagnostic[],\n code: string,\n message: string,\n result: CapturedProcessResult,\n): void {\n addError(diagnostics, {\n code,\n message: `${message}${result.stderr.trim() ? `\\n${result.stderr.trim()}` : ''}`,\n });\n}\n\n/**\n * Run credential-free local validation without executing user modules.\n *\n * @param context - CLI context\n * @param options - Manifest and format behavior\n * @param runner - Captured process runner\n * @returns Stable check result\n */\nexport async function runCustomFunctionChecks(\n context: LocalContext,\n options: RunCustomFunctionChecksOptions,\n runner: CapturedProcessRunner = runCapturedProcess,\n): Promise<CustomFunctionCheckResult> {\n const manifestPath = resolve(options.manifestPath);\n const manifestDirectory = dirname(manifestPath);\n const diagnostics: CustomFunctionDiagnostic[] = [];\n const statuses = new Map<string, CustomFunctionCheckStatus>([\n ['manifest', 'passed'],\n ['files', 'passed'],\n ['payloads', 'passed'],\n ['runtime', 'passed'],\n ['exports', 'passed'],\n ['typecheck', 'passed'],\n ['lint', 'passed'],\n ['format', 'passed'],\n ]);\n const buildResult = (): CustomFunctionCheckResult => ({\n version: CUSTOM_FUNCTION_RESULT_VERSION,\n status: diagnostics.some(({ severity }) => severity === 'error') ? 'failed' : 'passed',\n manifestPath,\n checks: [...statuses].map(([name, status]) => ({ name, status })),\n diagnostics,\n });\n if (!context.fs.existsSync(manifestPath)) {\n addError(diagnostics, {\n code: 'manifest.missing',\n message: 'Custom Function manifest does not exist.',\n path: relativePath(context.process.cwd(), manifestPath),\n });\n statuses.set('manifest', 'failed');\n ['files', 'payloads', 'runtime', 'exports', 'typecheck', 'lint', 'format'].forEach((name) =>\n statuses.set(name, 'skipped'),\n );\n return buildResult();\n }\n\n let entries: readonly CustomFunctionManifestEntry[] = [];\n try {\n const manifestContents = replaceVariablesInYaml(\n context.fs.readFileSync(manifestPath, 'utf8'),\n options.variables ?? {},\n );\n entries = parseCustomFunctionsManifest(manifestContents).functions;\n } catch (error) {\n addError(diagnostics, {\n code: 'manifest.invalid',\n message: (error as Error).message,\n path: relativePath(manifestDirectory, manifestPath),\n });\n statuses.set('manifest', 'failed');\n ['files', 'payloads', 'runtime', 'exports', 'typecheck', 'lint', 'format'].forEach((name) =>\n statuses.set(name, 'skipped'),\n );\n return buildResult();\n }\n entries.forEach((entry) => {\n try {\n validateCustomFunctionExecutionContext({\n ...(entry.env ? { env: entry.env } : {}),\n ...(entry['allowed-hosts'] ? { allowedHosts: entry['allowed-hosts'] } : {}),\n });\n } catch (error) {\n statuses.set('manifest', 'failed');\n addError(diagnostics, {\n code: 'manifest.execution-context',\n message: (error as Error).message,\n path: relativePath(manifestDirectory, manifestPath),\n functionName: entry.name,\n });\n }\n });\n\n const { sources, payloadPaths } = validateReferencedFiles(\n context,\n manifestDirectory,\n entries,\n diagnostics,\n );\n if (\n diagnostics.some(({ code }) =>\n ['source.', 'manifest.unresolved-code-path'].some((prefix) => code.startsWith(prefix)),\n )\n ) {\n statuses.set('files', 'failed');\n ['exports', 'typecheck', 'lint'].forEach((name) => statuses.set(name, 'failed'));\n }\n if (\n diagnostics.some(({ code }) =>\n ['payload.', 'manifest.unresolved-payload-path'].some((prefix) => code.startsWith(prefix)),\n )\n ) {\n statuses.set('payloads', 'failed');\n }\n\n const denoJsonc = join(manifestDirectory, 'deno.jsonc');\n const denoJson = join(manifestDirectory, 'deno.json');\n const configPath = context.fs.existsSync(denoJsonc)\n ? denoJsonc\n : context.fs.existsSync(denoJson)\n ? denoJson\n : undefined;\n const unsafeConfig =\n configPath !== undefined && !isPathPhysicallyContained(context, manifestDirectory, configPath);\n let unsafeConfiguration = unsafeConfig;\n let docImportMap: string | undefined;\n if (unsafeConfig) {\n addError(diagnostics, {\n code: 'deno.config-outside-project',\n message: 'Deno configuration resolves outside the manifest directory through a symlink.',\n path: relativePath(manifestDirectory, configPath),\n });\n ['exports', 'typecheck', 'lint', 'format'].forEach((name) => statuses.set(name, 'failed'));\n } else {\n try {\n docImportMap = resolveDocImportMap(context, manifestDirectory, configPath);\n } catch (error) {\n unsafeConfiguration = true;\n addError(diagnostics, {\n code: 'deno.import-map-outside-project',\n message: (error as Error).message,\n });\n ['exports', 'typecheck', 'lint', 'format'].forEach((name) => statuses.set(name, 'failed'));\n }\n }\n const configArgs =\n configPath && !unsafeConfiguration ? [`--config=${configPath}`] : ['--no-config'];\n const skipPendingDenoChecks = (): void => {\n ['exports', 'typecheck', 'lint', 'format'].forEach((name) => {\n if (statuses.get(name) !== 'failed') {\n statuses.set(name, 'skipped');\n }\n });\n };\n const denoVersion = await runner('deno', ['--version'], { cwd: manifestDirectory }, context);\n const compatibility =\n denoVersion.code === 0 ? getDenoRuntimeCompatibility(denoVersion.stdout) : undefined;\n if (compatibility?.level === 'warning') {\n diagnostics.push({\n code: 'deno.version-mismatch',\n severity: 'warning',\n message: compatibility.message,\n });\n }\n if (denoVersion.error?.code === 'ENOENT') {\n statuses.set('runtime', 'failed');\n skipPendingDenoChecks();\n addError(diagnostics, {\n code: 'deno.missing',\n message: `Deno ${SUPPORTED_DENO_MAJOR_VERSION}.x is required for export, type, lint, and format checks. Install it from ${DENO_INSTALL_URL}`,\n });\n } else if (denoVersion.code !== 0) {\n statuses.set('runtime', 'failed');\n skipPendingDenoChecks();\n recordDenoFailure(diagnostics, 'deno.unavailable', 'Deno could not be started.', denoVersion);\n } else if (compatibility?.level === 'error') {\n statuses.set('runtime', 'failed');\n skipPendingDenoChecks();\n addError(diagnostics, {\n code: 'deno.unsupported-version',\n message: compatibility.message,\n });\n } else if (!unsafeConfiguration) {\n for (const source of sources) {\n const moduleGraph = await runner(\n 'deno',\n ['info', '--json', ...configArgs, source.path],\n { cwd: manifestDirectory },\n context,\n );\n if (moduleGraph.code !== 0) {\n statuses.set('files', 'failed');\n recordDenoFailure(\n diagnostics,\n 'source.module-graph',\n `Could not inspect runtime imports for ${relativePath(manifestDirectory, source.path)}.`,\n moduleGraph,\n );\n } else {\n try {\n const unsupportedImports = findNonSelfContainedRuntimeImports(moduleGraph.stdout);\n if (unsupportedImports.length > 0) {\n statuses.set('files', 'failed');\n addError(diagnostics, {\n code: 'source.local-runtime-import',\n message:\n 'Custom Functions must be self-contained. Local or import-map runtime dependencies are not deployed: ' +\n unsupportedImports.join(', '),\n path: relativePath(manifestDirectory, source.path),\n functionName: source.entry.name,\n });\n }\n } catch (error) {\n statuses.set('files', 'failed');\n addError(diagnostics, {\n code: 'source.module-graph',\n message: (error as Error).message,\n path: relativePath(manifestDirectory, source.path),\n functionName: source.entry.name,\n });\n }\n }\n const result = await runner(\n 'deno',\n ['doc', '--json', ...(docImportMap ? ['--import-map', docImportMap] : []), source.path],\n { cwd: manifestDirectory },\n context,\n );\n if (result.code !== 0) {\n statuses.set('exports', 'failed');\n recordDenoFailure(\n diagnostics,\n 'exports.inspect',\n `Could not inspect exports for ${relativePath(manifestDirectory, source.path)}.`,\n result,\n );\n continue;\n }\n const names = exportedNames(result.stdout);\n if (source.needsDefault && !names.has('default')) {\n statuses.set('exports', 'failed');\n addError(diagnostics, {\n code: 'exports.default-missing',\n message: 'The manifest fixtures require a default export.',\n path: relativePath(manifestDirectory, source.path),\n functionName: source.entry.name,\n });\n }\n if (source.needsEnricher && !names.has('enricher')) {\n statuses.set('exports', 'failed');\n addError(diagnostics, {\n code: 'exports.enricher-missing',\n message: 'A REQUEST_ENRICHER fixture requires an `enricher` export.',\n path: relativePath(manifestDirectory, source.path),\n functionName: source.entry.name,\n });\n }\n if (source.needsAnyDsrExport && !names.has('default') && !names.has('enricher')) {\n statuses.set('exports', 'failed');\n addError(diagnostics, {\n code: 'exports.dsr-missing',\n message: 'A DSR Custom Function requires a `default` or `enricher` export.',\n path: relativePath(manifestDirectory, source.path),\n functionName: source.entry.name,\n });\n }\n }\n\n const sourcePaths = [...new Set(sources.map(({ path }) => path))];\n if (sourcePaths.length > 0) {\n const typecheck = await runner(\n 'deno',\n ['check', ...configArgs, ...sourcePaths],\n { cwd: manifestDirectory },\n context,\n );\n if (typecheck.code !== 0) {\n statuses.set('typecheck', 'failed');\n recordDenoFailure(diagnostics, 'deno.typecheck', 'Deno type checking failed.', typecheck);\n }\n const lint = await runner(\n 'deno',\n ['lint', ...configArgs, ...sourcePaths],\n { cwd: manifestDirectory },\n context,\n );\n if (lint.code !== 0) {\n statuses.set('lint', 'failed');\n recordDenoFailure(diagnostics, 'deno.lint', 'Deno linting failed.', lint);\n }\n }\n\n const formatPaths = [\n ...sourcePaths,\n ...payloadPaths,\n manifestPath,\n ...(configPath ? [configPath] : []),\n ...(docImportMap && docImportMap !== configPath && !/^[a-z][a-z\\d+.-]*:/iu.test(docImportMap)\n ? [docImportMap]\n : []),\n ];\n formatPaths.forEach((path) => assertPathPhysicallyContained(context, manifestDirectory, path));\n const format = await runner(\n 'deno',\n ['fmt', '--check', ...configArgs, ...formatPaths],\n { cwd: manifestDirectory },\n context,\n );\n if (format.code !== 0) {\n let formatPlan: Awaited<ReturnType<typeof buildFormatPlan>>;\n try {\n formatPlan = await buildFormatPlan(\n context,\n runner,\n manifestDirectory,\n configArgs,\n formatPaths,\n );\n } catch (error) {\n statuses.set('format', 'failed');\n addError(diagnostics, {\n code: 'deno.format-preview',\n message: (error as Error).message,\n });\n return buildResult();\n }\n if (formatPlan.changes.length === 0) {\n statuses.set('format', 'failed');\n recordDenoFailure(\n diagnostics,\n 'deno.format',\n 'Deno reported a formatting failure but did not produce a repair.',\n format,\n );\n return buildResult();\n }\n const shouldFix =\n options.fix ||\n (options.confirmFormat ? await options.confirmFormat(formatPlan.patch) : false);\n if (shouldFix) {\n try {\n await applyProjectPlan(context, {\n rootDirectory: manifestDirectory,\n changes: formatPlan.changes,\n });\n } catch (error) {\n statuses.set('format', 'failed');\n addError(diagnostics, {\n code: 'deno.format-fix',\n message: `Could not apply formatting transaction: ${(error as Error).message}`,\n });\n }\n } else {\n statuses.set('format', 'failed');\n formatPlan.changes.forEach((change, index) => {\n addError(diagnostics, {\n code: 'deno.format',\n message:\n 'Referenced file is not formatted.' +\n (index === 0 && options.includeFormatPatchInDiagnostics && formatPlan.patch\n ? `\\n${formatPlan.patch}`\n : ''),\n path: relativePath(manifestDirectory, change.path),\n });\n });\n }\n }\n }\n\n return buildResult();\n}\n","import colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { formatMissingManifestMessage } from '../../../lib/custom-functions/missing-manifest.js';\nimport { resolveCustomFunctionProjectPaths } from '../../../lib/custom-functions/paths.js';\nimport { discoverCustomFunctionManifests } from '../../../lib/custom-functions/project-discovery.js';\nimport { parseVariablesFromString } from '../../../lib/helpers/parseVariablesFromString.js';\nimport {\n isInteractivePromptInvocation,\n PromptCancelledError,\n ScaffoldPrompts,\n} from '../../../lib/scaffolding/prompts.js';\nimport { runCustomFunctionChecks } from './helpers.js';\n\n/** CLI flags for `transcend custom-functions check`. */\nexport interface CustomFunctionsCheckFlags {\n /** Explicit manifest path. */\n manifest?: string;\n /** Manifest variable substitutions. */\n variables: string;\n /** Apply Deno formatting. */\n fix: boolean;\n /** Disable prompts. */\n noInteractive: boolean;\n /** Emit JSON on stdout. */\n json: boolean;\n}\n\n/**\n * Validate a local Custom Function project without credentials.\n *\n * @param this - CLI context\n * @param flags - Check and interaction flags\n * @param directory - Optional target directory\n */\nexport async function check(\n this: LocalContext,\n flags: CustomFunctionsCheckFlags,\n directory?: string,\n): Promise<void> {\n doneInputValidation(this.process);\n const { manifestPath } = resolveCustomFunctionProjectPaths(this.process.cwd(), {\n ...(directory ? { directory } : {}),\n ...(flags.manifest ? { manifest: flags.manifest } : {}),\n });\n const missingMessage = this.fs.existsSync(manifestPath)\n ? undefined\n : formatMissingManifestMessage({\n cwd: this.process.cwd(),\n manifestPath,\n discoveredManifestPaths: discoverCustomFunctionManifests(this, this.process.cwd()),\n command: 'check',\n });\n const interactive = isInteractivePromptInvocation(\n flags,\n this.process.stdin.isTTY,\n this.process.stderr.isTTY,\n );\n const prompts = new ScaffoldPrompts(this);\n try {\n const result = await runCustomFunctionChecks(this, {\n manifestPath,\n variables: parseVariablesFromString(flags.variables),\n fix: flags.fix,\n includeFormatPatchInDiagnostics: !flags.json,\n ...(interactive && !flags.fix\n ? {\n confirmFormat: async (patch: string): Promise<boolean> => {\n if (patch) {\n this.logger.error(patch);\n }\n return prompts.confirm('Format the files shown above?', true);\n },\n }\n : {}),\n });\n if (missingMessage) {\n result.diagnostics.forEach((diagnostic) => {\n if (diagnostic.code === 'manifest.missing') {\n diagnostic.message = missingMessage;\n }\n });\n }\n if (flags.json) {\n this.process.stdout.write(`${JSON.stringify(result)}\\n`);\n } else {\n this.logger.info(`${colors.bold('Custom Function checks')}\\n`);\n result.checks.forEach(({ name, status }) => {\n const label = status === 'passed' ? 'PASS' : status === 'failed' ? 'FAIL' : 'SKIP';\n const styledLabel =\n status === 'passed'\n ? colors.green(label)\n : status === 'failed'\n ? colors.red(label)\n : colors.yellow(label);\n this.logger.info(`${styledLabel} ${name[0]!.toUpperCase()}${name.slice(1)}`);\n });\n if (result.diagnostics.length > 0) {\n this.logger.error('');\n }\n result.diagnostics.forEach((diagnostic) => {\n const location = diagnostic.path ? `${diagnostic.path}: ` : '';\n const owner = diagnostic.functionName ? `[${diagnostic.functionName}] ` : '';\n const message = `${diagnostic.severity}: ${location}${owner}${diagnostic.message}`;\n if (diagnostic.severity === 'warning') {\n this.logger.warn(colors.yellow(message));\n } else {\n this.logger.error(colors.red(message));\n }\n });\n if (result.status === 'passed') {\n this.logger.info('');\n this.logger.info(colors.green('Custom Function checks passed.'));\n } else {\n this.logger.error('');\n this.logger.error(colors.red('Custom Function checks failed.'));\n }\n }\n if (result.status === 'failed') {\n this.process.exitCode = 1;\n }\n } catch (error) {\n if (error instanceof PromptCancelledError) {\n this.process.exit(130);\n }\n throw error;\n }\n}\n"],"mappings":"sjCAuFA,SAAS,EACP,EACA,EACM,CACN,EAAY,KAAK,CAAE,SAAU,QAAS,GAAG,EAAY,CAAC,CAUxD,SAAS,EAAa,EAA2B,EAAsB,CAErE,OADc,EAAS,EAAmB,EAAK,CAAC,MAAM,EAAI,CAAC,KAAK,IACpD,EAAI,IASlB,SAAS,EAAkB,EAAwD,CACjF,IAAM,EACJ,GAEI,EAAM,OAAS,MAGZ,IAAgB,mBAAqB,eAAiB,gBAFpD,UAaX,OATI,EAAM,gBACD,CACL,CACE,QACA,KAAM,EAAM,gBACZ,KAAM,EAAQ,EAAM,qBAAqB,CAC1C,CACF,EAEK,EAAM,kBAAoB,EAAE,EAAE,IAAK,IAAU,CACnD,QACA,KAAM,EAAK,QACX,KAAM,EAAQ,EAAK,gBAAgB,CACpC,EAAE,CAUL,SAAS,EACP,EACA,EACiB,CACjB,IAAM,EAAe,EAAkB,EAAM,CAAC,KAAK,CAAE,UAAW,EAAK,CAC/D,EAAqB,EAAM,OAAS,OAAS,EAAa,SAAW,EAC3E,MAAO,CACL,QACA,KAAM,EAAQ,EAAmB,EAAM,KAAK,CAC5C,aAAc,EAAM,OAAS,OAAS,EAAa,SAAS,gBAAgB,CAC5E,cAAe,EAAa,SAAS,eAAe,CACpD,kBAAmB,EACpB,CAQH,SAAS,GAA6E,CACpF,IAAM,EAAM,IAAI,EAAI,CAAE,UAAW,GAAM,OAAQ,GAAO,CAAC,CACvD,MAAO,CACL,QAAS,EAAI,QAAQ,EAAuC,CAC5D,gBAAiB,EAAI,QAAQ,EAA6C,CAC1E,eAAgB,EAAI,QAAQ,EAAoD,CACjF,CASH,SAAS,EAAkB,EAA4B,CACrD,MAAO,GAAG,EAAM,cAAgB,IAAI,GAAG,EA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,IAAM,GACpE,EAAU,GAAG,EAAW,SAAS,IAAI,IAAW,IAAQ,EAAW,UACrE,EAAW,WAAa,UAC1B,KAAK,OAAO,KAAK,EAAO,OAAO,EAAQ,CAAC,CAExC,KAAK,OAAO,MAAM,EAAO,IAAI,EAAQ,CAAC,EAExC,CACE,EAAO,SAAW,UACpB,KAAK,OAAO,KAAK,GAAG,CACpB,KAAK,OAAO,KAAK,EAAO,MAAM,iCAAiC,CAAC,GAEhE,KAAK,OAAO,MAAM,GAAG,CACrB,KAAK,OAAO,MAAM,EAAO,IAAI,iCAAiC,CAAC,GAG/D,EAAO,SAAW,WACpB,KAAK,QAAQ,SAAW,SAEnB,EAAO,CAId,MAHI,aAAiB,GACnB,KAAK,QAAQ,KAAK,IAAI,CAElB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{g as e}from"./constants-BlKpAm3R.mjs";import{r as t,t as n}from"./project-plan-output-BHHlkLxe.mjs";import{t as r}from"./project-discovery-CWRjlFnC.mjs";import{t as i}from"./done-input-validation-LiTaCEzF.mjs";import{n as a}from"./project-discovery-BkHpTXDx.mjs";import{i as o,n as s,r as c,t as l}from"./prompts-BhXfYD6g.mjs";import{t as u}from"./run-captured-process-BjaSDWXG.mjs";import{r as d,t as f}from"./deno-runtime-CB2HBach.mjs";import{t as p}from"./scaffold-model-CUZER0BC.mjs";import{t as m}from"./project-plan-apply-Bg_1eMX9.mjs";import{c as h,i as g,n as _,s as v}from"./scaffold-planning-CaetLfv8.mjs";import y from"colors";import{CUSTOM_FUNCTION_TYPES_VERSION as b}from"@transcend-io/custom-function-types";const x={[p.Deno]:`Deno configuration`,[p.Editor]:`VS Code settings`,[p.Skill]:`Agent skill`,[p.Ci]:`GitHub Actions`},S=Object.values(p);async function C(C,w){i(this.process);try{let i=a(this,{...w?{directory:w}:{},...C.manifest?{manifest:C.manifest}:{}}),l=new s(this),T=c(C,this.process.stdin.isTTY,this.process.stderr.isTTY),E=await o(l,{features:S,labels:x,enabled:{[p.Deno]:C.deno,[p.Editor]:C.editor,[p.Skill]:C.skill,[p.Ci]:C.ci},interactive:T}),D=_({state:i,snapshots:r(this,i.projectRoot,g(i,{features:E})),contractVersion:b,cliVersion:e},{features:E});if(E.includes(p.Deno)){let e=await u(`deno`,[`--version`],{cwd:this.process.cwd()},this);if(e.error?.code===`ENOENT`)D.warnings.push(`Deno 2.x is not installed. Install it from ${f}`);else if(e.code!==0)D.warnings.push(`Deno was found, but its version could not be determined. Deno 2.x is required. See ${f}`);else{let t=d(e.stdout);t.level!==`compatible`&&D.warnings.push(t.message)}}C.json||this.logger.info(t(D,{cwd:this.process.cwd(),title:`Custom Function plan`,details:[{label:`Target`,path:D.targetDirectory},{label:`Manifest`,path:D.manifestPath}]}));let O=D.changes.length===0||C.dryRun;if(D.changes.length>0&&!C.dryRun)if(C.yes)O=!0;else if(T)O=await l.confirm(`Apply this complete plan?`,!0);else throw Error(`The plan requires approval in a non-interactive invocation. Review with --dryRun, then pass --yes.`);O&&!C.dryRun&&D.changes.length>0&&await m(this,D);let k=O&&!C.dryRun&&D.changes.length>0,A=O&&!C.dryRun,j=h({targetDirectory:n(this.process.cwd(),i.targetDirectory),manifestPath:n(this.process.cwd(),i.manifestPath),cliVersion:e,hasSkill:A&&E.includes(p.Skill),hasGithubWorkflow:A&&E.includes(p.Ci)&&!!(i.repositoryRoot&&i.usesGithub)}),M=v(D,{applied:k,dryRun:C.dryRun,cwd:this.process.cwd(),aiHandoff:j});if(C.json){this.process.stdout.write(`${JSON.stringify(M)}\n`);return}if(C.dryRun){this.logger.info(y.yellow(`Dry run complete. No changes were written.`));return}if(!O){this.logger.info(y.yellow(`No changes applied.`));return}if(D.changes.length===0){this.logger.info(y.green(`Custom Function project is already initialized.`));return}this.logger.info(y.green(`Custom Function project initialized.`)),D.nextSteps.length>0&&(this.logger.info(`\n${y.bold(`Next steps`)}`),D.nextSteps.forEach(e=>this.logger.info(e))),this.logger.info(`\n${y.bold(`AI handoff — paste into your coding agent`)}`),this.logger.info(j)}catch(e){throw e instanceof l&&this.process.exit(130),e}}export{C as init};
|
|
2
|
+
//# sourceMappingURL=impl-BxvKe9_7.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impl-BxvKe9_7.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 isInteractivePromptInvocation,\n PromptCancelledError,\n resolveSetupFeatures,\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 * 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 = isInteractivePromptInvocation(\n flags,\n this.process.stdin.isTTY,\n this.process.stderr.isTTY,\n );\n const features = await resolveSetupFeatures(prompts, {\n features: ALL_SETUP_FEATURES,\n labels: SETUP_LABELS,\n enabled: {\n [CustomFunctionSetupFeature.Deno]: flags.deno,\n [CustomFunctionSetupFeature.Editor]: flags.editor,\n [CustomFunctionSetupFeature.Skill]: flags.skill,\n [CustomFunctionSetupFeature.Ci]: flags.ci,\n },\n interactive,\n });\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":"ytBA2DA,MAAM,EAAyE,EAC5E,EAA2B,MAAO,sBAClC,EAA2B,QAAS,oBACpC,EAA2B,OAAQ,eACnC,EAA2B,IAAK,iBAClC,CAGK,EAAqB,OAAO,OAAO,EAA2B,CASpE,eAAsB,EAEpB,EACA,EACe,CACf,EAAoB,KAAK,QAAQ,CACjC,GAAI,CACF,IAAM,EAAQ,EAA8B,KAAM,CAChD,GAAI,EAAY,CAAE,YAAW,CAAG,EAAE,CAClC,GAAI,EAAM,SAAW,CAAE,SAAU,EAAM,SAAU,CAAG,EAAE,CACvD,CAAC,CACI,EAAU,IAAI,EAAgB,KAAK,CACnC,EAAc,EAClB,EACA,KAAK,QAAQ,MAAM,MACnB,KAAK,QAAQ,OAAO,MACrB,CACK,EAAW,MAAM,EAAqB,EAAS,CACnD,SAAU,EACV,OAAQ,EACR,QAAS,EACN,EAA2B,MAAO,EAAM,MACxC,EAA2B,QAAS,EAAM,QAC1C,EAA2B,OAAQ,EAAM,OACzC,EAA2B,IAAK,EAAM,GACxC,CACD,cACD,CAAC,CAMI,EAAO,EACX,CACE,QACA,UARc,EAChB,KACA,EAAM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,SAAS,EAA2B,MAAM,CAC/E,kBACE,GACA,EAAS,SAAS,EAA2B,GAAG,EAChD,GAAQ,EAAM,gBAAkB,EAAM,YACzC,CAAC,CACI,EAAS,EAAgB,EAAM,CACnC,UACA,OAAQ,EAAM,OACd,IAAK,KAAK,QAAQ,KAAK,CACvB,YACD,CAAC,CACF,GAAI,EAAM,KAAM,CACd,KAAK,QAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,EAAO,CAAC,IAAI,CACxD,OAEF,GAAI,EAAM,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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./streamPrivacyRequestsToCsv-
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
import{t as e}from"./streamPrivacyRequestsToCsv-ByRBG8Mb.mjs";import{t}from"./done-input-validation-LiTaCEzF.mjs";import n from"colors";async function r({auth:r,transcendUrl:i,file:a,pageLimit:o,concurrency:s,actions:c,sombraAuth:l,skipRequestIdentifiers:u,statuses:d,createdAtBefore:f,createdAtAfter:p,updatedAtBefore:m,updatedAtAfter:h,showTests:g}){t(this.process);let{filePaths:_,totalCount:v}=await e({transcendUrl:i,concurrency:s,pageLimit:o,actions:c,statuses:d,auth:r,sombraAuth:l,skipRequestIdentifiers:u,createdAtBefore:f,createdAtAfter:p,updatedAtBefore:m,updatedAtAfter:h,isTest:g,file:a});this.logger.info(n.green(`Successfully wrote ${v} requests to ${_.length} file(s): ${_.join(`, `)}`))}export{r as _export};
|
|
2
|
+
//# sourceMappingURL=impl-BzIyVAg_.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl-
|
|
1
|
+
{"version":3,"file":"impl-BzIyVAg_.mjs","names":[],"sources":["../src/commands/request/export/impl.ts"],"sourcesContent":["import type { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { streamPrivacyRequestsToCsv } from '../../../lib/requests/index.js';\n\nexport interface ExportCommandFlags {\n auth: string;\n sombraAuth?: string;\n actions?: RequestAction[];\n statuses?: RequestStatus[];\n transcendUrl: string;\n file: string;\n concurrency: number;\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n showTests?: boolean;\n skipRequestIdentifiers?: boolean;\n pageLimit: number;\n}\n\n// `export` is a reserved keyword, so we need to prefix it with an underscore\n// eslint-disable-next-line no-underscore-dangle\nexport async function _export(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n file,\n pageLimit,\n concurrency,\n actions,\n sombraAuth,\n skipRequestIdentifiers,\n statuses,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n showTests,\n }: ExportCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n const { filePaths, totalCount } = await streamPrivacyRequestsToCsv({\n transcendUrl,\n concurrency,\n pageLimit,\n actions,\n statuses,\n auth,\n sombraAuth,\n skipRequestIdentifiers,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n isTest: showTests,\n file,\n });\n\n this.logger.info(\n colors.green(\n `Successfully wrote ${totalCount} requests to ` +\n `${filePaths.length} file(s): ${filePaths.join(', ')}`,\n ),\n );\n}\n"],"mappings":"wIA0BA,eAAsB,EAEpB,CACE,OACA,eACA,OACA,YACA,cACA,UACA,aACA,yBACA,WACA,kBACA,iBACA,kBACA,iBACA,aAEa,CACf,EAAoB,KAAK,QAAQ,CAEjC,GAAM,CAAE,YAAW,cAAe,MAAM,EAA2B,CACjE,eACA,cACA,YACA,UACA,WACA,OACA,aACA,yBACA,kBACA,iBACA,kBACA,iBACA,OAAQ,EACR,OACD,CAAC,CAEF,KAAK,OAAO,KACV,EAAO,MACL,sBAAsB,EAAW,eAC5B,EAAU,OAAO,YAAY,EAAU,KAAK,KAAK,GACvD,CACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./constants-
|
|
2
|
-
//# sourceMappingURL=impl-
|
|
1
|
+
import{t as e}from"./constants-BlKpAm3R.mjs";import{t}from"./logger-CPu6zbyQ.mjs";import{n}from"./syncCodePackages-DJnrcX5l.mjs";import{t as r}from"./done-input-validation-LiTaCEzF.mjs";import{t as i}from"./constants-DC_bBO09.mjs";import a from"colors";import o from"fast-glob";import{getEntries as s}from"@transcend-io/type-utils";import{buildTranscendGraphQLClient as c}from"@transcend-io/sdk";import{execSync as l}from"child_process";async function u({scanPath:e,ignoreDirs:n=[],repositoryName:r}){return(await Promise.all(s(i).map(async([i,s])=>{let{ignoreDirs:c,supportedFiles:l,scanFunction:u}=s,d=[...n,...c].filter(e=>e.length>0);try{let n=await o(`${e}/**/${l.join(`|`)}`,{ignore:d.map(t=>`${e}/**/${t}`),unique:!0,onlyFiles:!0});t.info(a.magenta(`Scanning: ${n.length} files of type ${i}`));let s=n.map(t=>u(t).map(n=>({...n,relativePath:t.replace(`${e}/`,``)}))).flat();return t.info(a.green(`Found: ${s.length} packages and ${s.map(({softwareDevelopmentKits:e=[]})=>e).flat().length} sdks`)),s.map(e=>({...e,type:i,repositoryName:r}))}catch(e){throw Error(`Error scanning globs ${l} with error: ${e}`)}}))).flat()}const d=`A repository name must be provided. You can specify using --repositoryName=$REPO_NAME or by ensuring the command "git config --get remote.origin.url" returns the name of the repository`;async function f({auth:t,scanPath:i,ignoreDirs:o,repositoryName:s,transcendUrl:f}){r(this.process);let p=s;if(!p)try{let e=l(`cd ${i} && git config --get remote.origin.url`).toString(`utf-8`).trim();[p]=e.includes(`https:`)?e.split(`/`).slice(3).join(`/`).split(`.`):(e.split(`:`).pop()||``).split(`.`),p||(this.logger.error(a.red(d)),this.process.exit(1))}catch(e){this.logger.error(a.red(`${d} - Got error: ${e.message}`)),this.process.exit(1)}let m=c(f,t),h=await u({scanPath:i,ignoreDirs:o,repositoryName:p});await n(m,h);let g=new URL(e);g.pathname=`/code-scanning/code-packages`,this.logger.info(a.green(`Scan found ${h.length} packages at ${i}! View results at '${g.href}'`))}export{f as scanPackages};
|
|
2
|
+
//# sourceMappingURL=impl-C-PvYlFE.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impl-
|
|
1
|
+
{"version":3,"file":"impl-C-PvYlFE.mjs","names":[],"sources":["../src/lib/code-scanning/findCodePackagesInFolder.ts","../src/commands/inventory/scan-packages/impl.ts"],"sourcesContent":["import { getEntries } from '@transcend-io/type-utils';\nimport colors from 'colors';\nimport fastGlob from 'fast-glob';\n\nimport { CodePackageInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { CODE_SCANNING_CONFIGS } from './constants.js';\n\n/**\n * Helper to scan and discovery all of the code packages within a folder\n *\n * @param options - Options\n * @returns the list of integrations\n */\nexport async function findCodePackagesInFolder({\n scanPath,\n ignoreDirs = [],\n repositoryName,\n}: {\n /** The name of the github repository reporting packages for */\n repositoryName: string;\n /** Where to look for package.json files */\n scanPath: string;\n /** The directories to ignore (excludes node_modules and serverless-build) */\n ignoreDirs?: string[];\n}): Promise<CodePackageInput[]> {\n const allCodePackages = await Promise.all(\n getEntries(CODE_SCANNING_CONFIGS).map(async ([codePackageType, config]) => {\n const { ignoreDirs: configIgnoreDirs, supportedFiles, scanFunction } = config;\n const dirsToIgnore = [...ignoreDirs, ...configIgnoreDirs].filter((dir) => dir.length > 0);\n try {\n const filesToScan: string[] = await fastGlob(`${scanPath}/**/${supportedFiles.join('|')}`, {\n ignore: dirsToIgnore.map((dir: string) => `${scanPath}/**/${dir}`),\n unique: true,\n onlyFiles: true,\n });\n logger.info(\n colors.magenta(`Scanning: ${filesToScan.length} files of type ${codePackageType}`),\n );\n const allPackages = filesToScan\n .map((filePath) =>\n scanFunction(filePath).map((result) => ({\n ...result,\n relativePath: filePath.replace(`${scanPath}/`, ''),\n })),\n )\n .flat();\n logger.info(\n colors.green(\n `Found: ${allPackages.length} packages and ${\n allPackages.map(({ softwareDevelopmentKits = [] }) => softwareDevelopmentKits).flat()\n .length\n } sdks`,\n ),\n );\n\n return allPackages.map(\n (pkg): CodePackageInput => ({\n ...pkg,\n type: codePackageType,\n repositoryName,\n }),\n );\n } catch (error) {\n throw new Error(`Error scanning globs ${supportedFiles} with error: ${error}`);\n }\n }),\n );\n\n return allCodePackages.flat();\n}\n","import { execSync } from 'child_process';\n\nimport { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport colors from 'colors';\n\nimport { ADMIN_DASH } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { findCodePackagesInFolder } from '../../../lib/code-scanning/index.js';\nimport { syncCodePackages } from '../../../lib/graphql/index.js';\n\nconst REPO_ERROR =\n 'A repository name must be provided. ' +\n 'You can specify using --repositoryName=$REPO_NAME or by ensuring the ' +\n 'command \"git config --get remote.origin.url\" returns the name of the repository';\n\nexport interface ScanPackagesCommandFlags {\n auth: string;\n scanPath: string;\n ignoreDirs?: string[];\n repositoryName?: string;\n transcendUrl: string;\n}\n\nexport async function scanPackages(\n this: LocalContext,\n { auth, scanPath, ignoreDirs, repositoryName, transcendUrl }: ScanPackagesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n // Ensure repository name is specified\n let gitRepositoryName = repositoryName;\n if (!gitRepositoryName) {\n try {\n const name = execSync(`cd ${scanPath} && git config --get remote.origin.url`);\n // Trim and parse the URL\n const url = name.toString('utf-8').trim();\n [gitRepositoryName] = !url.includes('https:')\n ? (url.split(':').pop() || '').split('.')\n : url.split('/').slice(3).join('/').split('.');\n if (!gitRepositoryName) {\n this.logger.error(colors.red(REPO_ERROR));\n this.process.exit(1);\n }\n } catch (err) {\n this.logger.error(colors.red(`${REPO_ERROR} - Got error: ${err.message}`));\n this.process.exit(1);\n }\n }\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Scan the codebase to discovery packages\n const results = await findCodePackagesInFolder({\n scanPath,\n ignoreDirs,\n repositoryName: gitRepositoryName,\n });\n\n // Report scan to Transcend\n await syncCodePackages(client, results);\n\n const newUrl = new URL(ADMIN_DASH);\n newUrl.pathname = '/code-scanning/code-packages';\n\n // Indicate success\n this.logger.info(\n colors.green(\n `Scan found ${results.length} packages at ${scanPath}! ` + `View results at '${newUrl.href}'`,\n ),\n );\n}\n"],"mappings":"qbAcA,eAAsB,EAAyB,CAC7C,WACA,aAAa,EAAE,CACf,kBAQ8B,CA4C9B,OAAO,MA3CuB,QAAQ,IACpC,EAAW,EAAsB,CAAC,IAAI,MAAO,CAAC,EAAiB,KAAY,CACzE,GAAM,CAAE,WAAY,EAAkB,iBAAgB,gBAAiB,EACjE,EAAe,CAAC,GAAG,EAAY,GAAG,EAAiB,CAAC,OAAQ,GAAQ,EAAI,OAAS,EAAE,CACzF,GAAI,CACF,IAAM,EAAwB,MAAM,EAAS,GAAG,EAAS,MAAM,EAAe,KAAK,IAAI,GAAI,CACzF,OAAQ,EAAa,IAAK,GAAgB,GAAG,EAAS,MAAM,IAAM,CAClE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