@transcend-io/cli 10.5.9 → 10.5.11

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 (128) hide show
  1. package/dist/{app-eV34tHJ-.mjs → app-80lfIgWu.mjs} +16 -16
  2. package/dist/{app-eV34tHJ-.mjs.map → app-80lfIgWu.mjs.map} +1 -1
  3. package/dist/{approvePrivacyRequests-CVIETlEr.mjs → approvePrivacyRequests-CCCcny1x.mjs} +2 -2
  4. package/dist/{approvePrivacyRequests-CVIETlEr.mjs.map → approvePrivacyRequests-CCCcny1x.mjs.map} +1 -1
  5. package/dist/bin/bash-complete.mjs +1 -1
  6. package/dist/bin/cli.mjs +1 -1
  7. package/dist/bin/deprecated-command.mjs +1 -1
  8. package/dist/{buildXdiSyncEndpoint-DebUtvXV.mjs → buildXdiSyncEndpoint-jQ3542fw.mjs} +2 -2
  9. package/dist/{buildXdiSyncEndpoint-DebUtvXV.mjs.map → buildXdiSyncEndpoint-jQ3542fw.mjs.map} +1 -1
  10. package/dist/{bulkRestartRequests-rGsHi_JA.mjs → bulkRestartRequests-BsoIC3g7.mjs} +2 -2
  11. package/dist/{bulkRestartRequests-rGsHi_JA.mjs.map → bulkRestartRequests-BsoIC3g7.mjs.map} +1 -1
  12. package/dist/{bulkRetryEnrichers-h8-m1giM.mjs → bulkRetryEnrichers-edv9vW96.mjs} +2 -2
  13. package/dist/{bulkRetryEnrichers-h8-m1giM.mjs.map → bulkRetryEnrichers-edv9vW96.mjs.map} +1 -1
  14. package/dist/{cancelPrivacyRequests-DBvil_1B.mjs → cancelPrivacyRequests-DxMOvvH3.mjs} +2 -2
  15. package/dist/{cancelPrivacyRequests-DBvil_1B.mjs.map → cancelPrivacyRequests-DxMOvvH3.mjs.map} +1 -1
  16. package/dist/{command-B6BJxfeb.mjs → command-CRSNyyri.mjs} +2 -2
  17. package/dist/{command-B6BJxfeb.mjs.map → command-CRSNyyri.mjs.map} +1 -1
  18. package/dist/constants-CY1i6J69.mjs +2 -0
  19. package/dist/{constants-CVdC1nK_.mjs.map → constants-CY1i6J69.mjs.map} +1 -1
  20. package/dist/{createExtraKeyHandler-B6DaVVWr.mjs → createExtraKeyHandler-B5OkuqMX.mjs} +2 -2
  21. package/dist/{createExtraKeyHandler-B6DaVVWr.mjs.map → createExtraKeyHandler-B5OkuqMX.mjs.map} +1 -1
  22. package/dist/{downloadPrivacyRequestFiles-DM35rqpc.mjs → downloadPrivacyRequestFiles-CrqSzV3f.mjs} +2 -2
  23. package/dist/{downloadPrivacyRequestFiles-DM35rqpc.mjs.map → downloadPrivacyRequestFiles-CrqSzV3f.mjs.map} +1 -1
  24. package/dist/{generateCrossAccountApiKeys-Ddw9d_2c.mjs → generateCrossAccountApiKeys-CW3qfNn0.mjs} +2 -2
  25. package/dist/{generateCrossAccountApiKeys-Ddw9d_2c.mjs.map → generateCrossAccountApiKeys-CW3qfNn0.mjs.map} +1 -1
  26. package/dist/{impl-Df2dj7L7.mjs → impl-3CmWqSMs.mjs} +2 -2
  27. package/dist/{impl-Df2dj7L7.mjs.map → impl-3CmWqSMs.mjs.map} +1 -1
  28. package/dist/{impl-BAVe-n5r.mjs → impl-8qdzXN5I.mjs} +2 -2
  29. package/dist/{impl-BAVe-n5r.mjs.map → impl-8qdzXN5I.mjs.map} +1 -1
  30. package/dist/{impl-BPGxYouk.mjs → impl-9-8onCXj.mjs} +2 -2
  31. package/dist/{impl-BPGxYouk.mjs.map → impl-9-8onCXj.mjs.map} +1 -1
  32. package/dist/{impl-BjVFLbFc.mjs → impl-B-Pez4dW.mjs} +2 -2
  33. package/dist/{impl-BjVFLbFc.mjs.map → impl-B-Pez4dW.mjs.map} +1 -1
  34. package/dist/{impl-DnNCir5X.mjs → impl-B3Yex6pC.mjs} +2 -2
  35. package/dist/{impl-DnNCir5X.mjs.map → impl-B3Yex6pC.mjs.map} +1 -1
  36. package/dist/{impl-BM6ormZt.mjs → impl-BYOkz96k.mjs} +2 -2
  37. package/dist/{impl-BM6ormZt.mjs.map → impl-BYOkz96k.mjs.map} +1 -1
  38. package/dist/{impl-Bt9YlQsn.mjs → impl-Bd0qkHJc.mjs} +2 -2
  39. package/dist/{impl-Bt9YlQsn.mjs.map → impl-Bd0qkHJc.mjs.map} +1 -1
  40. package/dist/{impl-C9zRQ0em.mjs → impl-BhmZICjb.mjs} +2 -2
  41. package/dist/{impl-C9zRQ0em.mjs.map → impl-BhmZICjb.mjs.map} +1 -1
  42. package/dist/{impl-CmCk6_gN.mjs → impl-BiYvyMu7.mjs} +2 -2
  43. package/dist/{impl-CmCk6_gN.mjs.map → impl-BiYvyMu7.mjs.map} +1 -1
  44. package/dist/{impl-D74eq-kJ.mjs → impl-BppRgxzL.mjs} +2 -2
  45. package/dist/{impl-D74eq-kJ.mjs.map → impl-BppRgxzL.mjs.map} +1 -1
  46. package/dist/{impl-DSX9ZOyN.mjs → impl-CCatAC1N.mjs} +2 -2
  47. package/dist/{impl-DSX9ZOyN.mjs.map → impl-CCatAC1N.mjs.map} +1 -1
  48. package/dist/{impl-Dovxgzrw.mjs → impl-CPZIkZ87.mjs} +2 -2
  49. package/dist/{impl-Dovxgzrw.mjs.map → impl-CPZIkZ87.mjs.map} +1 -1
  50. package/dist/{impl-CACyabzW.mjs → impl-CSE5LOYp.mjs} +2 -2
  51. package/dist/{impl-CACyabzW.mjs.map → impl-CSE5LOYp.mjs.map} +1 -1
  52. package/dist/{impl-CN8TyxAL.mjs → impl-CZ-mqAxy.mjs} +2 -2
  53. package/dist/{impl-CN8TyxAL.mjs.map → impl-CZ-mqAxy.mjs.map} +1 -1
  54. package/dist/{impl-5KU-buzx.mjs → impl-CZ69h5EI.mjs} +2 -2
  55. package/dist/{impl-5KU-buzx.mjs.map → impl-CZ69h5EI.mjs.map} +1 -1
  56. package/dist/{impl-ChyRuJd-.mjs → impl-Cuc1G87s.mjs} +2 -2
  57. package/dist/{impl-ChyRuJd-.mjs.map → impl-Cuc1G87s.mjs.map} +1 -1
  58. package/dist/{impl-DXyIDFgR.mjs → impl-Cw-nJQ1z.mjs} +2 -2
  59. package/dist/{impl-DXyIDFgR.mjs.map → impl-Cw-nJQ1z.mjs.map} +1 -1
  60. package/dist/{impl-CLloLqRM.mjs → impl-CyyRnIFq.mjs} +2 -2
  61. package/dist/{impl-CLloLqRM.mjs.map → impl-CyyRnIFq.mjs.map} +1 -1
  62. package/dist/{impl-Bvpl3pjH.mjs → impl-CzjxZMtp.mjs} +2 -2
  63. package/dist/{impl-Bvpl3pjH.mjs.map → impl-CzjxZMtp.mjs.map} +1 -1
  64. package/dist/{impl-GiGHfQys.mjs → impl-D0iIi5ke.mjs} +2 -2
  65. package/dist/{impl-GiGHfQys.mjs.map → impl-D0iIi5ke.mjs.map} +1 -1
  66. package/dist/{impl-BTpQDuwP.mjs → impl-DOnp-UHS.mjs} +2 -2
  67. package/dist/{impl-BTpQDuwP.mjs.map → impl-DOnp-UHS.mjs.map} +1 -1
  68. package/dist/{impl-BRsYJJvH.mjs → impl-DSoqBGxJ.mjs} +2 -2
  69. package/dist/{impl-BRsYJJvH.mjs.map → impl-DSoqBGxJ.mjs.map} +1 -1
  70. package/dist/{impl-BHRBMA88.mjs → impl-DkoCw--t.mjs} +2 -2
  71. package/dist/{impl-BHRBMA88.mjs.map → impl-DkoCw--t.mjs.map} +1 -1
  72. package/dist/{impl-DRoRyuVJ.mjs → impl-DrNfKDQ3.mjs} +2 -2
  73. package/dist/{impl-DRoRyuVJ.mjs.map → impl-DrNfKDQ3.mjs.map} +1 -1
  74. package/dist/{impl-CDAbvUwM.mjs → impl-IGizHcVC.mjs} +2 -2
  75. package/dist/{impl-CDAbvUwM.mjs.map → impl-IGizHcVC.mjs.map} +1 -1
  76. package/dist/{impl-B74gg4wg.mjs → impl-RYAKe7Fv.mjs} +2 -2
  77. package/dist/{impl-B74gg4wg.mjs.map → impl-RYAKe7Fv.mjs.map} +1 -1
  78. package/dist/{impl-C3qNq8l6.mjs → impl-Td62Sj3h.mjs} +2 -2
  79. package/dist/{impl-C3qNq8l6.mjs.map → impl-Td62Sj3h.mjs.map} +1 -1
  80. package/dist/{impl-wvAcih-u.mjs → impl-VgoCxy3T.mjs} +2 -2
  81. package/dist/{impl-wvAcih-u.mjs.map → impl-VgoCxy3T.mjs.map} +1 -1
  82. package/dist/{impl-8twQ8GMC.mjs → impl-WLxT70oT.mjs} +2 -2
  83. package/dist/{impl-8twQ8GMC.mjs.map → impl-WLxT70oT.mjs.map} +1 -1
  84. package/dist/{impl-CjJ0UQlE.mjs → impl-eMdIf8vD.mjs} +2 -2
  85. package/dist/{impl-CjJ0UQlE.mjs.map → impl-eMdIf8vD.mjs.map} +1 -1
  86. package/dist/{impl-CwdaxTeM.mjs → impl-euN2T30y.mjs} +2 -2
  87. package/dist/{impl-CwdaxTeM.mjs.map → impl-euN2T30y.mjs.map} +1 -1
  88. package/dist/{impl-BU6LoI9j.mjs → impl-nH5uHVyq.mjs} +2 -2
  89. package/dist/{impl-BU6LoI9j.mjs.map → impl-nH5uHVyq.mjs.map} +1 -1
  90. package/dist/{impl-rF0vq9Nk.mjs → impl-tlrH4BTy.mjs} +2 -2
  91. package/dist/{impl-rF0vq9Nk.mjs.map → impl-tlrH4BTy.mjs.map} +1 -1
  92. package/dist/index.mjs +1 -1
  93. package/dist/{markRequestDataSiloIdsCompleted-RLx-NGQX.mjs → markRequestDataSiloIdsCompleted-BS5PL4pL.mjs} +2 -2
  94. package/dist/{markRequestDataSiloIdsCompleted-RLx-NGQX.mjs.map → markRequestDataSiloIdsCompleted-BS5PL4pL.mjs.map} +1 -1
  95. package/dist/{markSilentPrivacyRequests-CaW2kbbn.mjs → markSilentPrivacyRequests-DpV3i0hX.mjs} +2 -2
  96. package/dist/{markSilentPrivacyRequests-CaW2kbbn.mjs.map → markSilentPrivacyRequests-DpV3i0hX.mjs.map} +1 -1
  97. package/dist/{notifyPrivacyRequestsAdditionalTime-GcUtfuzA.mjs → notifyPrivacyRequestsAdditionalTime-BDipeYtR.mjs} +2 -2
  98. package/dist/{notifyPrivacyRequestsAdditionalTime-GcUtfuzA.mjs.map → notifyPrivacyRequestsAdditionalTime-BDipeYtR.mjs.map} +1 -1
  99. package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-CeyJB-lD.mjs → pullChunkedCustomSiloOutstandingIdentifiers-BSDvt77x.mjs} +2 -2
  100. package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-CeyJB-lD.mjs.map → pullChunkedCustomSiloOutstandingIdentifiers-BSDvt77x.mjs.map} +1 -1
  101. package/dist/{pullManualEnrichmentIdentifiersToCsv-DfkW9-nX.mjs → pullManualEnrichmentIdentifiersToCsv-DcT-9Cp1.mjs} +2 -2
  102. package/dist/{pullManualEnrichmentIdentifiersToCsv-DfkW9-nX.mjs.map → pullManualEnrichmentIdentifiersToCsv-DcT-9Cp1.mjs.map} +1 -1
  103. package/dist/{pushCronIdentifiersFromCsv-Oks7iOwC.mjs → pushCronIdentifiersFromCsv-D__AqLbM.mjs} +2 -2
  104. package/dist/{pushCronIdentifiersFromCsv-Oks7iOwC.mjs.map → pushCronIdentifiersFromCsv-D__AqLbM.mjs.map} +1 -1
  105. package/dist/{pushManualEnrichmentIdentifiersFromCsv-Y1qfOHQS.mjs → pushManualEnrichmentIdentifiersFromCsv-P-FlXSNH.mjs} +2 -2
  106. package/dist/{pushManualEnrichmentIdentifiersFromCsv-Y1qfOHQS.mjs.map → pushManualEnrichmentIdentifiersFromCsv-P-FlXSNH.mjs.map} +1 -1
  107. package/dist/{removeUnverifiedRequestIdentifiers-CFrPuQZa.mjs → removeUnverifiedRequestIdentifiers-Drty-WbB.mjs} +2 -2
  108. package/dist/{removeUnverifiedRequestIdentifiers-CFrPuQZa.mjs.map → removeUnverifiedRequestIdentifiers-Drty-WbB.mjs.map} +1 -1
  109. package/dist/{retryRequestDataSilos-CUkt_5rj.mjs → retryRequestDataSilos-I-TMWIjU.mjs} +2 -2
  110. package/dist/{retryRequestDataSilos-CUkt_5rj.mjs.map → retryRequestDataSilos-I-TMWIjU.mjs.map} +1 -1
  111. package/dist/{skipPreflightJobs-Bz7lOjRZ.mjs → skipPreflightJobs-yux0ZXc_.mjs} +2 -2
  112. package/dist/{skipPreflightJobs-Bz7lOjRZ.mjs.map → skipPreflightJobs-yux0ZXc_.mjs.map} +1 -1
  113. package/dist/{skipRequestDataSilos-CgucJfbw.mjs → skipRequestDataSilos-CI9xC7Gv.mjs} +2 -2
  114. package/dist/{skipRequestDataSilos-CgucJfbw.mjs.map → skipRequestDataSilos-CI9xC7Gv.mjs.map} +1 -1
  115. package/dist/{streamPrivacyRequestsToCsv-CmmaBjCu.mjs → streamPrivacyRequestsToCsv-Bh-gk9ZD.mjs} +2 -2
  116. package/dist/{streamPrivacyRequestsToCsv-CmmaBjCu.mjs.map → streamPrivacyRequestsToCsv-Bh-gk9ZD.mjs.map} +1 -1
  117. package/dist/{updateConsentManagerVersionToLatest-z4dVl2L0.mjs → updateConsentManagerVersionToLatest-thw0q_iC.mjs} +2 -2
  118. package/dist/{updateConsentManagerVersionToLatest-z4dVl2L0.mjs.map → updateConsentManagerVersionToLatest-thw0q_iC.mjs.map} +1 -1
  119. package/dist/{uploadConsents-DXUKPUVc.mjs → uploadConsents-D9kSOwW8.mjs} +2 -2
  120. package/dist/{uploadConsents-DXUKPUVc.mjs.map → uploadConsents-D9kSOwW8.mjs.map} +1 -1
  121. package/dist/{uploadCookiesFromCsv-De5mzrnq.mjs → uploadCookiesFromCsv-BkvgIOSv.mjs} +2 -2
  122. package/dist/{uploadCookiesFromCsv-De5mzrnq.mjs.map → uploadCookiesFromCsv-BkvgIOSv.mjs.map} +1 -1
  123. package/dist/{uploadDataFlowsFromCsv-UlL2RtFK.mjs → uploadDataFlowsFromCsv-BOqV1uQG.mjs} +2 -2
  124. package/dist/{uploadDataFlowsFromCsv-UlL2RtFK.mjs.map → uploadDataFlowsFromCsv-BOqV1uQG.mjs.map} +1 -1
  125. package/dist/{uploadPrivacyRequestsFromCsv-B12nUzR7.mjs → uploadPrivacyRequestsFromCsv-nrbRvXw3.mjs} +2 -2
  126. package/dist/{uploadPrivacyRequestsFromCsv-B12nUzR7.mjs.map → uploadPrivacyRequestsFromCsv-nrbRvXw3.mjs.map} +1 -1
  127. package/package.json +4 -4
  128. package/dist/constants-CVdC1nK_.mjs +0 -2
@@ -1 +1 @@
1
- {"version":3,"file":"impl-B74gg4wg.mjs","names":["buildXdiSyncEndpointHelper"],"sources":["../src/commands/consent/build-xdi-sync-endpoint/impl.ts"],"sourcesContent":["import { writeFileSync } from 'node:fs';\n\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 { buildXdiSyncEndpoint as buildXdiSyncEndpointHelper } from '../../../lib/consent-manager/index.js';\nimport { logger } from '../../../logger.js';\n\nexport interface BuildXdiSyncEndpointCommandFlags {\n auth: string;\n xdiLocation: string;\n file: string;\n removeIpAddresses: boolean;\n domainBlockList: string[];\n xdiAllowedCommands: string;\n transcendUrl: string;\n}\n\nexport async function buildXdiSyncEndpoint(\n this: LocalContext,\n {\n auth,\n xdiLocation,\n file,\n removeIpAddresses,\n domainBlockList,\n xdiAllowedCommands,\n transcendUrl,\n }: BuildXdiSyncEndpointCommandFlags,\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 // Build the sync endpoint\n const { syncGroups, html } = await buildXdiSyncEndpointHelper(apiKeyOrList, {\n xdiLocation,\n transcendUrl,\n removeIpAddresses,\n domainBlockList: domainBlockList.length > 0 ? domainBlockList : undefined,\n xdiAllowedCommands,\n });\n\n // Log success\n logger.info(\n colors.green(\n `Successfully constructed sync endpoint for sync groups: ${JSON.stringify(\n syncGroups,\n null,\n 2,\n )}`,\n ),\n );\n\n // Write to disk\n writeFileSync(file, html);\n logger.info(colors.green(`Wrote configuration to file \"${file}\"!`));\n}\n"],"mappings":"kRAoBA,eAAsB,EAEpB,CACE,OACA,cACA,OACA,oBACA,kBACA,qBACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAMtC,GAAM,CAAE,aAAY,QAAS,MAAMA,EAA2B,MAHnC,EAAsB,EAAK,CAGsB,CAC1E,cACA,eACA,oBACA,gBAAiB,EAAgB,OAAS,EAAI,EAAkB,IAAA,GAChE,qBACD,CAAC,CAGF,EAAO,KACL,EAAO,MACL,2DAA2D,KAAK,UAC9D,EACA,KACA,EACD,GACF,CACF,CAGD,EAAc,EAAM,EAAK,CACzB,EAAO,KAAK,EAAO,MAAM,gCAAgC,EAAK,IAAI,CAAC"}
1
+ {"version":3,"file":"impl-RYAKe7Fv.mjs","names":["buildXdiSyncEndpointHelper"],"sources":["../src/commands/consent/build-xdi-sync-endpoint/impl.ts"],"sourcesContent":["import { writeFileSync } from 'node:fs';\n\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 { buildXdiSyncEndpoint as buildXdiSyncEndpointHelper } from '../../../lib/consent-manager/index.js';\nimport { logger } from '../../../logger.js';\n\nexport interface BuildXdiSyncEndpointCommandFlags {\n auth: string;\n xdiLocation: string;\n file: string;\n removeIpAddresses: boolean;\n domainBlockList: string[];\n xdiAllowedCommands: string;\n transcendUrl: string;\n}\n\nexport async function buildXdiSyncEndpoint(\n this: LocalContext,\n {\n auth,\n xdiLocation,\n file,\n removeIpAddresses,\n domainBlockList,\n xdiAllowedCommands,\n transcendUrl,\n }: BuildXdiSyncEndpointCommandFlags,\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 // Build the sync endpoint\n const { syncGroups, html } = await buildXdiSyncEndpointHelper(apiKeyOrList, {\n xdiLocation,\n transcendUrl,\n removeIpAddresses,\n domainBlockList: domainBlockList.length > 0 ? domainBlockList : undefined,\n xdiAllowedCommands,\n });\n\n // Log success\n logger.info(\n colors.green(\n `Successfully constructed sync endpoint for sync groups: ${JSON.stringify(\n syncGroups,\n null,\n 2,\n )}`,\n ),\n );\n\n // Write to disk\n writeFileSync(file, html);\n logger.info(colors.green(`Wrote configuration to file \"${file}\"!`));\n}\n"],"mappings":"kRAoBA,eAAsB,EAEpB,CACE,OACA,cACA,OACA,oBACA,kBACA,qBACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAMtC,GAAM,CAAE,aAAY,QAAS,MAAMA,EAA2B,MAHnC,EAAsB,EAAK,CAGsB,CAC1E,cACA,eACA,oBACA,gBAAiB,EAAgB,OAAS,EAAI,EAAkB,IAAA,GAChE,qBACD,CAAC,CAGF,EAAO,KACL,EAAO,MACL,2DAA2D,KAAK,UAC9D,EACA,KACA,EACD,GACF,CACF,CAGD,EAAc,EAAM,EAAK,CACzB,EAAO,KAAK,EAAO,MAAM,gCAAgC,EAAK,IAAI,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./constants-CVdC1nK_.mjs";import{t}from"./logger-Bj782ZYD.mjs";import{n}from"./syncCodePackages-CAk_Hjyl.mjs";import{t as r}from"./done-input-validation-BcNBxhEs.mjs";import{t as i}from"./constants-BmwXDQu9.mjs";import{getEntries as a}from"@transcend-io/type-utils";import o from"colors";import{buildTranscendGraphQLClient as s}from"@transcend-io/sdk";import{execSync as c}from"child_process";import l from"fast-glob";async function u({scanPath:e,ignoreDirs:n=[],repositoryName:r}){return(await Promise.all(a(i).map(async([i,a])=>{let{ignoreDirs:s,supportedFiles:c,scanFunction:u}=a,d=[...n,...s].filter(e=>e.length>0);try{let n=await l(`${e}/**/${c.join(`|`)}`,{ignore:d.map(t=>`${e}/**/${t}`),unique:!0,onlyFiles:!0});t.info(o.magenta(`Scanning: ${n.length} files of type ${i}`));let a=n.map(t=>u(t).map(n=>({...n,relativePath:t.replace(`${e}/`,``)}))).flat();return t.info(o.green(`Found: ${a.length} packages and ${a.map(({softwareDevelopmentKits:e=[]})=>e).flat().length} sdks`)),a.map(e=>({...e,type:i,repositoryName:r}))}catch(e){throw Error(`Error scanning globs ${c} with error: ${e}`)}}))).flat()}const d=`A repository name must be provided. You can specify using --repositoryName=$REPO_NAME or by ensuring the command "git config --get remote.origin.url" returns the name of the repository`;async function f({auth:i,scanPath:a,ignoreDirs:l,repositoryName:f,transcendUrl:p}){r(this.process.exit);let m=f;if(!m)try{let e=c(`cd ${a} && git config --get remote.origin.url`).toString(`utf-8`).trim();[m]=e.includes(`https:`)?e.split(`/`).slice(3).join(`/`).split(`.`):(e.split(`:`).pop()||``).split(`.`),m||(t.error(o.red(d)),this.process.exit(1))}catch(e){t.error(o.red(`${d} - Got error: ${e.message}`)),this.process.exit(1)}let h=s(p,i),g=await u({scanPath:a,ignoreDirs:l,repositoryName:m});await n(h,g);let _=new URL(e);_.pathname=`/code-scanning/code-packages`,t.info(o.green(`Scan found ${g.length} packages at ${a}! View results at '${_.href}'`))}export{f as scanPackages};
2
- //# sourceMappingURL=impl-C3qNq8l6.mjs.map
1
+ import{t as e}from"./constants-CY1i6J69.mjs";import{t}from"./logger-Bj782ZYD.mjs";import{n}from"./syncCodePackages-CAk_Hjyl.mjs";import{t as r}from"./done-input-validation-BcNBxhEs.mjs";import{t as i}from"./constants-BmwXDQu9.mjs";import{getEntries as a}from"@transcend-io/type-utils";import o from"colors";import{buildTranscendGraphQLClient as s}from"@transcend-io/sdk";import{execSync as c}from"child_process";import l from"fast-glob";async function u({scanPath:e,ignoreDirs:n=[],repositoryName:r}){return(await Promise.all(a(i).map(async([i,a])=>{let{ignoreDirs:s,supportedFiles:c,scanFunction:u}=a,d=[...n,...s].filter(e=>e.length>0);try{let n=await l(`${e}/**/${c.join(`|`)}`,{ignore:d.map(t=>`${e}/**/${t}`),unique:!0,onlyFiles:!0});t.info(o.magenta(`Scanning: ${n.length} files of type ${i}`));let a=n.map(t=>u(t).map(n=>({...n,relativePath:t.replace(`${e}/`,``)}))).flat();return t.info(o.green(`Found: ${a.length} packages and ${a.map(({softwareDevelopmentKits:e=[]})=>e).flat().length} sdks`)),a.map(e=>({...e,type:i,repositoryName:r}))}catch(e){throw Error(`Error scanning globs ${c} with error: ${e}`)}}))).flat()}const d=`A repository name must be provided. You can specify using --repositoryName=$REPO_NAME or by ensuring the command "git config --get remote.origin.url" returns the name of the repository`;async function f({auth:i,scanPath:a,ignoreDirs:l,repositoryName:f,transcendUrl:p}){r(this.process.exit);let m=f;if(!m)try{let e=c(`cd ${a} && git config --get remote.origin.url`).toString(`utf-8`).trim();[m]=e.includes(`https:`)?e.split(`/`).slice(3).join(`/`).split(`.`):(e.split(`:`).pop()||``).split(`.`),m||(t.error(o.red(d)),this.process.exit(1))}catch(e){t.error(o.red(`${d} - Got error: ${e.message}`)),this.process.exit(1)}let h=s(p,i),g=await u({scanPath:a,ignoreDirs:l,repositoryName:m});await n(h,g);let _=new URL(e);_.pathname=`/code-scanning/code-packages`,t.info(o.green(`Scan found ${g.length} packages at ${a}! View results at '${_.href}'`))}export{f as scanPackages};
2
+ //# sourceMappingURL=impl-Td62Sj3h.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-C3qNq8l6.mjs","names":[],"sources":["../src/lib/code-scanning/findCodePackagesInFolder.ts","../src/commands/inventory/scan-packages/impl.ts"],"sourcesContent":["import { getEntries } from '@transcend-io/type-utils';\nimport colors from 'colors';\nimport fastGlob from 'fast-glob';\n\nimport { CodePackageInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { CODE_SCANNING_CONFIGS } from './constants.js';\n\n/**\n * Helper to scan and discovery all of the code packages within a folder\n *\n * @param options - Options\n * @returns the list of integrations\n */\nexport async function findCodePackagesInFolder({\n scanPath,\n ignoreDirs = [],\n repositoryName,\n}: {\n /** The name of the github repository reporting packages for */\n repositoryName: string;\n /** Where to look for package.json files */\n scanPath: string;\n /** The directories to ignore (excludes node_modules and serverless-build) */\n ignoreDirs?: string[];\n}): Promise<CodePackageInput[]> {\n const allCodePackages = await Promise.all(\n getEntries(CODE_SCANNING_CONFIGS).map(async ([codePackageType, config]) => {\n const { ignoreDirs: configIgnoreDirs, supportedFiles, scanFunction } = config;\n const dirsToIgnore = [...ignoreDirs, ...configIgnoreDirs].filter((dir) => dir.length > 0);\n try {\n const filesToScan: string[] = await fastGlob(`${scanPath}/**/${supportedFiles.join('|')}`, {\n ignore: dirsToIgnore.map((dir: string) => `${scanPath}/**/${dir}`),\n unique: true,\n onlyFiles: true,\n });\n logger.info(\n colors.magenta(`Scanning: ${filesToScan.length} files of type ${codePackageType}`),\n );\n const allPackages = filesToScan\n .map((filePath) =>\n scanFunction(filePath).map((result) => ({\n ...result,\n relativePath: filePath.replace(`${scanPath}/`, ''),\n })),\n )\n .flat();\n logger.info(\n colors.green(\n `Found: ${allPackages.length} packages and ${\n allPackages.map(({ softwareDevelopmentKits = [] }) => softwareDevelopmentKits).flat()\n .length\n } sdks`,\n ),\n );\n\n return allPackages.map(\n (pkg): CodePackageInput => ({\n ...pkg,\n type: codePackageType,\n repositoryName,\n }),\n );\n } catch (error) {\n throw new Error(`Error scanning globs ${supportedFiles} with error: ${error}`);\n }\n }),\n );\n\n return allCodePackages.flat();\n}\n","import { execSync } from 'child_process';\n\nimport { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport colors from 'colors';\n\nimport { ADMIN_DASH } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { findCodePackagesInFolder } from '../../../lib/code-scanning/index.js';\nimport { syncCodePackages } from '../../../lib/graphql/index.js';\nimport { logger } from '../../../logger.js';\n\nconst REPO_ERROR =\n 'A repository name must be provided. ' +\n 'You can specify using --repositoryName=$REPO_NAME or by ensuring the ' +\n 'command \"git config --get remote.origin.url\" returns the name of the repository';\n\nexport interface ScanPackagesCommandFlags {\n auth: string;\n scanPath: string;\n ignoreDirs?: string[];\n repositoryName?: string;\n transcendUrl: string;\n}\n\nexport async function scanPackages(\n this: LocalContext,\n { auth, scanPath, ignoreDirs, repositoryName, transcendUrl }: ScanPackagesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Ensure repository name is specified\n let gitRepositoryName = repositoryName;\n if (!gitRepositoryName) {\n try {\n const name = execSync(`cd ${scanPath} && git config --get remote.origin.url`);\n // Trim and parse the URL\n const url = name.toString('utf-8').trim();\n [gitRepositoryName] = !url.includes('https:')\n ? (url.split(':').pop() || '').split('.')\n : url.split('/').slice(3).join('/').split('.');\n if (!gitRepositoryName) {\n logger.error(colors.red(REPO_ERROR));\n this.process.exit(1);\n }\n } catch (err) {\n logger.error(colors.red(`${REPO_ERROR} - Got error: ${err.message}`));\n this.process.exit(1);\n }\n }\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Scan the codebase to discovery packages\n const results = await findCodePackagesInFolder({\n scanPath,\n ignoreDirs,\n repositoryName: gitRepositoryName,\n });\n\n // Report scan to Transcend\n await syncCodePackages(client, results);\n\n const newUrl = new URL(ADMIN_DASH);\n newUrl.pathname = '/code-scanning/code-packages';\n\n // Indicate success\n logger.info(\n colors.green(\n `Scan found ${results.length} packages at ${scanPath}! ` + `View results at '${newUrl.href}'`,\n ),\n );\n}\n"],"mappings":"qbAcA,eAAsB,EAAyB,CAC7C,WACA,aAAa,EAAE,CACf,kBAQ8B,CA4C9B,OAAO,MA3CuB,QAAQ,IACpC,EAAW,EAAsB,CAAC,IAAI,MAAO,CAAC,EAAiB,KAAY,CACzE,GAAM,CAAE,WAAY,EAAkB,iBAAgB,gBAAiB,EACjE,EAAe,CAAC,GAAG,EAAY,GAAG,EAAiB,CAAC,OAAQ,GAAQ,EAAI,OAAS,EAAE,CACzF,GAAI,CACF,IAAM,EAAwB,MAAM,EAAS,GAAG,EAAS,MAAM,EAAe,KAAK,IAAI,GAAI,CACzF,OAAQ,EAAa,IAAK,GAAgB,GAAG,EAAS,MAAM,IAAM,CAClE,OAAQ,GACR,UAAW,GACZ,CAAC,CACF,EAAO,KACL,EAAO,QAAQ,aAAa,EAAY,OAAO,iBAAiB,IAAkB,CACnF,CACD,IAAM,EAAc,EACjB,IAAK,GACJ,EAAa,EAAS,CAAC,IAAK,IAAY,CACtC,GAAG,EACH,aAAc,EAAS,QAAQ,GAAG,EAAS,GAAI,GAAG,CACnD,EAAE,CACJ,CACA,MAAM,CAUT,OATA,EAAO,KACL,EAAO,MACL,UAAU,EAAY,OAAO,gBAC3B,EAAY,KAAK,CAAE,0BAA0B,EAAE,IAAO,EAAwB,CAAC,MAAM,CAClF,OACJ,OACF,CACF,CAEM,EAAY,IAChB,IAA2B,CAC1B,GAAG,EACH,KAAM,EACN,iBACD,EACF,OACM,EAAO,CACd,MAAU,MAAM,wBAAwB,EAAe,eAAe,IAAQ,GAEhF,CACH,EAEsB,MAAM,CCzD/B,MAAM,EACJ,2LAYF,eAAsB,EAEpB,CAAE,OAAM,WAAU,aAAY,iBAAgB,gBAC/B,CACf,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAI,EAAoB,EACxB,GAAI,CAAC,EACH,GAAI,CAGF,IAAM,EAFO,EAAS,MAAM,EAAS,wCAErB,CAAC,SAAS,QAAQ,CAAC,MAAM,CACzC,CAAC,GAAsB,EAAI,SAAS,SAAS,CAEzC,EAAI,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC,MAAM,IAAI,EAD3C,EAAI,MAAM,IAAI,CAAC,KAAK,EAAI,IAAI,MAAM,IAAI,CAEtC,IACH,EAAO,MAAM,EAAO,IAAI,EAAW,CAAC,CACpC,KAAK,QAAQ,KAAK,EAAE,QAEf,EAAK,CACZ,EAAO,MAAM,EAAO,IAAI,GAAG,EAAW,gBAAgB,EAAI,UAAU,CAAC,CACrE,KAAK,QAAQ,KAAK,EAAE,CAKxB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAU,MAAM,EAAyB,CAC7C,WACA,aACA,eAAgB,EACjB,CAAC,CAGF,MAAM,EAAiB,EAAQ,EAAQ,CAEvC,IAAM,EAAS,IAAI,IAAI,EAAW,CAClC,EAAO,SAAW,+BAGlB,EAAO,KACL,EAAO,MACL,cAAc,EAAQ,OAAO,eAAe,EAAS,qBAA0B,EAAO,KAAK,GAC5F,CACF"}
1
+ {"version":3,"file":"impl-Td62Sj3h.mjs","names":[],"sources":["../src/lib/code-scanning/findCodePackagesInFolder.ts","../src/commands/inventory/scan-packages/impl.ts"],"sourcesContent":["import { getEntries } from '@transcend-io/type-utils';\nimport colors from 'colors';\nimport fastGlob from 'fast-glob';\n\nimport { CodePackageInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { CODE_SCANNING_CONFIGS } from './constants.js';\n\n/**\n * Helper to scan and discovery all of the code packages within a folder\n *\n * @param options - Options\n * @returns the list of integrations\n */\nexport async function findCodePackagesInFolder({\n scanPath,\n ignoreDirs = [],\n repositoryName,\n}: {\n /** The name of the github repository reporting packages for */\n repositoryName: string;\n /** Where to look for package.json files */\n scanPath: string;\n /** The directories to ignore (excludes node_modules and serverless-build) */\n ignoreDirs?: string[];\n}): Promise<CodePackageInput[]> {\n const allCodePackages = await Promise.all(\n getEntries(CODE_SCANNING_CONFIGS).map(async ([codePackageType, config]) => {\n const { ignoreDirs: configIgnoreDirs, supportedFiles, scanFunction } = config;\n const dirsToIgnore = [...ignoreDirs, ...configIgnoreDirs].filter((dir) => dir.length > 0);\n try {\n const filesToScan: string[] = await fastGlob(`${scanPath}/**/${supportedFiles.join('|')}`, {\n ignore: dirsToIgnore.map((dir: string) => `${scanPath}/**/${dir}`),\n unique: true,\n onlyFiles: true,\n });\n logger.info(\n colors.magenta(`Scanning: ${filesToScan.length} files of type ${codePackageType}`),\n );\n const allPackages = filesToScan\n .map((filePath) =>\n scanFunction(filePath).map((result) => ({\n ...result,\n relativePath: filePath.replace(`${scanPath}/`, ''),\n })),\n )\n .flat();\n logger.info(\n colors.green(\n `Found: ${allPackages.length} packages and ${\n allPackages.map(({ softwareDevelopmentKits = [] }) => softwareDevelopmentKits).flat()\n .length\n } sdks`,\n ),\n );\n\n return allPackages.map(\n (pkg): CodePackageInput => ({\n ...pkg,\n type: codePackageType,\n repositoryName,\n }),\n );\n } catch (error) {\n throw new Error(`Error scanning globs ${supportedFiles} with error: ${error}`);\n }\n }),\n );\n\n return allCodePackages.flat();\n}\n","import { execSync } from 'child_process';\n\nimport { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport colors from 'colors';\n\nimport { ADMIN_DASH } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { findCodePackagesInFolder } from '../../../lib/code-scanning/index.js';\nimport { syncCodePackages } from '../../../lib/graphql/index.js';\nimport { logger } from '../../../logger.js';\n\nconst REPO_ERROR =\n 'A repository name must be provided. ' +\n 'You can specify using --repositoryName=$REPO_NAME or by ensuring the ' +\n 'command \"git config --get remote.origin.url\" returns the name of the repository';\n\nexport interface ScanPackagesCommandFlags {\n auth: string;\n scanPath: string;\n ignoreDirs?: string[];\n repositoryName?: string;\n transcendUrl: string;\n}\n\nexport async function scanPackages(\n this: LocalContext,\n { auth, scanPath, ignoreDirs, repositoryName, transcendUrl }: ScanPackagesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Ensure repository name is specified\n let gitRepositoryName = repositoryName;\n if (!gitRepositoryName) {\n try {\n const name = execSync(`cd ${scanPath} && git config --get remote.origin.url`);\n // Trim and parse the URL\n const url = name.toString('utf-8').trim();\n [gitRepositoryName] = !url.includes('https:')\n ? (url.split(':').pop() || '').split('.')\n : url.split('/').slice(3).join('/').split('.');\n if (!gitRepositoryName) {\n logger.error(colors.red(REPO_ERROR));\n this.process.exit(1);\n }\n } catch (err) {\n logger.error(colors.red(`${REPO_ERROR} - Got error: ${err.message}`));\n this.process.exit(1);\n }\n }\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Scan the codebase to discovery packages\n const results = await findCodePackagesInFolder({\n scanPath,\n ignoreDirs,\n repositoryName: gitRepositoryName,\n });\n\n // Report scan to Transcend\n await syncCodePackages(client, results);\n\n const newUrl = new URL(ADMIN_DASH);\n newUrl.pathname = '/code-scanning/code-packages';\n\n // Indicate success\n logger.info(\n colors.green(\n `Scan found ${results.length} packages at ${scanPath}! ` + `View results at '${newUrl.href}'`,\n ),\n );\n}\n"],"mappings":"qbAcA,eAAsB,EAAyB,CAC7C,WACA,aAAa,EAAE,CACf,kBAQ8B,CA4C9B,OAAO,MA3CuB,QAAQ,IACpC,EAAW,EAAsB,CAAC,IAAI,MAAO,CAAC,EAAiB,KAAY,CACzE,GAAM,CAAE,WAAY,EAAkB,iBAAgB,gBAAiB,EACjE,EAAe,CAAC,GAAG,EAAY,GAAG,EAAiB,CAAC,OAAQ,GAAQ,EAAI,OAAS,EAAE,CACzF,GAAI,CACF,IAAM,EAAwB,MAAM,EAAS,GAAG,EAAS,MAAM,EAAe,KAAK,IAAI,GAAI,CACzF,OAAQ,EAAa,IAAK,GAAgB,GAAG,EAAS,MAAM,IAAM,CAClE,OAAQ,GACR,UAAW,GACZ,CAAC,CACF,EAAO,KACL,EAAO,QAAQ,aAAa,EAAY,OAAO,iBAAiB,IAAkB,CACnF,CACD,IAAM,EAAc,EACjB,IAAK,GACJ,EAAa,EAAS,CAAC,IAAK,IAAY,CACtC,GAAG,EACH,aAAc,EAAS,QAAQ,GAAG,EAAS,GAAI,GAAG,CACnD,EAAE,CACJ,CACA,MAAM,CAUT,OATA,EAAO,KACL,EAAO,MACL,UAAU,EAAY,OAAO,gBAC3B,EAAY,KAAK,CAAE,0BAA0B,EAAE,IAAO,EAAwB,CAAC,MAAM,CAClF,OACJ,OACF,CACF,CAEM,EAAY,IAChB,IAA2B,CAC1B,GAAG,EACH,KAAM,EACN,iBACD,EACF,OACM,EAAO,CACd,MAAU,MAAM,wBAAwB,EAAe,eAAe,IAAQ,GAEhF,CACH,EAEsB,MAAM,CCzD/B,MAAM,EACJ,2LAYF,eAAsB,EAEpB,CAAE,OAAM,WAAU,aAAY,iBAAgB,gBAC/B,CACf,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAI,EAAoB,EACxB,GAAI,CAAC,EACH,GAAI,CAGF,IAAM,EAFO,EAAS,MAAM,EAAS,wCAErB,CAAC,SAAS,QAAQ,CAAC,MAAM,CACzC,CAAC,GAAsB,EAAI,SAAS,SAAS,CAEzC,EAAI,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC,MAAM,IAAI,EAD3C,EAAI,MAAM,IAAI,CAAC,KAAK,EAAI,IAAI,MAAM,IAAI,CAEtC,IACH,EAAO,MAAM,EAAO,IAAI,EAAW,CAAC,CACpC,KAAK,QAAQ,KAAK,EAAE,QAEf,EAAK,CACZ,EAAO,MAAM,EAAO,IAAI,GAAG,EAAW,gBAAgB,EAAI,UAAU,CAAC,CACrE,KAAK,QAAQ,KAAK,EAAE,CAKxB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAU,MAAM,EAAyB,CAC7C,WACA,aACA,eAAgB,EACjB,CAAC,CAGF,MAAM,EAAiB,EAAQ,EAAQ,CAEvC,IAAM,EAAS,IAAI,IAAI,EAAW,CAClC,EAAO,SAAW,+BAGlB,EAAO,KACL,EAAO,MACL,cAAc,EAAQ,OAAO,eAAe,EAAS,qBAA0B,EAAO,KAAK,GAC5F,CACF"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./markSilentPrivacyRequests-CaW2kbbn.mjs";import{t}from"./done-input-validation-BcNBxhEs.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-wvAcih-u.mjs.map
1
+ import{t as e}from"./markSilentPrivacyRequests-DpV3i0hX.mjs";import{t}from"./done-input-validation-BcNBxhEs.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-VgoCxy3T.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-wvAcih-u.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-VgoCxy3T.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"./skipPreflightJobs-Bz7lOjRZ.mjs";import{t}from"./done-input-validation-BcNBxhEs.mjs";async function n({auth:n,transcendUrl:r,enricherIds:i}){t(this.process.exit),await e({transcendUrl:r,auth:n,enricherIds:i})}export{n as skipPreflightJobs};
2
- //# sourceMappingURL=impl-8twQ8GMC.mjs.map
1
+ import{t as e}from"./skipPreflightJobs-yux0ZXc_.mjs";import{t}from"./done-input-validation-BcNBxhEs.mjs";async function n({auth:n,transcendUrl:r,enricherIds:i}){t(this.process.exit),await e({transcendUrl:r,auth:n,enricherIds:i})}export{n as skipPreflightJobs};
2
+ //# sourceMappingURL=impl-WLxT70oT.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-8twQ8GMC.mjs","names":["skipPreflightJobsHelper"],"sources":["../src/commands/request/skip-preflight-jobs/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { skipPreflightJobs as skipPreflightJobsHelper } from '../../../lib/requests/index.js';\n\nexport interface SkipPreflightJobsCommandFlags {\n auth: string;\n enricherIds: string[];\n transcendUrl: string;\n}\n\nexport async function skipPreflightJobs(\n this: LocalContext,\n { auth, transcendUrl, enricherIds }: SkipPreflightJobsCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await skipPreflightJobsHelper({\n transcendUrl,\n auth,\n enricherIds,\n });\n}\n"],"mappings":"yGAUA,eAAsB,EAEpB,CAAE,OAAM,eAAc,eACP,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAAwB,CAC5B,eACA,OACA,cACD,CAAC"}
1
+ {"version":3,"file":"impl-WLxT70oT.mjs","names":["skipPreflightJobsHelper"],"sources":["../src/commands/request/skip-preflight-jobs/impl.ts"],"sourcesContent":["import type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { skipPreflightJobs as skipPreflightJobsHelper } from '../../../lib/requests/index.js';\n\nexport interface SkipPreflightJobsCommandFlags {\n auth: string;\n enricherIds: string[];\n transcendUrl: string;\n}\n\nexport async function skipPreflightJobs(\n this: LocalContext,\n { auth, transcendUrl, enricherIds }: SkipPreflightJobsCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n await skipPreflightJobsHelper({\n transcendUrl,\n auth,\n enricherIds,\n });\n}\n"],"mappings":"yGAUA,eAAsB,EAEpB,CAAE,OAAM,eAAc,eACP,CACf,EAAoB,KAAK,QAAQ,KAAK,CAEtC,MAAMA,EAAwB,CAC5B,eACA,OACA,cACD,CAAC"}
@@ -1,2 +1,2 @@
1
- import{r as e}from"./constants-CVdC1nK_.mjs";import{t}from"./logger-Bj782ZYD.mjs";import{r as n}from"./readTranscendYaml-CGb2UUyM.mjs";import{n as r,r as i,t as a}from"./parseVariablesFromString-BeKOGw5n.mjs";import{t as o}from"./validateTranscendAuth-DJ8qHb9B.mjs";import{t as s}from"./listFiles-D2wMHnEr.mjs";import{t as c}from"./done-input-validation-BcNBxhEs.mjs";import{existsSync as l,lstatSync as u}from"node:fs";import{join as d}from"node:path";import f from"colors";import{buildTranscendGraphQLClient as p}from"@transcend-io/sdk";import{mapSeries as m}from"@transcend-io/utils";async function h({transcendUrl:e,auth:n,pageSize:r,publishToPrivacyCenter:a,contents:o,deleteExtraAttributeValues:s=!1,classifyService:c=!1}){let l=p(e,n);try{return!await i(o,l,{pageSize:r,publishToPrivacyCenter:a,classifyService:c,deleteExtraAttributeValues:s})}catch(e){return t.error(f.red(`An unexpected error occurred syncing the schema: ${e.message}`)),!1}}async function g({file:i=`./transcend.yml`,transcendUrl:p,auth:g,variables:_,pageSize:v,publishToPrivacyCenter:y,classifyService:b,deleteExtraAttributeValues:x}){c(this.process.exit);let S=await o(g),C=a(_),w;if(w=Array.isArray(S)&&u(i).isDirectory()?s(i).map(e=>d(i,e)):i.split(`,`),w.length<1)throw Error(`No file specified!`);let T=w.map(e=>{l(e)?t.info(f.magenta(`Reading file "${e}"...`)):(t.error(f.red(`The file path does not exist on disk: ${e}. You can specify the filepath using --file=./examples/transcend.yml`)),this.process.exit(1));try{let r=n(e,C);return t.info(f.green(`Successfully read in "${e}"`)),{content:r,name:e.split(`/`).pop().replace(`.yml`,``)}}catch(e){t.error(f.red(`The shape of your yaml file is invalid with the following errors: ${e.message}`)),this.process.exit(1)}});if(typeof S==`string`){let[n,...i]=T.map(({content:e})=>e);await h({transcendUrl:p,auth:S,contents:r(n,...i),publishToPrivacyCenter:y,deleteExtraAttributeValues:x,pageSize:v,classifyService:!!b})||(t.info(f.red(`Sync encountered errors. View output above for more information, or check out ${e}`)),this.process.exit(1))}else{if(T.length!==1&&T.length!==S.length)throw Error(`Expected list of yml files to be equal to the list of API keys.Got ${T.length} YML file${T.length===1?``:`s`} and ${S.length} API key${S.length===1?``:`s`}`);let n=[];await m(S,async(e,r)=>{let i=`[${r+1}/${S.length}][${e.organizationName}] `;t.info(f.magenta(`~~~\n\n${i}Attempting to push configuration...\n\n~~~`));let a=T.length===1?T[0].content:T.find(t=>t.name===e.organizationName)?.content;if(!a){t.error(f.red(`${i}Failed to find transcend.yml file for organization: "${e.organizationName}".`)),n.push(e.organizationName);return}await h({transcendUrl:p,auth:e.apiKey,contents:a,pageSize:v,publishToPrivacyCenter:y,deleteExtraAttributeValues:x,classifyService:b})?t.info(f.green(`${i}Successfully pushed configuration!`)):(t.error(f.red(`${i}Failed to sync configuration.`)),n.push(e.organizationName))}),n.length>0&&(t.info(f.red(`Sync encountered errors for "${n.join(`,`)}". View output above for more information, or check out ${e}`)),this.process.exit(1))}t.info(f.green(`Successfully synced yaml file to Transcend! View at ${e}`))}export{g as push};
2
- //# sourceMappingURL=impl-CjJ0UQlE.mjs.map
1
+ import{r as e}from"./constants-CY1i6J69.mjs";import{t}from"./logger-Bj782ZYD.mjs";import{r as n}from"./readTranscendYaml-CGb2UUyM.mjs";import{n as r,r as i,t as a}from"./parseVariablesFromString-BeKOGw5n.mjs";import{t as o}from"./validateTranscendAuth-DJ8qHb9B.mjs";import{t as s}from"./listFiles-D2wMHnEr.mjs";import{t as c}from"./done-input-validation-BcNBxhEs.mjs";import{existsSync as l,lstatSync as u}from"node:fs";import{join as d}from"node:path";import f from"colors";import{buildTranscendGraphQLClient as p}from"@transcend-io/sdk";import{mapSeries as m}from"@transcend-io/utils";async function h({transcendUrl:e,auth:n,pageSize:r,publishToPrivacyCenter:a,contents:o,deleteExtraAttributeValues:s=!1,classifyService:c=!1}){let l=p(e,n);try{return!await i(o,l,{pageSize:r,publishToPrivacyCenter:a,classifyService:c,deleteExtraAttributeValues:s})}catch(e){return t.error(f.red(`An unexpected error occurred syncing the schema: ${e.message}`)),!1}}async function g({file:i=`./transcend.yml`,transcendUrl:p,auth:g,variables:_,pageSize:v,publishToPrivacyCenter:y,classifyService:b,deleteExtraAttributeValues:x}){c(this.process.exit);let S=await o(g),C=a(_),w;if(w=Array.isArray(S)&&u(i).isDirectory()?s(i).map(e=>d(i,e)):i.split(`,`),w.length<1)throw Error(`No file specified!`);let T=w.map(e=>{l(e)?t.info(f.magenta(`Reading file "${e}"...`)):(t.error(f.red(`The file path does not exist on disk: ${e}. You can specify the filepath using --file=./examples/transcend.yml`)),this.process.exit(1));try{let r=n(e,C);return t.info(f.green(`Successfully read in "${e}"`)),{content:r,name:e.split(`/`).pop().replace(`.yml`,``)}}catch(e){t.error(f.red(`The shape of your yaml file is invalid with the following errors: ${e.message}`)),this.process.exit(1)}});if(typeof S==`string`){let[n,...i]=T.map(({content:e})=>e);await h({transcendUrl:p,auth:S,contents:r(n,...i),publishToPrivacyCenter:y,deleteExtraAttributeValues:x,pageSize:v,classifyService:!!b})||(t.info(f.red(`Sync encountered errors. View output above for more information, or check out ${e}`)),this.process.exit(1))}else{if(T.length!==1&&T.length!==S.length)throw Error(`Expected list of yml files to be equal to the list of API keys.Got ${T.length} YML file${T.length===1?``:`s`} and ${S.length} API key${S.length===1?``:`s`}`);let n=[];await m(S,async(e,r)=>{let i=`[${r+1}/${S.length}][${e.organizationName}] `;t.info(f.magenta(`~~~\n\n${i}Attempting to push configuration...\n\n~~~`));let a=T.length===1?T[0].content:T.find(t=>t.name===e.organizationName)?.content;if(!a){t.error(f.red(`${i}Failed to find transcend.yml file for organization: "${e.organizationName}".`)),n.push(e.organizationName);return}await h({transcendUrl:p,auth:e.apiKey,contents:a,pageSize:v,publishToPrivacyCenter:y,deleteExtraAttributeValues:x,classifyService:b})?t.info(f.green(`${i}Successfully pushed configuration!`)):(t.error(f.red(`${i}Failed to sync configuration.`)),n.push(e.organizationName))}),n.length>0&&(t.info(f.red(`Sync encountered errors for "${n.join(`,`)}". View output above for more information, or check out ${e}`)),this.process.exit(1))}t.info(f.green(`Successfully synced yaml file to Transcend! View at ${e}`))}export{g as push};
2
+ //# sourceMappingURL=impl-eMdIf8vD.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-CjJ0UQlE.mjs","names":[],"sources":["../src/commands/inventory/push/impl.ts"],"sourcesContent":["import { existsSync, lstatSync } from 'node:fs';\nimport { join } from 'node:path';\n\nimport { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport { mapSeries } from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport { TranscendInput } from '../../../codecs.js';\nimport { ADMIN_DASH_INTEGRATIONS } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { validateTranscendAuth, listFiles } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { syncConfigurationToTranscend } from '../../../lib/graphql/index.js';\nimport { parseVariablesFromString } from '../../../lib/helpers/parseVariablesFromString.js';\nimport { mergeTranscendInputs } from '../../../lib/mergeTranscendInputs.js';\nimport { readTranscendYaml } from '../../../lib/readTranscendYaml.js';\nimport { logger } from '../../../logger.js';\n\n/**\n * Sync configuration to Transcend\n *\n * @param options - Options\n * @returns True if synced successfully, false if error occurs\n */\nasync function syncConfiguration({\n transcendUrl,\n auth,\n pageSize,\n publishToPrivacyCenter,\n contents,\n deleteExtraAttributeValues = false,\n classifyService = false,\n}: {\n /** Transcend YAML */\n contents: TranscendInput;\n /** Transcend URL */\n transcendUrl: string;\n /** API key */\n auth: string;\n /** Page size */\n pageSize: number;\n /** Skip privacy center publish step */\n publishToPrivacyCenter: boolean;\n /** classify data flow service if missing */\n classifyService?: boolean;\n /** Delete attributes when syncing */\n deleteExtraAttributeValues?: boolean;\n}): Promise<boolean> {\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Sync to Transcend\n try {\n const encounteredError = await syncConfigurationToTranscend(contents, client, {\n pageSize,\n publishToPrivacyCenter,\n classifyService,\n deleteExtraAttributeValues,\n });\n return !encounteredError;\n } catch (err) {\n logger.error(colors.red(`An unexpected error occurred syncing the schema: ${err.message}`));\n return false;\n }\n}\n\nexport interface PushCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n pageSize: number;\n variables: string;\n publishToPrivacyCenter: boolean;\n classifyService: boolean;\n deleteExtraAttributeValues: boolean;\n}\n\nexport async function push(\n this: LocalContext,\n {\n file = './transcend.yml',\n transcendUrl,\n auth,\n variables,\n pageSize,\n publishToPrivacyCenter,\n classifyService,\n deleteExtraAttributeValues,\n }: PushCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth);\n\n // Parse out the variables\n const vars = parseVariablesFromString(variables);\n\n // check if we are being passed a list of API keys and a list of files\n let fileList: string[];\n if (Array.isArray(apiKeyOrList) && lstatSync(file).isDirectory()) {\n fileList = listFiles(file).map((filePath) => join(file, filePath));\n } else {\n fileList = file.split(',');\n }\n\n // Ensure at least one file is parsed\n if (fileList.length < 1) {\n throw new Error('No file specified!');\n }\n\n // eslint-disable-next-line array-callback-return,consistent-return\n const transcendInputs = fileList.map((filePath) => {\n // Ensure yaml file exists on disk\n if (!existsSync(filePath)) {\n logger.error(\n colors.red(\n `The file path does not exist on disk: ${filePath}. You can specify the filepath using --file=./examples/transcend.yml`,\n ),\n );\n this.process.exit(1);\n } else {\n logger.info(colors.magenta(`Reading file \"${filePath}\"...`));\n }\n\n try {\n // Read in the yaml file and validate it's shape\n const newContents = readTranscendYaml(filePath, vars);\n logger.info(colors.green(`Successfully read in \"${filePath}\"`));\n return {\n content: newContents,\n name: filePath.split('/').pop()!.replace('.yml', ''),\n };\n } catch (err) {\n logger.error(\n colors.red(\n `The shape of your yaml file is invalid with the following errors: ${err.message}`,\n ),\n );\n this.process.exit(1);\n }\n });\n\n // process a single API key\n if (typeof apiKeyOrList === 'string') {\n // if passed multiple inputs, merge them together\n const [base, ...rest] = transcendInputs.map(({ content }) => content);\n const contents = mergeTranscendInputs(base, ...rest);\n\n // sync the configuration\n const success = await syncConfiguration({\n transcendUrl,\n auth: apiKeyOrList,\n contents,\n publishToPrivacyCenter,\n deleteExtraAttributeValues,\n pageSize,\n classifyService: !!classifyService,\n });\n\n // exist with error code\n if (!success) {\n logger.info(\n colors.red(\n `Sync encountered errors. View output above for more information, or check out ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n\n this.process.exit(1);\n }\n } else {\n // if passed multiple inputs, expect them to be one per instance\n if (transcendInputs.length !== 1 && transcendInputs.length !== apiKeyOrList.length) {\n throw new Error(\n 'Expected list of yml files to be equal to the list of API keys.' +\n `Got ${transcendInputs.length} YML file${\n transcendInputs.length === 1 ? '' : 's'\n } and ${apiKeyOrList.length} API key${apiKeyOrList.length === 1 ? '' : 's'}`,\n );\n }\n\n const encounteredErrors: string[] = [];\n await mapSeries(apiKeyOrList, async (apiKey, ind) => {\n const prefix = `[${ind + 1}/${apiKeyOrList.length}][${apiKey.organizationName}] `;\n logger.info(colors.magenta(`~~~\\n\\n${prefix}Attempting to push configuration...\\n\\n~~~`));\n\n // use the merged contents if 1 yml passed, else use the contents that map to that organization\n const useContents =\n transcendInputs.length === 1\n ? transcendInputs[0].content\n : transcendInputs.find((input) => input.name === apiKey.organizationName)?.content;\n\n // Throw error if cannot find a yml file matching that organization name\n if (!useContents) {\n logger.error(\n colors.red(\n `${prefix}Failed to find transcend.yml file for organization: \"${apiKey.organizationName}\".`,\n ),\n );\n encounteredErrors.push(apiKey.organizationName);\n return;\n }\n\n const success = await syncConfiguration({\n transcendUrl,\n auth: apiKey.apiKey,\n contents: useContents,\n pageSize,\n publishToPrivacyCenter,\n deleteExtraAttributeValues,\n classifyService,\n });\n\n if (success) {\n logger.info(colors.green(`${prefix}Successfully pushed configuration!`));\n } else {\n logger.error(colors.red(`${prefix}Failed to sync configuration.`));\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 // Indicate success\n logger.info(\n colors.green(`Successfully synced yaml file to Transcend! View at ${ADMIN_DASH_INTEGRATIONS}`),\n );\n}\n"],"mappings":"2kBAwBA,eAAe,EAAkB,CAC/B,eACA,OACA,WACA,yBACA,WACA,6BAA6B,GAC7B,kBAAkB,IAgBC,CACnB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAG9D,GAAI,CAOF,MAAO,CAAC,MANuB,EAA6B,EAAU,EAAQ,CAC5E,WACA,yBACA,kBACA,6BACD,CAAC,OAEK,EAAK,CAEZ,OADA,EAAO,MAAM,EAAO,IAAI,oDAAoD,EAAI,UAAU,CAAC,CACpF,IAeX,eAAsB,EAEpB,CACE,OAAO,kBACP,eACA,OACA,YACA,WACA,yBACA,kBACA,8BAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAM,EAAe,MAAM,EAAsB,EAAK,CAGhD,EAAO,EAAyB,EAAU,CAG5C,EAQJ,GAPA,AAGE,EAHE,MAAM,QAAQ,EAAa,EAAI,EAAU,EAAK,CAAC,aAAa,CACnD,EAAU,EAAK,CAAC,IAAK,GAAa,EAAK,EAAM,EAAS,CAAC,CAEvD,EAAK,MAAM,IAAI,CAIxB,EAAS,OAAS,EACpB,MAAU,MAAM,qBAAqB,CAIvC,IAAM,EAAkB,EAAS,IAAK,GAAa,CAE5C,EAAW,EAAS,CAQvB,EAAO,KAAK,EAAO,QAAQ,iBAAiB,EAAS,MAAM,CAAC,EAP5D,EAAO,MACL,EAAO,IACL,yCAAyC,EAAS,sEACnD,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAKtB,GAAI,CAEF,IAAM,EAAc,EAAkB,EAAU,EAAK,CAErD,OADA,EAAO,KAAK,EAAO,MAAM,yBAAyB,EAAS,GAAG,CAAC,CACxD,CACL,QAAS,EACT,KAAM,EAAS,MAAM,IAAI,CAAC,KAAK,CAAE,QAAQ,OAAQ,GAAG,CACrD,OACM,EAAK,CACZ,EAAO,MACL,EAAO,IACL,qEAAqE,EAAI,UAC1E,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,GAEtB,CAGF,GAAI,OAAO,GAAiB,SAAU,CAEpC,GAAM,CAAC,EAAM,GAAG,GAAQ,EAAgB,KAAK,CAAE,aAAc,EAAQ,CAehE,MAXiB,EAAkB,CACtC,eACA,KAAM,EACN,SANe,EAAqB,EAAM,GAAG,EAMrC,CACR,yBACA,6BACA,WACA,gBAAiB,CAAC,CAAC,EACpB,CAAC,GAIA,EAAO,KACL,EAAO,IACL,iFAAiF,IAClF,CACF,CAED,KAAK,QAAQ,KAAK,EAAE,MAEjB,CAEL,GAAI,EAAgB,SAAW,GAAK,EAAgB,SAAW,EAAa,OAC1E,MAAU,MACR,sEACS,EAAgB,OAAO,WAC5B,EAAgB,SAAW,EAAI,GAAK,IACrC,OAAO,EAAa,OAAO,UAAU,EAAa,SAAW,EAAI,GAAK,MAC1E,CAGH,IAAM,EAA8B,EAAE,CACtC,MAAM,EAAU,EAAc,MAAO,EAAQ,IAAQ,CACnD,IAAM,EAAS,IAAI,EAAM,EAAE,GAAG,EAAa,OAAO,IAAI,EAAO,iBAAiB,IAC9E,EAAO,KAAK,EAAO,QAAQ,UAAU,EAAO,4CAA4C,CAAC,CAGzF,IAAM,EACJ,EAAgB,SAAW,EACvB,EAAgB,GAAG,QACnB,EAAgB,KAAM,GAAU,EAAM,OAAS,EAAO,iBAAiB,EAAE,QAG/E,GAAI,CAAC,EAAa,CAChB,EAAO,MACL,EAAO,IACL,GAAG,EAAO,uDAAuD,EAAO,iBAAiB,IAC1F,CACF,CACD,EAAkB,KAAK,EAAO,iBAAiB,CAC/C,OAaE,MAVkB,EAAkB,CACtC,eACA,KAAM,EAAO,OACb,SAAU,EACV,WACA,yBACA,6BACA,kBACD,CAAC,CAGA,EAAO,KAAK,EAAO,MAAM,GAAG,EAAO,oCAAoC,CAAC,EAExE,EAAO,MAAM,EAAO,IAAI,GAAG,EAAO,+BAA+B,CAAC,CAClE,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,EAKxB,EAAO,KACL,EAAO,MAAM,uDAAuD,IAA0B,CAC/F"}
1
+ {"version":3,"file":"impl-eMdIf8vD.mjs","names":[],"sources":["../src/commands/inventory/push/impl.ts"],"sourcesContent":["import { existsSync, lstatSync } from 'node:fs';\nimport { join } from 'node:path';\n\nimport { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport { mapSeries } from '@transcend-io/utils';\nimport colors from 'colors';\n\nimport { TranscendInput } from '../../../codecs.js';\nimport { ADMIN_DASH_INTEGRATIONS } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { validateTranscendAuth, listFiles } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { syncConfigurationToTranscend } from '../../../lib/graphql/index.js';\nimport { parseVariablesFromString } from '../../../lib/helpers/parseVariablesFromString.js';\nimport { mergeTranscendInputs } from '../../../lib/mergeTranscendInputs.js';\nimport { readTranscendYaml } from '../../../lib/readTranscendYaml.js';\nimport { logger } from '../../../logger.js';\n\n/**\n * Sync configuration to Transcend\n *\n * @param options - Options\n * @returns True if synced successfully, false if error occurs\n */\nasync function syncConfiguration({\n transcendUrl,\n auth,\n pageSize,\n publishToPrivacyCenter,\n contents,\n deleteExtraAttributeValues = false,\n classifyService = false,\n}: {\n /** Transcend YAML */\n contents: TranscendInput;\n /** Transcend URL */\n transcendUrl: string;\n /** API key */\n auth: string;\n /** Page size */\n pageSize: number;\n /** Skip privacy center publish step */\n publishToPrivacyCenter: boolean;\n /** classify data flow service if missing */\n classifyService?: boolean;\n /** Delete attributes when syncing */\n deleteExtraAttributeValues?: boolean;\n}): Promise<boolean> {\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Sync to Transcend\n try {\n const encounteredError = await syncConfigurationToTranscend(contents, client, {\n pageSize,\n publishToPrivacyCenter,\n classifyService,\n deleteExtraAttributeValues,\n });\n return !encounteredError;\n } catch (err) {\n logger.error(colors.red(`An unexpected error occurred syncing the schema: ${err.message}`));\n return false;\n }\n}\n\nexport interface PushCommandFlags {\n auth: string;\n file: string;\n transcendUrl: string;\n pageSize: number;\n variables: string;\n publishToPrivacyCenter: boolean;\n classifyService: boolean;\n deleteExtraAttributeValues: boolean;\n}\n\nexport async function push(\n this: LocalContext,\n {\n file = './transcend.yml',\n transcendUrl,\n auth,\n variables,\n pageSize,\n publishToPrivacyCenter,\n classifyService,\n deleteExtraAttributeValues,\n }: PushCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n // Parse authentication as API key or path to list of API keys\n const apiKeyOrList = await validateTranscendAuth(auth);\n\n // Parse out the variables\n const vars = parseVariablesFromString(variables);\n\n // check if we are being passed a list of API keys and a list of files\n let fileList: string[];\n if (Array.isArray(apiKeyOrList) && lstatSync(file).isDirectory()) {\n fileList = listFiles(file).map((filePath) => join(file, filePath));\n } else {\n fileList = file.split(',');\n }\n\n // Ensure at least one file is parsed\n if (fileList.length < 1) {\n throw new Error('No file specified!');\n }\n\n // eslint-disable-next-line array-callback-return,consistent-return\n const transcendInputs = fileList.map((filePath) => {\n // Ensure yaml file exists on disk\n if (!existsSync(filePath)) {\n logger.error(\n colors.red(\n `The file path does not exist on disk: ${filePath}. You can specify the filepath using --file=./examples/transcend.yml`,\n ),\n );\n this.process.exit(1);\n } else {\n logger.info(colors.magenta(`Reading file \"${filePath}\"...`));\n }\n\n try {\n // Read in the yaml file and validate it's shape\n const newContents = readTranscendYaml(filePath, vars);\n logger.info(colors.green(`Successfully read in \"${filePath}\"`));\n return {\n content: newContents,\n name: filePath.split('/').pop()!.replace('.yml', ''),\n };\n } catch (err) {\n logger.error(\n colors.red(\n `The shape of your yaml file is invalid with the following errors: ${err.message}`,\n ),\n );\n this.process.exit(1);\n }\n });\n\n // process a single API key\n if (typeof apiKeyOrList === 'string') {\n // if passed multiple inputs, merge them together\n const [base, ...rest] = transcendInputs.map(({ content }) => content);\n const contents = mergeTranscendInputs(base, ...rest);\n\n // sync the configuration\n const success = await syncConfiguration({\n transcendUrl,\n auth: apiKeyOrList,\n contents,\n publishToPrivacyCenter,\n deleteExtraAttributeValues,\n pageSize,\n classifyService: !!classifyService,\n });\n\n // exist with error code\n if (!success) {\n logger.info(\n colors.red(\n `Sync encountered errors. View output above for more information, or check out ${ADMIN_DASH_INTEGRATIONS}`,\n ),\n );\n\n this.process.exit(1);\n }\n } else {\n // if passed multiple inputs, expect them to be one per instance\n if (transcendInputs.length !== 1 && transcendInputs.length !== apiKeyOrList.length) {\n throw new Error(\n 'Expected list of yml files to be equal to the list of API keys.' +\n `Got ${transcendInputs.length} YML file${\n transcendInputs.length === 1 ? '' : 's'\n } and ${apiKeyOrList.length} API key${apiKeyOrList.length === 1 ? '' : 's'}`,\n );\n }\n\n const encounteredErrors: string[] = [];\n await mapSeries(apiKeyOrList, async (apiKey, ind) => {\n const prefix = `[${ind + 1}/${apiKeyOrList.length}][${apiKey.organizationName}] `;\n logger.info(colors.magenta(`~~~\\n\\n${prefix}Attempting to push configuration...\\n\\n~~~`));\n\n // use the merged contents if 1 yml passed, else use the contents that map to that organization\n const useContents =\n transcendInputs.length === 1\n ? transcendInputs[0].content\n : transcendInputs.find((input) => input.name === apiKey.organizationName)?.content;\n\n // Throw error if cannot find a yml file matching that organization name\n if (!useContents) {\n logger.error(\n colors.red(\n `${prefix}Failed to find transcend.yml file for organization: \"${apiKey.organizationName}\".`,\n ),\n );\n encounteredErrors.push(apiKey.organizationName);\n return;\n }\n\n const success = await syncConfiguration({\n transcendUrl,\n auth: apiKey.apiKey,\n contents: useContents,\n pageSize,\n publishToPrivacyCenter,\n deleteExtraAttributeValues,\n classifyService,\n });\n\n if (success) {\n logger.info(colors.green(`${prefix}Successfully pushed configuration!`));\n } else {\n logger.error(colors.red(`${prefix}Failed to sync configuration.`));\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 // Indicate success\n logger.info(\n colors.green(`Successfully synced yaml file to Transcend! View at ${ADMIN_DASH_INTEGRATIONS}`),\n );\n}\n"],"mappings":"2kBAwBA,eAAe,EAAkB,CAC/B,eACA,OACA,WACA,yBACA,WACA,6BAA6B,GAC7B,kBAAkB,IAgBC,CACnB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAG9D,GAAI,CAOF,MAAO,CAAC,MANuB,EAA6B,EAAU,EAAQ,CAC5E,WACA,yBACA,kBACA,6BACD,CAAC,OAEK,EAAK,CAEZ,OADA,EAAO,MAAM,EAAO,IAAI,oDAAoD,EAAI,UAAU,CAAC,CACpF,IAeX,eAAsB,EAEpB,CACE,OAAO,kBACP,eACA,OACA,YACA,WACA,yBACA,kBACA,8BAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAGtC,IAAM,EAAe,MAAM,EAAsB,EAAK,CAGhD,EAAO,EAAyB,EAAU,CAG5C,EAQJ,GAPA,AAGE,EAHE,MAAM,QAAQ,EAAa,EAAI,EAAU,EAAK,CAAC,aAAa,CACnD,EAAU,EAAK,CAAC,IAAK,GAAa,EAAK,EAAM,EAAS,CAAC,CAEvD,EAAK,MAAM,IAAI,CAIxB,EAAS,OAAS,EACpB,MAAU,MAAM,qBAAqB,CAIvC,IAAM,EAAkB,EAAS,IAAK,GAAa,CAE5C,EAAW,EAAS,CAQvB,EAAO,KAAK,EAAO,QAAQ,iBAAiB,EAAS,MAAM,CAAC,EAP5D,EAAO,MACL,EAAO,IACL,yCAAyC,EAAS,sEACnD,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,EAKtB,GAAI,CAEF,IAAM,EAAc,EAAkB,EAAU,EAAK,CAErD,OADA,EAAO,KAAK,EAAO,MAAM,yBAAyB,EAAS,GAAG,CAAC,CACxD,CACL,QAAS,EACT,KAAM,EAAS,MAAM,IAAI,CAAC,KAAK,CAAE,QAAQ,OAAQ,GAAG,CACrD,OACM,EAAK,CACZ,EAAO,MACL,EAAO,IACL,qEAAqE,EAAI,UAC1E,CACF,CACD,KAAK,QAAQ,KAAK,EAAE,GAEtB,CAGF,GAAI,OAAO,GAAiB,SAAU,CAEpC,GAAM,CAAC,EAAM,GAAG,GAAQ,EAAgB,KAAK,CAAE,aAAc,EAAQ,CAehE,MAXiB,EAAkB,CACtC,eACA,KAAM,EACN,SANe,EAAqB,EAAM,GAAG,EAMrC,CACR,yBACA,6BACA,WACA,gBAAiB,CAAC,CAAC,EACpB,CAAC,GAIA,EAAO,KACL,EAAO,IACL,iFAAiF,IAClF,CACF,CAED,KAAK,QAAQ,KAAK,EAAE,MAEjB,CAEL,GAAI,EAAgB,SAAW,GAAK,EAAgB,SAAW,EAAa,OAC1E,MAAU,MACR,sEACS,EAAgB,OAAO,WAC5B,EAAgB,SAAW,EAAI,GAAK,IACrC,OAAO,EAAa,OAAO,UAAU,EAAa,SAAW,EAAI,GAAK,MAC1E,CAGH,IAAM,EAA8B,EAAE,CACtC,MAAM,EAAU,EAAc,MAAO,EAAQ,IAAQ,CACnD,IAAM,EAAS,IAAI,EAAM,EAAE,GAAG,EAAa,OAAO,IAAI,EAAO,iBAAiB,IAC9E,EAAO,KAAK,EAAO,QAAQ,UAAU,EAAO,4CAA4C,CAAC,CAGzF,IAAM,EACJ,EAAgB,SAAW,EACvB,EAAgB,GAAG,QACnB,EAAgB,KAAM,GAAU,EAAM,OAAS,EAAO,iBAAiB,EAAE,QAG/E,GAAI,CAAC,EAAa,CAChB,EAAO,MACL,EAAO,IACL,GAAG,EAAO,uDAAuD,EAAO,iBAAiB,IAC1F,CACF,CACD,EAAkB,KAAK,EAAO,iBAAiB,CAC/C,OAaE,MAVkB,EAAkB,CACtC,eACA,KAAM,EAAO,OACb,SAAU,EACV,WACA,yBACA,6BACA,kBACD,CAAC,CAGA,EAAO,KAAK,EAAO,MAAM,GAAG,EAAO,oCAAoC,CAAC,EAExE,EAAO,MAAM,EAAO,IAAI,GAAG,EAAO,+BAA+B,CAAC,CAClE,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,EAKxB,EAAO,KACL,EAAO,MAAM,uDAAuD,IAA0B,CAC/F"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./logger-Bj782ZYD.mjs";import{t}from"./readCsv-C4TyEs-r.mjs";import{t as n}from"./markRequestDataSiloIdsCompleted-RLx-NGQX.mjs";import{t as r}from"./done-input-validation-BcNBxhEs.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-CwdaxTeM.mjs.map
1
+ import{t as e}from"./logger-Bj782ZYD.mjs";import{t}from"./readCsv-C4TyEs-r.mjs";import{t as n}from"./markRequestDataSiloIdsCompleted-BS5PL4pL.mjs";import{t as r}from"./done-input-validation-BcNBxhEs.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-euN2T30y.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-CwdaxTeM.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-euN2T30y.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{c as e}from"./constants-CVdC1nK_.mjs";import{t}from"./generateCrossAccountApiKeys-Ddw9d_2c.mjs";import{t as n}from"./done-input-validation-BcNBxhEs.mjs";import{writeFileSync as r}from"node:fs";async function i({email:i,password:a,apiKeyTitle:o,file:s,scopes:c,deleteExistingApiKey:l,createNewApiKey:u,parentOrganizationId:d,transcendUrl:f}){n(this.process.exit);let{errors:p,apiKeys:m}=await t({transcendUrl:f,password:a,email:i,parentOrganizationId:d,deleteExistingApiKey:l,createNewApiKey:u,apiKeyTitle:o,scopes:c.map(t=>e[t].name)});r(s,`${JSON.stringify(m,null,2)}\n`),p.length>0&&this.process.exit(1)}export{i as generateApiKeys};
2
- //# sourceMappingURL=impl-BU6LoI9j.mjs.map
1
+ import{c as e}from"./constants-CY1i6J69.mjs";import{t}from"./generateCrossAccountApiKeys-CW3qfNn0.mjs";import{t as n}from"./done-input-validation-BcNBxhEs.mjs";import{writeFileSync as r}from"node:fs";async function i({email:i,password:a,apiKeyTitle:o,file:s,scopes:c,deleteExistingApiKey:l,createNewApiKey:u,parentOrganizationId:d,transcendUrl:f}){n(this.process.exit);let{errors:p,apiKeys:m}=await t({transcendUrl:f,password:a,email:i,parentOrganizationId:d,deleteExistingApiKey:l,createNewApiKey:u,apiKeyTitle:o,scopes:c.map(t=>e[t].name)});r(s,`${JSON.stringify(m,null,2)}\n`),p.length>0&&this.process.exit(1)}export{i as generateApiKeys};
2
+ //# sourceMappingURL=impl-nH5uHVyq.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-BU6LoI9j.mjs","names":[],"sources":["../src/commands/admin/generate-api-keys/impl.ts"],"sourcesContent":["import { writeFileSync } from 'node:fs';\n\nimport { ScopeName } from '@transcend-io/privacy-types';\n\nimport { SCOPES_BY_TITLE } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { generateCrossAccountApiKeys } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\n\n// Command flag interface\nexport interface GenerateApiKeysCommandFlags {\n email: string;\n password: string;\n apiKeyTitle: string;\n file: string;\n scopes: string[];\n deleteExistingApiKey: boolean;\n createNewApiKey: boolean;\n parentOrganizationId?: string;\n transcendUrl: string;\n}\n\n// Command implementation\nexport async function generateApiKeys(\n this: LocalContext,\n {\n email,\n password,\n apiKeyTitle,\n file,\n scopes,\n deleteExistingApiKey,\n createNewApiKey,\n parentOrganizationId,\n transcendUrl,\n }: GenerateApiKeysCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const scopeNames = scopes.map((scopeTitle) => SCOPES_BY_TITLE[scopeTitle].name as ScopeName);\n\n // Upload privacy requests\n const { errors, apiKeys } = await generateCrossAccountApiKeys({\n transcendUrl,\n password,\n email,\n parentOrganizationId,\n deleteExistingApiKey,\n createNewApiKey,\n apiKeyTitle,\n scopes: scopeNames,\n });\n\n // Write to disk\n writeFileSync(file, `${JSON.stringify(apiKeys, null, 2)}\\n`);\n if (errors.length > 0) {\n this.process.exit(1);\n }\n}\n"],"mappings":"wMAuBA,eAAsB,EAEpB,CACE,QACA,WACA,cACA,OACA,SACA,uBACA,kBACA,uBACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAKtC,GAAM,CAAE,SAAQ,WAAY,MAAM,EAA4B,CAC5D,eACA,WACA,QACA,uBACA,uBACA,kBACA,cACA,OAXiB,EAAO,IAAK,GAAe,EAAgB,GAAY,KAWtD,CACnB,CAAC,CAGF,EAAc,EAAM,GAAG,KAAK,UAAU,EAAS,KAAM,EAAE,CAAC,IAAI,CACxD,EAAO,OAAS,GAClB,KAAK,QAAQ,KAAK,EAAE"}
1
+ {"version":3,"file":"impl-nH5uHVyq.mjs","names":[],"sources":["../src/commands/admin/generate-api-keys/impl.ts"],"sourcesContent":["import { writeFileSync } from 'node:fs';\n\nimport { ScopeName } from '@transcend-io/privacy-types';\n\nimport { SCOPES_BY_TITLE } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { generateCrossAccountApiKeys } from '../../../lib/api-keys/index.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\n\n// Command flag interface\nexport interface GenerateApiKeysCommandFlags {\n email: string;\n password: string;\n apiKeyTitle: string;\n file: string;\n scopes: string[];\n deleteExistingApiKey: boolean;\n createNewApiKey: boolean;\n parentOrganizationId?: string;\n transcendUrl: string;\n}\n\n// Command implementation\nexport async function generateApiKeys(\n this: LocalContext,\n {\n email,\n password,\n apiKeyTitle,\n file,\n scopes,\n deleteExistingApiKey,\n createNewApiKey,\n parentOrganizationId,\n transcendUrl,\n }: GenerateApiKeysCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process.exit);\n\n const scopeNames = scopes.map((scopeTitle) => SCOPES_BY_TITLE[scopeTitle].name as ScopeName);\n\n // Upload privacy requests\n const { errors, apiKeys } = await generateCrossAccountApiKeys({\n transcendUrl,\n password,\n email,\n parentOrganizationId,\n deleteExistingApiKey,\n createNewApiKey,\n apiKeyTitle,\n scopes: scopeNames,\n });\n\n // Write to disk\n writeFileSync(file, `${JSON.stringify(apiKeys, null, 2)}\\n`);\n if (errors.length > 0) {\n this.process.exit(1);\n }\n}\n"],"mappings":"wMAuBA,eAAsB,EAEpB,CACE,QACA,WACA,cACA,OACA,SACA,uBACA,kBACA,uBACA,gBAEa,CACf,EAAoB,KAAK,QAAQ,KAAK,CAKtC,GAAM,CAAE,SAAQ,WAAY,MAAM,EAA4B,CAC5D,eACA,WACA,QACA,uBACA,uBACA,kBACA,cACA,OAXiB,EAAO,IAAK,GAAe,EAAgB,GAAY,KAWtD,CACnB,CAAC,CAGF,EAAc,EAAM,GAAG,KAAK,UAAU,EAAS,KAAM,EAAE,CAAC,IAAI,CACxD,EAAO,OAAS,GAClB,KAAK,QAAQ,KAAK,EAAE"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./logger-Bj782ZYD.mjs";import{t}from"./pullChunkedCustomSiloOutstandingIdentifiers-CeyJB-lD.mjs";import{i as n,s as r}from"./writeCsv-C4pjXGsD.mjs";import{t as i}from"./done-input-validation-BcNBxhEs.mjs";import{chunk as a,uniq as o}from"lodash-es";import s from"colors";import{buildTranscendGraphQLClient as c,fetchRequestFilesForRequest as l}from"@transcend-io/sdk";import{map as u}from"@transcend-io/utils";async function d({file:d,fileTarget:f,transcendUrl:p,auth:m,sombraAuth:h,cronDataSiloId:g,targetDataSiloId:_,actions:v,skipRequestCount:y,pageLimit:b,chunkSize:x}){y&&e.info(s.yellow(`Skipping request count as requested. This may help speed up the call.`)),(Number.isNaN(x)||x<=0||x%b!==0)&&(e.error(s.red(`Invalid chunk size: "${x}". Must be a positive integer that is a multiple of ${b}.`)),this.process.exit(1)),i(this.process.exit);let S=c(p,m),{baseName:C,extension:w}=n(d),{baseName:T,extension:E}=n(f),D=0,O=0,k=0;await t({dataSiloId:g,auth:m,sombraAuth:h,actions:v,apiPageSize:b,savePageSize:x,onSave:async t=>{D+=t.length;let n=await u(a(o(t.map(e=>e.requestId)),b),async t=>(e.info(s.magenta(`Fetching target identifiers for ${t.length} requests`)),(await l(S,{logger:e,pageSize:b*2,filterBy:{requestIds:t,dataSiloIds:[_]}})).map(({fileName:e,remoteId:t})=>{if(!t)throw Error(`Failed to find remoteId for ${e}`);return{RecordId:t,Object:e.replace(`.json`,``).split(`/`).pop()?.replace(` Information`,``),Comment:`Customer data deletion request submitted via transcend.io`}})),{concurrency:1});O+=n.flat().length;let i=o(t.map(e=>Object.keys(e)).flat()),c=`${C}-${k}${w}`,p=`${T}-${k}${E}`;await r(c,t,i),e.info(s.green(`Successfully wrote ${t.length} identifiers to file "${d}"`));let m=n.flat();await r(p,m,o(m.map(e=>Object.keys(e)).flat())),e.info(s.green(`Successfully wrote ${m.length} identifiers to file "${f}"`)),e.info(s.blue(`Processed chunk of ${a.length} identifiers, found ${m.length} target identifiers`)),k+=1},transcendUrl:p,skipRequestCount:y}),e.info(s.green(`Successfully wrote ${D} identifiers to file "${d}"`)),e.info(s.green(`Successfully wrote ${O} identifiers to file "${f}"`))}export{d as pullProfiles};
2
- //# sourceMappingURL=impl-rF0vq9Nk.mjs.map
1
+ import{t as e}from"./logger-Bj782ZYD.mjs";import{t}from"./pullChunkedCustomSiloOutstandingIdentifiers-BSDvt77x.mjs";import{i as n,s as r}from"./writeCsv-C4pjXGsD.mjs";import{t as i}from"./done-input-validation-BcNBxhEs.mjs";import{chunk as a,uniq as o}from"lodash-es";import s from"colors";import{buildTranscendGraphQLClient as c,fetchRequestFilesForRequest as l}from"@transcend-io/sdk";import{map as u}from"@transcend-io/utils";async function d({file:d,fileTarget:f,transcendUrl:p,auth:m,sombraAuth:h,cronDataSiloId:g,targetDataSiloId:_,actions:v,skipRequestCount:y,pageLimit:b,chunkSize:x}){y&&e.info(s.yellow(`Skipping request count as requested. This may help speed up the call.`)),(Number.isNaN(x)||x<=0||x%b!==0)&&(e.error(s.red(`Invalid chunk size: "${x}". Must be a positive integer that is a multiple of ${b}.`)),this.process.exit(1)),i(this.process.exit);let S=c(p,m),{baseName:C,extension:w}=n(d),{baseName:T,extension:E}=n(f),D=0,O=0,k=0;await t({dataSiloId:g,auth:m,sombraAuth:h,actions:v,apiPageSize:b,savePageSize:x,onSave:async t=>{D+=t.length;let n=await u(a(o(t.map(e=>e.requestId)),b),async t=>(e.info(s.magenta(`Fetching target identifiers for ${t.length} requests`)),(await l(S,{logger:e,pageSize:b*2,filterBy:{requestIds:t,dataSiloIds:[_]}})).map(({fileName:e,remoteId:t})=>{if(!t)throw Error(`Failed to find remoteId for ${e}`);return{RecordId:t,Object:e.replace(`.json`,``).split(`/`).pop()?.replace(` Information`,``),Comment:`Customer data deletion request submitted via transcend.io`}})),{concurrency:1});O+=n.flat().length;let i=o(t.map(e=>Object.keys(e)).flat()),c=`${C}-${k}${w}`,p=`${T}-${k}${E}`;await r(c,t,i),e.info(s.green(`Successfully wrote ${t.length} identifiers to file "${d}"`));let m=n.flat();await r(p,m,o(m.map(e=>Object.keys(e)).flat())),e.info(s.green(`Successfully wrote ${m.length} identifiers to file "${f}"`)),e.info(s.blue(`Processed chunk of ${a.length} identifiers, found ${m.length} target identifiers`)),k+=1},transcendUrl:p,skipRequestCount:y}),e.info(s.green(`Successfully wrote ${D} identifiers to file "${d}"`)),e.info(s.green(`Successfully wrote ${O} identifiers to file "${f}"`))}export{d as pullProfiles};
2
+ //# sourceMappingURL=impl-tlrH4BTy.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-rF0vq9Nk.mjs","names":[],"sources":["../src/commands/request/cron/pull-profiles/impl.ts"],"sourcesContent":["import type { RequestAction } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient, fetchRequestFilesForRequest } from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport colors from 'colors';\nimport { uniq, chunk } from 'lodash-es';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport {\n pullChunkedCustomSiloOutstandingIdentifiers,\n type CsvFormattedIdentifier,\n} from '../../../../lib/cron/index.js';\nimport { parseFilePath, writeLargeCsv } from '../../../../lib/helpers/index.js';\nimport { logger } from '../../../../logger.js';\n\nexport interface PullProfilesCommandFlags {\n file: string;\n fileTarget: string;\n transcendUrl: string;\n auth: string;\n sombraAuth?: string;\n cronDataSiloId: string;\n targetDataSiloId: string;\n actions: RequestAction[];\n skipRequestCount: boolean;\n pageLimit: number;\n chunkSize: number;\n}\n\nexport async function pullProfiles(\n this: LocalContext,\n {\n file,\n fileTarget,\n transcendUrl,\n auth,\n sombraAuth,\n cronDataSiloId,\n targetDataSiloId,\n actions,\n skipRequestCount,\n pageLimit,\n chunkSize,\n }: PullProfilesCommandFlags,\n): Promise<void> {\n if (skipRequestCount) {\n 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 // Create GraphQL client to connect to Transcend backend\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const { baseName, extension } = parseFilePath(file);\n const { baseName: baseNameTarget, extension: extensionTarget } = parseFilePath(fileTarget);\n\n let allIdentifiersCount = 0;\n let allTargetIdentifiersCount = 0;\n let fileCount = 0;\n // Create onSave callback to handle chunked processing\n const onSave = async (chunkToSave: CsvFormattedIdentifier[]): Promise<void> => {\n // Add to all identifiers\n allIdentifiersCount += chunkToSave.length;\n\n // Get unique request IDs from this chunk\n const requestIds = chunkToSave.map((d) => d.requestId as string);\n const uniqueRequestIds = uniq(requestIds);\n\n // Pull down target identifiers for this chunk\n const chunkedRequestIds = chunk(uniqueRequestIds, pageLimit);\n const results = await map(\n chunkedRequestIds,\n async (requestIds) => {\n logger.info(\n colors.magenta(`Fetching target identifiers for ${requestIds.length} requests`),\n );\n const results = await fetchRequestFilesForRequest(client, {\n logger,\n pageSize: pageLimit * 2,\n filterBy: {\n requestIds,\n dataSiloIds: [targetDataSiloId],\n },\n });\n return results.map(({ fileName, remoteId }) => {\n if (!remoteId) {\n throw new Error(`Failed to find remoteId for ${fileName}`);\n }\n return {\n RecordId: remoteId,\n Object: fileName.replace('.json', '').split('/').pop()?.replace(' Information', ''),\n Comment: 'Customer data deletion request submitted via transcend.io',\n };\n });\n },\n // We are grabbing all the request files for the 'pageLimit' # of requests at a time\n {\n concurrency: 1,\n },\n );\n\n allTargetIdentifiersCount += results.flat().length;\n\n // Write the identifiers and target identifiers to CSV\n const headers = uniq(chunkToSave.map((d) => Object.keys(d)).flat());\n const numberedFileName = `${baseName}-${fileCount}${extension}`;\n const numberedFileNameTarget = `${baseNameTarget}-${fileCount}${extensionTarget}`;\n await writeLargeCsv(numberedFileName, chunkToSave, headers);\n logger.info(\n colors.green(`Successfully wrote ${chunkToSave.length} identifiers to file \"${file}\"`),\n );\n\n const targetIdentifiers = results.flat();\n const headers2 = uniq(targetIdentifiers.map((d) => Object.keys(d)).flat());\n await writeLargeCsv(numberedFileNameTarget, targetIdentifiers, headers2);\n logger.info(\n colors.green(\n `Successfully wrote ${targetIdentifiers.length} identifiers to file \"${fileTarget}\"`,\n ),\n );\n\n logger.info(\n colors.blue(\n `Processed chunk of ${chunk.length} identifiers, found ${targetIdentifiers.length} target identifiers`,\n ),\n );\n fileCount += 1;\n };\n\n // Pull down outstanding identifiers using the new chunked function\n await pullChunkedCustomSiloOutstandingIdentifiers({\n dataSiloId: cronDataSiloId,\n auth,\n sombraAuth,\n actions,\n apiPageSize: pageLimit,\n savePageSize: chunkSize,\n onSave,\n transcendUrl,\n skipRequestCount,\n });\n\n logger.info(\n colors.green(`Successfully wrote ${allIdentifiersCount} identifiers to file \"${file}\"`),\n );\n logger.info(\n colors.green(\n `Successfully wrote ${allTargetIdentifiersCount} identifiers to file \"${fileTarget}\"`,\n ),\n );\n}\n"],"mappings":"6aA6BA,eAAsB,EAEpB,CACE,OACA,aACA,eACA,OACA,aACA,iBACA,mBACA,UACA,mBACA,YACA,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,CAGtC,IAAM,EAAS,EAA4B,EAAc,EAAK,CACxD,CAAE,WAAU,aAAc,EAAc,EAAK,CAC7C,CAAE,SAAU,EAAgB,UAAW,GAAoB,EAAc,EAAW,CAEtF,EAAsB,EACtB,EAA4B,EAC5B,EAAY,EAwEhB,MAAM,EAA4C,CAChD,WAAY,EACZ,OACA,aACA,UACA,YAAa,EACb,aAAc,EACd,YA7EoB,IAAyD,CAE7E,GAAuB,EAAY,OAQnC,IAAM,EAAU,MAAM,EADI,EAHD,EADN,EAAY,IAAK,GAAM,EAAE,UACJ,CAGQ,CAAE,EAE/B,CACjB,KAAO,KACL,EAAO,KACL,EAAO,QAAQ,mCAAmC,EAAW,OAAO,WAAW,CAChF,EASM,MARe,EAA4B,EAAQ,CACxD,SACA,SAAU,EAAY,EACtB,SAAU,CACR,aACA,YAAa,CAAC,EAAiB,CAChC,CACF,CAAC,EACa,KAAK,CAAE,WAAU,cAAe,CAC7C,GAAI,CAAC,EACH,MAAU,MAAM,+BAA+B,IAAW,CAE5D,MAAO,CACL,SAAU,EACV,OAAQ,EAAS,QAAQ,QAAS,GAAG,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,QAAQ,eAAgB,GAAG,CACnF,QAAS,4DACV,EACD,EAGJ,CACE,YAAa,EACd,CACF,CAED,GAA6B,EAAQ,MAAM,CAAC,OAG5C,IAAM,EAAU,EAAK,EAAY,IAAK,GAAM,OAAO,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAC7D,EAAmB,GAAG,EAAS,GAAG,IAAY,IAC9C,EAAyB,GAAG,EAAe,GAAG,IAAY,IAChE,MAAM,EAAc,EAAkB,EAAa,EAAQ,CAC3D,EAAO,KACL,EAAO,MAAM,sBAAsB,EAAY,OAAO,wBAAwB,EAAK,GAAG,CACvF,CAED,IAAM,EAAoB,EAAQ,MAAM,CAExC,MAAM,EAAc,EAAwB,EAD3B,EAAK,EAAkB,IAAK,GAAM,OAAO,KAAK,EAAE,CAAC,CAAC,MAAM,CACF,CAAC,CACxE,EAAO,KACL,EAAO,MACL,sBAAsB,EAAkB,OAAO,wBAAwB,EAAW,GACnF,CACF,CAED,EAAO,KACL,EAAO,KACL,sBAAsB,EAAM,OAAO,sBAAsB,EAAkB,OAAO,qBACnF,CACF,CACD,GAAa,GAYb,eACA,mBACD,CAAC,CAEF,EAAO,KACL,EAAO,MAAM,sBAAsB,EAAoB,wBAAwB,EAAK,GAAG,CACxF,CACD,EAAO,KACL,EAAO,MACL,sBAAsB,EAA0B,wBAAwB,EAAW,GACpF,CACF"}
1
+ {"version":3,"file":"impl-tlrH4BTy.mjs","names":[],"sources":["../src/commands/request/cron/pull-profiles/impl.ts"],"sourcesContent":["import type { RequestAction } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient, fetchRequestFilesForRequest } from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport colors from 'colors';\nimport { uniq, chunk } from 'lodash-es';\n\nimport type { LocalContext } from '../../../../context.js';\nimport { doneInputValidation } from '../../../../lib/cli/done-input-validation.js';\nimport {\n pullChunkedCustomSiloOutstandingIdentifiers,\n type CsvFormattedIdentifier,\n} from '../../../../lib/cron/index.js';\nimport { parseFilePath, writeLargeCsv } from '../../../../lib/helpers/index.js';\nimport { logger } from '../../../../logger.js';\n\nexport interface PullProfilesCommandFlags {\n file: string;\n fileTarget: string;\n transcendUrl: string;\n auth: string;\n sombraAuth?: string;\n cronDataSiloId: string;\n targetDataSiloId: string;\n actions: RequestAction[];\n skipRequestCount: boolean;\n pageLimit: number;\n chunkSize: number;\n}\n\nexport async function pullProfiles(\n this: LocalContext,\n {\n file,\n fileTarget,\n transcendUrl,\n auth,\n sombraAuth,\n cronDataSiloId,\n targetDataSiloId,\n actions,\n skipRequestCount,\n pageLimit,\n chunkSize,\n }: PullProfilesCommandFlags,\n): Promise<void> {\n if (skipRequestCount) {\n 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 // Create GraphQL client to connect to Transcend backend\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n const { baseName, extension } = parseFilePath(file);\n const { baseName: baseNameTarget, extension: extensionTarget } = parseFilePath(fileTarget);\n\n let allIdentifiersCount = 0;\n let allTargetIdentifiersCount = 0;\n let fileCount = 0;\n // Create onSave callback to handle chunked processing\n const onSave = async (chunkToSave: CsvFormattedIdentifier[]): Promise<void> => {\n // Add to all identifiers\n allIdentifiersCount += chunkToSave.length;\n\n // Get unique request IDs from this chunk\n const requestIds = chunkToSave.map((d) => d.requestId as string);\n const uniqueRequestIds = uniq(requestIds);\n\n // Pull down target identifiers for this chunk\n const chunkedRequestIds = chunk(uniqueRequestIds, pageLimit);\n const results = await map(\n chunkedRequestIds,\n async (requestIds) => {\n logger.info(\n colors.magenta(`Fetching target identifiers for ${requestIds.length} requests`),\n );\n const results = await fetchRequestFilesForRequest(client, {\n logger,\n pageSize: pageLimit * 2,\n filterBy: {\n requestIds,\n dataSiloIds: [targetDataSiloId],\n },\n });\n return results.map(({ fileName, remoteId }) => {\n if (!remoteId) {\n throw new Error(`Failed to find remoteId for ${fileName}`);\n }\n return {\n RecordId: remoteId,\n Object: fileName.replace('.json', '').split('/').pop()?.replace(' Information', ''),\n Comment: 'Customer data deletion request submitted via transcend.io',\n };\n });\n },\n // We are grabbing all the request files for the 'pageLimit' # of requests at a time\n {\n concurrency: 1,\n },\n );\n\n allTargetIdentifiersCount += results.flat().length;\n\n // Write the identifiers and target identifiers to CSV\n const headers = uniq(chunkToSave.map((d) => Object.keys(d)).flat());\n const numberedFileName = `${baseName}-${fileCount}${extension}`;\n const numberedFileNameTarget = `${baseNameTarget}-${fileCount}${extensionTarget}`;\n await writeLargeCsv(numberedFileName, chunkToSave, headers);\n logger.info(\n colors.green(`Successfully wrote ${chunkToSave.length} identifiers to file \"${file}\"`),\n );\n\n const targetIdentifiers = results.flat();\n const headers2 = uniq(targetIdentifiers.map((d) => Object.keys(d)).flat());\n await writeLargeCsv(numberedFileNameTarget, targetIdentifiers, headers2);\n logger.info(\n colors.green(\n `Successfully wrote ${targetIdentifiers.length} identifiers to file \"${fileTarget}\"`,\n ),\n );\n\n logger.info(\n colors.blue(\n `Processed chunk of ${chunk.length} identifiers, found ${targetIdentifiers.length} target identifiers`,\n ),\n );\n fileCount += 1;\n };\n\n // Pull down outstanding identifiers using the new chunked function\n await pullChunkedCustomSiloOutstandingIdentifiers({\n dataSiloId: cronDataSiloId,\n auth,\n sombraAuth,\n actions,\n apiPageSize: pageLimit,\n savePageSize: chunkSize,\n onSave,\n transcendUrl,\n skipRequestCount,\n });\n\n logger.info(\n colors.green(`Successfully wrote ${allIdentifiersCount} identifiers to file \"${file}\"`),\n );\n logger.info(\n colors.green(\n `Successfully wrote ${allTargetIdentifiersCount} identifiers to file \"${fileTarget}\"`,\n ),\n );\n}\n"],"mappings":"6aA6BA,eAAsB,EAEpB,CACE,OACA,aACA,eACA,OACA,aACA,iBACA,mBACA,UACA,mBACA,YACA,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,CAGtC,IAAM,EAAS,EAA4B,EAAc,EAAK,CACxD,CAAE,WAAU,aAAc,EAAc,EAAK,CAC7C,CAAE,SAAU,EAAgB,UAAW,GAAoB,EAAc,EAAW,CAEtF,EAAsB,EACtB,EAA4B,EAC5B,EAAY,EAwEhB,MAAM,EAA4C,CAChD,WAAY,EACZ,OACA,aACA,UACA,YAAa,EACb,aAAc,EACd,YA7EoB,IAAyD,CAE7E,GAAuB,EAAY,OAQnC,IAAM,EAAU,MAAM,EADI,EAHD,EADN,EAAY,IAAK,GAAM,EAAE,UACJ,CAGQ,CAAE,EAE/B,CACjB,KAAO,KACL,EAAO,KACL,EAAO,QAAQ,mCAAmC,EAAW,OAAO,WAAW,CAChF,EASM,MARe,EAA4B,EAAQ,CACxD,SACA,SAAU,EAAY,EACtB,SAAU,CACR,aACA,YAAa,CAAC,EAAiB,CAChC,CACF,CAAC,EACa,KAAK,CAAE,WAAU,cAAe,CAC7C,GAAI,CAAC,EACH,MAAU,MAAM,+BAA+B,IAAW,CAE5D,MAAO,CACL,SAAU,EACV,OAAQ,EAAS,QAAQ,QAAS,GAAG,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,QAAQ,eAAgB,GAAG,CACnF,QAAS,4DACV,EACD,EAGJ,CACE,YAAa,EACd,CACF,CAED,GAA6B,EAAQ,MAAM,CAAC,OAG5C,IAAM,EAAU,EAAK,EAAY,IAAK,GAAM,OAAO,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAC7D,EAAmB,GAAG,EAAS,GAAG,IAAY,IAC9C,EAAyB,GAAG,EAAe,GAAG,IAAY,IAChE,MAAM,EAAc,EAAkB,EAAa,EAAQ,CAC3D,EAAO,KACL,EAAO,MAAM,sBAAsB,EAAY,OAAO,wBAAwB,EAAK,GAAG,CACvF,CAED,IAAM,EAAoB,EAAQ,MAAM,CAExC,MAAM,EAAc,EAAwB,EAD3B,EAAK,EAAkB,IAAK,GAAM,OAAO,KAAK,EAAE,CAAC,CAAC,MAAM,CACF,CAAC,CACxE,EAAO,KACL,EAAO,MACL,sBAAsB,EAAkB,OAAO,wBAAwB,EAAW,GACnF,CACF,CAED,EAAO,KACL,EAAO,KACL,sBAAsB,EAAM,OAAO,sBAAsB,EAAkB,OAAO,qBACnF,CACF,CACD,GAAa,GAYb,eACA,mBACD,CAAC,CAEF,EAAO,KACL,EAAO,MAAM,sBAAsB,EAAoB,wBAAwB,EAAK,GAAG,CACxF,CACD,EAAO,KACL,EAAO,MACL,sBAAsB,EAA0B,wBAAwB,EAAW,GACpF,CACF"}
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import{a as e,i as t,n,o as r,r as i,t as a}from"./enums-CyFTrzXY.mjs";import{a as o,c as s,d as c,f as l,h as u,i as d,l as f,m as p,n as m,o as h,p as g,r as _,s as v,t as y,u as b}from"./constants-CVdC1nK_.mjs";import{t as x}from"./logger-Bj782ZYD.mjs";import{$ as S,A as ee,B as te,C as ne,D as re,E as ie,F as ae,G as oe,H as se,I as ce,J as le,K as ue,L as de,M as fe,N as pe,O as me,P as he,Q as ge,R as _e,S as ve,T as ye,U as be,V as xe,W as C,X as w,Y as T,Z as E,_ as D,_t as O,a as k,at as A,b as j,bt as M,c as Se,ct as Ce,d as we,dt as Te,et as Ee,f as De,ft as Oe,g as ke,gt as Ae,h as je,ht as Me,i as Ne,it as Pe,j as Fe,k as Ie,l as Le,lt as Re,m as ze,mt as Be,n as Ve,nt as He,o as Ue,ot as We,p as Ge,pt as Ke,q as qe,r as Je,rt as Ye,s as Xe,st as Ze,t as Qe,tt as $e,u as et,ut as tt,v as nt,vt as rt,w as it,x as at,xt as ot,y as st,yt as ct,z as lt}from"./codecs-Dnq-rEcB.mjs";import{a as ut,i as dt,n as ft,r as pt,t as mt}from"./readTranscendYaml-CGb2UUyM.mjs";import{a as ht,i as gt,n as _t,r as vt,t as yt}from"./parseVariablesFromString-BeKOGw5n.mjs";import{a as bt,c as xt,i as St,l as Ct,n as wt,o as Tt,r as Et,s as Dt,t as Ot,u as kt}from"./constants-CLxPXlJM.mjs";import{i as At,n as jt,r as Mt,t as Nt}from"./parseAttributesFromString-q4-59nEN.mjs";import{a as Pt,c as Ft,d as It,f as Lt,i as Rt,l as zt,n as Bt,o as Vt,r as Ht,s as Ut,t as Wt,u as Gt}from"./uploadPrivacyRequestsFromCsv-B12nUzR7.mjs";import{t as Kt}from"./readCsv-C4TyEs-r.mjs";import{n as qt,t as Jt}from"./pullUnstructuredSubDataPointRecommendations-D0z-vPgq.mjs";import{a as Yt,i as Xt,n as Zt,o as Qt,r as $t,t as en}from"./request-DfkRPQFr.mjs";import{i as tn,n as nn,r as rn,t as an}from"./pullTranscendConfiguration-BHP6t_Nq.mjs";import{i as on,n as sn,r as N,t as cn}from"./fetchAllRequests-CHHdyb4Q.mjs";import{a as ln,i as un,n as dn,r as fn,t as pn}from"./pullChunkedCustomSiloOutstandingIdentifiers-CeyJB-lD.mjs";import{n as mn,r as hn,t as gn}from"./syncCodePackages-CAk_Hjyl.mjs";import{t as _n}from"./markSilentPrivacyRequests-CaW2kbbn.mjs";import{a as vn,i as yn,n as bn,o as xn,r as Sn,t as Cn}from"./downloadPrivacyRequestFiles-DM35rqpc.mjs";import{n as wn,r as Tn,t as En}from"./extractClientError-i-Tw_az7.mjs";import{t as Dn}from"./approvePrivacyRequests-CVIETlEr.mjs";import{t as On}from"./notifyPrivacyRequestsAdditionalTime-GcUtfuzA.mjs";import{t as kn}from"./cancelPrivacyRequests-DBvil_1B.mjs";import{n as An,t as jn}from"./bulkRestartRequests-rGsHi_JA.mjs";import{t as Mn}from"./skipPreflightJobs-Bz7lOjRZ.mjs";import{t as Nn}from"./bulkRetryEnrichers-h8-m1giM.mjs";import{t as Pn}from"./retryRequestDataSilos-CUkt_5rj.mjs";import{n as P,r as F,t as Fn}from"./streamPrivacyRequestsToCsv-CmmaBjCu.mjs";import{n as In,r as Ln,t as Rn}from"./inquirer-B4iEodLy.mjs";import{t as zn}from"./collectParquetFilesOrExit-BJiAyaQ5.mjs";import{t as Bn}from"./collectCsvFilesOrExit-CbtyKAzu.mjs";import{t as Vn}from"./parquetToCsvOneFile-B84XXInh.mjs";import{a as Hn,i as Un,n as Wn,o as Gn,r as Kn,s as qn,t as Jn}from"./writeCsv-C4pjXGsD.mjs";import{t as Yn}from"./skipRequestDataSilos-CgucJfbw.mjs";import{t as Xn}from"./removeUnverifiedRequestIdentifiers-CFrPuQZa.mjs";import{t as Zn}from"./updateConsentManagerVersionToLatest-z4dVl2L0.mjs";import{t as Qn}from"./uploadDataFlowsFromCsv-UlL2RtFK.mjs";import{t as $n}from"./uploadCookiesFromCsv-De5mzrnq.mjs";import{t as er}from"./pullConsentManagerMetrics-zKgjc3Ap.mjs";import{n as tr,r as nr,t as rr}from"./buildXdiSyncEndpoint-DebUtvXV.mjs";import{t as ir}from"./consentManagersToBusinessEntities-BdKDganK.mjs";import{i as ar,n as or,r as sr,t as cr}from"./uploadConsents-DXUKPUVc.mjs";import{n as lr,r as ur,t as dr}from"./pushCronIdentifiersFromCsv-Oks7iOwC.mjs";import{t as fr}from"./markRequestDataSiloIdsCompleted-RLx-NGQX.mjs";import{t as pr}from"./generateCrossAccountApiKeys-Ddw9d_2c.mjs";import{t as mr}from"./validateTranscendAuth-DJ8qHb9B.mjs";import{t as hr}from"./listFiles-D2wMHnEr.mjs";import{t as gr}from"./pullAllDatapoints-Bbmky50p.mjs";import{t as _r}from"./pullManualEnrichmentIdentifiersToCsv-DfkW9-nX.mjs";import{n as vr,r as yr,t as br}from"./pushManualEnrichmentIdentifiersFromCsv-Y1qfOHQS.mjs";import{ChatCompletionRole as I,PromptRunProductArea as L,PromptStatus as R,QueueStatus as z}from"@transcend-io/privacy-types";import{chunk as B,difference as xr,groupBy as Sr,keyBy as V,uniq as Cr}from"lodash-es";import{apply as wr,decodeCodec as H,getValues as Tr}from"@transcend-io/type-utils";import{readFileSync as Er,readdirSync as Dr,statSync as Or}from"node:fs";import{join as kr}from"node:path";import U from"colors";import{UPDATE_OR_CREATE_COOKIES as Ar,buildTranscendGraphQLClient as W,createSombraGotInstance as jr,fetchAllAgentFiles as Mr,fetchAllAgents as G,fetchAllLargeLanguageModels as Nr,fetchAllPromptThreads as Pr,fetchAllRequestIdentifiers as Fr,fetchConsentManagerId as Ir,fetchPromptsWithVariables as Lr,makeGraphQLRequest as Rr,reportPromptRun as K,validateSombraVersion as q}from"@transcend-io/sdk";import{map as J,mapSeries as Y}from"@transcend-io/utils";import{createHandlebarsWithHelpers as X}from"@transcend-io/handlebars-utils";import{execSync as Z}from"child_process";import zr from"fast-glob";async function Q(e,t){let n=await Ir(e,{logger:x});await Y(B(t,100),async t=>{await Rr(e,Ar,{variables:{airgapBundleId:n,cookies:t.map(e=>({name:e.name,trackingPurposes:e.trackingPurposes&&e.trackingPurposes.length>0?e.trackingPurposes:void 0,description:e.description,service:e.service,status:e.status,attributes:e.attributes,isRegex:e.isRegex}))},logger:x})})}async function Br(e,t){let n=!1;x.info(U.magenta(`Syncing "${t.length}" cookies...`));let r=t.filter(e=>t.filter(t=>e.name===t.name&&e.isRegex===t.isRegex).length>1);if(r.length>0)throw Error(`Failed to upload cookies as there were non-unique entries found: ${r.map(({name:e})=>e).join(`,`)}`);try{x.info(U.magenta(`Upserting "${t.length}" new cookies...`)),await Q(e,t),x.info(U.green(`Successfully synced ${t.length} cookies!`))}catch(e){n=!0,x.error(U.red(`Failed to create cookies! - ${e.message}`))}return!n}async function Vr({auth:e,sombraAuth:t,actions:n=[],statuses:r=[],identifierSearch:i,pageLimit:a=100,concurrency:s=1,transcendUrl:c=o,createdAtBefore:l,skipRequestIdentifiers:u=!1,createdAtAfter:d,updatedAtBefore:f,updatedAtAfter:p,isTest:m}){let h=W(c,e),g=await jr(c,e,{logger:x,sombraApiKey:t,sombraUrl:process.env.SOMBRA_URL}),_=``;l&&(_+=` before ${l.toISOString()}`),d&&(_+=`${_?`, and`:``} after ${d.toISOString()}`),x.info(U.magenta(`${n.length>0?`Pulling requests of type "${n.join(`" , "`)}"`:`Pulling all requests`}${_}`));let v=s>1&&d&&l,y=v?P(d,l,s):[{createdAtAfter:d,createdAtBefore:l}];v&&x.info(U.magenta(`Splitting date range into ${s} parallel chunks`));let b=(await J(y,e=>N(h,{actions:n,text:i,statuses:r,createdAtBefore:e.createdAtBefore,createdAtAfter:e.createdAtAfter,updatedAtBefore:f,updatedAtAfter:p,isTest:m}),{concurrency:v?s:1})).flat();u||await q(h,{logger:x});let S=u?b.map(e=>({...e,requestIdentifiers:[]})):await J(b,async e=>{let t=await Fr(h,g,{filterBy:{requestId:e.id},skipSombraCheck:!0,logger:x});return{...e,requestIdentifiers:t}},{concurrency:a});return x.info(U.magenta(`Pulled ${S.length} requests`)),{requestsWithRequestIdentifiers:S,requestsFormattedForCsv:S.map(F)}}function Hr(e){try{return e?Er(e,`utf8`):``}catch{return``}}function Ur(e){return Dr(e).filter(t=>Or(kr(e,t)).isDirectory())}function $(e){return RegExp(`<${e}>([\\s\\S]+?)<\\/${e}>`)}function Wr(e){return e}const Gr=e=>{try{return JSON.parse(e)}catch{return e}};var Kr=class{prompts;handlebarsOptions;promptContentMap;largeLanguageModels=[];agentsByName={};agentsByAgentId={};graphQLClient;defaultVariables;variables;handlebars;transcendApiKey;transcendUrl;requireApproval;cacheDuration;lastUpdatedAt;constructor({prompts:e,handlebarsOptions:t={},transcendUrl:n=o,transcendApiKey:r,requireApproval:i=!0,cacheDuration:a,defaultVariables:s={}}){this.prompts=e,this.transcendUrl=n,this.transcendApiKey=r,this.variables=s,this.defaultVariables=s,this.graphQLClient=W(n,typeof r==`object`?r.release():r),this.requireApproval=i,this.cacheDuration=a,this.handlebarsOptions=t,this.handlebars=X(t)}async fetchPromptsAndMetadata(){let e=Tr(this.prompts),t=e.map(({id:e})=>e).filter(e=>!!e),n=e.map(({title:e})=>e).filter(e=>!!e),r=Cr(e.map(({agentNames:e})=>e||[]).flat()),[i,a,o]=await Promise.all([Lr(this.graphQLClient,{logger:x,filterBy:{ids:t,titles:n}}),Nr(this.graphQLClient,{logger:x}),G(this.graphQLClient,{logger:x,filterBy:{names:r}})]);this.agentsByName=V(o,`name`),this.agentsByAgentId=V(o,`agentId`),this.largeLanguageModels=a.filter(e=>e.isTranscendHosted===!1);let s=V(i.prompts,`title`),c=V(i.prompts,`id`);return this.variables={...i.calculatedVariables.reduce((e,t)=>Object.assign(e,{[t.name]:t.data?JSON.parse(t.data):t.data}),{}),...this.defaultVariables},this.handlebars=X({...this.handlebarsOptions,templates:[...this.handlebarsOptions.templates||[],...i.promptPartials.map(e=>({name:e.slug,content:e.content}))]}),this.promptContentMap=wr(this.prompts,({id:e,title:t})=>{let n=e?c[e]:t?s[t]:void 0;if(!n)throw Error(`Failed to find prompt with title: "${t}" and id: "${e}"`);return n}),this.lastUpdatedAt=new Date,i}async getAgentByName(e){let t=this.agentsByName[e];if(t)return t;let[n]=await G(this.graphQLClient,{logger:x,filterBy:{names:[e]}});if(n)return this.agentsByName[n.name]=n,this.agentsByAgentId[n.agentId]=n,n}async getPromptThreadBySlackTs(e){let[t]=await Pr(this.graphQLClient,{logger:x,filterBy:{slackMessageTs:[e]}});return t}async getAgentsByName(e){if(e.length<1)throw Error(`Expected at least one name to be provided`);let{hasCache:t=[],missingCache:n=[]}=Sr(e,e=>this.agentsByName[e]?`hasCache`:`missingCache`),r=t.map(e=>this.agentsByName[e]);if(n.length===0)return r;let i=B(n,50),a=[];return await Y(i,async e=>{let t=await G(this.graphQLClient,{logger:x,filterBy:{names:e}});t.forEach(e=>{this.agentsByName[e.name]=e,this.agentsByAgentId[e.agentId]=e}),a.push(...t)}),[...r,...a]}getAgentFiles(e){return Mr(this.graphQLClient,{logger:x,filterBy:e})}getLargeLanguageModel(e){let t=this.largeLanguageModels.find(t=>typeof e==`string`?t.id===e:t.name===e.name&&t.client===e.client);if(!t)throw Error(`Failed to find model matching: ${typeof e==`string`?e:JSON.stringify(e)}`);return t}async getPromptDefinition(e){(!this.lastUpdatedAt||this.cacheDuration===0||this.cacheDuration&&Date.now()-this.lastUpdatedAt.getTime()>this.cacheDuration)&&await this.fetchPromptsAndMetadata();let{promptContentMap:t}=this;if(!t)throw Error(`Expected this.promptContentMap to be defined`);let n=t[e];if(!n)throw Error(`Expected this.promptContentMap[${e}] to be defined`);return n}async compilePrompt(e,t){let n=await this.getPromptDefinition(e),r=this.prompts[e];if(!r)throw Error(`Expected this.prompts[${e}] to be defined`);if(this.requireApproval&&n.status!==R.Approved)throw Error(`Assessment "${n.title}" cannot be used because its in status: "${n.status}"`);if(n.status===R.Rejected)throw Error(`Assessment "${n.title}" cannot be used because it's in status: "${n.status}"`);return H(r.paramCodec,t),this.handlebars.compile(n.content)({currentDate:new Date().toISOString(),...this.variables,...t})}parseAiResponse(e,t){let n=this.prompts[e];if(!n)throw Error(`Expected this.prompts[${e}] to be defined`);let r=n.extractFromTag&&($(n.extractFromTag).exec(t)||[])[1]||t;return H(n.outputCodec,Gr(r),!1)}async reportAndParsePromptRun(e,{largeLanguageModel:t,...n}){(!this.lastUpdatedAt||this.cacheDuration===0||this.cacheDuration&&Date.now()-this.lastUpdatedAt.getTime()>this.cacheDuration)&&await this.fetchPromptsAndMetadata();let r=n.name||`@transcend-io/cli-prompt-run-${new Date().toISOString()}`;if(!this.promptContentMap)throw Error(`Expected this.promptContentMap to be defined`);let i=this.promptContentMap[e];if(!i)throw Error(`Expected this.prompts[${e}] to be defined`);if(n.promptRunMessages.length===0)throw Error(`promptRunMessages is expected to have length > 0`);if(n.promptRunMessages[0].role!==I.System)throw Error(`promptRunMessages[0].role is expected to be = ${I.System}`);if(n.promptRunMessages[n.promptRunMessages.length-1].role!==I.Assistant)throw Error(`promptRunMessages[${n.promptRunMessages.length-1}].role is expected to be = ${I.Assistant}`);let a=n.promptRunMessages[n.promptRunMessages.length-1].content,o;try{o=this.parseAiResponse(e,a)}catch(e){throw await K(this.graphQLClient,{productArea:L.PromptManager,...n,name:r,error:e.message,status:z.Error,...typeof t==`string`?{largeLanguageModelId:t}:{largeLanguageModelName:t.name,largeLanguageModelClient:t.client},promptId:i.id,promptRunMessages:n.promptRunMessages.map((e,t)=>({...e,...t===0?{template:i.content}:{}}))},{logger:x}),e}let s=await K(this.graphQLClient,{productArea:L.PromptManager,...n,name:r,status:z.Resolved,...typeof t==`string`?{largeLanguageModelId:t}:{largeLanguageModelName:t.name,largeLanguageModelClient:t.client},promptId:i.id,promptRunMessages:n.promptRunMessages.map((e,t)=>({...e,...t===0?{template:i.content}:{}}))},{logger:x});return{result:o,promptRunId:s,promptRunUrl:`https://app.transcend.io/prompts/runs/${s}`}}async reportPromptRunError(e,{largeLanguageModel:t,...n}){(!this.lastUpdatedAt||this.cacheDuration===0||this.cacheDuration&&Date.now()-this.lastUpdatedAt.getTime()>this.cacheDuration)&&await this.fetchPromptsAndMetadata();let r=n.name||`@transcend-io/cli-prompt-run-${new Date().toISOString()}`;if(!this.promptContentMap)throw Error(`Expected this.promptContentMap to be defined`);let i=this.promptContentMap[e];if(!i)throw Error(`Expected this.prompts[${e}] to be defined`);if(n.promptRunMessages.length===0)throw Error(`promptRunMessages is expected to have length > 0`);if(n.promptRunMessages[0].role!==I.System)throw Error(`promptRunMessages[0].role is expected to be = ${I.System}`);let a=await K(this.graphQLClient,{productArea:L.PromptManager,...n,name:r,status:z.Error,...typeof t==`string`?{largeLanguageModelId:t}:{largeLanguageModelName:t.name,largeLanguageModelClient:t.client},promptId:i.id,promptRunMessages:n.promptRunMessages.map((e,t)=>({...e,...t===0?{template:i.content}:{}}))},{logger:x});return{promptRunId:a,promptRunUrl:`https://app.transcend.io/prompts/runs/${a}`}}};function qr(e){return e.replace(/(https?:\/\/[^\s]+)/g,`<link-omitted>`)}function Jr(e){return Object.entries(e).reduce((e,[t,n])=>n!=null&&n!==``&&!(Array.isArray(n)&&n.length===0)&&!(typeof n==`object`&&Object.keys(n).length===0)?Object.assign(e,{[t]:n}):e,{})}function Yr({baseBranch:e,rootDirectory:t,githubRepo:n,excludedGlob:r=[],fileBlockList:i=[]}){Z(`git fetch origin ${e}`);let a=Z(`git ls-remote ${n} "refs/heads/${e}" | cut -f 1`,{encoding:`utf-8`}).split(`
1
+ import{a as e,i as t,n,o as r,r as i,t as a}from"./enums-CyFTrzXY.mjs";import{a as o,c as s,d as c,f as l,h as u,i as d,l as f,m as p,n as m,o as h,p as g,r as _,s as v,t as y,u as b}from"./constants-CY1i6J69.mjs";import{t as x}from"./logger-Bj782ZYD.mjs";import{$ as S,A as ee,B as te,C as ne,D as re,E as ie,F as ae,G as oe,H as se,I as ce,J as le,K as ue,L as de,M as fe,N as pe,O as me,P as he,Q as ge,R as _e,S as ve,T as ye,U as be,V as xe,W as C,X as w,Y as T,Z as E,_ as D,_t as O,a as k,at as A,b as j,bt as M,c as Se,ct as Ce,d as we,dt as Te,et as Ee,f as De,ft as Oe,g as ke,gt as Ae,h as je,ht as Me,i as Ne,it as Pe,j as Fe,k as Ie,l as Le,lt as Re,m as ze,mt as Be,n as Ve,nt as He,o as Ue,ot as We,p as Ge,pt as Ke,q as qe,r as Je,rt as Ye,s as Xe,st as Ze,t as Qe,tt as $e,u as et,ut as tt,v as nt,vt as rt,w as it,x as at,xt as ot,y as st,yt as ct,z as lt}from"./codecs-Dnq-rEcB.mjs";import{a as ut,i as dt,n as ft,r as pt,t as mt}from"./readTranscendYaml-CGb2UUyM.mjs";import{a as ht,i as gt,n as _t,r as vt,t as yt}from"./parseVariablesFromString-BeKOGw5n.mjs";import{a as bt,c as xt,i as St,l as Ct,n as wt,o as Tt,r as Et,s as Dt,t as Ot,u as kt}from"./constants-CLxPXlJM.mjs";import{i as At,n as jt,r as Mt,t as Nt}from"./parseAttributesFromString-q4-59nEN.mjs";import{a as Pt,c as Ft,d as It,f as Lt,i as Rt,l as zt,n as Bt,o as Vt,r as Ht,s as Ut,t as Wt,u as Gt}from"./uploadPrivacyRequestsFromCsv-nrbRvXw3.mjs";import{t as Kt}from"./readCsv-C4TyEs-r.mjs";import{n as qt,t as Jt}from"./pullUnstructuredSubDataPointRecommendations-D0z-vPgq.mjs";import{a as Yt,i as Xt,n as Zt,o as Qt,r as $t,t as en}from"./request-DfkRPQFr.mjs";import{i as tn,n as nn,r as rn,t as an}from"./pullTranscendConfiguration-BHP6t_Nq.mjs";import{i as on,n as sn,r as N,t as cn}from"./fetchAllRequests-CHHdyb4Q.mjs";import{a as ln,i as un,n as dn,r as fn,t as pn}from"./pullChunkedCustomSiloOutstandingIdentifiers-BSDvt77x.mjs";import{n as mn,r as hn,t as gn}from"./syncCodePackages-CAk_Hjyl.mjs";import{t as _n}from"./markSilentPrivacyRequests-DpV3i0hX.mjs";import{a as vn,i as yn,n as bn,o as xn,r as Sn,t as Cn}from"./downloadPrivacyRequestFiles-CrqSzV3f.mjs";import{n as wn,r as Tn,t as En}from"./extractClientError-i-Tw_az7.mjs";import{t as Dn}from"./approvePrivacyRequests-CCCcny1x.mjs";import{t as On}from"./notifyPrivacyRequestsAdditionalTime-BDipeYtR.mjs";import{t as kn}from"./cancelPrivacyRequests-DxMOvvH3.mjs";import{n as An,t as jn}from"./bulkRestartRequests-BsoIC3g7.mjs";import{t as Mn}from"./skipPreflightJobs-yux0ZXc_.mjs";import{t as Nn}from"./bulkRetryEnrichers-edv9vW96.mjs";import{t as Pn}from"./retryRequestDataSilos-I-TMWIjU.mjs";import{n as P,r as F,t as Fn}from"./streamPrivacyRequestsToCsv-Bh-gk9ZD.mjs";import{n as In,r as Ln,t as Rn}from"./inquirer-B4iEodLy.mjs";import{t as zn}from"./collectParquetFilesOrExit-BJiAyaQ5.mjs";import{t as Bn}from"./collectCsvFilesOrExit-CbtyKAzu.mjs";import{t as Vn}from"./parquetToCsvOneFile-B84XXInh.mjs";import{a as Hn,i as Un,n as Wn,o as Gn,r as Kn,s as qn,t as Jn}from"./writeCsv-C4pjXGsD.mjs";import{t as Yn}from"./skipRequestDataSilos-CI9xC7Gv.mjs";import{t as Xn}from"./removeUnverifiedRequestIdentifiers-Drty-WbB.mjs";import{t as Zn}from"./updateConsentManagerVersionToLatest-thw0q_iC.mjs";import{t as Qn}from"./uploadDataFlowsFromCsv-BOqV1uQG.mjs";import{t as $n}from"./uploadCookiesFromCsv-BkvgIOSv.mjs";import{t as er}from"./pullConsentManagerMetrics-zKgjc3Ap.mjs";import{n as tr,r as nr,t as rr}from"./buildXdiSyncEndpoint-jQ3542fw.mjs";import{t as ir}from"./consentManagersToBusinessEntities-BdKDganK.mjs";import{i as ar,n as or,r as sr,t as cr}from"./uploadConsents-D9kSOwW8.mjs";import{n as lr,r as ur,t as dr}from"./pushCronIdentifiersFromCsv-D__AqLbM.mjs";import{t as fr}from"./markRequestDataSiloIdsCompleted-BS5PL4pL.mjs";import{t as pr}from"./generateCrossAccountApiKeys-CW3qfNn0.mjs";import{t as mr}from"./validateTranscendAuth-DJ8qHb9B.mjs";import{t as hr}from"./listFiles-D2wMHnEr.mjs";import{t as gr}from"./pullAllDatapoints-Bbmky50p.mjs";import{t as _r}from"./pullManualEnrichmentIdentifiersToCsv-DcT-9Cp1.mjs";import{n as vr,r as yr,t as br}from"./pushManualEnrichmentIdentifiersFromCsv-P-FlXSNH.mjs";import{ChatCompletionRole as I,PromptRunProductArea as L,PromptStatus as R,QueueStatus as z}from"@transcend-io/privacy-types";import{chunk as B,difference as xr,groupBy as Sr,keyBy as V,uniq as Cr}from"lodash-es";import{apply as wr,decodeCodec as H,getValues as Tr}from"@transcend-io/type-utils";import{readFileSync as Er,readdirSync as Dr,statSync as Or}from"node:fs";import{join as kr}from"node:path";import U from"colors";import{UPDATE_OR_CREATE_COOKIES as Ar,buildTranscendGraphQLClient as W,createSombraGotInstance as jr,fetchAllAgentFiles as Mr,fetchAllAgents as G,fetchAllLargeLanguageModels as Nr,fetchAllPromptThreads as Pr,fetchAllRequestIdentifiers as Fr,fetchConsentManagerId as Ir,fetchPromptsWithVariables as Lr,makeGraphQLRequest as Rr,reportPromptRun as K,validateSombraVersion as q}from"@transcend-io/sdk";import{map as J,mapSeries as Y}from"@transcend-io/utils";import{createHandlebarsWithHelpers as X}from"@transcend-io/handlebars-utils";import{execSync as Z}from"child_process";import zr from"fast-glob";async function Q(e,t){let n=await Ir(e,{logger:x});await Y(B(t,100),async t=>{await Rr(e,Ar,{variables:{airgapBundleId:n,cookies:t.map(e=>({name:e.name,trackingPurposes:e.trackingPurposes&&e.trackingPurposes.length>0?e.trackingPurposes:void 0,description:e.description,service:e.service,status:e.status,attributes:e.attributes,isRegex:e.isRegex}))},logger:x})})}async function Br(e,t){let n=!1;x.info(U.magenta(`Syncing "${t.length}" cookies...`));let r=t.filter(e=>t.filter(t=>e.name===t.name&&e.isRegex===t.isRegex).length>1);if(r.length>0)throw Error(`Failed to upload cookies as there were non-unique entries found: ${r.map(({name:e})=>e).join(`,`)}`);try{x.info(U.magenta(`Upserting "${t.length}" new cookies...`)),await Q(e,t),x.info(U.green(`Successfully synced ${t.length} cookies!`))}catch(e){n=!0,x.error(U.red(`Failed to create cookies! - ${e.message}`))}return!n}async function Vr({auth:e,sombraAuth:t,actions:n=[],statuses:r=[],identifierSearch:i,pageLimit:a=100,concurrency:s=1,transcendUrl:c=o,createdAtBefore:l,skipRequestIdentifiers:u=!1,createdAtAfter:d,updatedAtBefore:f,updatedAtAfter:p,isTest:m}){let h=W(c,e),g=await jr(c,e,{logger:x,sombraApiKey:t,sombraUrl:process.env.SOMBRA_URL}),_=``;l&&(_+=` before ${l.toISOString()}`),d&&(_+=`${_?`, and`:``} after ${d.toISOString()}`),x.info(U.magenta(`${n.length>0?`Pulling requests of type "${n.join(`" , "`)}"`:`Pulling all requests`}${_}`));let v=s>1&&d&&l,y=v?P(d,l,s):[{createdAtAfter:d,createdAtBefore:l}];v&&x.info(U.magenta(`Splitting date range into ${s} parallel chunks`));let b=(await J(y,e=>N(h,{actions:n,text:i,statuses:r,createdAtBefore:e.createdAtBefore,createdAtAfter:e.createdAtAfter,updatedAtBefore:f,updatedAtAfter:p,isTest:m}),{concurrency:v?s:1})).flat();u||await q(h,{logger:x});let S=u?b.map(e=>({...e,requestIdentifiers:[]})):await J(b,async e=>{let t=await Fr(h,g,{filterBy:{requestId:e.id},skipSombraCheck:!0,logger:x});return{...e,requestIdentifiers:t}},{concurrency:a});return x.info(U.magenta(`Pulled ${S.length} requests`)),{requestsWithRequestIdentifiers:S,requestsFormattedForCsv:S.map(F)}}function Hr(e){try{return e?Er(e,`utf8`):``}catch{return``}}function Ur(e){return Dr(e).filter(t=>Or(kr(e,t)).isDirectory())}function $(e){return RegExp(`<${e}>([\\s\\S]+?)<\\/${e}>`)}function Wr(e){return e}const Gr=e=>{try{return JSON.parse(e)}catch{return e}};var Kr=class{prompts;handlebarsOptions;promptContentMap;largeLanguageModels=[];agentsByName={};agentsByAgentId={};graphQLClient;defaultVariables;variables;handlebars;transcendApiKey;transcendUrl;requireApproval;cacheDuration;lastUpdatedAt;constructor({prompts:e,handlebarsOptions:t={},transcendUrl:n=o,transcendApiKey:r,requireApproval:i=!0,cacheDuration:a,defaultVariables:s={}}){this.prompts=e,this.transcendUrl=n,this.transcendApiKey=r,this.variables=s,this.defaultVariables=s,this.graphQLClient=W(n,typeof r==`object`?r.release():r),this.requireApproval=i,this.cacheDuration=a,this.handlebarsOptions=t,this.handlebars=X(t)}async fetchPromptsAndMetadata(){let e=Tr(this.prompts),t=e.map(({id:e})=>e).filter(e=>!!e),n=e.map(({title:e})=>e).filter(e=>!!e),r=Cr(e.map(({agentNames:e})=>e||[]).flat()),[i,a,o]=await Promise.all([Lr(this.graphQLClient,{logger:x,filterBy:{ids:t,titles:n}}),Nr(this.graphQLClient,{logger:x}),G(this.graphQLClient,{logger:x,filterBy:{names:r}})]);this.agentsByName=V(o,`name`),this.agentsByAgentId=V(o,`agentId`),this.largeLanguageModels=a.filter(e=>e.isTranscendHosted===!1);let s=V(i.prompts,`title`),c=V(i.prompts,`id`);return this.variables={...i.calculatedVariables.reduce((e,t)=>Object.assign(e,{[t.name]:t.data?JSON.parse(t.data):t.data}),{}),...this.defaultVariables},this.handlebars=X({...this.handlebarsOptions,templates:[...this.handlebarsOptions.templates||[],...i.promptPartials.map(e=>({name:e.slug,content:e.content}))]}),this.promptContentMap=wr(this.prompts,({id:e,title:t})=>{let n=e?c[e]:t?s[t]:void 0;if(!n)throw Error(`Failed to find prompt with title: "${t}" and id: "${e}"`);return n}),this.lastUpdatedAt=new Date,i}async getAgentByName(e){let t=this.agentsByName[e];if(t)return t;let[n]=await G(this.graphQLClient,{logger:x,filterBy:{names:[e]}});if(n)return this.agentsByName[n.name]=n,this.agentsByAgentId[n.agentId]=n,n}async getPromptThreadBySlackTs(e){let[t]=await Pr(this.graphQLClient,{logger:x,filterBy:{slackMessageTs:[e]}});return t}async getAgentsByName(e){if(e.length<1)throw Error(`Expected at least one name to be provided`);let{hasCache:t=[],missingCache:n=[]}=Sr(e,e=>this.agentsByName[e]?`hasCache`:`missingCache`),r=t.map(e=>this.agentsByName[e]);if(n.length===0)return r;let i=B(n,50),a=[];return await Y(i,async e=>{let t=await G(this.graphQLClient,{logger:x,filterBy:{names:e}});t.forEach(e=>{this.agentsByName[e.name]=e,this.agentsByAgentId[e.agentId]=e}),a.push(...t)}),[...r,...a]}getAgentFiles(e){return Mr(this.graphQLClient,{logger:x,filterBy:e})}getLargeLanguageModel(e){let t=this.largeLanguageModels.find(t=>typeof e==`string`?t.id===e:t.name===e.name&&t.client===e.client);if(!t)throw Error(`Failed to find model matching: ${typeof e==`string`?e:JSON.stringify(e)}`);return t}async getPromptDefinition(e){(!this.lastUpdatedAt||this.cacheDuration===0||this.cacheDuration&&Date.now()-this.lastUpdatedAt.getTime()>this.cacheDuration)&&await this.fetchPromptsAndMetadata();let{promptContentMap:t}=this;if(!t)throw Error(`Expected this.promptContentMap to be defined`);let n=t[e];if(!n)throw Error(`Expected this.promptContentMap[${e}] to be defined`);return n}async compilePrompt(e,t){let n=await this.getPromptDefinition(e),r=this.prompts[e];if(!r)throw Error(`Expected this.prompts[${e}] to be defined`);if(this.requireApproval&&n.status!==R.Approved)throw Error(`Assessment "${n.title}" cannot be used because its in status: "${n.status}"`);if(n.status===R.Rejected)throw Error(`Assessment "${n.title}" cannot be used because it's in status: "${n.status}"`);return H(r.paramCodec,t),this.handlebars.compile(n.content)({currentDate:new Date().toISOString(),...this.variables,...t})}parseAiResponse(e,t){let n=this.prompts[e];if(!n)throw Error(`Expected this.prompts[${e}] to be defined`);let r=n.extractFromTag&&($(n.extractFromTag).exec(t)||[])[1]||t;return H(n.outputCodec,Gr(r),!1)}async reportAndParsePromptRun(e,{largeLanguageModel:t,...n}){(!this.lastUpdatedAt||this.cacheDuration===0||this.cacheDuration&&Date.now()-this.lastUpdatedAt.getTime()>this.cacheDuration)&&await this.fetchPromptsAndMetadata();let r=n.name||`@transcend-io/cli-prompt-run-${new Date().toISOString()}`;if(!this.promptContentMap)throw Error(`Expected this.promptContentMap to be defined`);let i=this.promptContentMap[e];if(!i)throw Error(`Expected this.prompts[${e}] to be defined`);if(n.promptRunMessages.length===0)throw Error(`promptRunMessages is expected to have length > 0`);if(n.promptRunMessages[0].role!==I.System)throw Error(`promptRunMessages[0].role is expected to be = ${I.System}`);if(n.promptRunMessages[n.promptRunMessages.length-1].role!==I.Assistant)throw Error(`promptRunMessages[${n.promptRunMessages.length-1}].role is expected to be = ${I.Assistant}`);let a=n.promptRunMessages[n.promptRunMessages.length-1].content,o;try{o=this.parseAiResponse(e,a)}catch(e){throw await K(this.graphQLClient,{productArea:L.PromptManager,...n,name:r,error:e.message,status:z.Error,...typeof t==`string`?{largeLanguageModelId:t}:{largeLanguageModelName:t.name,largeLanguageModelClient:t.client},promptId:i.id,promptRunMessages:n.promptRunMessages.map((e,t)=>({...e,...t===0?{template:i.content}:{}}))},{logger:x}),e}let s=await K(this.graphQLClient,{productArea:L.PromptManager,...n,name:r,status:z.Resolved,...typeof t==`string`?{largeLanguageModelId:t}:{largeLanguageModelName:t.name,largeLanguageModelClient:t.client},promptId:i.id,promptRunMessages:n.promptRunMessages.map((e,t)=>({...e,...t===0?{template:i.content}:{}}))},{logger:x});return{result:o,promptRunId:s,promptRunUrl:`https://app.transcend.io/prompts/runs/${s}`}}async reportPromptRunError(e,{largeLanguageModel:t,...n}){(!this.lastUpdatedAt||this.cacheDuration===0||this.cacheDuration&&Date.now()-this.lastUpdatedAt.getTime()>this.cacheDuration)&&await this.fetchPromptsAndMetadata();let r=n.name||`@transcend-io/cli-prompt-run-${new Date().toISOString()}`;if(!this.promptContentMap)throw Error(`Expected this.promptContentMap to be defined`);let i=this.promptContentMap[e];if(!i)throw Error(`Expected this.prompts[${e}] to be defined`);if(n.promptRunMessages.length===0)throw Error(`promptRunMessages is expected to have length > 0`);if(n.promptRunMessages[0].role!==I.System)throw Error(`promptRunMessages[0].role is expected to be = ${I.System}`);let a=await K(this.graphQLClient,{productArea:L.PromptManager,...n,name:r,status:z.Error,...typeof t==`string`?{largeLanguageModelId:t}:{largeLanguageModelName:t.name,largeLanguageModelClient:t.client},promptId:i.id,promptRunMessages:n.promptRunMessages.map((e,t)=>({...e,...t===0?{template:i.content}:{}}))},{logger:x});return{promptRunId:a,promptRunUrl:`https://app.transcend.io/prompts/runs/${a}`}}};function qr(e){return e.replace(/(https?:\/\/[^\s]+)/g,`<link-omitted>`)}function Jr(e){return Object.entries(e).reduce((e,[t,n])=>n!=null&&n!==``&&!(Array.isArray(n)&&n.length===0)&&!(typeof n==`object`&&Object.keys(n).length===0)?Object.assign(e,{[t]:n}):e,{})}function Yr({baseBranch:e,rootDirectory:t,githubRepo:n,excludedGlob:r=[],fileBlockList:i=[]}){Z(`git fetch origin ${e}`);let a=Z(`git ls-remote ${n} "refs/heads/${e}" | cut -f 1`,{encoding:`utf-8`}).split(`
2
2
  `)[0],o=Z(`git rev-parse HEAD`,{encoding:`utf-8`}).split(`
3
3
  `)[0];if(!a||!o)throw Error(`FAILED TO FIND COMMIT RANGE`);let s=xr(Z(`git fetch && git diff --name-only "${e||a}...${o}" -- ${t}`,{encoding:`utf-8`}).split(`
4
4
  `).filter(e=>e),i),c=r.length>0?zr.sync(s,{ignore:r}):s,l={};return c.forEach(e=>{l[e]=Z(`git show ${o}:${e}`,{encoding:`utf-8`})}),{changedFiles:s,fileDiffs:l,repoName:n.split(`/`).pop().split(`.`)[0],commit:o}}export{y as ADMIN_DASH,m as ADMIN_DASH_DATAPOINTS,_ as ADMIN_DASH_INTEGRATIONS,en as APPROVE_PRIVACY_REQUEST,tn as ASSESSMENT_TEMPLATES,Qe as ActionInput,Ve as ActionItemCollectionInput,Je as ActionItemInput,Ne as AgentFileInput,k as AgentFunctionInput,Ue as AgentInput,Xe as ApiKeyInput,Se as AssessmentAnswerOptionInput,Le as AssessmentDisplayLogicInput,et as AssessmentInput,we as AssessmentNestedRuleInput,De as AssessmentResourceInput,Ge as AssessmentRetentionScheduleInput,ze as AssessmentRuleInput,je as AssessmentSectionInput,ke as AssessmentSectionQuestionInput,D as AssessmentTemplateInput,Rt as AttestedExtraIdentifiers,nt as AttributeInput,st as AttributePreview,j as AttributeValueInput,Ot as BLANK,wt as BULK_APPLY,at as BusinessEntityInput,Zt as CANCEL_PRIVACY_REQUEST,Et as CAN_APPLY_IN_BULK,St as CachedFileState,bt as CachedRequestState,ve as CodePackageInput,ne as CodePackageSdk,Tt as ColumnName,it as ConsentManageExperienceInput,ye as ConsentManagerInput,ie as ConsentManagerServiceMetadata,re as ConsentPreferenceTopic,me as ConsentPreferenceTopicOptionValue,Ie as ConsentPurpose,ee as CookieCsvInput,Fe as CookieInput,dn as CronIdentifier,lr as CronIdentifierPush,fn as CronPartition,d as DEBUG,o as DEFAULT_TRANSCEND_API,h as DEFAULT_TRANSCEND_CONSENT_API,an as DEFAULT_TRANSCEND_PULL_RESOURCES,fe as DataCategoryGuessInput,pe as DataCategoryInput,he as DataCategoryPreviewInput,ae as DataCategoryRecommendationInput,ce as DataFlowCsvInput,de as DataFlowInput,_e as DataSiloInput,lt as DataSubjectInput,te as DatapointInput,qt as ENTRY_COUNT,vr as EnrichPrivacyRequest,xe as EnricherInput,se as FieldInput,Dt as IDENTIFIER_BLOCK_LIST,rr as IP_ADDRESS_REGEX,xt as IS_REQUIRED,be as IdentifierInput,C as ImportOnetrustAssessmentsInput,Sn as IntlMessage,oe as IntlMessageInput,Ct as NONE,$t as NOTIFY_ADDITIONAL_TIME,a as OneTrustFileFormat,n as OneTrustPullResource,i as OneTrustPullSource,ue as OpenAIEnabledRoute,qe as OpenAIEnabledRoutes,le as OpenAIIntegration,t as OpenAIRouteName,Nt as ParsedAttributeInput,T as PartitionInput,w as PathfinderPolicy,e as PathfinderPolicyName,E as PathfinderPolicyNameC,ge as PathfinderPromptRunMetadata,S as PolicyInput,Ee as PrivacyCenterInput,cn as PrivacyRequest,Pt as PrivacyRequestInput,wn as PrivacyRequestResponse,$e as ProcessingActivityInput,He as ProcessingPurposeInput,Ye as ProcessingPurposePreviewInput,Pe as PromptAVendorEmailSettings,A as PromptGroupInput,We as PromptInput,Ze as PromptPartialInput,cr as PurposeMap,Xt as REQUESTS,Yt as REQUESTS_COUNT,v as RETRYABLE_BATCH_STATUSES,Ce as RegionInput,Re as RepositoryInput,yn as RequestFileMetadata,vn as RequestFileMetadataResponse,sn as RequestPurposeTrigger,tt as RiskAssignmentInput,Te as RiskLogicInput,s as SCOPES_BY_TITLE,f as SCOPE_TITLES,Oe as SiloDiscoveryResultInput,Ke as SoftwareDevelopmentKitInput,Be as StoredApiKey,kt as SuccessfulRequest,b as TR_PULL_RESOURCE_SCOPE_MAP,c as TR_PUSH_RESOURCE_SCOPE_MAP,l as TR_YML_RESOURCE_TO_FIELD_NAME,Me as TeamInput,Ae as TemplateInput,O as TranscendInput,Kr as TranscendPromptManager,r as TranscendPullResource,Qt as UPDATE_PRIVACY_REQUEST,or as USP_STRING_REGEX,mt as VARIABLE_PARAMETERS_NAME,ft as VARIABLE_PARAMETERS_REGEXP,rt as VendorInput,ct as WebhookHeader,Jn as appendCsvRowsOrdered,Wn as appendCsvSync,Dn as approvePrivacyRequests,ot as buildAIIntegrationType,M as buildEnabledRouteType,tr as buildXdiSyncEndpoint,jn as bulkRestartRequests,Nn as bulkRetryEnrichers,kn as cancelPrivacyRequests,Bn as collectCsvFilesOrExit,zn as collectParquetFilesOrExit,ir as consentManagersToBusinessEntities,gn as createCodePackage,ar as createConsentToken,$ as createRegexForTag,Wr as defineTranscendPrompts,p as description,nr as domainToHost,Cn as downloadPrivacyRequestFiles,yr as enrichPrivacyRequest,ht as ensureAllDataSubjectsExist,En as extractClientError,rn as fetchAllAssessmentTemplates,N as fetchAllRequests,ln as fetchRequestDataSiloActiveCount,on as fetchRequestsTotalCount,Jr as filterNullishValuesFromObject,Gt as filterRows,F as formatRequestForCsv,Mt as fuzzyMatchColumns,At as fuzzySearch,pr as generateCrossAccountApiKeys,xn as getFileMetadataForPrivacyRequests,Yr as getGitFilesThatChanged,It as getUniqueValuesForColumn,Kn as initCsvFile,Rn as inquirerAutoComplete,In as inquirerConfirmBoolean,Ln as inquirerConfirmText,Ur as listDirectories,hr as listFiles,Bt as mapColumnsToAttributes,Ht as mapColumnsToIdentifiers,zt as mapCsvColumnsToApi,Vt as mapCsvRowsToRequestInputs,Lt as mapEnumValues,Ft as mapRequestEnumValues,ur as markCronIdentifierCompleted,fr as markRequestDataSiloIdsCompleted,_n as markSilentPrivacyRequests,_t as mergeTranscendInputs,g as name,Ut as normalizeIdentifierValue,On as notifyPrivacyRequestsAdditionalTime,Vn as parquetToCsvOneFile,jt as parseAttributesFromString,Un as parseFilePath,yt as parseVariablesFromString,gr as pullAllDatapoints,pn as pullChunkedCustomSiloOutstandingIdentifiers,er as pullConsentManagerMetrics,un as pullCronPageOfIdentifiers,_r as pullManualEnrichmentIdentifiersToCsv,Vr as pullPrivacyRequests,nn as pullTranscendConfiguration,Jt as pullUnstructuredSubDataPointRecommendations,dr as pushCronIdentifiersFromCsv,br as pushManualEnrichmentIdentifiersFromCsv,Kt as readCsv,Hr as readSafe,pt as readTranscendYaml,qr as removeLinks,Xn as removeUnverifiedRequestIdentifiers,dt as replaceVariablesInYaml,An as restartPrivacyRequest,Pn as retryRequestDataSilos,Mn as skipPreflightJobs,Yn as skipRequestDataSilos,P as splitDateRange,bn as streamPrivacyRequestFiles,Fn as streamPrivacyRequestsToCsv,Tn as submitPrivacyRequest,mn as syncCodePackages,vt as syncConfigurationToTranscend,Br as syncCookies,gt as syncDataSilos,hn as updateCodePackages,Zn as updateConsentManagerVersionToLatest,Q as updateOrCreateCookies,sr as uploadConsents,$n as uploadCookiesFromCsv,Qn as uploadDataFlowsFromCsv,Wt as uploadPrivacyRequestsFromCsv,mr as validateTranscendAuth,u as version,Hn as writeCsv,Gn as writeCsvSync,qn as writeLargeCsv,ut as writeTranscendYaml};
@@ -1,2 +1,2 @@
1
- import{a as e}from"./constants-CVdC1nK_.mjs";import{t}from"./logger-Bj782ZYD.mjs";import{RequestDataSiloStatus as n}from"@transcend-io/privacy-types";import r from"colors";import{CHANGE_REQUEST_DATA_SILO_STATUS as i,buildTranscendGraphQLClient as a,fetchRequestDataSilo as o,makeGraphQLRequest as s}from"@transcend-io/sdk";import{map as c}from"@transcend-io/utils";import l from"cli-progress";async function u({requestIds:u,dataSiloId:d,auth:f,concurrency:p=100,status:m=n.Resolved,transcendUrl:h=e}){let g=a(h,f),_=new Date().getTime(),v=new l.SingleBar({},l.Presets.shades_classic);t.info(r.magenta(`Notifying Transcend for data silo "${d}" marking "${u.length}" requests as completed.`));let y=0;v.start(u.length,0),await c(u,async e=>{let n=await o(g,{logger:t,filterBy:{requestId:e,dataSiloId:d}});try{await s(g,i,{variables:{requestDataSiloId:n.id,status:m},logger:t})}catch(e){if(!e.message.includes(`Client error: Request must be active:`)&&!e.message.includes(`Failed to find RequestDataSilo`))throw e}y+=1,v.update(y)},{concurrency:p}),v.stop();let b=new Date().getTime()-_;return t.info(r.green(`Successfully notified Transcend in "${b/1e3}" seconds!`)),u.length}export{u as t};
2
- //# sourceMappingURL=markRequestDataSiloIdsCompleted-RLx-NGQX.mjs.map
1
+ import{a as e}from"./constants-CY1i6J69.mjs";import{t}from"./logger-Bj782ZYD.mjs";import{RequestDataSiloStatus as n}from"@transcend-io/privacy-types";import r from"colors";import{CHANGE_REQUEST_DATA_SILO_STATUS as i,buildTranscendGraphQLClient as a,fetchRequestDataSilo as o,makeGraphQLRequest as s}from"@transcend-io/sdk";import{map as c}from"@transcend-io/utils";import l from"cli-progress";async function u({requestIds:u,dataSiloId:d,auth:f,concurrency:p=100,status:m=n.Resolved,transcendUrl:h=e}){let g=a(h,f),_=new Date().getTime(),v=new l.SingleBar({},l.Presets.shades_classic);t.info(r.magenta(`Notifying Transcend for data silo "${d}" marking "${u.length}" requests as completed.`));let y=0;v.start(u.length,0),await c(u,async e=>{let n=await o(g,{logger:t,filterBy:{requestId:e,dataSiloId:d}});try{await s(g,i,{variables:{requestDataSiloId:n.id,status:m},logger:t})}catch(e){if(!e.message.includes(`Client error: Request must be active:`)&&!e.message.includes(`Failed to find RequestDataSilo`))throw e}y+=1,v.update(y)},{concurrency:p}),v.stop();let b=new Date().getTime()-_;return t.info(r.green(`Successfully notified Transcend in "${b/1e3}" seconds!`)),u.length}export{u as t};
2
+ //# sourceMappingURL=markRequestDataSiloIdsCompleted-BS5PL4pL.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"markRequestDataSiloIdsCompleted-RLx-NGQX.mjs","names":[],"sources":["../src/lib/cron/markRequestDataSiloIdsCompleted.ts"],"sourcesContent":["import { RequestDataSiloStatus } from '@transcend-io/privacy-types';\nimport {\n buildTranscendGraphQLClient,\n makeGraphQLRequest,\n CHANGE_REQUEST_DATA_SILO_STATUS,\n fetchRequestDataSilo,\n} from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\n\n/**\n * Given a CSV of Request IDs, mark associated RequestDataSilos as completed\n *\n * @param options - Options\n * @returns Number of items marked as completed\n */\nexport async function markRequestDataSiloIdsCompleted({\n requestIds,\n dataSiloId,\n auth,\n concurrency = 100,\n status = RequestDataSiloStatus.Resolved,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** The list of request ids to mark as completed */\n requestIds: string[];\n /** Transcend API key authentication */\n auth: string;\n /** Data Silo ID to pull down jobs for */\n dataSiloId: string;\n /** Status to update requests to */\n status?: RequestDataSiloStatus;\n /** Upload concurrency */\n concurrency?: number;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<number> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n\n // Notify Transcend\n logger.info(\n colors.magenta(\n `Notifying Transcend for data silo \"${dataSiloId}\" marking \"${requestIds.length}\" requests as completed.`,\n ),\n );\n\n let total = 0;\n progressBar.start(requestIds.length, 0);\n await map(\n requestIds,\n async (requestId) => {\n const requestDataSilo = await fetchRequestDataSilo(client, {\n logger,\n filterBy: { requestId, dataSiloId },\n });\n\n try {\n await makeGraphQLRequest<{\n /** Whether we successfully uploaded the results */\n success: boolean;\n }>(client, CHANGE_REQUEST_DATA_SILO_STATUS, {\n variables: {\n requestDataSiloId: requestDataSilo.id,\n status,\n },\n logger,\n });\n } catch (err) {\n if (\n !err.message.includes('Client error: Request must be active:') &&\n !err.message.includes('Failed to find RequestDataSilo')\n ) {\n throw err;\n }\n }\n\n total += 1;\n progressBar.update(total);\n },\n { concurrency },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(colors.green(`Successfully notified Transcend in \"${totalTime / 1000}\" seconds!`));\n return requestIds.length;\n}\n"],"mappings":"yYAoBA,eAAsB,EAAgC,CACpD,aACA,aACA,OACA,cAAc,IACd,SAAS,EAAsB,SAC/B,eAAe,GAcG,CAElB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAK,IAAI,MAAM,CAAC,SAAS,CAEzB,EAAc,IAAI,EAAY,UAAU,EAAE,CAAE,EAAY,QAAQ,eAAe,CAGrF,EAAO,KACL,EAAO,QACL,sCAAsC,EAAW,aAAa,EAAW,OAAO,0BACjF,CACF,CAED,IAAI,EAAQ,EACZ,EAAY,MAAM,EAAW,OAAQ,EAAE,CACvC,MAAM,EACJ,EACA,KAAO,IAAc,CACnB,IAAM,EAAkB,MAAM,EAAqB,EAAQ,CACzD,SACA,SAAU,CAAE,YAAW,aAAY,CACpC,CAAC,CAEF,GAAI,CACF,MAAM,EAGH,EAAQ,EAAiC,CAC1C,UAAW,CACT,kBAAmB,EAAgB,GACnC,SACD,CACD,SACD,CAAC,OACK,EAAK,CACZ,GACE,CAAC,EAAI,QAAQ,SAAS,wCAAwC,EAC9D,CAAC,EAAI,QAAQ,SAAS,iCAAiC,CAEvD,MAAM,EAIV,GAAS,EACT,EAAY,OAAO,EAAM,EAE3B,CAAE,cAAa,CAChB,CAED,EAAY,MAAM,CAElB,IAAM,EADK,IAAI,MAAM,CAAC,SACF,CAAG,EAGvB,OADA,EAAO,KAAK,EAAO,MAAM,uCAAuC,EAAY,IAAK,YAAY,CAAC,CACvF,EAAW"}
1
+ {"version":3,"file":"markRequestDataSiloIdsCompleted-BS5PL4pL.mjs","names":[],"sources":["../src/lib/cron/markRequestDataSiloIdsCompleted.ts"],"sourcesContent":["import { RequestDataSiloStatus } from '@transcend-io/privacy-types';\nimport {\n buildTranscendGraphQLClient,\n makeGraphQLRequest,\n CHANGE_REQUEST_DATA_SILO_STATUS,\n fetchRequestDataSilo,\n} from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\n\n/**\n * Given a CSV of Request IDs, mark associated RequestDataSilos as completed\n *\n * @param options - Options\n * @returns Number of items marked as completed\n */\nexport async function markRequestDataSiloIdsCompleted({\n requestIds,\n dataSiloId,\n auth,\n concurrency = 100,\n status = RequestDataSiloStatus.Resolved,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** The list of request ids to mark as completed */\n requestIds: string[];\n /** Transcend API key authentication */\n auth: string;\n /** Data Silo ID to pull down jobs for */\n dataSiloId: string;\n /** Status to update requests to */\n status?: RequestDataSiloStatus;\n /** Upload concurrency */\n concurrency?: number;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<number> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n\n // Notify Transcend\n logger.info(\n colors.magenta(\n `Notifying Transcend for data silo \"${dataSiloId}\" marking \"${requestIds.length}\" requests as completed.`,\n ),\n );\n\n let total = 0;\n progressBar.start(requestIds.length, 0);\n await map(\n requestIds,\n async (requestId) => {\n const requestDataSilo = await fetchRequestDataSilo(client, {\n logger,\n filterBy: { requestId, dataSiloId },\n });\n\n try {\n await makeGraphQLRequest<{\n /** Whether we successfully uploaded the results */\n success: boolean;\n }>(client, CHANGE_REQUEST_DATA_SILO_STATUS, {\n variables: {\n requestDataSiloId: requestDataSilo.id,\n status,\n },\n logger,\n });\n } catch (err) {\n if (\n !err.message.includes('Client error: Request must be active:') &&\n !err.message.includes('Failed to find RequestDataSilo')\n ) {\n throw err;\n }\n }\n\n total += 1;\n progressBar.update(total);\n },\n { concurrency },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(colors.green(`Successfully notified Transcend in \"${totalTime / 1000}\" seconds!`));\n return requestIds.length;\n}\n"],"mappings":"yYAoBA,eAAsB,EAAgC,CACpD,aACA,aACA,OACA,cAAc,IACd,SAAS,EAAsB,SAC/B,eAAe,GAcG,CAElB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAK,IAAI,MAAM,CAAC,SAAS,CAEzB,EAAc,IAAI,EAAY,UAAU,EAAE,CAAE,EAAY,QAAQ,eAAe,CAGrF,EAAO,KACL,EAAO,QACL,sCAAsC,EAAW,aAAa,EAAW,OAAO,0BACjF,CACF,CAED,IAAI,EAAQ,EACZ,EAAY,MAAM,EAAW,OAAQ,EAAE,CACvC,MAAM,EACJ,EACA,KAAO,IAAc,CACnB,IAAM,EAAkB,MAAM,EAAqB,EAAQ,CACzD,SACA,SAAU,CAAE,YAAW,aAAY,CACpC,CAAC,CAEF,GAAI,CACF,MAAM,EAGH,EAAQ,EAAiC,CAC1C,UAAW,CACT,kBAAmB,EAAgB,GACnC,SACD,CACD,SACD,CAAC,OACK,EAAK,CACZ,GACE,CAAC,EAAI,QAAQ,SAAS,wCAAwC,EAC9D,CAAC,EAAI,QAAQ,SAAS,iCAAiC,CAEvD,MAAM,EAIV,GAAS,EACT,EAAY,OAAO,EAAM,EAE3B,CAAE,cAAa,CAChB,CAED,EAAY,MAAM,CAElB,IAAM,EADK,IAAI,MAAM,CAAC,SACF,CAAG,EAGvB,OADA,EAAO,KAAK,EAAO,MAAM,uCAAuC,EAAY,IAAK,YAAY,CAAC,CACvF,EAAW"}
@@ -1,2 +1,2 @@
1
- import{a as e}from"./constants-CVdC1nK_.mjs";import{t}from"./logger-Bj782ZYD.mjs";import{o as n}from"./request-DfkRPQFr.mjs";import{r}from"./fetchAllRequests-CHHdyb4Q.mjs";import{RequestStatus as i}from"@transcend-io/privacy-types";import a from"colors";import{buildTranscendGraphQLClient as o,makeGraphQLRequest as s}from"@transcend-io/sdk";import{map as c}from"@transcend-io/utils";import l from"cli-progress";async function u({requestActions:u,auth:d,requestIds:f,statuses:p=[i.Compiling,i.RequestMade,i.Delayed,i.Approving,i.Secondary,i.Enriching,i.Waiting,i.SecondaryApproving],createdAtAfter:m,createdAtBefore:h,updatedAtBefore:g,updatedAtAfter:_,concurrency:v=100,transcendUrl:y=e}){let b=o(y,d),x=new Date().getTime(),S=new l.SingleBar({},l.Presets.shades_classic),C=await r(b,{actions:u,statuses:p,createdAtBefore:h,createdAtAfter:m,updatedAtBefore:g,updatedAtAfter:_,isSilent:!1,requestIds:f});t.info(a.magenta(`Marking "${C.length}" as silent mode.`));let w=0;S.start(C.length,0),await c(C,async e=>{await s(b,n,{variables:{input:{id:e.id,isSilent:!0}},logger:t}),w+=1,S.update(w)},{concurrency:v}),S.stop();let T=new Date().getTime()-x;return t.info(a.green(`Successfully marked ${w} requests as silent mode in "${T/1e3}" seconds!`)),C.length}export{u as t};
2
- //# sourceMappingURL=markSilentPrivacyRequests-CaW2kbbn.mjs.map
1
+ import{a as e}from"./constants-CY1i6J69.mjs";import{t}from"./logger-Bj782ZYD.mjs";import{o as n}from"./request-DfkRPQFr.mjs";import{r}from"./fetchAllRequests-CHHdyb4Q.mjs";import{RequestStatus as i}from"@transcend-io/privacy-types";import a from"colors";import{buildTranscendGraphQLClient as o,makeGraphQLRequest as s}from"@transcend-io/sdk";import{map as c}from"@transcend-io/utils";import l from"cli-progress";async function u({requestActions:u,auth:d,requestIds:f,statuses:p=[i.Compiling,i.RequestMade,i.Delayed,i.Approving,i.Secondary,i.Enriching,i.Waiting,i.SecondaryApproving],createdAtAfter:m,createdAtBefore:h,updatedAtBefore:g,updatedAtAfter:_,concurrency:v=100,transcendUrl:y=e}){let b=o(y,d),x=new Date().getTime(),S=new l.SingleBar({},l.Presets.shades_classic),C=await r(b,{actions:u,statuses:p,createdAtBefore:h,createdAtAfter:m,updatedAtBefore:g,updatedAtAfter:_,isSilent:!1,requestIds:f});t.info(a.magenta(`Marking "${C.length}" as silent mode.`));let w=0;S.start(C.length,0),await c(C,async e=>{await s(b,n,{variables:{input:{id:e.id,isSilent:!0}},logger:t}),w+=1,S.update(w)},{concurrency:v}),S.stop();let T=new Date().getTime()-x;return t.info(a.green(`Successfully marked ${w} requests as silent mode in "${T/1e3}" seconds!`)),C.length}export{u as t};
2
+ //# sourceMappingURL=markSilentPrivacyRequests-DpV3i0hX.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"markSilentPrivacyRequests-CaW2kbbn.mjs","names":[],"sources":["../src/lib/requests/markSilentPrivacyRequests.ts"],"sourcesContent":["import { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient, makeGraphQLRequest } from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { UPDATE_PRIVACY_REQUEST, fetchAllRequests } from '../graphql/index.js';\n\n/**\n * Mark a set of privacy requests to be in silent mode\n *\n * @param options - Options\n * @returns The number of requests marked silent\n */\nexport async function markSilentPrivacyRequests({\n requestActions,\n auth,\n requestIds,\n statuses = [\n RequestStatus.Compiling,\n RequestStatus.RequestMade,\n RequestStatus.Delayed,\n RequestStatus.Approving,\n RequestStatus.Secondary,\n RequestStatus.Enriching,\n RequestStatus.Waiting,\n RequestStatus.SecondaryApproving,\n ],\n createdAtAfter,\n createdAtBefore,\n updatedAtBefore,\n updatedAtAfter,\n concurrency = 100,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** The request actions that should be restarted */\n requestActions: RequestAction[];\n /** Transcend API key authentication */\n auth: string;\n /** Concurrency limit for approving */\n concurrency?: number;\n /** The request statuses to mark silent */\n statuses?: RequestStatus[];\n /** The set of privacy requests to mark silent */\n requestIds?: string[];\n /** Filter for requests created before this date */\n createdAtBefore?: Date;\n /** Filter for requests created after this date */\n createdAtAfter?: Date;\n /** Filter for requests updated before this date */\n updatedAtBefore?: Date;\n /** Filter for requests updated after this date */\n updatedAtAfter?: Date;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<number> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n\n // Pull in the requests\n const allRequests = await fetchAllRequests(client, {\n actions: requestActions,\n statuses,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n isSilent: false,\n requestIds,\n });\n\n // Notify Transcend\n logger.info(colors.magenta(`Marking \"${allRequests.length}\" as silent mode.`));\n\n let total = 0;\n progressBar.start(allRequests.length, 0);\n await map(\n allRequests,\n async (requestToMarkSilent) => {\n await makeGraphQLRequest(client, UPDATE_PRIVACY_REQUEST, {\n variables: {\n input: {\n id: requestToMarkSilent.id,\n isSilent: true,\n },\n },\n logger,\n });\n\n total += 1;\n progressBar.update(total);\n },\n { concurrency },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully marked ${total} requests as silent mode in \"${totalTime / 1000}\" seconds!`,\n ),\n );\n return allRequests.length;\n}\n"],"mappings":"4ZAgBA,eAAsB,EAA0B,CAC9C,iBACA,OACA,aACA,WAAW,CACT,EAAc,UACd,EAAc,YACd,EAAc,QACd,EAAc,UACd,EAAc,UACd,EAAc,UACd,EAAc,QACd,EAAc,mBACf,CACD,iBACA,kBACA,kBACA,iBACA,cAAc,IACd,eAAe,GAsBG,CAElB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAK,IAAI,MAAM,CAAC,SAAS,CAEzB,EAAc,IAAI,EAAY,UAAU,EAAE,CAAE,EAAY,QAAQ,eAAe,CAG/E,EAAc,MAAM,EAAiB,EAAQ,CACjD,QAAS,EACT,WACA,kBACA,iBACA,kBACA,iBACA,SAAU,GACV,aACD,CAAC,CAGF,EAAO,KAAK,EAAO,QAAQ,YAAY,EAAY,OAAO,mBAAmB,CAAC,CAE9E,IAAI,EAAQ,EACZ,EAAY,MAAM,EAAY,OAAQ,EAAE,CACxC,MAAM,EACJ,EACA,KAAO,IAAwB,CAC7B,MAAM,EAAmB,EAAQ,EAAwB,CACvD,UAAW,CACT,MAAO,CACL,GAAI,EAAoB,GACxB,SAAU,GACX,CACF,CACD,SACD,CAAC,CAEF,GAAS,EACT,EAAY,OAAO,EAAM,EAE3B,CAAE,cAAa,CAChB,CAED,EAAY,MAAM,CAElB,IAAM,EADK,IAAI,MAAM,CAAC,SACF,CAAG,EAOvB,OALA,EAAO,KACL,EAAO,MACL,uBAAuB,EAAM,+BAA+B,EAAY,IAAK,YAC9E,CACF,CACM,EAAY"}
1
+ {"version":3,"file":"markSilentPrivacyRequests-DpV3i0hX.mjs","names":[],"sources":["../src/lib/requests/markSilentPrivacyRequests.ts"],"sourcesContent":["import { RequestAction, RequestStatus } from '@transcend-io/privacy-types';\nimport { buildTranscendGraphQLClient, makeGraphQLRequest } from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { UPDATE_PRIVACY_REQUEST, fetchAllRequests } from '../graphql/index.js';\n\n/**\n * Mark a set of privacy requests to be in silent mode\n *\n * @param options - Options\n * @returns The number of requests marked silent\n */\nexport async function markSilentPrivacyRequests({\n requestActions,\n auth,\n requestIds,\n statuses = [\n RequestStatus.Compiling,\n RequestStatus.RequestMade,\n RequestStatus.Delayed,\n RequestStatus.Approving,\n RequestStatus.Secondary,\n RequestStatus.Enriching,\n RequestStatus.Waiting,\n RequestStatus.SecondaryApproving,\n ],\n createdAtAfter,\n createdAtBefore,\n updatedAtBefore,\n updatedAtAfter,\n concurrency = 100,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** The request actions that should be restarted */\n requestActions: RequestAction[];\n /** Transcend API key authentication */\n auth: string;\n /** Concurrency limit for approving */\n concurrency?: number;\n /** The request statuses to mark silent */\n statuses?: RequestStatus[];\n /** The set of privacy requests to mark silent */\n requestIds?: string[];\n /** Filter for requests created before this date */\n createdAtBefore?: Date;\n /** Filter for requests created after this date */\n createdAtAfter?: Date;\n /** Filter for requests updated before this date */\n updatedAtBefore?: Date;\n /** Filter for requests updated after this date */\n updatedAtAfter?: Date;\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<number> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n\n // Pull in the requests\n const allRequests = await fetchAllRequests(client, {\n actions: requestActions,\n statuses,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n isSilent: false,\n requestIds,\n });\n\n // Notify Transcend\n logger.info(colors.magenta(`Marking \"${allRequests.length}\" as silent mode.`));\n\n let total = 0;\n progressBar.start(allRequests.length, 0);\n await map(\n allRequests,\n async (requestToMarkSilent) => {\n await makeGraphQLRequest(client, UPDATE_PRIVACY_REQUEST, {\n variables: {\n input: {\n id: requestToMarkSilent.id,\n isSilent: true,\n },\n },\n logger,\n });\n\n total += 1;\n progressBar.update(total);\n },\n { concurrency },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully marked ${total} requests as silent mode in \"${totalTime / 1000}\" seconds!`,\n ),\n );\n return allRequests.length;\n}\n"],"mappings":"4ZAgBA,eAAsB,EAA0B,CAC9C,iBACA,OACA,aACA,WAAW,CACT,EAAc,UACd,EAAc,YACd,EAAc,QACd,EAAc,UACd,EAAc,UACd,EAAc,UACd,EAAc,QACd,EAAc,mBACf,CACD,iBACA,kBACA,kBACA,iBACA,cAAc,IACd,eAAe,GAsBG,CAElB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAK,IAAI,MAAM,CAAC,SAAS,CAEzB,EAAc,IAAI,EAAY,UAAU,EAAE,CAAE,EAAY,QAAQ,eAAe,CAG/E,EAAc,MAAM,EAAiB,EAAQ,CACjD,QAAS,EACT,WACA,kBACA,iBACA,kBACA,iBACA,SAAU,GACV,aACD,CAAC,CAGF,EAAO,KAAK,EAAO,QAAQ,YAAY,EAAY,OAAO,mBAAmB,CAAC,CAE9E,IAAI,EAAQ,EACZ,EAAY,MAAM,EAAY,OAAQ,EAAE,CACxC,MAAM,EACJ,EACA,KAAO,IAAwB,CAC7B,MAAM,EAAmB,EAAQ,EAAwB,CACvD,UAAW,CACT,MAAO,CACL,GAAI,EAAoB,GACxB,SAAU,GACX,CACF,CACD,SACD,CAAC,CAEF,GAAS,EACT,EAAY,OAAO,EAAM,EAE3B,CAAE,cAAa,CAChB,CAED,EAAY,MAAM,CAElB,IAAM,EADK,IAAI,MAAM,CAAC,SACF,CAAG,EAOvB,OALA,EAAO,KACL,EAAO,MACL,uBAAuB,EAAM,+BAA+B,EAAY,IAAK,YAC9E,CACF,CACM,EAAY"}
@@ -1,2 +1,2 @@
1
- import{a as e}from"./constants-CVdC1nK_.mjs";import{t}from"./logger-Bj782ZYD.mjs";import{r as n}from"./request-DfkRPQFr.mjs";import{r}from"./fetchAllRequests-CHHdyb4Q.mjs";import{RequestAction as i}from"@transcend-io/privacy-types";import a from"colors";import{buildTranscendGraphQLClient as o,fetchAllTemplates as s,makeGraphQLRequest as c}from"@transcend-io/sdk";import{map as l}from"@transcend-io/utils";import u from"cli-progress";async function d({requestActions:d=Object.values(i),auth:f,requestIds:p,createdAtBefore:m,days:h=45,daysLeft:g=10,createdAtAfter:_,updatedAtBefore:v,updatedAtAfter:y,emailTemplate:b=`Additional Time Needed`,concurrency:x=100,transcendUrl:S=e}){let C=o(S,f),w=new Date().getTime(),T=new u.SingleBar({},u.Presets.shades_classic),E=(await s(C,{logger:t,filterBy:{title:b}})).find(e=>e.title===b);if(!E)throw Error(`Failed to find a template with title: "${b}"`);let D=await r(C,{actions:d,createdAtBefore:m,createdAtAfter:_,updatedAtBefore:v,updatedAtAfter:y,isSilent:!1,isClosed:!1,requestIds:p});D=D.filter(e=>typeof e.daysRemaining==`number`&&e.daysRemaining<g),t.info(a.magenta(`Notifying "${D.length}" that more time is needed.`));let O=0;T.start(D.length,0),await l(D,async e=>{await c(C,n,{variables:{input:{requestId:e.id,template:E.template.defaultMessage,subject:E.subject.defaultMessage,additionalTime:h}},logger:t}),O+=1,T.update(O)},{concurrency:x}),T.stop();let k=new Date().getTime()-w;return t.info(a.green(`Successfully marked ${O} requests as silent mode in "${k/1e3}" seconds!`)),D.length}export{d as t};
2
- //# sourceMappingURL=notifyPrivacyRequestsAdditionalTime-GcUtfuzA.mjs.map
1
+ import{a as e}from"./constants-CY1i6J69.mjs";import{t}from"./logger-Bj782ZYD.mjs";import{r as n}from"./request-DfkRPQFr.mjs";import{r}from"./fetchAllRequests-CHHdyb4Q.mjs";import{RequestAction as i}from"@transcend-io/privacy-types";import a from"colors";import{buildTranscendGraphQLClient as o,fetchAllTemplates as s,makeGraphQLRequest as c}from"@transcend-io/sdk";import{map as l}from"@transcend-io/utils";import u from"cli-progress";async function d({requestActions:d=Object.values(i),auth:f,requestIds:p,createdAtBefore:m,days:h=45,daysLeft:g=10,createdAtAfter:_,updatedAtBefore:v,updatedAtAfter:y,emailTemplate:b=`Additional Time Needed`,concurrency:x=100,transcendUrl:S=e}){let C=o(S,f),w=new Date().getTime(),T=new u.SingleBar({},u.Presets.shades_classic),E=(await s(C,{logger:t,filterBy:{title:b}})).find(e=>e.title===b);if(!E)throw Error(`Failed to find a template with title: "${b}"`);let D=await r(C,{actions:d,createdAtBefore:m,createdAtAfter:_,updatedAtBefore:v,updatedAtAfter:y,isSilent:!1,isClosed:!1,requestIds:p});D=D.filter(e=>typeof e.daysRemaining==`number`&&e.daysRemaining<g),t.info(a.magenta(`Notifying "${D.length}" that more time is needed.`));let O=0;T.start(D.length,0),await l(D,async e=>{await c(C,n,{variables:{input:{requestId:e.id,template:E.template.defaultMessage,subject:E.subject.defaultMessage,additionalTime:h}},logger:t}),O+=1,T.update(O)},{concurrency:x}),T.stop();let k=new Date().getTime()-w;return t.info(a.green(`Successfully marked ${O} requests as silent mode in "${k/1e3}" seconds!`)),D.length}export{d as t};
2
+ //# sourceMappingURL=notifyPrivacyRequestsAdditionalTime-BDipeYtR.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"notifyPrivacyRequestsAdditionalTime-GcUtfuzA.mjs","names":[],"sources":["../src/lib/requests/notifyPrivacyRequestsAdditionalTime.ts"],"sourcesContent":["import { RequestAction } from '@transcend-io/privacy-types';\nimport {\n buildTranscendGraphQLClient,\n fetchAllTemplates,\n makeGraphQLRequest,\n} from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { NOTIFY_ADDITIONAL_TIME, fetchAllRequests } from '../graphql/index.js';\n\n/**\n * Mark a set of privacy requests to be in silent mode.\n * Note requests in silent mode are ignored\n *\n * @param options - Options\n * @returns The number of requests marked silent\n */\nexport async function notifyPrivacyRequestsAdditionalTime({\n requestActions = Object.values(RequestAction),\n auth,\n requestIds,\n createdAtBefore,\n days = 45,\n daysLeft = 10,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n emailTemplate = 'Additional Time Needed',\n concurrency = 100,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** The request actions that should be restarted */\n requestActions?: RequestAction[];\n /** Filter for requests created before this date */\n createdAtBefore: Date;\n /** Filter for requests created after this date */\n createdAtAfter?: Date;\n /** Filter for requests updated before this date */\n updatedAtBefore?: Date;\n /** Filter for requests updated after this date */\n updatedAtAfter?: Date;\n /** Email template */\n emailTemplate?: string;\n /** Transcend API key authentication */\n auth: string;\n /** Number of days to extend request by */\n days?: number;\n /**\n * Only notify requests that have less than this number of days until they are considered expired.\n * This allows for re-running the command without notifying the same users multiple times\n */\n daysLeft?: number;\n /** Concurrency limit for approving */\n concurrency?: number;\n /** The set of privacy requests to notify */\n requestIds?: string[];\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<number> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n\n // Grab the template with that title\n const matchingTemplates = await fetchAllTemplates(client, {\n logger,\n filterBy: { title: emailTemplate },\n });\n const exactTemplateMatch = matchingTemplates.find((template) => template.title === emailTemplate);\n if (!exactTemplateMatch) {\n throw new Error(`Failed to find a template with title: \"${emailTemplate}\"`);\n }\n\n // Pull in the requests\n let allRequests = await fetchAllRequests(client, {\n actions: requestActions,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n isSilent: false,\n isClosed: false,\n requestIds,\n });\n\n // Filter requests by daysLeft\n allRequests = allRequests.filter(\n (request) => typeof request.daysRemaining === 'number' && request.daysRemaining < daysLeft,\n );\n\n // Notify Transcend\n logger.info(colors.magenta(`Notifying \"${allRequests.length}\" that more time is needed.`));\n\n let total = 0;\n progressBar.start(allRequests.length, 0);\n await map(\n allRequests,\n async (requestToNotify) => {\n await makeGraphQLRequest(client, NOTIFY_ADDITIONAL_TIME, {\n variables: {\n input: {\n requestId: requestToNotify.id,\n template: exactTemplateMatch.template.defaultMessage,\n subject: exactTemplateMatch.subject.defaultMessage,\n additionalTime: days,\n },\n },\n logger,\n });\n\n total += 1;\n progressBar.update(total);\n },\n { concurrency },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully marked ${total} requests as silent mode in \"${totalTime / 1000}\" seconds!`,\n ),\n );\n return allRequests.length;\n}\n"],"mappings":"mbAqBA,eAAsB,EAAoC,CACxD,iBAAiB,OAAO,OAAO,EAAc,CAC7C,OACA,aACA,kBACA,OAAO,GACP,WAAW,GACX,iBACA,kBACA,iBACA,gBAAgB,yBAChB,cAAc,IACd,eAAe,GA6BG,CAElB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAK,IAAI,MAAM,CAAC,SAAS,CAEzB,EAAc,IAAI,EAAY,UAAU,EAAE,CAAE,EAAY,QAAQ,eAAe,CAO/E,GAAqB,MAJK,EAAkB,EAAQ,CACxD,SACA,SAAU,CAAE,MAAO,EAAe,CACnC,CAAC,EAC2C,KAAM,GAAa,EAAS,QAAU,EAAc,CACjG,GAAI,CAAC,EACH,MAAU,MAAM,0CAA0C,EAAc,GAAG,CAI7E,IAAI,EAAc,MAAM,EAAiB,EAAQ,CAC/C,QAAS,EACT,kBACA,iBACA,kBACA,iBACA,SAAU,GACV,SAAU,GACV,aACD,CAAC,CAGF,EAAc,EAAY,OACvB,GAAY,OAAO,EAAQ,eAAkB,UAAY,EAAQ,cAAgB,EACnF,CAGD,EAAO,KAAK,EAAO,QAAQ,cAAc,EAAY,OAAO,6BAA6B,CAAC,CAE1F,IAAI,EAAQ,EACZ,EAAY,MAAM,EAAY,OAAQ,EAAE,CACxC,MAAM,EACJ,EACA,KAAO,IAAoB,CACzB,MAAM,EAAmB,EAAQ,EAAwB,CACvD,UAAW,CACT,MAAO,CACL,UAAW,EAAgB,GAC3B,SAAU,EAAmB,SAAS,eACtC,QAAS,EAAmB,QAAQ,eACpC,eAAgB,EACjB,CACF,CACD,SACD,CAAC,CAEF,GAAS,EACT,EAAY,OAAO,EAAM,EAE3B,CAAE,cAAa,CAChB,CAED,EAAY,MAAM,CAElB,IAAM,EADK,IAAI,MAAM,CAAC,SACF,CAAG,EAOvB,OALA,EAAO,KACL,EAAO,MACL,uBAAuB,EAAM,+BAA+B,EAAY,IAAK,YAC9E,CACF,CACM,EAAY"}
1
+ {"version":3,"file":"notifyPrivacyRequestsAdditionalTime-BDipeYtR.mjs","names":[],"sources":["../src/lib/requests/notifyPrivacyRequestsAdditionalTime.ts"],"sourcesContent":["import { RequestAction } from '@transcend-io/privacy-types';\nimport {\n buildTranscendGraphQLClient,\n fetchAllTemplates,\n makeGraphQLRequest,\n} from '@transcend-io/sdk';\nimport { map } from '@transcend-io/utils';\nimport cliProgress from 'cli-progress';\nimport colors from 'colors';\n\nimport { DEFAULT_TRANSCEND_API } from '../../constants.js';\nimport { logger } from '../../logger.js';\nimport { NOTIFY_ADDITIONAL_TIME, fetchAllRequests } from '../graphql/index.js';\n\n/**\n * Mark a set of privacy requests to be in silent mode.\n * Note requests in silent mode are ignored\n *\n * @param options - Options\n * @returns The number of requests marked silent\n */\nexport async function notifyPrivacyRequestsAdditionalTime({\n requestActions = Object.values(RequestAction),\n auth,\n requestIds,\n createdAtBefore,\n days = 45,\n daysLeft = 10,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n emailTemplate = 'Additional Time Needed',\n concurrency = 100,\n transcendUrl = DEFAULT_TRANSCEND_API,\n}: {\n /** The request actions that should be restarted */\n requestActions?: RequestAction[];\n /** Filter for requests created before this date */\n createdAtBefore: Date;\n /** Filter for requests created after this date */\n createdAtAfter?: Date;\n /** Filter for requests updated before this date */\n updatedAtBefore?: Date;\n /** Filter for requests updated after this date */\n updatedAtAfter?: Date;\n /** Email template */\n emailTemplate?: string;\n /** Transcend API key authentication */\n auth: string;\n /** Number of days to extend request by */\n days?: number;\n /**\n * Only notify requests that have less than this number of days until they are considered expired.\n * This allows for re-running the command without notifying the same users multiple times\n */\n daysLeft?: number;\n /** Concurrency limit for approving */\n concurrency?: number;\n /** The set of privacy requests to notify */\n requestIds?: string[];\n /** API URL for Transcend backend */\n transcendUrl?: string;\n}): Promise<number> {\n // Find all requests made before createdAt that are in a removing data state\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Time duration\n const t0 = new Date().getTime();\n // create a new progress bar instance and use shades_classic theme\n const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);\n\n // Grab the template with that title\n const matchingTemplates = await fetchAllTemplates(client, {\n logger,\n filterBy: { title: emailTemplate },\n });\n const exactTemplateMatch = matchingTemplates.find((template) => template.title === emailTemplate);\n if (!exactTemplateMatch) {\n throw new Error(`Failed to find a template with title: \"${emailTemplate}\"`);\n }\n\n // Pull in the requests\n let allRequests = await fetchAllRequests(client, {\n actions: requestActions,\n createdAtBefore,\n createdAtAfter,\n updatedAtBefore,\n updatedAtAfter,\n isSilent: false,\n isClosed: false,\n requestIds,\n });\n\n // Filter requests by daysLeft\n allRequests = allRequests.filter(\n (request) => typeof request.daysRemaining === 'number' && request.daysRemaining < daysLeft,\n );\n\n // Notify Transcend\n logger.info(colors.magenta(`Notifying \"${allRequests.length}\" that more time is needed.`));\n\n let total = 0;\n progressBar.start(allRequests.length, 0);\n await map(\n allRequests,\n async (requestToNotify) => {\n await makeGraphQLRequest(client, NOTIFY_ADDITIONAL_TIME, {\n variables: {\n input: {\n requestId: requestToNotify.id,\n template: exactTemplateMatch.template.defaultMessage,\n subject: exactTemplateMatch.subject.defaultMessage,\n additionalTime: days,\n },\n },\n logger,\n });\n\n total += 1;\n progressBar.update(total);\n },\n { concurrency },\n );\n\n progressBar.stop();\n const t1 = new Date().getTime();\n const totalTime = t1 - t0;\n\n logger.info(\n colors.green(\n `Successfully marked ${total} requests as silent mode in \"${totalTime / 1000}\" seconds!`,\n ),\n );\n return allRequests.length;\n}\n"],"mappings":"mbAqBA,eAAsB,EAAoC,CACxD,iBAAiB,OAAO,OAAO,EAAc,CAC7C,OACA,aACA,kBACA,OAAO,GACP,WAAW,GACX,iBACA,kBACA,iBACA,gBAAgB,yBAChB,cAAc,IACd,eAAe,GA6BG,CAElB,IAAM,EAAS,EAA4B,EAAc,EAAK,CAGxD,EAAK,IAAI,MAAM,CAAC,SAAS,CAEzB,EAAc,IAAI,EAAY,UAAU,EAAE,CAAE,EAAY,QAAQ,eAAe,CAO/E,GAAqB,MAJK,EAAkB,EAAQ,CACxD,SACA,SAAU,CAAE,MAAO,EAAe,CACnC,CAAC,EAC2C,KAAM,GAAa,EAAS,QAAU,EAAc,CACjG,GAAI,CAAC,EACH,MAAU,MAAM,0CAA0C,EAAc,GAAG,CAI7E,IAAI,EAAc,MAAM,EAAiB,EAAQ,CAC/C,QAAS,EACT,kBACA,iBACA,kBACA,iBACA,SAAU,GACV,SAAU,GACV,aACD,CAAC,CAGF,EAAc,EAAY,OACvB,GAAY,OAAO,EAAQ,eAAkB,UAAY,EAAQ,cAAgB,EACnF,CAGD,EAAO,KAAK,EAAO,QAAQ,cAAc,EAAY,OAAO,6BAA6B,CAAC,CAE1F,IAAI,EAAQ,EACZ,EAAY,MAAM,EAAY,OAAQ,EAAE,CACxC,MAAM,EACJ,EACA,KAAO,IAAoB,CACzB,MAAM,EAAmB,EAAQ,EAAwB,CACvD,UAAW,CACT,MAAO,CACL,UAAW,EAAgB,GAC3B,SAAU,EAAmB,SAAS,eACtC,QAAS,EAAmB,QAAQ,eACpC,eAAgB,EACjB,CACF,CACD,SACD,CAAC,CAEF,GAAS,EACT,EAAY,OAAO,EAAM,EAE3B,CAAE,cAAa,CAChB,CAED,EAAY,MAAM,CAElB,IAAM,EADK,IAAI,MAAM,CAAC,SACF,CAAG,EAOvB,OALA,EAAO,KACL,EAAO,MACL,uBAAuB,EAAM,+BAA+B,EAAY,IAAK,YAC9E,CACF,CACM,EAAY"}
@@ -1,2 +1,2 @@
1
- import{a as e}from"./constants-CVdC1nK_.mjs";import{t}from"./logger-Bj782ZYD.mjs";import{decodeCodec as n}from"@transcend-io/type-utils";import r from"colors";import*as i from"io-ts";import{REDUCED_REQUESTS_FOR_DATA_SILO_COUNT as a,buildTranscendGraphQLClient as o,createSombraGotInstance as s,makeGraphQLRequest as c,withTransientRetry as l}from"@transcend-io/sdk";import{mapSeries as u}from"@transcend-io/utils";import d from"cli-progress";async function f(e,{dataSiloId:n}){let{listReducedRequestsForDataSilo:{totalCount:r}}=await c(e,a,{variables:{input:{dataSiloId:n,isResolved:!1}},logger:t});return r}const p=i.type({id:i.string,name:i.string,partition:i.string}),m=i.intersection([i.type({identifier:i.string,type:i.string,coreIdentifier:i.string,dataSiloId:i.string,requestId:i.string,nonce:i.string,requestCreatedAt:i.string,daysUntilOverdue:i.number,attributes:i.array(i.type({key:i.string,values:i.array(i.string)}))}),i.partial({partition:i.union([p,i.null])})]);async function h(e,{dataSiloId:r,limit:a=100,offset:o=0,requestType:s}){try{let c=await l(`pullCronPageOfIdentifiers`,()=>e.get(`v1/data-silo/${r}/pending-requests/${s}`,{searchParams:{offset:o,limit:a}}).json(),{logger:t,maxAttempts:6,baseDelayMs:500}),{items:u}=n(i.type({items:i.array(m)}),c);return u}catch(e){throw Error(`Received an error from server: ${e?.response?.body||e?.message}`)}}async function g({dataSiloId:n,auth:i,sombraAuth:a,actions:c,apiPageSize:l=100,savePageSize:p=1e3,onSave:m,transcendUrl:g=e,skipRequestCount:_=!1}){if(p%l!==0)throw Error(`savePageSize must be a multiple of apiPageSize. savePageSize: ${p}, apiPageSize: ${l}`);let v=await s(g,i,{logger:t,sombraApiKey:a,sombraUrl:process.env.SOMBRA_URL}),y=o(g,i),b=0;_||(b=await f(y,{dataSiloId:n})),t.info(r.magenta(`Pulling ${_?`all`:b} outstanding request identifiers for data silo: "${n}" for requests of types "${c.join(`", "`)}"`));let x=new Date().getTime(),S=new d.SingleBar({},d.Presets.shades_classic),C=new Set,w=[],T=[];_||S.start(b,0),await u(c,async e=>{let i=0,a=!0;for(;a;){let o=await h(v,{dataSiloId:n,limit:l,offset:i,requestType:e}),s=o.map(t=>(C.add(t.requestId),{...t,action:e})),c=s.map(({attributes:e,partition:t,...n})=>({...n,...t?{partitionId:t.id,partitionName:t.name,partitionKey:t.partition}:{},...e.reduce((e,t)=>Object.assign(e,{[t.key]:t.values.join(`,`)}),{})}));w.push(...s),T.push(...c),T.length>=p&&(await m(T),T=[]),a=o.length===l,i+=l,_?t.info(r.magenta(`Pulled ${o.length} outstanding identifiers for ${C.size} requests`)):S.update(C.size)}}),T.length>0&&await m(T),_||S.stop();let E=new Date().getTime()-x;return t.info(r.green(`Successfully pulled ${w.length} outstanding identifiers from ${C.size} requests in "${E/1e3}" seconds!`)),{identifiers:w}}export{f as a,h as i,m as n,p as r,g as t};
2
- //# sourceMappingURL=pullChunkedCustomSiloOutstandingIdentifiers-CeyJB-lD.mjs.map
1
+ import{a as e}from"./constants-CY1i6J69.mjs";import{t}from"./logger-Bj782ZYD.mjs";import{decodeCodec as n}from"@transcend-io/type-utils";import r from"colors";import*as i from"io-ts";import{REDUCED_REQUESTS_FOR_DATA_SILO_COUNT as a,buildTranscendGraphQLClient as o,createSombraGotInstance as s,makeGraphQLRequest as c,withTransientRetry as l}from"@transcend-io/sdk";import{mapSeries as u}from"@transcend-io/utils";import d from"cli-progress";async function f(e,{dataSiloId:n}){let{listReducedRequestsForDataSilo:{totalCount:r}}=await c(e,a,{variables:{input:{dataSiloId:n,isResolved:!1}},logger:t});return r}const p=i.type({id:i.string,name:i.string,partition:i.string}),m=i.intersection([i.type({identifier:i.string,type:i.string,coreIdentifier:i.string,dataSiloId:i.string,requestId:i.string,nonce:i.string,requestCreatedAt:i.string,daysUntilOverdue:i.number,attributes:i.array(i.type({key:i.string,values:i.array(i.string)}))}),i.partial({partition:i.union([p,i.null])})]);async function h(e,{dataSiloId:r,limit:a=100,offset:o=0,requestType:s}){try{let c=await l(`pullCronPageOfIdentifiers`,()=>e.get(`v1/data-silo/${r}/pending-requests/${s}`,{searchParams:{offset:o,limit:a}}).json(),{logger:t,maxAttempts:6,baseDelayMs:500}),{items:u}=n(i.type({items:i.array(m)}),c);return u}catch(e){throw Error(`Received an error from server: ${e?.response?.body||e?.message}`)}}async function g({dataSiloId:n,auth:i,sombraAuth:a,actions:c,apiPageSize:l=100,savePageSize:p=1e3,onSave:m,transcendUrl:g=e,skipRequestCount:_=!1}){if(p%l!==0)throw Error(`savePageSize must be a multiple of apiPageSize. savePageSize: ${p}, apiPageSize: ${l}`);let v=await s(g,i,{logger:t,sombraApiKey:a,sombraUrl:process.env.SOMBRA_URL}),y=o(g,i),b=0;_||(b=await f(y,{dataSiloId:n})),t.info(r.magenta(`Pulling ${_?`all`:b} outstanding request identifiers for data silo: "${n}" for requests of types "${c.join(`", "`)}"`));let x=new Date().getTime(),S=new d.SingleBar({},d.Presets.shades_classic),C=new Set,w=[],T=[];_||S.start(b,0),await u(c,async e=>{let i=0,a=!0;for(;a;){let o=await h(v,{dataSiloId:n,limit:l,offset:i,requestType:e}),s=o.map(t=>(C.add(t.requestId),{...t,action:e})),c=s.map(({attributes:e,partition:t,...n})=>({...n,...t?{partitionId:t.id,partitionName:t.name,partitionKey:t.partition}:{},...e.reduce((e,t)=>Object.assign(e,{[t.key]:t.values.join(`,`)}),{})}));w.push(...s),T.push(...c),T.length>=p&&(await m(T),T=[]),a=o.length===l,i+=l,_?t.info(r.magenta(`Pulled ${o.length} outstanding identifiers for ${C.size} requests`)):S.update(C.size)}}),T.length>0&&await m(T),_||S.stop();let E=new Date().getTime()-x;return t.info(r.green(`Successfully pulled ${w.length} outstanding identifiers from ${C.size} requests in "${E/1e3}" seconds!`)),{identifiers:w}}export{f as a,h as i,m as n,p as r,g as t};
2
+ //# sourceMappingURL=pullChunkedCustomSiloOutstandingIdentifiers-BSDvt77x.mjs.map