@noodleseed/one 0.45.0 → 0.47.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 (338) hide show
  1. package/dist/commands/auth-ops.d.ts.map +1 -1
  2. package/dist/commands/auth-ops.js +28 -4
  3. package/dist/commands/auth-ops.js.map +1 -1
  4. package/dist/commands/billing-enforcement-ops.d.ts +2 -0
  5. package/dist/commands/billing-enforcement-ops.d.ts.map +1 -0
  6. package/dist/commands/billing-enforcement-ops.js +312 -0
  7. package/dist/commands/billing-enforcement-ops.js.map +1 -0
  8. package/dist/commands/billing-metering-ops.d.ts +2 -0
  9. package/dist/commands/billing-metering-ops.d.ts.map +1 -0
  10. package/dist/commands/billing-metering-ops.js +128 -0
  11. package/dist/commands/billing-metering-ops.js.map +1 -0
  12. package/dist/commands/billing-metering-validation-ops.d.ts +2 -0
  13. package/dist/commands/billing-metering-validation-ops.d.ts.map +1 -0
  14. package/dist/commands/billing-metering-validation-ops.js +186 -0
  15. package/dist/commands/billing-metering-validation-ops.js.map +1 -0
  16. package/dist/commands/billing-ops.d.ts.map +1 -1
  17. package/dist/commands/billing-ops.js +6 -0
  18. package/dist/commands/billing-ops.js.map +1 -1
  19. package/dist/commands/catalog-data-resources.d.ts.map +1 -1
  20. package/dist/commands/catalog-data-resources.js +14 -3
  21. package/dist/commands/catalog-data-resources.js.map +1 -1
  22. package/dist/commands/catalog-render.d.ts.map +1 -1
  23. package/dist/commands/catalog-render.js +7 -5
  24. package/dist/commands/catalog-render.js.map +1 -1
  25. package/dist/commands/deploy-ops.d.ts.map +1 -1
  26. package/dist/commands/deploy-ops.js +10 -1
  27. package/dist/commands/deploy-ops.js.map +1 -1
  28. package/dist/commands/deploy-output.d.ts.map +1 -1
  29. package/dist/commands/deploy-output.js +4 -0
  30. package/dist/commands/deploy-output.js.map +1 -1
  31. package/dist/commands/deploy-version-resolution.d.ts +1 -0
  32. package/dist/commands/deploy-version-resolution.d.ts.map +1 -1
  33. package/dist/commands/deploy-version-resolution.js +8 -0
  34. package/dist/commands/deploy-version-resolution.js.map +1 -1
  35. package/dist/commands/mcp-apps-chatgpt.d.ts +7 -0
  36. package/dist/commands/mcp-apps-chatgpt.d.ts.map +1 -0
  37. package/dist/commands/mcp-apps-chatgpt.js +143 -0
  38. package/dist/commands/mcp-apps-chatgpt.js.map +1 -0
  39. package/dist/commands/mcp-apps.d.ts.map +1 -1
  40. package/dist/commands/mcp-apps.js +2 -114
  41. package/dist/commands/mcp-apps.js.map +1 -1
  42. package/dist/deploy-payload-size.d.ts +3 -0
  43. package/dist/deploy-payload-size.d.ts.map +1 -0
  44. package/dist/deploy-payload-size.js +29 -0
  45. package/dist/deploy-payload-size.js.map +1 -0
  46. package/dist/deploy.d.ts.map +1 -1
  47. package/dist/deploy.js +16 -8
  48. package/dist/deploy.js.map +1 -1
  49. package/dist/saas-scaffold-template.js +1 -1
  50. package/dist/saas-scaffold-template.js.map +1 -1
  51. package/dist/sdk-version-skew.d.ts +3 -0
  52. package/dist/sdk-version-skew.d.ts.map +1 -0
  53. package/dist/sdk-version-skew.js +34 -0
  54. package/dist/sdk-version-skew.js.map +1 -0
  55. package/dist/widget-scaffold-template.d.ts.map +1 -1
  56. package/dist/widget-scaffold-template.js +4 -2
  57. package/dist/widget-scaffold-template.js.map +1 -1
  58. package/node_modules/@noodle-borg/agent-kit/dist/generated/example-files.js +3 -3
  59. package/node_modules/@noodle-borg/agent-kit/dist/generated/example-files.js.map +1 -1
  60. package/node_modules/@noodle-borg/agent-kit/dist/skill-authoring-refs.js +1 -1
  61. package/node_modules/@noodle-borg/agent-kit/dist/skill-authoring-refs.js.map +1 -1
  62. package/node_modules/@noodle-borg/agent-kit/dist/skill-content.js +1 -1
  63. package/node_modules/@noodle-borg/agent-kit/dist/skill-content.js.map +1 -1
  64. package/node_modules/@noodle-borg/agent-kit/dist/skill-embedded-assistant-ref.d.ts.map +1 -1
  65. package/node_modules/@noodle-borg/agent-kit/dist/skill-embedded-assistant-ref.js +6 -4
  66. package/node_modules/@noodle-borg/agent-kit/dist/skill-embedded-assistant-ref.js.map +1 -1
  67. package/node_modules/@noodle-borg/agent-kit/package.json +1 -1
  68. package/node_modules/@noodle-borg/authoring/dist/assistant.d.ts +9 -0
  69. package/node_modules/@noodle-borg/authoring/dist/assistant.d.ts.map +1 -1
  70. package/node_modules/@noodle-borg/authoring/dist/assistant.js.map +1 -1
  71. package/node_modules/@noodle-borg/authoring/dist/server.d.ts +7 -0
  72. package/node_modules/@noodle-borg/authoring/dist/server.d.ts.map +1 -1
  73. package/node_modules/@noodle-borg/authoring/dist/server.js +2 -0
  74. package/node_modules/@noodle-borg/authoring/dist/server.js.map +1 -1
  75. package/node_modules/@noodle-borg/compiler/dist/artifact/types.d.ts +10 -1
  76. package/node_modules/@noodle-borg/compiler/dist/artifact/types.d.ts.map +1 -1
  77. package/node_modules/@noodle-borg/compiler/dist/artifact/types.js +6 -1
  78. package/node_modules/@noodle-borg/compiler/dist/artifact/types.js.map +1 -1
  79. package/node_modules/@noodle-borg/compiler/dist/compile.d.ts.map +1 -1
  80. package/node_modules/@noodle-borg/compiler/dist/compile.js +4 -0
  81. package/node_modules/@noodle-borg/compiler/dist/compile.js.map +1 -1
  82. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.d.ts +52 -0
  83. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.d.ts.map +1 -1
  84. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.js +17 -0
  85. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.js.map +1 -1
  86. package/node_modules/@noodle-borg/protocol/dist/mapping.d.ts.map +1 -1
  87. package/node_modules/@noodle-borg/protocol/dist/mapping.js +1 -0
  88. package/node_modules/@noodle-borg/protocol/dist/mapping.js.map +1 -1
  89. package/node_modules/@noodle-borg/protocol/dist/sdk-server.js +18 -0
  90. package/node_modules/@noodle-borg/protocol/dist/sdk-server.js.map +1 -1
  91. package/node_modules/@noodle-borg/protocol/dist/tool-interaction.d.ts +3 -0
  92. package/node_modules/@noodle-borg/protocol/dist/tool-interaction.d.ts.map +1 -1
  93. package/node_modules/@noodle-borg/protocol/dist/tool-interaction.js +12 -3
  94. package/node_modules/@noodle-borg/protocol/dist/tool-interaction.js.map +1 -1
  95. package/node_modules/@noodle-borg/service/dist/assistant-interactive.d.ts.map +1 -1
  96. package/node_modules/@noodle-borg/service/dist/assistant-interactive.js +7 -3
  97. package/node_modules/@noodle-borg/service/dist/assistant-interactive.js.map +1 -1
  98. package/node_modules/@noodle-borg/service/dist/assistant-presentation.d.ts +11 -0
  99. package/node_modules/@noodle-borg/service/dist/assistant-presentation.d.ts.map +1 -1
  100. package/node_modules/@noodle-borg/service/dist/assistant-presentation.js +67 -3
  101. package/node_modules/@noodle-borg/service/dist/assistant-presentation.js.map +1 -1
  102. package/node_modules/@noodle-borg/service/dist/billing/enforcement-profile.d.ts +96 -0
  103. package/node_modules/@noodle-borg/service/dist/billing/enforcement-profile.d.ts.map +1 -0
  104. package/node_modules/@noodle-borg/service/dist/billing/enforcement-profile.js +198 -0
  105. package/node_modules/@noodle-borg/service/dist/billing/enforcement-profile.js.map +1 -0
  106. package/node_modules/@noodle-borg/service/dist/billing/integration.d.ts +25 -2
  107. package/node_modules/@noodle-borg/service/dist/billing/integration.d.ts.map +1 -1
  108. package/node_modules/@noodle-borg/service/dist/billing/integration.js +51 -5
  109. package/node_modules/@noodle-borg/service/dist/billing/integration.js.map +1 -1
  110. package/node_modules/@noodle-borg/service/dist/billing/meter-capacity.d.ts +77 -0
  111. package/node_modules/@noodle-borg/service/dist/billing/meter-capacity.d.ts.map +1 -0
  112. package/node_modules/@noodle-borg/service/dist/billing/meter-capacity.js +202 -0
  113. package/node_modules/@noodle-borg/service/dist/billing/meter-capacity.js.map +1 -0
  114. package/node_modules/@noodle-borg/service/dist/billing/meter-live-validation-contract.d.ts +8 -0
  115. package/node_modules/@noodle-borg/service/dist/billing/meter-live-validation-contract.d.ts.map +1 -0
  116. package/node_modules/@noodle-borg/service/dist/billing/meter-live-validation-contract.js +93 -0
  117. package/node_modules/@noodle-borg/service/dist/billing/meter-live-validation-contract.js.map +1 -0
  118. package/node_modules/@noodle-borg/service/dist/billing/meter-live-validation.d.ts +76 -0
  119. package/node_modules/@noodle-borg/service/dist/billing/meter-live-validation.d.ts.map +1 -0
  120. package/node_modules/@noodle-borg/service/dist/billing/meter-live-validation.js +233 -0
  121. package/node_modules/@noodle-borg/service/dist/billing/meter-live-validation.js.map +1 -0
  122. package/node_modules/@noodle-borg/service/dist/billing/meter-readiness-health.d.ts +89 -0
  123. package/node_modules/@noodle-borg/service/dist/billing/meter-readiness-health.d.ts.map +1 -0
  124. package/node_modules/@noodle-borg/service/dist/billing/meter-readiness-health.js +191 -0
  125. package/node_modules/@noodle-borg/service/dist/billing/meter-readiness-health.js.map +1 -0
  126. package/node_modules/@noodle-borg/service/dist/billing/meter-readiness.d.ts +99 -0
  127. package/node_modules/@noodle-borg/service/dist/billing/meter-readiness.d.ts.map +1 -0
  128. package/node_modules/@noodle-borg/service/dist/billing/meter-readiness.js +136 -0
  129. package/node_modules/@noodle-borg/service/dist/billing/meter-readiness.js.map +1 -0
  130. package/node_modules/@noodle-borg/service/dist/billing/meter-runtime-config.d.ts +9 -0
  131. package/node_modules/@noodle-borg/service/dist/billing/meter-runtime-config.d.ts.map +1 -0
  132. package/node_modules/@noodle-borg/service/dist/billing/meter-runtime-config.js +24 -0
  133. package/node_modules/@noodle-borg/service/dist/billing/meter-runtime-config.js.map +1 -0
  134. package/node_modules/@noodle-borg/service/dist/billing/meter-validation-epoch.d.ts +75 -0
  135. package/node_modules/@noodle-borg/service/dist/billing/meter-validation-epoch.d.ts.map +1 -0
  136. package/node_modules/@noodle-borg/service/dist/billing/meter-validation-epoch.js +127 -0
  137. package/node_modules/@noodle-borg/service/dist/billing/meter-validation-epoch.js.map +1 -0
  138. package/node_modules/@noodle-borg/service/dist/billing/postgres-enforcement-profile-schema.d.ts +4 -0
  139. package/node_modules/@noodle-borg/service/dist/billing/postgres-enforcement-profile-schema.d.ts.map +1 -0
  140. package/node_modules/@noodle-borg/service/dist/billing/postgres-enforcement-profile-schema.js +107 -0
  141. package/node_modules/@noodle-borg/service/dist/billing/postgres-enforcement-profile-schema.js.map +1 -0
  142. package/node_modules/@noodle-borg/service/dist/billing/postgres-enforcement-profile.d.ts +18 -0
  143. package/node_modules/@noodle-borg/service/dist/billing/postgres-enforcement-profile.d.ts.map +1 -0
  144. package/node_modules/@noodle-borg/service/dist/billing/postgres-enforcement-profile.js +341 -0
  145. package/node_modules/@noodle-borg/service/dist/billing/postgres-enforcement-profile.js.map +1 -0
  146. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-clock.d.ts +3 -0
  147. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-clock.d.ts.map +1 -0
  148. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-clock.js +9 -0
  149. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-clock.js.map +1 -0
  150. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-epoch-fixtures.d.ts +13 -0
  151. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-epoch-fixtures.d.ts.map +1 -0
  152. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-epoch-fixtures.js +102 -0
  153. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-epoch-fixtures.js.map +1 -0
  154. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-epochs.d.ts +41 -0
  155. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-epochs.d.ts.map +1 -0
  156. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-epochs.js +289 -0
  157. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-epochs.js.map +1 -0
  158. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-evidence-retention.d.ts +16 -0
  159. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-evidence-retention.d.ts.map +1 -0
  160. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-evidence-retention.js +126 -0
  161. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-evidence-retention.js.map +1 -0
  162. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-live-validation.d.ts +33 -0
  163. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-live-validation.d.ts.map +1 -0
  164. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-live-validation.js +436 -0
  165. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-live-validation.js.map +1 -0
  166. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-maintenance.d.ts +26 -0
  167. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-maintenance.d.ts.map +1 -0
  168. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-maintenance.js +146 -0
  169. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-maintenance.js.map +1 -0
  170. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-partition.d.ts +8 -0
  171. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-partition.d.ts.map +1 -0
  172. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-partition.js +42 -0
  173. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-partition.js.map +1 -0
  174. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-prepare-preflight.d.ts +8 -0
  175. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-prepare-preflight.d.ts.map +1 -0
  176. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-prepare-preflight.js +44 -0
  177. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-prepare-preflight.js.map +1 -0
  178. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-readiness-live.d.ts +13 -0
  179. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-readiness-live.d.ts.map +1 -0
  180. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-readiness-live.js +189 -0
  181. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-readiness-live.js.map +1 -0
  182. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-readiness.d.ts +18 -0
  183. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-readiness.d.ts.map +1 -0
  184. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-readiness.js +342 -0
  185. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-readiness.js.map +1 -0
  186. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-reconciliation.d.ts +27 -0
  187. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-reconciliation.d.ts.map +1 -0
  188. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-reconciliation.js +304 -0
  189. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-reconciliation.js.map +1 -0
  190. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-retention.d.ts +22 -0
  191. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-retention.d.ts.map +1 -0
  192. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-retention.js +224 -0
  193. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-retention.js.map +1 -0
  194. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-runtime.d.ts +33 -0
  195. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-runtime.d.ts.map +1 -0
  196. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-runtime.js +173 -0
  197. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-runtime.js.map +1 -0
  198. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler-schema.d.ts +7 -0
  199. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler-schema.d.ts.map +1 -0
  200. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler-schema.js +50 -0
  201. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler-schema.js.map +1 -0
  202. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler-store.d.ts +34 -0
  203. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler-store.d.ts.map +1 -0
  204. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler-store.js +157 -0
  205. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler-store.js.map +1 -0
  206. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler.d.ts +56 -0
  207. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler.d.ts.map +1 -0
  208. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler.js +264 -0
  209. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler.js.map +1 -0
  210. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-schema.d.ts +6 -0
  211. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-schema.d.ts.map +1 -0
  212. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-schema.js +414 -0
  213. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-schema.js.map +1 -0
  214. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-validation.d.ts +43 -0
  215. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-validation.d.ts.map +1 -0
  216. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-validation.js +321 -0
  217. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-validation.js.map +1 -0
  218. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-window-lock.d.ts +10 -0
  219. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-window-lock.d.ts.map +1 -0
  220. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-window-lock.js +13 -0
  221. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-window-lock.js.map +1 -0
  222. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-window-schema.d.ts +6 -0
  223. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-window-schema.d.ts.map +1 -0
  224. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-window-schema.js +248 -0
  225. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-window-schema.js.map +1 -0
  226. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-writer-compaction.d.ts +29 -0
  227. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-writer-compaction.d.ts.map +1 -0
  228. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-writer-compaction.js +240 -0
  229. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-writer-compaction.js.map +1 -0
  230. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-writer-health-schema.d.ts +4 -0
  231. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-writer-health-schema.d.ts.map +1 -0
  232. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-writer-health-schema.js +140 -0
  233. package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-writer-health-schema.js.map +1 -0
  234. package/node_modules/@noodle-borg/service/dist/billing/postgres-migration.d.ts.map +1 -1
  235. package/node_modules/@noodle-borg/service/dist/billing/postgres-migration.js +4 -0
  236. package/node_modules/@noodle-borg/service/dist/billing/postgres-migration.js.map +1 -1
  237. package/node_modules/@noodle-borg/service/dist/billing/postgres-schema.d.ts.map +1 -1
  238. package/node_modules/@noodle-borg/service/dist/billing/postgres-schema.js +6 -0
  239. package/node_modules/@noodle-borg/service/dist/billing/postgres-schema.js.map +1 -1
  240. package/node_modules/@noodle-borg/service/dist/billing/postgres.d.ts.map +1 -1
  241. package/node_modules/@noodle-borg/service/dist/billing/postgres.js +3 -0
  242. package/node_modules/@noodle-borg/service/dist/billing/postgres.js.map +1 -1
  243. package/node_modules/@noodle-borg/service/dist/billing/service-meter-runtime.d.ts +7 -0
  244. package/node_modules/@noodle-borg/service/dist/billing/service-meter-runtime.d.ts.map +1 -0
  245. package/node_modules/@noodle-borg/service/dist/billing/service-meter-runtime.js +19 -0
  246. package/node_modules/@noodle-borg/service/dist/billing/service-meter-runtime.js.map +1 -0
  247. package/node_modules/@noodle-borg/service/dist/billing/shadow-meter.d.ts +9 -4
  248. package/node_modules/@noodle-borg/service/dist/billing/shadow-meter.d.ts.map +1 -1
  249. package/node_modules/@noodle-borg/service/dist/billing/shadow-meter.js +34 -95
  250. package/node_modules/@noodle-borg/service/dist/billing/shadow-meter.js.map +1 -1
  251. package/node_modules/@noodle-borg/service/dist/billing/usage-identity.d.ts +14 -0
  252. package/node_modules/@noodle-borg/service/dist/billing/usage-identity.d.ts.map +1 -0
  253. package/node_modules/@noodle-borg/service/dist/billing/usage-identity.js +87 -0
  254. package/node_modules/@noodle-borg/service/dist/billing/usage-identity.js.map +1 -0
  255. package/node_modules/@noodle-borg/service/dist/billing/usage-observer.d.ts +6 -0
  256. package/node_modules/@noodle-borg/service/dist/billing/usage-observer.d.ts.map +1 -0
  257. package/node_modules/@noodle-borg/service/dist/billing/usage-observer.js +26 -0
  258. package/node_modules/@noodle-borg/service/dist/billing/usage-observer.js.map +1 -0
  259. package/node_modules/@noodle-borg/service/dist/billing-public.d.ts +16 -0
  260. package/node_modules/@noodle-borg/service/dist/billing-public.d.ts.map +1 -0
  261. package/node_modules/@noodle-borg/service/dist/billing-public.js +15 -0
  262. package/node_modules/@noodle-borg/service/dist/billing-public.js.map +1 -0
  263. package/node_modules/@noodle-borg/service/dist/customer-verifier.d.ts +1 -0
  264. package/node_modules/@noodle-borg/service/dist/customer-verifier.d.ts.map +1 -1
  265. package/node_modules/@noodle-borg/service/dist/customer-verifier.js +15 -0
  266. package/node_modules/@noodle-borg/service/dist/customer-verifier.js.map +1 -1
  267. package/node_modules/@noodle-borg/service/dist/http-util.d.ts +2 -0
  268. package/node_modules/@noodle-borg/service/dist/http-util.d.ts.map +1 -1
  269. package/node_modules/@noodle-borg/service/dist/http-util.js +1 -1
  270. package/node_modules/@noodle-borg/service/dist/http-util.js.map +1 -1
  271. package/node_modules/@noodle-borg/service/dist/index.d.ts +2 -7
  272. package/node_modules/@noodle-borg/service/dist/index.d.ts.map +1 -1
  273. package/node_modules/@noodle-borg/service/dist/index.js +1 -6
  274. package/node_modules/@noodle-borg/service/dist/index.js.map +1 -1
  275. package/node_modules/@noodle-borg/service/dist/main.js +3 -0
  276. package/node_modules/@noodle-borg/service/dist/main.js.map +1 -1
  277. package/node_modules/@noodle-borg/service/dist/options.d.ts +18 -0
  278. package/node_modules/@noodle-borg/service/dist/options.d.ts.map +1 -1
  279. package/node_modules/@noodle-borg/service/dist/persistence-options.d.ts +4 -0
  280. package/node_modules/@noodle-borg/service/dist/persistence-options.d.ts.map +1 -0
  281. package/node_modules/@noodle-borg/service/dist/persistence-options.js +22 -0
  282. package/node_modules/@noodle-borg/service/dist/persistence-options.js.map +1 -0
  283. package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-stream.d.ts.map +1 -1
  284. package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-stream.js +2 -1
  285. package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-stream.js.map +1 -1
  286. package/node_modules/@noodle-borg/service/dist/routes/assistant-interactions.d.ts.map +1 -1
  287. package/node_modules/@noodle-borg/service/dist/routes/assistant-interactions.js +6 -2
  288. package/node_modules/@noodle-borg/service/dist/routes/assistant-interactions.js.map +1 -1
  289. package/node_modules/@noodle-borg/service/dist/routes/billing-enforcement-cohort.d.ts +17 -0
  290. package/node_modules/@noodle-borg/service/dist/routes/billing-enforcement-cohort.d.ts.map +1 -0
  291. package/node_modules/@noodle-borg/service/dist/routes/billing-enforcement-cohort.js +145 -0
  292. package/node_modules/@noodle-borg/service/dist/routes/billing-enforcement-cohort.js.map +1 -0
  293. package/node_modules/@noodle-borg/service/dist/routes/billing-meter-readiness.d.ts +15 -0
  294. package/node_modules/@noodle-borg/service/dist/routes/billing-meter-readiness.d.ts.map +1 -0
  295. package/node_modules/@noodle-borg/service/dist/routes/billing-meter-readiness.js +78 -0
  296. package/node_modules/@noodle-borg/service/dist/routes/billing-meter-readiness.js.map +1 -0
  297. package/node_modules/@noodle-borg/service/dist/routes/billing-meter-validation.d.ts +15 -0
  298. package/node_modules/@noodle-borg/service/dist/routes/billing-meter-validation.d.ts.map +1 -0
  299. package/node_modules/@noodle-borg/service/dist/routes/billing-meter-validation.js +108 -0
  300. package/node_modules/@noodle-borg/service/dist/routes/billing-meter-validation.js.map +1 -0
  301. package/node_modules/@noodle-borg/service/dist/routes/commercial-dispatch.d.ts +6 -0
  302. package/node_modules/@noodle-borg/service/dist/routes/commercial-dispatch.d.ts.map +1 -1
  303. package/node_modules/@noodle-borg/service/dist/routes/commercial-dispatch.js +99 -0
  304. package/node_modules/@noodle-borg/service/dist/routes/commercial-dispatch.js.map +1 -1
  305. package/node_modules/@noodle-borg/service/dist/routes/commercial-service-deps.d.ts +25 -0
  306. package/node_modules/@noodle-borg/service/dist/routes/commercial-service-deps.d.ts.map +1 -0
  307. package/node_modules/@noodle-borg/service/dist/routes/commercial-service-deps.js +35 -0
  308. package/node_modules/@noodle-borg/service/dist/routes/commercial-service-deps.js.map +1 -0
  309. package/node_modules/@noodle-borg/service/dist/routes/control-plane.d.ts.map +1 -1
  310. package/node_modules/@noodle-borg/service/dist/routes/control-plane.js +3 -1
  311. package/node_modules/@noodle-borg/service/dist/routes/control-plane.js.map +1 -1
  312. package/node_modules/@noodle-borg/service/dist/serve-options.d.ts +93 -0
  313. package/node_modules/@noodle-borg/service/dist/serve-options.d.ts.map +1 -0
  314. package/node_modules/@noodle-borg/service/dist/serve-options.js +2 -0
  315. package/node_modules/@noodle-borg/service/dist/serve-options.js.map +1 -0
  316. package/node_modules/@noodle-borg/service/dist/serve.d.ts +2 -92
  317. package/node_modules/@noodle-borg/service/dist/serve.d.ts.map +1 -1
  318. package/node_modules/@noodle-borg/service/dist/serve.js +64 -59
  319. package/node_modules/@noodle-borg/service/dist/serve.js.map +1 -1
  320. package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.d.ts +22 -0
  321. package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.d.ts.map +1 -0
  322. package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.js +51 -0
  323. package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.js.map +1 -0
  324. package/node_modules/@noodle-borg/service/dist/service.d.ts.map +1 -1
  325. package/node_modules/@noodle-borg/service/dist/service.js +10 -21
  326. package/node_modules/@noodle-borg/service/dist/service.js.map +1 -1
  327. package/node_modules/@noodle-borg/service/dist/store/cloudsql-pool.d.ts.map +1 -1
  328. package/node_modules/@noodle-borg/service/dist/store/cloudsql-pool.js +7 -1
  329. package/node_modules/@noodle-borg/service/dist/store/cloudsql-pool.js.map +1 -1
  330. package/node_modules/@noodle-borg/service/dist/store/postgres-billing.d.ts +6 -2
  331. package/node_modules/@noodle-borg/service/dist/store/postgres-billing.d.ts.map +1 -1
  332. package/node_modules/@noodle-borg/service/dist/store/postgres-billing.js +11 -1
  333. package/node_modules/@noodle-borg/service/dist/store/postgres-billing.js.map +1 -1
  334. package/node_modules/@noodle-borg/wire-contracts/dist/assistant.d.ts +3 -0
  335. package/node_modules/@noodle-borg/wire-contracts/dist/assistant.d.ts.map +1 -1
  336. package/node_modules/@noodle-borg/wire-contracts/dist/assistant.js +3 -0
  337. package/node_modules/@noodle-borg/wire-contracts/dist/assistant.js.map +1 -1
  338. package/package.json +1 -1
@@ -0,0 +1,145 @@
1
+ import { BillingEnforcementCohortConflictError, BillingEnforcementCohortSealResponseSchema, BillingEnforcementCohortStatusResponseSchema, billingEnforcementCohortSuccessAudit, parseBillingEnforcementCohortSealRequest, } from '../billing/enforcement-profile.js';
2
+ import { readJsonBody, sendForbidden, sendJson, sendUnauthorized } from '../http-util.js';
3
+ import { emitAuditMirrors } from '../store/audit.js';
4
+ /** Aggregate-only operator status. It reveals no account, organization, app, or owner identity. */
5
+ export async function handleBillingEnforcementCohortStatus(req, res, deps) {
6
+ const identity = await authorizeCohortOperator(req, res, deps, 'read');
7
+ if (identity === undefined)
8
+ return;
9
+ if (deps.store === undefined) {
10
+ await emitDenial(deps.audit, 409, 'store_required', 'read', identity);
11
+ return sendJson(res, 409, {
12
+ ok: false,
13
+ code: 'billing_enforcement_profile_store_required',
14
+ error: 'billing enforcement cohort status requires the configured PostgreSQL profile store',
15
+ });
16
+ }
17
+ let status;
18
+ try {
19
+ status = BillingEnforcementCohortStatusResponseSchema.parse(await deps.store.getEnforcementCohortStatus());
20
+ }
21
+ catch (error) {
22
+ await emitDenial(deps.audit, 500, 'internal_error', 'read', identity);
23
+ throw error;
24
+ }
25
+ await deps.audit.emit({
26
+ eventType: 'billing.enforcement.cohort.read',
27
+ org: 'platform',
28
+ actorSubject: identity.subject,
29
+ ...(identity.email !== undefined ? { actorEmail: identity.email } : {}),
30
+ decision: 'allow',
31
+ status: 200,
32
+ details: {
33
+ cohortKind: status.cohortKind,
34
+ state: status.state,
35
+ legacyAccountProfile: status.legacyAccountProfile,
36
+ postSealAccountProfile: status.postSealAccountProfile,
37
+ billingAccountCount: status.billingAccountCount,
38
+ profiledAccountCount: status.profiledAccountCount,
39
+ legacyInternalExemptAccountCount: status.legacyInternalExemptAccountCount,
40
+ enforcedAccountCount: status.enforcedAccountCount,
41
+ unprofiledAccountCount: status.unprofiledAccountCount,
42
+ billingAttributionComplete: status.billingAttributionComplete,
43
+ attributionBlockerCount: status.attributionBlockerCount,
44
+ },
45
+ });
46
+ sendJson(res, 200, { ok: true, data: status });
47
+ }
48
+ /** Classify the immutable launch cohort without activating usage or footprint enforcement. */
49
+ export async function handleBillingEnforcementCohortSeal(req, res, deps) {
50
+ const identity = await authorizeCohortOperator(req, res, deps, 'seal');
51
+ if (identity === undefined)
52
+ return;
53
+ if (deps.store === undefined) {
54
+ await emitDenial(deps.audit, 409, 'store_required', 'seal', identity);
55
+ return sendJson(res, 409, {
56
+ ok: false,
57
+ code: 'billing_enforcement_profile_store_required',
58
+ error: 'billing enforcement cohort seal requires the configured PostgreSQL profile store',
59
+ });
60
+ }
61
+ if (deps.serviceUrl === undefined) {
62
+ await emitDenial(deps.audit, 409, 'service_required', 'seal', identity);
63
+ return sendJson(res, 409, {
64
+ ok: false,
65
+ code: 'billing_enforcement_service_required',
66
+ error: 'billing enforcement cohort seal requires the configured public service URL',
67
+ });
68
+ }
69
+ const body = await readJsonBody(req, deps.maxBody);
70
+ if (!body.ok) {
71
+ await emitDenial(deps.audit, body.status, 'invalid_request', 'seal', identity);
72
+ return sendJson(res, body.status, { ok: false, error: body.error });
73
+ }
74
+ let request;
75
+ try {
76
+ request = parseBillingEnforcementCohortSealRequest(body.value);
77
+ }
78
+ catch (error) {
79
+ await emitDenial(deps.audit, 400, 'invalid_request', 'seal', identity);
80
+ return sendJson(res, 400, {
81
+ ok: false,
82
+ error: error instanceof Error ? error.message : String(error),
83
+ });
84
+ }
85
+ let result;
86
+ try {
87
+ result = BillingEnforcementCohortSealResponseSchema.parse(await deps.store.sealEnforcementCohort({
88
+ request,
89
+ actor: identity,
90
+ service: deps.serviceUrl,
91
+ }));
92
+ }
93
+ catch (error) {
94
+ if (error instanceof BillingEnforcementCohortConflictError) {
95
+ await emitDenial(deps.audit, 409, error.code, 'seal', identity);
96
+ return sendJson(res, 409, { ok: false, code: error.code, error: error.message });
97
+ }
98
+ await emitDenial(deps.audit, 500, 'internal_error', 'seal', identity);
99
+ throw error;
100
+ }
101
+ const status = result.replayed ? 200 : 201;
102
+ const successAudit = billingEnforcementCohortSuccessAudit(result, identity);
103
+ if (deps.store.successAuditMode === 'transactional') {
104
+ await emitAuditMirrors(deps.audit, successAudit);
105
+ }
106
+ else {
107
+ await deps.audit.emit(successAudit);
108
+ }
109
+ sendJson(res, status, { ok: true, data: result });
110
+ }
111
+ async function authorizeCohortOperator(req, res, deps, action) {
112
+ const auth = await deps.gate.authorize(req);
113
+ if (!auth.ok) {
114
+ await emitDenial(deps.audit, auth.status, 'authorization_failed', action);
115
+ if (auth.status === 401)
116
+ sendUnauthorized(res, auth.message);
117
+ else
118
+ sendForbidden(res, auth.message);
119
+ return undefined;
120
+ }
121
+ if (auth.identity === undefined) {
122
+ await emitDenial(deps.audit, 401, 'identity_required', action);
123
+ sendUnauthorized(res, 'identity required');
124
+ return undefined;
125
+ }
126
+ if (!auth.identity.superAdmin) {
127
+ await emitDenial(deps.audit, 403, 'super_admin_required', action, auth.identity);
128
+ sendForbidden(res, 'super-admin required');
129
+ return undefined;
130
+ }
131
+ return auth.identity;
132
+ }
133
+ function emitDenial(audit, status, reasonCode, action, identity) {
134
+ return audit.emit({
135
+ eventType: action === 'read' ? 'billing.enforcement.cohort.read' : 'billing.enforcement.cohort.sealed',
136
+ org: 'platform',
137
+ decision: 'deny',
138
+ status,
139
+ reasonCode,
140
+ ...(identity === undefined
141
+ ? {}
142
+ : { actorSubject: identity.subject, actorEmail: identity.email }),
143
+ });
144
+ }
145
+ //# sourceMappingURL=billing-enforcement-cohort.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing-enforcement-cohort.js","sourceRoot":"","sources":["../../src/routes/billing-enforcement-cohort.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,qCAAqC,EAGrC,0CAA0C,EAE1C,4CAA4C,EAE5C,oCAAoC,EACpC,wCAAwC,GACzC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC1F,OAAO,EAAkB,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAUrE,mGAAmG;AACnG,MAAM,CAAC,KAAK,UAAU,oCAAoC,CACxD,GAAoB,EACpB,GAAmB,EACnB,IAAqB;IAErB,MAAM,QAAQ,GAAG,MAAM,uBAAuB,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IACvE,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO;IACnC,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC7B,MAAM,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,gBAAgB,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QACtE,OAAO,QA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AAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QAChC,MAAM,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,mBAAmB,EAAE,MAAM,CAAC,CAAC;QAC/D,gBAAgB,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAC;QAC3C,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;QAC9B,MAAM,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,sBAAsB,EAAE,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjF,aAAa,CAAC,GAAG,EAAE,sBAAsB,CAAC,CAAC;QAC3C,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,IAAI,CAAC,QAAQ,CAAC;AACvB,CAAC;AAED,SAAS,UAAU,CACjB,KAAgB,EAChB,MAAc,EACd,UAAkB,EAClB,MAAuB,EACvB,QAA+B;IAE/B,OAAO,KAAK,CAAC,IAAI,CAAC;QAChB,SAAS,EACP,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,iCAAiC,CAAC,CAAC,CAAC,mCAAmC;QAC7F,GAAG,EAAE,UAAU;QACf,QAAQ,EAAE,MAAM;QAChB,MAAM;QACN,UAAU;QACV,GAAG,CAAC,QAAQ,KAAK,SAAS;YACxB,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,YAAY,EAAE,QAAQ,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC;KACpE,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { IncomingMessage, ServerResponse } from 'node:http';
2
+ import type { DeployAuthGate } from '../auth/deploy-gate.js';
3
+ import { type BillingMeterReadinessStore } from '../billing/meter-readiness.js';
4
+ import type { AuditSink } from '../store/audit.js';
5
+ interface BillingMeterReadinessDeps {
6
+ readonly gate: DeployAuthGate;
7
+ readonly store?: BillingMeterReadinessStore;
8
+ readonly billingUsageEnabled?: boolean;
9
+ readonly clock?: () => Date;
10
+ readonly audit: AuditSink;
11
+ }
12
+ /** Read-only operator diagnostic. It does not activate, enforce, or mutate metering state. */
13
+ export declare function handleBillingMeterReadiness(req: IncomingMessage, res: ServerResponse, deps: BillingMeterReadinessDeps): Promise<void>;
14
+ export {};
15
+ //# sourceMappingURL=billing-meter-readiness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing-meter-readiness.d.ts","sourceRoot":"","sources":["../../src/routes/billing-meter-readiness.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,KAAK,EAAwB,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACnF,OAAO,EAGL,KAAK,0BAA0B,EAEhC,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,UAAU,yBAAyB;IACjC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,0BAA0B,CAAC;IAC5C,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IACvC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;CAC3B;AAED,8FAA8F;AAC9F,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE,yBAAyB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAoCf"}
@@ -0,0 +1,78 @@
1
+ import { BillingMeterReadinessReportSchema, unavailableBillingMeterReadinessReport, } from '../billing/meter-readiness.js';
2
+ import { sendForbidden, sendJson, sendUnauthorized } from '../http-util.js';
3
+ /** Read-only operator diagnostic. It does not activate, enforce, or mutate metering state. */
4
+ export async function handleBillingMeterReadiness(req, res, deps) {
5
+ const auth = await deps.gate.authorize(req);
6
+ if (!auth.ok) {
7
+ await emitReadinessDenial(deps.audit, auth.status, 'authorization_failed');
8
+ if (auth.status === 401)
9
+ sendUnauthorized(res, auth.message);
10
+ else
11
+ sendForbidden(res, auth.message);
12
+ return;
13
+ }
14
+ if (auth.identity === undefined) {
15
+ await emitReadinessDenial(deps.audit, 401, 'identity_required');
16
+ return sendUnauthorized(res, 'identity required');
17
+ }
18
+ if (!auth.identity.superAdmin) {
19
+ await emitReadinessDenial(deps.audit, 403, 'super_admin_required', auth.identity);
20
+ return sendForbidden(res, 'super-admin required');
21
+ }
22
+ const report = BillingMeterReadinessReportSchema.parse(await readReadinessReport(deps));
23
+ const states = { pass: 0, fail: 0, unknown: 0 };
24
+ for (const check of report.checks)
25
+ states[check.state]++;
26
+ await deps.audit.emit({
27
+ eventType: 'billing.metering.readiness.read',
28
+ org: 'platform',
29
+ actorSubject: auth.identity.subject,
30
+ ...(auth.identity.email !== undefined ? { actorEmail: auth.identity.email } : {}),
31
+ decision: 'allow',
32
+ status: 200,
33
+ details: {
34
+ technicalReadiness: report.technicalReadiness,
35
+ meteringMode: report.metering.mode,
36
+ checksPassed: states.pass,
37
+ checksFailed: states.fail,
38
+ checksUnknown: states.unknown,
39
+ },
40
+ });
41
+ sendJson(res, 200, { ok: true, data: report });
42
+ }
43
+ async function readReadinessReport(deps) {
44
+ if (deps.store !== undefined) {
45
+ try {
46
+ const report = BillingMeterReadinessReportSchema.parse(await deps.store.getMeterReadiness());
47
+ if (report.technicalReadiness !== 'unavailable')
48
+ return report;
49
+ return withCurrentMetering(report, deps.billingUsageEnabled === true);
50
+ }
51
+ catch {
52
+ // Health reads are represented as typed unavailable data. They never expose backend errors.
53
+ }
54
+ }
55
+ const unavailable = unavailableBillingMeterReadinessReport((deps.clock ?? (() => new Date()))().toISOString());
56
+ return withCurrentMetering(unavailable, deps.billingUsageEnabled === true);
57
+ }
58
+ function withCurrentMetering(report, billingUsageEnabled) {
59
+ return BillingMeterReadinessReportSchema.parse({
60
+ ...report,
61
+ metering: billingUsageEnabled
62
+ ? { mode: 'shadow', coverage: 'partial' }
63
+ : { mode: 'not_started', coverage: null },
64
+ });
65
+ }
66
+ function emitReadinessDenial(audit, status, reasonCode, identity) {
67
+ return audit.emit({
68
+ eventType: 'billing.metering.readiness.read',
69
+ org: 'platform',
70
+ decision: 'deny',
71
+ status,
72
+ reasonCode,
73
+ ...(identity !== undefined
74
+ ? { actorSubject: identity.subject, actorEmail: identity.email }
75
+ : {}),
76
+ });
77
+ }
78
+ //# sourceMappingURL=billing-meter-readiness.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing-meter-readiness.js","sourceRoot":"","sources":["../../src/routes/billing-meter-readiness.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,iCAAiC,EAEjC,sCAAsC,GACvC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAW5E,8FAA8F;AAC9F,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,GAAoB,EACpB,GAAmB,EACnB,IAA+B;IAE/B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC5C,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;QACb,MAAM,mBAAmB,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;QAC3E,IAAI,IAAI,CAAC,MAAM,KAAK,GAAG;YAAE,gBAAgB,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;;YACxD,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACtC,OAAO;IACT,CAAC;IACD,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QAChC,M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,EACjB,UAAkB,EAClB,QAA+B;IAE/B,OAAO,KAAK,CAAC,IAAI,CAAC;QAChB,SAAS,EAAE,iCAAiC;QAC5C,GAAG,EAAE,UAAU;QACf,QAAQ,EAAE,MAAM;QAChB,MAAM;QACN,UAAU;QACV,GAAG,CAAC,QAAQ,KAAK,SAAS;YACxB,CAAC,CAAC,EAAE,YAAY,EAAE,QAAQ,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAC,KAAK,EAAE;YAChE,CAAC,CAAC,EAAE,CAAC;KACR,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { IncomingMessage, ServerResponse } from 'node:http';
2
+ import type { DeployAuthGate } from '../auth/deploy-gate.js';
3
+ import { type BillingMeterValidationEpochStore } from '../billing/meter-validation-epoch.js';
4
+ import { type AuditSink } from '../store/audit.js';
5
+ interface ValidationEpochRouteDeps {
6
+ readonly gate: DeployAuthGate;
7
+ readonly store?: BillingMeterValidationEpochStore;
8
+ readonly serviceUrl?: string;
9
+ readonly audit: AuditSink;
10
+ readonly maxBody: number;
11
+ }
12
+ export declare function handleBillingMeterValidationEpochPrepare(req: IncomingMessage, res: ServerResponse, deps: ValidationEpochRouteDeps): Promise<void>;
13
+ export declare function handleBillingMeterValidationEpochRetire(req: IncomingMessage, res: ServerResponse, deps: ValidationEpochRouteDeps): Promise<void>;
14
+ export {};
15
+ //# sourceMappingURL=billing-meter-validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing-meter-validation.d.ts","sourceRoot":"","sources":["../../src/routes/billing-meter-validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,KAAK,EAAwB,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACnF,OAAO,EAKL,KAAK,gCAAgC,EAItC,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,KAAK,SAAS,EAAoB,MAAM,mBAAmB,CAAC;AAErE,UAAU,wBAAwB;IAChC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,gCAAgC,CAAC;IAClD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,wCAAwC,CACtD,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE,wBAAwB,GAC7B,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,wBAAgB,uCAAuC,CACrD,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE,wBAAwB,GAC7B,OAAO,CAAC,IAAI,CAAC,CAEf"}
@@ -0,0 +1,108 @@
1
+ import { BillingMeterValidationEpochConflictError, billingMeterValidationEpochSuccessAudit, parseBillingMeterValidationEpochPrepareRequest, parseBillingMeterValidationEpochRetireRequest, } from '../billing/meter-validation-epoch.js';
2
+ import { readJsonBody, sendForbidden, sendJson, sendUnauthorized } from '../http-util.js';
3
+ import { emitAuditMirrors } from '../store/audit.js';
4
+ export function handleBillingMeterValidationEpochPrepare(req, res, deps) {
5
+ return handleValidationEpochMutation(req, res, deps, 'validation_prepare');
6
+ }
7
+ export function handleBillingMeterValidationEpochRetire(req, res, deps) {
8
+ return handleValidationEpochMutation(req, res, deps, 'validation_retire');
9
+ }
10
+ async function handleValidationEpochMutation(req, res, deps, action) {
11
+ const auth = await deps.gate.authorize(req);
12
+ if (!auth.ok) {
13
+ await emitDenial(deps.audit, auth.status, 'authorization_failed', action);
14
+ if (auth.status === 401)
15
+ sendUnauthorized(res, auth.message);
16
+ else
17
+ sendForbidden(res, auth.message);
18
+ return;
19
+ }
20
+ if (auth.identity === undefined) {
21
+ await emitDenial(deps.audit, 401, 'identity_required', action);
22
+ return sendUnauthorized(res, 'identity required');
23
+ }
24
+ if (!auth.identity.superAdmin) {
25
+ await emitDenial(deps.audit, 403, 'super_admin_required', action, auth.identity);
26
+ return sendForbidden(res, 'super-admin required');
27
+ }
28
+ if (deps.store === undefined) {
29
+ await emitDenial(deps.audit, 409, 'store_required', action, auth.identity);
30
+ return sendJson(res, 409, {
31
+ ok: false,
32
+ code: 'billing_meter_validation_epoch_store_required',
33
+ error: 'validation epoch operations require the configured PostgreSQL lifecycle store',
34
+ });
35
+ }
36
+ if (deps.serviceUrl === undefined) {
37
+ await emitDenial(deps.audit, 409, 'service_required', action, auth.identity);
38
+ return sendJson(res, 409, {
39
+ ok: false,
40
+ code: 'billing_meter_validation_epoch_service_required',
41
+ error: 'validation epoch operations require the configured public service URL',
42
+ });
43
+ }
44
+ const body = await readJsonBody(req, deps.maxBody);
45
+ if (!body.ok) {
46
+ await emitDenial(deps.audit, body.status, 'invalid_request', action, auth.identity);
47
+ return sendJson(res, body.status, { ok: false, error: body.error });
48
+ }
49
+ let result;
50
+ try {
51
+ if (action === 'validation_prepare') {
52
+ const request = parseBillingMeterValidationEpochPrepareRequest(body.value);
53
+ result = await deps.store.prepareValidationEpoch({
54
+ request,
55
+ actor: auth.identity,
56
+ service: deps.serviceUrl,
57
+ });
58
+ }
59
+ else {
60
+ const request = parseBillingMeterValidationEpochRetireRequest(body.value);
61
+ result = await deps.store.retireValidationEpoch({
62
+ request,
63
+ actor: auth.identity,
64
+ service: deps.serviceUrl,
65
+ });
66
+ }
67
+ }
68
+ catch (error) {
69
+ if (isInvalidRequest(error)) {
70
+ await emitDenial(deps.audit, 400, 'invalid_request', action, auth.identity);
71
+ return sendJson(res, 400, { ok: false, error: error.message });
72
+ }
73
+ if (error instanceof BillingMeterValidationEpochConflictError) {
74
+ await emitDenial(deps.audit, 409, error.code, action, auth.identity);
75
+ return sendJson(res, 409, { ok: false, code: error.code, error: error.message });
76
+ }
77
+ await emitDenial(deps.audit, 500, 'internal_error', action, auth.identity);
78
+ throw error;
79
+ }
80
+ const status = action === 'validation_prepare' && !result.replayed ? 201 : 200;
81
+ const successAudit = billingMeterValidationEpochSuccessAudit(action, result, auth.identity);
82
+ if (deps.store.successAuditMode === 'transactional') {
83
+ await emitAuditMirrors(deps.audit, successAudit);
84
+ }
85
+ else {
86
+ await deps.audit.emit(successAudit);
87
+ }
88
+ sendJson(res, status, { ok: true, data: result });
89
+ }
90
+ function emitDenial(audit, status, reasonCode, action, identity) {
91
+ return audit.emit({
92
+ eventType: 'billing.metering.validation_epoch',
93
+ org: 'platform',
94
+ decision: 'deny',
95
+ status,
96
+ reasonCode,
97
+ ...(identity !== undefined
98
+ ? { actorSubject: identity.subject, actorEmail: identity.email }
99
+ : {}),
100
+ details: { action },
101
+ });
102
+ }
103
+ function isInvalidRequest(error) {
104
+ return (error instanceof Error &&
105
+ (error.message.startsWith('invalid billing meter validation epoch prepare:') ||
106
+ error.message.startsWith('invalid billing meter validation epoch retire:')));
107
+ }
108
+ //# sourceMappingURL=billing-meter-validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing-meter-validation.js","sourceRoot":"","sources":["../../src/routes/billing-meter-validation.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,wCAAwC,EAKxC,uCAAuC,EACvC,8CAA8C,EAC9C,6CAA6C,GAC9C,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC1F,OAAO,EAAkB,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAUrE,MAAM,UAAU,wCAAwC,CACtD,GAAoB,EACpB,GAAmB,EACnB,IAA8B;IAE9B,OAAO,6BAA6B,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,oBAAoB,CAAC,CAAC;AAC7E,CAAC;AAED,MAAM,UAAU,uCAAuC,CACrD,GAAoB,EACpB,GAAmB,EACnB,IAA8B;IAE9B,OAAO,6BAA6B,CAAC,GA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YAAY,GAAG,uCAAuC,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC5F,IAAI,IAAI,CAAC,KAAK,CAAC,gBAAgB,KAAK,eAAe,EAAE,CAAC;QACpD,MAAM,gBAAgB,CAAC,IAAI,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;IACnD,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACtC,CAAC;IACD,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;AACpD,CAAC;AAED,SAAS,UAAU,CACjB,KAAgB,EAChB,MAAc,EACd,UAAkB,EAClB,MAAkD,EAClD,QAA+B;IAE/B,OAAO,KAAK,CAAC,IAAI,CAAC;QAChB,SAAS,EAAE,mCAAmC;QAC9C,GAAG,EAAE,UAAU;QACf,QAAQ,EAAE,MAAM;QAChB,MAAM;QACN,UAAU;QACV,GAAG,CAAC,QAAQ,KAAK,SAAS;YACxB,CAAC,CAAC,EAAE,YAAY,EAAE,QAAQ,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAC,KAAK,EAAE;YAChE,CAAC,CAAC,EAAE,CAAC;QACP,OAAO,EAAE,EAAE,MAAM,EAAE;KACpB,CAAC,CAAC;AACL,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAc;IACtC,OAAO,CACL,KAAK,YAAY,KAAK;QACtB,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,iDAAiD,CAAC;YAC1E,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,gDAAgD,CAAC,CAAC,CAC9E,CAAC;AACJ,CAAC"}
@@ -2,6 +2,9 @@
2
2
  import type { IncomingMessage, ServerResponse } from 'node:http';
3
3
  import type { Logger, TlsPosture } from '@noodle-borg/transport-http';
4
4
  import type { DeployAuthGate } from '../auth/deploy-gate.js';
5
+ import type { BillingEnforcementProfileStore } from '../billing/enforcement-profile.js';
6
+ import type { BillingMeterReadinessStore } from '../billing/meter-readiness.js';
7
+ import type { BillingMeterValidationEpochStore } from '../billing/meter-validation-epoch.js';
5
8
  import type { LegacyBillingMigrationStore } from '../billing/migration-apply.js';
6
9
  import type { CommercialPlanCatalog } from '../commercial-plans.js';
7
10
  import type { PolicyAssignmentStore } from '../policy.js';
@@ -15,6 +18,9 @@ export interface CommercialDispatchDeps {
15
18
  readonly billingUsageEnabled?: boolean;
16
19
  readonly clock?: () => Date;
17
20
  readonly billingMigrationStore?: LegacyBillingMigrationStore;
21
+ readonly billingEnforcementProfileStore?: BillingEnforcementProfileStore;
22
+ readonly billingMeterReadinessStore?: BillingMeterReadinessStore;
23
+ readonly billingMeterValidationEpochStore?: BillingMeterValidationEpochStore;
18
24
  readonly serviceUrl?: string;
19
25
  readonly logger: Logger;
20
26
  readonly policyStore?: PolicyAssignmentStore;
@@ -1 +1 @@
1
- {"version":3,"file":"commercial-dispatch.d.ts","sourceRoot":"","sources":["../../src/routes/commercial-dispatch.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,iBAAiB,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CAAgC,CAAC;IAC7E,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,CAAC,EAAE,qBAAqB,CAAC;IAC7C,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,qBAAqB,CAAC;IACxC,QAAQ,CAAC,oBAAoB,EAAE,CAAC,GAAG,EAAE,cAAc,EAAE,GAAG,EAAE,UAAU,KAAK,IAAI,CAAC;IAC9E,QAAQ,CAAC,YAAY,EAAE,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,EAAE,GAAG,EAAE,UAAU,KAAK,OAAO,CAAC;IAC/F,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAChF,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC;CAC1B;AAED,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,sBAAsB,GAC3B,OAAO,CAwMT"}
@@ -1,10 +1,109 @@
1
1
  import { handleLegacyBillingMigrationApply, handleLegacyBillingMigrationPreview, } from './billing.js';
2
+ import { handleBillingEnforcementCohortSeal, handleBillingEnforcementCohortStatus, } from './billing-enforcement-cohort.js';
3
+ import { handleBillingMeterReadiness } from './billing-meter-readiness.js';
4
+ import { handleBillingMeterValidationEpochPrepare, handleBillingMeterValidationEpochRetire, } from './billing-meter-validation.js';
2
5
  import { handleBillingAccountInspect, handleBillingAccountList, handleOrgBillingInspect, } from './billing-read.js';
3
6
  import { parseBillingAccountItemPath, parseOrgBillingPath, parsePlanPath } from './paths.js';
4
7
  import { handlePlan } from './plans.js';
5
8
  const LEGACY_BILLING_PREVIEW_PATH = '/v1/billing-accounts/migrations/legacy/preview';
6
9
  const LEGACY_BILLING_APPLY_PATH = '/v1/billing-accounts/migrations/legacy/apply';
10
+ const BILLING_METER_READINESS_PATH = '/v1/billing-accounts/metering/readiness';
11
+ const BILLING_METER_VALIDATION_PREPARE_PATH = '/v1/billing-accounts/metering/validation/prepare';
12
+ const BILLING_METER_VALIDATION_RETIRE_PATH = '/v1/billing-accounts/metering/validation/retire';
13
+ const BILLING_ENFORCEMENT_COHORT_PATH = '/v1/billing-accounts/enforcement/cohort';
14
+ const BILLING_ENFORCEMENT_COHORT_SEAL_PATH = '/v1/billing-accounts/enforcement/cohort/seal';
7
15
  export function dispatchCommercialRoutes(req, res, url, deps) {
16
+ if (url.pathname === BILLING_ENFORCEMENT_COHORT_PATH && req.method === 'GET') {
17
+ deps.applySecurityHeaders(res, deps.tls);
18
+ if (deps.enforceHttps(req, res, deps.tls))
19
+ return true;
20
+ handleBillingEnforcementCohortStatus(req, res, {
21
+ gate: deps.gate,
22
+ ...(deps.billingEnforcementProfileStore === undefined
23
+ ? {}
24
+ : { store: deps.billingEnforcementProfileStore }),
25
+ audit: deps.audit,
26
+ maxBody: deps.maxBody,
27
+ }).catch((error) => respondCommercialRouteError(deps, res, 'billing.enforcement_cohort_read.error', error, {
28
+ ok: false,
29
+ error: 'internal error',
30
+ }));
31
+ return true;
32
+ }
33
+ if (url.pathname === BILLING_ENFORCEMENT_COHORT_SEAL_PATH && req.method === 'POST') {
34
+ deps.applySecurityHeaders(res, deps.tls);
35
+ if (deps.enforceHttps(req, res, deps.tls))
36
+ return true;
37
+ handleBillingEnforcementCohortSeal(req, res, {
38
+ gate: deps.gate,
39
+ ...(deps.billingEnforcementProfileStore === undefined
40
+ ? {}
41
+ : { store: deps.billingEnforcementProfileStore }),
42
+ ...(deps.serviceUrl === undefined ? {} : { serviceUrl: deps.serviceUrl }),
43
+ audit: deps.audit,
44
+ maxBody: deps.maxBody,
45
+ }).catch((error) => respondCommercialRouteError(deps, res, 'billing.enforcement_cohort_seal.error', error, {
46
+ ok: false,
47
+ error: 'internal error',
48
+ }));
49
+ return true;
50
+ }
51
+ if (url.pathname === BILLING_METER_VALIDATION_PREPARE_PATH && req.method === 'POST') {
52
+ deps.applySecurityHeaders(res, deps.tls);
53
+ if (deps.enforceHttps(req, res, deps.tls))
54
+ return true;
55
+ handleBillingMeterValidationEpochPrepare(req, res, {
56
+ gate: deps.gate,
57
+ ...(deps.billingMeterValidationEpochStore !== undefined
58
+ ? { store: deps.billingMeterValidationEpochStore }
59
+ : {}),
60
+ ...(deps.serviceUrl !== undefined ? { serviceUrl: deps.serviceUrl } : {}),
61
+ audit: deps.audit,
62
+ maxBody: deps.maxBody,
63
+ }).catch((error) => respondCommercialRouteError(deps, res, 'billing.metering_validation_prepare.error', error, {
64
+ ok: false,
65
+ error: 'internal error',
66
+ }));
67
+ return true;
68
+ }
69
+ if (url.pathname === BILLING_METER_VALIDATION_RETIRE_PATH && req.method === 'POST') {
70
+ deps.applySecurityHeaders(res, deps.tls);
71
+ if (deps.enforceHttps(req, res, deps.tls))
72
+ return true;
73
+ handleBillingMeterValidationEpochRetire(req, res, {
74
+ gate: deps.gate,
75
+ ...(deps.billingMeterValidationEpochStore !== undefined
76
+ ? { store: deps.billingMeterValidationEpochStore }
77
+ : {}),
78
+ ...(deps.serviceUrl !== undefined ? { serviceUrl: deps.serviceUrl } : {}),
79
+ audit: deps.audit,
80
+ maxBody: deps.maxBody,
81
+ }).catch((error) => respondCommercialRouteError(deps, res, 'billing.metering_validation_retire.error', error, {
82
+ ok: false,
83
+ error: 'internal error',
84
+ }));
85
+ return true;
86
+ }
87
+ if (url.pathname === BILLING_METER_READINESS_PATH && req.method === 'GET') {
88
+ deps.applySecurityHeaders(res, deps.tls);
89
+ if (deps.enforceHttps(req, res, deps.tls))
90
+ return true;
91
+ handleBillingMeterReadiness(req, res, {
92
+ gate: deps.gate,
93
+ ...(deps.billingMeterReadinessStore !== undefined
94
+ ? { store: deps.billingMeterReadinessStore }
95
+ : {}),
96
+ ...(deps.billingUsageEnabled !== undefined
97
+ ? { billingUsageEnabled: deps.billingUsageEnabled }
98
+ : {}),
99
+ ...(deps.clock !== undefined ? { clock: deps.clock } : {}),
100
+ audit: deps.audit,
101
+ }).catch((error) => respondCommercialRouteError(deps, res, 'billing.metering_readiness.error', error, {
102
+ ok: false,
103
+ error: 'internal error',
104
+ }));
105
+ return true;
106
+ }
8
107
  if (url.pathname === '/v1/billing-accounts' && req.method === 'GET') {
9
108
  deps.applySecurityHeaders(res, deps.tls);
10
109
  if (deps.enforceHttps(req, res, deps.tls))
@@ -1 +1 @@
1
- {"version":3,"file":"commercial-dispatch.js","sourceRoot":"","sources":["../../src/routes/commercial-dispatch.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,iCAAiC,EACjC,mCAAmC,GACpC,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,2BAA2B,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC7F,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,2BAA2B,GAAG,gDAAgD,CAAC;AACrF,MAAM,yBAAyB,GAAG,8CAA8C,CAAC;AAqBjF,MAAM,UAAU,wBAAwB,CACtC,GAAoB,EACpB,GAAmB,EACnB,GAAQ,EACR,IAA4B;IAE5B,IAAI,GAAG,CAAC,QAAQ,KAAK,sBAAsB,IAAI,GAAG,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;QACpE,IAAI,CAAC,oBAAoB,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;QACzC,IAAI,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QACvD,wBAAwB,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,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,OAAO,EAAE,IAAI,CAAC,OAAO;KACtB,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE,CAC1B,2BAA2B,CAAC,IAAI,EAAE,GAAG,EAAE,uBAAuB,EAAE,KAAK,EAAE;QACrE,KAAK,EAAE,gBAAgB;KACxB,CAAC,CACH,CAAC;IACF,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,2BAA2B,CAClC,IAA4B,EAC5B,GAAmB,EACnB,KAAa,EACb,KAAc,EACd,IAAa;IAEb,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE;QACvB,IAAI,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;QACrD,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;KAChE,CAAC,CAAC;IACH,IAAI,CAAC,GAAG,CAAC,WAAW;QAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;AACtD,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { ServiceOptions } from '../options.js';
2
+ import type { CommercialDispatchDeps } from './commercial-dispatch.js';
3
+ interface CommercialServiceDepsInput {
4
+ readonly options: ServiceOptions;
5
+ readonly commercialPlanCatalog: CommercialDispatchDeps['catalog'];
6
+ readonly route: {
7
+ readonly gate: CommercialDispatchDeps['gate'];
8
+ readonly controlPlane: CommercialDispatchDeps['controlPlane'];
9
+ readonly registry: CommercialDispatchDeps['registry'];
10
+ readonly billingUsage: {
11
+ readonly readOptions: Pick<CommercialDispatchDeps, 'billingUsageEnabled' | 'clock'>;
12
+ };
13
+ };
14
+ readonly shared: {
15
+ readonly logger: CommercialDispatchDeps['logger'];
16
+ readonly policyStore: CommercialDispatchDeps['policyStore'];
17
+ readonly audit: CommercialDispatchDeps['audit'];
18
+ readonly maxBody: CommercialDispatchDeps['maxBody'];
19
+ readonly tls: CommercialDispatchDeps['tls'];
20
+ };
21
+ }
22
+ /** Build the request-invariant commercial route dependencies once per service handler. */
23
+ export declare function createCommercialServiceDeps(input: CommercialServiceDepsInput): CommercialDispatchDeps;
24
+ export {};
25
+ //# sourceMappingURL=commercial-service-deps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commercial-service-deps.d.ts","sourceRoot":"","sources":["../../src/routes/commercial-service-deps.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAEvE,UAAU,0BAA0B;IAClC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,qBAAqB,EAAE,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAClE,QAAQ,CAAC,KAAK,EAAE;QACd,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAC;QAC9C,QAAQ,CAAC,YAAY,EAAE,sBAAsB,CAAC,cAAc,CAAC,CAAC;QAC9D,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,CAAC,UAAU,CAAC,CAAC;QACtD,QAAQ,CAAC,YAAY,EAAE;YACrB,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,sBAAsB,EAAE,qBAAqB,GAAG,OAAO,CAAC,CAAC;SACrF,CAAC;KACH,CAAC;IACF,QAAQ,CAAC,MAAM,EAAE;QACf,QAAQ,CAAC,MAAM,EAAE,sBAAsB,CAAC,QAAQ,CAAC,CAAC;QAClD,QAAQ,CAAC,WAAW,EAAE,sBAAsB,CAAC,aAAa,CAAC,CAAC;QAC5D,QAAQ,CAAC,KAAK,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC;QAChD,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC,SAAS,CAAC,CAAC;QACpD,QAAQ,CAAC,GAAG,EAAE,sBAAsB,CAAC,KAAK,CAAC,CAAC;KAC7C,CAAC;CACH;AAED,0FAA0F;AAC1F,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,0BAA0B,GAChC,sBAAsB,CAmCxB"}