@noodleseed/one 0.46.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/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/node_modules/@noodle-borg/agent-kit/dist/generated/example-files.js +2 -2
- 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.js +2 -2
- 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/server.d.ts +5 -0
- package/node_modules/@noodle-borg/authoring/dist/server.d.ts.map +1 -1
- package/node_modules/@noodle-borg/authoring/dist/server.js +1 -0
- package/node_modules/@noodle-borg/authoring/dist/server.js.map +1 -1
- package/node_modules/@noodle-borg/compiler/dist/artifact/types.d.ts +7 -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 +4 -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 +3 -0
- package/node_modules/@noodle-borg/compiler/dist/compile.js.map +1 -1
- package/node_modules/@noodle-borg/compiler/dist/manifest/schema.d.ts +12 -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 +7 -0
- package/node_modules/@noodle-borg/compiler/dist/manifest/schema.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/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/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/package.json +1 -1
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { createBillingUsageIdentityDeriver, } from './usage-identity.js';
|
|
2
|
+
const DEFAULT_MAX_WAIT_MS = 250;
|
|
3
|
+
// Production's smallest pool has five connections: reserve one for scheduler work and one generally.
|
|
4
|
+
const DEFAULT_MAX_CONCURRENT_WRITES = 3;
|
|
5
|
+
const DEFAULT_FAILURE_COOLDOWN_MS = 5_000;
|
|
6
|
+
const DEFAULT_SHUTDOWN_DRAIN_MS = 5_000;
|
|
7
|
+
/**
|
|
8
|
+
* Mirror the final hosted tool-dispatch boundary into v1 shadow and the prepared v2 validation epoch.
|
|
9
|
+
* Both sinks are observational: every local, timeout, saturation, or database outcome still allows the
|
|
10
|
+
* connector exactly as before.
|
|
11
|
+
*/
|
|
12
|
+
export function createBillingMeterValidationMirror(options) {
|
|
13
|
+
const deriveIdentity = createBillingUsageIdentityDeriver(options.hmacKey);
|
|
14
|
+
const maxWaitMs = boundedInteger('billing validation mirror max wait', options.maxWaitMs ?? DEFAULT_MAX_WAIT_MS, 1, 5_000);
|
|
15
|
+
const maxConcurrentWrites = boundedInteger('billing validation mirror concurrency', options.maxConcurrentWrites ?? DEFAULT_MAX_CONCURRENT_WRITES, 1, 1_024);
|
|
16
|
+
const failureCooldownMs = boundedInteger('billing validation mirror failure cooldown', options.failureCooldownMs ?? DEFAULT_FAILURE_COOLDOWN_MS, 0, 60_000);
|
|
17
|
+
const shutdownDrainMs = boundedInteger('billing validation mirror shutdown drain', options.shutdownDrainMs ?? DEFAULT_SHUTDOWN_DRAIN_MS, 1, 30_000);
|
|
18
|
+
const counters = mutableCounters(options.writer.session);
|
|
19
|
+
const pendingValidations = new Set();
|
|
20
|
+
let circuitOpenUntil = 0;
|
|
21
|
+
let closing = false;
|
|
22
|
+
let validationFenced = false;
|
|
23
|
+
const snapshot = () => ({ ...counters });
|
|
24
|
+
const observe = async (context) => {
|
|
25
|
+
if (closing)
|
|
26
|
+
return;
|
|
27
|
+
if (context.signal.aborted)
|
|
28
|
+
return;
|
|
29
|
+
let identity;
|
|
30
|
+
try {
|
|
31
|
+
identity = deriveIdentity(context);
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
if (!validationFenced) {
|
|
35
|
+
mutate(counters, () => {
|
|
36
|
+
counters.observedCalls += 1;
|
|
37
|
+
counters.derivationFailures += 1;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
warn(options.logger, context, 'identity_derivation_failed');
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const waits = [];
|
|
44
|
+
if (options.shadowSink !== undefined) {
|
|
45
|
+
waits.push(invokeShadow(options.shadowSink, context, identity).catch(() => {
|
|
46
|
+
warn(options.logger, context, 'shadow_sink_failed');
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
if (validationFenced) {
|
|
50
|
+
await settleWithin(waits, maxWaitMs);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
mutate(counters, () => {
|
|
54
|
+
counters.observedCalls += 1;
|
|
55
|
+
});
|
|
56
|
+
let validation;
|
|
57
|
+
if (Date.now() < circuitOpenUntil) {
|
|
58
|
+
mutate(counters, () => {
|
|
59
|
+
counters.circuitOpenSkips += 1;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
else if (counters.inFlightWrites >= maxConcurrentWrites) {
|
|
63
|
+
mutate(counters, () => {
|
|
64
|
+
counters.saturationSkips += 1;
|
|
65
|
+
});
|
|
66
|
+
warn(options.logger, context, 'bulkhead_saturated');
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
mutate(counters, () => {
|
|
70
|
+
counters.attemptedWrites += 1;
|
|
71
|
+
counters.inFlightWrites += 1;
|
|
72
|
+
});
|
|
73
|
+
validation = startValidationWrite(options.writer, context, identity, (outcome) => {
|
|
74
|
+
mutate(counters, () => {
|
|
75
|
+
counters.inFlightWrites -= 1;
|
|
76
|
+
if (outcome === 'recorded')
|
|
77
|
+
counters.recordedWrites += 1;
|
|
78
|
+
else if (outcome === 'duplicate')
|
|
79
|
+
counters.duplicateWrites += 1;
|
|
80
|
+
else if (outcome === 'no_prepared_epoch')
|
|
81
|
+
counters.noEpochSkips += 1;
|
|
82
|
+
else if (outcome === 'identity_mismatch')
|
|
83
|
+
counters.epochIdentityFailures += 1;
|
|
84
|
+
else
|
|
85
|
+
counters.finalFailures += 1;
|
|
86
|
+
});
|
|
87
|
+
if (outcome === 'failed' || outcome === 'identity_mismatch') {
|
|
88
|
+
circuitOpenUntil = Date.now() + failureCooldownMs;
|
|
89
|
+
}
|
|
90
|
+
if (outcome === 'failed')
|
|
91
|
+
warn(options.logger, context, 'validation_write_failed');
|
|
92
|
+
});
|
|
93
|
+
trackPendingValidation(pendingValidations, validation.settled);
|
|
94
|
+
waits.push(validation.settled);
|
|
95
|
+
}
|
|
96
|
+
const completed = await settleWithin(waits, maxWaitMs);
|
|
97
|
+
if (!completed && validation !== undefined && !validation.isSettled()) {
|
|
98
|
+
mutate(counters, () => {
|
|
99
|
+
counters.timeoutUnknownOutcomes += 1;
|
|
100
|
+
});
|
|
101
|
+
circuitOpenUntil = Date.now() + failureCooldownMs;
|
|
102
|
+
warn(options.logger, context, 'validation_write_timed_out');
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const reportHealth = async () => {
|
|
106
|
+
const directive = await options.writer.reportHealth(snapshot());
|
|
107
|
+
if (directive === undefined) {
|
|
108
|
+
// A previous arm may have committed even when its acknowledgement was lost. A later durable
|
|
109
|
+
// report with no arm directive is the writer's confirmation that validation may resume.
|
|
110
|
+
validationFenced = false;
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
validationFenced = true;
|
|
114
|
+
const drained = await settleWithin([...pendingValidations], shutdownDrainMs);
|
|
115
|
+
if (!drained) {
|
|
116
|
+
throw new Error('billing meter epoch arm has unresolved validation writes');
|
|
117
|
+
}
|
|
118
|
+
if (options.writer.armEpoch === undefined) {
|
|
119
|
+
throw new Error('billing meter writer cannot arm a prepared epoch');
|
|
120
|
+
}
|
|
121
|
+
await options.writer.armEpoch(directive.armEpochId, snapshot());
|
|
122
|
+
validationFenced = false;
|
|
123
|
+
};
|
|
124
|
+
return {
|
|
125
|
+
observe,
|
|
126
|
+
snapshot,
|
|
127
|
+
reportHealth,
|
|
128
|
+
close: async () => {
|
|
129
|
+
closing = true;
|
|
130
|
+
validationFenced = true;
|
|
131
|
+
const drained = await settleWithin([...pendingValidations], shutdownDrainMs);
|
|
132
|
+
if (!drained) {
|
|
133
|
+
await settleWithin([
|
|
134
|
+
options.writer.reportHealth(snapshot()).then(() => undefined, () => undefined),
|
|
135
|
+
], maxWaitMs);
|
|
136
|
+
throw new Error('billing meter shutdown has unresolved validation writes');
|
|
137
|
+
}
|
|
138
|
+
await options.writer.close(snapshot());
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function trackPendingValidation(pending, operation) {
|
|
143
|
+
pending.add(operation);
|
|
144
|
+
void operation.finally(() => pending.delete(operation));
|
|
145
|
+
}
|
|
146
|
+
function startValidationWrite(writer, context, identity, onSettled) {
|
|
147
|
+
let done = false;
|
|
148
|
+
let operation;
|
|
149
|
+
try {
|
|
150
|
+
operation = writer.record({
|
|
151
|
+
classification: 'included',
|
|
152
|
+
org: context.org,
|
|
153
|
+
app: context.app,
|
|
154
|
+
environment: context.environment,
|
|
155
|
+
deploymentId: context.deploymentId,
|
|
156
|
+
identity,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
operation = Promise.reject(new Error('billing validation writer failed synchronously'));
|
|
161
|
+
}
|
|
162
|
+
const settled = operation.then((result) => {
|
|
163
|
+
done = true;
|
|
164
|
+
onSettled(result.outcome);
|
|
165
|
+
}, () => {
|
|
166
|
+
done = true;
|
|
167
|
+
onSettled('failed');
|
|
168
|
+
});
|
|
169
|
+
return { settled, isSettled: () => done };
|
|
170
|
+
}
|
|
171
|
+
async function invokeShadow(sink, context, identity) {
|
|
172
|
+
await sink(context, identity);
|
|
173
|
+
}
|
|
174
|
+
async function settleWithin(waits, timeoutMs) {
|
|
175
|
+
if (waits.length === 0)
|
|
176
|
+
return true;
|
|
177
|
+
let timer;
|
|
178
|
+
try {
|
|
179
|
+
return await Promise.race([
|
|
180
|
+
Promise.allSettled(waits).then(() => true),
|
|
181
|
+
new Promise((resolve) => {
|
|
182
|
+
timer = setTimeout(() => resolve(false), timeoutMs);
|
|
183
|
+
}),
|
|
184
|
+
]);
|
|
185
|
+
}
|
|
186
|
+
finally {
|
|
187
|
+
if (timer !== undefined)
|
|
188
|
+
clearTimeout(timer);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function mutableCounters(session) {
|
|
192
|
+
return {
|
|
193
|
+
...session,
|
|
194
|
+
reportVersion: 0,
|
|
195
|
+
observedCalls: 0,
|
|
196
|
+
attemptedWrites: 0,
|
|
197
|
+
recordedWrites: 0,
|
|
198
|
+
duplicateWrites: 0,
|
|
199
|
+
finalFailures: 0,
|
|
200
|
+
noEpochSkips: 0,
|
|
201
|
+
circuitOpenSkips: 0,
|
|
202
|
+
saturationSkips: 0,
|
|
203
|
+
derivationFailures: 0,
|
|
204
|
+
epochIdentityFailures: 0,
|
|
205
|
+
timeoutUnknownOutcomes: 0,
|
|
206
|
+
inFlightWrites: 0,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
function mutate(counters, operation) {
|
|
210
|
+
operation();
|
|
211
|
+
counters.reportVersion += 1;
|
|
212
|
+
}
|
|
213
|
+
function warn(logger, context, failure) {
|
|
214
|
+
try {
|
|
215
|
+
logger.warn('billing.meter.validation_mirror_failed', {
|
|
216
|
+
org: context.org,
|
|
217
|
+
app: context.app,
|
|
218
|
+
env: context.environment,
|
|
219
|
+
deploymentId: context.deploymentId,
|
|
220
|
+
failure,
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
catch {
|
|
224
|
+
// Validation diagnostics must never become an admission dependency.
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
function boundedInteger(name, value, minimum, maximum) {
|
|
228
|
+
if (!Number.isSafeInteger(value) || value < minimum || value > maximum) {
|
|
229
|
+
throw new Error(`${name} must be between ${minimum} and ${maximum}`);
|
|
230
|
+
}
|
|
231
|
+
return value;
|
|
232
|
+
}
|
|
233
|
+
//# sourceMappingURL=meter-live-validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meter-live-validation.js","sourceRoot":"","sources":["../../src/billing/meter-live-validation.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,iCAAiC,GAClC,MAAM,qBAAqB,CAAC;AA+E7B,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAChC,qGAAqG;AACrG,MAAM,6BAA6B,GAAG,CAAC,CAAC;AACxC,MAAM,2BAA2B,GAAG,KAAK,CAAC;AAC1C,MAAM,yBAAyB,GAAG,KAAK,CAAC;AAExC;;;;GAIG;AACH,MAAM,UAAU,kCAAkC,CAChD,OAA4C;IAE5C,MAAM,cAAc,GAAG,iCAAiC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1E,MAAM,SAAS,GAAG,cAAc,CAC9B,oCAAoC,EACpC,OAAO,CAAC,SAAS,IAAI,mBAAmB,EACxC,CAAC,EACD,KAAK,CACN,CAAC;IACF,MAAM,mBAAmB,GAAG,cAAc,CACxC,uCAAuC,EACvC,OAAO,CAAC,mBAAmB,IAAI,6BAA6B,EAC5D,CAAC,EACD,KAAK,CACN,CAAC;IACF,MAAM,iBAAiB,GAAG,cAAc,CACtC,4CAA4C,EAC5C,OAAO,CAAC,iBAAiB,IAAI,2BAA2B,EACxD,CAAC,EACD,MAAM,CACP,CAAC;IACF,MAAM,eAAe,GAAG,cAAc,CACpC,0CAA0C,EAC1C,OAAO,CAAC,eAAe,IAAI,yBAAyB,EACpD,CAAC,EACD,MAAM,CACP,CAAC;IACF,MAAM,QAAQ,GAAG,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACzD,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAiB,CAAC;IACpD,IAAI,gBAAgB,GAAG,CAAC,CAAC;IACzB,IAAI,OAAO,GAAG,KAAK,CAAC;IACp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ACP,oEAAoE;IACtE,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CAAC,IAAY,EAAE,KAAa,EAAE,OAAe,EAAE,OAAe;IACnF,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,OAAO,IAAI,KAAK,GAAG,OAAO,EAAE,CAAC;QACvE,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,oBAAoB,OAAO,QAAQ,OAAO,EAAE,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { BillingMeterReadinessCheckState } from './meter-readiness.js';
|
|
2
|
+
export declare const BILLING_METER_WRITER_HEARTBEAT_INTERVAL_MS = 30000;
|
|
3
|
+
export declare const BILLING_METER_WRITER_FRESHNESS_MS: number;
|
|
4
|
+
export declare const BILLING_METER_SCHEDULER_FRESHNESS_MS: number;
|
|
5
|
+
export interface BillingMeterHealthSignal {
|
|
6
|
+
readonly state: BillingMeterReadinessCheckState;
|
|
7
|
+
readonly checkedAt: string;
|
|
8
|
+
}
|
|
9
|
+
export interface BillingMeterPreparedEpochHealthIdentity {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly preparedAt: string;
|
|
12
|
+
readonly releaseSha: string;
|
|
13
|
+
readonly keyGeneration: string;
|
|
14
|
+
readonly retryIdentityVersion: number;
|
|
15
|
+
readonly writerContractVersion: number;
|
|
16
|
+
}
|
|
17
|
+
export interface BillingMeterLiveRuntimeExpectation {
|
|
18
|
+
readonly releaseSha: string;
|
|
19
|
+
readonly keyGeneration: string;
|
|
20
|
+
readonly retryIdentityVersion: number;
|
|
21
|
+
readonly writerContractVersion: number;
|
|
22
|
+
readonly schedulerContractVersion: number;
|
|
23
|
+
readonly writerFreshnessMs?: number;
|
|
24
|
+
readonly schedulerFreshnessMs?: number;
|
|
25
|
+
}
|
|
26
|
+
export interface BillingMeterHealthCounters {
|
|
27
|
+
readonly observedCalls: bigint;
|
|
28
|
+
readonly attemptedWrites: bigint;
|
|
29
|
+
readonly recordedWrites: bigint;
|
|
30
|
+
readonly duplicateWrites: bigint;
|
|
31
|
+
readonly finalFailures: bigint;
|
|
32
|
+
readonly noEpochSkips: bigint;
|
|
33
|
+
readonly circuitOpenSkips: bigint;
|
|
34
|
+
readonly saturationSkips: bigint;
|
|
35
|
+
readonly derivationFailures: bigint;
|
|
36
|
+
readonly epochIdentityFailures: bigint;
|
|
37
|
+
readonly timeoutUnknownOutcomes: bigint;
|
|
38
|
+
readonly inFlightWrites: bigint;
|
|
39
|
+
}
|
|
40
|
+
export interface BillingMeterWriterSessionHealthEvidence {
|
|
41
|
+
readonly sessionId: string;
|
|
42
|
+
readonly releaseSha: string;
|
|
43
|
+
readonly keyGeneration: string;
|
|
44
|
+
readonly retryIdentityVersion: number;
|
|
45
|
+
readonly writerContractVersion: number;
|
|
46
|
+
readonly lastHeartbeatAt: string;
|
|
47
|
+
readonly closedAt: string | null;
|
|
48
|
+
readonly cleanStop: boolean;
|
|
49
|
+
readonly baselineArmedAt: string | null;
|
|
50
|
+
readonly baselineReportVersion: bigint;
|
|
51
|
+
readonly reportVersion: bigint;
|
|
52
|
+
readonly baseline: BillingMeterHealthCounters;
|
|
53
|
+
readonly current: BillingMeterHealthCounters;
|
|
54
|
+
}
|
|
55
|
+
export interface BillingMeterSchedulerCompletedEvidence {
|
|
56
|
+
readonly status: 'succeeded' | 'failed' | 'backlogged';
|
|
57
|
+
readonly releaseSha: string;
|
|
58
|
+
readonly contractVersion: number;
|
|
59
|
+
readonly cpuAlwaysAllocated: boolean;
|
|
60
|
+
readonly startedAt: string;
|
|
61
|
+
readonly completedAt: string;
|
|
62
|
+
readonly windowsFailed: number;
|
|
63
|
+
readonly backlogDetected: boolean;
|
|
64
|
+
readonly maintenanceRunId: string | null;
|
|
65
|
+
}
|
|
66
|
+
export declare function emptyBillingMeterHealthCounters(): BillingMeterHealthCounters;
|
|
67
|
+
export declare function evaluateBillingMeterValidationMirror(input: {
|
|
68
|
+
readonly checkedAt: string;
|
|
69
|
+
readonly epoch: BillingMeterPreparedEpochHealthIdentity;
|
|
70
|
+
readonly expectation: BillingMeterLiveRuntimeExpectation;
|
|
71
|
+
readonly latestReceiptAt: string | null;
|
|
72
|
+
}): BillingMeterHealthSignal;
|
|
73
|
+
export declare function evaluateBillingMeterWriterHealth(input: {
|
|
74
|
+
readonly checkedAt: string;
|
|
75
|
+
readonly epoch: BillingMeterPreparedEpochHealthIdentity;
|
|
76
|
+
readonly expectation: BillingMeterLiveRuntimeExpectation;
|
|
77
|
+
readonly unbaselinedSessionCount: number;
|
|
78
|
+
readonly rollup: BillingMeterHealthCounters;
|
|
79
|
+
readonly uncleanRollupStops: bigint;
|
|
80
|
+
readonly sessions: readonly BillingMeterWriterSessionHealthEvidence[];
|
|
81
|
+
}): BillingMeterHealthSignal;
|
|
82
|
+
export declare function evaluateBillingMeterSchedulerHealth(input: {
|
|
83
|
+
readonly checkedAt: string;
|
|
84
|
+
readonly epoch: BillingMeterPreparedEpochHealthIdentity;
|
|
85
|
+
readonly expectation: BillingMeterLiveRuntimeExpectation;
|
|
86
|
+
readonly staleRunningCount: number;
|
|
87
|
+
readonly latestCompleted?: BillingMeterSchedulerCompletedEvidence;
|
|
88
|
+
}): BillingMeterHealthSignal;
|
|
89
|
+
//# sourceMappingURL=meter-readiness-health.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meter-readiness-health.d.ts","sourceRoot":"","sources":["../../src/billing/meter-readiness-health.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,sBAAsB,CAAC;AAE5E,eAAO,MAAM,0CAA0C,QAAS,CAAC;AACjE,eAAO,MAAM,iCAAiC,QAAa,CAAC;AAC5D,eAAO,MAAM,oCAAoC,QAAc,CAAC;AAEhE,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,KAAK,EAAE,+BAA+B,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KAAK,EAAE;IAC1D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,uCAAuC,CAAC;IACxD,QAAQ,CAAC,WAAW,EAAE,kCAAkC,CAAC;IACzD,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CACzC,GAAG,wBAAwB,CAc3B;AAED,wBAAgB,gCAAgC,CAAC,KAAK,EAAE;IACtD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,uCAAuC,CAAC;IACxD,QAAQ,CAAC,WAAW,EAAE,kCAAkC,CAAC;IACzD,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC;IACzC,QAAQ,CAAC,MAAM,EAAE,0BAA0B,CAAC;IAC5C,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,SAAS,uCAAuC,EAAE,CAAC;CACvE,GAAG,wBAAwB,CAyD3B;AAED,wBAAgB,mCAAmC,CAAC,KAAK,EAAE;IACzD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,uCAAuC,CAAC;IACxD,QAAQ,CAAC,WAAW,EAAE,kCAAkC,CAAC;IACzD,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,eAAe,CAAC,EAAE,sCAAsC,CAAC;CACnE,GAAG,wBAAwB,CAoC3B"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
export const BILLING_METER_WRITER_HEARTBEAT_INTERVAL_MS = 30_000;
|
|
2
|
+
export const BILLING_METER_WRITER_FRESHNESS_MS = 2 * 60_000;
|
|
3
|
+
export const BILLING_METER_SCHEDULER_FRESHNESS_MS = 15 * 60_000;
|
|
4
|
+
export function emptyBillingMeterHealthCounters() {
|
|
5
|
+
return {
|
|
6
|
+
observedCalls: 0n,
|
|
7
|
+
attemptedWrites: 0n,
|
|
8
|
+
recordedWrites: 0n,
|
|
9
|
+
duplicateWrites: 0n,
|
|
10
|
+
finalFailures: 0n,
|
|
11
|
+
noEpochSkips: 0n,
|
|
12
|
+
circuitOpenSkips: 0n,
|
|
13
|
+
saturationSkips: 0n,
|
|
14
|
+
derivationFailures: 0n,
|
|
15
|
+
epochIdentityFailures: 0n,
|
|
16
|
+
timeoutUnknownOutcomes: 0n,
|
|
17
|
+
inFlightWrites: 0n,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export function evaluateBillingMeterValidationMirror(input) {
|
|
21
|
+
const checkedAt = validInstant(input.checkedAt);
|
|
22
|
+
if (!identityMatches(input.epoch, input.expectation)) {
|
|
23
|
+
return { state: 'fail', checkedAt };
|
|
24
|
+
}
|
|
25
|
+
if (input.latestReceiptAt === null)
|
|
26
|
+
return { state: 'unknown', checkedAt };
|
|
27
|
+
const receiptAt = validInstant(input.latestReceiptAt);
|
|
28
|
+
if (Date.parse(receiptAt) < Date.parse(validInstant(input.epoch.preparedAt)) ||
|
|
29
|
+
Date.parse(receiptAt) > Date.parse(checkedAt)) {
|
|
30
|
+
return { state: 'fail', checkedAt: receiptAt };
|
|
31
|
+
}
|
|
32
|
+
return { state: 'pass', checkedAt: receiptAt };
|
|
33
|
+
}
|
|
34
|
+
export function evaluateBillingMeterWriterHealth(input) {
|
|
35
|
+
const checkedAt = validInstant(input.checkedAt);
|
|
36
|
+
if (!identityMatches(input.epoch, input.expectation) ||
|
|
37
|
+
!Number.isSafeInteger(input.unbaselinedSessionCount) ||
|
|
38
|
+
input.unbaselinedSessionCount > 0 ||
|
|
39
|
+
input.uncleanRollupStops > 0n) {
|
|
40
|
+
return { state: 'fail', checkedAt };
|
|
41
|
+
}
|
|
42
|
+
const freshnessMs = positiveDuration(input.expectation.writerFreshnessMs ?? BILLING_METER_WRITER_FRESHNESS_MS);
|
|
43
|
+
let aggregate = input.rollup;
|
|
44
|
+
let oldestHeartbeat = checkedAt;
|
|
45
|
+
let awaitingWriterArm = false;
|
|
46
|
+
for (const session of input.sessions) {
|
|
47
|
+
const heartbeatAt = validInstant(session.lastHeartbeatAt);
|
|
48
|
+
if (Date.parse(heartbeatAt) < Date.parse(oldestHeartbeat))
|
|
49
|
+
oldestHeartbeat = heartbeatAt;
|
|
50
|
+
if (!identityMatches(session, input.expectation)) {
|
|
51
|
+
return { state: 'fail', checkedAt: heartbeatAt };
|
|
52
|
+
}
|
|
53
|
+
if (session.baselineArmedAt === null) {
|
|
54
|
+
if (session.closedAt !== null) {
|
|
55
|
+
return { state: 'fail', checkedAt: validInstant(session.closedAt) };
|
|
56
|
+
}
|
|
57
|
+
awaitingWriterArm = true;
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
validInstant(session.baselineArmedAt);
|
|
61
|
+
if (session.closedAt === null) {
|
|
62
|
+
const age = Date.parse(checkedAt) - Date.parse(heartbeatAt);
|
|
63
|
+
if (age < 0 || age > freshnessMs)
|
|
64
|
+
return { state: 'fail', checkedAt: heartbeatAt };
|
|
65
|
+
}
|
|
66
|
+
else if (!session.cleanStop || session.current.inFlightWrites !== 0n) {
|
|
67
|
+
return { state: 'fail', checkedAt: validInstant(session.closedAt) };
|
|
68
|
+
}
|
|
69
|
+
if (session.reportVersion < session.baselineReportVersion) {
|
|
70
|
+
return { state: 'fail', checkedAt: heartbeatAt };
|
|
71
|
+
}
|
|
72
|
+
const delta = subtractCounters(session.current, session.baseline);
|
|
73
|
+
if (delta === undefined)
|
|
74
|
+
return { state: 'fail', checkedAt: heartbeatAt };
|
|
75
|
+
aggregate = addCounters(aggregate, delta);
|
|
76
|
+
}
|
|
77
|
+
if (awaitingWriterArm)
|
|
78
|
+
return { state: 'unknown', checkedAt: oldestHeartbeat };
|
|
79
|
+
if (!counterEquationsHold(aggregate) || hasPoisonedWriterEvidence(aggregate)) {
|
|
80
|
+
return { state: 'fail', checkedAt: oldestHeartbeat };
|
|
81
|
+
}
|
|
82
|
+
if (aggregate.inFlightWrites !== 0n) {
|
|
83
|
+
return { state: 'unknown', checkedAt: oldestHeartbeat };
|
|
84
|
+
}
|
|
85
|
+
if (aggregate.recordedWrites + aggregate.duplicateWrites === 0n) {
|
|
86
|
+
return { state: 'unknown', checkedAt: oldestHeartbeat };
|
|
87
|
+
}
|
|
88
|
+
return { state: 'pass', checkedAt: oldestHeartbeat };
|
|
89
|
+
}
|
|
90
|
+
export function evaluateBillingMeterSchedulerHealth(input) {
|
|
91
|
+
const checkedAt = validInstant(input.checkedAt);
|
|
92
|
+
if (!identityMatches(input.epoch, input.expectation) ||
|
|
93
|
+
!Number.isSafeInteger(input.staleRunningCount) ||
|
|
94
|
+
input.staleRunningCount < 0 ||
|
|
95
|
+
input.staleRunningCount > 0) {
|
|
96
|
+
return { state: 'fail', checkedAt };
|
|
97
|
+
}
|
|
98
|
+
const run = input.latestCompleted;
|
|
99
|
+
if (run === undefined)
|
|
100
|
+
return { state: 'unknown', checkedAt };
|
|
101
|
+
const completedAt = validInstant(run.completedAt);
|
|
102
|
+
const age = Date.parse(checkedAt) - Date.parse(completedAt);
|
|
103
|
+
const freshnessMs = positiveDuration(input.expectation.schedulerFreshnessMs ?? BILLING_METER_SCHEDULER_FRESHNESS_MS);
|
|
104
|
+
if (age < 0 ||
|
|
105
|
+
age > freshnessMs ||
|
|
106
|
+
Date.parse(completedAt) < Date.parse(input.epoch.preparedAt)) {
|
|
107
|
+
return { state: 'unknown', checkedAt: completedAt };
|
|
108
|
+
}
|
|
109
|
+
if (run.status !== 'succeeded' ||
|
|
110
|
+
run.releaseSha !== input.expectation.releaseSha ||
|
|
111
|
+
run.contractVersion !== input.expectation.schedulerContractVersion ||
|
|
112
|
+
!run.cpuAlwaysAllocated ||
|
|
113
|
+
run.windowsFailed !== 0 ||
|
|
114
|
+
run.backlogDetected ||
|
|
115
|
+
run.maintenanceRunId === null) {
|
|
116
|
+
return { state: 'fail', checkedAt: completedAt };
|
|
117
|
+
}
|
|
118
|
+
return { state: 'pass', checkedAt: completedAt };
|
|
119
|
+
}
|
|
120
|
+
const COUNTER_KEYS = [
|
|
121
|
+
'observedCalls',
|
|
122
|
+
'attemptedWrites',
|
|
123
|
+
'recordedWrites',
|
|
124
|
+
'duplicateWrites',
|
|
125
|
+
'finalFailures',
|
|
126
|
+
'noEpochSkips',
|
|
127
|
+
'circuitOpenSkips',
|
|
128
|
+
'saturationSkips',
|
|
129
|
+
'derivationFailures',
|
|
130
|
+
'epochIdentityFailures',
|
|
131
|
+
'timeoutUnknownOutcomes',
|
|
132
|
+
'inFlightWrites',
|
|
133
|
+
];
|
|
134
|
+
function subtractCounters(current, baseline) {
|
|
135
|
+
const result = {};
|
|
136
|
+
for (const key of COUNTER_KEYS) {
|
|
137
|
+
const delta = current[key] - baseline[key];
|
|
138
|
+
if (delta < 0n)
|
|
139
|
+
return undefined;
|
|
140
|
+
result[key] = delta;
|
|
141
|
+
}
|
|
142
|
+
return result;
|
|
143
|
+
}
|
|
144
|
+
function addCounters(left, right) {
|
|
145
|
+
const result = {};
|
|
146
|
+
for (const key of COUNTER_KEYS)
|
|
147
|
+
result[key] = left[key] + right[key];
|
|
148
|
+
return result;
|
|
149
|
+
}
|
|
150
|
+
function counterEquationsHold(counters) {
|
|
151
|
+
return (counters.observedCalls ===
|
|
152
|
+
counters.attemptedWrites +
|
|
153
|
+
counters.circuitOpenSkips +
|
|
154
|
+
counters.saturationSkips +
|
|
155
|
+
counters.derivationFailures &&
|
|
156
|
+
counters.attemptedWrites ===
|
|
157
|
+
counters.recordedWrites +
|
|
158
|
+
counters.duplicateWrites +
|
|
159
|
+
counters.finalFailures +
|
|
160
|
+
counters.noEpochSkips +
|
|
161
|
+
counters.epochIdentityFailures +
|
|
162
|
+
counters.inFlightWrites);
|
|
163
|
+
}
|
|
164
|
+
function hasPoisonedWriterEvidence(counters) {
|
|
165
|
+
return (counters.finalFailures > 0n ||
|
|
166
|
+
counters.noEpochSkips > 0n ||
|
|
167
|
+
counters.circuitOpenSkips > 0n ||
|
|
168
|
+
counters.saturationSkips > 0n ||
|
|
169
|
+
counters.derivationFailures > 0n ||
|
|
170
|
+
counters.epochIdentityFailures > 0n ||
|
|
171
|
+
counters.timeoutUnknownOutcomes > 0n);
|
|
172
|
+
}
|
|
173
|
+
function identityMatches(identity, expectation) {
|
|
174
|
+
return (identity.releaseSha === expectation.releaseSha &&
|
|
175
|
+
identity.keyGeneration === expectation.keyGeneration &&
|
|
176
|
+
identity.retryIdentityVersion === expectation.retryIdentityVersion &&
|
|
177
|
+
identity.writerContractVersion === expectation.writerContractVersion);
|
|
178
|
+
}
|
|
179
|
+
function positiveDuration(value) {
|
|
180
|
+
if (!Number.isSafeInteger(value) || value < 1) {
|
|
181
|
+
throw new Error('billing meter health freshness must be a positive integer');
|
|
182
|
+
}
|
|
183
|
+
return value;
|
|
184
|
+
}
|
|
185
|
+
function validInstant(value) {
|
|
186
|
+
const instant = new Date(value);
|
|
187
|
+
if (!Number.isFinite(instant.getTime()))
|
|
188
|
+
throw new Error('billing meter health timestamp is invalid');
|
|
189
|
+
return instant.toISOString();
|
|
190
|
+
}
|
|
191
|
+
//# sourceMappingURL=meter-readiness-health.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meter-readiness-health.js","sourceRoot":"","sources":["../../src/billing/meter-readiness-health.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,0CAA0C,GAAG,MAAM,CAAC;AACjE,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,GAAG,MAAM,CAAC;AAC5D,MAAM,CAAC,MAAM,oCAAoC,GAAG,EAAE,GAAG,MAAM,CAAC;AAqEhE,MAAM,UAAU,+BAA+B;IAC7C,OAAO;QACL,aAAa,EAAE,EAAE;QACjB,eAAe,EAAE,EAAE;QACnB,cAAc,EAAE,EAAE;QAClB,eAAe,EAAE,EAAE;QACnB,aAAa,EAAE,EAAE;QACjB,YAAY,EAAE,EAAE;QAChB,gBAAgB,EAAE,EAAE;QACpB,eAAe,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,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;IAC/E,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,YAAY,CAAC,KAAa;IACjC,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;IAChC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC/D,OAAO,OAAO,CAAC,WAAW,EAAE,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const BILLING_METER_READINESS_SCHEMA_VERSION: 1;
|
|
3
|
+
export declare const BILLING_METER_RECEIPT_RETENTION_DAYS: 7;
|
|
4
|
+
export declare const BILLING_METER_EXACT_KEY_TOMBSTONE_RETENTION_DAYS: 30;
|
|
5
|
+
export declare const BILLING_METER_AGGREGATE_RETENTION_MONTHS: 25;
|
|
6
|
+
export declare const BILLING_METER_PARTITION_HORIZON_MONTHS: 2;
|
|
7
|
+
export declare const BILLING_METER_EVIDENCE_FRESHNESS_MS: number;
|
|
8
|
+
export declare const BILLING_METER_RETRY_IDENTITY_VERSION: 1;
|
|
9
|
+
export declare const BILLING_METER_READINESS_CHECK_CODES: readonly ["durable_postgres", "billing_attribution_complete", "legacy_platform_quota_retired", "key_generation_consistent", "prepared_meter_epoch", "partition_horizon", "receipt_retention", "exact_key_tombstones", "aggregate_reconciliation", "validation_mirror", "writer_health", "scheduler_health"];
|
|
10
|
+
export declare const BILLING_METER_LATER_CUTOVER_GATES: readonly ["traffic_fleet_convergence_proof", "plan_volume_capacity_proof", "nonproduction_fail_closed_drill", "grant_expiry_contract", "authoritative_activation", "protected_production_approval"];
|
|
11
|
+
declare const BillingMeterReadinessCheckSchema: z.ZodObject<{
|
|
12
|
+
code: z.ZodEnum<{
|
|
13
|
+
durable_postgres: "durable_postgres";
|
|
14
|
+
billing_attribution_complete: "billing_attribution_complete";
|
|
15
|
+
legacy_platform_quota_retired: "legacy_platform_quota_retired";
|
|
16
|
+
key_generation_consistent: "key_generation_consistent";
|
|
17
|
+
prepared_meter_epoch: "prepared_meter_epoch";
|
|
18
|
+
partition_horizon: "partition_horizon";
|
|
19
|
+
receipt_retention: "receipt_retention";
|
|
20
|
+
exact_key_tombstones: "exact_key_tombstones";
|
|
21
|
+
aggregate_reconciliation: "aggregate_reconciliation";
|
|
22
|
+
validation_mirror: "validation_mirror";
|
|
23
|
+
writer_health: "writer_health";
|
|
24
|
+
scheduler_health: "scheduler_health";
|
|
25
|
+
}>;
|
|
26
|
+
state: z.ZodEnum<{
|
|
27
|
+
unknown: "unknown";
|
|
28
|
+
pass: "pass";
|
|
29
|
+
fail: "fail";
|
|
30
|
+
}>;
|
|
31
|
+
checkedAt: z.ZodOptional<z.ZodPipe<z.ZodISODateTime, z.ZodTransform<string, string>>>;
|
|
32
|
+
}, z.core.$strict>;
|
|
33
|
+
export declare const BillingMeterReadinessReportSchema: z.ZodObject<{
|
|
34
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
35
|
+
checkedAt: z.ZodPipe<z.ZodISODateTime, z.ZodTransform<string, string>>;
|
|
36
|
+
technicalReadiness: z.ZodEnum<{
|
|
37
|
+
unavailable: "unavailable";
|
|
38
|
+
ready: "ready";
|
|
39
|
+
blocked: "blocked";
|
|
40
|
+
}>;
|
|
41
|
+
metering: z.ZodUnion<readonly [z.ZodObject<{
|
|
42
|
+
mode: z.ZodLiteral<"not_started">;
|
|
43
|
+
coverage: z.ZodNull;
|
|
44
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
45
|
+
mode: z.ZodLiteral<"shadow">;
|
|
46
|
+
coverage: z.ZodLiteral<"partial">;
|
|
47
|
+
}, z.core.$strict>]>;
|
|
48
|
+
enforcement: z.ZodObject<{
|
|
49
|
+
state: z.ZodLiteral<"legacy_unchanged">;
|
|
50
|
+
}, z.core.$strict>;
|
|
51
|
+
activation: z.ZodObject<{
|
|
52
|
+
state: z.ZodLiteral<"not_available">;
|
|
53
|
+
}, z.core.$strict>;
|
|
54
|
+
checks: z.ZodArray<z.ZodObject<{
|
|
55
|
+
code: z.ZodEnum<{
|
|
56
|
+
durable_postgres: "durable_postgres";
|
|
57
|
+
billing_attribution_complete: "billing_attribution_complete";
|
|
58
|
+
legacy_platform_quota_retired: "legacy_platform_quota_retired";
|
|
59
|
+
key_generation_consistent: "key_generation_consistent";
|
|
60
|
+
prepared_meter_epoch: "prepared_meter_epoch";
|
|
61
|
+
partition_horizon: "partition_horizon";
|
|
62
|
+
receipt_retention: "receipt_retention";
|
|
63
|
+
exact_key_tombstones: "exact_key_tombstones";
|
|
64
|
+
aggregate_reconciliation: "aggregate_reconciliation";
|
|
65
|
+
validation_mirror: "validation_mirror";
|
|
66
|
+
writer_health: "writer_health";
|
|
67
|
+
scheduler_health: "scheduler_health";
|
|
68
|
+
}>;
|
|
69
|
+
state: z.ZodEnum<{
|
|
70
|
+
unknown: "unknown";
|
|
71
|
+
pass: "pass";
|
|
72
|
+
fail: "fail";
|
|
73
|
+
}>;
|
|
74
|
+
checkedAt: z.ZodOptional<z.ZodPipe<z.ZodISODateTime, z.ZodTransform<string, string>>>;
|
|
75
|
+
}, z.core.$strict>>;
|
|
76
|
+
laterCutoverGates: z.ZodTuple<[z.ZodLiteral<"traffic_fleet_convergence_proof">, z.ZodLiteral<"plan_volume_capacity_proof">, z.ZodLiteral<"nonproduction_fail_closed_drill">, z.ZodLiteral<"grant_expiry_contract">, z.ZodLiteral<"authoritative_activation">, z.ZodLiteral<"protected_production_approval">], null>;
|
|
77
|
+
}, z.core.$strict>;
|
|
78
|
+
export type BillingMeterReadinessCheckCode = (typeof BILLING_METER_READINESS_CHECK_CODES)[number];
|
|
79
|
+
export type BillingMeterReadinessCheckState = z.infer<typeof BillingMeterReadinessCheckSchema>['state'];
|
|
80
|
+
export type BillingMeterLaterCutoverGate = (typeof BILLING_METER_LATER_CUTOVER_GATES)[number];
|
|
81
|
+
export type BillingMeterReadinessCheck = z.infer<typeof BillingMeterReadinessCheckSchema>;
|
|
82
|
+
export type BillingMeterReadinessReport = z.infer<typeof BillingMeterReadinessReportSchema>;
|
|
83
|
+
export interface BillingMeterReadinessStore {
|
|
84
|
+
getMeterReadiness(): Promise<BillingMeterReadinessReport>;
|
|
85
|
+
}
|
|
86
|
+
type ReadinessCheckSignals = Readonly<Record<BillingMeterReadinessCheckCode, {
|
|
87
|
+
readonly state: BillingMeterReadinessCheckState;
|
|
88
|
+
readonly checkedAt?: string;
|
|
89
|
+
}>>;
|
|
90
|
+
export declare function buildBillingMeterReadinessReport(input: {
|
|
91
|
+
readonly checkedAt: string;
|
|
92
|
+
readonly metering: BillingMeterReadinessReport['metering'];
|
|
93
|
+
readonly checks: ReadinessCheckSignals;
|
|
94
|
+
}): BillingMeterReadinessReport;
|
|
95
|
+
export declare function unavailableBillingMeterReadinessReport(checkedAt: string): BillingMeterReadinessReport;
|
|
96
|
+
/** A one-way generation marker; the HMAC key itself is never persisted or returned. */
|
|
97
|
+
export declare function deriveBillingMeterKeyGeneration(hmacKey: string): string;
|
|
98
|
+
export {};
|
|
99
|
+
//# sourceMappingURL=meter-readiness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meter-readiness.d.ts","sourceRoot":"","sources":["../../src/billing/meter-readiness.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,sCAAsC,EAAG,CAAU,CAAC;AACjE,eAAO,MAAM,oCAAoC,EAAG,CAAU,CAAC;AAC/D,eAAO,MAAM,gDAAgD,EAAG,EAAW,CAAC;AAC5E,eAAO,MAAM,wCAAwC,EAAG,EAAW,CAAC;AACpE,eAAO,MAAM,sCAAsC,EAAG,CAAU,CAAC;AACjE,eAAO,M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