@transcend-io/cli 11.0.0 → 12.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (379) hide show
  1. package/README.md +286 -130
  2. package/dist/app-CfJlhIn8.mjs +148 -0
  3. package/dist/app-CfJlhIn8.mjs.map +1 -0
  4. package/dist/{approvePrivacyRequests-C165wLBa.mjs → approvePrivacyRequests-BWj6SsgX.mjs} +2 -2
  5. package/dist/{approvePrivacyRequests-C165wLBa.mjs.map → approvePrivacyRequests-BWj6SsgX.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-1I3xKR1X.mjs +2 -0
  10. package/dist/buildExamples-1I3xKR1X.mjs.map +1 -0
  11. package/dist/{buildXdiSyncEndpoint-DeStnIit.mjs → buildXdiSyncEndpoint-CAal3Xc4.mjs} +2 -2
  12. package/dist/{buildXdiSyncEndpoint-DeStnIit.mjs.map → buildXdiSyncEndpoint-CAal3Xc4.mjs.map} +1 -1
  13. package/dist/{bulkRestartRequests-_Mu1rwZQ.mjs → bulkRestartRequests-B3wupylo.mjs} +2 -2
  14. package/dist/{bulkRestartRequests-_Mu1rwZQ.mjs.map → bulkRestartRequests-B3wupylo.mjs.map} +1 -1
  15. package/dist/{bulkRetryEnrichers-C2keTKuQ.mjs → bulkRetryEnrichers-D801tBcB.mjs} +2 -2
  16. package/dist/{bulkRetryEnrichers-C2keTKuQ.mjs.map → bulkRetryEnrichers-D801tBcB.mjs.map} +1 -1
  17. package/dist/{cancelPrivacyRequests-DwQr18Fk.mjs → cancelPrivacyRequests-CAKTZF47.mjs} +2 -2
  18. package/dist/{cancelPrivacyRequests-DwQr18Fk.mjs.map → cancelPrivacyRequests-CAKTZF47.mjs.map} +1 -1
  19. package/dist/{codecs-CTxFjCg4.mjs → codecs-CfcaFoZR.mjs} +1 -1
  20. package/dist/{codecs-CTxFjCg4.mjs.map → codecs-CfcaFoZR.mjs.map} +1 -1
  21. package/dist/{collectCsvFilesOrExit-B1VOVGWN.mjs → collectCsvFilesOrExit-BindZ0dF.mjs} +1 -1
  22. package/dist/{collectCsvFilesOrExit-B1VOVGWN.mjs.map → collectCsvFilesOrExit-BindZ0dF.mjs.map} +1 -1
  23. package/dist/{collectParquetFilesOrExit-DVlv5ctt.mjs → collectParquetFilesOrExit-CbNQ9CJc.mjs} +1 -1
  24. package/dist/{collectParquetFilesOrExit-DVlv5ctt.mjs.map → collectParquetFilesOrExit-CbNQ9CJc.mjs.map} +1 -1
  25. package/dist/command-BDQOL_MQ.mjs +9 -0
  26. package/dist/command-BDQOL_MQ.mjs.map +1 -0
  27. package/dist/command-output-BJcDRXNr.mjs +2 -0
  28. package/dist/command-output-BJcDRXNr.mjs.map +1 -0
  29. package/dist/command-output-BRfF3YFv.mjs +2 -0
  30. package/dist/command-output-BRfF3YFv.mjs.map +1 -0
  31. package/dist/commands/admin/chunk-csv/worker.mjs +1 -1
  32. package/dist/commands/admin/parquet-to-csv/worker.mjs +1 -1
  33. package/dist/{consentManagersToBusinessEntities-CBJ81aGO.mjs → consentManagersToBusinessEntities-DG0_eby5.mjs} +1 -1
  34. package/dist/{consentManagersToBusinessEntities-CBJ81aGO.mjs.map → consentManagersToBusinessEntities-DG0_eby5.mjs.map} +1 -1
  35. package/dist/{constants-Upxn_rQF.mjs → constants-BlKpAm3R.mjs} +2 -2
  36. package/dist/{constants-Upxn_rQF.mjs.map → constants-BlKpAm3R.mjs.map} +1 -1
  37. package/dist/{constants-DXzsg2CQ.mjs → constants-DC_bBO09.mjs} +3 -3
  38. package/dist/{constants-DXzsg2CQ.mjs.map → constants-DC_bBO09.mjs.map} +1 -1
  39. package/dist/{constants-D_HVDaOy.mjs → constants-qvGk0wlN.mjs} +1 -1
  40. package/dist/{constants-D_HVDaOy.mjs.map → constants-qvGk0wlN.mjs.map} +1 -1
  41. package/dist/{context-B33NT3ki.mjs → context-D0A0LxsP.mjs} +1 -1
  42. package/dist/{context-B33NT3ki.mjs.map → context-D0A0LxsP.mjs.map} +1 -1
  43. package/dist/{createPoolingCommandUi-CKH-24w5.mjs → createPoolingCommandUi-JBOW5UxY.mjs} +5 -5
  44. package/dist/{createPoolingCommandUi-CKH-24w5.mjs.map → createPoolingCommandUi-JBOW5UxY.mjs.map} +1 -1
  45. package/dist/{dataFlowsToDataSilos-BF6fzWcm.mjs → dataFlowsToDataSilos-CRqbNjZ0.mjs} +1 -1
  46. package/dist/{dataFlowsToDataSilos-BF6fzWcm.mjs.map → dataFlowsToDataSilos-CRqbNjZ0.mjs.map} +1 -1
  47. package/dist/deno-runtime-CB2HBach.mjs +2 -0
  48. package/dist/deno-runtime-CB2HBach.mjs.map +1 -0
  49. package/dist/{done-input-validation-BUz-aVC5.mjs → done-input-validation-LiTaCEzF.mjs} +1 -1
  50. package/dist/{done-input-validation-BUz-aVC5.mjs.map → done-input-validation-LiTaCEzF.mjs.map} +1 -1
  51. package/dist/downloadPrivacyRequestFiles-Cf14MQR4.mjs +2 -0
  52. package/dist/{downloadPrivacyRequestFiles-D3bzcegH.mjs.map → downloadPrivacyRequestFiles-Cf14MQR4.mjs.map} +1 -1
  53. package/dist/{extractClientError-HZ2U7yqV.mjs → extractClientError-DUJxHv07.mjs} +1 -1
  54. package/dist/{extractClientError-HZ2U7yqV.mjs.map → extractClientError-DUJxHv07.mjs.map} +1 -1
  55. package/dist/{fetchAllRequests-2TZr-LfT.mjs → fetchAllRequests-BI0tFl_a.mjs} +2 -2
  56. package/dist/{fetchAllRequests-2TZr-LfT.mjs.map → fetchAllRequests-BI0tFl_a.mjs.map} +1 -1
  57. package/dist/{formatPolicyBundleVersionSummary-CJmMCLtJ.mjs → formatPolicyBundleVersionSummary-DCHl1Vhy.mjs} +1 -1
  58. package/dist/{formatPolicyBundleVersionSummary-CJmMCLtJ.mjs.map → formatPolicyBundleVersionSummary-DCHl1Vhy.mjs.map} +1 -1
  59. package/dist/{fuzzyMatchColumns-CQCzpjWC.mjs → fuzzyMatchColumns-2NmQqCZI.mjs} +2 -2
  60. package/dist/{fuzzyMatchColumns-CQCzpjWC.mjs.map → fuzzyMatchColumns-2NmQqCZI.mjs.map} +1 -1
  61. package/dist/{generateCrossAccountApiKeys-DWfJtB3t.mjs → generateCrossAccountApiKeys-CVdsJFOe.mjs} +2 -2
  62. package/dist/{generateCrossAccountApiKeys-DWfJtB3t.mjs.map → generateCrossAccountApiKeys-CVdsJFOe.mjs.map} +1 -1
  63. package/dist/impl-0-_oxvck.mjs +2 -0
  64. package/dist/impl-0-_oxvck.mjs.map +1 -0
  65. package/dist/{impl-ByFyaZkK.mjs → impl-2sYR_UFO.mjs} +2 -2
  66. package/dist/{impl-ByFyaZkK.mjs.map → impl-2sYR_UFO.mjs.map} +1 -1
  67. package/dist/{impl-DRpK-QLC.mjs → impl-ApZGIx6l.mjs} +2 -2
  68. package/dist/{impl-DRpK-QLC.mjs.map → impl-ApZGIx6l.mjs.map} +1 -1
  69. package/dist/{impl-DVeGQCrr.mjs → impl-Ay6JeH-7.mjs} +2 -2
  70. package/dist/{impl-DVeGQCrr.mjs.map → impl-Ay6JeH-7.mjs.map} +1 -1
  71. package/dist/impl-B-Oe7DcE2.mjs +421 -0
  72. package/dist/impl-B-Oe7DcE2.mjs.map +1 -0
  73. package/dist/{impl-BPoEH3Nf2.mjs → impl-B94dMG4x2.mjs} +2 -2
  74. package/dist/{impl-BPoEH3Nf2.mjs.map → impl-B94dMG4x2.mjs.map} +1 -1
  75. package/dist/{impl-BEA5cQOT2.mjs → impl-BD03bzB-.mjs} +2 -2
  76. package/dist/impl-BD03bzB-.mjs.map +1 -0
  77. package/dist/{impl-BpMQYnbR.mjs → impl-BGtup1F9.mjs} +2 -2
  78. package/dist/{impl-BpMQYnbR.mjs.map → impl-BGtup1F9.mjs.map} +1 -1
  79. package/dist/{impl-DXowiNOz.mjs → impl-BH1fCPDh.mjs} +2 -2
  80. package/dist/{impl-DXowiNOz.mjs.map → impl-BH1fCPDh.mjs.map} +1 -1
  81. package/dist/{impl-CfvxD3RI.mjs → impl-BLOhoP-b2.mjs} +2 -2
  82. package/dist/impl-BLOhoP-b2.mjs.map +1 -0
  83. package/dist/impl-BQRP9NIv.mjs +2 -0
  84. package/dist/impl-BQRP9NIv.mjs.map +1 -0
  85. package/dist/{impl-BppXJ1AD2.mjs → impl-BQe6vddz.mjs} +2 -2
  86. package/dist/impl-BQe6vddz.mjs.map +1 -0
  87. package/dist/impl-BQj1Ien4.mjs +3 -0
  88. package/dist/impl-BQj1Ien4.mjs.map +1 -0
  89. package/dist/{impl-C_62Z4ED.mjs → impl-BRFL8xp7.mjs} +2 -2
  90. package/dist/{impl-C_62Z4ED.mjs.map → impl-BRFL8xp7.mjs.map} +1 -1
  91. package/dist/impl-BTvZxws5.mjs +2 -0
  92. package/dist/impl-BTvZxws5.mjs.map +1 -0
  93. package/dist/{impl-D94m3EPp.mjs → impl-BVcy_GYa.mjs} +2 -2
  94. package/dist/{impl-D94m3EPp.mjs.map → impl-BVcy_GYa.mjs.map} +1 -1
  95. package/dist/{impl-zRAjMVgz.mjs → impl-B_CRtRo8.mjs} +2 -2
  96. package/dist/{impl-zRAjMVgz.mjs.map → impl-B_CRtRo8.mjs.map} +1 -1
  97. package/dist/{impl-D4Ne3Vbg.mjs → impl-BgD7TeMD.mjs} +2 -2
  98. package/dist/{impl-D4Ne3Vbg.mjs.map → impl-BgD7TeMD.mjs.map} +1 -1
  99. package/dist/{impl-Cw0L2xEU.mjs → impl-BgkovGOz.mjs} +2 -2
  100. package/dist/{impl-Cw0L2xEU.mjs.map → impl-BgkovGOz.mjs.map} +1 -1
  101. package/dist/{impl-C9OmNI49.mjs → impl-Bh02zrTq.mjs} +2 -2
  102. package/dist/{impl-C9OmNI49.mjs.map → impl-Bh02zrTq.mjs.map} +1 -1
  103. package/dist/{impl-CiBT9-GH2.mjs → impl-BopWGXnH.mjs} +2 -2
  104. package/dist/impl-BopWGXnH.mjs.map +1 -0
  105. package/dist/impl-BpVe6fMe.mjs +3 -0
  106. package/dist/{impl--JGnR3wp.mjs.map → impl-BpVe6fMe.mjs.map} +1 -1
  107. package/dist/impl-BxvKe9_7.mjs +2 -0
  108. package/dist/impl-BxvKe9_7.mjs.map +1 -0
  109. package/dist/{impl-C8jjYvgu.mjs → impl-BzIyVAg_.mjs} +2 -2
  110. package/dist/{impl-C8jjYvgu.mjs.map → impl-BzIyVAg_.mjs.map} +1 -1
  111. package/dist/{impl-DXQHLpMw.mjs → impl-C-PvYlFE.mjs} +2 -2
  112. package/dist/{impl-DXQHLpMw.mjs.map → impl-C-PvYlFE.mjs.map} +1 -1
  113. package/dist/impl-C36c5NfN.mjs +2 -0
  114. package/dist/impl-C36c5NfN.mjs.map +1 -0
  115. package/dist/{impl-BhfxcCgN2.mjs → impl-CC-yFYWt.mjs} +2 -2
  116. package/dist/impl-CC-yFYWt.mjs.map +1 -0
  117. package/dist/{impl-lsmXIGSo2.mjs → impl-CFB_508q.mjs} +2 -2
  118. package/dist/impl-CFB_508q.mjs.map +1 -0
  119. package/dist/{impl-D2Q4nxUO.mjs → impl-CG3f4B6u.mjs} +2 -2
  120. package/dist/{impl-D2Q4nxUO.mjs.map → impl-CG3f4B6u.mjs.map} +1 -1
  121. package/dist/{impl-DaH1_ZzK.mjs → impl-CVUD-7mJ.mjs} +5 -5
  122. package/dist/{impl-DaH1_ZzK.mjs.map → impl-CVUD-7mJ.mjs.map} +1 -1
  123. package/dist/impl-CY8C-Fvj2.mjs +2 -0
  124. package/dist/impl-CY8C-Fvj2.mjs.map +1 -0
  125. package/dist/{impl-DqhZR11m.mjs → impl-ClqrQo1M.mjs} +2 -2
  126. package/dist/{impl-DqhZR11m.mjs.map → impl-ClqrQo1M.mjs.map} +1 -1
  127. package/dist/impl-CnHfn7rr.mjs +5 -0
  128. package/dist/{impl-DPtx5iZO.mjs.map → impl-CnHfn7rr.mjs.map} +1 -1
  129. package/dist/{impl-Dqqb0lVN.mjs → impl-CoqCyj7e.mjs} +3 -3
  130. package/dist/{impl-Dqqb0lVN.mjs.map → impl-CoqCyj7e.mjs.map} +1 -1
  131. package/dist/{impl-CHUxKOz_.mjs → impl-Cq-GARM1.mjs} +2 -2
  132. package/dist/{impl-CHUxKOz_.mjs.map → impl-Cq-GARM1.mjs.map} +1 -1
  133. package/dist/{impl-DzUTmaID2.mjs → impl-CsaT3aM2.mjs} +2 -2
  134. package/dist/impl-CsaT3aM2.mjs.map +1 -0
  135. package/dist/impl-Cvyc-iTI2.mjs +2 -0
  136. package/dist/impl-Cvyc-iTI2.mjs.map +1 -0
  137. package/dist/impl-CwBa15M42.mjs +3 -0
  138. package/dist/impl-CwBa15M42.mjs.map +1 -0
  139. package/dist/impl-D3gqip90.mjs +2 -0
  140. package/dist/impl-D3gqip90.mjs.map +1 -0
  141. package/dist/{impl-nz1MyjX22.mjs → impl-D6Lzwd-R2.mjs} +2 -2
  142. package/dist/{impl-nz1MyjX22.mjs.map → impl-D6Lzwd-R2.mjs.map} +1 -1
  143. package/dist/impl-DG-041kN.mjs +3 -0
  144. package/dist/impl-DG-041kN.mjs.map +1 -0
  145. package/dist/{impl-CD2R3L0v.mjs → impl-DTvnDByz.mjs} +2 -2
  146. package/dist/{impl-CD2R3L0v.mjs.map → impl-DTvnDByz.mjs.map} +1 -1
  147. package/dist/{impl-CTwyYUw3.mjs → impl-DUg1sDwg.mjs} +2 -2
  148. package/dist/{impl-CTwyYUw3.mjs.map → impl-DUg1sDwg.mjs.map} +1 -1
  149. package/dist/{impl-DKepRc812.mjs → impl-DeCRXfAh2.mjs} +2 -2
  150. package/dist/{impl-DKepRc812.mjs.map → impl-DeCRXfAh2.mjs.map} +1 -1
  151. package/dist/{impl-COujMWgp.mjs → impl-Dg7XSQdO2.mjs} +2 -2
  152. package/dist/impl-Dg7XSQdO2.mjs.map +1 -0
  153. package/dist/{impl-a_Y8bnSn.mjs → impl-DhXzxQDN2.mjs} +5 -5
  154. package/dist/impl-DhXzxQDN2.mjs.map +1 -0
  155. package/dist/{impl-C2sSZ8qF.mjs → impl-DldrBJEa.mjs} +2 -2
  156. package/dist/{impl-C2sSZ8qF.mjs.map → impl-DldrBJEa.mjs.map} +1 -1
  157. package/dist/{impl-gs5wJ1BK.mjs → impl-Dmn1CWts.mjs} +3 -3
  158. package/dist/{impl-gs5wJ1BK.mjs.map → impl-Dmn1CWts.mjs.map} +1 -1
  159. package/dist/impl-Dr9Jezjh2.mjs +2 -0
  160. package/dist/impl-Dr9Jezjh2.mjs.map +1 -0
  161. package/dist/impl-DtTfsHtL.mjs +2 -0
  162. package/dist/impl-DtTfsHtL.mjs.map +1 -0
  163. package/dist/impl-DzNEfRoS2.mjs +4 -0
  164. package/dist/{impl-D-AHlqlD2.mjs.map → impl-DzNEfRoS2.mjs.map} +1 -1
  165. package/dist/{impl-a0BFtbna.mjs → impl-HnrcGt_T.mjs} +2 -2
  166. package/dist/{impl-a0BFtbna.mjs.map → impl-HnrcGt_T.mjs.map} +1 -1
  167. package/dist/{impl-B5df-igZ.mjs → impl-QdSegO65.mjs} +2 -2
  168. package/dist/{impl-B5df-igZ.mjs.map → impl-QdSegO65.mjs.map} +1 -1
  169. package/dist/{impl-BJyzyrZD.mjs → impl-S90NUBGm.mjs} +2 -2
  170. package/dist/{impl-BJyzyrZD.mjs.map → impl-S90NUBGm.mjs.map} +1 -1
  171. package/dist/impl-Tr08dgdk.mjs +2 -0
  172. package/dist/{impl-DQPmSYSE.mjs.map → impl-Tr08dgdk.mjs.map} +1 -1
  173. package/dist/{impl-CPSEzCc9.mjs → impl-WJBuS_0m.mjs} +2 -2
  174. package/dist/{impl-CPSEzCc9.mjs.map → impl-WJBuS_0m.mjs.map} +1 -1
  175. package/dist/impl-b4KAEVci.mjs +2 -0
  176. package/dist/{impl-GytUVAMP.mjs.map → impl-b4KAEVci.mjs.map} +1 -1
  177. package/dist/impl-defjX-97.mjs +3 -0
  178. package/dist/impl-defjX-97.mjs.map +1 -0
  179. package/dist/{impl-DhxDp4GN.mjs → impl-fg0UZYw6.mjs} +2 -2
  180. package/dist/{impl-DhxDp4GN.mjs.map → impl-fg0UZYw6.mjs.map} +1 -1
  181. package/dist/{impl-CzdUHruN.mjs → impl-hRK54juc.mjs} +2 -2
  182. package/dist/{impl-CzdUHruN.mjs.map → impl-hRK54juc.mjs.map} +1 -1
  183. package/dist/{impl-CSk_okwj.mjs → impl-mjDxMEDR.mjs} +2 -2
  184. package/dist/{impl-CSk_okwj.mjs.map → impl-mjDxMEDR.mjs.map} +1 -1
  185. package/dist/index.d.mts +1 -1
  186. package/dist/index.mjs +2 -2
  187. package/dist/index.mjs.map +1 -1
  188. package/dist/{initializeCliRuntime-6wI_VIHV.mjs → initializeCliRuntime-BaATMO1X.mjs} +1 -1
  189. package/dist/{initializeCliRuntime-6wI_VIHV.mjs.map → initializeCliRuntime-BaATMO1X.mjs.map} +1 -1
  190. package/dist/{inquirer-BeaBetMO.mjs → inquirer-BU5IpgA8.mjs} +2 -2
  191. package/dist/{inquirer-BeaBetMO.mjs.map → inquirer-BU5IpgA8.mjs.map} +1 -1
  192. package/dist/{jsonc-D9dDWb1J.mjs → jsonc-CdTubr53.mjs} +1 -1
  193. package/dist/{jsonc-D9dDWb1J.mjs.map → jsonc-CdTubr53.mjs.map} +1 -1
  194. package/dist/{listFiles-BdFUbX5x.mjs → listFiles-DDGCBdtx.mjs} +1 -1
  195. package/dist/{listFiles-BdFUbX5x.mjs.map → listFiles-DDGCBdtx.mjs.map} +1 -1
  196. package/dist/logger-CPu6zbyQ.mjs +2 -0
  197. package/dist/logger-CPu6zbyQ.mjs.map +1 -0
  198. package/dist/{mapConsentCsvRowsToInputs-Dqb6WL4r.mjs → mapConsentCsvRowsToInputs-CkLfxaIf.mjs} +1 -1
  199. package/dist/{mapConsentCsvRowsToInputs-Dqb6WL4r.mjs.map → mapConsentCsvRowsToInputs-CkLfxaIf.mjs.map} +1 -1
  200. package/dist/markRequestDataSiloIdsCompleted-C6lV_My-.mjs +2 -0
  201. package/dist/{markRequestDataSiloIdsCompleted-Br5gIS3S.mjs.map → markRequestDataSiloIdsCompleted-C6lV_My-.mjs.map} +1 -1
  202. package/dist/{markSilentPrivacyRequests-Cs_iZNJs.mjs → markSilentPrivacyRequests-D3bFOMLh.mjs} +2 -2
  203. package/dist/{markSilentPrivacyRequests-Cs_iZNJs.mjs.map → markSilentPrivacyRequests-D3bFOMLh.mjs.map} +1 -1
  204. package/dist/{mergeTranscendInputs-DFQcbh8b.mjs → mergeTranscendInputs-B7WjxYMN.mjs} +3 -3
  205. package/dist/{mergeTranscendInputs-DFQcbh8b.mjs.map → mergeTranscendInputs-B7WjxYMN.mjs.map} +1 -1
  206. package/dist/missing-manifest-D8y1VL4p.mjs +2 -0
  207. package/dist/missing-manifest-D8y1VL4p.mjs.map +1 -0
  208. package/dist/{module-graph-Cb0g74Ft.mjs → module-graph-CAT8_JCG.mjs} +1 -1
  209. package/dist/{module-graph-Cb0g74Ft.mjs.map → module-graph-CAT8_JCG.mjs.map} +1 -1
  210. package/dist/{notifyPrivacyRequestsAdditionalTime-kPXTdjgT.mjs → notifyPrivacyRequestsAdditionalTime-BGUxsWLN.mjs} +2 -2
  211. package/dist/{notifyPrivacyRequestsAdditionalTime-kPXTdjgT.mjs.map → notifyPrivacyRequestsAdditionalTime-BGUxsWLN.mjs.map} +1 -1
  212. package/dist/{parquetToCsvOneFile-ChmPC6dL.mjs → parquetToCsvOneFile-DtbCFm08.mjs} +3 -3
  213. package/dist/{parquetToCsvOneFile-ChmPC6dL.mjs.map → parquetToCsvOneFile-DtbCFm08.mjs.map} +1 -1
  214. package/dist/{parseAttributesFromString-CO16oAlx.mjs → parseAttributesFromString-C5hJMRvt.mjs} +2 -2
  215. package/dist/{parseAttributesFromString-CO16oAlx.mjs.map → parseAttributesFromString-C5hJMRvt.mjs.map} +1 -1
  216. package/dist/{parseVariablesFromString-BOSfQ4QF.mjs → parseVariablesFromString-6TYW65LF.mjs} +1 -1
  217. package/dist/{parseVariablesFromString-BOSfQ4QF.mjs.map → parseVariablesFromString-6TYW65LF.mjs.map} +1 -1
  218. package/dist/paths-J5KScOaQ.mjs +2 -0
  219. package/dist/paths-J5KScOaQ.mjs.map +1 -0
  220. package/dist/policy-bundle-manifest-RgsjPnfI.mjs +7 -0
  221. package/dist/policy-bundle-manifest-RgsjPnfI.mjs.map +1 -0
  222. package/dist/policy-project-discovery-B4cFXUlA.mjs +430 -0
  223. package/dist/policy-project-discovery-B4cFXUlA.mjs.map +1 -0
  224. package/dist/{policy-runtime-BMKa-Upy.mjs → policy-runtime-6jmkXlBk.mjs} +2 -2
  225. package/dist/{policy-runtime-BMKa-Upy.mjs.map → policy-runtime-6jmkXlBk.mjs.map} +1 -1
  226. package/dist/policy-scaffold-config-CwlygiTz.mjs +76 -0
  227. package/dist/policy-scaffold-config-CwlygiTz.mjs.map +1 -0
  228. package/dist/{policyEngineCliError-DY8V-qkK.mjs → policyEngineCliError-CZrOHhLv.mjs} +1 -1
  229. package/dist/{policyEngineCliError-DY8V-qkK.mjs.map → policyEngineCliError-CZrOHhLv.mjs.map} +1 -1
  230. package/dist/printResult-Dmwv78e7.mjs +33 -0
  231. package/dist/printResult-Dmwv78e7.mjs.map +1 -0
  232. package/dist/project-discovery-BkHpTXDx.mjs +2 -0
  233. package/dist/project-discovery-BkHpTXDx.mjs.map +1 -0
  234. package/dist/project-discovery-CWRjlFnC.mjs +2 -0
  235. package/dist/project-discovery-CWRjlFnC.mjs.map +1 -0
  236. package/dist/project-plan-apply-Bg_1eMX9.mjs +3 -0
  237. package/dist/{project-plan-apply-Dvndx455.mjs.map → project-plan-apply-Bg_1eMX9.mjs.map} +1 -1
  238. package/dist/project-plan-output-BHHlkLxe.mjs +4 -0
  239. package/dist/project-plan-output-BHHlkLxe.mjs.map +1 -0
  240. package/dist/prompts-BhXfYD6g.mjs +2 -0
  241. package/dist/prompts-BhXfYD6g.mjs.map +1 -0
  242. package/dist/{pullAllDatapoints-uk5ggk6O.mjs → pullAllDatapoints-CNqQSSmF.mjs} +3 -3
  243. package/dist/{pullAllDatapoints-uk5ggk6O.mjs.map → pullAllDatapoints-CNqQSSmF.mjs.map} +1 -1
  244. package/dist/pullChunkedCustomSiloOutstandingIdentifiers-BfNNWqeI.mjs +2 -0
  245. package/dist/{pullChunkedCustomSiloOutstandingIdentifiers-DbFFXAVM.mjs.map → pullChunkedCustomSiloOutstandingIdentifiers-BfNNWqeI.mjs.map} +1 -1
  246. package/dist/{pullConsentManagerMetrics-Dv5n1ZGp.mjs → pullConsentManagerMetrics-DKCkfbCB.mjs} +2 -2
  247. package/dist/{pullConsentManagerMetrics-Dv5n1ZGp.mjs.map → pullConsentManagerMetrics-DKCkfbCB.mjs.map} +1 -1
  248. package/dist/pullManualEnrichmentIdentifiersToCsv-B_lWa6Yg.mjs +2 -0
  249. package/dist/{pullManualEnrichmentIdentifiersToCsv-D5is0Nrs.mjs.map → pullManualEnrichmentIdentifiersToCsv-B_lWa6Yg.mjs.map} +1 -1
  250. package/dist/{pullTranscendConfiguration-B63M3ild.mjs → pullTranscendConfiguration-CDUDqxpm.mjs} +2 -2
  251. package/dist/{pullTranscendConfiguration-B63M3ild.mjs.map → pullTranscendConfiguration-CDUDqxpm.mjs.map} +1 -1
  252. package/dist/{pullUnstructuredSubDataPointRecommendations-YTBzfkRZ.mjs → pullUnstructuredSubDataPointRecommendations-Ci4AOxyH.mjs} +2 -2
  253. package/dist/{pullUnstructuredSubDataPointRecommendations-YTBzfkRZ.mjs.map → pullUnstructuredSubDataPointRecommendations-Ci4AOxyH.mjs.map} +1 -1
  254. package/dist/{pushCronIdentifiersFromCsv-Ctq38wAY.mjs → pushCronIdentifiersFromCsv-CDhlEf6n.mjs} +2 -2
  255. package/dist/{pushCronIdentifiersFromCsv-Ctq38wAY.mjs.map → pushCronIdentifiersFromCsv-CDhlEf6n.mjs.map} +1 -1
  256. package/dist/pushManualEnrichmentIdentifiersFromCsv-Bn_028w5.mjs +2 -0
  257. package/dist/{pushManualEnrichmentIdentifiersFromCsv-0WHf6d_m.mjs.map → pushManualEnrichmentIdentifiersFromCsv-Bn_028w5.mjs.map} +1 -1
  258. package/dist/{readCsv-DLg8pwjd.mjs → readCsv-DNcJ_UfU.mjs} +1 -1
  259. package/dist/{readCsv-DLg8pwjd.mjs.map → readCsv-DNcJ_UfU.mjs.map} +1 -1
  260. package/dist/{readTranscendYaml-BNn6-Ofi.mjs → readTranscendYaml-BfqQbPiT.mjs} +3 -3
  261. package/dist/{readTranscendYaml-BNn6-Ofi.mjs.map → readTranscendYaml-BfqQbPiT.mjs.map} +1 -1
  262. package/dist/{removeUnverifiedRequestIdentifiers-Do3Pus6m.mjs → removeUnverifiedRequestIdentifiers-DcI9ut4q.mjs} +2 -2
  263. package/dist/{removeUnverifiedRequestIdentifiers-Do3Pus6m.mjs.map → removeUnverifiedRequestIdentifiers-DcI9ut4q.mjs.map} +1 -1
  264. package/dist/{renderTable-D68QasPc.mjs → renderTable-CZP2roD1.mjs} +1 -1
  265. package/dist/{renderTable-D68QasPc.mjs.map → renderTable-CZP2roD1.mjs.map} +1 -1
  266. package/dist/{request-BiPv6jmP.mjs → request-BpKyN9Xm.mjs} +1 -1
  267. package/dist/{request-BiPv6jmP.mjs.map → request-BpKyN9Xm.mjs.map} +1 -1
  268. package/dist/resolveBundleIdByName-BPrMkU0w.mjs +2 -0
  269. package/dist/resolveBundleIdByName-BPrMkU0w.mjs.map +1 -0
  270. package/dist/resolvePolicyBundleVersion-BrVz4LKN.mjs +2 -0
  271. package/dist/resolvePolicyBundleVersion-BrVz4LKN.mjs.map +1 -0
  272. package/dist/{retryRequestDataSilos-CEgUW6Fx.mjs → retryRequestDataSilos-ZdY2PM0S.mjs} +2 -2
  273. package/dist/{retryRequestDataSilos-CEgUW6Fx.mjs.map → retryRequestDataSilos-ZdY2PM0S.mjs.map} +1 -1
  274. package/dist/{run-captured-process-BXwWXuTh.mjs → run-captured-process-BjaSDWXG.mjs} +1 -1
  275. package/dist/{run-captured-process-BXwWXuTh.mjs.map → run-captured-process-BjaSDWXG.mjs.map} +1 -1
  276. package/dist/{runOpa-CswzJxIs.mjs → runOpa-ojIqU1tO.mjs} +2 -2
  277. package/dist/{runOpa-CswzJxIs.mjs.map → runOpa-ojIqU1tO.mjs.map} +1 -1
  278. package/dist/{scaffold-model-BAbYTR0q.mjs → scaffold-model-CUZER0BC.mjs} +1 -1
  279. package/dist/scaffold-model-CUZER0BC.mjs.map +1 -0
  280. package/dist/{scaffold-planning-CNv83t_v.mjs → scaffold-planning-CaetLfv8.mjs} +9 -9
  281. package/dist/{scaffold-planning-CNv83t_v.mjs.map → scaffold-planning-CaetLfv8.mjs.map} +1 -1
  282. package/dist/{scaffold-templates-DzDGTZie.mjs → scaffold-templates-CUL82Zf8.mjs} +1 -1
  283. package/dist/{scaffold-templates-DzDGTZie.mjs.map → scaffold-templates-CUL82Zf8.mjs.map} +1 -1
  284. package/dist/{skipPreflightJobs-D_1mZ9mr.mjs → skipPreflightJobs-KdcSw8Td.mjs} +2 -2
  285. package/dist/{skipPreflightJobs-D_1mZ9mr.mjs.map → skipPreflightJobs-KdcSw8Td.mjs.map} +1 -1
  286. package/dist/{skipRequestDataSilos-CcGl9Z8M.mjs → skipRequestDataSilos-Cy2NfP47.mjs} +2 -2
  287. package/dist/{skipRequestDataSilos-CcGl9Z8M.mjs.map → skipRequestDataSilos-Cy2NfP47.mjs.map} +1 -1
  288. package/dist/{streamPrivacyRequestsToCsv-1l8RAcnK.mjs → streamPrivacyRequestsToCsv-ByRBG8Mb.mjs} +2 -2
  289. package/dist/{streamPrivacyRequestsToCsv-1l8RAcnK.mjs.map → streamPrivacyRequestsToCsv-ByRBG8Mb.mjs.map} +1 -1
  290. package/dist/{syncCodePackages-BHE2Tn1Q.mjs → syncCodePackages-DJnrcX5l.mjs} +2 -2
  291. package/dist/{syncCodePackages-BHE2Tn1Q.mjs.map → syncCodePackages-DJnrcX5l.mjs.map} +1 -1
  292. package/dist/updateConsentManagerVersionToLatest-KwMaAkwh.mjs +2 -0
  293. package/dist/{updateConsentManagerVersionToLatest-yZhBDcv8.mjs.map → updateConsentManagerVersionToLatest-KwMaAkwh.mjs.map} +1 -1
  294. package/dist/{uploadConsents-DQqApEaH.mjs → uploadConsents-C5LmI-9T.mjs} +2 -2
  295. package/dist/{uploadConsents-DQqApEaH.mjs.map → uploadConsents-C5LmI-9T.mjs.map} +1 -1
  296. package/dist/{uploadPrivacyRequestsFromCsv-ntuK0eSR.mjs → uploadPrivacyRequestsFromCsv-BsYnCgbl.mjs} +2 -2
  297. package/dist/{uploadPrivacyRequestsFromCsv-ntuK0eSR.mjs.map → uploadPrivacyRequestsFromCsv-BsYnCgbl.mjs.map} +1 -1
  298. package/dist/validateTranscendAuth-D-dDINof.mjs +2 -0
  299. package/dist/{validateTranscendAuth-D6Wr1cxY.mjs.map → validateTranscendAuth-D-dDINof.mjs.map} +1 -1
  300. package/dist/{writeCsv-D-2siSwE.mjs → writeCsv-CNZrq3zU.mjs} +1 -1
  301. package/dist/{writeCsv-D-2siSwE.mjs.map → writeCsv-CNZrq3zU.mjs.map} +1 -1
  302. package/package.json +8 -7
  303. package/dist/app-DhG-JhT3.mjs +0 -148
  304. package/dist/app-DhG-JhT3.mjs.map +0 -1
  305. package/dist/buildExamples-DOopJFYY.mjs +0 -2
  306. package/dist/buildExamples-DOopJFYY.mjs.map +0 -1
  307. package/dist/command-Ds6oNo0v.mjs +0 -9
  308. package/dist/command-Ds6oNo0v.mjs.map +0 -1
  309. package/dist/deno-runtime-DV52X8-P.mjs +0 -2
  310. package/dist/deno-runtime-DV52X8-P.mjs.map +0 -1
  311. package/dist/downloadPrivacyRequestFiles-D3bzcegH.mjs +0 -2
  312. package/dist/impl--JGnR3wp.mjs +0 -3
  313. package/dist/impl-7UqkSO3x2.mjs +0 -2
  314. package/dist/impl-7UqkSO3x2.mjs.map +0 -1
  315. package/dist/impl-B4BgGuF_.mjs +0 -3
  316. package/dist/impl-B4BgGuF_.mjs.map +0 -1
  317. package/dist/impl-B5oVsX-F2.mjs +0 -303
  318. package/dist/impl-B5oVsX-F2.mjs.map +0 -1
  319. package/dist/impl-BEA5cQOT2.mjs.map +0 -1
  320. package/dist/impl-BhfxcCgN2.mjs.map +0 -1
  321. package/dist/impl-BppXJ1AD2.mjs.map +0 -1
  322. package/dist/impl-C6HtWd1t.mjs +0 -2
  323. package/dist/impl-C6HtWd1t.mjs.map +0 -1
  324. package/dist/impl-CO4ZqlLV.mjs +0 -3
  325. package/dist/impl-CO4ZqlLV.mjs.map +0 -1
  326. package/dist/impl-COujMWgp.mjs.map +0 -1
  327. package/dist/impl-CUOVJsRg.mjs +0 -3
  328. package/dist/impl-CUOVJsRg.mjs.map +0 -1
  329. package/dist/impl-CUiYbk6G.mjs +0 -3
  330. package/dist/impl-CUiYbk6G.mjs.map +0 -1
  331. package/dist/impl-CfvxD3RI.mjs.map +0 -1
  332. package/dist/impl-CiBT9-GH2.mjs.map +0 -1
  333. package/dist/impl-Cli2XRp02.mjs +0 -2
  334. package/dist/impl-Cli2XRp02.mjs.map +0 -1
  335. package/dist/impl-D-AHlqlD2.mjs +0 -4
  336. package/dist/impl-DPN1En7L.mjs +0 -2
  337. package/dist/impl-DPN1En7L.mjs.map +0 -1
  338. package/dist/impl-DPtx5iZO.mjs +0 -5
  339. package/dist/impl-DQPmSYSE.mjs +0 -2
  340. package/dist/impl-DXRDWiB1.mjs +0 -2
  341. package/dist/impl-DXRDWiB1.mjs.map +0 -1
  342. package/dist/impl-DdIa0zla.mjs +0 -2
  343. package/dist/impl-DdIa0zla.mjs.map +0 -1
  344. package/dist/impl-Dp4bZvAV.mjs +0 -2
  345. package/dist/impl-Dp4bZvAV.mjs.map +0 -1
  346. package/dist/impl-DryC3OJu.mjs +0 -2
  347. package/dist/impl-DryC3OJu.mjs.map +0 -1
  348. package/dist/impl-DzUTmaID2.mjs.map +0 -1
  349. package/dist/impl-GytUVAMP.mjs +0 -2
  350. package/dist/impl-Z8oWVENM.mjs +0 -2
  351. package/dist/impl-Z8oWVENM.mjs.map +0 -1
  352. package/dist/impl-a_Y8bnSn.mjs.map +0 -1
  353. package/dist/impl-lsmXIGSo2.mjs.map +0 -1
  354. package/dist/logger-zplFSeXU.mjs +0 -2
  355. package/dist/logger-zplFSeXU.mjs.map +0 -1
  356. package/dist/manifest-BNIpO_zW.mjs +0 -2
  357. package/dist/manifest-BNIpO_zW.mjs.map +0 -1
  358. package/dist/markRequestDataSiloIdsCompleted-Br5gIS3S.mjs +0 -2
  359. package/dist/missing-manifest-DgcukXfg.mjs +0 -2
  360. package/dist/missing-manifest-DgcukXfg.mjs.map +0 -1
  361. package/dist/path-safety-D5Qwl40b.mjs +0 -2
  362. package/dist/path-safety-D5Qwl40b.mjs.map +0 -1
  363. package/dist/policy-bundle-manifest-D6dkbjNi.mjs +0 -7
  364. package/dist/policy-bundle-manifest-D6dkbjNi.mjs.map +0 -1
  365. package/dist/printResult-CHe3nRN4.mjs +0 -33
  366. package/dist/printResult-CHe3nRN4.mjs.map +0 -1
  367. package/dist/project-plan-apply-Dvndx455.mjs +0 -3
  368. package/dist/prompts-ClBXdELk.mjs +0 -4
  369. package/dist/prompts-ClBXdELk.mjs.map +0 -1
  370. package/dist/pullChunkedCustomSiloOutstandingIdentifiers-DbFFXAVM.mjs +0 -2
  371. package/dist/pullManualEnrichmentIdentifiersToCsv-D5is0Nrs.mjs +0 -2
  372. package/dist/pushManualEnrichmentIdentifiersFromCsv-0WHf6d_m.mjs +0 -2
  373. package/dist/resolveBundleIdByName-qXZBrUz_.mjs +0 -2
  374. package/dist/resolveBundleIdByName-qXZBrUz_.mjs.map +0 -1
  375. package/dist/resolvePolicyBundleVersion-BG7XqBBP.mjs +0 -2
  376. package/dist/resolvePolicyBundleVersion-BG7XqBBP.mjs.map +0 -1
  377. package/dist/scaffold-model-BAbYTR0q.mjs.map +0 -1
  378. package/dist/updateConsentManagerVersionToLatest-yZhBDcv8.mjs +0 -2
  379. package/dist/validateTranscendAuth-D6Wr1cxY.mjs +0 -2
@@ -0,0 +1,7 @@
1
+ import{c as e,l as t,m as n}from"./policy-project-discovery-B4cFXUlA.mjs";const r=/^\s*package\s+/mu;function i(e,t){let n=/^[A-Za-z_][A-Za-z0-9_]*/u.exec(e.slice(t));return n?{identifier:n[0],end:t+n[0].length}:void 0}function a(e,t){let n=t;for(;n<e.length&&/\s/u.test(e[n]);)n+=1;return n}function o(e,t){if(e[t]==="`"){let n=e.indexOf("`",t+1);return n===-1?void 0:{value:e.slice(t+1,n),end:n+1}}if(e[t]!==`"`)return;let n=t+1;for(;n<e.length;){if(e[n]===`\\`){n+=2;continue}if(e[n]===`"`){let r=e.slice(t,n+1);try{return{value:JSON.parse(r),end:n+1}}catch{return}}n+=1}}function s(e,t){let n=i(e,t);if(!n)return;let r=[n.identifier],s=n.end;for(;s<e.length;){let t=a(e,s);if(e[t]===`.`){let n=i(e,a(e,t+1));if(!n)break;r.push(n.identifier),s=n.end;continue}if(e[t]===`[`){let n=o(e,a(e,t+1));if(!n)break;let i=a(e,n.end);if(e[i]!==`]`)break;r.push(n.value),s=i+1;continue}break}return{source:e.slice(t,s),segments:r,end:s}}function c(e){let t=r.exec(e);if(!t)return;let n=s(e,t.index+t[0].length);return n?{source:n.source,segments:n.segments}:void 0}function l(e,t){let n=e[t],r=t+1;for(;r<e.length;){if(n===`"`&&e[r]===`\\`){r+=2;continue}if(e[r]===n)return r+1;r+=1}return r}function u(e){let t=[],n=0;for(;n<e.length;){if(e[n]===`#`){let t=e.indexOf(`
2
+ `,n);n=t===-1?e.length:t+1;continue}if(e[n]===`"`||e[n]==="`"){n=l(e,n);continue}let r=i(e,n);if(!r){n+=1;continue}if(r.identifier!==`data`){n=r.end;continue}let a=s(e,n);if(!a||a.segments.length===1){n=r.end;continue}let o=e.lastIndexOf(`
3
+ `,n-1)+1;/^\s*import\s+$/u.test(e.slice(o,n))||t.push({reference:a,line:e.slice(0,n).split(`
4
+ `).length}),n=a.end}return t}function d(e){return e.endsWith(`.rego`)&&!e.endsWith(`_test.rego`)}function f(t){if(t===void 0)throw Error(`Policy bundle directory must contain a ${e} file.`);let n;try{n=JSON.parse(t)}catch(t){throw Error(`${e} is not valid JSON: ${t instanceof Error?t.message:String(t)}`,{cause:t})}if(!n||typeof n!=`object`||Array.isArray(n))throw Error(`${e} must contain a JSON object.`);let r=n.roots;if(!Array.isArray(r)||r.length===0)throw Error(`${e} must declare "roots" as a non-empty array of strings (e.g. {"roots":["policy_engine"]}).`);if(!r.every(e=>typeof e==`string`&&e.length>0))throw Error(`${e} "roots" must be an array of non-empty strings.`);if(!r.every(e=>e.split(`/`).every(e=>/^[A-Za-z_][A-Za-z0-9_]*$/u.test(e))))throw Error(`${e} "roots" must contain slash-separated Rego identifiers so Policy Engine can re-namespace them safely.`);let i=p(n);return i===void 0?{roots:r}:{roots:r,template:i}}function p(e){let r=e.metadata;if(!r||typeof r!=`object`||Array.isArray(r))return;let i=r[t];if(!i||typeof i!=`object`||Array.isArray(i))return;let a=i.template;if(typeof a==`string`)return n.includes(a)?a:void 0}function m(e,t){return e.length>=t.length&&t.every((t,n)=>t===e[n])}function h(e,t){let n=t.join(`.`),r=e.source.slice(n.length);return e.source.startsWith(n)&&(r===``||r.startsWith(`.`)||/^\s*\[/u.test(r))}function g(e,t){return m(e.slice(1),t)}function _(t,n){let r=f(t),i=r.roots.join(`, `),a=n.filter(({path:e})=>d(e)).slice().sort((e,t)=>e.path.localeCompare(t.path));if(a.length===0)throw Error(`Policy bundle directory must contain at least one .rego policy file.`);let o=r.roots.map(e=>e.split(`/`)),s=a.flatMap(({path:e,contents:t})=>{let n=c(t);return!n||o.some(e=>h(n,e))?[]:[` - ${e} (package ${n.source}) is not covered by roots [${i}]`]});if(s.length>0)throw Error([`${e} "roots" do not cover all Rego packages in the bundle; uncovered packages will fail-closed at decide time. Either broaden "roots" or move the policy under a covered package:`,...s].join(`
5
+ `));let l=a.flatMap(({path:e,contents:t})=>u(t).filter(({reference:e})=>o.some(t=>g(e.segments,t))).map(({reference:t,line:n})=>` - ${e}:${n} references ${t.source}; import that package and use its local name`));if(l.length>0)throw Error([`Publishable Rego must not reference its declared bundle roots directly because Policy Engine re-namespaces package imports during activation:`,...l].join(`
6
+ `));return{manifest:r,publishableRegoPaths:a.map(({path:e})=>e)}}export{_ as n,f as t};
7
+ //# sourceMappingURL=policy-bundle-manifest-RgsjPnfI.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policy-bundle-manifest-RgsjPnfI.mjs","names":[],"sources":["../src/lib/policy/rego-reference.ts","../src/lib/policy/policy-bundle-manifest.ts"],"sourcesContent":["/** Parsed static Rego reference. */\ninterface StaticRegoReference {\n /** Source representation of the reference. */\n source: string;\n /** Logical document path segments. */\n segments: string[];\n /** Offset immediately after the reference. */\n end: number;\n}\n\n/** Matches the beginning of a Rego package declaration. */\nconst PACKAGE_DECLARATION_PATTERN = /^\\s*package\\s+/mu;\n\n/**\n * Read an identifier at a source offset.\n *\n * @param source - Rego source\n * @param start - Candidate identifier offset\n * @returns Identifier and following offset\n */\nfunction readIdentifier(\n source: string,\n start: number,\n): { identifier: string; end: number } | undefined {\n const match = /^[A-Za-z_][A-Za-z0-9_]*/u.exec(source.slice(start));\n return match ? { identifier: match[0], end: start + match[0].length } : undefined;\n}\n\n/**\n * Advance past Rego whitespace.\n *\n * @param source - Rego source\n * @param start - Initial source offset\n * @returns First non-whitespace offset\n */\nfunction skipWhitespace(source: string, start: number): number {\n let current = start;\n while (current < source.length && /\\s/u.test(source[current]!)) {\n current += 1;\n }\n return current;\n}\n\n/**\n * Read a quoted or raw Rego string.\n *\n * @param source - Rego source\n * @param start - Opening quote offset\n * @returns Decoded string and following offset\n */\nfunction readQuotedString(\n source: string,\n start: number,\n): { value: string; end: number } | undefined {\n if (source[start] === '`') {\n const closingQuote = source.indexOf('`', start + 1);\n return closingQuote === -1\n ? undefined\n : { value: source.slice(start + 1, closingQuote), end: closingQuote + 1 };\n }\n if (source[start] !== '\"') {\n return undefined;\n }\n let current = start + 1;\n while (current < source.length) {\n if (source[current] === '\\\\') {\n current += 2;\n continue;\n }\n if (source[current] === '\"') {\n const raw = source.slice(start, current + 1);\n try {\n return { value: JSON.parse(raw) as string, end: current + 1 };\n } catch {\n return undefined;\n }\n }\n current += 1;\n }\n return undefined;\n}\n\n/**\n * Parse a static Rego reference with dotted or quoted bracket segments.\n *\n * @param source - Rego source\n * @param start - First identifier offset\n * @returns Parsed reference\n */\nfunction parseStaticRegoReference(source: string, start: number): StaticRegoReference | undefined {\n const first = readIdentifier(source, start);\n if (!first) {\n return undefined;\n }\n const segments = [first.identifier];\n let current = first.end;\n while (current < source.length) {\n const separator = skipWhitespace(source, current);\n if (source[separator] === '.') {\n const identifierStart = skipWhitespace(source, separator + 1);\n const identifier = readIdentifier(source, identifierStart);\n if (!identifier) {\n break;\n }\n segments.push(identifier.identifier);\n current = identifier.end;\n continue;\n }\n if (source[separator] === '[') {\n const stringStart = skipWhitespace(source, separator + 1);\n const value = readQuotedString(source, stringStart);\n if (!value) {\n break;\n }\n const closingBracket = skipWhitespace(source, value.end);\n if (source[closingBracket] !== ']') {\n break;\n }\n segments.push(value.value);\n current = closingBracket + 1;\n continue;\n }\n break;\n }\n return {\n source: source.slice(start, current),\n segments,\n end: current,\n };\n}\n\n/**\n * Read the package reference declared by Rego source.\n *\n * @param contents - Rego source\n * @returns Package reference, or undefined when no declaration is present\n */\nexport function parseRegoPackageReference(\n contents: string,\n): Omit<StaticRegoReference, 'end'> | undefined {\n const declaration = PACKAGE_DECLARATION_PATTERN.exec(contents);\n if (!declaration) {\n return undefined;\n }\n const reference = parseStaticRegoReference(contents, declaration.index + declaration[0].length);\n return reference ? { source: reference.source, segments: reference.segments } : undefined;\n}\n\n/**\n * Skip a string literal while scanning executable Rego source.\n *\n * @param source - Rego source\n * @param start - Opening delimiter offset\n * @returns Offset immediately after the string\n */\nfunction skipStringLiteral(source: string, start: number): number {\n const delimiter = source[start]!;\n let current = start + 1;\n while (current < source.length) {\n if (delimiter === '\"' && source[current] === '\\\\') {\n current += 2;\n continue;\n }\n if (source[current] === delimiter) {\n return current + 1;\n }\n current += 1;\n }\n return current;\n}\n\n/**\n * Find executable static `data` references outside imports.\n *\n * @param contents - Rego source\n * @returns References with one-based source lines\n */\nexport function findDirectDataReferences(\n contents: string,\n): { reference: StaticRegoReference; line: number }[] {\n const references: { reference: StaticRegoReference; line: number }[] = [];\n let current = 0;\n while (current < contents.length) {\n if (contents[current] === '#') {\n const newline = contents.indexOf('\\n', current);\n current = newline === -1 ? contents.length : newline + 1;\n continue;\n }\n if (contents[current] === '\"' || contents[current] === '`') {\n current = skipStringLiteral(contents, current);\n continue;\n }\n const identifier = readIdentifier(contents, current);\n if (!identifier) {\n current += 1;\n continue;\n }\n if (identifier.identifier !== 'data') {\n current = identifier.end;\n continue;\n }\n const reference = parseStaticRegoReference(contents, current);\n if (!reference || reference.segments.length === 1) {\n current = identifier.end;\n continue;\n }\n const lineStart = contents.lastIndexOf('\\n', current - 1) + 1;\n if (!/^\\s*import\\s+$/u.test(contents.slice(lineStart, current))) {\n references.push({\n reference,\n line: contents.slice(0, current).split('\\n').length,\n });\n }\n current = reference.end;\n }\n return references;\n}\n","import {\n POLICY_MANIFEST_FILENAME,\n POLICY_MANIFEST_TRANSCEND_METADATA_KEY,\n POLICY_TEMPLATE_NAMES,\n type PolicyTemplateName,\n} from './policy-scaffold-templates.js';\nimport { findDirectDataReferences, parseRegoPackageReference } from './rego-reference.js';\n\n/** Shape of the policy bundle `.manifest` accepted by Policy Engine. */\nexport interface PolicyBundleManifest {\n /** Roots of the bundle, such as `policy_engine/transcend`. */\n roots: string[];\n /**\n * Optional scaffold template from `metadata.transcend.io.template`.\n *\n * Authoring hint only — upload does not branch on it. Permissions API\n * still keys off the remote bundle name `permissions`.\n */\n template?: PolicyTemplateName;\n}\n\n/** In-memory Rego file used to validate a policy bundle. */\nexport interface PolicyBundleRegoFile {\n /** POSIX-style path relative to the policy bundle directory. */\n path: string;\n /** Rego source contents. */\n contents: string;\n}\n\n/** Validated publishable policy bundle contents. */\nexport interface ValidatedPolicyBundleContents {\n /** Parsed and validated bundle manifest. */\n manifest: PolicyBundleManifest;\n /** Publishable Rego paths, excluding local test modules. */\n publishableRegoPaths: string[];\n}\n\n/**\n * Returns whether a relative path is a publishable Rego policy file.\n *\n * OPA test files (`*_test.rego`) are local-only and excluded from uploads.\n *\n * @param relativePath - Path relative to the bundle directory\n * @returns Whether the file belongs in the uploaded archive\n */\nexport function isPublishableRegoFile(relativePath: string): boolean {\n return relativePath.endsWith('.rego') && !relativePath.endsWith('_test.rego');\n}\n\n/**\n * Parse and validate the Policy Engine bundle manifest.\n *\n * @param contents - Raw manifest contents, or undefined when absent\n * @returns Parsed manifest\n */\nexport function parsePolicyBundleManifest(contents: string | undefined): PolicyBundleManifest {\n if (contents === undefined) {\n throw new Error(`Policy bundle directory must contain a ${POLICY_MANIFEST_FILENAME} file.`);\n }\n\n let parsed: unknown;\n try {\n parsed = JSON.parse(contents);\n } catch (error) {\n throw new Error(\n `${POLICY_MANIFEST_FILENAME} is not valid JSON: ${error instanceof Error ? error.message : String(error)}`,\n { cause: error },\n );\n }\n\n if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {\n throw new Error(`${POLICY_MANIFEST_FILENAME} must contain a JSON object.`);\n }\n\n const roots = (parsed as { roots?: unknown }).roots;\n if (!Array.isArray(roots) || roots.length === 0) {\n throw new Error(\n `${POLICY_MANIFEST_FILENAME} must declare \"roots\" as a non-empty array of strings (e.g. {\"roots\":[\"policy_engine\"]}).`,\n );\n }\n if (!roots.every((root) => typeof root === 'string' && root.length > 0)) {\n throw new Error(`${POLICY_MANIFEST_FILENAME} \"roots\" must be an array of non-empty strings.`);\n }\n if (\n !roots.every((root) =>\n root.split('/').every((segment: string) => /^[A-Za-z_][A-Za-z0-9_]*$/u.test(segment)),\n )\n ) {\n throw new Error(\n `${POLICY_MANIFEST_FILENAME} \"roots\" must contain slash-separated Rego identifiers so Policy Engine can re-namespace them safely.`,\n );\n }\n\n const template = parseOptionalManifestTemplate(parsed);\n\n return template === undefined ? { roots } : { roots, template };\n}\n\n/**\n * Read an optional `metadata.transcend.io.template` authoring hint.\n *\n * Invalid or unknown values are ignored so upload validation stays focused on\n * roots and Rego coverage.\n *\n * @param parsed - Parsed `.manifest` object\n * @returns Known template name, or undefined\n */\nfunction parseOptionalManifestTemplate(parsed: object): PolicyTemplateName | undefined {\n const metadata = (parsed as { metadata?: unknown }).metadata;\n if (!metadata || typeof metadata !== 'object' || Array.isArray(metadata)) {\n return undefined;\n }\n const transcend = (metadata as Record<string, unknown>)[POLICY_MANIFEST_TRANSCEND_METADATA_KEY];\n if (!transcend || typeof transcend !== 'object' || Array.isArray(transcend)) {\n return undefined;\n }\n const template = (transcend as { template?: unknown }).template;\n if (typeof template !== 'string') {\n return undefined;\n }\n return POLICY_TEMPLATE_NAMES.includes(template as PolicyTemplateName)\n ? (template as PolicyTemplateName)\n : undefined;\n}\n\n/**\n * Determine whether one document path starts with another.\n *\n * @param segments - Complete document path\n * @param prefix - Candidate root\n * @returns Whether the root covers the document path\n */\nfunction hasSegmentPrefix(segments: readonly string[], prefix: readonly string[]): boolean {\n return (\n segments.length >= prefix.length &&\n prefix.every((segment, index) => segment === segments[index])\n );\n}\n\n/**\n * Match the package syntax supported by Policy Engine activation.\n *\n * Bracketed segments remain supported below a declared dotted root.\n *\n * @param reference - Parsed package reference\n * @param root - Declared manifest root\n * @returns Whether activation can re-namespace the package\n */\nfunction rootCoversPackage(reference: { source: string }, root: readonly string[]): boolean {\n const dottedRoot = root.join('.');\n const suffix = reference.source.slice(dottedRoot.length);\n return (\n reference.source.startsWith(dottedRoot) &&\n (suffix === '' || suffix.startsWith('.') || /^\\s*\\[/u.test(suffix))\n );\n}\n\n/**\n * Determine whether `data.<root>` is referenced directly.\n *\n * @param segments - Parsed `data` reference segments\n * @param root - Declared manifest root\n * @returns Whether the reference targets the declared root\n */\nfunction referencesDeclaredRoot(segments: readonly string[], root: readonly string[]): boolean {\n return hasSegmentPrefix(segments.slice(1), root);\n}\n\n/**\n * Validate the manifest, publishable file requirement, and root coverage.\n *\n * This is the shared pure upload contract used by both `policy lint` and\n * `policy publish`.\n *\n * @param manifestContents - Raw manifest contents, or undefined when absent\n * @param regoFiles - All Rego files in the policy directory\n * @returns Validated manifest and publishable paths\n */\nexport function validatePolicyBundleContents(\n manifestContents: string | undefined,\n regoFiles: readonly PolicyBundleRegoFile[],\n): ValidatedPolicyBundleContents {\n const manifest = parsePolicyBundleManifest(manifestContents);\n const renderedRoots = manifest.roots.join(', ');\n const publishableFiles = regoFiles\n .filter(({ path }) => isPublishableRegoFile(path))\n .slice()\n .sort((left, right) => left.path.localeCompare(right.path));\n if (publishableFiles.length === 0) {\n throw new Error('Policy bundle directory must contain at least one .rego policy file.');\n }\n\n const rootPrefixes = manifest.roots.map((root) => root.split('/'));\n const uncovered = publishableFiles.flatMap(({ path, contents }) => {\n const packageReference = parseRegoPackageReference(contents);\n if (\n !packageReference ||\n rootPrefixes.some((prefix) => rootCoversPackage(packageReference, prefix))\n ) {\n return [];\n }\n return [\n ` - ${path} (package ${packageReference.source}) is not covered by roots [${renderedRoots}]`,\n ];\n });\n if (uncovered.length > 0) {\n throw new Error(\n [\n `${POLICY_MANIFEST_FILENAME} \"roots\" do not cover all Rego packages in the bundle; ` +\n 'uncovered packages will fail-closed at decide time. Either broaden \"roots\" or move the policy under a covered package:',\n ...uncovered,\n ].join('\\n'),\n );\n }\n\n const unsupportedReferences = publishableFiles.flatMap(({ path, contents }) =>\n findDirectDataReferences(contents)\n .filter(({ reference }) =>\n rootPrefixes.some((prefix) => referencesDeclaredRoot(reference.segments, prefix)),\n )\n .map(\n ({ reference, line }) =>\n ` - ${path}:${line} references ${reference.source}; import that package and use its local name`,\n ),\n );\n if (unsupportedReferences.length > 0) {\n throw new Error(\n [\n 'Publishable Rego must not reference its declared bundle roots directly because Policy Engine re-namespaces package imports during activation:',\n ...unsupportedReferences,\n ].join('\\n'),\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E,OAAM,cAAe,CACjE,IAAM,EAAmB,EAA0B,EAAS,CAO5D,MALE,CAAC,GACD,EAAa,KAAM,GAAW,EAAkB,EAAkB,EAAO,CAAC,CAEnE,EAAE,CAEJ,CACL,OAAO,EAAK,YAAY,EAAiB,OAAO,6BAA6B,EAAc,GAC5F,EACD,CACF,GAAI,EAAU,OAAS,EACrB,MAAU,MACR,CACE,GAAG,EAAyB,+KAE5B,GAAG,EACJ,CAAC,KAAK;EAAK,CACb,CAGH,IAAM,EAAwB,EAAiB,SAAS,CAAE,OAAM,cAC9D,EAAyB,EAAS,CAC/B,QAAQ,CAAE,eACT,EAAa,KAAM,GAAW,EAAuB,EAAU,SAAU,EAAO,CAAC,CAClF,CACA,KACE,CAAE,YAAW,UACZ,OAAO,EAAK,GAAG,EAAK,cAAc,EAAU,OAAO,8CACtD,CACJ,CACD,GAAI,EAAsB,OAAS,EACjC,MAAU,MACR,CACE,gJACA,GAAG,EACJ,CAAC,KAAK;EAAK,CACb,CAGH,MAAO,CACL,WACA,qBAAsB,EAAiB,KAAK,CAAE,UAAW,EAAK,CAC/D"}
@@ -0,0 +1,430 @@
1
+ import{g as e}from"./constants-BlKpAm3R.mjs";import{n as t,r as n}from"./project-discovery-CWRjlFnC.mjs";import{join as r,resolve as i}from"node:path";import a from"js-yaml";var o=`https://raw.githubusercontent.com/transcend-io/tools/main/packages/cli/schema/permissions-policy-input.json`,s=[{preferences:[{name:`Analytics`,choice:!0,days_since_choice:42},{name:`SaleOfInfo`,choice:null}],context:{region:`US-CA`}}],c={$schema:`http://json-schema.org/draft-07/schema#`,$id:o,title:`Permissions API policy input`,description:"JSON document Sombra posts as `{ input }` when evaluating a Permissions policy bundle via the OPA Data API.",type:`object`,additionalProperties:!1,required:[`preferences`,`context`],properties:{preferences:{type:`array`,description:`Purpose preference rows from Preference Store for the current subject.`,items:{type:`object`,additionalProperties:!1,required:[`name`,`choice`],properties:{name:{type:`string`,description:`Purpose slug (for example Analytics or SaleOfInfo).`},choice:{type:[`boolean`,`null`],description:`true when opted in, false when opted out, or null when unset.`},days_since_choice:{type:`integer`,minimum:0,description:`Whole days since the preference was last set. Omitted when no timestamp is available.`}}}},context:{type:`object`,description:`Caller-supplied context for the decision (for example region). Use an empty object when none is provided.`,additionalProperties:!0}},examples:s};const l=o,u=`1.18.2`,d=`example`,f=`${d}-bundle`,p=`input.schema.json`,m=`.manifest`,h=`permissions`,g=`transcend.io`,_={Generic:`generic`,Permissions:`permissions`},v=[_.Generic,_.Permissions];function y(t,n=_.Generic){return`{
2
+ "$schema": "https://openpolicyagent.org/schemas/bundle/v1/manifest.schema.json",
3
+ "revision": "",
4
+ "roots": ["${t}"],
5
+ "rego_version": 1,
6
+ "metadata": {
7
+ "${g}": {
8
+ "template": "${n}",
9
+ "templateVersion": "${e}"
10
+ }
11
+ }
12
+ }
13
+ `}y(d,_.Generic);function b(e){return`# Workspace-level Regal config for both publishable bundles under this tree.
14
+ # \`project.roots\` are package-path prefixes (same meaning as OPA \`.manifest\`
15
+ # roots), not filesystem folders. Each bundle also has its own \`.manifest\`.
16
+ capabilities:
17
+ from:
18
+ engine: opa
19
+ version: v${u}
20
+ project:
21
+ ${e.length===0?` roots: []`:` roots:\n${e.map(e=>` - ${e}`).join(`
22
+ `)}`}
23
+ rego-version: 1
24
+ `}function x(e,t){if(e.trim().length===0){let e=[t];return{contents:b(e),roots:e}}let n;try{n=a.load(e)}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`.regal/config.yaml is not valid YAML: ${t}`)}if(n==null){let e=[t];return{contents:b(e),roots:e}}if(typeof n!=`object`||Array.isArray(n))throw Error(`.regal/config.yaml must be a YAML mapping at the top level.`);let r={...n},i=r.project;if(i!=null&&(typeof i!=`object`||Array.isArray(i)))throw Error(`.regal/config.yaml project must be a YAML mapping when present.`);let o={...i??{}},s=o.roots,c;if(s===void 0)c=[t];else if(Array.isArray(s)&&s.every(e=>typeof e==`string`))c=[...new Set([...s,t])].sort((e,t)=>e.localeCompare(t));else throw Error(".regal/config.yaml project.roots must be an array of strings. Fix the Regal config before running `transcend policy new`.");o.roots=c,o[`rego-version`]===void 0&&(o[`rego-version`]=1),r.project=o,r.capabilities===void 0&&(r.capabilities={from:{engine:`opa`,version:`v${u}`}});let l=a.dump(r,{lineWidth:-1,noRefs:!0,sortKeys:!1});return{contents:l.endsWith(`
25
+ `)?l:`${l}\n`,roots:c}}b([d]);const S=b([]);`${d}`,`${d}${d}`;const C=`{
26
+ "subject": {
27
+ "trusted": false
28
+ }
29
+ }
30
+ `;`${d}`;const w=`# Local policy evaluation input (VS Code / Regal look for input.json here).
31
+ /input.json
32
+ `,T=`# Transcend Policy
33
+
34
+ Multi-bundle workspace for Transcend Policy Engine bundles
35
+ (OPA / Rego v1). Requires **Transcend CLI ≥ 11** (\`transcend policy --help\`
36
+ should list \`init\`, \`new\`, and positional \`[directory]\` args).
37
+
38
+ Each \`*-bundle/\` directory is a separate publishable unit (own \`.manifest\`,
39
+ input, and query path). Add a new bundle with:
40
+
41
+ \`\`\`sh
42
+ transcend policy new
43
+ \`\`\`
44
+
45
+ ## Quick start
46
+
47
+ \`\`\`sh
48
+ transcend policy init # create the workspace
49
+ transcend policy new --template generic # add a bundle from a template
50
+
51
+ transcend policy lint --noInteractive
52
+ transcend policy test
53
+ transcend policy eval transcend/policy/example-bundle \\
54
+ --package=data.example.result \\
55
+ --input=transcend/policy/example-bundle/input.json
56
+ \`\`\`
57
+
58
+ \`policy new\` also writes a gitignored \`input.json\` (copy of \`input.example.json\`)
59
+ for local Evaluate. \`policy lint\` / \`policy test\` default to every child with a
60
+ \`.manifest\` and use bundle-mode \`opa test -b\`, so both input files can coexist
61
+ without a merge error.
62
+
63
+ ## Layout
64
+
65
+ \`\`\`
66
+ transcend/policy/
67
+ example-bundle/ # publish directory (added by policy new)
68
+ example/ # package root (matches .manifest roots)
69
+ input.example.json
70
+ input.json # local only (gitignored)
71
+ input.schema.json # input JSON Schema (editor + opa --schema)
72
+ .regal/config.yaml
73
+ \`\`\`
74
+
75
+ Replace or delete example bundles when you have a real policy. Publish each
76
+ bundle separately (\`transcend policy publish --remote-bundle-name … <dir>\`).
77
+
78
+ ## Permissions API
79
+
80
+ Scaffold the Permissions starter, then simulate the query Sombra runs:
81
+
82
+ \`\`\`sh
83
+ transcend policy new \\
84
+ --template permissions \\
85
+ --name ${h} \\
86
+ --bundle-dir ${h}-bundle \\
87
+ --yes
88
+
89
+ transcend policy eval transcend/policy/${h}-bundle \\
90
+ --package=data.${h}.purposes \\
91
+ --input=transcend/policy/${h}-bundle/input.json \\
92
+ --schema=transcend/policy/${h}-bundle/input.schema.json
93
+ \`\`\`
94
+
95
+ Upload does **not** distinguish bundle kinds. What makes a bundle “Permissions”
96
+ is the remote name plus where Sombra queries it:
97
+
98
+ - **Permissions API** always loads the fixed remote bundle name
99
+ \`${h}\`. Publish that starter with
100
+ \`--remote-bundle-name=${h}\`.
101
+ - **Generic / decide** bundles use any other \`--remote-bundle-name\` and the decide
102
+ path.
103
+
104
+ Scaffolded \`.manifest\` files may include \`metadata.transcend.io.template\`
105
+ (\`generic\` or \`permissions\`) and \`templateVersion\` (the \`@transcend-io/cli\`
106
+ version that generated the scaffold) as authoring hints. Upload ignores them;
107
+ \`policy publish\` may warn when the template hint and \`--remote-bundle-name\` disagree.
108
+ `;`${f}${d}`,`${f}${d}`,`${f}${m}`,`${u}`,`${f}${p}`,`${f}`,`${f}`;const E=[{path:`.regal/config.yaml`,contents:S,description:`Pin strict Rego v1 linting to OPA ${u} capabilities`},{path:`README.md`,contents:T,description:`Create the concise multi-bundle workspace guide`}];function D(){return E.map(e=>({...e}))}const O={[_.Generic]:`Generic example`,[_.Permissions]:`Permission API starter`},k={[_.Generic]:`example`,[_.Permissions]:h};function A(e){return`${e}-bundle`}function j(e){return e?e===`.`||e===`..`||e.includes(`/`)||e.includes(`\\`)?`Bundle directory must be a single path segment (no slashes).`:/^[A-Za-z0-9][A-Za-z0-9._-]*$/u.test(e)?e.length>128?`Bundle directory cannot exceed 128 characters.`:!0:`Bundle directory must be alphanumeric (plus ., _, -), e.g. "my-bundle".`:`Enter a bundle directory name.`}function M(e,t=A(e)){let n=t;return[{path:`${n}/${m}`,contents:y(e,_.Generic),description:`Create the OPA bundle .manifest`},{path:`${n}/${p}`,contents:`{
109
+ "$schema": "http://json-schema.org/draft-07/schema#",
110
+ "$id": "https://transcend.io/policy-schemas/${e}/input.json",
111
+ "title": "${e===`example`?`Example policy input`:`${e} policy input`}",
112
+ "description": "${e===`example`?`Disposable teaching envelope for the example bundle.`:`Input envelope for the ${e} bundle.`}",
113
+ "type": "object",
114
+ "additionalProperties": true,
115
+ "properties": {
116
+ "subject": {
117
+ "type": "object",
118
+ "additionalProperties": true,
119
+ "properties": {
120
+ "trusted": {
121
+ "type": "boolean",
122
+ "description": "When true, the ${e===`example`?`example`:e} policy allows; otherwise it denies."
123
+ }
124
+ }
125
+ }
126
+ }
127
+ }
128
+ `,description:`Create the input JSON Schema for the ${e} bundle`},{path:`${n}/${e}/result/result.rego`,contents:`# METADATA
129
+ # title: ${e===`example`?`Disposable example result`:`${e} result`}
130
+ # description: |
131
+ # A fail-closed ${e===`example`?`teaching `:``}entrypoint. Replace this ${e===`example`?`example `:``}with the document
132
+ # tree and result contract required by your application.
133
+ # scope: package
134
+ # entrypoint: true
135
+ package ${e}.result
136
+
137
+ import rego.v1
138
+
139
+ default decision := "deny"
140
+
141
+ decision := "allow" if {
142
+ \tinput.subject.trusted == true
143
+ }
144
+
145
+ default reason_code := "untrusted_or_invalid_input"
146
+
147
+ reason_code := "trusted_subject" if {
148
+ \tdecision == "allow"
149
+ }
150
+ `,description:`Create a documented fail-closed result entrypoint`},{path:`${n}/${e}/result/result_test.rego`,contents:`package ${e}.result_test
151
+
152
+ import data.${e}.result
153
+ import rego.v1
154
+
155
+ test_denies_untrusted_subject if {
156
+ \tresult.decision == "deny" with input as {"subject": {"trusted": false}}
157
+ \tresult.reason_code == "untrusted_or_invalid_input" with input as {"subject": {"trusted": false}}
158
+ }
159
+
160
+ test_fails_closed_for_missing_subject if {
161
+ \tresult.decision == "deny" with input as {}
162
+ \tresult.reason_code == "untrusted_or_invalid_input" with input as {}
163
+ }
164
+
165
+ test_allows_trusted_subject if {
166
+ \tresult.decision == "allow" with input as {"subject": {"trusted": true}}
167
+ \tresult.reason_code == "trusted_subject" with input as {"subject": {"trusted": true}}
168
+ }
169
+ `,description:`Create executable tests for allow and fail-closed decisions`},{path:`${n}/input.example.json`,contents:C,description:`Create a sanitized local evaluation input example`},{path:`${n}/input.json`,contents:C,description:`Create a local evaluation input (gitignored copy of the example)`},{path:`${n}/.gitignore`,contents:w,description:`Ignore only the private local input file`}]}function N(){return`${JSON.stringify(c,null,2)}\n`}function P(){let[e]=s;if(!e)throw Error(`permissions-policy-input.json must declare at least one example`);return`${JSON.stringify(e,null,2)}\n`}function F(e,t=A(e)){let n=t,r=P();return[{path:`${n}/${m}`,contents:y(e,_.Permissions),description:`Create the OPA bundle .manifest`},{path:`${n}/${p}`,contents:N(),description:`Create the input JSON Schema for the ${e} bundle (from published permissions-policy-input.json)`},{path:`${n}/${e}/config/config.rego`,contents:`# METADATA
170
+ # title: Permissions config
171
+ # description: |
172
+ # Static bundle configuration. Values come from data.json in this directory.
173
+ package ${e}.config
174
+
175
+ import rego.v1
176
+ `,description:`Create the static bundle configuration package`},{path:`${n}/${e}/config/data.json`,contents:`{
177
+ "default_consent_allowed": true,
178
+ "purposes": [
179
+ "Analytics",
180
+ "SaleOfInfo"
181
+ ],
182
+ "default_consent": {}
183
+ }
184
+ `,description:`Create the static purpose configuration data`},{path:`${n}/${e}/helpers/preference/preference.rego`,contents:`# METADATA
185
+ # title: Purpose preference resolution
186
+ # description: |
187
+ # Resolves the subject's recorded choice for one purpose from the OPA
188
+ # \`input.preferences\` array Sombra injects (one \`{name, choice,
189
+ # days_since_choice?}\` entry per purpose; \`choice\` may be null when unset).
190
+ package ${e}.helpers.preference
191
+
192
+ import rego.v1
193
+
194
+ import data.${e}.config
195
+
196
+ raw_preferences := object.get(input, "preferences", [])
197
+
198
+ source_available if {
199
+ \tis_array(raw_preferences)
200
+ \tevery entry in raw_preferences {
201
+ \t\tis_object(entry)
202
+ \t\tis_string(entry.name)
203
+ \t\tentry.name != ""
204
+ \t}
205
+ }
206
+
207
+ # Boolean choice for a purpose, last-wins across duplicate entries (matching
208
+ # Sombra's own dedup semantics). Returns the boolean only when a usable choice
209
+ # exists; otherwise the rule is undefined and the purpose is undecided.
210
+ choice(name) := choice if {
211
+ \tsource_available
212
+ \tmatching := [entry | some entry in raw_preferences; entry.name == name]
213
+ \tcount(matching) > 0
214
+ \tlast := matching[count(matching) - 1]
215
+ \tchoice := object.get(last, "choice", null)
216
+ \tis_boolean(choice)
217
+ }
218
+
219
+ enabled(name) if choice(name) == true
220
+
221
+ disabled(name) if choice(name) == false
222
+
223
+ decided(name) if enabled(name)
224
+
225
+ decided(name) if disabled(name)
226
+
227
+ # A configured purpose with no usable boolean choice is undecided: the subject
228
+ # never chose, so the resolved default applies (not an opt-out).
229
+ undecided(name) if {
230
+ \tname in config.purposes
231
+ \tnot enabled(name)
232
+ \tnot disabled(name)
233
+ }
234
+ `,description:`Create purpose preference resolution helpers`},{path:`${n}/${e}/helpers/preference/preference_test.rego`,contents:`# Mechanical tests for purpose preference resolution.
235
+ # Policy outcomes are tested beside the public entrypoint.
236
+ package ${e}.helpers.preference_test
237
+
238
+ import rego.v1
239
+
240
+ import data.${e}.helpers.preference
241
+
242
+ given(preferences) := {"preferences": preferences}
243
+
244
+ test_treats_an_absent_preferences_array_as_no_recorded_choices if {
245
+ \tfixture := {}
246
+
247
+ \tpreference.source_available with input as fixture
248
+ \tpreference.undecided("Analytics") with input as fixture
249
+ }
250
+
251
+ test_accepts_an_empty_preferences_array if {
252
+ \tfixture := given([])
253
+
254
+ \tpreference.source_available with input as fixture
255
+ \tpreference.undecided("Analytics") with input as fixture
256
+ }
257
+
258
+ test_reports_a_non_array_preferences_as_unavailable if {
259
+ \tnot preference.source_available with input as {"preferences": {"Analytics": true}}
260
+ }
261
+
262
+ test_reports_entries_without_a_usable_name_as_unavailable if {
263
+ \tnot preference.source_available with input as {"preferences": [{}]}
264
+ \tnot preference.source_available with input as {"preferences": [{"name": ""}]}
265
+ \tnot preference.source_available with input as {"preferences": [{"choice": true}]}
266
+ }
267
+
268
+ test_distinguishes_enabled_and_disabled_choices if {
269
+ \tfixture := given([
270
+ \t\t{"name": "Analytics", "choice": true},
271
+ \t\t{"name": "SaleOfInfo", "choice": false},
272
+ \t])
273
+
274
+ \tpreference.enabled("Analytics") with input as fixture
275
+ \tpreference.disabled("SaleOfInfo") with input as fixture
276
+ \tpreference.decided("Analytics") with input as fixture
277
+ \tpreference.decided("SaleOfInfo") with input as fixture
278
+ \tnot preference.undecided("Analytics") with input as fixture
279
+ }
280
+
281
+ test_treats_a_null_choice_as_undecided if {
282
+ \tfixture := given([{"name": "Analytics", "choice": null}])
283
+
284
+ \tpreference.undecided("Analytics") with input as fixture
285
+ \tnot preference.decided("Analytics") with input as fixture
286
+ }
287
+
288
+ test_treats_an_absent_choice_key_as_undecided if {
289
+ \tfixture := given([{"name": "Analytics", "channel": "email"}])
290
+
291
+ \tpreference.undecided("Analytics") with input as fixture
292
+ }
293
+
294
+ test_treats_a_non_boolean_choice_as_undecided if {
295
+ \tfixture := given([{"name": "SaleOfInfo", "choice": "Daily"}])
296
+
297
+ \tpreference.undecided("SaleOfInfo") with input as fixture
298
+ \tnot preference.decided("SaleOfInfo") with input as fixture
299
+ }
300
+
301
+ # Sombra dedupes by purpose before sending; last-wins keeps the bundle correct
302
+ # against hand-crafted input that names the same purpose twice.
303
+ test_last_wins_on_duplicate_entries if {
304
+ \tfixture := given([
305
+ \t\t{"name": "SaleOfInfo", "choice": true},
306
+ \t\t{"name": "SaleOfInfo", "choice": false},
307
+ \t])
308
+
309
+ \tpreference.disabled("SaleOfInfo") with input as fixture
310
+ \tnot preference.enabled("SaleOfInfo") with input as fixture
311
+ }
312
+
313
+ # Extra fields on an entry (evidence, days_since_choice, channel) are ignored
314
+ # rather than treated as a choice.
315
+ test_ignores_fields_beyond_the_recorded_choice if {
316
+ \tfixture := given([{
317
+ \t\t"name": "Analytics",
318
+ \t\t"choice": true,
319
+ \t\t"evidence": "consent_banner",
320
+ \t\t"days_since_choice": 45,
321
+ \t\t"channel": "email",
322
+ \t}])
323
+
324
+ \tpreference.enabled("Analytics") with input as fixture
325
+ }
326
+ `,description:`Create preference resolution tests`},{path:`${n}/${e}/purposes/analytics/analytics.rego`,contents:`# METADATA
327
+ # title: Analytics purpose decision
328
+ # description: |
329
+ # The Analytics purpose's verdict as a \`result\` document
330
+ # (\`data.${e}.purposes.analytics.result\`).
331
+ package ${e}.purposes.analytics
332
+
333
+ import rego.v1
334
+
335
+ import data.${e}.helpers.preference
336
+
337
+ default result := {
338
+ \t"decision": "deny",
339
+ \t"reason_code": "default_deny",
340
+ }
341
+
342
+ result := {
343
+ \t"decision": "allow",
344
+ \t"reason_code": "explicit_allow",
345
+ } if {
346
+ \tpreference.enabled("Analytics")
347
+ }
348
+
349
+ result := {
350
+ \t"decision": "deny",
351
+ \t"reason_code": "explicit_deny",
352
+ } if {
353
+ \tpreference.disabled("Analytics")
354
+ }
355
+
356
+ result := {
357
+ \t"decision": "allow",
358
+ \t"reason_code": "default_allow",
359
+ } if {
360
+ \tpreference.undecided("Analytics")
361
+ }
362
+ `,description:`Create the analytics purpose decision rule`},{path:`${n}/${e}/purposes/analytics/analytics_test.rego`,contents:`# Policy outcomes for the Analytics purpose (the queried document).
363
+ package ${e}.purposes.analytics_test
364
+
365
+ import rego.v1
366
+
367
+ import data.${e}.purposes.analytics
368
+
369
+ given(preferences) := {"preferences": preferences}
370
+
371
+ test_explicit_allow if {
372
+ \tresult := analytics.result with input as given([{"name": "Analytics", "choice": true}])
373
+ \tresult == {
374
+ \t\t"decision": "allow",
375
+ \t\t"reason_code": "explicit_allow",
376
+ \t}
377
+ }
378
+
379
+ test_explicit_deny if {
380
+ \tresult := analytics.result with input as given([{"name": "Analytics", "choice": false}])
381
+ \tresult == {
382
+ \t\t"decision": "deny",
383
+ \t\t"reason_code": "explicit_deny",
384
+ \t}
385
+ }
386
+
387
+ test_undecided_resolves_to_default_allow if {
388
+ \tresult := analytics.result with input as given([])
389
+ \tresult == {
390
+ \t\t"decision": "allow",
391
+ \t\t"reason_code": "default_allow",
392
+ \t}
393
+ }
394
+
395
+ test_missing_preferences_resolves_to_default_allow if {
396
+ \tresult := analytics.result with input as {}
397
+ \tresult == {
398
+ \t\t"decision": "allow",
399
+ \t\t"reason_code": "default_allow",
400
+ \t}
401
+ }
402
+
403
+ test_non_boolean_choice_falls_back_to_default_allow if {
404
+ \tresult := analytics.result with input as given([{"name": "Analytics", "choice": "yes"}])
405
+ \tresult == {
406
+ \t\t"decision": "allow",
407
+ \t\t"reason_code": "default_allow",
408
+ \t}
409
+ }
410
+
411
+ test_malformed_preferences_are_treated_as_undecided if {
412
+ \t# source_available is false, so enabled/disabled never fire; undecided still
413
+ \t# holds for configured purposes (not enabled and not disabled).
414
+ \tresult := analytics.result with input as {"preferences": {"Analytics": true}}
415
+ \tresult == {
416
+ \t\t"decision": "allow",
417
+ \t\t"reason_code": "default_allow",
418
+ \t}
419
+ }
420
+ `,description:`Create analytics purpose decision tests`},{path:`${n}/${e}/purposes/entrypoint.rego`,contents:`# METADATA
421
+ # title: Purpose decisions
422
+ # description: Returns each purpose's decision and reason code.
423
+ # scope: package
424
+ # entrypoint: true
425
+ package ${e}.purposes
426
+
427
+ import rego.v1
428
+ `,description:`Create the purposes entrypoint`},{path:`${n}/input.example.json`,contents:r,description:`Create a sanitized permissions evaluation input example`},{path:`${n}/input.json`,contents:r,description:`Create a local evaluation input (gitignored copy of the example)`},{path:`${n}/.gitignore`,contents:w,description:`Ignore only the private local input file`}]}function I(e,t,n=A(t)){switch(e){case _.Generic:return M(t,n);case _.Permissions:return F(t,n);default:throw Error(`Unknown policy template: ${String(e)}`)}}function L(e){let{bundleDirectory:t,root:n,template:r}=e,i=r===_.Permissions?`data.${n}.purposes`:`data.${n}.result`;return[`transcend policy eval ${t} \\`,` --package=${i} \\`,` --input=${t}/input.json \\`,` --schema=${t}/${p}`].join(`
429
+ `)}const R=`transcend/policy`;function z(e,t=R){return i(e,t)}function B(e,t){if(!e.fs.existsSync(t)||!e.fs.statSync(t).isDirectory())return[];let n=r(t,m);return e.fs.existsSync(n)&&e.fs.statSync(n).isFile()?[t]:e.fs.readdirSync(t,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>r(t,e.name)).filter(t=>{let n=r(t,m);return e.fs.existsSync(n)&&e.fs.statSync(n).isFile()}).sort((e,t)=>e.localeCompare(t))}function V(e,r=R){let i=e.process.cwd(),a=z(i,r);if(e.fs.existsSync(a)&&!e.fs.statSync(a).isDirectory())throw Error(`Policy target is not a directory: ${a}`);return{invocationDirectory:i,targetDirectory:a,...n(e,{invocationDirectory:i,targetDirectory:a,standaloneProjectRoot:i}),relativePaths:t(e,a),relativeFilePaths:t(e,a,{includeDirectories:!1})}}export{j as S,A as _,h as a,D as b,m as c,u as d,d as f,_ as g,O as h,z as i,g as l,v as m,B as n,l as o,k as p,V as r,p as s,R as t,f as u,L as v,x,I as y};
430
+ //# sourceMappingURL=policy-project-discovery-B4cFXUlA.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policy-project-discovery-B4cFXUlA.mjs","names":["permissionsPolicyInputSchema.$id","CLI_VERSION","permissionsPolicyInputSchema","permissionsPolicyInputSchema.examples"],"sources":["../schema/permissions-policy-input.json","../src/lib/policy/policy-scaffold-templates.ts","../src/lib/policy/policy-project-discovery.ts"],"sourcesContent":["","import yaml from 'js-yaml';\n\nimport permissionsPolicyInputSchema from '../../../schema/permissions-policy-input.json' with { type: 'json' };\nimport { version as CLI_VERSION } from '../../constants.js';\n\n/** Published Permissions API OPA input schema `$id` (raw GitHub URL). */\nexport const PERMISSIONS_POLICY_INPUT_SCHEMA_ID = permissionsPolicyInputSchema.$id;\n\n/** OPA version targeted by generated policy authoring configuration. */\nexport const POLICY_STARTER_OPA_VERSION = '1.18.2';\n\n/**\n * Package-path prefix for the disposable starter bundle.\n *\n * Matches OPA `.manifest` `roots` and Regal `project.roots` (not a filesystem\n * folder name by itself). The default publish directory is `{root}-bundle/`;\n * `policy new --bundle-dir` can override that basename.\n */\nexport const POLICY_STARTER_ROOT = 'example';\n\n/** Publish directory name for the disposable starter (`{root}-bundle`). */\nexport const POLICY_STARTER_BUNDLE_DIRECTORY = `${POLICY_STARTER_ROOT}-bundle`;\n\n/** Input JSON Schema filename written beside each publish directory's fixtures. */\nexport const POLICY_INPUT_SCHEMA_FILENAME = 'input.schema.json';\n\n/** One deterministic file in the safe policy starter. */\nexport interface PolicyStarterFile {\n /** POSIX-style path relative to the policy workspace directory. */\n path: string;\n /** Complete UTF-8 file contents. */\n contents: string;\n /** Human-readable reason shown in the plan. */\n description: string;\n}\n\n/** OPA bundle manifest filename used for local authoring and upload. */\nexport const POLICY_MANIFEST_FILENAME = '.manifest';\n\n/**\n * Remote bundle name reserved for Permissions API.\n *\n * Upload treats every bundle the same; Sombra's Permissions API always queries\n * this fixed name (never taken from the request body).\n */\nexport const PERMISSIONS_POLICY_BUNDLE_NAME = 'permissions';\n\n/** OPA `.manifest` `metadata` key for Transcend authoring hints. */\nexport const POLICY_MANIFEST_TRANSCEND_METADATA_KEY = 'transcend.io';\n\n/** Supported policy bundle templates (enum-style constants). */\nexport const PolicyTemplate = {\n Generic: 'generic',\n Permissions: 'permissions',\n} as const;\n\n/** Supported policy bundle template names. */\nexport const POLICY_TEMPLATE_NAMES = [PolicyTemplate.Generic, PolicyTemplate.Permissions] as const;\n\n/** A supported policy bundle template name. */\nexport type PolicyTemplateName = (typeof PolicyTemplate)[keyof typeof PolicyTemplate];\n\n/**\n * OPA `.manifest` `metadata.transcend.io` key for the CLI version that\n * generated the scaffold template.\n */\nexport const POLICY_MANIFEST_TEMPLATE_VERSION_KEY = 'templateVersion';\n\n/**\n * Build an OPA bundle manifest for a given root and scaffold template.\n *\n * `metadata.transcend.io.template` and `templateVersion` are authoring hints\n * only — Policy Engine upload does not branch on them. Permissions API still\n * keys off the remote bundle name {@link PERMISSIONS_POLICY_BUNDLE_NAME}.\n * `templateVersion` records the `@transcend-io/cli` package version used to\n * generate the scaffold.\n *\n * @param root - Package root\n * @param template - Scaffold template that produced this bundle\n * @returns Manifest JSON\n */\nexport function buildPolicyManifestTemplate(\n root: string,\n template: PolicyTemplateName = PolicyTemplate.Generic,\n): string {\n return `{\n \"$schema\": \"https://openpolicyagent.org/schemas/bundle/v1/manifest.schema.json\",\n \"revision\": \"\",\n \"roots\": [\"${root}\"],\n \"rego_version\": 1,\n \"metadata\": {\n \"${POLICY_MANIFEST_TRANSCEND_METADATA_KEY}\": {\n \"template\": \"${template}\",\n \"${POLICY_MANIFEST_TEMPLATE_VERSION_KEY}\": \"${CLI_VERSION}\"\n }\n }\n}\n`;\n}\n\n/** OPA bundle manifest for the disposable starter publish directory. */\nexport const POLICY_MANIFEST_TEMPLATE = buildPolicyManifestTemplate(\n POLICY_STARTER_ROOT,\n PolicyTemplate.Generic,\n);\n\n/**\n * Build workspace-level Regal configuration for given roots.\n *\n * `project.roots` are package-path prefixes (same meaning as OPA `.manifest`\n * roots), not filesystem folders.\n *\n * @param roots - Package-path roots\n * @returns YAML configuration\n */\nexport function buildPolicyRegalConfigTemplate(roots: readonly string[]): string {\n const rootsSection =\n roots.length === 0\n ? ' roots: []'\n : ` roots:\\n${roots.map((root) => ` - ${root}`).join('\\n')}`;\n return `# Workspace-level Regal config for both publishable bundles under this tree.\n# \\`project.roots\\` are package-path prefixes (same meaning as OPA \\`.manifest\\`\n# roots), not filesystem folders. Each bundle also has its own \\`.manifest\\`.\ncapabilities:\n from:\n engine: opa\n version: v${POLICY_STARTER_OPA_VERSION}\nproject:\n${rootsSection}\n rego-version: 1\n`;\n}\n\n/**\n * Merge one package-path root into an existing Regal config without wiping\n * unrelated keys (custom rules, ignores, etc.).\n *\n * Comments and key order may be reformatted by the YAML serializer. Invalid\n * `project.roots` shapes throw instead of silently dropping prior roots.\n *\n * @param existingContents - Current `.regal/config.yaml` contents\n * @param rootToAdd - Package-path root to include\n * @returns Updated file contents and the full roots list\n */\nexport function mergePolicyRegalConfigRoots(\n existingContents: string,\n rootToAdd: string,\n): { contents: string; roots: string[] } {\n const trimmed = existingContents.trim();\n if (trimmed.length === 0) {\n const roots = [rootToAdd];\n return { contents: buildPolicyRegalConfigTemplate(roots), roots };\n }\n\n let parsed: unknown;\n try {\n parsed = yaml.load(existingContents);\n } catch (error) {\n const detail = error instanceof Error ? error.message : String(error);\n throw new Error(`.regal/config.yaml is not valid YAML: ${detail}`);\n }\n\n if (parsed === null || parsed === undefined) {\n const roots = [rootToAdd];\n return { contents: buildPolicyRegalConfigTemplate(roots), roots };\n }\n if (typeof parsed !== 'object' || Array.isArray(parsed)) {\n throw new Error('.regal/config.yaml must be a YAML mapping at the top level.');\n }\n\n const config = { ...(parsed as Record<string, unknown>) };\n const existingProject = config.project;\n if (\n existingProject !== undefined &&\n existingProject !== null &&\n (typeof existingProject !== 'object' || Array.isArray(existingProject))\n ) {\n throw new Error('.regal/config.yaml project must be a YAML mapping when present.');\n }\n\n const project: Record<string, unknown> = {\n ...((existingProject as Record<string, unknown> | undefined) ?? {}),\n };\n const existingRoots = project.roots;\n let roots: string[];\n if (existingRoots === undefined) {\n roots = [rootToAdd];\n } else if (\n Array.isArray(existingRoots) &&\n existingRoots.every((root): root is string => typeof root === 'string')\n ) {\n roots = [...new Set([...existingRoots, rootToAdd])].sort((left, right) =>\n left.localeCompare(right),\n );\n } else {\n throw new Error(\n '.regal/config.yaml project.roots must be an array of strings. ' +\n 'Fix the Regal config before running `transcend policy new`.',\n );\n }\n\n project.roots = roots;\n if (project['rego-version'] === undefined) {\n project['rego-version'] = 1;\n }\n config.project = project;\n\n if (config.capabilities === undefined) {\n config.capabilities = {\n from: {\n engine: 'opa',\n version: `v${POLICY_STARTER_OPA_VERSION}`,\n },\n };\n }\n\n const dumped = yaml.dump(config, {\n lineWidth: -1,\n noRefs: true,\n sortKeys: false,\n });\n return {\n contents: dumped.endsWith('\\n') ? dumped : `${dumped}\\n`,\n roots,\n };\n}\n\n/**\n * Workspace-level Regal configuration.\n *\n * `project.roots` are package-path prefixes (same meaning as OPA `.manifest`\n * roots), not filesystem folders.\n */\nexport const POLICY_REGAL_CONFIG_TEMPLATE = buildPolicyRegalConfigTemplate([POLICY_STARTER_ROOT]);\n\n/** Regal config for an empty workspace with no bundles yet. */\nexport const POLICY_REGAL_CONFIG_EMPTY_TEMPLATE = buildPolicyRegalConfigTemplate([]);\n\n/** Disposable, fail-closed example policy. */\nexport const POLICY_RESULT_REGO_TEMPLATE = `# METADATA\n# title: Disposable example result\n# description: |\n# A fail-closed teaching entrypoint. Replace this example with the document\n# tree and result contract required by your application.\n# scope: package\n# entrypoint: true\npackage ${POLICY_STARTER_ROOT}.result\n\nimport rego.v1\n\ndefault decision := \"deny\"\n\ndecision := \"allow\" if {\n\tinput.subject.trusted == true\n}\n\ndefault reason_code := \"untrusted_or_invalid_input\"\n\nreason_code := \"trusted_subject\" if {\n\tdecision == \"allow\"\n}\n`;\n\n/** Executable tests adjacent to the disposable example policy. */\nexport const POLICY_RESULT_TEST_REGO_TEMPLATE = `package ${POLICY_STARTER_ROOT}.result_test\n\nimport data.${POLICY_STARTER_ROOT}.result\nimport rego.v1\n\ntest_denies_untrusted_subject if {\n\tresult.decision == \"deny\" with input as {\"subject\": {\"trusted\": false}}\n\tresult.reason_code == \"untrusted_or_invalid_input\" with input as {\"subject\": {\"trusted\": false}}\n}\n\ntest_fails_closed_for_missing_subject if {\n\tresult.decision == \"deny\" with input as {}\n\tresult.reason_code == \"untrusted_or_invalid_input\" with input as {}\n}\n\ntest_allows_trusted_subject if {\n\tresult.decision == \"allow\" with input as {\"subject\": {\"trusted\": true}}\n\tresult.reason_code == \"trusted_subject\" with input as {\"subject\": {\"trusted\": true}}\n}\n`;\n\n/** Sanitized local input example containing no credentials or personal data. */\nexport const POLICY_INPUT_EXAMPLE_TEMPLATE = `{\n \"subject\": {\n \"trusted\": false\n }\n}\n`;\n\n/** Input JSON Schema for the disposable starter (editor + \\`opa check -s\\`). */\nexport const POLICY_INPUT_SCHEMA_TEMPLATE = `{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": \"https://transcend.io/policy-schemas/${POLICY_STARTER_ROOT}/input.json\",\n \"title\": \"Example policy input\",\n \"description\": \"Disposable teaching envelope for the example bundle.\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"subject\": {\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"trusted\": {\n \"type\": \"boolean\",\n \"description\": \"When true, the example policy allows; otherwise it denies.\"\n }\n }\n }\n }\n}\n`;\n\n/** Target-local ignore rules for private evaluation input only. */\nexport const POLICY_GITIGNORE_TEMPLATE = `# Local policy evaluation input (VS Code / Regal look for input.json here).\n/input.json\n`;\n\n/** Concise workspace-local authoring guide (multi-bundle, empty workspace). */\nexport const POLICY_README_TEMPLATE = `# Transcend Policy\n\nMulti-bundle workspace for Transcend Policy Engine bundles\n(OPA / Rego v1). Requires **Transcend CLI ≥ 11** (\\`transcend policy --help\\`\nshould list \\`init\\`, \\`new\\`, and positional \\`[directory]\\` args).\n\nEach \\`*-bundle/\\` directory is a separate publishable unit (own \\`.manifest\\`,\ninput, and query path). Add a new bundle with:\n\n\\`\\`\\`sh\ntranscend policy new\n\\`\\`\\`\n\n## Quick start\n\n\\`\\`\\`sh\ntranscend policy init # create the workspace\ntranscend policy new --template generic # add a bundle from a template\n\ntranscend policy lint --noInteractive\ntranscend policy test\ntranscend policy eval transcend/policy/example-bundle \\\\\n --package=data.example.result \\\\\n --input=transcend/policy/example-bundle/input.json\n\\`\\`\\`\n\n\\`policy new\\` also writes a gitignored \\`input.json\\` (copy of \\`input.example.json\\`)\nfor local Evaluate. \\`policy lint\\` / \\`policy test\\` default to every child with a\n\\`.manifest\\` and use bundle-mode \\`opa test -b\\`, so both input files can coexist\nwithout a merge error.\n\n## Layout\n\n\\`\\`\\`\ntranscend/policy/\n example-bundle/ # publish directory (added by policy new)\n example/ # package root (matches .manifest roots)\n input.example.json\n input.json # local only (gitignored)\n input.schema.json # input JSON Schema (editor + opa --schema)\n .regal/config.yaml\n\\`\\`\\`\n\nReplace or delete example bundles when you have a real policy. Publish each\nbundle separately (\\`transcend policy publish --remote-bundle-name … <dir>\\`).\n\n## Permissions API\n\nScaffold the Permissions starter, then simulate the query Sombra runs:\n\n\\`\\`\\`sh\ntranscend policy new \\\\\n --template permissions \\\\\n --name ${PERMISSIONS_POLICY_BUNDLE_NAME} \\\\\n --bundle-dir ${PERMISSIONS_POLICY_BUNDLE_NAME}-bundle \\\\\n --yes\n\ntranscend policy eval transcend/policy/${PERMISSIONS_POLICY_BUNDLE_NAME}-bundle \\\\\n --package=data.${PERMISSIONS_POLICY_BUNDLE_NAME}.purposes \\\\\n --input=transcend/policy/${PERMISSIONS_POLICY_BUNDLE_NAME}-bundle/input.json \\\\\n --schema=transcend/policy/${PERMISSIONS_POLICY_BUNDLE_NAME}-bundle/input.schema.json\n\\`\\`\\`\n\nUpload does **not** distinguish bundle kinds. What makes a bundle “Permissions”\nis the remote name plus where Sombra queries it:\n\n- **Permissions API** always loads the fixed remote bundle name\n \\`${PERMISSIONS_POLICY_BUNDLE_NAME}\\`. Publish that starter with\n \\`--remote-bundle-name=${PERMISSIONS_POLICY_BUNDLE_NAME}\\`.\n- **Generic / decide** bundles use any other \\`--remote-bundle-name\\` and the decide\n path.\n\nScaffolded \\`.manifest\\` files may include \\`metadata.transcend.io.template\\`\n(\\`generic\\` or \\`permissions\\`) and \\`templateVersion\\` (the \\`@transcend-io/cli\\`\nversion that generated the scaffold) as authoring hints. Upload ignores them;\n\\`policy publish\\` may warn when the template hint and \\`--remote-bundle-name\\` disagree.\n`;\n\n/** Workspace-relative path to the disposable example entrypoint. */\nexport const POLICY_STARTER_RESULT_REGO_PATH = `${POLICY_STARTER_BUNDLE_DIRECTORY}/${POLICY_STARTER_ROOT}/result/result.rego`;\n\n/** Workspace-relative path to the disposable example tests. */\nexport const POLICY_STARTER_RESULT_TEST_REGO_PATH = `${POLICY_STARTER_BUNDLE_DIRECTORY}/${POLICY_STARTER_ROOT}/result/result_test.rego`;\n\n/** Complete safe starter in deterministic plan order. */\nconst POLICY_STARTER_FILES: readonly PolicyStarterFile[] = [\n {\n path: `${POLICY_STARTER_BUNDLE_DIRECTORY}/${POLICY_MANIFEST_FILENAME}`,\n contents: POLICY_MANIFEST_TEMPLATE,\n description: 'Create the OPA bundle .manifest',\n },\n {\n path: '.regal/config.yaml',\n contents: POLICY_REGAL_CONFIG_TEMPLATE,\n description: `Pin strict Rego v1 linting to OPA ${POLICY_STARTER_OPA_VERSION} capabilities`,\n },\n {\n path: `${POLICY_STARTER_BUNDLE_DIRECTORY}/${POLICY_INPUT_SCHEMA_FILENAME}`,\n contents: POLICY_INPUT_SCHEMA_TEMPLATE,\n description: 'Create the input JSON Schema for the example bundle',\n },\n {\n path: POLICY_STARTER_RESULT_REGO_PATH,\n contents: POLICY_RESULT_REGO_TEMPLATE,\n description: 'Create a documented fail-closed result entrypoint',\n },\n {\n path: POLICY_STARTER_RESULT_TEST_REGO_PATH,\n contents: POLICY_RESULT_TEST_REGO_TEMPLATE,\n description: 'Create executable tests for allow and fail-closed decisions',\n },\n {\n path: `${POLICY_STARTER_BUNDLE_DIRECTORY}/input.example.json`,\n contents: POLICY_INPUT_EXAMPLE_TEMPLATE,\n description: 'Create a sanitized local evaluation input',\n },\n {\n path: `${POLICY_STARTER_BUNDLE_DIRECTORY}/.gitignore`,\n contents: POLICY_GITIGNORE_TEMPLATE,\n description: 'Ignore only the private local input file',\n },\n {\n path: 'README.md',\n contents: POLICY_README_TEMPLATE,\n description: 'Create the concise policy project guide',\n },\n];\n\n/**\n * Generate an independent copy of the safe policy starter.\n *\n * @returns Deterministic relative files\n */\nexport function generatePolicyStarterFiles(): PolicyStarterFile[] {\n return POLICY_STARTER_FILES.map((file) => ({ ...file }));\n}\n\n// ---------------------------------------------------------------------------\n// Workspace-only init files (no bundles)\n// ---------------------------------------------------------------------------\n\n/** Files created by `policy init` — empty workspace only. */\nconst POLICY_INIT_WORKSPACE_FILES: readonly PolicyStarterFile[] = [\n {\n path: '.regal/config.yaml',\n contents: POLICY_REGAL_CONFIG_EMPTY_TEMPLATE,\n description: `Pin strict Rego v1 linting to OPA ${POLICY_STARTER_OPA_VERSION} capabilities`,\n },\n {\n path: 'README.md',\n contents: POLICY_README_TEMPLATE,\n description: 'Create the concise multi-bundle workspace guide',\n },\n];\n\n/**\n * Generate files for an empty workspace (init without bundles).\n *\n * @returns Deterministic workspace files\n */\nexport function generatePolicyWorkspaceFiles(): PolicyStarterFile[] {\n return POLICY_INIT_WORKSPACE_FILES.map((file) => ({ ...file }));\n}\n\n// ---------------------------------------------------------------------------\n// Policy bundle templates (used by `policy new`)\n// ---------------------------------------------------------------------------\n\n/** Interactive labels for each policy template. */\nexport const POLICY_TEMPLATE_PROMPT_LABELS: Record<PolicyTemplateName, string> = {\n [PolicyTemplate.Generic]: 'Generic example',\n [PolicyTemplate.Permissions]: 'Permission API starter',\n};\n\n/** Default root names for each template. */\nexport const POLICY_TEMPLATE_DEFAULT_ROOTS: Record<PolicyTemplateName, string> = {\n [PolicyTemplate.Generic]: 'example',\n [PolicyTemplate.Permissions]: PERMISSIONS_POLICY_BUNDLE_NAME,\n};\n\n/**\n * Build the bundle directory name from a root.\n *\n * @param root - Package root\n * @returns Bundle directory name\n */\nexport function buildBundleDirectoryName(root: string): string {\n return `${root}-bundle`;\n}\n\n/**\n * Validate a local bundle directory basename (under the policy workspace).\n *\n * @param value - Proposed directory basename\n * @returns True or error message\n */\nexport function validateBundleDirectoryName(value: string): true | string {\n if (!value) {\n return 'Enter a bundle directory name.';\n }\n if (value === '.' || value === '..' || value.includes('/') || value.includes('\\\\')) {\n return 'Bundle directory must be a single path segment (no slashes).';\n }\n if (!/^[A-Za-z0-9][A-Za-z0-9._-]*$/u.test(value)) {\n return 'Bundle directory must be alphanumeric (plus ., _, -), e.g. \"my-bundle\".';\n }\n if (value.length > 128) {\n return 'Bundle directory cannot exceed 128 characters.';\n }\n return true;\n}\n\n/**\n * Generate bundle files for the generic template.\n *\n * @param root - Package root name\n * @param bundleDir - Publish directory basename under the workspace\n * @returns Bundle files relative to the workspace\n */\nexport function generateGenericBundleFiles(\n root: string,\n bundleDir: string = buildBundleDirectoryName(root),\n): PolicyStarterFile[] {\n const bundle = bundleDir;\n return [\n {\n path: `${bundle}/${POLICY_MANIFEST_FILENAME}`,\n contents: buildPolicyManifestTemplate(root, PolicyTemplate.Generic),\n description: 'Create the OPA bundle .manifest',\n },\n {\n path: `${bundle}/${POLICY_INPUT_SCHEMA_FILENAME}`,\n contents: `{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": \"https://transcend.io/policy-schemas/${root}/input.json\",\n \"title\": \"${root === 'example' ? 'Example policy input' : `${root} policy input`}\",\n \"description\": \"${root === 'example' ? 'Disposable teaching envelope for the example bundle.' : `Input envelope for the ${root} bundle.`}\",\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"subject\": {\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"properties\": {\n \"trusted\": {\n \"type\": \"boolean\",\n \"description\": \"When true, the ${root === 'example' ? 'example' : root} policy allows; otherwise it denies.\"\n }\n }\n }\n }\n}\n`,\n description: `Create the input JSON Schema for the ${root} bundle`,\n },\n {\n path: `${bundle}/${root}/result/result.rego`,\n contents: `# METADATA\n# title: ${root === 'example' ? 'Disposable example result' : `${root} result`}\n# description: |\n# A fail-closed ${root === 'example' ? 'teaching ' : ''}entrypoint. Replace this ${root === 'example' ? 'example ' : ''}with the document\n# tree and result contract required by your application.\n# scope: package\n# entrypoint: true\npackage ${root}.result\n\nimport rego.v1\n\ndefault decision := \"deny\"\n\ndecision := \"allow\" if {\n\\tinput.subject.trusted == true\n}\n\ndefault reason_code := \"untrusted_or_invalid_input\"\n\nreason_code := \"trusted_subject\" if {\n\\tdecision == \"allow\"\n}\n`,\n description: 'Create a documented fail-closed result entrypoint',\n },\n {\n path: `${bundle}/${root}/result/result_test.rego`,\n contents: `package ${root}.result_test\n\nimport data.${root}.result\nimport rego.v1\n\ntest_denies_untrusted_subject if {\n\\tresult.decision == \"deny\" with input as {\"subject\": {\"trusted\": false}}\n\\tresult.reason_code == \"untrusted_or_invalid_input\" with input as {\"subject\": {\"trusted\": false}}\n}\n\ntest_fails_closed_for_missing_subject if {\n\\tresult.decision == \"deny\" with input as {}\n\\tresult.reason_code == \"untrusted_or_invalid_input\" with input as {}\n}\n\ntest_allows_trusted_subject if {\n\\tresult.decision == \"allow\" with input as {\"subject\": {\"trusted\": true}}\n\\tresult.reason_code == \"trusted_subject\" with input as {\"subject\": {\"trusted\": true}}\n}\n`,\n description: 'Create executable tests for allow and fail-closed decisions',\n },\n {\n path: `${bundle}/input.example.json`,\n contents: POLICY_INPUT_EXAMPLE_TEMPLATE,\n description: 'Create a sanitized local evaluation input example',\n },\n {\n path: `${bundle}/input.json`,\n contents: POLICY_INPUT_EXAMPLE_TEMPLATE,\n description: 'Create a local evaluation input (gitignored copy of the example)',\n },\n {\n path: `${bundle}/.gitignore`,\n contents: POLICY_GITIGNORE_TEMPLATE,\n description: 'Ignore only the private local input file',\n },\n ];\n}\n\n/**\n * Generate bundle files for the permissions template.\n *\n * @param root - Package root name\n * @returns Bundle files relative to the workspace\n */\n/**\n * Serialize the published Permissions input schema for the local bundle path.\n *\n * Written as `{bundle}/input.schema.json` so editors and `opa --schema` can\n * type-check the envelope offline without a workspace `schemas/` directory.\n *\n * @returns Schema file contents ending in a trailing newline\n */\nexport function buildPermissionsInputSchemaContents(): string {\n return `${JSON.stringify(permissionsPolicyInputSchema, null, 2)}\\n`;\n}\n\n/**\n * Serialize the published Permissions input example for local evaluation.\n *\n * @returns Example input JSON ending in a trailing newline\n */\nexport function buildPermissionsInputExampleContents(): string {\n const [example] = permissionsPolicyInputSchema.examples;\n if (!example) {\n throw new Error('permissions-policy-input.json must declare at least one example');\n }\n return `${JSON.stringify(example, null, 2)}\\n`;\n}\n\n/**\n * Generate bundle files for the permissions template.\n *\n * @param root - Package root name\n * @param bundleDir - Publish directory basename under the workspace\n * @returns Bundle files relative to the workspace\n */\nexport function generatePermissionsBundleFiles(\n root: string,\n bundleDir: string = buildBundleDirectoryName(root),\n): PolicyStarterFile[] {\n const bundle = bundleDir;\n const inputExample = buildPermissionsInputExampleContents();\n return [\n {\n path: `${bundle}/${POLICY_MANIFEST_FILENAME}`,\n contents: buildPolicyManifestTemplate(root, PolicyTemplate.Permissions),\n description: 'Create the OPA bundle .manifest',\n },\n {\n path: `${bundle}/${POLICY_INPUT_SCHEMA_FILENAME}`,\n contents: buildPermissionsInputSchemaContents(),\n description: `Create the input JSON Schema for the ${root} bundle (from published permissions-policy-input.json)`,\n },\n {\n path: `${bundle}/${root}/config/config.rego`,\n contents: `# METADATA\n# title: Permissions config\n# description: |\n# Static bundle configuration. Values come from data.json in this directory.\npackage ${root}.config\n\nimport rego.v1\n`,\n description: 'Create the static bundle configuration package',\n },\n {\n path: `${bundle}/${root}/config/data.json`,\n contents: `{\n \"default_consent_allowed\": true,\n \"purposes\": [\n \"Analytics\",\n \"SaleOfInfo\"\n ],\n \"default_consent\": {}\n}\n`,\n description: 'Create the static purpose configuration data',\n },\n {\n path: `${bundle}/${root}/helpers/preference/preference.rego`,\n contents: `# METADATA\n# title: Purpose preference resolution\n# description: |\n# Resolves the subject's recorded choice for one purpose from the OPA\n# \\`input.preferences\\` array Sombra injects (one \\`{name, choice,\n# days_since_choice?}\\` entry per purpose; \\`choice\\` may be null when unset).\npackage ${root}.helpers.preference\n\nimport rego.v1\n\nimport data.${root}.config\n\nraw_preferences := object.get(input, \"preferences\", [])\n\nsource_available if {\n\\tis_array(raw_preferences)\n\\tevery entry in raw_preferences {\n\\t\\tis_object(entry)\n\\t\\tis_string(entry.name)\n\\t\\tentry.name != \"\"\n\\t}\n}\n\n# Boolean choice for a purpose, last-wins across duplicate entries (matching\n# Sombra's own dedup semantics). Returns the boolean only when a usable choice\n# exists; otherwise the rule is undefined and the purpose is undecided.\nchoice(name) := choice if {\n\\tsource_available\n\\tmatching := [entry | some entry in raw_preferences; entry.name == name]\n\\tcount(matching) > 0\n\\tlast := matching[count(matching) - 1]\n\\tchoice := object.get(last, \"choice\", null)\n\\tis_boolean(choice)\n}\n\nenabled(name) if choice(name) == true\n\ndisabled(name) if choice(name) == false\n\ndecided(name) if enabled(name)\n\ndecided(name) if disabled(name)\n\n# A configured purpose with no usable boolean choice is undecided: the subject\n# never chose, so the resolved default applies (not an opt-out).\nundecided(name) if {\n\\tname in config.purposes\n\\tnot enabled(name)\n\\tnot disabled(name)\n}\n`,\n description: 'Create purpose preference resolution helpers',\n },\n {\n path: `${bundle}/${root}/helpers/preference/preference_test.rego`,\n contents: `# Mechanical tests for purpose preference resolution.\n# Policy outcomes are tested beside the public entrypoint.\npackage ${root}.helpers.preference_test\n\nimport rego.v1\n\nimport data.${root}.helpers.preference\n\ngiven(preferences) := {\"preferences\": preferences}\n\ntest_treats_an_absent_preferences_array_as_no_recorded_choices if {\n\\tfixture := {}\n\n\\tpreference.source_available with input as fixture\n\\tpreference.undecided(\"Analytics\") with input as fixture\n}\n\ntest_accepts_an_empty_preferences_array if {\n\\tfixture := given([])\n\n\\tpreference.source_available with input as fixture\n\\tpreference.undecided(\"Analytics\") with input as fixture\n}\n\ntest_reports_a_non_array_preferences_as_unavailable if {\n\\tnot preference.source_available with input as {\"preferences\": {\"Analytics\": true}}\n}\n\ntest_reports_entries_without_a_usable_name_as_unavailable if {\n\\tnot preference.source_available with input as {\"preferences\": [{}]}\n\\tnot preference.source_available with input as {\"preferences\": [{\"name\": \"\"}]}\n\\tnot preference.source_available with input as {\"preferences\": [{\"choice\": true}]}\n}\n\ntest_distinguishes_enabled_and_disabled_choices if {\n\\tfixture := given([\n\\t\\t{\"name\": \"Analytics\", \"choice\": true},\n\\t\\t{\"name\": \"SaleOfInfo\", \"choice\": false},\n\\t])\n\n\\tpreference.enabled(\"Analytics\") with input as fixture\n\\tpreference.disabled(\"SaleOfInfo\") with input as fixture\n\\tpreference.decided(\"Analytics\") with input as fixture\n\\tpreference.decided(\"SaleOfInfo\") with input as fixture\n\\tnot preference.undecided(\"Analytics\") with input as fixture\n}\n\ntest_treats_a_null_choice_as_undecided if {\n\\tfixture := given([{\"name\": \"Analytics\", \"choice\": null}])\n\n\\tpreference.undecided(\"Analytics\") with input as fixture\n\\tnot preference.decided(\"Analytics\") with input as fixture\n}\n\ntest_treats_an_absent_choice_key_as_undecided if {\n\\tfixture := given([{\"name\": \"Analytics\", \"channel\": \"email\"}])\n\n\\tpreference.undecided(\"Analytics\") with input as fixture\n}\n\ntest_treats_a_non_boolean_choice_as_undecided if {\n\\tfixture := given([{\"name\": \"SaleOfInfo\", \"choice\": \"Daily\"}])\n\n\\tpreference.undecided(\"SaleOfInfo\") with input as fixture\n\\tnot preference.decided(\"SaleOfInfo\") with input as fixture\n}\n\n# Sombra dedupes by purpose before sending; last-wins keeps the bundle correct\n# against hand-crafted input that names the same purpose twice.\ntest_last_wins_on_duplicate_entries if {\n\\tfixture := given([\n\\t\\t{\"name\": \"SaleOfInfo\", \"choice\": true},\n\\t\\t{\"name\": \"SaleOfInfo\", \"choice\": false},\n\\t])\n\n\\tpreference.disabled(\"SaleOfInfo\") with input as fixture\n\\tnot preference.enabled(\"SaleOfInfo\") with input as fixture\n}\n\n# Extra fields on an entry (evidence, days_since_choice, channel) are ignored\n# rather than treated as a choice.\ntest_ignores_fields_beyond_the_recorded_choice if {\n\\tfixture := given([{\n\\t\\t\"name\": \"Analytics\",\n\\t\\t\"choice\": true,\n\\t\\t\"evidence\": \"consent_banner\",\n\\t\\t\"days_since_choice\": 45,\n\\t\\t\"channel\": \"email\",\n\\t}])\n\n\\tpreference.enabled(\"Analytics\") with input as fixture\n}\n`,\n description: 'Create preference resolution tests',\n },\n {\n path: `${bundle}/${root}/purposes/analytics/analytics.rego`,\n contents: `# METADATA\n# title: Analytics purpose decision\n# description: |\n# The Analytics purpose's verdict as a \\`result\\` document\n# (\\`data.${root}.purposes.analytics.result\\`).\npackage ${root}.purposes.analytics\n\nimport rego.v1\n\nimport data.${root}.helpers.preference\n\ndefault result := {\n\\t\"decision\": \"deny\",\n\\t\"reason_code\": \"default_deny\",\n}\n\nresult := {\n\\t\"decision\": \"allow\",\n\\t\"reason_code\": \"explicit_allow\",\n} if {\n\\tpreference.enabled(\"Analytics\")\n}\n\nresult := {\n\\t\"decision\": \"deny\",\n\\t\"reason_code\": \"explicit_deny\",\n} if {\n\\tpreference.disabled(\"Analytics\")\n}\n\nresult := {\n\\t\"decision\": \"allow\",\n\\t\"reason_code\": \"default_allow\",\n} if {\n\\tpreference.undecided(\"Analytics\")\n}\n`,\n description: 'Create the analytics purpose decision rule',\n },\n {\n path: `${bundle}/${root}/purposes/analytics/analytics_test.rego`,\n contents: `# Policy outcomes for the Analytics purpose (the queried document).\npackage ${root}.purposes.analytics_test\n\nimport rego.v1\n\nimport data.${root}.purposes.analytics\n\ngiven(preferences) := {\"preferences\": preferences}\n\ntest_explicit_allow if {\n\\tresult := analytics.result with input as given([{\"name\": \"Analytics\", \"choice\": true}])\n\\tresult == {\n\\t\\t\"decision\": \"allow\",\n\\t\\t\"reason_code\": \"explicit_allow\",\n\\t}\n}\n\ntest_explicit_deny if {\n\\tresult := analytics.result with input as given([{\"name\": \"Analytics\", \"choice\": false}])\n\\tresult == {\n\\t\\t\"decision\": \"deny\",\n\\t\\t\"reason_code\": \"explicit_deny\",\n\\t}\n}\n\ntest_undecided_resolves_to_default_allow if {\n\\tresult := analytics.result with input as given([])\n\\tresult == {\n\\t\\t\"decision\": \"allow\",\n\\t\\t\"reason_code\": \"default_allow\",\n\\t}\n}\n\ntest_missing_preferences_resolves_to_default_allow if {\n\\tresult := analytics.result with input as {}\n\\tresult == {\n\\t\\t\"decision\": \"allow\",\n\\t\\t\"reason_code\": \"default_allow\",\n\\t}\n}\n\ntest_non_boolean_choice_falls_back_to_default_allow if {\n\\tresult := analytics.result with input as given([{\"name\": \"Analytics\", \"choice\": \"yes\"}])\n\\tresult == {\n\\t\\t\"decision\": \"allow\",\n\\t\\t\"reason_code\": \"default_allow\",\n\\t}\n}\n\ntest_malformed_preferences_are_treated_as_undecided if {\n\\t# source_available is false, so enabled/disabled never fire; undecided still\n\\t# holds for configured purposes (not enabled and not disabled).\n\\tresult := analytics.result with input as {\"preferences\": {\"Analytics\": true}}\n\\tresult == {\n\\t\\t\"decision\": \"allow\",\n\\t\\t\"reason_code\": \"default_allow\",\n\\t}\n}\n`,\n description: 'Create analytics purpose decision tests',\n },\n {\n path: `${bundle}/${root}/purposes/entrypoint.rego`,\n contents: `# METADATA\n# title: Purpose decisions\n# description: Returns each purpose's decision and reason code.\n# scope: package\n# entrypoint: true\npackage ${root}.purposes\n\nimport rego.v1\n`,\n description: 'Create the purposes entrypoint',\n },\n {\n path: `${bundle}/input.example.json`,\n contents: inputExample,\n description: 'Create a sanitized permissions evaluation input example',\n },\n {\n path: `${bundle}/input.json`,\n contents: inputExample,\n description: 'Create a local evaluation input (gitignored copy of the example)',\n },\n {\n path: `${bundle}/.gitignore`,\n contents: POLICY_GITIGNORE_TEMPLATE,\n description: 'Ignore only the private local input file',\n },\n ];\n}\n\n/**\n * Generate bundle files for a given template and root.\n *\n * @param template - Template name\n * @param root - Package root name\n * @param bundleDir - Publish directory basename under the workspace\n * @returns Bundle files relative to the workspace\n */\nexport function generatePolicyBundleFiles(\n template: PolicyTemplateName,\n root: string,\n bundleDir: string = buildBundleDirectoryName(root),\n): PolicyStarterFile[] {\n switch (template) {\n case PolicyTemplate.Generic:\n return generateGenericBundleFiles(root, bundleDir);\n case PolicyTemplate.Permissions:\n return generatePermissionsBundleFiles(root, bundleDir);\n default:\n throw new Error(`Unknown policy template: ${String(template)}`);\n }\n}\n\n/**\n * Build the suggested `policy eval` follow-up after `policy new`.\n *\n * @param options - Bundle display path, package root, and template\n * @returns Multi-line shell command ready to paste\n */\nexport function buildPolicyBundleEvalNextStep(options: {\n /** Workspace-relative publish directory (e.g. `transcend/policy/permissions-bundle`). */\n bundleDirectory: string;\n /** Rego / `.manifest` package root. */\n root: string;\n /** Scaffold template that determined the query path. */\n template: PolicyTemplateName;\n}): string {\n const { bundleDirectory, root, template } = options;\n const packagePath =\n template === PolicyTemplate.Permissions ? `data.${root}.purposes` : `data.${root}.result`;\n return [\n `transcend policy eval ${bundleDirectory} \\\\`,\n ` --package=${packagePath} \\\\`,\n ` --input=${bundleDirectory}/input.json \\\\`,\n ` --schema=${bundleDirectory}/${POLICY_INPUT_SCHEMA_FILENAME}`,\n ].join('\\n');\n}\n","import { join, resolve } from 'node:path';\n\nimport type { LocalContext } from '../../context.js';\nimport {\n collectProjectRelativePaths,\n discoverProjectRepository,\n} from '../scaffolding/project-discovery.js';\nimport type { PolicyProjectState } from './policy-scaffold-model.js';\nimport {\n POLICY_MANIFEST_FILENAME,\n POLICY_STARTER_BUNDLE_DIRECTORY,\n} from './policy-scaffold-templates.js';\n\n/** Default local policy workspace directory (shared Regal config + bundles). */\nexport const DEFAULT_POLICY_PROJECT_DIRECTORY = 'transcend/policy';\n\n/**\n * Resolve a selected policy project relative to the invocation directory.\n *\n * @param invocationDirectory - CLI working directory\n * @param directory - User-selected project directory\n * @returns Absolute policy project directory\n */\nexport function resolvePolicyProjectDirectory(\n invocationDirectory: string,\n directory: string = DEFAULT_POLICY_PROJECT_DIRECTORY,\n): string {\n return resolve(invocationDirectory, directory);\n}\n\n/**\n * Absolute path to the disposable starter publish directory under a workspace.\n *\n * @param workspaceDirectory - Absolute policy workspace directory\n * @returns Absolute starter bundle directory\n */\nexport function getPolicyStarterBundleDirectory(workspaceDirectory: string): string {\n return join(workspaceDirectory, POLICY_STARTER_BUNDLE_DIRECTORY);\n}\n\n/**\n * Resolve publishable bundle directories under a path.\n *\n * - If `directory` itself contains a `.manifest`, it is treated as one bundle.\n * - Otherwise immediate child directories that contain a `.manifest` are\n * returned in sorted order (multi-bundle workspace). Folder names are not\n * required to end in `-bundle`; that suffix is only the `policy new`\n * scaffolding convention.\n *\n * @param context - Filesystem-bearing CLI context\n * @param directory - Absolute workspace or bundle directory\n * @returns Absolute bundle directories to lint / test\n */\nexport function discoverPolicyBundleDirectories(\n context: Pick<LocalContext, 'fs'>,\n directory: string,\n): string[] {\n if (!context.fs.existsSync(directory) || !context.fs.statSync(directory).isDirectory()) {\n return [];\n }\n const manifestAtRoot = join(directory, POLICY_MANIFEST_FILENAME);\n if (context.fs.existsSync(manifestAtRoot) && context.fs.statSync(manifestAtRoot).isFile()) {\n return [directory];\n }\n return context.fs\n .readdirSync(directory, { withFileTypes: true })\n .filter((entry) => entry.isDirectory())\n .map((entry) => join(directory, entry.name))\n .filter((bundleDirectory) => {\n const manifestPath = join(bundleDirectory, POLICY_MANIFEST_FILENAME);\n return context.fs.existsSync(manifestPath) && context.fs.statSync(manifestPath).isFile();\n })\n .sort((left, right) => left.localeCompare(right));\n}\n\n/**\n * Collect repository state required by the pure policy planner.\n *\n * @param context - CLI context\n * @param directory - User-selected target directory\n * @returns Policy project discovery state\n */\nexport function discoverPolicyProject(\n context: LocalContext,\n directory: string = DEFAULT_POLICY_PROJECT_DIRECTORY,\n): PolicyProjectState {\n const invocationDirectory = context.process.cwd();\n const targetDirectory = resolvePolicyProjectDirectory(invocationDirectory, directory);\n if (\n context.fs.existsSync(targetDirectory) &&\n !context.fs.statSync(targetDirectory).isDirectory()\n ) {\n throw new Error(`Policy target is not a directory: ${targetDirectory}`);\n }\n const repository = discoverProjectRepository(context, {\n invocationDirectory,\n targetDirectory,\n standaloneProjectRoot: invocationDirectory,\n });\n return {\n invocationDirectory,\n targetDirectory,\n ...repository,\n relativePaths: collectProjectRelativePaths(context, targetDirectory),\n relativeFilePaths: collectProjectRelativePaths(context, targetDirectory, {\n includeDirectories: false,\n }),\n };\n}\n\n/**\n * Resolve the starter bundle manifest path for a discovered workspace.\n *\n * @param state - Policy project state\n * @returns Absolute manifest path under the starter `{root}-bundle/`\n */\nexport function getPolicyManifestPath(state: PolicyProjectState): string {\n return join(getPolicyStarterBundleDirectory(state.targetDirectory), POLICY_MANIFEST_FILENAME);\n}\n"],"mappings":"g6CCMA,MAAa,EAAqCA,EAGrC,EAA6B,SAS7B,EAAsB,UAGtB,EAAkC,GAAG,EAAoB,SAGzD,EAA+B,oBAa/B,EAA2B,YAQ3B,EAAiC,cAGjC,EAAyC,eAGzC,EAAiB,CAC5B,QAAS,UACT,YAAa,cACd,CAGY,EAAwB,CAAC,EAAe,QAAS,EAAe,YAAY,CAwBzF,SAAgB,EACd,EACA,EAA+B,EAAe,QACtC,CACR,MAAO;;;eAGM,EAAK;;;OAGb,EAAuC;qBACzB,EAAS;4BACsBC,EAAY;;;;EAQxB,EACtC,EACA,EAAe,QAChB,CAWD,SAAgB,EAA+B,EAAkC,CAK/E,MAAO;;;;;;gBAMO,EAA2B;;EATvC,EAAM,SAAW,EACb,cACA,aAAa,EAAM,IAAK,GAAS,SAAS,IAAO,CAAC,KAAK;EAAK,GASrD;;EAgBf,SAAgB,EACd,EACA,EACuC,CAEvC,GADgB,EAAiB,MACtB,CAAC,SAAW,EAAG,CACxB,IAAM,EAAQ,CAAC,EAAU,CACzB,MAAO,CAAE,SAAU,EAA+B,EAAM,CAAE,QAAO,CAGnE,IAAI,EACJ,GAAI,CACF,EAAS,EAAK,KAAK,EAAiB,OAC7B,EAAO,CACd,IAAM,EAAS,aAAiB,MAAQ,EAAM,QAAU,OAAO,EAAM,CACrE,MAAU,MAAM,yCAAyC,IAAS,CAGpE,GAAI,GAAW,KAA8B,CAC3C,IAAM,EAAQ,CAAC,EAAU,CACzB,MAAO,CAAE,SAAU,EAA+B,EAAM,CAAE,QAAO,CAEnE,GAAI,OAAO,GAAW,UAAY,MAAM,QAAQ,EAAO,CACrD,MAAU,MAAM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
- import e from"semver";const t=`0.39.0`,n=`https://www.openpolicyagent.org/docs#1-download-opa`,r=`https://www.openpolicyagent.org/projects/regal#installing-regal`,i=`OPA 1.x is required but \`opa\` was not found on PATH. Install or upgrade it using the official instructions: ${n}`,a=`The Open Policy Agent CLI (\`opa\`) is required but was not found on PATH. Install it using the official instructions: ${n}`,o=`Regal is required but \`regal\` was not found on PATH. Install or upgrade it using the official instructions: ${r}`;function s(t){let n=t.match(/^\s*Version:\s+v?(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?)\s*$/imu);if(!(!n||!e.valid(n[1])))return{version:n[1],major:e.major(n[1])}}function c(e){let t=s(e);if(t?.major!==1)return`OPA 1.x is required${t?`; found ${t.version}`:`; unable to parse the installed version`}. Install or upgrade it using the official instructions: ${n}`}function l(t,n=`0.30.0`,i=`OPA 1 support`){let a=s(t);if(!(a&&e.gte(a.version,n)))return`Regal ${n} or newer is required for ${i}${a?`; found ${a.version}`:`; unable to parse the installed version`}. Install or upgrade it using the official instructions: ${r}`}export{r as a,c,i,l,a as n,o,n as r,s,t};
2
- //# sourceMappingURL=policy-runtime-BMKa-Upy.mjs.map
1
+ import e from"semver";const t=`0.42.0`,n=`https://www.openpolicyagent.org/docs#1-download-opa`,r=`https://www.openpolicyagent.org/projects/regal#installing-regal`,i=`OPA 1.x is required but \`opa\` was not found on PATH. Install or upgrade it using the official instructions: ${n}`,a=`The Open Policy Agent CLI (\`opa\`) is required but was not found on PATH. Install it using the official instructions: ${n}`,o=`Regal is required but \`regal\` was not found on PATH. Install or upgrade it using the official instructions: ${r}`;function s(t){let n=t.match(/^\s*Version:\s+v?(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?)\s*$/imu);if(!(!n||!e.valid(n[1])))return{version:n[1],major:e.major(n[1])}}function c(e){let t=s(e);if(t?.major!==1)return`OPA 1.x is required${t?`; found ${t.version}`:`; unable to parse the installed version`}. Install or upgrade it using the official instructions: ${n}`}function l(t,n=`0.30.0`,i=`OPA 1 support`){let a=s(t);if(!(a&&e.gte(a.version,n)))return`Regal ${n} or newer is required for ${i}${a?`; found ${a.version}`:`; unable to parse the installed version`}. Install or upgrade it using the official instructions: ${r}`}export{r as a,c,i,l,a as n,o,n as r,s,t};
2
+ //# sourceMappingURL=policy-runtime-6jmkXlBk.mjs.map