@transcend-io/cli 13.0.6 → 13.0.7

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 (146) hide show
  1. package/README.md +2 -2
  2. package/dist/{app-CgHCDGve.mjs → app-CO1O5Hkp.mjs} +16 -16
  3. package/dist/{app-CgHCDGve.mjs.map → app-CO1O5Hkp.mjs.map} +1 -1
  4. package/dist/{approvePrivacyRequests-BrnJ-CVF.mjs → approvePrivacyRequests-Dp391N0W.mjs} +2 -2
  5. package/dist/{approvePrivacyRequests-BrnJ-CVF.mjs.map → approvePrivacyRequests-Dp391N0W.mjs.map} +1 -1
  6. package/dist/bin/bash-complete.mjs +1 -1
  7. package/dist/bin/cli.mjs +1 -1
  8. package/dist/bin/deprecated-command.mjs +1 -1
  9. package/dist/{buildExamples-CnR3Kr1g.mjs → buildExamples-CFmrB0Ib.mjs} +2 -2
  10. package/dist/{buildExamples-CnR3Kr1g.mjs.map → buildExamples-CFmrB0Ib.mjs.map} +1 -1
  11. package/dist/{buildXdiSyncEndpoint-C5d116vB.mjs → buildXdiSyncEndpoint-ClifAojB.mjs} +2 -2
  12. package/dist/{buildXdiSyncEndpoint-C5d116vB.mjs.map → buildXdiSyncEndpoint-ClifAojB.mjs.map} +1 -1
  13. package/dist/{bulkRestartRequests-C3cbvO42.mjs → bulkRestartRequests-CiBW6ccP.mjs} +2 -2
  14. package/dist/{bulkRestartRequests-C3cbvO42.mjs.map → bulkRestartRequests-CiBW6ccP.mjs.map} +1 -1
  15. package/dist/{bulkRetryEnrichers-C0Z-5oAG.mjs → bulkRetryEnrichers-CeJbLkVa.mjs} +2 -2
  16. package/dist/{bulkRetryEnrichers-C0Z-5oAG.mjs.map → bulkRetryEnrichers-CeJbLkVa.mjs.map} +1 -1
  17. package/dist/{cancelPrivacyRequests-i7HTC4_n.mjs → cancelPrivacyRequests-DHUjIs6Q.mjs} +2 -2
  18. package/dist/{cancelPrivacyRequests-i7HTC4_n.mjs.map → cancelPrivacyRequests-DHUjIs6Q.mjs.map} +1 -1
  19. package/dist/{command-hkvdh57O.mjs → command-CW2zzyZv.mjs} +2 -2
  20. package/dist/{command-hkvdh57O.mjs.map → command-CW2zzyZv.mjs.map} +1 -1
  21. package/dist/{constants-CusZYsjT.mjs → constants-COP23kS1.mjs} +2 -2
  22. package/dist/{constants-CusZYsjT.mjs.map → constants-COP23kS1.mjs.map} +1 -1
  23. package/dist/{createPoolingCommandUi-C6uf3bzG.mjs → createPoolingCommandUi-C1LcY1pb.mjs} +2 -2
  24. package/dist/{createPoolingCommandUi-C6uf3bzG.mjs.map → createPoolingCommandUi-C1LcY1pb.mjs.map} +1 -1
  25. package/dist/{downloadPrivacyRequestFiles-Do8cKTNC.mjs → downloadPrivacyRequestFiles-BWzpebA9.mjs} +2 -2
  26. package/dist/{downloadPrivacyRequestFiles-Do8cKTNC.mjs.map → downloadPrivacyRequestFiles-BWzpebA9.mjs.map} +1 -1
  27. package/dist/{generateCrossAccountApiKeys-D3EzSJV7.mjs → generateCrossAccountApiKeys-CySsayKo.mjs} +2 -2
  28. package/dist/{generateCrossAccountApiKeys-D3EzSJV7.mjs.map → generateCrossAccountApiKeys-CySsayKo.mjs.map} +1 -1
  29. package/dist/{impl-DvLO4Qn3.mjs → impl-B-0sNsEl.mjs} +2 -2
  30. package/dist/{impl-DvLO4Qn3.mjs.map → impl-B-0sNsEl.mjs.map} +1 -1
  31. package/dist/{impl-L-TZRGF5.mjs → impl-BEsnbaiX.mjs} +2 -2
  32. package/dist/{impl-L-TZRGF5.mjs.map → impl-BEsnbaiX.mjs.map} +1 -1
  33. package/dist/{impl-Dd60oodD2.mjs → impl-BH5iAw6H2.mjs} +2 -2
  34. package/dist/{impl-Dd60oodD2.mjs.map → impl-BH5iAw6H2.mjs.map} +1 -1
  35. package/dist/{impl-DnPaAp-d.mjs → impl-BLXycY43.mjs} +2 -2
  36. package/dist/{impl-DnPaAp-d.mjs.map → impl-BLXycY43.mjs.map} +1 -1
  37. package/dist/{impl-CuII9KiJ.mjs → impl-BOxmt2GG.mjs} +2 -2
  38. package/dist/{impl-CuII9KiJ.mjs.map → impl-BOxmt2GG.mjs.map} +1 -1
  39. package/dist/{impl-BUbwefXr.mjs → impl-BR8Hd6mv.mjs} +2 -2
  40. package/dist/{impl-BUbwefXr.mjs.map → impl-BR8Hd6mv.mjs.map} +1 -1
  41. package/dist/{impl-CBLQwa8E.mjs → impl-BV5F911e.mjs} +2 -2
  42. package/dist/{impl-CBLQwa8E.mjs.map → impl-BV5F911e.mjs.map} +1 -1
  43. package/dist/{impl-Cm_hCZ5h.mjs → impl-BZ-3THtu.mjs} +2 -2
  44. package/dist/{impl-Cm_hCZ5h.mjs.map → impl-BZ-3THtu.mjs.map} +1 -1
  45. package/dist/{impl-DHTAxvp8.mjs → impl-B__KKiTX.mjs} +2 -2
  46. package/dist/{impl-DHTAxvp8.mjs.map → impl-B__KKiTX.mjs.map} +1 -1
  47. package/dist/{impl-DAlYoIsj.mjs → impl-BcdEn3Fl.mjs} +2 -2
  48. package/dist/{impl-DAlYoIsj.mjs.map → impl-BcdEn3Fl.mjs.map} +1 -1
  49. package/dist/{impl-BY1HzPeX.mjs → impl-Bi6LJASv.mjs} +2 -2
  50. package/dist/{impl-BY1HzPeX.mjs.map → impl-Bi6LJASv.mjs.map} +1 -1
  51. package/dist/{impl-B964vhTe.mjs → impl-BlpM1lXA.mjs} +2 -2
  52. package/dist/{impl-B964vhTe.mjs.map → impl-BlpM1lXA.mjs.map} +1 -1
  53. package/dist/{impl-D8KUHOU8.mjs → impl-BodK3EBe.mjs} +2 -2
  54. package/dist/{impl-D8KUHOU8.mjs.map → impl-BodK3EBe.mjs.map} +1 -1
  55. package/dist/{impl-zH16n-0l.mjs → impl-C70SbLuM.mjs} +2 -2
  56. package/dist/{impl-zH16n-0l.mjs.map → impl-C70SbLuM.mjs.map} +1 -1
  57. package/dist/{impl-wymd_Y3k.mjs → impl-CDdfGdZS.mjs} +2 -2
  58. package/dist/{impl-wymd_Y3k.mjs.map → impl-CDdfGdZS.mjs.map} +1 -1
  59. package/dist/{impl-Dw-MR5nR.mjs → impl-CFd4xBgL.mjs} +2 -2
  60. package/dist/{impl-Dw-MR5nR.mjs.map → impl-CFd4xBgL.mjs.map} +1 -1
  61. package/dist/{impl-S3znb469.mjs → impl-CUMgdqIK.mjs} +2 -2
  62. package/dist/{impl-S3znb469.mjs.map → impl-CUMgdqIK.mjs.map} +1 -1
  63. package/dist/{impl-DwGZvFYI.mjs → impl-CVUB56mN.mjs} +2 -2
  64. package/dist/{impl-DwGZvFYI.mjs.map → impl-CVUB56mN.mjs.map} +1 -1
  65. package/dist/{impl-C9JlWA7i.mjs → impl-CW1o90oL.mjs} +2 -2
  66. package/dist/{impl-C9JlWA7i.mjs.map → impl-CW1o90oL.mjs.map} +1 -1
  67. package/dist/{impl-CVjaQ_-Y2.mjs → impl-CYHtZNqc2.mjs} +2 -2
  68. package/dist/{impl-CVjaQ_-Y2.mjs.map → impl-CYHtZNqc2.mjs.map} +1 -1
  69. package/dist/{impl-DwBrrrR3.mjs → impl-CYmUc_vX.mjs} +2 -2
  70. package/dist/{impl-DwBrrrR3.mjs.map → impl-CYmUc_vX.mjs.map} +1 -1
  71. package/dist/{impl-D-1QAfLV.mjs → impl-Ce8auZ7z.mjs} +2 -2
  72. package/dist/{impl-D-1QAfLV.mjs.map → impl-Ce8auZ7z.mjs.map} +1 -1
  73. package/dist/{impl-D_03KeBQ.mjs → impl-CnMcL9n5.mjs} +2 -2
  74. package/dist/{impl-D_03KeBQ.mjs.map → impl-CnMcL9n5.mjs.map} +1 -1
  75. package/dist/{impl-DLaSUiZ7.mjs → impl-CwrOulKa.mjs} +2 -2
  76. package/dist/{impl-DLaSUiZ7.mjs.map → impl-CwrOulKa.mjs.map} +1 -1
  77. package/dist/{impl-Q8a16IkZ.mjs → impl-D68Cz0sq.mjs} +2 -2
  78. package/dist/{impl-Q8a16IkZ.mjs.map → impl-D68Cz0sq.mjs.map} +1 -1
  79. package/dist/{impl-DbTZmp_W2.mjs → impl-D8k-pJS22.mjs} +2 -2
  80. package/dist/{impl-DbTZmp_W2.mjs.map → impl-D8k-pJS22.mjs.map} +1 -1
  81. package/dist/{impl-DWmQ_15Y.mjs → impl-D9OTKDPp.mjs} +2 -2
  82. package/dist/{impl-DWmQ_15Y.mjs.map → impl-D9OTKDPp.mjs.map} +1 -1
  83. package/dist/{impl-COD03bOu.mjs → impl-DEIttGUr.mjs} +2 -2
  84. package/dist/{impl-COD03bOu.mjs.map → impl-DEIttGUr.mjs.map} +1 -1
  85. package/dist/{impl-C7iC7S5D.mjs → impl-DOwpJ0Di.mjs} +2 -2
  86. package/dist/{impl-C7iC7S5D.mjs.map → impl-DOwpJ0Di.mjs.map} +1 -1
  87. package/dist/{impl-BiQ9lDze.mjs → impl-DPpvHMjb.mjs} +2 -2
  88. package/dist/{impl-BiQ9lDze.mjs.map → impl-DPpvHMjb.mjs.map} +1 -1
  89. package/dist/{impl-8kZN8w0q.mjs → impl-DemRJL6E.mjs} +2 -2
  90. package/dist/{impl-8kZN8w0q.mjs.map → impl-DemRJL6E.mjs.map} +1 -1
  91. package/dist/{impl-CALzjhEc.mjs → impl-DpDvrRiO.mjs} +2 -2
  92. package/dist/{impl-CALzjhEc.mjs.map → impl-DpDvrRiO.mjs.map} +1 -1
  93. package/dist/{impl-De1JItpM2.mjs → impl-Ex1k8tmr2.mjs} +2 -2
  94. package/dist/{impl-De1JItpM2.mjs.map → impl-Ex1k8tmr2.mjs.map} +1 -1
  95. package/dist/{impl-UlLFb3UK2.mjs → impl-Nw0Zse5L2.mjs} +2 -2
  96. package/dist/{impl-UlLFb3UK2.mjs.map → impl-Nw0Zse5L2.mjs.map} +1 -1
  97. package/dist/{impl-COpuW67i.mjs → impl-Ozpcz9ZU.mjs} +2 -2
  98. package/dist/{impl-COpuW67i.mjs.map → impl-Ozpcz9ZU.mjs.map} +1 -1
  99. package/dist/{impl-DQbP4dBX.mjs → impl-_iRsjm4-.mjs} +2 -2
  100. package/dist/{impl-DQbP4dBX.mjs.map → impl-_iRsjm4-.mjs.map} +1 -1
  101. package/dist/{impl-F0lRLx7N.mjs → impl-jDN8J2nu.mjs} +2 -2
  102. package/dist/{impl-F0lRLx7N.mjs.map → impl-jDN8J2nu.mjs.map} +1 -1
  103. package/dist/{impl-B5CqfbCN.mjs → impl-lICSh559.mjs} +2 -2
  104. package/dist/{impl-B5CqfbCN.mjs.map → impl-lICSh559.mjs.map} +1 -1
  105. package/dist/{impl-CFPN8z3c.mjs → impl-tnFsm0_E.mjs} +2 -2
  106. package/dist/{impl-CFPN8z3c.mjs.map → impl-tnFsm0_E.mjs.map} +1 -1
  107. package/dist/index.d.mts +2 -0
  108. package/dist/index.d.mts.map +1 -1
  109. package/dist/index.mjs +1 -1
  110. package/dist/{markRequestDataSiloIdsCompleted-CJdC2ta9.mjs → markRequestDataSiloIdsCompleted-8pyUnD96.mjs} +2 -2
  111. package/dist/{markRequestDataSiloIdsCompleted-CJdC2ta9.mjs.map → markRequestDataSiloIdsCompleted-8pyUnD96.mjs.map} +1 -1
  112. package/dist/{markSilentPrivacyRequests-CIjtVoXr.mjs → markSilentPrivacyRequests-B0WgT7XH.mjs} +2 -2
  113. package/dist/{markSilentPrivacyRequests-CIjtVoXr.mjs.map → markSilentPrivacyRequests-B0WgT7XH.mjs.map} +1 -1
  114. package/dist/{notifyPrivacyRequestsAdditionalTime-DsjlAlh8.mjs → notifyPrivacyRequestsAdditionalTime-CF_Q_gQB.mjs} +2 -2
  115. package/dist/{notifyPrivacyRequestsAdditionalTime-DsjlAlh8.mjs.map → notifyPrivacyRequestsAdditionalTime-CF_Q_gQB.mjs.map} +1 -1
  116. package/dist/{policy-bundle-manifest-xaiuhXv5.mjs → policy-bundle-manifest-C54mLUrx.mjs} +2 -2
  117. package/dist/{policy-bundle-manifest-xaiuhXv5.mjs.map → policy-bundle-manifest-C54mLUrx.mjs.map} +1 -1
  118. package/dist/{policy-project-discovery-Dxikd8NT.mjs → policy-project-discovery-DhZ6dKNc.mjs} +2 -2
  119. package/dist/{policy-project-discovery-Dxikd8NT.mjs.map → policy-project-discovery-DhZ6dKNc.mjs.map} +1 -1
  120. package/dist/{policy-scaffold-config-DRWTaw0k.mjs → policy-scaffold-config-DGq600jy.mjs} +2 -2
  121. package/dist/{policy-scaffold-config-DRWTaw0k.mjs.map → policy-scaffold-config-DGq600jy.mjs.map} +1 -1
  122. package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-DbNvJJrP.mjs → pullChunkedCustomSiloOutstandingIdentifiers-DDlLAT1E.mjs} +2 -2
  123. package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-DbNvJJrP.mjs.map → pullChunkedCustomSiloOutstandingIdentifiers-DDlLAT1E.mjs.map} +1 -1
  124. package/dist/{pullManualEnrichmentIdentifiersToCsv-3hX7b2sn.mjs → pullManualEnrichmentIdentifiersToCsv-CMdQpJhA.mjs} +2 -2
  125. package/dist/{pullManualEnrichmentIdentifiersToCsv-3hX7b2sn.mjs.map → pullManualEnrichmentIdentifiersToCsv-CMdQpJhA.mjs.map} +1 -1
  126. package/dist/{pushCronIdentifiersFromCsv-DSsDe8er.mjs → pushCronIdentifiersFromCsv-zG2hSmLe.mjs} +2 -2
  127. package/dist/{pushCronIdentifiersFromCsv-DSsDe8er.mjs.map → pushCronIdentifiersFromCsv-zG2hSmLe.mjs.map} +1 -1
  128. package/dist/{pushManualEnrichmentIdentifiersFromCsv-B4NWrYLP.mjs → pushManualEnrichmentIdentifiersFromCsv-BTNRsy1n.mjs} +2 -2
  129. package/dist/{pushManualEnrichmentIdentifiersFromCsv-B4NWrYLP.mjs.map → pushManualEnrichmentIdentifiersFromCsv-BTNRsy1n.mjs.map} +1 -1
  130. package/dist/{removeUnverifiedRequestIdentifiers-eub1buew.mjs → removeUnverifiedRequestIdentifiers-B-4jnuHJ.mjs} +2 -2
  131. package/dist/{removeUnverifiedRequestIdentifiers-eub1buew.mjs.map → removeUnverifiedRequestIdentifiers-B-4jnuHJ.mjs.map} +1 -1
  132. package/dist/{retryRequestDataSilos-Bz2krPpO.mjs → retryRequestDataSilos-4KK-YDFo.mjs} +2 -2
  133. package/dist/{retryRequestDataSilos-Bz2krPpO.mjs.map → retryRequestDataSilos-4KK-YDFo.mjs.map} +1 -1
  134. package/dist/{skipPreflightJobs-DnMtLNHR.mjs → skipPreflightJobs-CTAUtsAu.mjs} +2 -2
  135. package/dist/{skipPreflightJobs-DnMtLNHR.mjs.map → skipPreflightJobs-CTAUtsAu.mjs.map} +1 -1
  136. package/dist/{skipRequestDataSilos-hFvX-tmq.mjs → skipRequestDataSilos-DhWSTG5Y.mjs} +2 -2
  137. package/dist/{skipRequestDataSilos-hFvX-tmq.mjs.map → skipRequestDataSilos-DhWSTG5Y.mjs.map} +1 -1
  138. package/dist/{streamPrivacyRequestsToCsv-1D5tgLIt.mjs → streamPrivacyRequestsToCsv-BNGRUSGN.mjs} +2 -2
  139. package/dist/{streamPrivacyRequestsToCsv-1D5tgLIt.mjs.map → streamPrivacyRequestsToCsv-BNGRUSGN.mjs.map} +1 -1
  140. package/dist/{updateConsentManagerVersionToLatest-DYvkq9Lr.mjs → updateConsentManagerVersionToLatest-sLQaEvXZ.mjs} +2 -2
  141. package/dist/{updateConsentManagerVersionToLatest-DYvkq9Lr.mjs.map → updateConsentManagerVersionToLatest-sLQaEvXZ.mjs.map} +1 -1
  142. package/dist/{uploadConsents-BIt4fC8B.mjs → uploadConsents-DD5ZYsjA.mjs} +2 -2
  143. package/dist/{uploadConsents-BIt4fC8B.mjs.map → uploadConsents-DD5ZYsjA.mjs.map} +1 -1
  144. package/dist/{uploadPrivacyRequestsFromCsv-Df79Xp4b.mjs → uploadPrivacyRequestsFromCsv-Dxep9tvI.mjs} +2 -2
  145. package/dist/{uploadPrivacyRequestsFromCsv-Df79Xp4b.mjs.map → uploadPrivacyRequestsFromCsv-Dxep9tvI.mjs.map} +1 -1
  146. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"impl-B5CqfbCN.mjs","names":[],"sources":["../src/commands/policy/test/impl.ts"],"sourcesContent":["import path from 'node:path';\n\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport {\n DEFAULT_POLICY_PROJECT_DIRECTORY,\n discoverPolicyBundleDirectories,\n resolvePolicyProjectDirectory,\n} from '../../../lib/policy/policy-project-discovery.js';\nimport { assertOpaInstalled, runOpa } from '../helpers/index.js';\nimport type { PolicyTestExplainMode, PolicyTestFormat } from './command.js';\n\n/** CLI flags for `transcend policy test`. */\nexport interface TestCommandFlags {\n /** `opa test --format` value. */\n format: PolicyTestFormat;\n /** `opa test --verbose`. */\n verbose: boolean;\n /** Optional `opa test --run` regex. */\n run?: string;\n /** `opa test --coverage`. */\n coverage: boolean;\n /** Optional `opa test --threshold` coverage percent. */\n threshold?: string;\n /** Optional `opa test --timeout` duration. */\n timeout?: string;\n /** `opa test --var-values`. */\n 'var-values': boolean;\n /** Optional `opa test --explain` mode. */\n explain?: PolicyTestExplainMode;\n /** Optional `opa test --schema` path. */\n schema?: string;\n /** `opa test --exit-zero-on-skipped`. */\n 'exit-zero-on-skipped': boolean;\n}\n\n/**\n * Run OPA tests against local policy bundles.\n *\n * With no directory (or the default workspace path), discovers every immediate\n * child that contains a `.manifest` and tests each. Pass one bundle path to\n * test a single publishable unit.\n *\n * @param this - CLI context\n * @param flags - Command flags\n * @param directory - Policy workspace or bundle directory\n */\nexport async function test(\n this: LocalContext,\n {\n format,\n verbose,\n run,\n coverage,\n threshold,\n timeout,\n 'var-values': varValues,\n explain,\n schema,\n 'exit-zero-on-skipped': exitZeroOnSkipped,\n }: TestCommandFlags,\n directory: string = DEFAULT_POLICY_PROJECT_DIRECTORY,\n): Promise<void> {\n doneInputValidation(this.process);\n\n assertOpaInstalled();\n const resolvedDir = resolvePolicyProjectDirectory(this.process.cwd(), directory);\n if (!this.fs.existsSync(resolvedDir) || !this.fs.statSync(resolvedDir).isDirectory()) {\n throw new Error(`Policy directory does not exist or is not a directory: ${resolvedDir}`);\n }\n\n if (threshold !== undefined && !coverage) {\n throw new Error('--threshold requires --coverage.');\n }\n if (threshold !== undefined) {\n const parsed = Number(threshold);\n if (!Number.isFinite(parsed) || parsed < 0 || parsed > 100) {\n throw new Error(`--threshold must be a number between 0 and 100, got: ${threshold}`);\n }\n }\n\n const schemaPath = schema ? path.resolve(this.process.cwd(), schema) : undefined;\n if (schemaPath && !this.fs.existsSync(schemaPath)) {\n throw new Error(`Schema path not found: ${schemaPath}`);\n }\n\n const bundleDirectories = discoverPolicyBundleDirectories(this, resolvedDir);\n if (bundleDirectories.length === 0) {\n throw new Error(\n 'No publishable policy bundles found. Add one with `transcend policy new`, ' +\n 'or pass a directory that contains a `.manifest`.',\n );\n }\n\n for (const bundleDirectory of bundleDirectories) {\n this.logger.info(colors.green(`Running policy tests in ${bundleDirectory}...`));\n const exitCode = await runOpa([\n 'test',\n '--fail-on-empty',\n '-b',\n bundleDirectory,\n '--format',\n format,\n ...(verbose ? ['--verbose'] : []),\n ...(run ? ['--run', run] : []),\n ...(coverage ? ['--coverage'] : []),\n ...(threshold !== undefined ? ['--threshold', threshold] : []),\n ...(timeout ? ['--timeout', timeout] : []),\n ...(varValues ? ['--var-values'] : []),\n ...(explain ? ['--explain', explain] : []),\n ...(schemaPath ? ['--schema', schemaPath] : []),\n ...(exitZeroOnSkipped ? ['--exit-zero-on-skipped'] : []),\n ]);\n if (exitCode !== 0) {\n this.process.exit(exitCode);\n }\n }\n\n this.logger.info(colors.green('Policy tests passed.'));\n}\n"],"mappings":"mOAiDA,eAAsB,EAEpB,CACE,SACA,UACA,MACA,WACA,YACA,UACA,aAAc,EACd,UACA,SACA,uBAAwB,GAE1B,EAAoB,EACL,CACf,EAAoB,KAAK,QAAQ,CAEjC,GAAoB,CACpB,IAAM,EAAc,EAA8B,KAAK,QAAQ,KAAK,CAAE,EAAU,CAChF,GAAI,CAAC,KAAK,G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O,KAAK,EAAO,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"impl-lICSh559.mjs","names":[],"sources":["../src/commands/policy/test/impl.ts"],"sourcesContent":["import path from 'node:path';\n\nimport colors from 'colors';\n\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport {\n DEFAULT_POLICY_PROJECT_DIRECTORY,\n discoverPolicyBundleDirectories,\n resolvePolicyProjectDirectory,\n} from '../../../lib/policy/policy-project-discovery.js';\nimport { assertOpaInstalled, runOpa } from '../helpers/index.js';\nimport type { PolicyTestExplainMode, PolicyTestFormat } from './command.js';\n\n/** CLI flags for `transcend policy test`. */\nexport interface TestCommandFlags {\n /** `opa test --format` value. */\n format: PolicyTestFormat;\n /** `opa test --verbose`. */\n verbose: boolean;\n /** Optional `opa test --run` regex. */\n run?: string;\n /** `opa test --coverage`. */\n coverage: boolean;\n /** Optional `opa test --threshold` coverage percent. */\n threshold?: string;\n /** Optional `opa test --timeout` duration. */\n timeout?: string;\n /** `opa test --var-values`. */\n 'var-values': boolean;\n /** Optional `opa test --explain` mode. */\n explain?: PolicyTestExplainMode;\n /** Optional `opa test --schema` path. */\n schema?: string;\n /** `opa test --exit-zero-on-skipped`. */\n 'exit-zero-on-skipped': boolean;\n}\n\n/**\n * Run OPA tests against local policy bundles.\n *\n * With no directory (or the default workspace path), discovers every immediate\n * child that contains a `.manifest` and tests each. Pass one bundle path to\n * test a single publishable unit.\n *\n * @param this - CLI context\n * @param flags - Command flags\n * @param directory - Policy workspace or bundle directory\n */\nexport async function test(\n this: LocalContext,\n {\n format,\n verbose,\n run,\n coverage,\n threshold,\n timeout,\n 'var-values': varValues,\n explain,\n schema,\n 'exit-zero-on-skipped': exitZeroOnSkipped,\n }: TestCommandFlags,\n directory: string = DEFAULT_POLICY_PROJECT_DIRECTORY,\n): Promise<void> {\n doneInputValidation(this.process);\n\n assertOpaInstalled();\n const resolvedDir = resolvePolicyProjectDirectory(this.process.cwd(), directory);\n if (!this.fs.existsSync(resolvedDir) || !this.fs.statSync(resolvedDir).isDirectory()) {\n throw new Error(`Policy directory does not exist or is not a directory: ${resolvedDir}`);\n }\n\n if (threshold !== undefined && !coverage) {\n throw new Error('--threshold requires --coverage.');\n }\n if (threshold !== undefined) {\n const parsed = Number(threshold);\n if (!Number.isFinite(parsed) || parsed < 0 || parsed > 100) {\n throw new Error(`--threshold must be a number between 0 and 100, got: ${threshold}`);\n }\n }\n\n const schemaPath = schema ? path.resolve(this.process.cwd(), schema) : undefined;\n if (schemaPath && !this.fs.existsSync(schemaPath)) {\n throw new Error(`Schema path not found: ${schemaPath}`);\n }\n\n const bundleDirectories = discoverPolicyBundleDirectories(this, resolvedDir);\n if (bundleDirectories.length === 0) {\n throw new Error(\n 'No publishable policy bundles found. Add one with `transcend policy new`, ' +\n 'or pass a directory that contains a `.manifest`.',\n );\n }\n\n for (const bundleDirectory of bundleDirectories) {\n this.logger.info(colors.green(`Running policy tests in ${bundleDirectory}...`));\n const exitCode = await runOpa([\n 'test',\n '--fail-on-empty',\n '-b',\n bundleDirectory,\n '--format',\n format,\n ...(verbose ? ['--verbose'] : []),\n ...(run ? ['--run', run] : []),\n ...(coverage ? ['--coverage'] : []),\n ...(threshold !== undefined ? ['--threshold', threshold] : []),\n ...(timeout ? ['--timeout', timeout] : []),\n ...(varValues ? ['--var-values'] : []),\n ...(explain ? ['--explain', explain] : []),\n ...(schemaPath ? ['--schema', schemaPath] : []),\n ...(exitZeroOnSkipped ? ['--exit-zero-on-skipped'] : []),\n ]);\n if (exitCode !== 0) {\n this.process.exit(exitCode);\n }\n }\n\n this.logger.info(colors.green('Policy tests passed.'));\n}\n"],"mappings":"mOAiDA,eAAsB,EAEpB,CACE,SACA,UACA,MACA,WACA,YACA,UACA,aAAc,EACd,UACA,SACA,uBAAwB,GAE1B,EAAoB,EACL,CACf,EAAoB,KAAK,QAAQ,CAEjC,GAAoB,CACpB,IAAM,EAAc,EAA8B,KAAK,QAAQ,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,KAAK,QAAQ,KAAK,EAAS,CAI/B,KAAK,OAAO,KAAK,EAAO,MAAM,uBAAuB,CAAC"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./constants-CusZYsjT.mjs";import{t}from"./logger-CPu6zbyQ.mjs";import{n}from"./syncCodePackages-DJnrcX5l.mjs";import{t as r}from"./done-input-validation-LiTaCEzF.mjs";import{t as i}from"./constants-DC_bBO09.mjs";import a from"colors";import o from"fast-glob";import{getEntries as s}from"@transcend-io/type-utils";import{buildTranscendGraphQLClient as c}from"@transcend-io/sdk";import{execSync as l}from"child_process";async function u({scanPath:e,ignoreDirs:n=[],repositoryName:r}){return(await Promise.all(s(i).map(async([i,s])=>{let{ignoreDirs:c,supportedFiles:l,scanFunction:u}=s,d=[...n,...c].filter(e=>e.length>0);try{let n=await o(`${e}/**/${l.join(`|`)}`,{ignore:d.map(t=>`${e}/**/${t}`),unique:!0,onlyFiles:!0});t.info(a.magenta(`Scanning: ${n.length} files of type ${i}`));let s=n.map(t=>u(t).map(n=>({...n,relativePath:t.replace(`${e}/`,``)}))).flat();return t.info(a.green(`Found: ${s.length} packages and ${s.map(({softwareDevelopmentKits:e=[]})=>e).flat().length} sdks`)),s.map(e=>({...e,type:i,repositoryName:r}))}catch(e){throw Error(`Error scanning globs ${l} with error: ${e}`)}}))).flat()}const d=`A repository name must be provided. You can specify using --repositoryName=$REPO_NAME or by ensuring the command "git config --get remote.origin.url" returns the name of the repository`;async function f({auth:t,scanPath:i,ignoreDirs:o,repositoryName:s,transcendUrl:f}){r(this.process);let p=s;if(!p)try{let e=l(`cd ${i} && git config --get remote.origin.url`).toString(`utf-8`).trim();[p]=e.includes(`https:`)?e.split(`/`).slice(3).join(`/`).split(`.`):(e.split(`:`).pop()||``).split(`.`),p||(this.logger.error(a.red(d)),this.process.exit(1))}catch(e){this.logger.error(a.red(`${d} - Got error: ${e.message}`)),this.process.exit(1)}let m=c(f,t),h=await u({scanPath:i,ignoreDirs:o,repositoryName:p});await n(m,h);let g=new URL(e);g.pathname=`/code-scanning/code-packages`,this.logger.info(a.green(`Scan found ${h.length} packages at ${i}! View results at '${g.href}'`))}export{f as scanPackages};
2
- //# sourceMappingURL=impl-CFPN8z3c.mjs.map
1
+ import{t as e}from"./constants-COP23kS1.mjs";import{t}from"./logger-CPu6zbyQ.mjs";import{n}from"./syncCodePackages-DJnrcX5l.mjs";import{t as r}from"./done-input-validation-LiTaCEzF.mjs";import{t as i}from"./constants-DC_bBO09.mjs";import a from"colors";import o from"fast-glob";import{getEntries as s}from"@transcend-io/type-utils";import{buildTranscendGraphQLClient as c}from"@transcend-io/sdk";import{execSync as l}from"child_process";async function u({scanPath:e,ignoreDirs:n=[],repositoryName:r}){return(await Promise.all(s(i).map(async([i,s])=>{let{ignoreDirs:c,supportedFiles:l,scanFunction:u}=s,d=[...n,...c].filter(e=>e.length>0);try{let n=await o(`${e}/**/${l.join(`|`)}`,{ignore:d.map(t=>`${e}/**/${t}`),unique:!0,onlyFiles:!0});t.info(a.magenta(`Scanning: ${n.length} files of type ${i}`));let s=n.map(t=>u(t).map(n=>({...n,relativePath:t.replace(`${e}/`,``)}))).flat();return t.info(a.green(`Found: ${s.length} packages and ${s.map(({softwareDevelopmentKits:e=[]})=>e).flat().length} sdks`)),s.map(e=>({...e,type:i,repositoryName:r}))}catch(e){throw Error(`Error scanning globs ${l} with error: ${e}`)}}))).flat()}const d=`A repository name must be provided. You can specify using --repositoryName=$REPO_NAME or by ensuring the command "git config --get remote.origin.url" returns the name of the repository`;async function f({auth:t,scanPath:i,ignoreDirs:o,repositoryName:s,transcendUrl:f}){r(this.process);let p=s;if(!p)try{let e=l(`cd ${i} && git config --get remote.origin.url`).toString(`utf-8`).trim();[p]=e.includes(`https:`)?e.split(`/`).slice(3).join(`/`).split(`.`):(e.split(`:`).pop()||``).split(`.`),p||(this.logger.error(a.red(d)),this.process.exit(1))}catch(e){this.logger.error(a.red(`${d} - Got error: ${e.message}`)),this.process.exit(1)}let m=c(f,t),h=await u({scanPath:i,ignoreDirs:o,repositoryName:p});await n(m,h);let g=new URL(e);g.pathname=`/code-scanning/code-packages`,this.logger.info(a.green(`Scan found ${h.length} packages at ${i}! View results at '${g.href}'`))}export{f as scanPackages};
2
+ //# sourceMappingURL=impl-tnFsm0_E.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"impl-CFPN8z3c.mjs","names":[],"sources":["../src/lib/code-scanning/findCodePackagesInFolder.ts","../src/commands/inventory/scan-packages/impl.ts"],"sourcesContent":["import { getEntries } from '@transcend-io/type-utils';\nimport colors from 'colors';\nimport fastGlob from 'fast-glob';\n\nimport { CodePackageInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { CODE_SCANNING_CONFIGS } from './constants.js';\n\n/**\n * Helper to scan and discovery all of the code packages within a folder\n *\n * @param options - Options\n * @returns the list of integrations\n */\nexport async function findCodePackagesInFolder({\n scanPath,\n ignoreDirs = [],\n repositoryName,\n}: {\n /** The name of the github repository reporting packages for */\n repositoryName: string;\n /** Where to look for package.json files */\n scanPath: string;\n /** The directories to ignore (excludes node_modules and serverless-build) */\n ignoreDirs?: string[];\n}): Promise<CodePackageInput[]> {\n const allCodePackages = await Promise.all(\n getEntries(CODE_SCANNING_CONFIGS).map(async ([codePackageType, config]) => {\n const { ignoreDirs: configIgnoreDirs, supportedFiles, scanFunction } = config;\n const dirsToIgnore = [...ignoreDirs, ...configIgnoreDirs].filter((dir) => dir.length > 0);\n try {\n const filesToScan: string[] = await fastGlob(`${scanPath}/**/${supportedFiles.join('|')}`, {\n ignore: dirsToIgnore.map((dir: string) => `${scanPath}/**/${dir}`),\n unique: true,\n onlyFiles: true,\n });\n logger.info(\n colors.magenta(`Scanning: ${filesToScan.length} files of type ${codePackageType}`),\n );\n const allPackages = filesToScan\n .map((filePath) =>\n scanFunction(filePath).map((result) => ({\n ...result,\n relativePath: filePath.replace(`${scanPath}/`, ''),\n })),\n )\n .flat();\n logger.info(\n colors.green(\n `Found: ${allPackages.length} packages and ${\n allPackages.map(({ softwareDevelopmentKits = [] }) => softwareDevelopmentKits).flat()\n .length\n } sdks`,\n ),\n );\n\n return allPackages.map(\n (pkg): CodePackageInput => ({\n ...pkg,\n type: codePackageType,\n repositoryName,\n }),\n );\n } catch (error) {\n throw new Error(`Error scanning globs ${supportedFiles} with error: ${error}`);\n }\n }),\n );\n\n return allCodePackages.flat();\n}\n","import { execSync } from 'child_process';\n\nimport { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport colors from 'colors';\n\nimport { ADMIN_DASH } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { findCodePackagesInFolder } from '../../../lib/code-scanning/index.js';\nimport { syncCodePackages } from '../../../lib/graphql/index.js';\n\nconst REPO_ERROR =\n 'A repository name must be provided. ' +\n 'You can specify using --repositoryName=$REPO_NAME or by ensuring the ' +\n 'command \"git config --get remote.origin.url\" returns the name of the repository';\n\nexport interface ScanPackagesCommandFlags {\n auth: string;\n scanPath: string;\n ignoreDirs?: string[];\n repositoryName?: string;\n transcendUrl: string;\n}\n\nexport async function scanPackages(\n this: LocalContext,\n { auth, scanPath, ignoreDirs, repositoryName, transcendUrl }: ScanPackagesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n // Ensure repository name is specified\n let gitRepositoryName = repositoryName;\n if (!gitRepositoryName) {\n try {\n const name = execSync(`cd ${scanPath} && git config --get remote.origin.url`);\n // Trim and parse the URL\n const url = name.toString('utf-8').trim();\n [gitRepositoryName] = !url.includes('https:')\n ? (url.split(':').pop() || '').split('.')\n : url.split('/').slice(3).join('/').split('.');\n if (!gitRepositoryName) {\n this.logger.error(colors.red(REPO_ERROR));\n this.process.exit(1);\n }\n } catch (err) {\n this.logger.error(colors.red(`${REPO_ERROR} - Got error: ${err.message}`));\n this.process.exit(1);\n }\n }\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Scan the codebase to discovery packages\n const results = await findCodePackagesInFolder({\n scanPath,\n ignoreDirs,\n repositoryName: gitRepositoryName,\n });\n\n // Report scan to Transcend\n await syncCodePackages(client, results);\n\n const newUrl = new URL(ADMIN_DASH);\n newUrl.pathname = '/code-scanning/code-packages';\n\n // Indicate success\n this.logger.info(\n colors.green(\n `Scan found ${results.length} packages at ${scanPath}! ` + `View results at '${newUrl.href}'`,\n ),\n );\n}\n"],"mappings":"qbAcA,eAAsB,EAAyB,CAC7C,WACA,aAAa,EAAE,CACf,kBAQ8B,CA4C9B,OAAO,MA3CuB,QAAQ,IACpC,EAAW,EAAsB,CAAC,IAAI,MAAO,CAAC,EAAiB,KAAY,CACzE,GAAM,CAAE,WAAY,EAAkB,iBAAgB,gBAAiB,EACjE,EAAe,CAAC,GAAG,EAAY,GAAG,EAAiB,CAAC,OAAQ,GAAQ,EAAI,OAAS,EAAE,CACzF,GAAI,CACF,IAAM,EAAwB,MAAM,EAAS,GAAG,EAAS,MAAM,EAAe,KAAK,IAAI,GAAI,CACzF,OAAQ,EAAa,IAAK,GAAgB,GAAG,EAAS,MAAM,IAAM,CAClE,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,CC1D/B,MAAM,EACJ,2LAYF,eAAsB,EAEpB,CAAE,OAAM,WAAU,aAAY,iBAAgB,gBAC/B,CACf,EAAoB,KAAK,QAAQ,CAGjC,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,KAAK,OAAO,MAAM,EAAO,IAAI,EAAW,CAAC,CACzC,KAAK,QAAQ,KAAK,EAAE,QAEf,EAAK,CACZ,KAAK,OAAO,MAAM,EAAO,IAAI,GAAG,EAAW,gBAAgB,EAAI,UAAU,CAAC,CAC1E,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,KAAK,OAAO,KACV,EAAO,MACL,cAAc,EAAQ,OAAO,eAAe,EAAS,qBAA0B,EAAO,KAAK,GAC5F,CACF"}
1
+ {"version":3,"file":"impl-tnFsm0_E.mjs","names":[],"sources":["../src/lib/code-scanning/findCodePackagesInFolder.ts","../src/commands/inventory/scan-packages/impl.ts"],"sourcesContent":["import { getEntries } from '@transcend-io/type-utils';\nimport colors from 'colors';\nimport fastGlob from 'fast-glob';\n\nimport { CodePackageInput } from '../../codecs.js';\nimport { logger } from '../../logger.js';\nimport { CODE_SCANNING_CONFIGS } from './constants.js';\n\n/**\n * Helper to scan and discovery all of the code packages within a folder\n *\n * @param options - Options\n * @returns the list of integrations\n */\nexport async function findCodePackagesInFolder({\n scanPath,\n ignoreDirs = [],\n repositoryName,\n}: {\n /** The name of the github repository reporting packages for */\n repositoryName: string;\n /** Where to look for package.json files */\n scanPath: string;\n /** The directories to ignore (excludes node_modules and serverless-build) */\n ignoreDirs?: string[];\n}): Promise<CodePackageInput[]> {\n const allCodePackages = await Promise.all(\n getEntries(CODE_SCANNING_CONFIGS).map(async ([codePackageType, config]) => {\n const { ignoreDirs: configIgnoreDirs, supportedFiles, scanFunction } = config;\n const dirsToIgnore = [...ignoreDirs, ...configIgnoreDirs].filter((dir) => dir.length > 0);\n try {\n const filesToScan: string[] = await fastGlob(`${scanPath}/**/${supportedFiles.join('|')}`, {\n ignore: dirsToIgnore.map((dir: string) => `${scanPath}/**/${dir}`),\n unique: true,\n onlyFiles: true,\n });\n logger.info(\n colors.magenta(`Scanning: ${filesToScan.length} files of type ${codePackageType}`),\n );\n const allPackages = filesToScan\n .map((filePath) =>\n scanFunction(filePath).map((result) => ({\n ...result,\n relativePath: filePath.replace(`${scanPath}/`, ''),\n })),\n )\n .flat();\n logger.info(\n colors.green(\n `Found: ${allPackages.length} packages and ${\n allPackages.map(({ softwareDevelopmentKits = [] }) => softwareDevelopmentKits).flat()\n .length\n } sdks`,\n ),\n );\n\n return allPackages.map(\n (pkg): CodePackageInput => ({\n ...pkg,\n type: codePackageType,\n repositoryName,\n }),\n );\n } catch (error) {\n throw new Error(`Error scanning globs ${supportedFiles} with error: ${error}`);\n }\n }),\n );\n\n return allCodePackages.flat();\n}\n","import { execSync } from 'child_process';\n\nimport { buildTranscendGraphQLClient } from '@transcend-io/sdk';\nimport colors from 'colors';\n\nimport { ADMIN_DASH } from '../../../constants.js';\nimport type { LocalContext } from '../../../context.js';\nimport { doneInputValidation } from '../../../lib/cli/done-input-validation.js';\nimport { findCodePackagesInFolder } from '../../../lib/code-scanning/index.js';\nimport { syncCodePackages } from '../../../lib/graphql/index.js';\n\nconst REPO_ERROR =\n 'A repository name must be provided. ' +\n 'You can specify using --repositoryName=$REPO_NAME or by ensuring the ' +\n 'command \"git config --get remote.origin.url\" returns the name of the repository';\n\nexport interface ScanPackagesCommandFlags {\n auth: string;\n scanPath: string;\n ignoreDirs?: string[];\n repositoryName?: string;\n transcendUrl: string;\n}\n\nexport async function scanPackages(\n this: LocalContext,\n { auth, scanPath, ignoreDirs, repositoryName, transcendUrl }: ScanPackagesCommandFlags,\n): Promise<void> {\n doneInputValidation(this.process);\n\n // Ensure repository name is specified\n let gitRepositoryName = repositoryName;\n if (!gitRepositoryName) {\n try {\n const name = execSync(`cd ${scanPath} && git config --get remote.origin.url`);\n // Trim and parse the URL\n const url = name.toString('utf-8').trim();\n [gitRepositoryName] = !url.includes('https:')\n ? (url.split(':').pop() || '').split('.')\n : url.split('/').slice(3).join('/').split('.');\n if (!gitRepositoryName) {\n this.logger.error(colors.red(REPO_ERROR));\n this.process.exit(1);\n }\n } catch (err) {\n this.logger.error(colors.red(`${REPO_ERROR} - Got error: ${err.message}`));\n this.process.exit(1);\n }\n }\n\n // Create a GraphQL client\n const client = buildTranscendGraphQLClient(transcendUrl, auth);\n\n // Scan the codebase to discovery packages\n const results = await findCodePackagesInFolder({\n scanPath,\n ignoreDirs,\n repositoryName: gitRepositoryName,\n });\n\n // Report scan to Transcend\n await syncCodePackages(client, results);\n\n const newUrl = new URL(ADMIN_DASH);\n newUrl.pathname = '/code-scanning/code-packages';\n\n // Indicate success\n this.logger.info(\n colors.green(\n `Scan found ${results.length} packages at ${scanPath}! ` + `View results at '${newUrl.href}'`,\n ),\n );\n}\n"],"mappings":"qbAcA,eAAsB,EAAyB,CAC7C,WACA,aAAa,EAAE,CACf,kBAQ8B,CA4C9B,OAAO,MA3CuB,QAAQ,IACpC,EAAW,EAAsB,CAAC,IAAI,MAAO,CAAC,EAAiB,KAAY,CACzE,GAAM,CAAE,WAAY,EAAkB,iBAAgB,gBAAiB,EACjE,EAAe,CAAC,GAAG,EAAY,GAAG,EAAiB,CAAC,OAAQ,GAAQ,EAAI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O,IAAI,GAAG,EAAW,gBAAgB,EAAI,UAAU,CAAC,CAC1E,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,KAAK,OAAO,KACV,EAAO,MACL,cAAc,EAAQ,OAAO,eAAe,EAAS,qBAA0B,EAAO,KAAK,GAC5F,CACF"}
package/dist/index.d.mts CHANGED
@@ -165,6 +165,7 @@ declare const TeamInput: t.IntersectionC<[t.TypeC<{
165
165
  viewCustomFunction: unknown;
166
166
  manageCustomFunction: unknown;
167
167
  viewUsage: unknown;
168
+ executeLLMClassification: unknown;
168
169
  }>>;
169
170
  }>]>;
170
171
  /** Type override */
@@ -87147,6 +87148,7 @@ declare const TranscendInput: t.PartialC<{
87147
87148
  viewCustomFunction: unknown;
87148
87149
  manageCustomFunction: unknown;
87149
87150
  viewUsage: unknown;
87151
+ executeLLMClassification: unknown;
87150
87152
  }>>;
87151
87153
  }>]>>;
87152
87154
  /**