@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.
- package/dist/commands/auth-ops.d.ts.map +1 -1
- package/dist/commands/auth-ops.js +28 -4
- package/dist/commands/auth-ops.js.map +1 -1
- package/dist/commands/billing-enforcement-ops.d.ts +2 -0
- package/dist/commands/billing-enforcement-ops.d.ts.map +1 -0
- package/dist/commands/billing-enforcement-ops.js +312 -0
- package/dist/commands/billing-enforcement-ops.js.map +1 -0
- package/dist/commands/billing-metering-ops.d.ts +2 -0
- package/dist/commands/billing-metering-ops.d.ts.map +1 -0
- package/dist/commands/billing-metering-ops.js +128 -0
- package/dist/commands/billing-metering-ops.js.map +1 -0
- package/dist/commands/billing-metering-validation-ops.d.ts +2 -0
- package/dist/commands/billing-metering-validation-ops.d.ts.map +1 -0
- package/dist/commands/billing-metering-validation-ops.js +186 -0
- package/dist/commands/billing-metering-validation-ops.js.map +1 -0
- package/dist/commands/billing-ops.d.ts.map +1 -1
- package/dist/commands/billing-ops.js +6 -0
- package/dist/commands/billing-ops.js.map +1 -1
- package/dist/commands/catalog-data-resources.d.ts.map +1 -1
- package/dist/commands/catalog-data-resources.js +14 -3
- package/dist/commands/catalog-data-resources.js.map +1 -1
- package/dist/commands/catalog-render.d.ts.map +1 -1
- package/dist/commands/catalog-render.js +7 -5
- package/dist/commands/catalog-render.js.map +1 -1
- package/dist/commands/deploy-ops.d.ts.map +1 -1
- package/dist/commands/deploy-ops.js +10 -1
- package/dist/commands/deploy-ops.js.map +1 -1
- package/dist/commands/deploy-output.d.ts.map +1 -1
- package/dist/commands/deploy-output.js +4 -0
- package/dist/commands/deploy-output.js.map +1 -1
- package/dist/commands/deploy-version-resolution.d.ts +1 -0
- package/dist/commands/deploy-version-resolution.d.ts.map +1 -1
- package/dist/commands/deploy-version-resolution.js +8 -0
- package/dist/commands/deploy-version-resolution.js.map +1 -1
- package/dist/commands/mcp-apps-chatgpt.d.ts +7 -0
- package/dist/commands/mcp-apps-chatgpt.d.ts.map +1 -0
- package/dist/commands/mcp-apps-chatgpt.js +143 -0
- package/dist/commands/mcp-apps-chatgpt.js.map +1 -0
- package/dist/commands/mcp-apps.d.ts.map +1 -1
- package/dist/commands/mcp-apps.js +2 -114
- package/dist/commands/mcp-apps.js.map +1 -1
- package/dist/deploy-payload-size.d.ts +3 -0
- package/dist/deploy-payload-size.d.ts.map +1 -0
- package/dist/deploy-payload-size.js +29 -0
- package/dist/deploy-payload-size.js.map +1 -0
- package/dist/deploy.d.ts.map +1 -1
- package/dist/deploy.js +16 -8
- package/dist/deploy.js.map +1 -1
- package/dist/saas-scaffold-template.js +1 -1
- package/dist/saas-scaffold-template.js.map +1 -1
- package/dist/sdk-version-skew.d.ts +3 -0
- package/dist/sdk-version-skew.d.ts.map +1 -0
- package/dist/sdk-version-skew.js +34 -0
- package/dist/sdk-version-skew.js.map +1 -0
- package/dist/widget-scaffold-template.d.ts.map +1 -1
- package/dist/widget-scaffold-template.js +4 -2
- package/dist/widget-scaffold-template.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/generated/example-files.js +3 -3
- package/node_modules/@noodle-borg/agent-kit/dist/generated/example-files.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/skill-authoring-refs.js +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/skill-authoring-refs.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/skill-content.js +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/skill-content.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/skill-embedded-assistant-ref.d.ts.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/skill-embedded-assistant-ref.js +6 -4
- package/node_modules/@noodle-borg/agent-kit/dist/skill-embedded-assistant-ref.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/package.json +1 -1
- package/node_modules/@noodle-borg/authoring/dist/assistant.d.ts +9 -0
- package/node_modules/@noodle-borg/authoring/dist/assistant.d.ts.map +1 -1
- package/node_modules/@noodle-borg/authoring/dist/assistant.js.map +1 -1
- package/node_modules/@noodle-borg/authoring/dist/server.d.ts +7 -0
- package/node_modules/@noodle-borg/authoring/dist/server.d.ts.map +1 -1
- package/node_modules/@noodle-borg/authoring/dist/server.js +2 -0
- package/node_modules/@noodle-borg/authoring/dist/server.js.map +1 -1
- package/node_modules/@noodle-borg/compiler/dist/artifact/types.d.ts +10 -1
- package/node_modules/@noodle-borg/compiler/dist/artifact/types.d.ts.map +1 -1
- package/node_modules/@noodle-borg/compiler/dist/artifact/types.js +6 -1
- package/node_modules/@noodle-borg/compiler/dist/artifact/types.js.map +1 -1
- package/node_modules/@noodle-borg/compiler/dist/compile.d.ts.map +1 -1
- package/node_modules/@noodle-borg/compiler/dist/compile.js +4 -0
- package/node_modules/@noodle-borg/compiler/dist/compile.js.map +1 -1
- package/node_modules/@noodle-borg/compiler/dist/manifest/schema.d.ts +52 -0
- package/node_modules/@noodle-borg/compiler/dist/manifest/schema.d.ts.map +1 -1
- package/node_modules/@noodle-borg/compiler/dist/manifest/schema.js +17 -0
- package/node_modules/@noodle-borg/compiler/dist/manifest/schema.js.map +1 -1
- package/node_modules/@noodle-borg/protocol/dist/mapping.d.ts.map +1 -1
- package/node_modules/@noodle-borg/protocol/dist/mapping.js +1 -0
- package/node_modules/@noodle-borg/protocol/dist/mapping.js.map +1 -1
- package/node_modules/@noodle-borg/protocol/dist/sdk-server.js +18 -0
- package/node_modules/@noodle-borg/protocol/dist/sdk-server.js.map +1 -1
- package/node_modules/@noodle-borg/protocol/dist/tool-interaction.d.ts +3 -0
- package/node_modules/@noodle-borg/protocol/dist/tool-interaction.d.ts.map +1 -1
- package/node_modules/@noodle-borg/protocol/dist/tool-interaction.js +12 -3
- package/node_modules/@noodle-borg/protocol/dist/tool-interaction.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/assistant-interactive.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/assistant-interactive.js +7 -3
- package/node_modules/@noodle-borg/service/dist/assistant-interactive.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/assistant-presentation.d.ts +11 -0
- package/node_modules/@noodle-borg/service/dist/assistant-presentation.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/assistant-presentation.js +67 -3
- package/node_modules/@noodle-borg/service/dist/assistant-presentation.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/billing/enforcement-profile.d.ts +96 -0
- package/node_modules/@noodle-borg/service/dist/billing/enforcement-profile.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/enforcement-profile.js +198 -0
- package/node_modules/@noodle-borg/service/dist/billing/enforcement-profile.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/integration.d.ts +25 -2
- package/node_modules/@noodle-borg/service/dist/billing/integration.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/billing/integration.js +51 -5
- package/node_modules/@noodle-borg/service/dist/billing/integration.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/billing/meter-capacity.d.ts +77 -0
- package/node_modules/@noodle-borg/service/dist/billing/meter-capacity.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/meter-capacity.js +202 -0
- package/node_modules/@noodle-borg/service/dist/billing/meter-capacity.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/meter-live-validation-contract.d.ts +8 -0
- package/node_modules/@noodle-borg/service/dist/billing/meter-live-validation-contract.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/meter-live-validation-contract.js +93 -0
- package/node_modules/@noodle-borg/service/dist/billing/meter-live-validation-contract.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/meter-live-validation.d.ts +76 -0
- package/node_modules/@noodle-borg/service/dist/billing/meter-live-validation.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/meter-live-validation.js +233 -0
- package/node_modules/@noodle-borg/service/dist/billing/meter-live-validation.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/meter-readiness-health.d.ts +89 -0
- package/node_modules/@noodle-borg/service/dist/billing/meter-readiness-health.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/meter-readiness-health.js +191 -0
- package/node_modules/@noodle-borg/service/dist/billing/meter-readiness-health.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/meter-readiness.d.ts +99 -0
- package/node_modules/@noodle-borg/service/dist/billing/meter-readiness.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/meter-readiness.js +136 -0
- package/node_modules/@noodle-borg/service/dist/billing/meter-readiness.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/meter-runtime-config.d.ts +9 -0
- package/node_modules/@noodle-borg/service/dist/billing/meter-runtime-config.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/meter-runtime-config.js +24 -0
- package/node_modules/@noodle-borg/service/dist/billing/meter-runtime-config.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/meter-validation-epoch.d.ts +75 -0
- package/node_modules/@noodle-borg/service/dist/billing/meter-validation-epoch.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/meter-validation-epoch.js +127 -0
- package/node_modules/@noodle-borg/service/dist/billing/meter-validation-epoch.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-enforcement-profile-schema.d.ts +4 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-enforcement-profile-schema.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-enforcement-profile-schema.js +107 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-enforcement-profile-schema.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-enforcement-profile.d.ts +18 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-enforcement-profile.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-enforcement-profile.js +341 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-enforcement-profile.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-clock.d.ts +3 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-clock.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-clock.js +9 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-clock.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-epoch-fixtures.d.ts +13 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-epoch-fixtures.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-epoch-fixtures.js +102 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-epoch-fixtures.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-epochs.d.ts +41 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-epochs.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-epochs.js +289 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-epochs.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-evidence-retention.d.ts +16 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-evidence-retention.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-evidence-retention.js +126 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-evidence-retention.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-live-validation.d.ts +33 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-live-validation.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-live-validation.js +436 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-live-validation.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-maintenance.d.ts +26 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-maintenance.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-maintenance.js +146 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-maintenance.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-partition.d.ts +8 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-partition.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-partition.js +42 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-partition.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-prepare-preflight.d.ts +8 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-prepare-preflight.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-prepare-preflight.js +44 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-prepare-preflight.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-readiness-live.d.ts +13 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-readiness-live.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-readiness-live.js +189 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-readiness-live.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-readiness.d.ts +18 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-readiness.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-readiness.js +342 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-readiness.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-reconciliation.d.ts +27 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-reconciliation.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-reconciliation.js +304 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-reconciliation.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-retention.d.ts +22 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-retention.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-retention.js +224 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-retention.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-runtime.d.ts +33 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-runtime.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-runtime.js +173 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-runtime.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler-schema.d.ts +7 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler-schema.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler-schema.js +50 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler-schema.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler-store.d.ts +34 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler-store.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler-store.js +157 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler-store.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler.d.ts +56 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler.js +264 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-scheduler.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-schema.d.ts +6 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-schema.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-schema.js +414 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-schema.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-validation.d.ts +43 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-validation.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-validation.js +321 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-validation.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-window-lock.d.ts +10 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-window-lock.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-window-lock.js +13 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-window-lock.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-window-schema.d.ts +6 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-window-schema.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-window-schema.js +248 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-window-schema.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-writer-compaction.d.ts +29 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-writer-compaction.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-writer-compaction.js +240 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-writer-compaction.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-writer-health-schema.d.ts +4 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-writer-health-schema.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-writer-health-schema.js +140 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-meter-writer-health-schema.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-migration.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/billing/postgres-migration.js +4 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-migration.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/billing/postgres-schema.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/billing/postgres-schema.js +6 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres-schema.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/billing/postgres.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/billing/postgres.js +3 -0
- package/node_modules/@noodle-borg/service/dist/billing/postgres.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/billing/service-meter-runtime.d.ts +7 -0
- package/node_modules/@noodle-borg/service/dist/billing/service-meter-runtime.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/service-meter-runtime.js +19 -0
- package/node_modules/@noodle-borg/service/dist/billing/service-meter-runtime.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/shadow-meter.d.ts +9 -4
- package/node_modules/@noodle-borg/service/dist/billing/shadow-meter.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/billing/shadow-meter.js +34 -95
- package/node_modules/@noodle-borg/service/dist/billing/shadow-meter.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/billing/usage-identity.d.ts +14 -0
- package/node_modules/@noodle-borg/service/dist/billing/usage-identity.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/usage-identity.js +87 -0
- package/node_modules/@noodle-borg/service/dist/billing/usage-identity.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/usage-observer.d.ts +6 -0
- package/node_modules/@noodle-borg/service/dist/billing/usage-observer.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing/usage-observer.js +26 -0
- package/node_modules/@noodle-borg/service/dist/billing/usage-observer.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing-public.d.ts +16 -0
- package/node_modules/@noodle-borg/service/dist/billing-public.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/billing-public.js +15 -0
- package/node_modules/@noodle-borg/service/dist/billing-public.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/customer-verifier.d.ts +1 -0
- package/node_modules/@noodle-borg/service/dist/customer-verifier.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/customer-verifier.js +15 -0
- package/node_modules/@noodle-borg/service/dist/customer-verifier.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/http-util.d.ts +2 -0
- package/node_modules/@noodle-borg/service/dist/http-util.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/http-util.js +1 -1
- package/node_modules/@noodle-borg/service/dist/http-util.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/index.d.ts +2 -7
- package/node_modules/@noodle-borg/service/dist/index.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/index.js +1 -6
- package/node_modules/@noodle-borg/service/dist/index.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/main.js +3 -0
- package/node_modules/@noodle-borg/service/dist/main.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/options.d.ts +18 -0
- package/node_modules/@noodle-borg/service/dist/options.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/persistence-options.d.ts +4 -0
- package/node_modules/@noodle-borg/service/dist/persistence-options.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/persistence-options.js +22 -0
- package/node_modules/@noodle-borg/service/dist/persistence-options.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-stream.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-stream.js +2 -1
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-stream.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interactions.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interactions.js +6 -2
- package/node_modules/@noodle-borg/service/dist/routes/assistant-interactions.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/billing-enforcement-cohort.d.ts +17 -0
- package/node_modules/@noodle-borg/service/dist/routes/billing-enforcement-cohort.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/billing-enforcement-cohort.js +145 -0
- package/node_modules/@noodle-borg/service/dist/routes/billing-enforcement-cohort.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/billing-meter-readiness.d.ts +15 -0
- package/node_modules/@noodle-borg/service/dist/routes/billing-meter-readiness.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/billing-meter-readiness.js +78 -0
- package/node_modules/@noodle-borg/service/dist/routes/billing-meter-readiness.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/billing-meter-validation.d.ts +15 -0
- package/node_modules/@noodle-borg/service/dist/routes/billing-meter-validation.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/billing-meter-validation.js +108 -0
- package/node_modules/@noodle-borg/service/dist/routes/billing-meter-validation.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/commercial-dispatch.d.ts +6 -0
- package/node_modules/@noodle-borg/service/dist/routes/commercial-dispatch.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/commercial-dispatch.js +99 -0
- package/node_modules/@noodle-borg/service/dist/routes/commercial-dispatch.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/commercial-service-deps.d.ts +25 -0
- package/node_modules/@noodle-borg/service/dist/routes/commercial-service-deps.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/commercial-service-deps.js +35 -0
- package/node_modules/@noodle-borg/service/dist/routes/commercial-service-deps.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/control-plane.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/control-plane.js +3 -1
- package/node_modules/@noodle-borg/service/dist/routes/control-plane.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/serve-options.d.ts +93 -0
- package/node_modules/@noodle-borg/service/dist/serve-options.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/serve-options.js +2 -0
- package/node_modules/@noodle-borg/service/dist/serve-options.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/serve.d.ts +2 -92
- package/node_modules/@noodle-borg/service/dist/serve.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/serve.js +64 -59
- package/node_modules/@noodle-borg/service/dist/serve.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.d.ts +22 -0
- package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.js +51 -0
- package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/service.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/service.js +10 -21
- package/node_modules/@noodle-borg/service/dist/service.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/store/cloudsql-pool.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/store/cloudsql-pool.js +7 -1
- package/node_modules/@noodle-borg/service/dist/store/cloudsql-pool.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/store/postgres-billing.d.ts +6 -2
- package/node_modules/@noodle-borg/service/dist/store/postgres-billing.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/store/postgres-billing.js +11 -1
- package/node_modules/@noodle-borg/service/dist/store/postgres-billing.js.map +1 -1
- package/node_modules/@noodle-borg/wire-contracts/dist/assistant.d.ts +3 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/assistant.d.ts.map +1 -1
- package/node_modules/@noodle-borg/wire-contracts/dist/assistant.js +3 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/assistant.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { createHmac } from 'node:crypto';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { normalizeBillingUsageInstant } from './usage-window.js';
|
|
4
|
+
export const BILLING_METER_READINESS_SCHEMA_VERSION = 1;
|
|
5
|
+
export const BILLING_METER_RECEIPT_RETENTION_DAYS = 7;
|
|
6
|
+
export const BILLING_METER_EXACT_KEY_TOMBSTONE_RETENTION_DAYS = 30;
|
|
7
|
+
export const BILLING_METER_AGGREGATE_RETENTION_MONTHS = 25;
|
|
8
|
+
export const BILLING_METER_PARTITION_HORIZON_MONTHS = 2;
|
|
9
|
+
export const BILLING_METER_EVIDENCE_FRESHNESS_MS = 24 * 60 * 60 * 1_000;
|
|
10
|
+
export const BILLING_METER_RETRY_IDENTITY_VERSION = 1;
|
|
11
|
+
export const BILLING_METER_READINESS_CHECK_CODES = [
|
|
12
|
+
'durable_postgres',
|
|
13
|
+
'billing_attribution_complete',
|
|
14
|
+
'legacy_platform_quota_retired',
|
|
15
|
+
'key_generation_consistent',
|
|
16
|
+
'prepared_meter_epoch',
|
|
17
|
+
'partition_horizon',
|
|
18
|
+
'receipt_retention',
|
|
19
|
+
'exact_key_tombstones',
|
|
20
|
+
'aggregate_reconciliation',
|
|
21
|
+
'validation_mirror',
|
|
22
|
+
'writer_health',
|
|
23
|
+
'scheduler_health',
|
|
24
|
+
];
|
|
25
|
+
export const BILLING_METER_LATER_CUTOVER_GATES = [
|
|
26
|
+
'traffic_fleet_convergence_proof',
|
|
27
|
+
'plan_volume_capacity_proof',
|
|
28
|
+
'nonproduction_fail_closed_drill',
|
|
29
|
+
'grant_expiry_contract',
|
|
30
|
+
'authoritative_activation',
|
|
31
|
+
'protected_production_approval',
|
|
32
|
+
];
|
|
33
|
+
const BillingMeterInstantSchema = z.iso
|
|
34
|
+
.datetime({ offset: true })
|
|
35
|
+
.transform((value) => new Date(value).toISOString());
|
|
36
|
+
const BillingMeterReadinessCheckSchema = z.strictObject({
|
|
37
|
+
code: z.enum(BILLING_METER_READINESS_CHECK_CODES),
|
|
38
|
+
state: z.enum(['pass', 'fail', 'unknown']),
|
|
39
|
+
checkedAt: BillingMeterInstantSchema.optional(),
|
|
40
|
+
});
|
|
41
|
+
const BillingMeterReadinessChecksSchema = z
|
|
42
|
+
.array(BillingMeterReadinessCheckSchema)
|
|
43
|
+
.length(BILLING_METER_READINESS_CHECK_CODES.length)
|
|
44
|
+
.superRefine((checks, context) => {
|
|
45
|
+
for (const [index, code] of BILLING_METER_READINESS_CHECK_CODES.entries()) {
|
|
46
|
+
if (checks[index]?.code !== code) {
|
|
47
|
+
context.addIssue({
|
|
48
|
+
code: 'custom',
|
|
49
|
+
message: `expected readiness check ${code} at index ${index}`,
|
|
50
|
+
path: [index, 'code'],
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
export const BillingMeterReadinessReportSchema = z
|
|
56
|
+
.strictObject({
|
|
57
|
+
schemaVersion: z.literal(BILLING_METER_READINESS_SCHEMA_VERSION),
|
|
58
|
+
checkedAt: BillingMeterInstantSchema,
|
|
59
|
+
technicalReadiness: z.enum(['ready', 'blocked', 'unavailable']),
|
|
60
|
+
metering: z.union([
|
|
61
|
+
z.strictObject({ mode: z.literal('not_started'), coverage: z.null() }),
|
|
62
|
+
z.strictObject({ mode: z.literal('shadow'), coverage: z.literal('partial') }),
|
|
63
|
+
]),
|
|
64
|
+
enforcement: z.strictObject({ state: z.literal('legacy_unchanged') }),
|
|
65
|
+
activation: z.strictObject({ state: z.literal('not_available') }),
|
|
66
|
+
checks: BillingMeterReadinessChecksSchema,
|
|
67
|
+
laterCutoverGates: z.tuple([
|
|
68
|
+
z.literal('traffic_fleet_convergence_proof'),
|
|
69
|
+
z.literal('plan_volume_capacity_proof'),
|
|
70
|
+
z.literal('nonproduction_fail_closed_drill'),
|
|
71
|
+
z.literal('grant_expiry_contract'),
|
|
72
|
+
z.literal('authoritative_activation'),
|
|
73
|
+
z.literal('protected_production_approval'),
|
|
74
|
+
]),
|
|
75
|
+
})
|
|
76
|
+
.superRefine((report, context) => {
|
|
77
|
+
const allPass = report.checks.every((check) => check.state === 'pass');
|
|
78
|
+
if ((report.technicalReadiness === 'ready') !== allPass) {
|
|
79
|
+
context.addIssue({
|
|
80
|
+
code: 'custom',
|
|
81
|
+
message: 'technical readiness must be ready exactly when every readiness check passes',
|
|
82
|
+
path: ['technicalReadiness'],
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
export function buildBillingMeterReadinessReport(input) {
|
|
87
|
+
const checkedAt = normalizeBillingUsageInstant('billing meter readiness check', input.checkedAt);
|
|
88
|
+
if ((input.metering.mode === 'not_started' && input.metering.coverage !== null) ||
|
|
89
|
+
(input.metering.mode === 'shadow' && input.metering.coverage !== 'partial')) {
|
|
90
|
+
throw new Error('billing meter readiness metering state is inconsistent');
|
|
91
|
+
}
|
|
92
|
+
const checks = BILLING_METER_READINESS_CHECK_CODES.map((code) => {
|
|
93
|
+
const signal = input.checks[code];
|
|
94
|
+
return {
|
|
95
|
+
code,
|
|
96
|
+
state: signal.state,
|
|
97
|
+
...(signal.checkedAt === undefined
|
|
98
|
+
? {}
|
|
99
|
+
: {
|
|
100
|
+
checkedAt: normalizeBillingUsageInstant(`billing meter readiness ${code} check`, signal.checkedAt),
|
|
101
|
+
}),
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
return BillingMeterReadinessReportSchema.parse({
|
|
105
|
+
schemaVersion: BILLING_METER_READINESS_SCHEMA_VERSION,
|
|
106
|
+
checkedAt,
|
|
107
|
+
technicalReadiness: checks.every((check) => check.state === 'pass') ? 'ready' : 'blocked',
|
|
108
|
+
metering: input.metering,
|
|
109
|
+
enforcement: { state: 'legacy_unchanged' },
|
|
110
|
+
activation: { state: 'not_available' },
|
|
111
|
+
checks,
|
|
112
|
+
laterCutoverGates: BILLING_METER_LATER_CUTOVER_GATES,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
export function unavailableBillingMeterReadinessReport(checkedAt) {
|
|
116
|
+
const normalized = normalizeBillingUsageInstant('billing meter readiness check', checkedAt);
|
|
117
|
+
return BillingMeterReadinessReportSchema.parse({
|
|
118
|
+
schemaVersion: BILLING_METER_READINESS_SCHEMA_VERSION,
|
|
119
|
+
checkedAt: normalized,
|
|
120
|
+
technicalReadiness: 'unavailable',
|
|
121
|
+
metering: { mode: 'not_started', coverage: null },
|
|
122
|
+
enforcement: { state: 'legacy_unchanged' },
|
|
123
|
+
activation: { state: 'not_available' },
|
|
124
|
+
checks: BILLING_METER_READINESS_CHECK_CODES.map((code) => ({ code, state: 'unknown' })),
|
|
125
|
+
laterCutoverGates: BILLING_METER_LATER_CUTOVER_GATES,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
/** A one-way generation marker; the HMAC key itself is never persisted or returned. */
|
|
129
|
+
export function deriveBillingMeterKeyGeneration(hmacKey) {
|
|
130
|
+
if (hmacKey.length < 32)
|
|
131
|
+
throw new Error('billing usage HMAC key must be at least 32 characters');
|
|
132
|
+
return createHmac('sha256', hmacKey)
|
|
133
|
+
.update('noodle-billing-meter-key-generation-v1')
|
|
134
|
+
.digest('hex');
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=meter-readiness.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meter-readiness.js","sourceRoot":"","sources":["../../src/billing/meter-readiness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AAEjE,MAAM,CAAC,MAAM,sCAAsC,GAAG,CAAU,CAAC;AACjE,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAU,CAAC;AAC/D,MAAM,CAAC,MAAM,gDAAgD,GAAG,EAAW,CAAC;AAC5E,MAAM,CAAC,MAAM,wCAAwC,GAAG,EAAW,CAAC;AACpE,MAAM,CAAC,MAAM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AE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QACvF,iBAAiB,EAAE,iCAAiC;KACrD,CAAC,CAAC;AACL,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,+BAA+B,CAAC,OAAe;IAC7D,IAAI,OAAO,CAAC,MAAM,GAAG,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAClG,OAAO,UAAU,CAAC,QAAQ,EAAE,OAAO,CAAC;SACjC,MAAM,CAAC,wCAAwC,CAAC;SAChD,MAAM,CAAC,KAAK,CAAC,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface BillingMeterValidationRuntimeConfig {
|
|
2
|
+
readonly cpuAlwaysAllocated: true;
|
|
3
|
+
/** Test-only cadence override; production uses the exported 30-second health interval. */
|
|
4
|
+
readonly writerHeartbeatIntervalMs?: number;
|
|
5
|
+
/** Test-only cadence override; production uses the exported five-minute scheduler interval. */
|
|
6
|
+
readonly schedulerIntervalMs?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function resolveBillingMeterValidationRuntimeConfig(env: Readonly<Record<string, string | undefined>>): BillingMeterValidationRuntimeConfig | undefined;
|
|
9
|
+
//# sourceMappingURL=meter-runtime-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meter-runtime-config.d.ts","sourceRoot":"","sources":["../../src/billing/meter-runtime-config.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mCAAmC;IAClD,QAAQ,CAAC,kBAAkB,EAAE,IAAI,CAAC;IAClC,0FAA0F;IAC1F,QAAQ,CAAC,yBAAyB,CAAC,EAAE,MAAM,CAAC;IAC5C,+FAA+F;IAC/F,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CACvC;AAED,wBAAgB,0CAA0C,CACxD,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,GAChD,mCAAmC,GAAG,SAAS,CAmBjD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function resolveBillingMeterValidationRuntimeConfig(env) {
|
|
2
|
+
const enabled = parseOptionalBoolean('NOODLE_BILLING_METER_VALIDATION_ENABLED', env.NOODLE_BILLING_METER_VALIDATION_ENABLED);
|
|
3
|
+
const cpuAlwaysAllocated = parseOptionalBoolean('NOODLE_BILLING_METER_CPU_ALWAYS_ALLOCATED', env.NOODLE_BILLING_METER_CPU_ALWAYS_ALLOCATED);
|
|
4
|
+
if (enabled !== true) {
|
|
5
|
+
if (cpuAlwaysAllocated === true) {
|
|
6
|
+
throw new Error('always-allocated CPU assertion requires validation to be enabled');
|
|
7
|
+
}
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
if (cpuAlwaysAllocated !== true) {
|
|
11
|
+
throw new Error('billing meter validation requires an explicit always-allocated CPU assertion');
|
|
12
|
+
}
|
|
13
|
+
return { cpuAlwaysAllocated: true };
|
|
14
|
+
}
|
|
15
|
+
function parseOptionalBoolean(name, value) {
|
|
16
|
+
if (value === undefined || value.length === 0)
|
|
17
|
+
return undefined;
|
|
18
|
+
if (value === 'true' || value === '1')
|
|
19
|
+
return true;
|
|
20
|
+
if (value === 'false' || value === '0')
|
|
21
|
+
return false;
|
|
22
|
+
throw new Error(`${name} must be true/false or 1/0`);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=meter-runtime-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meter-runtime-config.js","sourceRoot":"","sources":["../../src/billing/meter-runtime-config.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,0CAA0C,CACxD,GAAiD;IAEjD,MAAM,OAAO,GAAG,oBAAoB,CAClC,yCAAyC,EACzC,GAAG,CAAC,uCAAuC,CAC5C,CAAC;IACF,MAAM,kBAAkB,GAAG,oBAAoB,CAC7C,2CAA2C,EAC3C,GAAG,CAAC,yCAAyC,CAC9C,CAAC;IACF,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACrB,IAAI,kBAAkB,KAAK,IAAI,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;QACtF,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,kBAAkB,KAAK,IAAI,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,8EAA8E,CAAC,CAAC;IAClG,CAAC;IACD,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC;AACtC,CAAC;AAED,SAAS,oBAAoB,CAAC,IAAY,EAAE,KAAyB;IACnE,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAChE,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,GAAG;QAAE,OAAO,IAAI,CAAC;IACnD,IAAI,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,GAAG;QAAE,OAAO,KAAK,CAAC;IACrD,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,4BAA4B,CAAC,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { AuditEventInput } from '@noodle-borg/module';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import type { ControlPlaneIdentity } from '../auth/deploy-gate.js';
|
|
4
|
+
export declare const BILLING_METER_VALIDATION_WRITER_CONTRACT_VERSION = 1;
|
|
5
|
+
declare const prepareRequestSchema: z.ZodObject<{
|
|
6
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
7
|
+
mode: z.ZodLiteral<"validation">;
|
|
8
|
+
reason: z.ZodString;
|
|
9
|
+
idempotencyKey: z.ZodString;
|
|
10
|
+
confirmed: z.ZodLiteral<true>;
|
|
11
|
+
}, z.core.$strict>;
|
|
12
|
+
declare const retireRequestSchema: z.ZodObject<{
|
|
13
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
14
|
+
epochId: z.ZodString;
|
|
15
|
+
reason: z.ZodString;
|
|
16
|
+
idempotencyKey: z.ZodString;
|
|
17
|
+
confirmed: z.ZodLiteral<true>;
|
|
18
|
+
}, z.core.$strict>;
|
|
19
|
+
export declare const BillingMeterValidationEpochResultSchema: z.ZodObject<{
|
|
20
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
21
|
+
epochId: z.ZodString;
|
|
22
|
+
mode: z.ZodLiteral<"validation">;
|
|
23
|
+
state: z.ZodEnum<{
|
|
24
|
+
prepared: "prepared";
|
|
25
|
+
retired: "retired";
|
|
26
|
+
}>;
|
|
27
|
+
replayed: z.ZodBoolean;
|
|
28
|
+
preparedAt: z.ZodISODateTime;
|
|
29
|
+
retiredAt: z.ZodUnion<readonly [z.ZodISODateTime, z.ZodNull]>;
|
|
30
|
+
retryIdentityVersion: z.ZodNumber;
|
|
31
|
+
writerContractVersion: z.ZodNumber;
|
|
32
|
+
serviceReleaseSha: z.ZodString;
|
|
33
|
+
meteringMode: z.ZodLiteral<"shadow">;
|
|
34
|
+
enforcementMode: z.ZodLiteral<"legacy_unchanged">;
|
|
35
|
+
}, z.core.$strict>;
|
|
36
|
+
export type BillingMeterValidationEpochPrepareRequest = z.infer<typeof prepareRequestSchema>;
|
|
37
|
+
export type BillingMeterValidationEpochRetireRequest = z.infer<typeof retireRequestSchema>;
|
|
38
|
+
export type BillingMeterValidationEpochResult = z.infer<typeof BillingMeterValidationEpochResultSchema>;
|
|
39
|
+
export interface BillingMeterValidationEpochStore {
|
|
40
|
+
/** PostgreSQL stores persist success audits with the lifecycle transaction. */
|
|
41
|
+
readonly successAuditMode?: 'transactional';
|
|
42
|
+
prepareValidationEpoch(input: {
|
|
43
|
+
readonly request: BillingMeterValidationEpochPrepareRequest;
|
|
44
|
+
readonly actor: ControlPlaneIdentity;
|
|
45
|
+
readonly service: string;
|
|
46
|
+
}): Promise<BillingMeterValidationEpochResult>;
|
|
47
|
+
retireValidationEpoch(input: {
|
|
48
|
+
readonly request: BillingMeterValidationEpochRetireRequest;
|
|
49
|
+
readonly actor: ControlPlaneIdentity;
|
|
50
|
+
readonly service: string;
|
|
51
|
+
}): Promise<BillingMeterValidationEpochResult>;
|
|
52
|
+
}
|
|
53
|
+
export type BillingMeterValidationEpochConflictCode = 'idempotency_key_conflict' | 'validation_epoch_already_prepared' | 'validation_epoch_not_found' | 'validation_epoch_state_conflict' | 'validation_epoch_configuration_unavailable' | 'serialization_conflict';
|
|
54
|
+
export declare class BillingMeterValidationEpochConflictError extends Error {
|
|
55
|
+
readonly code: BillingMeterValidationEpochConflictCode;
|
|
56
|
+
constructor(code: BillingMeterValidationEpochConflictCode, message: string);
|
|
57
|
+
}
|
|
58
|
+
export declare function parseBillingMeterValidationEpochPrepareRequest(value: unknown): BillingMeterValidationEpochPrepareRequest;
|
|
59
|
+
export declare function parseBillingMeterValidationEpochRetireRequest(value: unknown): BillingMeterValidationEpochRetireRequest;
|
|
60
|
+
type FingerprintInput = {
|
|
61
|
+
readonly action: 'validation_prepare';
|
|
62
|
+
readonly request: BillingMeterValidationEpochPrepareRequest;
|
|
63
|
+
readonly actor: Pick<ControlPlaneIdentity, 'subject' | 'email'>;
|
|
64
|
+
readonly service: string;
|
|
65
|
+
} | {
|
|
66
|
+
readonly action: 'validation_retire';
|
|
67
|
+
readonly request: BillingMeterValidationEpochRetireRequest;
|
|
68
|
+
readonly actor: Pick<ControlPlaneIdentity, 'subject' | 'email'>;
|
|
69
|
+
readonly service: string;
|
|
70
|
+
};
|
|
71
|
+
export declare function billingMeterValidationEpochRequestFingerprint(input: FingerprintInput): string;
|
|
72
|
+
export declare function billingMeterValidationEpochSuccessAudit(action: 'validation_prepare' | 'validation_retire', result: BillingMeterValidationEpochResult, actor: Pick<ControlPlaneIdentity, 'subject' | 'email'>): AuditEventInput;
|
|
73
|
+
export declare function normalizeBillingMeterServiceUrl(value: string): string;
|
|
74
|
+
export {};
|
|
75
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BAA+B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAarE"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { billingContentChecksum } from './model.js';
|
|
3
|
+
export const BILLING_METER_VALIDATION_WRITER_CONTRACT_VERSION = 1;
|
|
4
|
+
const scalarSchema = (label, max) => z
|
|
5
|
+
.string()
|
|
6
|
+
.trim()
|
|
7
|
+
.min(1, `${label} is required`)
|
|
8
|
+
.max(max, `${label} must be ${max} characters or fewer`)
|
|
9
|
+
.refine((value) => !hasControlCharacters(value), `${label} cannot contain control characters`);
|
|
10
|
+
const prepareRequestSchema = z.strictObject({
|
|
11
|
+
schemaVersion: z.literal(1),
|
|
12
|
+
mode: z.literal('validation'),
|
|
13
|
+
reason: scalarSchema('reason', 512),
|
|
14
|
+
idempotencyKey: scalarSchema('idempotencyKey', 256),
|
|
15
|
+
confirmed: z.literal(true),
|
|
16
|
+
});
|
|
17
|
+
const retireRequestSchema = z.strictObject({
|
|
18
|
+
schemaVersion: z.literal(1),
|
|
19
|
+
epochId: scalarSchema('epochId', 128),
|
|
20
|
+
reason: scalarSchema('reason', 512),
|
|
21
|
+
idempotencyKey: scalarSchema('idempotencyKey', 256),
|
|
22
|
+
confirmed: z.literal(true),
|
|
23
|
+
});
|
|
24
|
+
export const BillingMeterValidationEpochResultSchema = z
|
|
25
|
+
.strictObject({
|
|
26
|
+
schemaVersion: z.literal(1),
|
|
27
|
+
epochId: scalarSchema('epochId', 128),
|
|
28
|
+
mode: z.literal('validation'),
|
|
29
|
+
state: z.enum(['prepared', 'retired']),
|
|
30
|
+
replayed: z.boolean(),
|
|
31
|
+
preparedAt: z.iso.datetime({ offset: true }),
|
|
32
|
+
retiredAt: z.union([z.iso.datetime({ offset: true }), z.null()]),
|
|
33
|
+
retryIdentityVersion: z.number().int().positive(),
|
|
34
|
+
writerContractVersion: z.number().int().positive(),
|
|
35
|
+
serviceReleaseSha: z
|
|
36
|
+
.string()
|
|
37
|
+
.regex(/^[0-9a-f]{40}$/, 'serviceReleaseSha must be a full lowercase Git SHA'),
|
|
38
|
+
meteringMode: z.literal('shadow'),
|
|
39
|
+
enforcementMode: z.literal('legacy_unchanged'),
|
|
40
|
+
})
|
|
41
|
+
.superRefine((result, context) => {
|
|
42
|
+
if (result.state === 'prepared' && result.retiredAt !== null) {
|
|
43
|
+
context.addIssue({
|
|
44
|
+
code: 'custom',
|
|
45
|
+
path: ['retiredAt'],
|
|
46
|
+
message: 'a prepared validation epoch cannot have a retirement timestamp',
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
if (result.state === 'retired' && result.retiredAt === null) {
|
|
50
|
+
context.addIssue({
|
|
51
|
+
code: 'custom',
|
|
52
|
+
path: ['retiredAt'],
|
|
53
|
+
message: 'a retired validation epoch requires a retirement timestamp',
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
export class BillingMeterValidationEpochConflictError extends Error {
|
|
58
|
+
code;
|
|
59
|
+
constructor(code, message) {
|
|
60
|
+
super(message);
|
|
61
|
+
this.name = 'BillingMeterValidationEpochConflictError';
|
|
62
|
+
this.code = code;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export function parseBillingMeterValidationEpochPrepareRequest(value) {
|
|
66
|
+
const result = prepareRequestSchema.safeParse(value);
|
|
67
|
+
if (!result.success) {
|
|
68
|
+
throw new Error(`invalid billing meter validation epoch prepare: ${z.prettifyError(result.error)}`);
|
|
69
|
+
}
|
|
70
|
+
return result.data;
|
|
71
|
+
}
|
|
72
|
+
export function parseBillingMeterValidationEpochRetireRequest(value) {
|
|
73
|
+
const result = retireRequestSchema.safeParse(value);
|
|
74
|
+
if (!result.success) {
|
|
75
|
+
throw new Error(`invalid billing meter validation epoch retire: ${z.prettifyError(result.error)}`);
|
|
76
|
+
}
|
|
77
|
+
return result.data;
|
|
78
|
+
}
|
|
79
|
+
export function billingMeterValidationEpochRequestFingerprint(input) {
|
|
80
|
+
return billingContentChecksum({
|
|
81
|
+
schemaVersion: input.request.schemaVersion,
|
|
82
|
+
action: input.action,
|
|
83
|
+
request: input.request,
|
|
84
|
+
actor: { subject: input.actor.subject, email: input.actor.email },
|
|
85
|
+
service: normalizeBillingMeterServiceUrl(input.service),
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
export function billingMeterValidationEpochSuccessAudit(action, result, actor) {
|
|
89
|
+
return {
|
|
90
|
+
eventType: 'billing.metering.validation_epoch',
|
|
91
|
+
org: 'platform',
|
|
92
|
+
actorSubject: actor.subject,
|
|
93
|
+
...(actor.email !== undefined ? { actorEmail: actor.email } : {}),
|
|
94
|
+
decision: 'allow',
|
|
95
|
+
status: action === 'validation_prepare' && !result.replayed ? 201 : 200,
|
|
96
|
+
details: {
|
|
97
|
+
action,
|
|
98
|
+
epochId: result.epochId,
|
|
99
|
+
state: result.state,
|
|
100
|
+
replayed: result.replayed,
|
|
101
|
+
retryIdentityVersion: result.retryIdentityVersion,
|
|
102
|
+
writerContractVersion: result.writerContractVersion,
|
|
103
|
+
serviceReleaseSha: result.serviceReleaseSha,
|
|
104
|
+
meteringMode: result.meteringMode,
|
|
105
|
+
enforcementMode: result.enforcementMode,
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
export function normalizeBillingMeterServiceUrl(value) {
|
|
110
|
+
const parsed = new URL(value);
|
|
111
|
+
if ((parsed.protocol !== 'https:' && parsed.protocol !== 'http:') ||
|
|
112
|
+
parsed.username !== '' ||
|
|
113
|
+
parsed.password !== '' ||
|
|
114
|
+
parsed.pathname !== '/' ||
|
|
115
|
+
parsed.search !== '' ||
|
|
116
|
+
parsed.hash !== '') {
|
|
117
|
+
throw new Error('billing meter service must be an HTTP(S) origin');
|
|
118
|
+
}
|
|
119
|
+
return parsed.origin;
|
|
120
|
+
}
|
|
121
|
+
function hasControlCharacters(value) {
|
|
122
|
+
return [...value].some((character) => {
|
|
123
|
+
const code = character.charCodeAt(0);
|
|
124
|
+
return code <= 0x1f || code === 0x7f;
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=meter-validation-epoch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meter-validation-epoch.js","sourceRoot":"","sources":["../../src/billing/meter-validation-epoch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,CAAC,MAAM,gDAAgD,GAAG,CAAC,CAAC;AAElE,MAAM,YAAY,GAAG,CAAC,KAAa,EAAE,GAAW,EAAE,EAAE,CAClD,CAAC;KACE,MAAM,EAAE;KACR,IAAI,EAAE;KACN,GAAG,CAAC,CAAC,EAAE,GAAG,KAAK,cAAc,CAAC;KAC9B,GAAG,CAAC,GAAG,EAAE,GAAG,KAAK,YAAY,GAAG,sBAAsB,CAAC;KACvD,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,oCAAoC,CAAC,CAAC;AAEnG,MAAM,oBAAoB,GAAG,CAAC,CAAC,YAAY,CAAC;IAC1C,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3B,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;IAC7B,MAAM,EAAE,YAAY,CAAC,QAAQ,EAAE,GAAG,CAAC;IACnC,cAAc,EAAE,YAAY,CAAC,gBAAgB,EAAE,GAAG,CAAC;IACnD,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;CAC3B,CAAC,CAAC;AAEH,MAAM,mBAAmB,GAAG,CAAC,CAAC,YAAY,CAAC;IACzC,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3B,OAAO,EAAE,YAAY,CAAC,SAAS,EAAE,GAAG,CAAC;IAC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AAY,EAAE,MAAM,CAAC,YAAY;YACjC,eAAe,EAAE,MAAM,CAAC,eAAe;SACxC;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,+BAA+B,CAAC,KAAa;IAC3D,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IAC9B,IACE,CAAC,MAAM,CAAC,QAAQ,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,KAAK,OAAO,CAAC;QAC7D,MAAM,CAAC,QAAQ,KAAK,EAAE;QACtB,MAAM,CAAC,QAAQ,KAAK,EAAE;QACtB,MAAM,CAAC,QAAQ,KAAK,GAAG;QACvB,MAAM,CAAC,MAAM,KAAK,EAAE;QACpB,MAAM,CAAC,IAAI,KAAK,EAAE,EAClB,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC;AACvB,CAAC;AAED,SAAS,oBAAoB,CAAC,KAAa;IACzC,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE;QACnC,MAAM,IAAI,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACrC,OAAO,IAAI,IAAI,IAAI,IAAI,IAAI,KAAK,IAAI,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/node_modules/@noodle-borg/service/dist/billing/postgres-enforcement-profile-schema.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Pool } from 'pg';
|
|
2
|
+
/** Additive classification-only schema. Creating these tables never seals or profiles an account. */
|
|
3
|
+
export declare function ensureBillingEnforcementProfileSchema(pool: Pool): Promise<void>;
|
|
4
|
+
//# sourceMappingURL=postgres-enforcement-profile-schema.d.ts.map
|
package/node_modules/@noodle-borg/service/dist/billing/postgres-enforcement-profile-schema.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-enforcement-profile-schema.d.ts","sourceRoot":"","sources":["../../src/billing/postgres-enforcement-profile-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAE/B,qGAAqG;AACrG,wBAAsB,qCAAqC,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAwGrF"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/** Additive classification-only schema. Creating these tables never seals or profiles an account. */
|
|
2
|
+
export async function ensureBillingEnforcementProfileSchema(pool) {
|
|
3
|
+
await pool.query(`
|
|
4
|
+
CREATE TABLE IF NOT EXISTS billing_enforcement_cohort_seals (
|
|
5
|
+
id text PRIMARY KEY,
|
|
6
|
+
singleton boolean NOT NULL DEFAULT true UNIQUE CHECK (singleton),
|
|
7
|
+
schema_version integer NOT NULL CHECK (schema_version = 1),
|
|
8
|
+
cohort_kind text NOT NULL UNIQUE CHECK (cohort_kind = 'legacy_internal_v1'),
|
|
9
|
+
state text NOT NULL CHECK (state = 'sealed'),
|
|
10
|
+
legacy_account_profile text NOT NULL CHECK (legacy_account_profile = 'legacy_internal_exempt'),
|
|
11
|
+
post_seal_account_profile text NOT NULL CHECK (post_seal_account_profile = 'enforced'),
|
|
12
|
+
sealed_at timestamptz NOT NULL,
|
|
13
|
+
sealed_by_subject text NOT NULL,
|
|
14
|
+
sealed_by_email text NOT NULL,
|
|
15
|
+
service_origin text NOT NULL,
|
|
16
|
+
reason text NOT NULL
|
|
17
|
+
)
|
|
18
|
+
`);
|
|
19
|
+
await pool.query(`
|
|
20
|
+
CREATE TABLE IF NOT EXISTS billing_account_enforcement_profiles (
|
|
21
|
+
billing_account_id text NOT NULL REFERENCES billing_accounts(id) ON DELETE RESTRICT,
|
|
22
|
+
version integer NOT NULL CHECK (version > 0),
|
|
23
|
+
schema_version integer NOT NULL CHECK (schema_version = 1),
|
|
24
|
+
mode text NOT NULL CHECK (mode IN ('legacy_internal_exempt', 'enforced')),
|
|
25
|
+
cohort_kind text NOT NULL CHECK (cohort_kind = 'legacy_internal_v1'),
|
|
26
|
+
cohort_seal_id text NOT NULL REFERENCES billing_enforcement_cohort_seals(id) ON DELETE RESTRICT,
|
|
27
|
+
source text NOT NULL CHECK (source IN ('legacy_cohort_seal', 'post_seal_account')),
|
|
28
|
+
effective_from timestamptz NOT NULL,
|
|
29
|
+
created_at timestamptz NOT NULL,
|
|
30
|
+
PRIMARY KEY (billing_account_id, version),
|
|
31
|
+
CHECK (
|
|
32
|
+
(mode = 'legacy_internal_exempt' AND source = 'legacy_cohort_seal') OR
|
|
33
|
+
(mode = 'enforced' AND source = 'post_seal_account')
|
|
34
|
+
)
|
|
35
|
+
)
|
|
36
|
+
`);
|
|
37
|
+
await pool.query(`
|
|
38
|
+
CREATE TABLE IF NOT EXISTS billing_account_active_enforcement_profiles (
|
|
39
|
+
billing_account_id text PRIMARY KEY REFERENCES billing_accounts(id) ON DELETE RESTRICT,
|
|
40
|
+
profile_version integer NOT NULL CHECK (profile_version > 0),
|
|
41
|
+
FOREIGN KEY (billing_account_id, profile_version)
|
|
42
|
+
REFERENCES billing_account_enforcement_profiles(billing_account_id, version)
|
|
43
|
+
ON DELETE RESTRICT
|
|
44
|
+
)
|
|
45
|
+
`);
|
|
46
|
+
await pool.query(`
|
|
47
|
+
CREATE TABLE IF NOT EXISTS billing_enforcement_cohort_operations (
|
|
48
|
+
operation_id text PRIMARY KEY,
|
|
49
|
+
action text NOT NULL CHECK (action = 'seal'),
|
|
50
|
+
idempotency_key_hash text NOT NULL UNIQUE CHECK (idempotency_key_hash ~ '^[0-9a-f]{64}$'),
|
|
51
|
+
request_fingerprint text NOT NULL CHECK (request_fingerprint ~ '^[0-9a-f]{64}$'),
|
|
52
|
+
cohort_seal_id text NOT NULL REFERENCES billing_enforcement_cohort_seals(id) ON DELETE RESTRICT,
|
|
53
|
+
result jsonb NOT NULL,
|
|
54
|
+
actor_subject text NOT NULL,
|
|
55
|
+
actor_email text NOT NULL,
|
|
56
|
+
service_origin text NOT NULL,
|
|
57
|
+
reason text NOT NULL,
|
|
58
|
+
created_at timestamptz NOT NULL
|
|
59
|
+
)
|
|
60
|
+
`);
|
|
61
|
+
await pool.query(`
|
|
62
|
+
CREATE OR REPLACE FUNCTION assign_post_seal_billing_enforcement_profile()
|
|
63
|
+
RETURNS trigger LANGUAGE plpgsql AS $$
|
|
64
|
+
DECLARE
|
|
65
|
+
seal_id text;
|
|
66
|
+
profile_time timestamptz;
|
|
67
|
+
BEGIN
|
|
68
|
+
SELECT id INTO seal_id
|
|
69
|
+
FROM billing_enforcement_cohort_seals
|
|
70
|
+
WHERE singleton = true;
|
|
71
|
+
IF seal_id IS NULL THEN
|
|
72
|
+
RETURN NEW;
|
|
73
|
+
END IF;
|
|
74
|
+
|
|
75
|
+
profile_time := billing_meter_transaction_time();
|
|
76
|
+
INSERT INTO billing_account_enforcement_profiles
|
|
77
|
+
(billing_account_id, version, schema_version, mode, cohort_kind, cohort_seal_id,
|
|
78
|
+
source, effective_from, created_at)
|
|
79
|
+
VALUES
|
|
80
|
+
(NEW.id, 1, 1, 'enforced', 'legacy_internal_v1', seal_id,
|
|
81
|
+
'post_seal_account', profile_time, profile_time);
|
|
82
|
+
INSERT INTO billing_account_active_enforcement_profiles
|
|
83
|
+
(billing_account_id, profile_version)
|
|
84
|
+
VALUES (NEW.id, 1);
|
|
85
|
+
RETURN NEW;
|
|
86
|
+
END
|
|
87
|
+
$$
|
|
88
|
+
`);
|
|
89
|
+
await pool.query(`
|
|
90
|
+
DO $billing_enforcement_account_trigger$
|
|
91
|
+
BEGIN
|
|
92
|
+
IF NOT EXISTS (
|
|
93
|
+
SELECT 1
|
|
94
|
+
FROM pg_trigger
|
|
95
|
+
WHERE tgname = 'billing_accounts_assign_post_seal_enforcement_profile'
|
|
96
|
+
AND tgrelid = 'billing_accounts'::regclass
|
|
97
|
+
AND NOT tgisinternal
|
|
98
|
+
) THEN
|
|
99
|
+
CREATE TRIGGER billing_accounts_assign_post_seal_enforcement_profile
|
|
100
|
+
AFTER INSERT ON billing_accounts
|
|
101
|
+
FOR EACH ROW EXECUTE FUNCTION assign_post_seal_billing_enforcement_profile();
|
|
102
|
+
END IF;
|
|
103
|
+
END
|
|
104
|
+
$billing_enforcement_account_trigger$
|
|
105
|
+
`);
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=postgres-enforcement-profile-schema.js.map
|
package/node_modules/@noodle-borg/service/dist/billing/postgres-enforcement-profile-schema.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-enforcement-profile-schema.js","sourceRoot":"","sources":["../../src/billing/postgres-enforcement-profile-schema.ts"],"names":[],"mappings":"AAEA,qGAAqG;AACrG,MAAM,CAAC,KAAK,UAAU,qCAAqC,CAAC,IAAU;IACpE,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;GAehB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;;GAiBhB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;;GAQhB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;;;;;;;;GAchB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BhB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;GAgBhB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Pool, PoolClient } from 'pg';
|
|
2
|
+
import type { ControlPlaneIdentity } from '../auth/deploy-gate.js';
|
|
3
|
+
import { type BillingAccountEnforcementProfileRecord, type BillingEnforcementCohortSealRequest, type BillingEnforcementCohortSealResponse, type BillingEnforcementCohortStatusResponse } from './enforcement-profile.js';
|
|
4
|
+
export declare const BILLING_ENFORCEMENT_COHORT_LIFECYCLE_LOCK_KEY = "billing-enforcement-cohort-seal:legacy-internal-v1";
|
|
5
|
+
export declare function getEnforcementCohortStatusRow(pool: Pool): Promise<BillingEnforcementCohortStatusResponse>;
|
|
6
|
+
export declare function getActiveBillingAccountEnforcementProfileRow(pool: Pool, billingAccountId: string): Promise<BillingAccountEnforcementProfileRecord | undefined>;
|
|
7
|
+
export declare function sealEnforcementCohortRow(pool: Pool, input: {
|
|
8
|
+
readonly request: BillingEnforcementCohortSealRequest;
|
|
9
|
+
readonly actor: ControlPlaneIdentity;
|
|
10
|
+
readonly service: string;
|
|
11
|
+
}): Promise<BillingEnforcementCohortSealResponse>;
|
|
12
|
+
/**
|
|
13
|
+
* Application-side defense in depth after account insertion. The database trigger normally creates the
|
|
14
|
+
* profile first; the active-profile lookup keeps this helper idempotent with that trigger-created state.
|
|
15
|
+
*/
|
|
16
|
+
export declare function ensurePostSealBillingAccountEnforcementProfileTx(client: PoolClient, billingAccountId: string): Promise<BillingAccountEnforcementProfileRecord | undefined>;
|
|
17
|
+
export declare function requireBillingAccountEnforcementProfileIfSealedTx(client: PoolClient, billingAccountId: string): Promise<void>;
|
|
18
|
+
//# sourceMappingURL=postgres-enforcement-profile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-enforcement-profile.d.ts","sourceRoot":"","sources":["../../src/billing/postgres-enforcement-profile.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,IAAI,CAAC;AAC3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAEL,KAAK,sCAAsC,EAE3C,KAAK,mCAAmC,EACxC,KAAK,oCAAoC,EAEzC,KAAK,sCAAsC,EAM5C,MAAM,0BAA0B,CAAC;AAKlC,eAAO,MAAM,6CAA6C,uDACJ,CAAC;AA6BvD,wBAAsB,6BAA6B,CACjD,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,sCAAsC,CAAC,CAajD;AAED,wBAAgB,4CAA4C,CAC1D,IAAI,EAAE,IAAI,EACV,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,sCAAsC,GAAG,SAAS,CAAC,CAK7D;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,IAAI,EACV,KAAK,EAAE;IACL,QAAQ,CAAC,OAAO,EAAE,mCAAmC,CAAC;IACtD,QAAQ,CAAC,KAAK,EAAE,oBAAoB,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,GACA,OAAO,CAAC,oCAAoC,CAAC,CA4H/C;AAED;;;GAGG;AACH,wBAAsB,gDAAgD,CACpE,MAAM,EAAE,UAAU,EAClB,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,sCAAsC,GAAG,SAAS,CAAC,CAsB7D;AAED,wBAAsB,iDAAiD,CACrE,MAAM,EAAE,UAAU,EAClB,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC,CAOf"}
|