@transcend-io/cli 10.26.0 → 10.26.1

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.
Files changed (134) hide show
  1. package/README.md +2 -2
  2. package/dist/{app-CZX6ZV6X.mjs → app-B9liG9mC.mjs} +16 -16
  3. package/dist/{app-CZX6ZV6X.mjs.map → app-B9liG9mC.mjs.map} +1 -1
  4. package/dist/{approvePrivacyRequests-D1S2AYud.mjs → approvePrivacyRequests-Ccc_3C8v.mjs} +2 -2
  5. package/dist/{approvePrivacyRequests-D1S2AYud.mjs.map → approvePrivacyRequests-Ccc_3C8v.mjs.map} +1 -1
  6. package/dist/bin/bash-complete.mjs +1 -1
  7. package/dist/bin/cli.mjs +1 -1
  8. package/dist/bin/deprecated-command.mjs +1 -1
  9. package/dist/{buildExamples-CnfZJ8MD.mjs → buildExamples-Bd0uvJye.mjs} +2 -2
  10. package/dist/{buildExamples-CnfZJ8MD.mjs.map → buildExamples-Bd0uvJye.mjs.map} +1 -1
  11. package/dist/{buildXdiSyncEndpoint-B4l998cU.mjs → buildXdiSyncEndpoint-Cfsq16IY.mjs} +2 -2
  12. package/dist/{buildXdiSyncEndpoint-B4l998cU.mjs.map → buildXdiSyncEndpoint-Cfsq16IY.mjs.map} +1 -1
  13. package/dist/{bulkRestartRequests-NAASQwvP.mjs → bulkRestartRequests-CddZT7XC.mjs} +2 -2
  14. package/dist/{bulkRestartRequests-NAASQwvP.mjs.map → bulkRestartRequests-CddZT7XC.mjs.map} +1 -1
  15. package/dist/{bulkRetryEnrichers-BEEVKtCH.mjs → bulkRetryEnrichers-BYheZwIr.mjs} +2 -2
  16. package/dist/{bulkRetryEnrichers-BEEVKtCH.mjs.map → bulkRetryEnrichers-BYheZwIr.mjs.map} +1 -1
  17. package/dist/{cancelPrivacyRequests-DM3Zamqd.mjs → cancelPrivacyRequests-edkg0NB0.mjs} +2 -2
  18. package/dist/{cancelPrivacyRequests-DM3Zamqd.mjs.map → cancelPrivacyRequests-edkg0NB0.mjs.map} +1 -1
  19. package/dist/{command-30CgpFvx.mjs → command-B52YWqdY.mjs} +2 -2
  20. package/dist/{command-30CgpFvx.mjs.map → command-B52YWqdY.mjs.map} +1 -1
  21. package/dist/{constants-CAOyAsNX.mjs → constants-CXN-RdUM.mjs} +2 -2
  22. package/dist/{constants-CAOyAsNX.mjs.map → constants-CXN-RdUM.mjs.map} +1 -1
  23. package/dist/{createExtraKeyHandler-DbWzaD4c.mjs → createExtraKeyHandler-MXCneIvy.mjs} +2 -2
  24. package/dist/{createExtraKeyHandler-DbWzaD4c.mjs.map → createExtraKeyHandler-MXCneIvy.mjs.map} +1 -1
  25. package/dist/{downloadPrivacyRequestFiles-DSOTFVU6.mjs → downloadPrivacyRequestFiles-BQiPh0al.mjs} +2 -2
  26. package/dist/{downloadPrivacyRequestFiles-DSOTFVU6.mjs.map → downloadPrivacyRequestFiles-BQiPh0al.mjs.map} +1 -1
  27. package/dist/{generateCrossAccountApiKeys-C3mCgp6X.mjs → generateCrossAccountApiKeys-BddQwvq5.mjs} +2 -2
  28. package/dist/{generateCrossAccountApiKeys-C3mCgp6X.mjs.map → generateCrossAccountApiKeys-BddQwvq5.mjs.map} +1 -1
  29. package/dist/{impl-B0fzc-Pd.mjs → impl-7JlYzUYe.mjs} +2 -2
  30. package/dist/{impl-B0fzc-Pd.mjs.map → impl-7JlYzUYe.mjs.map} +1 -1
  31. package/dist/{impl-B2yCuG6f2.mjs → impl-ATN49LhV2.mjs} +2 -2
  32. package/dist/{impl-B2yCuG6f2.mjs.map → impl-ATN49LhV2.mjs.map} +1 -1
  33. package/dist/{impl-DPC_ktM2.mjs → impl-B1IGYR_V.mjs} +2 -2
  34. package/dist/{impl-DPC_ktM2.mjs.map → impl-B1IGYR_V.mjs.map} +1 -1
  35. package/dist/{impl-Bbtnhcy02.mjs → impl-BDZNvvup2.mjs} +2 -2
  36. package/dist/{impl-Bbtnhcy02.mjs.map → impl-BDZNvvup2.mjs.map} +1 -1
  37. package/dist/{impl-CWVX0Xnv.mjs → impl-BQ6CEC4S.mjs} +2 -2
  38. package/dist/{impl-CWVX0Xnv.mjs.map → impl-BQ6CEC4S.mjs.map} +1 -1
  39. package/dist/{impl-DLypyDZV2.mjs → impl-BU4p0r4b2.mjs} +2 -2
  40. package/dist/{impl-DLypyDZV2.mjs.map → impl-BU4p0r4b2.mjs.map} +1 -1
  41. package/dist/{impl-B6_4iGM2.mjs → impl-Ba84jyic.mjs} +2 -2
  42. package/dist/{impl-B6_4iGM2.mjs.map → impl-Ba84jyic.mjs.map} +1 -1
  43. package/dist/{impl-CWqtBcmr.mjs → impl-Bdjx2QKs.mjs} +2 -2
  44. package/dist/{impl-CWqtBcmr.mjs.map → impl-Bdjx2QKs.mjs.map} +1 -1
  45. package/dist/{impl-DRjvMMeU2.mjs → impl-BfHyYFlO2.mjs} +2 -2
  46. package/dist/{impl-DRjvMMeU2.mjs.map → impl-BfHyYFlO2.mjs.map} +1 -1
  47. package/dist/{impl-yVmEK84l.mjs → impl-C-Cn5Ngw.mjs} +2 -2
  48. package/dist/{impl-yVmEK84l.mjs.map → impl-C-Cn5Ngw.mjs.map} +1 -1
  49. package/dist/{impl-BsPgb_kT.mjs → impl-C-KfgFsR.mjs} +2 -2
  50. package/dist/{impl-BsPgb_kT.mjs.map → impl-C-KfgFsR.mjs.map} +1 -1
  51. package/dist/{impl-DSCuy4GU2.mjs → impl-CAIi2Iei2.mjs} +2 -2
  52. package/dist/{impl-DSCuy4GU2.mjs.map → impl-CAIi2Iei2.mjs.map} +1 -1
  53. package/dist/{impl-_BPSoSwJ.mjs → impl-CC--p8hz.mjs} +2 -2
  54. package/dist/{impl-_BPSoSwJ.mjs.map → impl-CC--p8hz.mjs.map} +1 -1
  55. package/dist/{impl-CdOwXtLY2.mjs → impl-CEuchKDD2.mjs} +2 -2
  56. package/dist/{impl-CdOwXtLY2.mjs.map → impl-CEuchKDD2.mjs.map} +1 -1
  57. package/dist/{impl-D__B55Iu2.mjs → impl-CLHN4nhK2.mjs} +2 -2
  58. package/dist/{impl-D__B55Iu2.mjs.map → impl-CLHN4nhK2.mjs.map} +1 -1
  59. package/dist/{impl-DPmitBXR2.mjs → impl-CLNmmYJ_2.mjs} +2 -2
  60. package/dist/{impl-DPmitBXR2.mjs.map → impl-CLNmmYJ_2.mjs.map} +1 -1
  61. package/dist/{impl-DNtaoKI9.mjs → impl-CLz1VLFS.mjs} +2 -2
  62. package/dist/{impl-DNtaoKI9.mjs.map → impl-CLz1VLFS.mjs.map} +1 -1
  63. package/dist/{impl-YeYfan582.mjs → impl-CMeeJCDH2.mjs} +2 -2
  64. package/dist/{impl-YeYfan582.mjs.map → impl-CMeeJCDH2.mjs.map} +1 -1
  65. package/dist/{impl-C2DDZ1EB2.mjs → impl-CWNUfcdj2.mjs} +2 -2
  66. package/dist/{impl-C2DDZ1EB2.mjs.map → impl-CWNUfcdj2.mjs.map} +1 -1
  67. package/dist/{impl-BdTWl0Xm.mjs → impl-CZLYI9Eh.mjs} +2 -2
  68. package/dist/{impl-BdTWl0Xm.mjs.map → impl-CZLYI9Eh.mjs.map} +1 -1
  69. package/dist/{impl-_nJfGV8K2.mjs → impl-C_tLoG0h2.mjs} +2 -2
  70. package/dist/{impl-_nJfGV8K2.mjs.map → impl-C_tLoG0h2.mjs.map} +1 -1
  71. package/dist/{impl-GeXGMn5G.mjs → impl-CeKxAc_j.mjs} +2 -2
  72. package/dist/{impl-GeXGMn5G.mjs.map → impl-CeKxAc_j.mjs.map} +1 -1
  73. package/dist/{impl-DmbT1vXM2.mjs → impl-CgepDtLJ2.mjs} +2 -2
  74. package/dist/{impl-DmbT1vXM2.mjs.map → impl-CgepDtLJ2.mjs.map} +1 -1
  75. package/dist/{impl-C9KCLG7s2.mjs → impl-Cj5NeBI22.mjs} +2 -2
  76. package/dist/{impl-C9KCLG7s2.mjs.map → impl-Cj5NeBI22.mjs.map} +1 -1
  77. package/dist/{impl-DJHPOIQn2.mjs → impl-CmlkjIP72.mjs} +2 -2
  78. package/dist/{impl-DJHPOIQn2.mjs.map → impl-CmlkjIP72.mjs.map} +1 -1
  79. package/dist/{impl-y01BtY2r.mjs → impl-D0fkfLxw.mjs} +2 -2
  80. package/dist/{impl-y01BtY2r.mjs.map → impl-D0fkfLxw.mjs.map} +1 -1
  81. package/dist/{impl-DOQk-mfA.mjs → impl-D1Jj-4Zn.mjs} +2 -2
  82. package/dist/{impl-DOQk-mfA.mjs.map → impl-D1Jj-4Zn.mjs.map} +1 -1
  83. package/dist/{impl-Da1sv_hX2.mjs → impl-D3ytHcs42.mjs} +2 -2
  84. package/dist/{impl-Da1sv_hX2.mjs.map → impl-D3ytHcs42.mjs.map} +1 -1
  85. package/dist/{impl-B_1LPpGy.mjs → impl-DVUNwxIx.mjs} +2 -2
  86. package/dist/{impl-B_1LPpGy.mjs.map → impl-DVUNwxIx.mjs.map} +1 -1
  87. package/dist/{impl-8zmHCdih.mjs → impl-DZy7vEEM.mjs} +2 -2
  88. package/dist/{impl-8zmHCdih.mjs.map → impl-DZy7vEEM.mjs.map} +1 -1
  89. package/dist/{impl-BdG67mkj.mjs → impl-DxVB8-h3.mjs} +2 -2
  90. package/dist/{impl-BdG67mkj.mjs.map → impl-DxVB8-h3.mjs.map} +1 -1
  91. package/dist/{impl-D5fmpaDf2.mjs → impl-FrbAsKvf2.mjs} +2 -2
  92. package/dist/{impl-D5fmpaDf2.mjs.map → impl-FrbAsKvf2.mjs.map} +1 -1
  93. package/dist/{impl-1ueiw_XV2.mjs → impl-GDBOa4jq2.mjs} +2 -2
  94. package/dist/{impl-1ueiw_XV2.mjs.map → impl-GDBOa4jq2.mjs.map} +1 -1
  95. package/dist/{impl-z5TV6Spz2.mjs → impl-yLtpv9IB2.mjs} +2 -2
  96. package/dist/{impl-z5TV6Spz2.mjs.map → impl-yLtpv9IB2.mjs.map} +1 -1
  97. package/dist/index.d.mts +4 -0
  98. package/dist/index.d.mts.map +1 -1
  99. package/dist/index.mjs +1 -1
  100. package/dist/{markRequestDataSiloIdsCompleted-CDV0Ppv2.mjs → markRequestDataSiloIdsCompleted-C-yZAoq6.mjs} +2 -2
  101. package/dist/{markRequestDataSiloIdsCompleted-CDV0Ppv2.mjs.map → markRequestDataSiloIdsCompleted-C-yZAoq6.mjs.map} +1 -1
  102. package/dist/{markSilentPrivacyRequests-DXLiS2jH.mjs → markSilentPrivacyRequests-Ir4ZB_lK.mjs} +2 -2
  103. package/dist/{markSilentPrivacyRequests-DXLiS2jH.mjs.map → markSilentPrivacyRequests-Ir4ZB_lK.mjs.map} +1 -1
  104. package/dist/{notifyPrivacyRequestsAdditionalTime-DPp0MyfT.mjs → notifyPrivacyRequestsAdditionalTime-aOusRVCh.mjs} +2 -2
  105. package/dist/{notifyPrivacyRequestsAdditionalTime-DPp0MyfT.mjs.map → notifyPrivacyRequestsAdditionalTime-aOusRVCh.mjs.map} +1 -1
  106. package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-rKefgKKC.mjs → pullChunkedCustomSiloOutstandingIdentifiers-CZARvaM3.mjs} +2 -2
  107. package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-rKefgKKC.mjs.map → pullChunkedCustomSiloOutstandingIdentifiers-CZARvaM3.mjs.map} +1 -1
  108. package/dist/{pullManualEnrichmentIdentifiersToCsv-Cbk-7ztw.mjs → pullManualEnrichmentIdentifiersToCsv-dseAHwSI.mjs} +2 -2
  109. package/dist/{pullManualEnrichmentIdentifiersToCsv-Cbk-7ztw.mjs.map → pullManualEnrichmentIdentifiersToCsv-dseAHwSI.mjs.map} +1 -1
  110. package/dist/{pushCronIdentifiersFromCsv-Dj-KEFpQ.mjs → pushCronIdentifiersFromCsv-CowCvbH0.mjs} +2 -2
  111. package/dist/{pushCronIdentifiersFromCsv-Dj-KEFpQ.mjs.map → pushCronIdentifiersFromCsv-CowCvbH0.mjs.map} +1 -1
  112. package/dist/{pushManualEnrichmentIdentifiersFromCsv-CY4d1jQy.mjs → pushManualEnrichmentIdentifiersFromCsv-DkQjQ5b9.mjs} +2 -2
  113. package/dist/{pushManualEnrichmentIdentifiersFromCsv-CY4d1jQy.mjs.map → pushManualEnrichmentIdentifiersFromCsv-DkQjQ5b9.mjs.map} +1 -1
  114. package/dist/{removeUnverifiedRequestIdentifiers-BUJZoJD9.mjs → removeUnverifiedRequestIdentifiers-D9soOpMX.mjs} +2 -2
  115. package/dist/{removeUnverifiedRequestIdentifiers-BUJZoJD9.mjs.map → removeUnverifiedRequestIdentifiers-D9soOpMX.mjs.map} +1 -1
  116. package/dist/{retryRequestDataSilos-DATDTDin.mjs → retryRequestDataSilos-g20l2uj6.mjs} +2 -2
  117. package/dist/{retryRequestDataSilos-DATDTDin.mjs.map → retryRequestDataSilos-g20l2uj6.mjs.map} +1 -1
  118. package/dist/{skipPreflightJobs-C1go-m8K.mjs → skipPreflightJobs-G1tfj4Nw.mjs} +2 -2
  119. package/dist/{skipPreflightJobs-C1go-m8K.mjs.map → skipPreflightJobs-G1tfj4Nw.mjs.map} +1 -1
  120. package/dist/{skipRequestDataSilos-1ksexte3.mjs → skipRequestDataSilos-Dtk8sCNd.mjs} +2 -2
  121. package/dist/{skipRequestDataSilos-1ksexte3.mjs.map → skipRequestDataSilos-Dtk8sCNd.mjs.map} +1 -1
  122. package/dist/{streamPrivacyRequestsToCsv-7S52MmdS.mjs → streamPrivacyRequestsToCsv-WHnlMy96.mjs} +2 -2
  123. package/dist/{streamPrivacyRequestsToCsv-7S52MmdS.mjs.map → streamPrivacyRequestsToCsv-WHnlMy96.mjs.map} +1 -1
  124. package/dist/{updateConsentManagerVersionToLatest-CYGRh2Mf.mjs → updateConsentManagerVersionToLatest-BJ2psQvP.mjs} +2 -2
  125. package/dist/{updateConsentManagerVersionToLatest-CYGRh2Mf.mjs.map → updateConsentManagerVersionToLatest-BJ2psQvP.mjs.map} +1 -1
  126. package/dist/{uploadConsents-DxzUYFP_.mjs → uploadConsents-BsH0XF3-.mjs} +2 -2
  127. package/dist/{uploadConsents-DxzUYFP_.mjs.map → uploadConsents-BsH0XF3-.mjs.map} +1 -1
  128. package/dist/{uploadCookiesFromCsv-D33lINd-.mjs → uploadCookiesFromCsv-CqRfU5k-.mjs} +2 -2
  129. package/dist/{uploadCookiesFromCsv-D33lINd-.mjs.map → uploadCookiesFromCsv-CqRfU5k-.mjs.map} +1 -1
  130. package/dist/{uploadDataFlowsFromCsv-0oDEouPJ.mjs → uploadDataFlowsFromCsv-CgTkrlhJ.mjs} +2 -2
  131. package/dist/{uploadDataFlowsFromCsv-0oDEouPJ.mjs.map → uploadDataFlowsFromCsv-CgTkrlhJ.mjs.map} +1 -1
  132. package/dist/{uploadPrivacyRequestsFromCsv-CX7JRYjH.mjs → uploadPrivacyRequestsFromCsv-CaYuvzXw.mjs} +2 -2
  133. package/dist/{uploadPrivacyRequestsFromCsv-CX7JRYjH.mjs.map → uploadPrivacyRequestsFromCsv-CaYuvzXw.mjs.map} +1 -1
  134. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"impl-DmbT1vXM2.mjs","names":["skipRequestDataSilosHelper"],"sources":["../src/commands/request/system/skip-request-data-silos/impl.ts"],"sourcesContent":["import type {\n RequestAction,\n RequestDataSiloStatus,\n RequestStatus,\n} from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport { skipRequestDataSilos as skipRequestDataSilosHelper } from '../../../../lib/requests/index.js';\n\nexport interface SkipRequestDataSilosCommandFlags {\n auth: string;\n dataSiloId: string;\n transcendUrl: string;\n statuses: RequestStatus[];\n status: (typeof RequestDataSiloStatus)['Skipped'] | (typeof RequestDataSiloStatus)['Resolved'];\n actionTypes?: RequestAction[];\n}\n\nexport async function skipRequestDataSilos(\n this: LocalContext,\n {\n auth,\n dataSiloId,\n status,\n statuses,\n transcendUrl,\n actionTypes,\n }: SkipRequestDataSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await skipRequestDataSilosHelper({\n transcendUrl,\n auth,\n status,\n dataSiloId,\n requestStatuses: statuses,\n actionTypes,\n });\n}\n"],"mappings":"4GAmBA,eAAsB,EAEpB,CACE,OACA,aACA,SACA,WACA,eACA,eAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAA2B,CAC/B,eACA,OACA,SACA,aACA,gBAAiB,EACjB,cACD,CAAC"}
1
+ {"version":3,"file":"impl-CgepDtLJ2.mjs","names":["skipRequestDataSilosHelper"],"sources":["../src/commands/request/system/skip-request-data-silos/impl.ts"],"sourcesContent":["import type {\n RequestAction,\n RequestDataSiloStatus,\n RequestStatus,\n} from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport { skipRequestDataSilos as skipRequestDataSilosHelper } from '../../../../lib/requests/index.js';\n\nexport interface SkipRequestDataSilosCommandFlags {\n auth: string;\n dataSiloId: string;\n transcendUrl: string;\n statuses: RequestStatus[];\n status: (typeof RequestDataSiloStatus)['Skipped'] | (typeof RequestDataSiloStatus)['Resolved'];\n actionTypes?: RequestAction[];\n}\n\nexport async function skipRequestDataSilos(\n this: LocalContext,\n {\n auth,\n dataSiloId,\n status,\n statuses,\n transcendUrl,\n actionTypes,\n }: SkipRequestDataSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await skipRequestDataSilosHelper({\n transcendUrl,\n auth,\n status,\n dataSiloId,\n requestStatuses: statuses,\n actionTypes,\n });\n}\n"],"mappings":"4GAmBA,eAAsB,EAEpB,CACE,OACA,aACA,SACA,WACA,eACA,eAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAA2B,CAC/B,eACA,OACA,SACA,aACA,gBAAiB,EACjB,cACD,CAAC"}
@@ -1,3 +1,3 @@
1
- import{t as e}from"./buildExamples-CnfZJ8MD.mjs";import{r as t}from"./policyEngineCliError-BnBghLd1.mjs";import{n,t as r}from"./constants-FbK2iR--.mjs";import{r as i,t as a}from"./runOpa-D511z37u.mjs";import{i as o,n as s,t as c}from"./printResult-oXnpZu_9.mjs";import{t as l}from"./formatPolicyBundleVersionSummary-Bo7DYxoy.mjs";import{n as u}from"./resolveBundleIdByName-By5Vl8Iz.mjs";import{t as d}from"./logger-Ckep4QXn.mjs";import{n as f}from"./inquirer-B0OF_nRe.mjs";import{t as p}from"./done-input-validation-DL31vk7g.mjs";import{spawnSync as m}from"node:child_process";import h from"node:fs";import g from"node:os";import _ from"node:path";import{gunzipSync as v}from"node:zlib";import y from"fast-glob";import b from"colors";function x(e){return e.endsWith(`.rego`)&&!e.endsWith(`_test.rego`)}function S(e){let t=_.join(e,`manifest.json`);if(!h.existsSync(t))throw Error(`Policy bundle directory must contain a manifest.json file.`);let n=h.readFileSync(t,`utf8`),r;try{r=JSON.parse(n)}catch(e){throw Error(`manifest.json is not valid JSON: ${e instanceof Error?e.message:String(e)}`,{cause:e})}if(!r||typeof r!=`object`||Array.isArray(r))throw Error(`manifest.json must contain a JSON object.`);let i=r.roots;if(!Array.isArray(i)||i.length===0)throw Error(`manifest.json must declare "roots" as a non-empty array of strings (e.g. {"roots":["policy_engine"]}).`);if(!i.every(e=>typeof e==`string`&&e.length>0))throw Error(`manifest.json "roots" must be an array of non-empty strings.`);return{roots:i}}function C(e){let t=S(e),n=y.sync(`**/*.rego`,{cwd:e,onlyFiles:!0,dot:!1}).filter(x);if(n.length===0)throw Error(`Policy bundle directory must contain at least one .rego policy file.`);return{entries:[`manifest.json`,...n.sort()],manifest:t}}const w=/^\s*package\s+([A-Za-z_][\w.]*)/m;function T(e){return e.replace(/\//g,`.`)}function E(e){let t=h.readFileSync(e,`utf8`);return w.exec(t)?.[1]}function D(e,t,n){let r=n.map(T),i=[];for(let a of t){let t=E(_.join(e,a));t&&(r.some(e=>t===e||t.startsWith(`${e}.`))||i.push(` - ${a} (package ${t}) is not covered by roots [${n.join(`, `)}]`))}if(i.length>0)throw Error([`manifest.json "roots" do not cover all Rego packages in the bundle; uncovered packages will fail-closed at decide time. Either broaden "roots" or move the policy under a covered package:`,...i].join(`
1
+ import{t as e}from"./buildExamples-Bd0uvJye.mjs";import{r as t}from"./policyEngineCliError-BnBghLd1.mjs";import{n,t as r}from"./constants-FbK2iR--.mjs";import{r as i,t as a}from"./runOpa-D511z37u.mjs";import{i as o,n as s,t as c}from"./printResult-oXnpZu_9.mjs";import{t as l}from"./formatPolicyBundleVersionSummary-Bo7DYxoy.mjs";import{n as u}from"./resolveBundleIdByName-By5Vl8Iz.mjs";import{t as d}from"./logger-Ckep4QXn.mjs";import{n as f}from"./inquirer-B0OF_nRe.mjs";import{t as p}from"./done-input-validation-DL31vk7g.mjs";import{spawnSync as m}from"node:child_process";import h from"node:fs";import g from"node:os";import _ from"node:path";import{gunzipSync as v}from"node:zlib";import y from"fast-glob";import b from"colors";function x(e){return e.endsWith(`.rego`)&&!e.endsWith(`_test.rego`)}function S(e){let t=_.join(e,`manifest.json`);if(!h.existsSync(t))throw Error(`Policy bundle directory must contain a manifest.json file.`);let n=h.readFileSync(t,`utf8`),r;try{r=JSON.parse(n)}catch(e){throw Error(`manifest.json is not valid JSON: ${e instanceof Error?e.message:String(e)}`,{cause:e})}if(!r||typeof r!=`object`||Array.isArray(r))throw Error(`manifest.json must contain a JSON object.`);let i=r.roots;if(!Array.isArray(i)||i.length===0)throw Error(`manifest.json must declare "roots" as a non-empty array of strings (e.g. {"roots":["policy_engine"]}).`);if(!i.every(e=>typeof e==`string`&&e.length>0))throw Error(`manifest.json "roots" must be an array of non-empty strings.`);return{roots:i}}function C(e){let t=S(e),n=y.sync(`**/*.rego`,{cwd:e,onlyFiles:!0,dot:!1}).filter(x);if(n.length===0)throw Error(`Policy bundle directory must contain at least one .rego policy file.`);return{entries:[`manifest.json`,...n.sort()],manifest:t}}const w=/^\s*package\s+([A-Za-z_][\w.]*)/m;function T(e){return e.replace(/\//g,`.`)}function E(e){let t=h.readFileSync(e,`utf8`);return w.exec(t)?.[1]}function D(e,t,n){let r=n.map(T),i=[];for(let a of t){let t=E(_.join(e,a));t&&(r.some(e=>t===e||t.startsWith(`${e}.`))||i.push(` - ${a} (package ${t}) is not covered by roots [${n.join(`, `)}]`))}if(i.length>0)throw Error([`manifest.json "roots" do not cover all Rego packages in the bundle; uncovered packages will fail-closed at decide time. Either broaden "roots" or move the policy under a covered package:`,...i].join(`
2
2
  `))}async function O(e){let t=_.join(g.tmpdir(),`transcend-policy-bundle-build-${Date.now()}-${Math.random().toString(36).slice(2)}.tar.gz`);try{let{code:n,stderr:r}=await a([`build`,`--v0-compatible`,`--ignore`,`*_test.rego`,`-o`,t,`.`],{cwd:e});if(n!==0)throw Error(r.trim()||`opa build failed with exit code ${n}`)}finally{h.existsSync(t)&&h.unlinkSync(t)}}function k(e){if(e<1024)return`${e} B`;let t=e/1024;if(t<1024)return`${t%1==0?t.toFixed(0):t.toFixed(1)} KiB`;let n=t/1024;return`${n%1==0?n.toFixed(0):n.toFixed(1)} MiB`}async function A(e){i();let t=_.resolve(e);if(!h.existsSync(t)||!h.statSync(t).isDirectory())throw Error(`Policy directory does not exist or is not a directory: ${t}`);let{entries:o,manifest:s}=C(t);D(t,o.filter(e=>e!==`manifest.json`),s.roots);let{code:c,stderr:l}=await a([`check`,`--strict`,`--v0-compatible`,t]);if(c!==0)throw Error(l.trim()||`opa check failed with exit code ${c}`);await O(t);let u=_.join(g.tmpdir(),`transcend-policy-bundle-${Date.now()}-${Math.random().toString(36).slice(2)}.tar.gz`),d=m(`tar`,[`-czf`,u,`-C`,t,...o],{env:{...process.env,COPYFILE_DISABLE:`1`},encoding:`utf8`});if(d.status!==0)throw Error(`Failed to create policy bundle archive: ${d.stderr.trim()||`tar failed`}`);let f=h.readFileSync(u);if(f.byteLength>5120)throw h.unlinkSync(u),Error(`Policy bundle exceeds the ${k(r)} compressed upload limit (bundle is ${k(f.byteLength)}). The server also rejects decompressed bundles larger than ${k(n)}.`);let p=v(f);if(p.byteLength>51200)throw h.unlinkSync(u),Error(`Policy bundle exceeds the ${k(n)} decompressed upload limit (bundle is ${k(p.byteLength)} decompressed).`);return u}function j(e){let t=h.readFileSync(e.bundlePath),n=new FormData;return n.append(`bundle`,new Blob([t],{type:`application/gzip`}),_.basename(e.bundlePath)),n.append(`version`,e.version),e.description&&n.append(`description`,e.description),e.bundleName&&n.append(`bundleName`,e.bundleName),n}function M(e){return e.toISOString().slice(0,19).replace(/[T:]/g,`-`)}function N(e,t=new Date){return`${e}-${M(t)}`}async function P({dir:n,"bundle-name":r,auth:i,"transcend-url":a,version:m,description:g,json:v,yes:y,debug:x=!1}){p(this.process.exit),t(x);let S=_.resolve(n),C=m??N(r),w=o(a,i),T;try{d.info(b.green(`Building policy bundle from ${S}...`)),T=await A(S);let t=await u(w,r),n;if(t){d.info(b.green(`Uploading new version for bundle "${r}"...`));let e=j({bundlePath:T,version:C,description:g});n=await s(w.post(`v1/policy-engine/policy-bundles/${t}/versions`,{body:e}).json())}else{if(!this.process.stdin.isTTY&&!y){d.error(b.red(`Cannot create a new bundle in a non-interactive environment; pass --yes to confirm.`)),this.process.exit(1);return}if(!y&&(d.warn(b.yellow(`No policy bundle named "${r}" exists for this organization.`)),!await f({message:`No policy bundle named "${r}" exists. Create a new bundle and upload its first version?`}))){d.info(b.yellow(`Publish cancelled.`));return}d.info(b.green(`Creating bundle "${r}" and uploading first version...`));let e=j({bundlePath:T,version:C,description:g,bundleName:r});n=await s(w.post(`v1/policy-engine/policy-bundles`,{body:e}).json())}c(this.process.stdout,{json:v,data:n,renderTable:()=>l(n.version)}),d.info(b.green(`Policy bundle version uploaded successfully.`));let i=e([`policy`,`activate`],{version:n.version.version,"bundle-name":r});d.info(b.yellow(`Publishing a policy does not activate it. To activate this version, run:\n ${i}`))}finally{T&&h.existsSync(T)&&h.unlinkSync(T)}}export{P as publish};
3
- //# sourceMappingURL=impl-C9KCLG7s2.mjs.map
3
+ //# sourceMappingURL=impl-Cj5NeBI22.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-C9KCLG7s2.mjs","names":["fg"],"sources":["../src/commands/policy/helpers/buildOpaBundleTarball.ts","../src/commands/policy/helpers/buildPolicyBundleFormData.ts","../src/commands/policy/helpers/defaultPolicyVersionLabel.ts","../src/commands/policy/publish/impl.ts"],"sourcesContent":["import { spawnSync } from 'node:child_process';\nimport fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\nimport { gunzipSync } from 'node:zlib';\n\nimport fg from 'fast-glob';\n\nimport { MAX_BUNDLE_COMPRESSED_BYTES, MAX_BUNDLE_DECOMPRESSED_BYTES } from '../constants.js';\nimport { assertOpaInstalled } from './assertOpaInstalled.js';\nimport { runOPACapture } from './runOpa.js';\n\n/**\n * Returns whether a relative path is a publishable Rego policy file.\n *\n * OPA test files (`*_test.rego`) are excluded because they are for local\n * validation only and are not part of the upload contract.\n *\n * @param relativePath - Path relative to the bundle directory\n * @returns Whether the file should be included in the upload archive\n */\nfunction isPublishableRegoFile(relativePath: string): boolean {\n return relativePath.endsWith('.rego') && !relativePath.endsWith('_test.rego');\n}\n\n/** Shape of the OPA bundle `manifest.json` as accepted by the Policy Engine. */\ninterface PolicyBundleManifest {\n /** Roots of the bundle, e.g. `[\"policy_engine\"]` or `[\"policy_engine/transcend\"]` */\n roots: string[];\n}\n\n/**\n * Reads and validates `manifest.json` from a policy bundle directory.\n *\n * The Policy Engine requires `manifest.json` to declare `roots` as an array of\n * strings. OPA's own tooling does not always enforce this against the Rego\n * packages on upload, so we validate the shape client-side to surface a clear,\n * actionable error instead of an opaque server `400` or a decide-time\n * fail-closed footgun.\n *\n * @param dir - Absolute path to the policy bundle directory\n * @returns The parsed manifest\n */\nfunction readPolicyBundleManifest(dir: string): PolicyBundleManifest {\n const manifestPath = path.join(dir, 'manifest.json');\n if (!fs.existsSync(manifestPath)) {\n throw new Error('Policy bundle directory must contain a manifest.json file.');\n }\n\n const raw = fs.readFileSync(manifestPath, 'utf8');\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch (err) {\n throw new Error(\n `manifest.json is not valid JSON: ${err instanceof Error ? err.message : String(err)}`,\n { cause: err },\n );\n }\n\n if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {\n throw new Error('manifest.json must contain a JSON object.');\n }\n\n const roots = (parsed as { roots?: unknown }).roots;\n if (!Array.isArray(roots) || roots.length === 0) {\n throw new Error(\n 'manifest.json must declare \"roots\" as a non-empty array of strings (e.g. {\"roots\":[\"policy_engine\"]}).',\n );\n }\n\n if (!roots.every((root) => typeof root === 'string' && root.length > 0)) {\n throw new Error('manifest.json \"roots\" must be an array of non-empty strings.');\n }\n\n return { roots };\n}\n\n/** Result of collecting publishable entries from a policy bundle directory. */\ninterface PolicyBundleArchiveContents {\n /** Relative paths to include in the upload tarball (manifest first, then rego) */\n entries: string[];\n /** Parsed manifest */\n manifest: PolicyBundleManifest;\n}\n\n/**\n * Collects `manifest.json` and publishable `.rego` files from a policy directory.\n *\n * @param dir - Absolute path to the policy bundle directory\n * @returns Archive entries and the parsed manifest\n */\nfunction collectPolicyBundleArchiveEntries(dir: string): PolicyBundleArchiveContents {\n const manifest = readPolicyBundleManifest(dir);\n\n const regoFiles = fg\n .sync('**/*.rego', {\n cwd: dir,\n onlyFiles: true,\n dot: false,\n })\n .filter(isPublishableRegoFile);\n\n if (regoFiles.length === 0) {\n throw new Error('Policy bundle directory must contain at least one .rego policy file.');\n }\n\n return { entries: ['manifest.json', ...regoFiles.sort()], manifest };\n}\n\n/** Matches a Rego `package <path>` declaration. */\nconst PACKAGE_DECLARATION_PATTERN = /^\\s*package\\s+([A-Za-z_][\\w.]*)/m;\n\n/**\n * Normalizes an OPA manifest root to a dotted package prefix.\n *\n * Roots use `/` as the path separator (e.g. `policy_engine/transcend`); Rego\n * package paths use `.` (e.g. `policy_engine.transcend`).\n *\n * @param root - A manifest root string\n * @returns The root in dotted form\n */\nfunction normalizeRootToPackagePrefix(root: string): string {\n return root.replace(/\\//g, '.');\n}\n\n/**\n * Reads the Rego package path declared in a `.rego` file.\n *\n * @param filePath - Absolute path to the `.rego` file\n * @returns The dotted package path, or `undefined` if no `package` declaration\n */\nfunction readRegoPackagePath(filePath: string): string | undefined {\n const contents = fs.readFileSync(filePath, 'utf8');\n const match = PACKAGE_DECLARATION_PATTERN.exec(contents);\n return match?.[1];\n}\n\n/**\n * Verifies that every publishable `.rego` package is covered by a manifest root.\n *\n * A bundle whose `roots` do not cover its Rego packages will upload cleanly but\n * fail-closed at decide time — the customer only discovers the mismatch via\n * denied decisions. This surfaces the mismatch at upload with a clear message.\n *\n * @param dir - Absolute path to the policy bundle directory\n * @param regoFiles - Relative paths to publishable `.rego` files\n * @param roots - Manifest roots\n */\nfunction assertRootsCoverPackages(dir: string, regoFiles: string[], roots: string[]): void {\n const rootPrefixes = roots.map(normalizeRootToPackagePrefix);\n\n const uncovered: string[] = [];\n for (const relativeRego of regoFiles) {\n const pkg = readRegoPackagePath(path.join(dir, relativeRego));\n if (!pkg) {\n continue;\n }\n const covered = rootPrefixes.some((prefix) => pkg === prefix || pkg.startsWith(`${prefix}.`));\n if (!covered) {\n uncovered.push(\n ` - ${relativeRego} (package ${pkg}) is not covered by roots [${roots.join(', ')}]`,\n );\n }\n }\n\n if (uncovered.length > 0) {\n throw new Error(\n [\n 'manifest.json \"roots\" do not cover all Rego packages in the bundle; ' +\n 'uncovered packages will fail-closed at decide time. Either broaden \"roots\" or move the policy under a covered package:',\n ...uncovered,\n ].join('\\n'),\n );\n }\n}\n\n/**\n * Verifies that a policy directory compiles end-to-end with `opa build`.\n *\n * The compiled output is discarded — the server receives the `manifest.json` +\n * `.rego` archive produced by {@link buildOpaBundleTarball}, not the OPA bundle\n * — but a successful build guarantees the policies compile and link, surfacing\n * errors (syntax, missing imports, undefined references, etc.) before upload.\n *\n * @param dir - Absolute path to the policy bundle directory\n */\nasync function assertBundleCompiles(dir: string): Promise<void> {\n const buildOutputPath = path.join(\n os.tmpdir(),\n `transcend-policy-bundle-build-${Date.now()}-${Math.random().toString(36).slice(2)}.tar.gz`,\n );\n try {\n // Run with `cwd` set to the bundle directory and pass `.` so `opa build`\n // resolves the bundle root correctly. `*_test.rego` files are local-only.\n const { code, stderr } = await runOPACapture(\n ['build', '--v0-compatible', '--ignore', '*_test.rego', '-o', buildOutputPath, '.'],\n { cwd: dir },\n );\n if (code !== 0) {\n throw new Error(stderr.trim() || `opa build failed with exit code ${code}`);\n }\n } finally {\n if (fs.existsSync(buildOutputPath)) {\n fs.unlinkSync(buildOutputPath);\n }\n }\n}\n\n/**\n * Formats a byte count as a human-readable size with binary units.\n *\n * @param bytes - Number of bytes\n * @returns Human-readable size, e.g. `14 MiB` or `4 KiB`\n */\nfunction formatBytes(bytes: number): string {\n if (bytes < 1024) {\n return `${bytes} B`;\n }\n const kib = bytes / 1024;\n if (kib < 1024) {\n return `${kib % 1 === 0 ? kib.toFixed(0) : kib.toFixed(1)} KiB`;\n }\n const mib = kib / 1024;\n return `${mib % 1 === 0 ? mib.toFixed(0) : mib.toFixed(1)} MiB`;\n}\n\n/**\n * Builds a gzip-compressed policy bundle tarball for upload to Transcend.\n *\n * The Policy Engine API expects a plain archive containing `manifest.json` and\n * one or more `.rego` files. This differs from `opa build` output, which embeds\n * `.manifest`, `data.json`, and other OPA bundle metadata that the server\n * rejects. Before packaging, the manifest is validated (shape + root coverage)\n * and the bundle is validated with `opa check` (strict Rego linting) and\n * `opa build` (full compilation) so failures surface client-side rather than\n * after upload.\n *\n * @param dir - Directory containing `manifest.json` and `.rego` policy files\n * @returns Absolute path to the generated `.tar.gz` bundle\n */\nexport async function buildOpaBundleTarball(dir: string): Promise<string> {\n assertOpaInstalled();\n\n const resolvedDir = path.resolve(dir);\n if (!fs.existsSync(resolvedDir) || !fs.statSync(resolvedDir).isDirectory()) {\n throw new Error(`Policy directory does not exist or is not a directory: ${resolvedDir}`);\n }\n\n // Validate the manifest shape and that roots cover every Rego package before\n // invoking OPA, so invalid manifests surface a clear error instead of an\n // opaque `opa build failed with exit code 1`.\n const { entries: archiveEntries, manifest } = collectPolicyBundleArchiveEntries(resolvedDir);\n const regoFiles = archiveEntries.filter((entry) => entry !== 'manifest.json');\n assertRootsCoverPackages(resolvedDir, regoFiles, manifest.roots);\n\n // Match the Rego v1 validation the Policy Engine API runs on upload.\n const { code: checkCode, stderr: checkStderr } = await runOPACapture([\n 'check',\n '--strict',\n '--v0-compatible',\n resolvedDir,\n ]);\n if (checkCode !== 0) {\n throw new Error(checkStderr.trim() || `opa check failed with exit code ${checkCode}`);\n }\n\n // Ensure the bundle compiles end-to-end before packaging for upload.\n await assertBundleCompiles(resolvedDir);\n\n const outputPath = path.join(\n os.tmpdir(),\n `transcend-policy-bundle-${Date.now()}-${Math.random().toString(36).slice(2)}.tar.gz`,\n );\n\n const tarResult = spawnSync('tar', ['-czf', outputPath, '-C', resolvedDir, ...archiveEntries], {\n env: { ...process.env, COPYFILE_DISABLE: '1' },\n encoding: 'utf8',\n });\n if (tarResult.status !== 0) {\n throw new Error(\n `Failed to create policy bundle archive: ${tarResult.stderr.trim() || 'tar failed'}`,\n );\n }\n\n const compressedBytes = fs.readFileSync(outputPath);\n if (compressedBytes.byteLength > MAX_BUNDLE_COMPRESSED_BYTES) {\n fs.unlinkSync(outputPath);\n throw new Error(\n `Policy bundle exceeds the ${formatBytes(MAX_BUNDLE_COMPRESSED_BYTES)} compressed upload limit ` +\n `(bundle is ${formatBytes(compressedBytes.byteLength)}). ` +\n `The server also rejects decompressed bundles larger than ${formatBytes(MAX_BUNDLE_DECOMPRESSED_BYTES)}.`,\n );\n }\n\n const decompressedBytes = gunzipSync(compressedBytes);\n if (decompressedBytes.byteLength > MAX_BUNDLE_DECOMPRESSED_BYTES) {\n fs.unlinkSync(outputPath);\n throw new Error(\n `Policy bundle exceeds the ${formatBytes(MAX_BUNDLE_DECOMPRESSED_BYTES)} decompressed upload limit ` +\n `(bundle is ${formatBytes(decompressedBytes.byteLength)} decompressed).`,\n );\n }\n\n return outputPath;\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\n\n/** Fields for building a policy bundle upload form. */\nexport interface BuildPolicyBundleFormDataOptions {\n /** Absolute path to the bundle tarball */\n bundlePath: string;\n /** Version label */\n version: string;\n /** Optional description */\n description?: string;\n /** Bundle name (only for create) */\n bundleName?: string;\n}\n\n/**\n * Builds multipart form data for a policy bundle upload.\n *\n * @param options - Upload fields\n * @returns FormData ready for POST\n */\nexport function buildPolicyBundleFormData(options: BuildPolicyBundleFormDataOptions): FormData {\n const bundleBytes = fs.readFileSync(options.bundlePath);\n const form = new FormData();\n form.append(\n 'bundle',\n new Blob([bundleBytes], { type: 'application/gzip' }),\n path.basename(options.bundlePath),\n );\n form.append('version', options.version);\n if (options.description) {\n form.append('description', options.description);\n }\n if (options.bundleName) {\n form.append('bundleName', options.bundleName);\n }\n return form;\n}\n","/**\n * Formats a date as `yyyy-mm-dd-hh-mm-ss` in UTC.\n *\n * @param date - Date to format\n * @returns Timestamp label\n */\nfunction formatPolicyVersionTimestamp(date: Date): string {\n return date.toISOString().slice(0, 19).replace(/[T:]/g, '-');\n}\n\n/**\n * Returns a default version label from the bundle name and current UTC timestamp.\n *\n * @param bundleName - Tenant-unique policy bundle name\n * @param now - Current time (for testing)\n * @returns Version label in `{bundleName}-yyyy-mm-dd-hh-mm-ss` form\n */\nexport function defaultPolicyVersionLabel(bundleName: string, now: Date = new Date()): string {\n return `${bundleName}-${formatPolicyVersionTimestamp(now)}`;\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\n\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { buildExampleCommand } from '../../../lib/docgen/buildExamples.js';\nimport { inquirerConfirmBoolean } from '../../../lib/helpers/inquirer.js';\nimport { logger } from '../../../logger.js';\nimport type { ActivateCommandFlags } from '../activate/impl.js';\nimport {\n buildPolicyBundleFormData,\n buildPolicyEngineClient,\n buildOpaBundleTarball,\n defaultPolicyVersionLabel,\n formatPolicyBundleVersionSummary,\n policyEngineRequest,\n printResult,\n resolveBundleIdByName,\n setPolicyEngineCliDebug,\n} from '../helpers/index.js';\nimport type { CreatePolicyBundleResponse, CreatePolicyBundleVersionResponse } from '../types.js';\n\n/** CLI flags for `transcend policy publish`. */\nexport interface PublishCommandFlags {\n /** Directory containing Rego policy files */\n dir: string;\n /** Tenant-unique bundle name */\n 'bundle-name': string;\n /** Transcend API key */\n auth: string;\n /** Transcend API URL */\n 'transcend-url': string;\n /** Version label (defaults to `{bundleName}-yyyy-mm-dd-hh-mm-ss`) */\n version?: string;\n /** Optional version description */\n description?: string;\n /** Print raw JSON response */\n json: boolean;\n /** Skip the \"create new bundle\" confirmation */\n yes: boolean;\n /** Include technical error details when a command fails */\n debug?: boolean;\n}\n\n/**\n * Build and upload a new immutable policy bundle version.\n *\n * @param this - CLI context\n * @param flags - Command flags\n */\nexport async function publish(\n this: LocalContext,\n {\n dir,\n 'bundle-name': bundleName,\n auth,\n 'transcend-url': transcendUrl,\n version,\n description,\n json,\n yes,\n debug = false,\n }: PublishCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n setPolicyEngineCliDebug(debug);\n\n const resolvedDir = path.resolve(dir);\n const versionLabel = version ?? defaultPolicyVersionLabel(bundleName);\n const client = buildPolicyEngineClient(transcendUrl, auth);\n\n let bundlePath: string | undefined;\n try {\n logger.info(colors.green(`Building policy bundle from ${resolvedDir}...`));\n bundlePath = await buildOpaBundleTarball(resolvedDir);\n\n const existingBundleId = await resolveBundleIdByName(client, bundleName);\n\n let responseBody: CreatePolicyBundleResponse | CreatePolicyBundleVersionResponse;\n\n if (existingBundleId) {\n logger.info(colors.green(`Uploading new version for bundle \"${bundleName}\"...`));\n const form = buildPolicyBundleFormData({\n bundlePath,\n version: versionLabel,\n description,\n });\n responseBody = await policyEngineRequest(\n client\n .post(`v1/policy-engine/policy-bundles/${existingBundleId}/versions`, { body: form })\n .json<CreatePolicyBundleVersionResponse>(),\n );\n } else {\n if (!this.process.stdin.isTTY && !yes) {\n logger.error(\n colors.red(\n 'Cannot create a new bundle in a non-interactive environment; pass --yes to confirm.',\n ),\n );\n this.process.exit(1);\n return;\n }\n\n if (!yes) {\n logger.warn(\n colors.yellow(`No policy bundle named \"${bundleName}\" exists for this organization.`),\n );\n const shouldCreate = await inquirerConfirmBoolean({\n message: `No policy bundle named \"${bundleName}\" exists. Create a new bundle and upload its first version?`,\n });\n if (!shouldCreate) {\n logger.info(colors.yellow('Publish cancelled.'));\n return;\n }\n }\n\n logger.info(colors.green(`Creating bundle \"${bundleName}\" and uploading first version...`));\n const createForm = buildPolicyBundleFormData({\n bundlePath,\n version: versionLabel,\n description,\n bundleName,\n });\n responseBody = await policyEngineRequest(\n client\n .post('v1/policy-engine/policy-bundles', {\n body: createForm,\n })\n .json<CreatePolicyBundleResponse>(),\n );\n }\n\n printResult(this.process.stdout, {\n json,\n data: responseBody,\n renderTable: () => formatPolicyBundleVersionSummary(responseBody.version),\n });\n\n logger.info(colors.green('Policy bundle version uploaded successfully.'));\n\n const activateCommand = buildExampleCommand<ActivateCommandFlags>(['policy', 'activate'], {\n version: responseBody.version.version,\n 'bundle-name': bundleName,\n });\n logger.info(\n colors.yellow(\n `Publishing a policy does not activate it. To activate this version, run:\\n ${activateCommand}`,\n ),\n );\n } finally {\n if (bundlePath && fs.existsSync(bundlePath)) {\n fs.unlinkSync(bundlePath);\n }\n }\n}\n"],"mappings":"8tBAqBA,SAAS,EAAsB,EAA+B,CAC5D,OAAO,EAAa,SAAS,QAAQ,EAAI,CAAC,EAAa,SAAS,aAAa,CAqB/E,SAAS,EAAyB,EAAmC,CACnE,IAAM,EAAe,EAAK,KAAK,EAAK,gBAAgB,CACpD,GAAI,CAAC,EAAG,WAAW,EAAa,CAC9B,MAAU,MAAM,6DAA6D,CAG/E,IAAM,EAAM,EAAG,aAAa,EAAc,OAAO,CAC7C,EACJ,GAAI,CACF,EAAS,KAAK,MAAM,EAAI,OACjB,EAAK,CACZ,MAAU,MACR,oCAAoC,aAAe,MA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EACnB,EACG,KAAK,kCAAmC,CACvC,KAAM,EACP,CAAC,CACD,MAAkC,CACtC,CAGH,EAAY,KAAK,QAAQ,OAAQ,CAC/B,OACA,KAAM,EACN,gBAAmB,EAAiC,EAAa,QAAQ,CAC1E,CAAC,CAEF,EAAO,KAAK,EAAO,MAAM,+CAA+C,CAAC,CAEzE,IAAM,EAAkB,EAA0C,CAAC,SAAU,WAAW,CAAE,CACxF,QAAS,EAAa,QAAQ,QAC9B,cAAe,EAChB,CAAC,CACF,EAAO,KACL,EAAO,OACL,+EAA+E,IAChF,CACF,QACO,CACJ,GAAc,EAAG,WAAW,EAAW,EACzC,EAAG,WAAW,EAAW"}
1
+ {"version":3,"file":"impl-Cj5NeBI22.mjs","names":["fg"],"sources":["../src/commands/policy/helpers/buildOpaBundleTarball.ts","../src/commands/policy/helpers/buildPolicyBundleFormData.ts","../src/commands/policy/helpers/defaultPolicyVersionLabel.ts","../src/commands/policy/publish/impl.ts"],"sourcesContent":["import { spawnSync } from 'node:child_process';\nimport fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\nimport { gunzipSync } from 'node:zlib';\n\nimport fg from 'fast-glob';\n\nimport { MAX_BUNDLE_COMPRESSED_BYTES, MAX_BUNDLE_DECOMPRESSED_BYTES } from '../constants.js';\nimport { assertOpaInstalled } from './assertOpaInstalled.js';\nimport { runOPACapture } from './runOpa.js';\n\n/**\n * Returns whether a relative path is a publishable Rego policy file.\n *\n * OPA test files (`*_test.rego`) are excluded because they are for local\n * validation only and are not part of the upload contract.\n *\n * @param relativePath - Path relative to the bundle directory\n * @returns Whether the file should be included in the upload archive\n */\nfunction isPublishableRegoFile(relativePath: string): boolean {\n return relativePath.endsWith('.rego') && !relativePath.endsWith('_test.rego');\n}\n\n/** Shape of the OPA bundle `manifest.json` as accepted by the Policy Engine. */\ninterface PolicyBundleManifest {\n /** Roots of the bundle, e.g. `[\"policy_engine\"]` or `[\"policy_engine/transcend\"]` */\n roots: string[];\n}\n\n/**\n * Reads and validates `manifest.json` from a policy bundle directory.\n *\n * The Policy Engine requires `manifest.json` to declare `roots` as an array of\n * strings. OPA's own tooling does not always enforce this against the Rego\n * packages on upload, so we validate the shape client-side to surface a clear,\n * actionable error instead of an opaque server `400` or a decide-time\n * fail-closed footgun.\n *\n * @param dir - Absolute path to the policy bundle directory\n * @returns The parsed manifest\n */\nfunction readPolicyBundleManifest(dir: string): PolicyBundleManifest {\n const manifestPath = path.join(dir, 'manifest.json');\n if (!fs.existsSync(manifestPath)) {\n throw new Error('Policy bundle directory must contain a manifest.json file.');\n }\n\n const raw = fs.readFileSync(manifestPath, 'utf8');\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch (err) {\n throw new Error(\n `manifest.json is not valid JSON: ${err instanceof Error ? err.message : String(err)}`,\n { cause: err },\n );\n }\n\n if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {\n throw new Error('manifest.json must contain a JSON object.');\n }\n\n const roots = (parsed as { roots?: unknown }).roots;\n if (!Array.isArray(roots) || roots.length === 0) {\n throw new Error(\n 'manifest.json must declare \"roots\" as a non-empty array of strings (e.g. {\"roots\":[\"policy_engine\"]}).',\n );\n }\n\n if (!roots.every((root) => typeof root === 'string' && root.length > 0)) {\n throw new Error('manifest.json \"roots\" must be an array of non-empty strings.');\n }\n\n return { roots };\n}\n\n/** Result of collecting publishable entries from a policy bundle directory. */\ninterface PolicyBundleArchiveContents {\n /** Relative paths to include in the upload tarball (manifest first, then rego) */\n entries: string[];\n /** Parsed manifest */\n manifest: PolicyBundleManifest;\n}\n\n/**\n * Collects `manifest.json` and publishable `.rego` files from a policy directory.\n *\n * @param dir - Absolute path to the policy bundle directory\n * @returns Archive entries and the parsed manifest\n */\nfunction collectPolicyBundleArchiveEntries(dir: string): PolicyBundleArchiveContents {\n const manifest = readPolicyBundleManifest(dir);\n\n const regoFiles = fg\n .sync('**/*.rego', {\n cwd: dir,\n onlyFiles: true,\n dot: false,\n })\n .filter(isPublishableRegoFile);\n\n if (regoFiles.length === 0) {\n throw new Error('Policy bundle directory must contain at least one .rego policy file.');\n }\n\n return { entries: ['manifest.json', ...regoFiles.sort()], manifest };\n}\n\n/** Matches a Rego `package <path>` declaration. */\nconst PACKAGE_DECLARATION_PATTERN = /^\\s*package\\s+([A-Za-z_][\\w.]*)/m;\n\n/**\n * Normalizes an OPA manifest root to a dotted package prefix.\n *\n * Roots use `/` as the path separator (e.g. `policy_engine/transcend`); Rego\n * package paths use `.` (e.g. `policy_engine.transcend`).\n *\n * @param root - A manifest root string\n * @returns The root in dotted form\n */\nfunction normalizeRootToPackagePrefix(root: string): string {\n return root.replace(/\\//g, '.');\n}\n\n/**\n * Reads the Rego package path declared in a `.rego` file.\n *\n * @param filePath - Absolute path to the `.rego` file\n * @returns The dotted package path, or `undefined` if no `package` declaration\n */\nfunction readRegoPackagePath(filePath: string): string | undefined {\n const contents = fs.readFileSync(filePath, 'utf8');\n const match = PACKAGE_DECLARATION_PATTERN.exec(contents);\n return match?.[1];\n}\n\n/**\n * Verifies that every publishable `.rego` package is covered by a manifest root.\n *\n * A bundle whose `roots` do not cover its Rego packages will upload cleanly but\n * fail-closed at decide time — the customer only discovers the mismatch via\n * denied decisions. This surfaces the mismatch at upload with a clear message.\n *\n * @param dir - Absolute path to the policy bundle directory\n * @param regoFiles - Relative paths to publishable `.rego` files\n * @param roots - Manifest roots\n */\nfunction assertRootsCoverPackages(dir: string, regoFiles: string[], roots: string[]): void {\n const rootPrefixes = roots.map(normalizeRootToPackagePrefix);\n\n const uncovered: string[] = [];\n for (const relativeRego of regoFiles) {\n const pkg = readRegoPackagePath(path.join(dir, relativeRego));\n if (!pkg) {\n continue;\n }\n const covered = rootPrefixes.some((prefix) => pkg === prefix || pkg.startsWith(`${prefix}.`));\n if (!covered) {\n uncovered.push(\n ` - ${relativeRego} (package ${pkg}) is not covered by roots [${roots.join(', ')}]`,\n );\n }\n }\n\n if (uncovered.length > 0) {\n throw new Error(\n [\n 'manifest.json \"roots\" do not cover all Rego packages in the bundle; ' +\n 'uncovered packages will fail-closed at decide time. Either broaden \"roots\" or move the policy under a covered package:',\n ...uncovered,\n ].join('\\n'),\n );\n }\n}\n\n/**\n * Verifies that a policy directory compiles end-to-end with `opa build`.\n *\n * The compiled output is discarded — the server receives the `manifest.json` +\n * `.rego` archive produced by {@link buildOpaBundleTarball}, not the OPA bundle\n * — but a successful build guarantees the policies compile and link, surfacing\n * errors (syntax, missing imports, undefined references, etc.) before upload.\n *\n * @param dir - Absolute path to the policy bundle directory\n */\nasync function assertBundleCompiles(dir: string): Promise<void> {\n const buildOutputPath = path.join(\n os.tmpdir(),\n `transcend-policy-bundle-build-${Date.now()}-${Math.random().toString(36).slice(2)}.tar.gz`,\n );\n try {\n // Run with `cwd` set to the bundle directory and pass `.` so `opa build`\n // resolves the bundle root correctly. `*_test.rego` files are local-only.\n const { code, stderr } = await runOPACapture(\n ['build', '--v0-compatible', '--ignore', '*_test.rego', '-o', buildOutputPath, '.'],\n { cwd: dir },\n );\n if (code !== 0) {\n throw new Error(stderr.trim() || `opa build failed with exit code ${code}`);\n }\n } finally {\n if (fs.existsSync(buildOutputPath)) {\n fs.unlinkSync(buildOutputPath);\n }\n }\n}\n\n/**\n * Formats a byte count as a human-readable size with binary units.\n *\n * @param bytes - Number of bytes\n * @returns Human-readable size, e.g. `14 MiB` or `4 KiB`\n */\nfunction formatBytes(bytes: number): string {\n if (bytes < 1024) {\n return `${bytes} B`;\n }\n const kib = bytes / 1024;\n if (kib < 1024) {\n return `${kib % 1 === 0 ? kib.toFixed(0) : kib.toFixed(1)} KiB`;\n }\n const mib = kib / 1024;\n return `${mib % 1 === 0 ? mib.toFixed(0) : mib.toFixed(1)} MiB`;\n}\n\n/**\n * Builds a gzip-compressed policy bundle tarball for upload to Transcend.\n *\n * The Policy Engine API expects a plain archive containing `manifest.json` and\n * one or more `.rego` files. This differs from `opa build` output, which embeds\n * `.manifest`, `data.json`, and other OPA bundle metadata that the server\n * rejects. Before packaging, the manifest is validated (shape + root coverage)\n * and the bundle is validated with `opa check` (strict Rego linting) and\n * `opa build` (full compilation) so failures surface client-side rather than\n * after upload.\n *\n * @param dir - Directory containing `manifest.json` and `.rego` policy files\n * @returns Absolute path to the generated `.tar.gz` bundle\n */\nexport async function buildOpaBundleTarball(dir: string): Promise<string> {\n assertOpaInstalled();\n\n const resolvedDir = path.resolve(dir);\n if (!fs.existsSync(resolvedDir) || !fs.statSync(resolvedDir).isDirectory()) {\n throw new Error(`Policy directory does not exist or is not a directory: ${resolvedDir}`);\n }\n\n // Validate the manifest shape and that roots cover every Rego package before\n // invoking OPA, so invalid manifests surface a clear error instead of an\n // opaque `opa build failed with exit code 1`.\n const { entries: archiveEntries, manifest } = collectPolicyBundleArchiveEntries(resolvedDir);\n const regoFiles = archiveEntries.filter((entry) => entry !== 'manifest.json');\n assertRootsCoverPackages(resolvedDir, regoFiles, manifest.roots);\n\n // Match the Rego v1 validation the Policy Engine API runs on upload.\n const { code: checkCode, stderr: checkStderr } = await runOPACapture([\n 'check',\n '--strict',\n '--v0-compatible',\n resolvedDir,\n ]);\n if (checkCode !== 0) {\n throw new Error(checkStderr.trim() || `opa check failed with exit code ${checkCode}`);\n }\n\n // Ensure the bundle compiles end-to-end before packaging for upload.\n await assertBundleCompiles(resolvedDir);\n\n const outputPath = path.join(\n os.tmpdir(),\n `transcend-policy-bundle-${Date.now()}-${Math.random().toString(36).slice(2)}.tar.gz`,\n );\n\n const tarResult = spawnSync('tar', ['-czf', outputPath, '-C', resolvedDir, ...archiveEntries], {\n env: { ...process.env, COPYFILE_DISABLE: '1' },\n encoding: 'utf8',\n });\n if (tarResult.status !== 0) {\n throw new Error(\n `Failed to create policy bundle archive: ${tarResult.stderr.trim() || 'tar failed'}`,\n );\n }\n\n const compressedBytes = fs.readFileSync(outputPath);\n if (compressedBytes.byteLength > MAX_BUNDLE_COMPRESSED_BYTES) {\n fs.unlinkSync(outputPath);\n throw new Error(\n `Policy bundle exceeds the ${formatBytes(MAX_BUNDLE_COMPRESSED_BYTES)} compressed upload limit ` +\n `(bundle is ${formatBytes(compressedBytes.byteLength)}). ` +\n `The server also rejects decompressed bundles larger than ${formatBytes(MAX_BUNDLE_DECOMPRESSED_BYTES)}.`,\n );\n }\n\n const decompressedBytes = gunzipSync(compressedBytes);\n if (decompressedBytes.byteLength > MAX_BUNDLE_DECOMPRESSED_BYTES) {\n fs.unlinkSync(outputPath);\n throw new Error(\n `Policy bundle exceeds the ${formatBytes(MAX_BUNDLE_DECOMPRESSED_BYTES)} decompressed upload limit ` +\n `(bundle is ${formatBytes(decompressedBytes.byteLength)} decompressed).`,\n );\n }\n\n return outputPath;\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\n\n/** Fields for building a policy bundle upload form. */\nexport interface BuildPolicyBundleFormDataOptions {\n /** Absolute path to the bundle tarball */\n bundlePath: string;\n /** Version label */\n version: string;\n /** Optional description */\n description?: string;\n /** Bundle name (only for create) */\n bundleName?: string;\n}\n\n/**\n * Builds multipart form data for a policy bundle upload.\n *\n * @param options - Upload fields\n * @returns FormData ready for POST\n */\nexport function buildPolicyBundleFormData(options: BuildPolicyBundleFormDataOptions): FormData {\n const bundleBytes = fs.readFileSync(options.bundlePath);\n const form = new FormData();\n form.append(\n 'bundle',\n new Blob([bundleBytes], { type: 'application/gzip' }),\n path.basename(options.bundlePath),\n );\n form.append('version', options.version);\n if (options.description) {\n form.append('description', options.description);\n }\n if (options.bundleName) {\n form.append('bundleName', options.bundleName);\n }\n return form;\n}\n","/**\n * Formats a date as `yyyy-mm-dd-hh-mm-ss` in UTC.\n *\n * @param date - Date to format\n * @returns Timestamp label\n */\nfunction formatPolicyVersionTimestamp(date: Date): string {\n return date.toISOString().slice(0, 19).replace(/[T:]/g, '-');\n}\n\n/**\n * Returns a default version label from the bundle name and current UTC timestamp.\n *\n * @param bundleName - Tenant-unique policy bundle name\n * @param now - Current time (for testing)\n * @returns Version label in `{bundleName}-yyyy-mm-dd-hh-mm-ss` form\n */\nexport function defaultPolicyVersionLabel(bundleName: string, now: Date = new Date()): string {\n return `${bundleName}-${formatPolicyVersionTimestamp(now)}`;\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\n\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { buildExampleCommand } from '../../../lib/docgen/buildExamples.js';\nimport { inquirerConfirmBoolean } from '../../../lib/helpers/inquirer.js';\nimport { logger } from '../../../logger.js';\nimport type { ActivateCommandFlags } from '../activate/impl.js';\nimport {\n buildPolicyBundleFormData,\n buildPolicyEngineClient,\n buildOpaBundleTarball,\n defaultPolicyVersionLabel,\n formatPolicyBundleVersionSummary,\n policyEngineRequest,\n printResult,\n resolveBundleIdByName,\n setPolicyEngineCliDebug,\n} from '../helpers/index.js';\nimport type { CreatePolicyBundleResponse, CreatePolicyBundleVersionResponse } from '../types.js';\n\n/** CLI flags for `transcend policy publish`. */\nexport interface PublishCommandFlags {\n /** Directory containing Rego policy files */\n dir: string;\n /** Tenant-unique bundle name */\n 'bundle-name': string;\n /** Transcend API key */\n auth: string;\n /** Transcend API URL */\n 'transcend-url': string;\n /** Version label (defaults to `{bundleName}-yyyy-mm-dd-hh-mm-ss`) */\n version?: string;\n /** Optional version description */\n description?: string;\n /** Print raw JSON response */\n json: boolean;\n /** Skip the \"create new bundle\" confirmation */\n yes: boolean;\n /** Include technical error details when a command fails */\n debug?: boolean;\n}\n\n/**\n * Build and upload a new immutable policy bundle version.\n *\n * @param this - CLI context\n * @param flags - Command flags\n */\nexport async function publish(\n this: LocalContext,\n {\n dir,\n 'bundle-name': bundleName,\n auth,\n 'transcend-url': transcendUrl,\n version,\n description,\n json,\n yes,\n debug = false,\n }: PublishCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n setPolicyEngineCliDebug(debug);\n\n const resolvedDir = path.resolve(dir);\n const versionLabel = version ?? defaultPolicyVersionLabel(bundleName);\n const client = buildPolicyEngineClient(transcendUrl, auth);\n\n let bundlePath: string | undefined;\n try {\n logger.info(colors.green(`Building policy bundle from ${resolvedDir}...`));\n bundlePath = await buildOpaBundleTarball(resolvedDir);\n\n const existingBundleId = await resolveBundleIdByName(client, bundleName);\n\n let responseBody: CreatePolicyBundleResponse | CreatePolicyBundleVersionResponse;\n\n if (existingBundleId) {\n logger.info(colors.green(`Uploading new version for bundle \"${bundleName}\"...`));\n const form = buildPolicyBundleFormData({\n bundlePath,\n version: versionLabel,\n description,\n });\n responseBody = await policyEngineRequest(\n client\n .post(`v1/policy-engine/policy-bundles/${existingBundleId}/versions`, { body: form })\n .json<CreatePolicyBundleVersionResponse>(),\n );\n } else {\n if (!this.process.stdin.isTTY && !yes) {\n logger.error(\n colors.red(\n 'Cannot create a new bundle in a non-interactive environment; pass --yes to confirm.',\n ),\n );\n this.process.exit(1);\n return;\n }\n\n if (!yes) {\n logger.warn(\n colors.yellow(`No policy bundle named \"${bundleName}\" exists for this organization.`),\n );\n const shouldCreate = await inquirerConfirmBoolean({\n message: `No policy bundle named \"${bundleName}\" exists. Create a new bundle and upload its first version?`,\n });\n if (!shouldCreate) {\n logger.info(colors.yellow('Publish cancelled.'));\n return;\n }\n }\n\n logger.info(colors.green(`Creating bundle \"${bundleName}\" and uploading first version...`));\n const createForm = buildPolicyBundleFormData({\n bundlePath,\n version: versionLabel,\n description,\n bundleName,\n });\n responseBody = await policyEngineRequest(\n client\n .post('v1/policy-engine/policy-bundles', {\n body: createForm,\n })\n .json<CreatePolicyBundleResponse>(),\n );\n }\n\n printResult(this.process.stdout, {\n json,\n data: responseBody,\n renderTable: () => formatPolicyBundleVersionSummary(responseBody.version),\n });\n\n logger.info(colors.green('Policy bundle version uploaded successfully.'));\n\n const activateCommand = buildExampleCommand<ActivateCommandFlags>(['policy', 'activate'], {\n version: responseBody.version.version,\n 'bundle-name': bundleName,\n });\n logger.info(\n colors.yellow(\n `Publishing a policy does not activate it. To activate this version, run:\\n ${activateCommand}`,\n ),\n );\n } finally {\n if (bundl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M,OAAS,CAAC,EAAK,CACrC,EAAO,MACL,EAAO,IACL,sFACD,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,CACpB,OAGF,GAAI,CAAC,IACH,EAAO,KACL,EAAO,OAAO,2BAA2B,EAAW,iCAAiC,CACtF,CAIG,CAAC,MAHsB,EAAuB,CAChD,QAAS,2BAA2B,EAAW,6DAChD,CAAC,EACiB,CACjB,EAAO,KAAK,EAAO,OAAO,qBAAqB,CAAC,CAChD,OAIJ,EAAO,KAAK,EAAO,MAAM,oBAAoB,EAAW,kCAAkC,CAAC,CAC3F,IAAM,EAAa,EAA0B,CAC3C,aACA,QAAS,EACT,cACA,aACD,CAAC,CACF,EAAe,MAAM,EACnB,EACG,KAAK,kCAAmC,CACvC,KAAM,EACP,CAAC,CACD,MAAkC,CACtC,CAGH,EAAY,KAAK,QAAQ,OAAQ,CAC/B,OACA,KAAM,EACN,gBAAmB,EAAiC,EAAa,QAAQ,CAC1E,CAAC,CAEF,EAAO,KAAK,EAAO,MAAM,+CAA+C,CAAC,CAEzE,IAAM,EAAkB,EAA0C,CAAC,SAAU,WAAW,CAAE,CACxF,QAAS,EAAa,QAAQ,QAC9B,cAAe,EAChB,CAAC,CACF,EAAO,KACL,EAAO,OACL,+EAA+E,IAChF,CACF,QACO,CACJ,GAAc,EAAG,WAAW,EAAW,EACzC,EAAG,WAAW,EAAW"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./logger-Ckep4QXn.mjs";import{t}from"./readCsv--FfP8n-H.mjs";import{t as n}from"./markRequestDataSiloIdsCompleted-CDV0Ppv2.mjs";import{t as r}from"./done-input-validation-DL31vk7g.mjs";import i from"colors";import*as a from"io-ts";const o=a.type({"Request Id":a.string});async function s({auth:a,dataSiloId:s,file:c,transcendUrl:l}){r(this.process.exit),e.info(i.magenta(`Reading "${c}" from disk`)),await n({requestIds:t(c,o).map(e=>e[`Request Id`]),transcendUrl:l,auth:a,dataSiloId:s})}export{s as markRequestDataSilosCompleted};
2
- //# sourceMappingURL=impl-DJHPOIQn2.mjs.map
1
+ import{t as e}from"./logger-Ckep4QXn.mjs";import{t}from"./readCsv--FfP8n-H.mjs";import{t as n}from"./markRequestDataSiloIdsCompleted-C-yZAoq6.mjs";import{t as r}from"./done-input-validation-DL31vk7g.mjs";import i from"colors";import*as a from"io-ts";const o=a.type({"Request Id":a.string});async function s({auth:a,dataSiloId:s,file:c,transcendUrl:l}){r(this.process.exit),e.info(i.magenta(`Reading "${c}" from disk`)),await n({requestIds:t(c,o).map(e=>e[`Request Id`]),transcendUrl:l,auth:a,dataSiloId:s})}export{s as markRequestDataSilosCompleted};
2
+ //# sourceMappingURL=impl-CmlkjIP72.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-DJHPOIQn2.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 { readCsv } from '../../../../lib/requests/index.js';\nimport { logger } from '../../../../logger.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.exit);\n\n logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const activeResults = readCsv(file, RequestIdRow);\n\n await markRequestDataSiloIdsCompleted({\n requestIds: activeResults.map((request) => request['Request Id']),\n transcendUrl,\n auth,\n dataSiloId,\n });\n}\n"],"mappings":"0PASA,MAAM,EAAe,EAAE,KAAK,CAC1B,aAAc,EAAE,OACjB,CAAC,CASF,eAAsB,EAEpB,CAAE,OAAM,aAAY,OAAM,gBACX,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,EAAO,KAAK,EAAO,QAAQ,YAAY,EAAK,aAAa,CAAC,CAG1D,MAAM,EAAgC,CACpC,WAHoB,EAAQ,EAAM,EAGT,CAAC,IAAK,GAAY,EAAQ,cAAc,CACjE,eACA,OACA,aACD,CAAC"}
1
+ {"version":3,"file":"impl-CmlkjIP72.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 { readCsv } from '../../../../lib/requests/index.js';\nimport { logger } from '../../../../logger.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.exit);\n\n logger.info(colors.magenta(`Reading \"${file}\" from disk`));\n const activeResults = readCsv(file, RequestIdRow);\n\n await markRequestDataSiloIdsCompleted({\n requestIds: activeResults.map((request) => request['Request Id']),\n transcendUrl,\n auth,\n dataSiloId,\n });\n}\n"],"mappings":"0PASA,MAAM,EAAe,EAAE,KAAK,CAC1B,aAAc,EAAE,OACjB,CAAC,CASF,eAAsB,EAEpB,CAAE,OAAM,aAAY,OAAM,gBACX,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,EAAO,KAAK,EAAO,QAAQ,YAAY,EAAK,aAAa,CAAC,CAG1D,MAAM,EAAgC,CACpC,WAHoB,EAAQ,EAAM,EAGT,CAAC,IAAK,GAAY,EAAQ,cAAc,CACjE,eACA,OACA,aACD,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./logger-Ckep4QXn.mjs";import{t}from"./collectCsvFilesOrExit-BPo8Mjy7.mjs";import{t as n}from"./done-input-validation-DL31vk7g.mjs";import{a as r,i,n as a,r as o,t as s}from"./createExtraKeyHandler-DbWzaD4c.mjs";import c from"colors";import{CHILD_FLAG as l,PoolCancelledError as u,computePoolSize as d,resolveWorkerPath as f,runPool as p}from"@transcend-io/utils";function m(e){return a(e)}function h(e){return o(e)}const g={renderHeader:m,renderWorkers:h};async function _(a){n(this.process.exit);let{directory:o,outputDir:m,clearOutputDir:h,chunkSizeMB:_,concurrency:v,viewerMode:y}=a,b=t(o,this),{poolSize:x,cpuCount:S}=d(v,b.length);e.info(c.green(`Chunking ${b.length} CSV file(s) with pool size ${x} (CPU=${S})`));let C=b.map(e=>({filePath:e,options:{outputDir:m,clearOutputDir:h,chunkSizeMB:_}}));await p({title:`Chunk CSV - ${o}`,baseDir:o||m||process.cwd(),childFlag:l,childModulePath:f(import.meta.url,`commands/admin/chunk-csv/worker.mjs`),poolSize:x,cpuCount:S,filesTotal:b.length,hooks:{nextTask:()=>C.shift(),taskLabel:e=>e.filePath,initTotals:()=>({}),initSlotProgress:()=>void 0,onProgress:e=>e,onResult:(e,t)=>({totals:e,ok:!!t.ok}),postProcess:async()=>{}},viewerMode:y,render:e=>i(e,g,y),installInteractiveSwitcher:y?void 0:({workers:e,onCtrlC:t,getLogPaths:n,replayBytes:i,replayWhich:a,setPaused:o,repaint:s})=>r({workers:e,onCtrlC:t,getLogPaths:n,replayBytes:i,replayWhich:a,onAttach:()=>o(!0),onDetach:()=>{o(!1),s()},onEnterAttachScreen:e=>{o(!0),process.stdout.write(`\x1B[2J\x1B[H`),process.stdout.write(`Attached to worker ${e}. (Esc/Ctrl+] detach \u2022 Ctrl+D EOF \u2022 Ctrl+C SIGINT)\n`)}}),extraKeyHandler:({logsBySlot:e,repaint:t,setPaused:n})=>s({logsBySlot:e,repaint:t,setPaused:n})}).catch(e=>{throw e instanceof u&&process.exit(130),e})}export{_ as chunkCsv};
2
- //# sourceMappingURL=impl-y01BtY2r.mjs.map
1
+ import{t as e}from"./logger-Ckep4QXn.mjs";import{t}from"./collectCsvFilesOrExit-BPo8Mjy7.mjs";import{t as n}from"./done-input-validation-DL31vk7g.mjs";import{a as r,i,n as a,r as o,t as s}from"./createExtraKeyHandler-MXCneIvy.mjs";import c from"colors";import{CHILD_FLAG as l,PoolCancelledError as u,computePoolSize as d,resolveWorkerPath as f,runPool as p}from"@transcend-io/utils";function m(e){return a(e)}function h(e){return o(e)}const g={renderHeader:m,renderWorkers:h};async function _(a){n(this.process.exit);let{directory:o,outputDir:m,clearOutputDir:h,chunkSizeMB:_,concurrency:v,viewerMode:y}=a,b=t(o,this),{poolSize:x,cpuCount:S}=d(v,b.length);e.info(c.green(`Chunking ${b.length} CSV file(s) with pool size ${x} (CPU=${S})`));let C=b.map(e=>({filePath:e,options:{outputDir:m,clearOutputDir:h,chunkSizeMB:_}}));await p({title:`Chunk CSV - ${o}`,baseDir:o||m||process.cwd(),childFlag:l,childModulePath:f(import.meta.url,`commands/admin/chunk-csv/worker.mjs`),poolSize:x,cpuCount:S,filesTotal:b.length,hooks:{nextTask:()=>C.shift(),taskLabel:e=>e.filePath,initTotals:()=>({}),initSlotProgress:()=>void 0,onProgress:e=>e,onResult:(e,t)=>({totals:e,ok:!!t.ok}),postProcess:async()=>{}},viewerMode:y,render:e=>i(e,g,y),installInteractiveSwitcher:y?void 0:({workers:e,onCtrlC:t,getLogPaths:n,replayBytes:i,replayWhich:a,setPaused:o,repaint:s})=>r({workers:e,onCtrlC:t,getLogPaths:n,replayBytes:i,replayWhich:a,onAttach:()=>o(!0),onDetach:()=>{o(!1),s()},onEnterAttachScreen:e=>{o(!0),process.stdout.write(`\x1B[2J\x1B[H`),process.stdout.write(`Attached to worker ${e}. (Esc/Ctrl+] detach \u2022 Ctrl+D EOF \u2022 Ctrl+C SIGINT)\n`)}}),extraKeyHandler:({logsBySlot:e,repaint:t,setPaused:n})=>s({logsBySlot:e,repaint:t,setPaused:n})}).catch(e=>{throw e instanceof u&&process.exit(130),e})}export{_ as chunkCsv};
2
+ //# sourceMappingURL=impl-D0fkfLxw.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-y01BtY2r.mjs","names":[],"sources":["../src/commands/admin/chunk-csv/ui/plugin.ts","../src/commands/admin/chunk-csv/impl.ts"],"sourcesContent":["import {\n makeHeader,\n makeWorkerRows,\n type ChunkSlotProgress,\n type CommonCtx,\n type DashboardPlugin,\n} from '../../../../lib/pooling/index.js';\n\n/**\n * Header for chunk-csv (no extra totals block).\n *\n * @param ctx - Dashboard context.\n * @returns Header lines.\n */\nfunction renderHeader<TTotals>(ctx: CommonCtx<TTotals, ChunkSlotProgress>): string[] {\n // no extra lines — reuse the shared header as-is\n return makeHeader(ctx);\n}\n\n/**\n * Worker rows for chunk-csv — share the generic row renderer.\n *\n * @param ctx - Dashboard context.\n * @returns Array of strings, each representing one worker row.\n */\nfunction renderWorkers<TTotals>(ctx: CommonCtx<TTotals, ChunkSlotProgress>): string[] {\n return makeWorkerRows(ctx);\n}\n\nexport const chunkCsvPlugin: DashboardPlugin<unknown, ChunkSlotProgress> = {\n renderHeader,\n renderWorkers,\n // no extras\n};\n","import {\n CHILD_FLAG,\n type PoolHooks,\n runPool,\n computePoolSize,\n PoolCancelledError,\n resolveWorkerPath,\n} from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { collectCsvFilesOrExit } from '../../../lib/helpers/collectCsvFilesOrExit.js';\nimport {\n createExtraKeyHandler,\n dashboardPlugin,\n installInteractiveSwitcher,\n} from '../../../lib/pooling/index.js';\nimport { logger } from '../../../logger.js';\nimport { chunkCsvPlugin } from './ui/index.js';\nimport type { ChunkProgress, ChunkResult, ChunkTask } from './worker.js';\n\n/**\n * Totals aggregate for this command.\n * We don’t need custom counters since the runner already tracks\n * completed/failed counts in its header — so we just use an empty record.\n */\ntype Totals = Record<string, never>;\n\n/**\n * CLI flags accepted by the `chunk-csv` command.\n *\n * These are passed down from the CLI parser into the parent process.\n */\nexport type ChunkCsvCommandFlags = {\n directory: string;\n outputDir?: string;\n clearOutputDir: boolean;\n chunkSizeMB: number;\n concurrency?: number;\n viewerMode: boolean;\n};\n\n/**\n * Parent entrypoint for chunking many CSVs in parallel using the worker pool runner.\n *\n * Lifecycle:\n * 1) Discover CSV inputs (exit if none).\n * 2) Compute pool size (CPU-count heuristic or --concurrency).\n * 3) Build a FIFO queue of `ChunkTask`s.\n * 4) Define pool hooks to drive task assignment, progress, and result handling.\n * 5) Launch the pool with `runPool`, rendering via the `chunkCsvPlugin`.\n *\n * @param this - Bound CLI context (provides process exit + logging).\n * @param flags - CLI options for the run.\n */\nexport async function chunkCsv(this: LocalContext, flags: ChunkCsvCommandFlags): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const { directory, outputDir, clearOutputDir, chunkSizeMB, concurrency, viewerMode } = flags;\n\n /* 1) Discover CSV inputs */\n const files = collectCsvFilesOrExit(directory, this);\n\n /* 2) Size the pool */\n const { poolSize, cpuCount } = computePoolSize(concurrency, files.length);\n\n logger.info(\n colors.green(\n `Chunking ${files.length} CSV file(s) with pool size ${poolSize} (CPU=${cpuCount})`,\n ),\n );\n\n /* 3) Prepare a simple FIFO queue of tasks (one per file). */\n const queue = files.map<ChunkTask>((filePath) => ({\n filePath,\n options: { outputDir, clearOutputDir, chunkSizeMB },\n }));\n\n /* 4) Define pool hooks to adapt runner to this command. */\n const hooks: PoolHooks<ChunkTask, ChunkProgress, ChunkResult, Totals> = {\n nextTask: () => queue.shift(),\n taskLabel: (t) => t.filePath,\n initTotals: () => ({}) as Totals,\n initSlotProgress: () => undefined,\n onProgress: (totals) => totals,\n onResult: (totals, res) => ({ totals, ok: !!res.ok }),\n // postProcess receives log context when viewerMode=true — we don’t need it here.\n postProcess: async () => {\n // nothing extra for chunk-csv\n },\n };\n\n /* 5) Launch the pool runner with our hooks and custom dashboard plugin. */\n await runPool({\n title: `Chunk CSV - ${directory}`,\n baseDir: directory || outputDir || process.cwd(),\n childFlag: CHILD_FLAG,\n childModulePath: resolveWorkerPath(import.meta.url, 'commands/admin/chunk-csv/worker.mjs'),\n poolSize,\n cpuCount,\n filesTotal: files.length,\n hooks,\n viewerMode,\n render: (input) => dashboardPlugin(input, chunkCsvPlugin, viewerMode),\n installInteractiveSwitcher: viewerMode\n ? undefined\n : ({\n workers,\n onCtrlC,\n getLogPaths,\n replayBytes: rb,\n replayWhich: rw,\n setPaused,\n repaint: rp,\n }) =>\n installInteractiveSwitcher({\n workers,\n onCtrlC,\n getLogPaths,\n replayBytes: rb,\n replayWhich: rw,\n onAttach: () => setPaused(true),\n onDetach: () => {\n setPaused(false);\n rp();\n },\n onEnterAttachScreen: (id) => {\n setPaused(true);\n process.stdout.write('\\x1b[2J\\x1b[H');\n process.stdout.write(\n `Attached to worker ${id}. (Esc/Ctrl+] detach \\u2022 Ctrl+D EOF \\u2022 Ctrl+C SIGINT)\\n`,\n );\n },\n }),\n extraKeyHandler: ({ logsBySlot, repaint, setPaused }) =>\n createExtraKeyHandler({\n logsBySlot,\n repaint,\n setPaused,\n }),\n }).catch((err) => {\n if (err instanceof PoolCancelledError) {\n process.exit(130);\n }\n throw err;\n });\n}\n"],"mappings":"+XAcA,SAAS,EAAsB,EAAsD,CAEnF,OAAO,EAAW,EAAI,CASxB,SAAS,EAAuB,EAAsD,CACpF,OAAO,EAAe,EAAI,CAG5B,MAAa,EAA8D,CACzE,eACA,gBAED,CCuBD,eAAsB,EAA6B,EAA4C,CAC7F,EAAoB,KAAK,QAAQ,KAAK,CAEtC,GAAM,CAAE,YAAW,YAAW,iBAAgB,cAAa,cAAa,cAAe,EAGjF,EAAQ,EAAsB,EAAW,KAAK,CAG9C,CAAE,WAAU,YAAa,EAAgB,EAAa,EAAM,OAAO,CAEzE,EAAO,KACL,EAAO,MACL,YAAY,EAAM,OAAO,8BAA8B,EAAS,QAAQ,EAAS,GAClF,CACF,CAGD,IAAM,EAAQ,EAAM,IAAgB,IAAc,CAChD,WACA,QAAS,CAAE,YAAW,iBAAgB,cAAa,CACpD,EAAE,CAiBH,MAAM,EAAQ,CACZ,MAAO,eAAe,IACtB,QAAS,GAAa,GAAa,QAAQ,KAAK,CAChD,UAAW,EACX,gBAAiB,EAAkB,OAAO,KAAK,IAAK,sCAAsC,CAC1F,WACA,WACA,WAAY,EAAM,OAClB,MAAA,CArBA,aAAgB,EAAM,OAAO,CAC7B,UAAY,GAAM,EAAE,SACpB,gBAAmB,EAAE,EACrB,qBAAwB,IAAA,GACxB,WAAa,GAAW,EACxB,UAAW,EAAQ,KAAS,CAAE,SAAQ,GAAI,CAAC,CAAC,EAAI,GAAI,EAEpD,YAAa,SAAY,GAcpB,CACL,aACA,OAAS,GAAU,EAAgB,EAAO,EAAgB,EAAW,CACrE,2BAA4B,EACxB,IAAA,IACC,CACC,UACA,UACA,cACA,YAAa,EACb,YAAa,EACb,YACA,QAAS,KAET,EAA2B,CACzB,UACA,UACA,cACA,YAAa,EACb,YAAa,EACb,aAAgB,EAAU,GAAK,CAC/B,aAAgB,CACd,EAAU,GAAM,CAChB,GAAI,EAEN,oBAAsB,GAAO,CAC3B,EAAU,GAAK,CACf,QAAQ,OAAO,MAAM,gBAAgB,CACrC,QAAQ,OAAO,MACb,sBAAsB,EAAG,gEAC1B,EAEJ,CAAC,CACR,iBAAkB,CAAE,aAAY,UAAS,eACvC,EAAsB,CACpB,aACA,UACA,YACD,CAAC,CACL,CAAC,CAAC,MAAO,GAAQ,CAIhB,MAHI,aAAe,GACjB,QAAQ,KAAK,IAAI,CAEb,GACN"}
1
+ {"version":3,"file":"impl-D0fkfLxw.mjs","names":[],"sources":["../src/commands/admin/chunk-csv/ui/plugin.ts","../src/commands/admin/chunk-csv/impl.ts"],"sourcesContent":["import {\n makeHeader,\n makeWorkerRows,\n type ChunkSlotProgress,\n type CommonCtx,\n type DashboardPlugin,\n} from '../../../../lib/pooling/index.js';\n\n/**\n * Header for chunk-csv (no extra totals block).\n *\n * @param ctx - Dashboard context.\n * @returns Header lines.\n */\nfunction renderHeader<TTotals>(ctx: CommonCtx<TTotals, ChunkSlotProgress>): string[] {\n // no extra lines — reuse the shared header as-is\n return makeHeader(ctx);\n}\n\n/**\n * Worker rows for chunk-csv — share the generic row renderer.\n *\n * @param ctx - Dashboard context.\n * @returns Array of strings, each representing one worker row.\n */\nfunction renderWorkers<TTotals>(ctx: CommonCtx<TTotals, ChunkSlotProgress>): string[] {\n return makeWorkerRows(ctx);\n}\n\nexport const chunkCsvPlugin: DashboardPlugin<unknown, ChunkSlotProgress> = {\n renderHeader,\n renderWorkers,\n // no extras\n};\n","import {\n CHILD_FLAG,\n type PoolHooks,\n runPool,\n computePoolSize,\n PoolCancelledError,\n resolveWorkerPath,\n} from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { collectCsvFilesOrExit } from '../../../lib/helpers/collectCsvFilesOrExit.js';\nimport {\n createExtraKeyHandler,\n dashboardPlugin,\n installInteractiveSwitcher,\n} from '../../../lib/pooling/index.js';\nimport { logger } from '../../../logger.js';\nimport { chunkCsvPlugin } from './ui/index.js';\nimport type { ChunkProgress, ChunkResult, ChunkTask } from './worker.js';\n\n/**\n * Totals aggregate for this command.\n * We don’t need custom counters since the runner already tracks\n * completed/failed counts in its header — so we just use an empty record.\n */\ntype Totals = Record<string, never>;\n\n/**\n * CLI flags accepted by the `chunk-csv` command.\n *\n * These are passed down from the CLI parser into the parent process.\n */\nexport type ChunkCsvCommandFlags = {\n directory: string;\n outputDir?: string;\n clearOutputDir: boolean;\n chunkSizeMB: number;\n concurrency?: number;\n viewerMode: boolean;\n};\n\n/**\n * Parent entrypoint for chunking many CSVs in parallel using the worker pool runner.\n *\n * Lifecycle:\n * 1) Discover CSV inputs (exit if none).\n * 2) Compute pool size (CPU-count heuristic or --concurrency).\n * 3) Build a FIFO queue of `ChunkTask`s.\n * 4) Define pool hooks to drive task assignment, progress, and result handling.\n * 5) Launch the pool with `runPool`, rendering via the `chunkCsvPlugin`.\n *\n * @param this - Bound CLI context (provides process exit + logging).\n * @param flags - CLI options for the run.\n */\nexport async function chunkCsv(this: LocalContext, flags: ChunkCsvCommandFlags): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const { directory, outputDir, clearOutputDir, chunkSizeMB, concurrency, viewerMode } = flags;\n\n /* 1) Discover CSV inputs */\n const files = collectCsvFilesOrExit(directory, this);\n\n /* 2) Size the pool */\n const { poolSize, cpuCount } = computePoolSize(concurrency, files.length);\n\n logger.info(\n colors.green(\n `Chunking ${files.length} CSV file(s) with pool size ${poolSize} (CPU=${cpuCount})`,\n ),\n );\n\n /* 3) Prepare a simple FIFO queue of tasks (one per file). */\n const queue = files.map<ChunkTask>((filePath) => ({\n filePath,\n options: { outputDir, clearOutputDir, chunkSizeMB },\n }));\n\n /* 4) Define pool hooks to adapt runner to this command. */\n const hooks: PoolHooks<ChunkTask, ChunkProgress, ChunkResult, Totals> = {\n nextTask: () => queue.shift(),\n taskLabel: (t) => t.filePath,\n initTotals: () => ({}) as Totals,\n initSlotProgress: () => undefined,\n onProgress: (totals) => totals,\n onResult: (totals, res) => ({ totals, ok: !!res.ok }),\n // postProcess receives log context when viewerMode=true — we don’t need it here.\n postProcess: async () => {\n // nothing extra for chunk-csv\n },\n };\n\n /* 5) Launch the pool runner with our hooks and custom dashboard plugin. */\n await runPool({\n title: `Chunk CSV - ${directory}`,\n baseDir: directory || outputDir || process.cwd(),\n childFlag: CHILD_FLAG,\n childModulePath: resolveWorkerPath(import.meta.url, 'commands/admin/chunk-csv/worker.mjs'),\n poolSize,\n cpuCount,\n filesTotal: files.length,\n hooks,\n viewerMode,\n render: (input) => dashboardPlugin(input, chunkCsvPlugin, viewerMode),\n installInteractiveSwitcher: viewerMode\n ? undefined\n : ({\n workers,\n onCtrlC,\n getLogPaths,\n replayBytes: rb,\n replayWhich: rw,\n setPaused,\n repaint: rp,\n }) =>\n installInteractiveSwitcher({\n workers,\n onCtrlC,\n getLogPaths,\n replayBytes: rb,\n replayWhich: rw,\n onAttach: () => setPaused(true),\n onDetach: () => {\n setPaused(false);\n rp();\n },\n onEnterAttachScreen: (id) => {\n setPaused(true);\n process.stdout.write('\\x1b[2J\\x1b[H');\n process.stdout.write(\n `Attached to worker ${id}. (Esc/Ctrl+] detach \\u2022 Ctrl+D EOF \\u2022 Ctrl+C SIGINT)\\n`,\n );\n },\n }),\n extraKeyHandler: ({ logsBySlot, repaint, setPaused }) =>\n createExtraKeyHandler({\n logsBySlot,\n repaint,\n setPaused,\n }),\n }).catch((err) => {\n if (err instanceof PoolCancelledError) {\n process.exit(130);\n }\n throw err;\n });\n}\n"],"mappings":"+XAcA,SAAS,EAAsB,EAAsD,CAEnF,OAAO,EAAW,EAAI,CASxB,SAAS,EAAuB,EAAsD,CACpF,OAAO,EAAe,EAAI,CAG5B,MAAa,EAA8D,CACzE,eACA,gBAED,CCuBD,eAAsB,EAA6B,EAA4C,CAC7F,EAAoB,KAAK,QAAQ,KAAK,CAEtC,GAAM,CAAE,YAAW,YAAW,iBAAgB,cAAa,cAAa,cAAe,EAGjF,EAAQ,EAAsB,EAAW,KAAK,CAG9C,CAAE,WAAU,YAAa,EAAgB,EAAa,EAAM,OAAO,CAEzE,EAAO,KACL,EAAO,MACL,YAAY,EAAM,OAAO,8BAA8B,EAAS,QAAQ,EAAS,GAClF,CACF,CAGD,IAAM,EAAQ,EAAM,IAAgB,IAAc,CAChD,WACA,QAAS,CAAE,YAAW,iBAAgB,cAAa,CACpD,EAAE,CAiBH,MAAM,EAAQ,CACZ,MAAO,eAAe,IACtB,QAAS,GAAa,GAAa,QAAQ,KAAK,CAChD,UAAW,EACX,gBAAiB,EAAkB,OAAO,KAAK,IAAK,sCAAsC,CAC1F,WACA,WACA,WAAY,EAAM,OAClB,MAAA,CArBA,aAAgB,EAAM,OAAO,CAC7B,UAAY,GAAM,EAAE,SACpB,gBAAmB,EAAE,EACrB,qBAAwB,IAAA,GACxB,WAAa,GAAW,EACxB,UAAW,EAAQ,KAAS,CAAE,SAAQ,GAAI,CAAC,CAAC,EAAI,GAAI,EAEpD,YAAa,SAAY,GAcpB,CACL,aACA,OAAS,GAAU,EAAgB,EAAO,EAAgB,EAAW,CACrE,2BAA4B,EACxB,IAAA,IACC,CACC,UACA,UACA,cACA,YAAa,EACb,YAAa,EACb,YACA,QAAS,KAET,EAA2B,CACzB,UACA,UACA,cACA,YAAa,EACb,YAAa,EACb,aAAgB,EAAU,GAAK,CAC/B,aAAgB,CACd,EAAU,GAAM,CAChB,GAAI,EAEN,oBAAsB,GAAO,CAC3B,EAAU,GAAK,CACf,QAAQ,OAAO,MAAM,gBAAgB,CACrC,QAAQ,OAAO,MACb,sBAAsB,EAAG,gEAC1B,EAEJ,CAAC,CACR,iBAAkB,CAAE,aAAY,UAAS,eACvC,EAAsB,CACpB,aACA,UACA,YACD,CAAC,CACL,CAAC,CAAC,MAAO,GAAQ,CAIhB,MAHI,aAAe,GACjB,QAAQ,KAAK,IAAI,CAEb,GACN"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./uploadDataFlowsFromCsv-0oDEouPJ.mjs";import{t}from"./done-input-validation-DL31vk7g.mjs";async function n({auth:n,trackerStatus:r,file:i,classifyService:a,transcendUrl:o}){t(this.process.exit),await e({auth:n,trackerStatus:r,file:i,classifyService:a,transcendUrl:o})}export{n as uploadDataFlowsFromCsv};
2
- //# sourceMappingURL=impl-DOQk-mfA.mjs.map
1
+ import{t as e}from"./uploadDataFlowsFromCsv-CgTkrlhJ.mjs";import{t}from"./done-input-validation-DL31vk7g.mjs";async function n({auth:n,trackerStatus:r,file:i,classifyService:a,transcendUrl:o}){t(this.process.exit),await e({auth:n,trackerStatus:r,file:i,classifyService:a,transcendUrl:o})}export{n as uploadDataFlowsFromCsv};
2
+ //# sourceMappingURL=impl-D1Jj-4Zn.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-DOQk-mfA.mjs","names":["uploadDataFlowsFromCsvHelper"],"sources":["../src/commands/consent/upload-data-flows-from-csv/impl.ts"],"sourcesContent":["import { ConsentTrackerStatus } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { uploadDataFlowsFromCsv as uploadDataFlowsFromCsvHelper } from '../../../lib/consent-manager/index.js';\n\nexport interface UploadDataFlowsFromCsvCommandFlags {\n auth: string;\n trackerStatus: ConsentTrackerStatus;\n file: string;\n classifyService: boolean;\n transcendUrl: string;\n}\n\nexport async function uploadDataFlowsFromCsv(\n this: LocalContext,\n { auth, trackerStatus, file, classifyService, transcendUrl }: UploadDataFlowsFromCsvCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await uploadDataFlowsFromCsvHelper({\n auth,\n trackerStatus,\n file,\n classifyService,\n transcendUrl,\n });\n}\n"],"mappings":"8GAcA,eAAsB,EAEpB,CAAE,OAAM,gBAAe,OAAM,kBAAiB,gBAC/B,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAA6B,CACjC,OACA,gBACA,OACA,kBACA,eACD,CAAC"}
1
+ {"version":3,"file":"impl-D1Jj-4Zn.mjs","names":["uploadDataFlowsFromCsvHelper"],"sources":["../src/commands/consent/upload-data-flows-from-csv/impl.ts"],"sourcesContent":["import { ConsentTrackerStatus } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { uploadDataFlowsFromCsv as uploadDataFlowsFromCsvHelper } from '../../../lib/consent-manager/index.js';\n\nexport interface UploadDataFlowsFromCsvCommandFlags {\n auth: string;\n trackerStatus: ConsentTrackerStatus;\n file: string;\n classifyService: boolean;\n transcendUrl: string;\n}\n\nexport async function uploadDataFlowsFromCsv(\n this: LocalContext,\n { auth, trackerStatus, file, classifyService, transcendUrl }: UploadDataFlowsFromCsvCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await uploadDataFlowsFromCsvHelper({\n auth,\n trackerStatus,\n file,\n classifyService,\n transcendUrl,\n });\n}\n"],"mappings":"8GAcA,eAAsB,EAEpB,CAAE,OAAM,gBAAe,OAAM,kBAAiB,gBAC/B,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAA6B,CACjC,OACA,gBACA,OACA,kBACA,eACD,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./markSilentPrivacyRequests-DXLiS2jH.mjs";import{t}from"./done-input-validation-DL31vk7g.mjs";async function n({auth:n,transcendUrl:r,actions:i,statuses:a,requestIds:o,createdAtBefore:s,createdAtAfter:c,updatedAtBefore:l,updatedAtAfter:u,concurrency:d}){t(this.process.exit),await e({transcendUrl:r,requestActions:i,auth:n,requestIds:o,statuses:a,concurrency:d,createdAtBefore:s,createdAtAfter:c,updatedAtBefore:l,updatedAtAfter:u})}export{n as markSilent};
2
- //# sourceMappingURL=impl-Da1sv_hX2.mjs.map
1
+ import{t as e}from"./markSilentPrivacyRequests-Ir4ZB_lK.mjs";import{t}from"./done-input-validation-DL31vk7g.mjs";async function n({auth:n,transcendUrl:r,actions:i,statuses:a,requestIds:o,createdAtBefore:s,createdAtAfter:c,updatedAtBefore:l,updatedAtAfter:u,concurrency:d}){t(this.process.exit),await e({transcendUrl:r,requestActions:i,auth:n,requestIds:o,statuses:a,concurrency:d,createdAtBefore:s,createdAtAfter:c,updatedAtBefore:l,updatedAtAfter:u})}export{n as markSilent};
2
+ //# sourceMappingURL=impl-D3ytHcs42.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-Da1sv_hX2.mjs","names":[],"sources":["../src/commands/request/mark-silent/impl.ts"],"sourcesContent":["import type { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { markSilentPrivacyRequests } from '../../../lib/requests/index.js';\n\nexport interface MarkSilentCommandFlags {\n auth: string;\n actions: RequestAction[];\n statuses?: RequestStatus[];\n requestIds?: string[];\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n transcendUrl: string;\n concurrency: number;\n}\n\nexport async function markSilent(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n actions,\n statuses,\n requestIds,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n concurrency,\n }: MarkSilentCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await markSilentPrivacyRequests({\n transcendUrl,\n requestActions: actions,\n auth,\n requestIds,\n statuses,\n concurrency,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n });\n}\n"],"mappings":"iHAmBA,eAAsB,EAEpB,CACE,OACA,eACA,UACA,WACA,aACA,kBACA,iBACA,kBACA,iBACA,eAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAM,EAA0B,CAC9B,eACA,eAAgB,EAChB,OACA,aACA,WACA,cACA,kBACA,iBACA,kBACA,iBACD,CAAC"}
1
+ {"version":3,"file":"impl-D3ytHcs42.mjs","names":[],"sources":["../src/commands/request/mark-silent/impl.ts"],"sourcesContent":["import type { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { markSilentPrivacyRequests } from '../../../lib/requests/index.js';\n\nexport interface MarkSilentCommandFlags {\n auth: string;\n actions: RequestAction[];\n statuses?: RequestStatus[];\n requestIds?: string[];\n createdAtBefore?: Date;\n createdAtAfter?: Date;\n updatedAtBefore?: Date;\n updatedAtAfter?: Date;\n transcendUrl: string;\n concurrency: number;\n}\n\nexport async function markSilent(\n this: LocalContext,\n {\n auth,\n transcendUrl,\n actions,\n statuses,\n requestIds,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n concurrency,\n }: MarkSilentCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await markSilentPrivacyRequests({\n transcendUrl,\n requestActions: actions,\n auth,\n requestIds,\n statuses,\n concurrency,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n });\n}\n"],"mappings":"iHAmBA,eAAsB,EAEpB,CACE,OACA,eACA,UACA,WACA,aACA,kBACA,iBACA,kBACA,iBACA,eAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAM,EAA0B,CAC9B,eACA,eAAgB,EAChB,OACA,aACA,WACA,cACA,kBACA,iBACA,kBACA,iBACD,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./logger-Ckep4QXn.mjs";import{t}from"./updateConsentManagerVersionToLatest-CYGRh2Mf.mjs";import{t as n}from"./validateTranscendAuth-CAO5ktnu.mjs";import{t as r}from"./done-input-validation-DL31vk7g.mjs";import{ConsentBundleType as i}from"@transcend-io/privacy-types";import a from"colors";import{mapSeries as o}from"@transcend-io/utils";async function s({auth:s,bundleTypes:c=[i.Production,i.Test],deploy:l,transcendUrl:u}){r(this.process.exit);let d=await n(s);typeof d==`string`?(await t({deploy:l,transcendUrl:u,auth:d,bundleTypes:c}),e.info(a.green(`Successfully updated Consent Manager!`))):(await o(d,async n=>{e.info(a.magenta(`Updating Consent Manager for organization "${n.organizationName}"...`)),await t({deploy:l,transcendUrl:u,auth:n.apiKey,bundleTypes:c}),e.info(a.green(`Successfully updated Consent Manager for organization "${n.organizationName}"!`))}),e.info(a.green(`Successfully updated Consent Managers!`)))}export{s as updateConsentManager};
2
- //# sourceMappingURL=impl-B_1LPpGy.mjs.map
1
+ import{t as e}from"./logger-Ckep4QXn.mjs";import{t}from"./updateConsentManagerVersionToLatest-BJ2psQvP.mjs";import{t as n}from"./validateTranscendAuth-CAO5ktnu.mjs";import{t as r}from"./done-input-validation-DL31vk7g.mjs";import{ConsentBundleType as i}from"@transcend-io/privacy-types";import a from"colors";import{mapSeries as o}from"@transcend-io/utils";async function s({auth:s,bundleTypes:c=[i.Production,i.Test],deploy:l,transcendUrl:u}){r(this.process.exit);let d=await n(s);typeof d==`string`?(await t({deploy:l,transcendUrl:u,auth:d,bundleTypes:c}),e.info(a.green(`Successfully updated Consent Manager!`))):(await o(d,async n=>{e.info(a.magenta(`Updating Consent Manager for organization "${n.organizationName}"...`)),await t({deploy:l,transcendUrl:u,auth:n.apiKey,bundleTypes:c}),e.info(a.green(`Successfully updated Consent Manager for organization "${n.organizationName}"!`))}),e.info(a.green(`Successfully updated Consent Managers!`)))}export{s as updateConsentManager};
2
+ //# sourceMappingURL=impl-DVUNwxIx.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-B_1LPpGy.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';\nimport { logger } from '../../../logger.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.exit);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth);\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 logger.info(colors.green('Successfully updated Consent Manager!'));\n } else {\n await mapSeries(apiKeyOrList, async (apiKey) => {\n 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 logger.info(\n colors.green(\n `Successfully updated Consent Manager for organization \"${apiKey.organizationName}\"!`,\n ),\n );\n });\n logger.info(colors.green('Successfully updated Consent Managers!'));\n }\n}\n"],"mappings":"oWAiBA,eAAsB,EAEpB,CACE,OACA,cAAc,CAAC,EAAkB,WAAY,EAAkB,KAAK,CACpE,SACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAM,EAAe,MAAM,EAAsB,EAAK,CAGlD,OAAO,GAAiB,UAE1B,MAAM,EAAoC,CACxC,SACA,eACA,KAAM,EACN,cACD,CAAC,CACF,EAAO,KAAK,EAAO,MAAM,wCAAwC,CAAC,GAElE,MAAM,EAAU,EAAc,KAAO,IAAW,CAC9C,EAAO,KACL,EAAO,QAAQ,8CAA8C,EAAO,iBAAiB,MAAM,CAC5F,CAED,MAAM,EAAoC,CACxC,SACA,eACA,KAAM,EAAO,OACb,cACD,CAAC,CAEF,EAAO,KACL,EAAO,MACL,0DAA0D,EAAO,iBAAiB,IACnF,CACF,EACD,CACF,EAAO,KAAK,EAAO,MAAM,yCAAyC,CAAC"}
1
+ {"version":3,"file":"impl-DVUNwxIx.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';\nimport { logger } from '../../../logger.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.exit);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth);\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 logger.info(colors.green('Successfully updated Consent Manager!'));\n } else {\n await mapSeries(apiKeyOrList, async (apiKey) => {\n 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 logger.info(\n colors.green(\n `Successfully updated Consent Manager for organization \"${apiKey.organizationName}\"!`,\n ),\n );\n });\n logger.info(colors.green('Successfully updated Consent Managers!'));\n }\n}\n"],"mappings":"oWAiBA,eAAsB,EAEpB,CACE,OACA,cAAc,CAAC,EAAkB,WAAY,EAAkB,KAAK,CACpE,SACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAM,EAAe,MAAM,EAAsB,EAAK,CAGlD,OAAO,GAAiB,UAE1B,MAAM,EAAoC,CACxC,SACA,eACA,KAAM,EACN,cACD,CAAC,CACF,EAAO,KAAK,EAAO,MAAM,wCAAwC,CAAC,GAElE,MAAM,EAAU,EAAc,KAAO,IAAW,CAC9C,EAAO,KACL,EAAO,QAAQ,8CAA8C,EAAO,iBAAiB,MAAM,CAC5F,CAED,MAAM,EAAoC,CACxC,SACA,eACA,KAAM,EAAO,OACb,cACD,CAAC,CAEF,EAAO,KACL,EAAO,MACL,0DAA0D,EAAO,iBAAiB,IACnF,CACF,EACD,CACF,EAAO,KAAK,EAAO,MAAM,yCAAyC,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./uploadCookiesFromCsv-D33lINd-.mjs";import{t}from"./done-input-validation-DL31vk7g.mjs";async function n({auth:n,trackerStatus:r,file:i,transcendUrl:a}){t(this.process.exit),await e({auth:n,trackerStatus:r,file:i,transcendUrl:a})}export{n as uploadCookiesFromCsv};
2
- //# sourceMappingURL=impl-8zmHCdih.mjs.map
1
+ import{t as e}from"./uploadCookiesFromCsv-CqRfU5k-.mjs";import{t}from"./done-input-validation-DL31vk7g.mjs";async function n({auth:n,trackerStatus:r,file:i,transcendUrl:a}){t(this.process.exit),await e({auth:n,trackerStatus:r,file:i,transcendUrl:a})}export{n as uploadCookiesFromCsv};
2
+ //# sourceMappingURL=impl-DZy7vEEM.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-8zmHCdih.mjs","names":["uploadCookiesFromCsvHelper"],"sources":["../src/commands/consent/upload-cookies-from-csv/impl.ts"],"sourcesContent":["import { ConsentTrackerStatus } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { uploadCookiesFromCsv as uploadCookiesFromCsvHelper } from '../../../lib/consent-manager/index.js';\n\nexport interface UploadCookiesFromCsvCommandFlags {\n auth: string;\n trackerStatus: ConsentTrackerStatus;\n file: string;\n transcendUrl: string;\n}\n\nexport async function uploadCookiesFromCsv(\n this: LocalContext,\n { auth, trackerStatus, file, transcendUrl }: UploadCookiesFromCsvCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Upload cookies\n await uploadCookiesFromCsvHelper({\n auth,\n trackerStatus,\n file,\n transcendUrl,\n });\n}\n"],"mappings":"4GAaA,eAAsB,EAEpB,CAAE,OAAM,gBAAe,OAAM,gBACd,CACf,EAAoB,KAAK,QAAQ,KAAK,CAGtC,MAAMA,EAA2B,CAC/B,OACA,gBACA,OACA,eACD,CAAC"}
1
+ {"version":3,"file":"impl-DZy7vEEM.mjs","names":["uploadCookiesFromCsvHelper"],"sources":["../src/commands/consent/upload-cookies-from-csv/impl.ts"],"sourcesContent":["import { ConsentTrackerStatus } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { uploadCookiesFromCsv as uploadCookiesFromCsvHelper } from '../../../lib/consent-manager/index.js';\n\nexport interface UploadCookiesFromCsvCommandFlags {\n auth: string;\n trackerStatus: ConsentTrackerStatus;\n file: string;\n transcendUrl: string;\n}\n\nexport async function uploadCookiesFromCsv(\n this: LocalContext,\n { auth, trackerStatus, file, transcendUrl }: UploadCookiesFromCsvCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Upload cookies\n await uploadCookiesFromCsvHelper({\n auth,\n trackerStatus,\n file,\n transcendUrl,\n });\n}\n"],"mappings":"4GAaA,eAAsB,EAEpB,CAAE,OAAM,gBAAe,OAAM,gBACd,CACf,EAAoB,KAAK,QAAQ,KAAK,CAGtC,MAAMA,EAA2B,CAC/B,OACA,gBACA,OACA,eACD,CAAC"}
@@ -1,3 +1,3 @@
1
- import{r as e}from"./constants-CAOyAsNX.mjs";import{t}from"./logger-Ckep4QXn.mjs";import{a as n}from"./writeCsv-DMw5OmWp.mjs";import{t as r}from"./pullConsentManagerMetrics-C41UhU8u.mjs";import{t as i}from"./validateTranscendAuth-CAO5ktnu.mjs";import{t as a}from"./done-input-validation-DL31vk7g.mjs";import{ConsentManagerMetricBin as o}from"@transcend-io/privacy-types";import s,{existsSync as c,mkdirSync as l}from"node:fs";import{join as u}from"node:path";import d from"colors";import{buildTranscendGraphQLClient as f}from"@transcend-io/sdk";import{map as p,mapSeries as m}from"@transcend-io/utils";async function h({auth:h,start:g,end:_,folder:v,bin:y,transcendUrl:b}){let x=y;Object.values(o).includes(x)||(t.error(d.red(`Failed to parse argument "bin" with value "${y}"\nExpected one of: \n${Object.values(o).join(`
1
+ import{r as e}from"./constants-CXN-RdUM.mjs";import{t}from"./logger-Ckep4QXn.mjs";import{a as n}from"./writeCsv-DMw5OmWp.mjs";import{t as r}from"./pullConsentManagerMetrics-C41UhU8u.mjs";import{t as i}from"./validateTranscendAuth-CAO5ktnu.mjs";import{t as a}from"./done-input-validation-DL31vk7g.mjs";import{ConsentManagerMetricBin as o}from"@transcend-io/privacy-types";import s,{existsSync as c,mkdirSync as l}from"node:fs";import{join as u}from"node:path";import d from"colors";import{buildTranscendGraphQLClient as f}from"@transcend-io/sdk";import{map as p,mapSeries as m}from"@transcend-io/utils";async function h({auth:h,start:g,end:_,folder:v,bin:y,transcendUrl:b}){let x=y;Object.values(o).includes(x)||(t.error(d.red(`Failed to parse argument "bin" with value "${y}"\nExpected one of: \n${Object.values(o).join(`
2
2
  `)}`)),this.process.exit(1));let S=new Date(g),C=_?new Date(_):new Date;Number.isNaN(S.getTime())&&(t.error(d.red(`Start date provided is invalid date. Got --start="${g}" expected --start="01/01/2023"`)),this.process.exit(1)),Number.isNaN(C.getTime())&&(t.error(d.red(`End date provided is invalid date. Got --end="${_}" expected --end="01/01/2023"`)),this.process.exit(1)),S>C&&(t.error(d.red(`Got a start date "${S.toISOString()}" that was larger than the end date "${C.toISOString()}". Start date must be before end date.`)),this.process.exit(1)),a(this.process.exit);let w=await i(h);if(s.existsSync(v)&&!s.lstatSync(v).isDirectory()&&(t.error(d.red(`The provided argument "folder" was passed a file. expected: folder="./consent-metrics/"`)),this.process.exit(1)),c(v)||l(v),t.info(d.magenta(`Pulling consent metrics from start=${S.toString()} to end=${C.toISOString()} with bin size "${y}"`)),typeof w==`string`){try{let e=await r(f(b,w),{bin:x,start:S,end:C});await p(Object.entries(e),async([e,r])=>{await p(r,async({points:r,name:i})=>{let a=u(v,`${e}_${i}.csv`);t.info(d.magenta(`Writing configuration to file "${a}"...`)),await n(a,r.map(({key:e,value:t})=>({timestamp:e,value:t})))},{concurrency:5})},{concurrency:5})}catch(e){t.error(d.red(`An error occurred syncing the schema: ${e.message}`)),this.process.exit(1)}t.info(d.green(`Successfully synced consent metrics to disk in folder "${v}"! View at ${e}`))}else{let i=[];await m(w,async(e,a)=>{let o=`[${a+1}/${w.length}][${e.organizationName}] `;t.info(d.magenta(`~~~\n\n${o}Attempting to pull consent metrics...\n\n~~~`));let s=f(b,e.apiKey);try{let i=await r(s,{bin:x,start:S,end:C}),a=u(v,e.organizationName);c(a)||l(a),Object.entries(i).forEach(([e,r])=>{r.forEach(({points:r,name:i})=>{let o=u(a,`${e}_${i}.csv`);t.info(d.magenta(`Writing configuration to file "${o}"...`)),n(o,r.map(({key:e,value:t})=>({timestamp:e,value:t})))})}),t.info(d.green(`${o}Successfully pulled configuration!`))}catch(n){t.error(d.red(`${o}Failed to sync configuration.`),n),i.push(e.organizationName)}}),i.length>0&&(t.info(d.red(`Sync encountered errors for "${i.join(`,`)}". View output above for more information, or check out ${e}`)),this.process.exit(1))}}export{h as pullConsentMetrics};
3
- //# sourceMappingURL=impl-BdG67mkj.mjs.map
3
+ //# sourceMappingURL=impl-DxVB8-h3.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-BdG67mkj.mjs","names":[],"sources":["../src/commands/consent/pull-consent-metrics/impl.ts"],"sourcesContent":["import fs, { existsSync, mkdirSync } from 'node:fs';\nimport { join } from 'node:path';\n\nimport { ConsentManagerMetricBin } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport { map, mapSeries } from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport { ADMIN_DASH_INTEGRATIONS } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { validateTranscendAuth } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { pullConsentManagerMetrics } from '../../../lib/consent-manager/index.js';\nimport { writeCsv } from '../../../lib/helpers/index.js';\nimport { logger } from '../../../logger.js';\n\nexport interface PullConsentMetricsCommandFlags {\n auth: string;\n start: Date;\n end?: Date;\n folder: string;\n bin: string;\n transcendUrl: string;\n}\n\nexport async function pullConsentMetrics(\n this: LocalContext,\n { auth, start, end, folder, bin, transcendUrl }: PullConsentMetricsCommandFlags,\n): Promise<void> {\n // Validate bin\n const parsedBin = bin as ConsentManagerMetricBin;\n if (!Object.values(ConsentManagerMetricBin).includes(parsedBin)) {\n logger.error(\n colors.red(\n `Failed to parse argument \"bin\" with value \"${bin}\"\\n` +\n `Expected one of: \\n${Object.values(ConsentManagerMetricBin).join('\\n')}`,\n ),\n );\n this.process.exit(1);\n }\n\n // Parse the dates\n const startDate = new Date(start);\n const endDate = end ? new Date(end) : new Date();\n if (Number.isNaN(startDate.getTime())) {\n logger.error(\n colors.red(\n `Start date provided is invalid date. Got --start=\"${start}\" expected --start=\"01/01/2023\"`,\n ),\n );\n this.process.exit(1);\n }\n if (Number.isNaN(endDate.getTime())) {\n logger.error(\n colors.red(\n `End date provided is invalid date. Got --end=\"${end}\" expected --end=\"01/01/2023\"`,\n ),\n );\n this.process.exit(1);\n }\n if (startDate > endDate) {\n logger.error(\n colors.red(\n `Got a start date \"${startDate.toISOString()}\" that was larger than the end date \"${endDate.toISOString()}\". ` +\n 'Start date must be before end date.',\n ),\n );\n this.process.exit(1);\n }\n\n doneInputValidation(this.process.exit);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth);\n\n // Ensure folder either does not exist or is not a file\n if (fs.existsSync(folder) && !fs.lstatSync(folder).isDirectory()) {\n logger.error(\n colors.red(\n 'The provided argument \"folder\" was passed a file. expected: folder=\"./consent-metrics/\"',\n ),\n );\n this.process.exit(1);\n }\n\n // Create the folder if it does not exist\n if (!existsSync(folder)) {\n mkdirSync(folder);\n }\n\n logger.info(\n colors.magenta(\n `Pulling consent metrics from start=${startDate.toString()} to end=${endDate.toISOString()} with bin size \"${bin}\"`,\n ),\n );\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 // Pull the metrics\n const configuration = await pullConsentManagerMetrics(client, {\n bin: parsedBin,\n start: startDate,\n end: endDate,\n });\n\n // Write to file\n await map(\n Object.entries(configuration),\n async ([metricName, metrics]) => {\n await map(\n metrics,\n async ({ points, name }) => {\n const file = join(folder, `${metricName}_${name}.csv`);\n logger.info(colors.magenta(`Writing configuration to file \"${file}\"...`));\n await writeCsv(\n file,\n points.map(({ key, value }: { key: string; value: string }) => ({\n timestamp: key,\n value,\n })),\n );\n },\n {\n concurrency: 5,\n },\n );\n },\n { concurrency: 5 },\n );\n } catch (err) {\n logger.error(colors.red(`An error occurred syncing the schema: ${err.message}`));\n this.process.exit(1);\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced consent metrics to disk in folder \"${folder}\"! View at ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n } else {\n const encounteredErrors: string[] = [];\n await mapSeries(apiKeyOrList, async (apiKey, ind) => {\n const prefix = `[${ind + 1}/${apiKeyOrList.length}][${apiKey.organizationName}] `;\n logger.info(colors.magenta(`~~~\\n\\n${prefix}Attempting to pull consent metrics...\\n\\n~~~`));\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, apiKey.apiKey);\n\n try {\n const configuration = await pullConsentManagerMetrics(client, {\n bin: parsedBin,\n start: startDate,\n end: endDate,\n });\n\n // ensure folder exists for that organization\n const subFolder = join(folder, apiKey.organizationName);\n if (!existsSync(subFolder)) {\n mkdirSync(subFolder);\n }\n\n // Write to file\n Object.entries(configuration).forEach(([metricName, metrics]) => {\n metrics.forEach(({ points, name }) => {\n const file = join(subFolder, `${metricName}_${name}.csv`);\n logger.info(colors.magenta(`Writing configuration to file \"${file}\"...`));\n writeCsv(\n file,\n points.map(({ key, value }: { key: string; value: string }) => ({\n timestamp: key,\n value,\n })),\n );\n });\n });\n\n logger.info(colors.green(`${prefix}Successfully pulled configuration!`));\n } catch (err) {\n logger.error(colors.red(`${prefix}Failed to sync configuration.`), err);\n encounteredErrors.push(apiKey.organizationName);\n }\n });\n\n if (encounteredErrors.length > 0) {\n 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":"0lBAyBA,eAAsB,EAEpB,CAAE,OAAM,QAAO,MAAK,SAAQ,MAAK,gBAClB,CAEf,IAAM,EAAY,EACb,OAAO,OAAO,EAAwB,CAAC,SAAS,EAAU,GAC7D,EAAO,MACL,EAAO,IACL,8CAA8C,EAAI,wBAC1B,OAAO,OAAO,EAAwB,CAAC,KAAK;EAAK,GAC1E,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAItB,IAAM,EAAY,IAAI,KAAK,EAAM,CAC3B,EAAU,EAAM,IAAI,KAAK,EAAI,CAAG,IAAI,KACtC,OAAO,MAAM,EAAU,SAAS,CAAC,GACnC,EAAO,MACL,EAAO,IACL,qDAAqD,EAAM,iCAC5D,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAElB,OAAO,MAAM,EAAQ,SAAS,CAAC,GACjC,EAAO,MACL,EAAO,IACL,iDAAiD,EAAI,+BACtD,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAElB,EAAY,IACd,EAAO,MACL,EAAO,IACL,qBAAqB,EAAU,aAAa,CAAC,uCAAuC,EAAQ,aAAa,CAAC,wCAE3G,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAGtB,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAM,EAAe,MAAM,EAAsB,EAAK,CAwBtD,GArBI,EAAG,WAAW,EAAO,EAAI,CAAC,EAAG,UAAU,EAAO,CAAC,aAAa,GAC9D,EAAO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CAGI,EAAY,EAAK,EAAQ,EAAO,iBAAiB,CAClD,EAAW,EAAU,EACxB,EAAU,EAAU,CAItB,OAAO,QAAQ,EAAc,CAAC,SAAS,CAAC,EAAY,KAAa,CAC/D,EAAQ,SAAS,CAAE,SAAQ,UAAW,CACpC,IAAM,EAAO,EAAK,EAAW,GAAG,EAAW,GAAG,EAAK,MAAM,CACzD,EAAO,KAAK,EAAO,QAAQ,kCAAkC,EAAK,MAAM,CAAC,CACzE,EACE,EACA,EAAO,KAAK,CAAE,MAAK,YAA6C,CAC9D,UAAW,EACX,QACD,EAAE,CACJ,EACD,EACF,CAEF,EAAO,KAAK,EAAO,MAAM,GAAG,EAAO,oCAAoC,CAAC,OACjE,EAAK,CACZ,EAAO,MAAM,EAAO,IAAI,GAAG,EAAO,+BAA+B,CAAE,EAAI,CACvE,EAAkB,KAAK,EAAO,iBAAiB,GAEjD,CAEE,EAAkB,OAAS,IAC7B,EAAO,KACL,EAAO,IACL,gCAAgC,EAAkB,KAChD,IACD,CAAC,0DAA0D,IAC7D,CACF,CAED,KAAK,QAAQ,KAAK,EAAE"}
1
+ {"version":3,"file":"impl-DxVB8-h3.mjs","names":[],"sources":["../src/commands/consent/pull-consent-metrics/impl.ts"],"sourcesContent":["import fs, { existsSync, mkdirSync } from 'node:fs';\nimport { join } from 'node:path';\n\nimport { ConsentManagerMetricBin } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport { map, mapSeries } from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport { ADMIN_DASH_INTEGRATIONS } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { validateTranscendAuth } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { pullConsentManagerMetrics } from '../../../lib/consent-manager/index.js';\nimport { writeCsv } from '../../../lib/helpers/index.js';\nimport { logger } from '../../../logger.js';\n\nexport interface PullConsentMetricsCommandFlags {\n auth: string;\n start: Date;\n end?: Date;\n folder: string;\n bin: string;\n transcendUrl: string;\n}\n\nexport async function pullConsentMetrics(\n this: LocalContext,\n { auth, start, end, folder, bin, transcendUrl }: PullConsentMetricsCommandFlags,\n): Promise<void> {\n // Validate bin\n const parsedBin = bin as ConsentManagerMetricBin;\n if (!Object.values(ConsentManagerMetricBin).includes(parsedBin)) {\n logger.error(\n colors.red(\n `Failed to parse argument \"bin\" with value \"${bin}\"\\n` +\n `Expected one of: \\n${Object.values(ConsentManagerMetricBin).join('\\n')}`,\n ),\n );\n this.process.exit(1);\n }\n\n // Parse the dates\n const startDate = new Date(start);\n const endDate = end ? new Date(end) : new Date();\n if (Number.isNaN(startDate.getTime())) {\n logger.error(\n colors.red(\n `Start date provided is invalid date. Got --start=\"${start}\" expected --start=\"01/01/2023\"`,\n ),\n );\n this.process.exit(1);\n }\n if (Number.isNaN(endDate.getTime())) {\n logger.error(\n colors.red(\n `End date provided is invalid date. Got --end=\"${end}\" expected --end=\"01/01/2023\"`,\n ),\n );\n this.process.exit(1);\n }\n if (startDate > endDate) {\n logger.error(\n colors.red(\n `Got a start date \"${startDate.toISOString()}\" that was larger than the end date \"${endDate.toISOString()}\". ` +\n 'Start date must be before end date.',\n ),\n );\n this.process.exit(1);\n }\n\n doneInputValidation(this.process.exit);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth);\n\n // Ensure folder either does not exist or is not a file\n if (fs.existsSync(folder) && !fs.lstatSync(folder).isDirectory()) {\n logger.error(\n colors.red(\n 'The provided argument \"folder\" was passed a file. expected: folder=\"./consent-metrics/\"',\n ),\n );\n this.process.exit(1);\n }\n\n // Create the folder if it does not exist\n if (!existsSync(folder)) {\n mkdirSync(folder);\n }\n\n logger.info(\n colors.magenta(\n `Pulling consent metrics from start=${startDate.toString()} to end=${endDate.toISOString()} with bin size \"${bin}\"`,\n ),\n );\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 // Pull the metrics\n const configuration = await pullConsentManagerMetrics(client, {\n bin: parsedBin,\n start: startDate,\n end: endDate,\n });\n\n // Write to file\n await map(\n Object.entries(configuration),\n async ([metricName, metrics]) => {\n await map(\n metrics,\n async ({ points, name }) => {\n const file = join(folder, `${metricName}_${name}.csv`);\n logger.info(colors.magenta(`Writing configuration to file \"${file}\"...`));\n await writeCsv(\n file,\n points.map(({ key, value }: { key: string; value: string }) => ({\n timestamp: key,\n value,\n })),\n );\n },\n {\n concurrency: 5,\n },\n );\n },\n { concurrency: 5 },\n );\n } catch (err) {\n logger.error(colors.red(`An error occurred syncing the schema: ${err.message}`));\n this.process.exit(1);\n }\n\n // Indicate success\n logger.info(\n colors.green(\n `Successfully synced consent metrics to disk in folder \"${folder}\"! View at ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n } else {\n const encounteredErrors: string[] = [];\n await mapSeries(apiKeyOrList, async (apiKey, ind) => {\n const prefix = `[${ind + 1}/${apiKeyOrList.length}][${apiKey.organizationName}] `;\n logger.info(colors.magenta(`~~~\\n\\n${prefix}Attempting to pull consent metrics...\\n\\n~~~`));\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, apiKey.apiKey);\n\n try {\n const configuration = await pullConsentManagerMetrics(client, {\n bin: parsedBin,\n start: startDate,\n end: endDate,\n });\n\n // ensure folder exists for that organization\n const subFolder = join(folder, apiKey.organizationName);\n if (!existsSync(subFolder)) {\n mkdirSync(subFolder);\n }\n\n // Write to file\n Object.entries(configuration).forEach(([metricName, metrics]) => {\n metrics.forEach(({ points, name }) => {\n const file = join(subFolder, `${metricName}_${name}.csv`);\n logger.info(colors.magenta(`Writing configuration to file \"${file}\"...`));\n writeCsv(\n file,\n points.map(({ key, value }: { key: string; value: string }) => ({\n timestamp: key,\n value,\n })),\n );\n });\n });\n\n logger.info(colors.green(`${prefix}Successfully pulled configuration!`));\n } catch (err) {\n logger.error(colors.red(`${prefix}Failed to sync configuration.`), err);\n encounteredErrors.push(apiKey.organizationName);\n }\n });\n\n if (encounteredErrors.length > 0) {\n 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":"0lBAyBA,eAAsB,EAEpB,CAAE,OAAM,QAAO,MAAK,SAAQ,MAAK,gBAClB,CAEf,IAAM,EAAY,EACb,OAAO,OAAO,EAAwB,CAAC,SAAS,EAAU,GAC7D,EAAO,MACL,EAAO,IACL,8CAA8C,EAAI,wBAC1B,OAAO,OAAO,EAAwB,CAAC,KAAK;EAAK,GAC1E,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAItB,IAAM,EAAY,IAAI,KAAK,EAAM,CAC3B,EAAU,EAAM,IAAI,KAAK,EAAI,CAAG,IAAI,KACtC,OAAO,MAAM,EAAU,SAAS,CAAC,GACnC,EAAO,MACL,EAAO,IACL,qDAAqD,EAAM,iCAC5D,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAElB,OAAO,MAAM,EAAQ,SAAS,CAAC,GACjC,EAAO,MACL,EAAO,IACL,iDAAiD,EAAI,+BACtD,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAElB,EAAY,IACd,EAAO,MACL,EAAO,IACL,qBAAqB,EAAU,aAAa,CAAC,uCAAuC,EAAQ,aAAa,CAAC,wCAE3G,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAGtB,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAM,EAAe,MAAM,EAAsB,EAAK,CAwBtD,GArBI,EAAG,WAAW,EAAO,EAAI,CAAC,EAAG,UAAU,EAAO,CAAC,aAAa,GAC9D,EAAO,MACL,EAAO,IACL,0FACD,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAIjB,EAAW,EAAO,EACrB,EAAU,EAAO,CAGnB,EAAO,KACL,E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AAC,EAAY,KAAa,CAC/D,EAAQ,SAAS,CAAE,SAAQ,UAAW,CACpC,IAAM,EAAO,EAAK,EAAW,GAAG,EAAW,GAAG,EAAK,MAAM,CACzD,EAAO,KAAK,EAAO,QAAQ,kCAAkC,EAAK,MAAM,CAAC,CACzE,EACE,EACA,EAAO,KAAK,CAAE,MAAK,YAA6C,CAC9D,UAAW,EACX,QACD,EAAE,CACJ,EACD,EACF,CAEF,EAAO,KAAK,EAAO,MAAM,GAAG,EAAO,oCAAoC,CAAC,OACjE,EAAK,CACZ,EAAO,MAAM,EAAO,IAAI,GAAG,EAAO,+BAA+B,CAAE,EAAI,CACvE,EAAkB,KAAK,EAAO,iBAAiB,GAEjD,CAEE,EAAkB,OAAS,IAC7B,EAAO,KACL,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"./retryRequestDataSilos-DATDTDin.mjs";import{t}from"./done-input-validation-DL31vk7g.mjs";async function n({auth:n,dataSiloId:r,actions:i,transcendUrl:a}){t(this.process.exit),await e({requestActions:i,transcendUrl:a,auth:n,dataSiloId:r})}export{n as retryRequestDataSilos};
2
- //# sourceMappingURL=impl-D5fmpaDf2.mjs.map
1
+ import{t as e}from"./retryRequestDataSilos-g20l2uj6.mjs";import{t}from"./done-input-validation-DL31vk7g.mjs";async function n({auth:n,dataSiloId:r,actions:i,transcendUrl:a}){t(this.process.exit),await e({requestActions:i,transcendUrl:a,auth:n,dataSiloId:r})}export{n as retryRequestDataSilos};
2
+ //# sourceMappingURL=impl-FrbAsKvf2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-D5fmpaDf2.mjs","names":["retryRequestDataSilosHelper"],"sources":["../src/commands/request/system/retry-request-data-silos/impl.ts"],"sourcesContent":["import type { RequestAction } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport { retryRequestDataSilos as retryRequestDataSilosHelper } from '../../../../lib/requests/index.js';\n\nexport interface RetryRequestDataSilosCommandFlags {\n auth: string;\n dataSiloId: string;\n actions: RequestAction[];\n transcendUrl: string;\n}\n\nexport async function retryRequestDataSilos(\n this: LocalContext,\n { auth, dataSiloId, actions, transcendUrl }: RetryRequestDataSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await retryRequestDataSilosHelper({\n requestActions: actions,\n transcendUrl,\n auth,\n dataSiloId,\n });\n}\n"],"mappings":"6GAaA,eAAsB,EAEpB,CAAE,OAAM,aAAY,UAAS,gBACd,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAA4B,CAChC,eAAgB,EAChB,eACA,OACA,aACD,CAAC"}
1
+ {"version":3,"file":"impl-FrbAsKvf2.mjs","names":["retryRequestDataSilosHelper"],"sources":["../src/commands/request/system/retry-request-data-silos/impl.ts"],"sourcesContent":["import type { RequestAction } from '@transcend-io/privacy-types';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport { retryRequestDataSilos as retryRequestDataSilosHelper } from '../../../../lib/requests/index.js';\n\nexport interface RetryRequestDataSilosCommandFlags {\n auth: string;\n dataSiloId: string;\n actions: RequestAction[];\n transcendUrl: string;\n}\n\nexport async function retryRequestDataSilos(\n this: LocalContext,\n { auth, dataSiloId, actions, transcendUrl }: RetryRequestDataSilosCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await retryRequestDataSilosHelper({\n requestActions: actions,\n transcendUrl,\n auth,\n dataSiloId,\n });\n}\n"],"mappings":"6GAaA,eAAsB,EAEpB,CAAE,OAAM,aAAY,UAAS,gBACd,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAA4B,CAChC,eAAgB,EAChB,eACA,OACA,aACD,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./logger-Ckep4QXn.mjs";import{t}from"./pullChunkedCustomSiloOutstandingIdentifiers-rKefgKKC.mjs";import{i as n,s as r}from"./writeCsv-DMw5OmWp.mjs";import{t as i}from"./done-input-validation-DL31vk7g.mjs";import{uniq as a}from"lodash-es";import o from"colors";async function s({file:s,transcendUrl:c,auth:l,sombraAuth:u,dataSiloId:d,actions:f,pageLimit:p,skipRequestCount:m,chunkSize:h}){m&&e.info(o.yellow(`Skipping request count as requested. This may help speed up the call.`)),(Number.isNaN(h)||h<=0||h%p!==0)&&(e.error(o.red(`Invalid chunk size: "${h}". Must be a positive integer that is a multiple of ${p}.`)),this.process.exit(1)),i(this.process.exit);let{baseName:g,extension:_}=n(s),v=0;await t({transcendUrl:c,apiPageSize:p,savePageSize:h,onSave:async t=>{let n=`${g}-${v}${_}`;return e.info(o.blue(`Saving ${t.length} identifiers to file "${n}"`)),await r(n,t,a(t.map(e=>Object.keys(e)).flat())),e.info(o.green(`Successfully wrote ${t.length} identifiers to file "${n}"`)),v+=1,Promise.resolve()},actions:f,auth:l,sombraAuth:u,dataSiloId:d,skipRequestCount:m})}export{s as pullIdentifiers};
2
- //# sourceMappingURL=impl-1ueiw_XV2.mjs.map
1
+ import{t as e}from"./logger-Ckep4QXn.mjs";import{t}from"./pullChunkedCustomSiloOutstandingIdentifiers-CZARvaM3.mjs";import{i as n,s as r}from"./writeCsv-DMw5OmWp.mjs";import{t as i}from"./done-input-validation-DL31vk7g.mjs";import{uniq as a}from"lodash-es";import o from"colors";async function s({file:s,transcendUrl:c,auth:l,sombraAuth:u,dataSiloId:d,actions:f,pageLimit:p,skipRequestCount:m,chunkSize:h}){m&&e.info(o.yellow(`Skipping request count as requested. This may help speed up the call.`)),(Number.isNaN(h)||h<=0||h%p!==0)&&(e.error(o.red(`Invalid chunk size: "${h}". Must be a positive integer that is a multiple of ${p}.`)),this.process.exit(1)),i(this.process.exit);let{baseName:g,extension:_}=n(s),v=0;await t({transcendUrl:c,apiPageSize:p,savePageSize:h,onSave:async t=>{let n=`${g}-${v}${_}`;return e.info(o.blue(`Saving ${t.length} identifiers to file "${n}"`)),await r(n,t,a(t.map(e=>Object.keys(e)).flat())),e.info(o.green(`Successfully wrote ${t.length} identifiers to file "${n}"`)),v+=1,Promise.resolve()},actions:f,auth:l,sombraAuth:u,dataSiloId:d,skipRequestCount:m})}export{s as pullIdentifiers};
2
+ //# sourceMappingURL=impl-GDBOa4jq2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-1ueiw_XV2.mjs","names":[],"sources":["../src/commands/request/cron/pull-identifiers/impl.ts"],"sourcesContent":["import { RequestAction } from '@transcend-io/privacy-types';\nimport colors from 'colors';\nimport { uniq } from 'lodash-es';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport {\n CsvFormattedIdentifier,\n pullChunkedCustomSiloOutstandingIdentifiers,\n} from '../../../../lib/cron/index.js';\nimport { parseFilePath, writeLargeCsv } from '../../../../lib/helpers/index.js';\nimport { logger } from '../../../../logger.js';\n\nexport interface PullIdentifiersCommandFlags {\n file: string;\n transcendUrl: string;\n auth: string;\n sombraAuth?: string;\n dataSiloId: string;\n actions: RequestAction[];\n pageLimit: number;\n skipRequestCount: boolean;\n chunkSize: number;\n}\n\nexport async function pullIdentifiers(\n this: LocalContext,\n {\n file,\n transcendUrl,\n auth,\n sombraAuth,\n dataSiloId,\n actions,\n pageLimit,\n skipRequestCount,\n chunkSize,\n }: PullIdentifiersCommandFlags,\n): Promise<void> {\n if (skipRequestCount) {\n logger.info(\n colors.yellow('Skipping request count as requested. This may help speed up the call.'),\n );\n }\n\n if (Number.isNaN(chunkSize) || chunkSize <= 0 || chunkSize % pageLimit !== 0) {\n logger.error(\n colors.red(\n `Invalid chunk size: \"${chunkSize}\". Must be a positive integer that is a multiple of ${pageLimit}.`,\n ),\n );\n this.process.exit(1);\n }\n\n doneInputValidation(this.process.exit);\n\n const { baseName, extension } = parseFilePath(file);\n let fileCount = 0;\n\n const onSave = async (chunk: CsvFormattedIdentifier[]): Promise<void> => {\n const numberedFileName = `${baseName}-${fileCount}${extension}`;\n logger.info(colors.blue(`Saving ${chunk.length} identifiers to file \"${numberedFileName}\"`));\n\n const headers = uniq(chunk.map((d) => Object.keys(d)).flat());\n await writeLargeCsv(numberedFileName, chunk, headers);\n logger.info(\n colors.green(`Successfully wrote ${chunk.length} identifiers to file \"${numberedFileName}\"`),\n );\n fileCount += 1;\n return Promise.resolve();\n };\n\n // Pull down outstanding identifiers\n await pullChunkedCustomSiloOutstandingIdentifiers({\n transcendUrl,\n apiPageSize: pageLimit,\n savePageSize: chunkSize,\n onSave,\n actions,\n auth,\n sombraAuth,\n dataSiloId,\n skipRequestCount,\n });\n}\n"],"mappings":"uRAyBA,eAAsB,EAEpB,CACE,OACA,eACA,OACA,aACA,aACA,UACA,YACA,mBACA,aAEa,CACX,GACF,EAAO,KACL,EAAO,OAAO,wEAAwE,CACvF,EAGC,OAAO,MAAM,EAAU,EAAI,GAAa,GAAK,EAAY,IAAc,KACzE,EAAO,MACL,EAAO,IACL,wBAAwB,EAAU,sDAAsD,EAAU,GACnG,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAGtB,EAAoB,KAAK,QAAQ,KAAK,CAEtC,GAAM,CAAE,WAAU,aAAc,EAAc,EAAK,CAC/C,EAAY,EAgBhB,MAAM,EAA4C,CAChD,eACA,YAAa,EACb,aAAc,EACd,YAlBoB,IAAmD,CACvE,IAAM,EAAmB,GAAG,EAAS,GAAG,IAAY,IASpD,OARA,EAAO,KAAK,EAAO,KAAK,UAAU,EAAM,OAAO,wBAAwB,EAAiB,GAAG,CAAC,CAG5F,MAAM,EAAc,EAAkB,EADtB,EAAK,EAAM,IAAK,GAAM,OAAO,KAAK,EAAE,CAAC,CAAC,MAAM,CACR,CAAC,CACrD,EAAO,KACL,EAAO,MAAM,sBAAsB,EAAM,OAAO,wBAAwB,EAAiB,GAAG,CAC7F,CACD,GAAa,EACN,QAAQ,SAAS,EASxB,UACA,OACA,aACA,aACA,mBACD,CAAC"}
1
+ {"version":3,"file":"impl-GDBOa4jq2.mjs","names":[],"sources":["../src/commands/request/cron/pull-identifiers/impl.ts"],"sourcesContent":["import { RequestAction } from '@transcend-io/privacy-types';\nimport colors from 'colors';\nimport { uniq } from 'lodash-es';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport {\n CsvFormattedIdentifier,\n pullChunkedCustomSiloOutstandingIdentifiers,\n} from '../../../../lib/cron/index.js';\nimport { parseFilePath, writeLargeCsv } from '../../../../lib/helpers/index.js';\nimport { logger } from '../../../../logger.js';\n\nexport interface PullIdentifiersCommandFlags {\n file: string;\n transcendUrl: string;\n auth: string;\n sombraAuth?: string;\n dataSiloId: string;\n actions: RequestAction[];\n pageLimit: number;\n skipRequestCount: boolean;\n chunkSize: number;\n}\n\nexport async function pullIdentifiers(\n this: LocalContext,\n {\n file,\n transcendUrl,\n auth,\n sombraAuth,\n dataSiloId,\n actions,\n pageLimit,\n skipRequestCount,\n chunkSize,\n }: PullIdentifiersCommandFlags,\n): Promise<void> {\n if (skipRequestCount) {\n logger.info(\n colors.yellow('Skipping request count as requested. This may help speed up the call.'),\n );\n }\n\n if (Number.isNaN(chunkSize) || chunkSize <= 0 || chunkSize % pageLimit !== 0) {\n logger.error(\n colors.red(\n `Invalid chunk size: \"${chunkSize}\". Must be a positive integer that is a multiple of ${pageLimit}.`,\n ),\n );\n this.process.exit(1);\n }\n\n doneInputValidation(this.process.exit);\n\n const { baseName, extension } = parseFilePath(file);\n let fileCount = 0;\n\n const onSave = async (chunk: CsvFormattedIdentifier[]): Promise<void> => {\n const numberedFileName = `${baseName}-${fileCount}${extension}`;\n logger.info(colors.blue(`Saving ${chunk.length} identifiers to file \"${numberedFileName}\"`));\n\n const headers = uniq(chunk.map((d) => Object.keys(d)).flat());\n await writeLargeCsv(numberedFileName, chunk, headers);\n logger.info(\n colors.green(`Successfully wrote ${chunk.length} identifiers to file \"${numberedFileName}\"`),\n );\n fileCount += 1;\n return Promise.resolve();\n };\n\n // Pull down outstanding identifiers\n await pullChunkedCustomSiloOutstandingIdentifiers({\n transcendUrl,\n apiPageSize: pageLimit,\n savePageSize: chunkSize,\n onSave,\n actions,\n auth,\n sombraAuth,\n dataSiloId,\n skipRequestCount,\n });\n}\n"],"mappings":"uRAyBA,eAAsB,EAEpB,CACE,OACA,eACA,OACA,aACA,aACA,UACA,YACA,mBACA,aAEa,CACX,GACF,EAAO,KACL,EAAO,OAAO,wEAAwE,CACvF,EAGC,OAAO,MAAM,EAAU,EAAI,GAAa,GAAK,EAAY,IAAc,KACzE,EAAO,MACL,EAAO,IACL,wBAAwB,EAAU,sDAAsD,EAAU,GACnG,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAGtB,EAAoB,KAAK,QAAQ,KAAK,CAEtC,GAAM,CAAE,WAAU,aAAc,EAAc,EAAK,CAC/C,EAAY,EAgBhB,MAAM,EAA4C,CAChD,eACA,YAAa,EACb,aAAc,EACd,YAlBoB,IAAmD,CACvE,IAAM,EAAmB,GAAG,EAAS,GAAG,IAAY,IASpD,OARA,EAAO,KAAK,EAAO,KAAK,UAAU,EAAM,OAAO,wBAAwB,EAAiB,GAAG,CAAC,CAG5F,MAAM,EAAc,EAAkB,EADtB,EAAK,EAAM,IAAK,GAAM,OAAO,KAAK,EAAE,CAAC,CAAC,MAAM,CACR,CAAC,CACrD,EAAO,KACL,EAAO,MAAM,sBAAsB,EAAM,OAAO,wBAAwB,EAAiB,GAAG,CAC7F,CACD,GAAa,EACN,QAAQ,SAAS,EASxB,UACA,OACA,aACA,aACA,mBACD,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./pushCronIdentifiersFromCsv-Dj-KEFpQ.mjs";import{t}from"./done-input-validation-DL31vk7g.mjs";async function n({file:n,transcendUrl:r,auth:i,sombraAuth:a,dataSiloId:o}){t(this.process.exit),await e({file:n,transcendUrl:r,auth:i,sombraAuth:a,dataSiloId:o})}export{n as markIdentifiersCompleted};
2
- //# sourceMappingURL=impl-z5TV6Spz2.mjs.map
1
+ import{t as e}from"./pushCronIdentifiersFromCsv-CowCvbH0.mjs";import{t}from"./done-input-validation-DL31vk7g.mjs";async function n({file:n,transcendUrl:r,auth:i,sombraAuth:a,dataSiloId:o}){t(this.process.exit),await e({file:n,transcendUrl:r,auth:i,sombraAuth:a,dataSiloId:o})}export{n as markIdentifiersCompleted};
2
+ //# sourceMappingURL=impl-yLtpv9IB2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-z5TV6Spz2.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.exit);\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,KAAK,CAEtC,MAAM,EAA2B,CAC/B,OACA,eACA,OACA,aACA,aACD,CAAC"}
1
+ {"version":3,"file":"impl-yLtpv9IB2.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.exit);\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,KAAK,CAEtC,MAAM,EAA2B,CAC/B,OACA,eACA,OACA,aACA,aACD,CAAC"}
package/dist/index.d.mts CHANGED
@@ -160,6 +160,8 @@ declare const TeamInput: t.IntersectionC<[t.TypeC<{
160
160
  viewAssignedRules: unknown;
161
161
  manageAssignedRules: unknown;
162
162
  executeRules: unknown;
163
+ viewCustomFunction: unknown;
164
+ manageCustomFunction: unknown;
163
165
  }>>;
164
166
  }>]>;
165
167
  /** Type override */
@@ -81649,6 +81651,8 @@ declare const TranscendInput: t.PartialC<{
81649
81651
  viewAssignedRules: unknown;
81650
81652
  manageAssignedRules: unknown;
81651
81653
  executeRules: unknown;
81654
+ viewCustomFunction: unknown;
81655
+ manageCustomFunction: unknown;
81652
81656
  }>>;
81653
81657
  }>]>>;
81654
81658
  /**