@zonastery/bursar 1.0.0 → 2.0.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/README.md +189 -62
- package/dist/billing/auto-recharge-port.d.ts +3 -3
- package/dist/billing/auto-recharge-port.d.ts.map +1 -1
- package/dist/billing/auto-recharge-port.js.map +1 -1
- package/dist/billing/auto-recharge-service.d.ts +5 -4
- package/dist/billing/auto-recharge-service.d.ts.map +1 -1
- package/dist/billing/auto-recharge-service.js +64 -34
- package/dist/billing/auto-recharge-service.js.map +1 -1
- package/dist/billing/billing-service.d.ts +5 -5
- package/dist/billing/billing-service.d.ts.map +1 -1
- package/dist/billing/billing-service.js +2 -2
- package/dist/billing/billing-service.js.map +1 -1
- package/dist/billing/billing-store.d.ts +10 -9
- package/dist/billing/billing-store.d.ts.map +1 -1
- package/dist/billing/billing-store.js.map +1 -1
- package/dist/billing/contracts.d.ts +31 -31
- package/dist/billing/contracts.d.ts.map +1 -1
- package/dist/billing/contracts.js.map +1 -1
- package/dist/billing/event-handlers.d.ts.map +1 -1
- package/dist/billing/event-handlers.js +49 -10
- package/dist/billing/event-handlers.js.map +1 -1
- package/dist/billing/event-processor.d.ts +1 -0
- package/dist/billing/event-processor.d.ts.map +1 -1
- package/dist/billing/event-processor.js +37 -10
- package/dist/billing/event-processor.js.map +1 -1
- package/dist/billing/financial-event-handlers.d.ts.map +1 -1
- package/dist/billing/financial-event-handlers.js +69 -72
- package/dist/billing/financial-event-handlers.js.map +1 -1
- package/dist/billing/index.d.ts +2 -1
- package/dist/billing/index.d.ts.map +1 -1
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/management.d.ts +5 -5
- package/dist/billing/management.d.ts.map +1 -1
- package/dist/billing/management.js +2 -2
- package/dist/billing/management.js.map +1 -1
- package/dist/billing/policy-window.js.map +1 -1
- package/dist/billing/postgres/repositories/auto-recharge.d.ts +3 -3
- package/dist/billing/postgres/repositories/auto-recharge.d.ts.map +1 -1
- package/dist/billing/postgres/repositories/auto-recharge.js +205 -60
- package/dist/billing/postgres/repositories/auto-recharge.js.map +1 -1
- package/dist/billing/postgres/repositories/customer.d.ts.map +1 -1
- package/dist/billing/postgres/repositories/customer.js +19 -11
- package/dist/billing/postgres/repositories/customer.js.map +1 -1
- package/dist/billing/postgres/repositories/dispute.d.ts.map +1 -1
- package/dist/billing/postgres/repositories/dispute.js +3 -1
- package/dist/billing/postgres/repositories/dispute.js.map +1 -1
- package/dist/billing/postgres/repositories/event.d.ts +14 -7
- package/dist/billing/postgres/repositories/event.d.ts.map +1 -1
- package/dist/billing/postgres/repositories/event.js +21 -20
- package/dist/billing/postgres/repositories/event.js.map +1 -1
- package/dist/billing/postgres/repositories/invoice.d.ts +3 -3
- package/dist/billing/postgres/repositories/invoice.d.ts.map +1 -1
- package/dist/billing/postgres/repositories/invoice.js +53 -11
- package/dist/billing/postgres/repositories/invoice.js.map +1 -1
- package/dist/billing/postgres/repositories/offer.d.ts +20 -17
- package/dist/billing/postgres/repositories/offer.d.ts.map +1 -1
- package/dist/billing/postgres/repositories/offer.js +123 -57
- package/dist/billing/postgres/repositories/offer.js.map +1 -1
- package/dist/billing/postgres/repositories/payment.d.ts +23 -20
- package/dist/billing/postgres/repositories/payment.d.ts.map +1 -1
- package/dist/billing/postgres/repositories/payment.js +43 -37
- package/dist/billing/postgres/repositories/payment.js.map +1 -1
- package/dist/billing/postgres/repositories/preferences.d.ts +3 -9
- package/dist/billing/postgres/repositories/preferences.d.ts.map +1 -1
- package/dist/billing/postgres/repositories/preferences.js +45 -7
- package/dist/billing/postgres/repositories/preferences.js.map +1 -1
- package/dist/billing/postgres/repositories/refund.d.ts +1 -1
- package/dist/billing/postgres/repositories/refund.d.ts.map +1 -1
- package/dist/billing/postgres/repositories/refund.js +13 -9
- package/dist/billing/postgres/repositories/refund.js.map +1 -1
- package/dist/billing/postgres/repositories/subscription-change.d.ts +15 -0
- package/dist/billing/postgres/repositories/subscription-change.d.ts.map +1 -0
- package/dist/billing/postgres/repositories/subscription-change.js +234 -0
- package/dist/billing/postgres/repositories/subscription-change.js.map +1 -0
- package/dist/billing/postgres/repositories/subscription.d.ts +38 -17
- package/dist/billing/postgres/repositories/subscription.d.ts.map +1 -1
- package/dist/billing/postgres/repositories/subscription.js +199 -91
- package/dist/billing/postgres/repositories/subscription.js.map +1 -1
- package/dist/billing/postgres/repositories/topup.d.ts +13 -15
- package/dist/billing/postgres/repositories/topup.d.ts.map +1 -1
- package/dist/billing/postgres/repositories/topup.js +65 -34
- package/dist/billing/postgres/repositories/topup.js.map +1 -1
- package/dist/billing/postgres/store.d.ts +23 -14
- package/dist/billing/postgres/store.d.ts.map +1 -1
- package/dist/billing/postgres/store.js +265 -228
- package/dist/billing/postgres/store.js.map +1 -1
- package/dist/billing/service-types.d.ts +6 -5
- package/dist/billing/service-types.d.ts.map +1 -1
- package/dist/billing/service-types.js.map +1 -1
- package/dist/billing/types/auto-recharge.d.ts +6 -4
- package/dist/billing/types/auto-recharge.d.ts.map +1 -1
- package/dist/billing/types/auto-recharge.js.map +1 -1
- package/dist/billing/types/catalog.d.ts +18 -35
- package/dist/billing/types/catalog.d.ts.map +1 -1
- package/dist/billing/types/catalog.js.map +1 -1
- package/dist/billing/types/common.d.ts +0 -1
- package/dist/billing/types/common.d.ts.map +1 -1
- package/dist/billing/types/common.js.map +1 -1
- package/dist/billing/types/documents.d.ts +38 -12
- package/dist/billing/types/documents.d.ts.map +1 -1
- package/dist/billing/types/documents.js.map +1 -1
- package/dist/billing/types/events.d.ts +2 -0
- package/dist/billing/types/events.d.ts.map +1 -1
- package/dist/billing/types/events.js +238 -0
- package/dist/billing/types/events.js.map +1 -1
- package/dist/billing/types/index.js.map +1 -1
- package/dist/billing/types/preferences.js.map +1 -1
- package/dist/billing/types/subscriptions.d.ts +8 -8
- package/dist/billing/types/subscriptions.d.ts.map +1 -1
- package/dist/billing/types/subscriptions.js.map +1 -1
- package/dist/breakdown.js.map +1 -1
- package/dist/browser.js.map +1 -1
- package/dist/bursar.d.ts +33 -11
- package/dist/bursar.d.ts.map +1 -1
- package/dist/bursar.js +58 -22
- package/dist/bursar.js.map +1 -1
- package/dist/catalog.d.ts +1 -0
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +1 -0
- package/dist/catalog.js.map +1 -1
- package/dist/commerce/errors.d.ts +4 -14
- package/dist/commerce/errors.d.ts.map +1 -1
- package/dist/commerce/errors.js +4 -21
- package/dist/commerce/errors.js.map +1 -1
- package/dist/commerce/index.d.ts +1 -0
- package/dist/commerce/index.d.ts.map +1 -1
- package/dist/commerce/index.js.map +1 -1
- package/dist/commerce/plan-change.js.map +1 -1
- package/dist/commerce/provider-registry.d.ts.map +1 -1
- package/dist/commerce/provider-registry.js +27 -2
- package/dist/commerce/provider-registry.js.map +1 -1
- package/dist/commerce/service.d.ts +15 -7
- package/dist/commerce/service.d.ts.map +1 -1
- package/dist/commerce/service.js +130 -77
- package/dist/commerce/service.js.map +1 -1
- package/dist/commerce/types.d.ts +33 -13
- package/dist/commerce/types.d.ts.map +1 -1
- package/dist/commerce/types.js.map +1 -1
- package/dist/config/parse-access.js.map +1 -1
- package/dist/config/parse-commerce.js.map +1 -1
- package/dist/config/parse-credits.js.map +1 -1
- package/dist/config/parse-plans.d.ts.map +1 -1
- package/dist/config/parse-plans.js +30 -13
- package/dist/config/parse-plans.js.map +1 -1
- package/dist/config/parse-pricing.d.ts.map +1 -1
- package/dist/config/parse-pricing.js +16 -5
- package/dist/config/parse-pricing.js.map +1 -1
- package/dist/config/parse-utils.js.map +1 -1
- package/dist/config/types.d.ts +14 -1
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js.map +1 -1
- package/dist/config.d.ts +7 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +64 -1
- package/dist/config.js.map +1 -1
- package/dist/credits/{pricing-runtime.d.ts → catalog-runtime.d.ts} +9 -8
- package/dist/credits/catalog-runtime.d.ts.map +1 -0
- package/dist/credits/{pricing-runtime.js → catalog-runtime.js} +58 -38
- package/dist/credits/catalog-runtime.js.map +1 -0
- package/dist/credits/events.d.ts +4 -4
- package/dist/credits/events.d.ts.map +1 -1
- package/dist/credits/events.js +1 -1
- package/dist/credits/events.js.map +1 -1
- package/dist/credits/lease-workflow.d.ts +14 -14
- package/dist/credits/lease-workflow.d.ts.map +1 -1
- package/dist/credits/lease-workflow.js +18 -17
- package/dist/credits/lease-workflow.js.map +1 -1
- package/dist/credits/low-balance-monitor.d.ts +2 -2
- package/dist/credits/low-balance-monitor.d.ts.map +1 -1
- package/dist/credits/low-balance-monitor.js.map +1 -1
- package/dist/credits/postgres/repositories/analytics.d.ts +39 -35
- package/dist/credits/postgres/repositories/analytics.d.ts.map +1 -1
- package/dist/credits/postgres/repositories/analytics.js +55 -53
- package/dist/credits/postgres/repositories/analytics.js.map +1 -1
- package/dist/credits/postgres/repositories/balance.d.ts +28 -30
- package/dist/credits/postgres/repositories/balance.d.ts.map +1 -1
- package/dist/credits/postgres/repositories/balance.js +100 -59
- package/dist/credits/postgres/repositories/balance.js.map +1 -1
- package/dist/credits/postgres/repositories/bucket.d.ts +14 -8
- package/dist/credits/postgres/repositories/bucket.d.ts.map +1 -1
- package/dist/credits/postgres/repositories/bucket.js +22 -21
- package/dist/credits/postgres/repositories/bucket.js.map +1 -1
- package/dist/credits/postgres/repositories/catalog.d.ts +31 -0
- package/dist/credits/postgres/repositories/catalog.d.ts.map +1 -0
- package/dist/credits/postgres/repositories/catalog.js +90 -0
- package/dist/credits/postgres/repositories/catalog.js.map +1 -0
- package/dist/credits/postgres/repositories/deduction.d.ts +32 -21
- package/dist/credits/postgres/repositories/deduction.d.ts.map +1 -1
- package/dist/credits/postgres/repositories/deduction.js +171 -62
- package/dist/credits/postgres/repositories/deduction.js.map +1 -1
- package/dist/credits/postgres/repositories/lease.d.ts +21 -18
- package/dist/credits/postgres/repositories/lease.d.ts.map +1 -1
- package/dist/credits/postgres/repositories/lease.js +157 -65
- package/dist/credits/postgres/repositories/lease.js.map +1 -1
- package/dist/credits/postgres/repositories/plan.d.ts +94 -42
- package/dist/credits/postgres/repositories/plan.d.ts.map +1 -1
- package/dist/credits/postgres/repositories/plan.js +134 -104
- package/dist/credits/postgres/repositories/plan.js.map +1 -1
- package/dist/credits/postgres/repositories/team.d.ts +36 -27
- package/dist/credits/postgres/repositories/team.d.ts.map +1 -1
- package/dist/credits/postgres/repositories/team.js +96 -52
- package/dist/credits/postgres/repositories/team.js.map +1 -1
- package/dist/credits/postgres/store.d.ts +31 -21
- package/dist/credits/postgres/store.d.ts.map +1 -1
- package/dist/credits/postgres/store.js +325 -235
- package/dist/credits/postgres/store.js.map +1 -1
- package/dist/credits/postgres/value-mappers.d.ts +7 -9
- package/dist/credits/postgres/value-mappers.d.ts.map +1 -1
- package/dist/credits/postgres/value-mappers.js +42 -63
- package/dist/credits/postgres/value-mappers.js.map +1 -1
- package/dist/credits/queries.d.ts +5 -5
- package/dist/credits/queries.d.ts.map +1 -1
- package/dist/credits/queries.js +4 -4
- package/dist/credits/queries.js.map +1 -1
- package/dist/credits/service-errors.js.map +1 -1
- package/dist/credits/service-types.d.ts +42 -7
- package/dist/credits/service-types.d.ts.map +1 -1
- package/dist/credits/service-types.js.map +1 -1
- package/dist/credits/service.d.ts +51 -58
- package/dist/credits/service.d.ts.map +1 -1
- package/dist/credits/service.js +178 -113
- package/dist/credits/service.js.map +1 -1
- package/dist/credits/store.d.ts +25 -22
- package/dist/credits/store.d.ts.map +1 -1
- package/dist/credits/store.js +9 -5
- package/dist/credits/store.js.map +1 -1
- package/dist/credits/types/account.d.ts +50 -12
- package/dist/credits/types/account.d.ts.map +1 -1
- package/dist/credits/types/account.js.map +1 -1
- package/dist/credits/types/admission.d.ts +17 -6
- package/dist/credits/types/admission.d.ts.map +1 -1
- package/dist/credits/types/admission.js.map +1 -1
- package/dist/credits/types/analytics.d.ts +2 -2
- package/dist/credits/types/analytics.d.ts.map +1 -1
- package/dist/credits/types/analytics.js.map +1 -1
- package/dist/credits/types/catalog.d.ts +21 -14
- package/dist/credits/types/catalog.d.ts.map +1 -1
- package/dist/credits/types/catalog.js.map +1 -1
- package/dist/credits/types/grants.d.ts +22 -8
- package/dist/credits/types/grants.d.ts.map +1 -1
- package/dist/credits/types/grants.js.map +1 -1
- package/dist/credits/types/index.js.map +1 -1
- package/dist/credits/types/ledger.d.ts +19 -0
- package/dist/credits/types/ledger.d.ts.map +1 -1
- package/dist/credits/types/ledger.js.map +1 -1
- package/dist/credits/types/quotas.js.map +1 -1
- package/dist/credits/types/teams.d.ts +18 -6
- package/dist/credits/types/teams.d.ts.map +1 -1
- package/dist/credits/types/teams.js.map +1 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +24 -10
- package/dist/engine.js.map +1 -1
- package/dist/errors.d.ts +105 -8
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +137 -9
- package/dist/errors.js.map +1 -1
- package/dist/expr/ast.d.ts.map +1 -1
- package/dist/expr/ast.js.map +1 -1
- package/dist/expr/evaluator.d.ts.map +1 -1
- package/dist/expr/evaluator.js +29 -17
- package/dist/expr/evaluator.js.map +1 -1
- package/dist/expr/language.js.map +1 -1
- package/dist/expr/parser.d.ts.map +1 -1
- package/dist/expr/parser.js +11 -4
- package/dist/expr/parser.js.map +1 -1
- package/dist/expr/tokenizer.d.ts.map +1 -1
- package/dist/expr/tokenizer.js +17 -13
- package/dist/expr/tokenizer.js.map +1 -1
- package/dist/expr.d.ts +2 -2
- package/dist/expr.d.ts.map +1 -1
- package/dist/expr.js +7 -9
- package/dist/expr.js.map +1 -1
- package/dist/generated/pricing-config.schema.json +30 -9
- package/dist/generated/pricing-config.types.d.ts +14 -3
- package/dist/generated/pricing-config.types.d.ts.map +1 -1
- package/dist/generated/pricing-config.types.js.map +1 -1
- package/dist/index.d.ts +11 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/integrations/better-auth.d.ts +23 -0
- package/dist/integrations/better-auth.d.ts.map +1 -0
- package/dist/integrations/better-auth.js +54 -0
- package/dist/integrations/better-auth.js.map +1 -0
- package/dist/{load-pricing-file.d.ts → load-config-file.d.ts} +4 -4
- package/dist/load-config-file.d.ts.map +1 -0
- package/dist/{load-pricing-file.js → load-config-file.js} +23 -14
- package/dist/load-config-file.js.map +1 -0
- package/dist/metrics.js.map +1 -1
- package/dist/node.d.ts +3 -3
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +2 -2
- package/dist/node.js.map +1 -1
- package/dist/providers/_shared.d.ts +5 -0
- package/dist/providers/_shared.d.ts.map +1 -1
- package/dist/providers/_shared.js +77 -14
- package/dist/providers/_shared.js.map +1 -1
- package/dist/providers/dodo/better-auth.d.ts +29 -0
- package/dist/providers/dodo/better-auth.d.ts.map +1 -0
- package/dist/providers/dodo/better-auth.js +23 -0
- package/dist/providers/dodo/better-auth.js.map +1 -0
- package/dist/providers/dodo/client-contract.d.ts +32 -70
- package/dist/providers/dodo/client-contract.d.ts.map +1 -1
- package/dist/providers/dodo/client-contract.js.map +1 -1
- package/dist/providers/dodo/event-mapper.d.ts +3 -1
- package/dist/providers/dodo/event-mapper.d.ts.map +1 -1
- package/dist/providers/dodo/event-mapper.js +219 -148
- package/dist/providers/dodo/event-mapper.js.map +1 -1
- package/dist/providers/dodo/index.d.ts +5 -2
- package/dist/providers/dodo/index.d.ts.map +1 -1
- package/dist/providers/dodo/index.js +2 -1
- package/dist/providers/dodo/index.js.map +1 -1
- package/dist/providers/dodo/nextjs.d.ts +16 -0
- package/dist/providers/dodo/nextjs.d.ts.map +1 -0
- package/dist/providers/dodo/nextjs.js +16 -0
- package/dist/providers/dodo/nextjs.js.map +1 -0
- package/dist/providers/dodo/provider.d.ts +30 -11
- package/dist/providers/dodo/provider.d.ts.map +1 -1
- package/dist/providers/dodo/provider.js +192 -122
- package/dist/providers/dodo/provider.js.map +1 -1
- package/dist/providers/dodo/react-native.d.ts +56 -0
- package/dist/providers/dodo/react-native.d.ts.map +1 -0
- package/dist/providers/dodo/react-native.js +57 -0
- package/dist/providers/dodo/react-native.js.map +1 -0
- package/dist/providers/dodo/webhook-bridge.d.ts +17 -0
- package/dist/providers/dodo/webhook-bridge.d.ts.map +1 -0
- package/dist/providers/dodo/webhook-bridge.js +21 -0
- package/dist/providers/dodo/webhook-bridge.js.map +1 -0
- package/dist/providers/index.d.ts +1 -1
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/mock/index.d.ts +1 -0
- package/dist/providers/mock/index.d.ts.map +1 -1
- package/dist/providers/mock/index.js.map +1 -1
- package/dist/providers/mock/provider.d.ts +8 -8
- package/dist/providers/mock/provider.d.ts.map +1 -1
- package/dist/providers/mock/provider.js +26 -19
- package/dist/providers/mock/provider.js.map +1 -1
- package/dist/providers/stripe/event-mapper.d.ts.map +1 -1
- package/dist/providers/stripe/event-mapper.js +214 -173
- package/dist/providers/stripe/event-mapper.js.map +1 -1
- package/dist/providers/stripe/index.d.ts +1 -0
- package/dist/providers/stripe/index.d.ts.map +1 -1
- package/dist/providers/stripe/index.js.map +1 -1
- package/dist/providers/stripe/provider.d.ts +13 -11
- package/dist/providers/stripe/provider.d.ts.map +1 -1
- package/dist/providers/stripe/provider.js +287 -107
- package/dist/providers/stripe/provider.js.map +1 -1
- package/dist/providers/types.d.ts +1 -2
- package/dist/providers/types.d.ts.map +1 -1
- package/dist/providers/types.js.map +1 -1
- package/dist/retry.d.ts +26 -4
- package/dist/retry.d.ts.map +1 -1
- package/dist/retry.js +65 -23
- package/dist/retry.js.map +1 -1
- package/dist/shared/diagnostics.d.ts +7 -0
- package/dist/shared/diagnostics.d.ts.map +1 -0
- package/dist/shared/diagnostics.js +18 -0
- package/dist/shared/diagnostics.js.map +1 -0
- package/dist/shared/logger.js.map +1 -1
- package/dist/shared/postgres-client.d.ts +43 -5
- package/dist/shared/postgres-client.d.ts.map +1 -1
- package/dist/shared/postgres-client.js +282 -30
- package/dist/shared/postgres-client.js.map +1 -1
- package/dist/shared/postgres-errors.d.ts +11 -0
- package/dist/shared/postgres-errors.d.ts.map +1 -0
- package/dist/shared/postgres-errors.js +105 -0
- package/dist/shared/postgres-errors.js.map +1 -0
- package/dist/shared/postgres-types.js.map +1 -1
- package/dist/shared/postgres-validation.d.ts +15 -3
- package/dist/shared/postgres-validation.d.ts.map +1 -1
- package/dist/shared/postgres-validation.js +58 -14
- package/dist/shared/postgres-validation.js.map +1 -1
- package/dist/storage/adapters/clickhouse.d.ts.map +1 -1
- package/dist/storage/adapters/clickhouse.js +18 -3
- package/dist/storage/adapters/clickhouse.js.map +1 -1
- package/dist/storage/adapters/s3.d.ts +0 -6
- package/dist/storage/adapters/s3.d.ts.map +1 -1
- package/dist/storage/adapters/s3.js +0 -2
- package/dist/storage/adapters/s3.js.map +1 -1
- package/dist/storage/outbox-worker.d.ts +2 -1
- package/dist/storage/outbox-worker.d.ts.map +1 -1
- package/dist/storage/outbox-worker.js +17 -3
- package/dist/storage/outbox-worker.js.map +1 -1
- package/dist/storage/ports.d.ts +1 -1
- package/dist/storage/ports.d.ts.map +1 -1
- package/dist/storage/ports.js.map +1 -1
- package/dist/storage/postgres-repository.d.ts +1 -1
- package/dist/storage/postgres-repository.d.ts.map +1 -1
- package/dist/storage/postgres-repository.js +13 -3
- package/dist/storage/postgres-repository.js.map +1 -1
- package/dist/storage/runtime.d.ts +35 -7
- package/dist/storage/runtime.d.ts.map +1 -1
- package/dist/storage/runtime.js +166 -53
- package/dist/storage/runtime.js.map +1 -1
- package/package.json +62 -7
- package/dist/credits/postgres/repositories/pricing.d.ts +0 -28
- package/dist/credits/postgres/repositories/pricing.d.ts.map +0 -1
- package/dist/credits/postgres/repositories/pricing.js +0 -70
- package/dist/credits/postgres/repositories/pricing.js.map +0 -1
- package/dist/credits/pricing-runtime.d.ts.map +0 -1
- package/dist/credits/pricing-runtime.js.map +0 -1
- package/dist/load-pricing-file.d.ts.map +0 -1
- package/dist/load-pricing-file.js.map +0 -1
|
@@ -2,13 +2,13 @@ import type Decimal from "decimal.js";
|
|
|
2
2
|
import type { UsageMetrics } from "../metrics.js";
|
|
3
3
|
import type { Logger } from "../shared/logger.js";
|
|
4
4
|
import type { CreditEvent } from "./events.js";
|
|
5
|
-
import type { BillingMode, CreditMetadata, DeductionResult, UsageAnalyticsStore, UsageChargeStore } from "./types/index.js";
|
|
5
|
+
import type { BillingMode, CreditMetadata, DeductionResult, DeductionSuccess, UsageAnalyticsStore, UsageChargeStore } from "./types/index.js";
|
|
6
6
|
export type PolicyPreset = "strict_prepaid" | "overdraft";
|
|
7
7
|
export type MetricsOrAmount = UsageMetrics | Decimal | number;
|
|
8
8
|
export interface PostDeductionContext {
|
|
9
9
|
userId: string;
|
|
10
10
|
source: "deduct" | "settle" | "raw";
|
|
11
|
-
deduction:
|
|
11
|
+
deduction: DeductionSuccess;
|
|
12
12
|
}
|
|
13
13
|
export interface LowBalanceConfig {
|
|
14
14
|
thresholds?: (Decimal | number)[] | null;
|
|
@@ -44,16 +44,53 @@ export interface CreditsServiceOptions {
|
|
|
44
44
|
/** Sweep a subject's expired credits before balance-sensitive operations. */
|
|
45
45
|
lazyExpiry?: boolean;
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
48
|
-
* reloads. Concurrent reloads are deduplicated.
|
|
47
|
+
* Catalog cache TTL in milliseconds. A value of 0 disables automatic
|
|
48
|
+
* reloads. Concurrent reloads are deduplicated. Defaults to 300,000.
|
|
49
49
|
*/
|
|
50
|
-
|
|
50
|
+
catalogCacheTtlMs?: number;
|
|
51
51
|
/**
|
|
52
52
|
* Awaited after a committed, non-replayed deduction. Hook failures are
|
|
53
53
|
* isolated from the committed credit charge.
|
|
54
54
|
*/
|
|
55
55
|
postDeduction?: ((context: PostDeductionContext) => void | Promise<void>) | null;
|
|
56
56
|
}
|
|
57
|
+
export interface AddCreditsOptions {
|
|
58
|
+
type?: string;
|
|
59
|
+
metadata?: CreditMetadata | null;
|
|
60
|
+
expiresAt?: Date | null;
|
|
61
|
+
/** Target credit bucket; omitted resolves to the catalog's default bucket. */
|
|
62
|
+
bucket?: string | null;
|
|
63
|
+
/** Stable replay key for the ledger mutation. */
|
|
64
|
+
idempotencyKey?: string | null;
|
|
65
|
+
}
|
|
66
|
+
export interface DeductCreditsOptions {
|
|
67
|
+
entryType?: string;
|
|
68
|
+
bucket?: string | null;
|
|
69
|
+
metadata?: CreditMetadata | null;
|
|
70
|
+
/** Stable replay key for the ledger mutation. */
|
|
71
|
+
idempotencyKey?: string | null;
|
|
72
|
+
}
|
|
73
|
+
export interface DeductOptions {
|
|
74
|
+
idempotencyKey?: string | null;
|
|
75
|
+
metadata?: CreditMetadata | null;
|
|
76
|
+
/** Entitlement feature required for this operation. */
|
|
77
|
+
feature?: string | null;
|
|
78
|
+
}
|
|
79
|
+
export type DeductFlatJobOptions = DeductOptions;
|
|
80
|
+
export interface RecordUsageOptions {
|
|
81
|
+
idempotencyKey?: string | null;
|
|
82
|
+
metadata?: CreditMetadata | null;
|
|
83
|
+
}
|
|
84
|
+
export interface RefundCreditsOptions {
|
|
85
|
+
amount?: Decimal | number;
|
|
86
|
+
reason?: string;
|
|
87
|
+
metadata?: CreditMetadata | null;
|
|
88
|
+
idempotencyKey?: string | null;
|
|
89
|
+
}
|
|
90
|
+
export interface DeductTeamOptions {
|
|
91
|
+
idempotencyKey?: string | null;
|
|
92
|
+
metadata?: CreditMetadata | null;
|
|
93
|
+
}
|
|
57
94
|
export interface ReserveOptions {
|
|
58
95
|
/** Replay-safe acquisition key. A random key is generated when omitted. */
|
|
59
96
|
idempotencyKey?: string | null;
|
|
@@ -80,8 +117,6 @@ export interface GrantSubscriptionCycleOptions {
|
|
|
80
117
|
bucket?: string;
|
|
81
118
|
expiresAt?: Date;
|
|
82
119
|
ttlDays?: number;
|
|
83
|
-
/** Expire the prior cycle balance first. Defaults to true. */
|
|
84
|
-
replacePrior?: boolean;
|
|
85
120
|
planKey?: string;
|
|
86
121
|
idempotencyKey?: string;
|
|
87
122
|
metadata?: CreditMetadata | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-types.d.ts","sourceRoot":"","sources":["../../src/credits/service-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AAEtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,YAAY,GAAG,gBAAgB,GAAG,WAAW,CAAC;AAC1D,MAAM,MAAM,eAAe,GAAG,YAAY,GAAG,OAAO,GAAG,MAAM,CAAC;AAE9D,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,KAAK,CAAC;IACpC,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"service-types.d.ts","sourceRoot":"","sources":["../../src/credits/service-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AAEtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,YAAY,GAAG,gBAAgB,GAAG,WAAW,CAAC;AAC1D,MAAM,MAAM,eAAe,GAAG,YAAY,GAAG,OAAO,GAAG,MAAM,CAA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;IACjC,iEAAiE;IACjE,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IACjC,gFAAgF;IAChF,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,EAAE,eAAe,CAAC;IAC1B,4DAA4D;IAC5D,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IACjC,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;CAClC;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,QAAQ,CAAC,EAAE,cAAc,GAAG,IAAI,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC5F,KAAK,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-types.js","sourceRoot":"","sources":["../../src/credits/service-types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"service-types.js","sourceRoot":"","sources":["../../src/credits/service-types.ts"],"names":[],"mappings":"","sourcesContent":["import type Decimal from \"decimal.js\";\n\nimport type { UsageMetrics } from \"../metrics.js\";\nimport type { Logger } from \"../shared/logger.js\";\nimport type { CreditEvent } from \"./events.js\";\nimport type {\n BillingMode,\n CreditMetadata,\n DeductionResult,\n DeductionSuccess,\n UsageAnalyticsStore,\n UsageChargeStore,\n} from \"./types/index.js\";\n\nexport type PolicyPreset = \"strict_prepaid\" | \"overdraft\";\nexport type MetricsOrAmount = UsageMetrics | Decimal | number;\n\nexport interface PostDeductionContext {\n userId: string;\n source: \"deduct\" | \"settle\" | \"raw\";\n deduction: DeductionSuccess;\n}\n\nexport interface LowBalanceConfig {\n thresholds?: (Decimal | number)[] | null;\n onTrigger?: ((event: CreditEvent) => void | Promise<void>) | null;\n /**\n * Maximum number of subjects whose breached-threshold state is retained in\n * memory. Defaults to 100,000.\n */\n maxTrackedUsers?: number;\n}\n\nexport interface CreditsServiceOptions {\n logger?: Logger | null;\n /**\n * Optional read-only analytics backend. Defaults to the credit store, which\n * keeps PostgreSQL as the zero-infrastructure behavior.\n */\n analytics?: UsageAnalyticsStore | null;\n /** Optional usage-history backend. Defaults to the credit store. */\n usageStore?: UsageChargeStore | null;\n /** Fallback credit policy for subjects without a plan assignment. */\n policy?: PolicyPreset;\n /** Planless-subject floor used with the `overdraft` fallback. */\n overdraftFloor?: Decimal | number | null;\n /** Planless-subject admission limit fallback. */\n maxConcurrent?: number | null;\n /**\n * Edge-triggered low-balance thresholds and optional non-blocking handler.\n * Defaults to zero when omitted.\n */\n lowBalance?: LowBalanceConfig | null;\n /** Default lease TTL in seconds. Defaults to 600. */\n defaultTtlSeconds?: number;\n /** Sweep a subject's expired credits before balance-sensitive operations. */\n lazyExpiry?: boolean;\n /**\n * Catalog cache TTL in milliseconds. A value of 0 disables automatic\n * reloads. Concurrent reloads are deduplicated. Defaults to 300,000.\n */\n catalogCacheTtlMs?: number;\n /**\n * Awaited after a committed, non-replayed deduction. Hook failures are\n * isolated from the committed credit charge.\n */\n postDeduction?: ((context: PostDeductionContext) => void | Promise<void>) | null;\n}\n\nexport interface AddCreditsOptions {\n type?: string;\n metadata?: CreditMetadata | null;\n expiresAt?: Date | null;\n /** Target credit bucket; omitted resolves to the catalog's default bucket. */\n bucket?: string | null;\n /** Stable replay key for the ledger mutation. */\n idempotencyKey?: string | null;\n}\n\nexport interface DeductCreditsOptions {\n entryType?: string;\n bucket?: string | null;\n metadata?: CreditMetadata | null;\n /** Stable replay key for the ledger mutation. */\n idempotencyKey?: string | null;\n}\n\nexport interface DeductOptions {\n idempotencyKey?: string | null;\n metadata?: CreditMetadata | null;\n /** Entitlement feature required for this operation. */\n feature?: string | null;\n}\n\nexport type DeductFlatJobOptions = DeductOptions;\n\nexport interface RecordUsageOptions {\n idempotencyKey?: string | null;\n metadata?: CreditMetadata | null;\n}\n\nexport interface RefundCreditsOptions {\n amount?: Decimal | number;\n reason?: string;\n metadata?: CreditMetadata | null;\n idempotencyKey?: string | null;\n}\n\nexport interface DeductTeamOptions {\n idempotencyKey?: string | null;\n metadata?: CreditMetadata | null;\n}\n\nexport interface ReserveOptions {\n /** Replay-safe acquisition key. A random key is generated when omitted. */\n idempotencyKey?: string | null;\n operationType?: string;\n billingMode?: BillingMode | null;\n ttl?: number | null;\n metadata?: CreditMetadata | null;\n feature?: string | null;\n /** Model tag used when reserving a raw amount instead of usage metrics. */\n model?: string | null;\n}\n\nexport interface SettleOptions {\n idempotencyKey?: string | null;\n metadata?: CreditMetadata | null;\n /** Entitlement key supplied at reserve time. */\n feature?: string | null;\n}\n\nexport interface CanAffordOptions {\n feature?: string | null;\n billingMode?: BillingMode | null;\n operationType?: string;\n}\n\nexport interface GrantSubscriptionCycleOptions {\n bucket?: string;\n expiresAt?: Date;\n ttlDays?: number;\n planKey?: string;\n idempotencyKey?: string;\n metadata?: CreditMetadata | null;\n}\n\nexport interface RunBilledOptions<T> {\n estimate: MetricsOrAmount;\n doWork: () => Promise<{ result: T; actual: MetricsOrAmount }>;\n operationType?: string;\n billingMode?: BillingMode | null;\n /** Stable key for the complete reserve/work/settle operation. */\n operationKey?: string | null;\n ttl?: number | null;\n feature?: string | null;\n metadata?: CreditMetadata | null;\n /** Settlement attempts for SDK-classified transient failures. Defaults to 3. */\n settlementAttempts?: number;\n}\n\nexport interface BeginBilledOperationOptions {\n estimate: MetricsOrAmount;\n /** Stable key for the complete reserve/settle operation. */\n operationKey: string;\n operationType?: string;\n billingMode?: BillingMode | null;\n ttl?: number | null;\n feature?: string | null;\n metadata?: CreditMetadata | null;\n}\n\nexport interface BilledOperation {\n readonly leaseId: string;\n readonly operationKey: string;\n settle(actual: MetricsOrAmount, metadata?: CreditMetadata | null): Promise<DeductionResult>;\n renew(ttl?: number | null): Promise<void>;\n release(): Promise<void>;\n}\n"]}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import Decimal from "decimal.js";
|
|
2
2
|
import type { PricingEngine } from "../engine.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { CatalogRollout } from "../config.js";
|
|
4
|
+
import type { AddCreditsResult, AggregateStats, AllowanceResult, AvailableResult, BalanceResult, CatalogRevision, BucketBalancesResult, CanAffordResult, CheckFeatureResult, DailySpendRow, DeductionResult, ExecuteGrantProgramRequest, GetUserPlanResult, GrantProgramAwardResult, LedgerEntry, LedgerPage, LeaseSuccess, ListLedgerEntriesOptions, ListQuotaEventsOptions, ListUsageChargesOptions, ListUsageEntriesOptions, PlanMigrationBatchResult, PlanMigrationStartResult, QuotaEvent, QuotaState, RefundSuccess, RevokeCreditsResult, ReleaseResult, SetUserPlanResult, UnsetUserPlanResult, SpendByModelRow, SpendByUserRow, SweepResult, TeamDeductionResult, TopUserRow, UsageChargePage, UsageRecordResult } from "./types/index.js";
|
|
4
5
|
import type { CreditStore } from "./store.js";
|
|
5
6
|
import type { CreditEventEmitter } from "./events.js";
|
|
6
7
|
import type { UsageMetrics } from "../metrics.js";
|
|
7
|
-
import type { CanAffordOptions, CreditsServiceOptions, GrantSubscriptionCycleOptions, MetricsOrAmount, PostDeductionContext,
|
|
8
|
-
export type { CanAffordOptions, CreditsServiceOptions, GrantSubscriptionCycleOptions, LowBalanceConfig, PolicyPreset,
|
|
8
|
+
import type { AddCreditsOptions, BeginBilledOperationOptions, BilledOperation, CanAffordOptions, CreditsServiceOptions, DeductCreditsOptions, DeductFlatJobOptions, DeductOptions, DeductTeamOptions, GrantSubscriptionCycleOptions, MetricsOrAmount, PostDeductionContext, RecordUsageOptions, RefundCreditsOptions, ReserveOptions, RunBilledOptions, SettleOptions } from "./service-types.js";
|
|
9
|
+
export type { AddCreditsOptions, BeginBilledOperationOptions, BilledOperation, CanAffordOptions, CreditsServiceOptions, DeductCreditsOptions, DeductFlatJobOptions, DeductOptions, DeductTeamOptions, GrantSubscriptionCycleOptions, LowBalanceConfig, PolicyPreset, PostDeductionContext, RecordUsageOptions, RefundCreditsOptions, ReserveOptions, RunBilledOptions, SettleOptions, } from "./service-types.js";
|
|
9
10
|
/**
|
|
10
11
|
* Orchestrates credit operations.
|
|
11
12
|
*
|
|
12
13
|
* The deduction path is a single atomic, idempotency-keyed store call
|
|
13
14
|
* (``deductWithAllowance``) that consumes free allowance, enforces plan policy,
|
|
14
|
-
* and debits the net amount in one transaction
|
|
15
|
-
* (contract §2). The manager is a thin layer that calculates the cost, maps
|
|
15
|
+
* and debits the net amount in one transaction. The service calculates the cost, maps
|
|
16
16
|
* the store's typed ``error`` codes to exceptions, and emits lifecycle events
|
|
17
|
-
* **only after** the operation has succeeded
|
|
17
|
+
* **only after** the operation has succeeded.
|
|
18
18
|
*
|
|
19
19
|
* Optionally accepts a ``CreditEventEmitter`` to emit lifecycle events
|
|
20
20
|
* (deducted, deduct_failed, added, refunded, refund_failed, expired,
|
|
@@ -23,7 +23,7 @@ export type { CanAffordOptions, CreditsServiceOptions, GrantSubscriptionCycleOpt
|
|
|
23
23
|
export declare class CreditsService {
|
|
24
24
|
private readonly store;
|
|
25
25
|
private readonly queries;
|
|
26
|
-
private readonly
|
|
26
|
+
private readonly catalogRuntime;
|
|
27
27
|
private readonly leases;
|
|
28
28
|
private emitter;
|
|
29
29
|
private balanceMonitor;
|
|
@@ -37,14 +37,14 @@ export declare class CreditsService {
|
|
|
37
37
|
*/
|
|
38
38
|
addPostDeductionHook(hook: (context: PostDeductionContext) => void | Promise<void>): () => void;
|
|
39
39
|
private afterDeduction;
|
|
40
|
-
|
|
40
|
+
getActiveCatalog(): Promise<CatalogRevision | null>;
|
|
41
41
|
getUserPlan(userId: string): Promise<GetUserPlanResult>;
|
|
42
42
|
checkFeature(userId: string, feature: string): Promise<CheckFeatureResult>;
|
|
43
43
|
getQuotaState(userId: string, quotaKey?: string | null): Promise<QuotaState[]>;
|
|
44
44
|
listQuotaEvents(userId: string, options?: ListQuotaEventsOptions): Promise<QuotaEvent[]>;
|
|
45
45
|
startPlanMigration(fromPlanId: string | null, toPlanId: string): Promise<PlanMigrationStartResult>;
|
|
46
46
|
migratePlanBatch(migrationId: string, batchSize?: number): Promise<PlanMigrationBatchResult>;
|
|
47
|
-
revokeCreditsByEntryType(userId: string, entryType: string): Promise<
|
|
47
|
+
revokeCreditsByEntryType(userId: string, entryType: string): Promise<RevokeCreditsResult>;
|
|
48
48
|
/** Execute an application-driven catalog grant program. */
|
|
49
49
|
executeGrantProgram(request: ExecuteGrantProgramRequest): Promise<GrantProgramAwardResult[]>;
|
|
50
50
|
getLedgerEntry(userId: string, entryId: string): Promise<LedgerEntry | null>;
|
|
@@ -60,63 +60,57 @@ export declare class CreditsService {
|
|
|
60
60
|
/** Emit a credit lifecycle event. No-op if no emitter is configured. */
|
|
61
61
|
private emit;
|
|
62
62
|
private emitQuotaEvents;
|
|
63
|
-
/** Load
|
|
64
|
-
|
|
65
|
-
/** Load the active pricing config from the store. */
|
|
66
|
-
loadPricingFromStore(): Promise<void>;
|
|
63
|
+
/** Load the active catalog revision from the store. */
|
|
64
|
+
loadCatalogFromStore(): Promise<void>;
|
|
67
65
|
/**
|
|
68
66
|
* If the cached PricingEngine is stale (TTL expired), reload it from the
|
|
69
67
|
* store. Concurrent callers are deduplicated via the underlying
|
|
70
|
-
* ``lru-cache.fetch()`` — only one ``
|
|
68
|
+
* ``lru-cache.fetch()`` — only one ``loadCatalogFromStore`` runs and all
|
|
71
69
|
* callers await the same result.
|
|
72
70
|
*
|
|
73
|
-
* When ``
|
|
74
|
-
* ``
|
|
71
|
+
* When ``catalogCacheTtlMs`` is ``0``, this is a no-op (the consumer must call
|
|
72
|
+
* ``loadCatalogFromStore`` manually).
|
|
75
73
|
*/
|
|
76
|
-
|
|
74
|
+
refreshCatalogIfStale(): Promise<void>;
|
|
77
75
|
/**
|
|
78
|
-
* Invalidate the
|
|
79
|
-
* reloads from the store. Useful after a manual ``
|
|
76
|
+
* Invalidate the catalog cache so the next ``refreshCatalogIfStale`` call
|
|
77
|
+
* reloads from the store. Useful after a manual ``loadCatalogFromStore``
|
|
80
78
|
* that bypasses the cache, or when the consumer knows the remote config
|
|
81
79
|
* has changed.
|
|
82
80
|
*/
|
|
83
|
-
|
|
81
|
+
invalidateCatalog(): void;
|
|
84
82
|
/**
|
|
85
|
-
* Publish
|
|
83
|
+
* Publish and activate a catalog revision, then update the local engine.
|
|
86
84
|
*
|
|
87
|
-
*
|
|
85
|
+
* The store write is awaited, so
|
|
88
86
|
* a persistence failure surfaces to the caller instead of becoming an
|
|
89
87
|
* unhandled promise rejection.
|
|
90
88
|
*/
|
|
91
|
-
|
|
89
|
+
publishAndActivateCatalog(config: Record<string, unknown>, label?: string | null, rollout?: CatalogRollout | Record<string, unknown> | null): Promise<string>;
|
|
92
90
|
/** Publish a validated, inactive catalog draft. */
|
|
93
|
-
|
|
91
|
+
publishCatalogDraft(config: Record<string, unknown>, label?: string | null): Promise<string>;
|
|
94
92
|
/** Activate an existing catalog version and reload the local engine. */
|
|
95
|
-
|
|
93
|
+
activateCatalogRevision(version: number, rollout?: CatalogRollout | Record<string, unknown> | null): Promise<string>;
|
|
96
94
|
/** The current PricingEngine, or null if not loaded. */
|
|
97
95
|
get pricingEngine(): PricingEngine | null;
|
|
98
96
|
/**
|
|
99
97
|
* Set a user's subscription plan and emit ``credits.plan_changed``.
|
|
100
98
|
*
|
|
101
99
|
* The store call is awaited so a persistence failure surfaces to the caller.
|
|
102
|
-
* The event is emitted only after the store write succeeds
|
|
100
|
+
* The event is emitted only after the store write succeeds.
|
|
103
101
|
*/
|
|
104
|
-
setUserPlan(userId: string, planKey: string, planAssignedAt?: Date | null): Promise<
|
|
102
|
+
setUserPlan(userId: string, planKey: string, planAssignedAt?: Date | null): Promise<SetUserPlanResult>;
|
|
105
103
|
/** Unset a user's subscription plan and emit the plan-change event. */
|
|
106
|
-
unsetUserPlan(userId: string): Promise<
|
|
104
|
+
unsetUserPlan(userId: string): Promise<UnsetUserPlanResult>;
|
|
105
|
+
/** Pin or unpin the user's current assignment revision. */
|
|
106
|
+
setPlanRevisionPin(userId: string, pinned: boolean): Promise<boolean>;
|
|
107
|
+
/** Apply one bounded batch of renewal-effective plan changes. */
|
|
108
|
+
applyDuePlanChanges(limit?: number): Promise<number>;
|
|
107
109
|
/** Sweep this user's expired lots when lazy expiry is enabled. */
|
|
108
110
|
private maybeLazyExpire;
|
|
109
111
|
getBalance(userId: string): Promise<BalanceResult>;
|
|
110
112
|
/** Add credits to a user's account. */
|
|
111
|
-
addCredits(userId: string, amount: Decimal | number, options?:
|
|
112
|
-
type?: string;
|
|
113
|
-
metadata?: CreditMetadata | null;
|
|
114
|
-
expiresAt?: Date | null;
|
|
115
|
-
/** Target credit bucket; omitted resolves to the config's default bucket. */
|
|
116
|
-
bucket?: string | null;
|
|
117
|
-
/** Replay-safe idempotency key (parity with `deduct`/`settle`/`refund`). */
|
|
118
|
-
idempotencyKey?: string | null;
|
|
119
|
-
}): Promise<AddCreditsResult>;
|
|
113
|
+
addCredits(userId: string, amount: Decimal | number, options?: AddCreditsOptions): Promise<AddCreditsResult>;
|
|
120
114
|
/**
|
|
121
115
|
* Deduct a raw credit amount from a user's account.
|
|
122
116
|
*
|
|
@@ -125,11 +119,7 @@ export declare class CreditsService {
|
|
|
125
119
|
* Use this for refund clawbacks and other administrative deductions that
|
|
126
120
|
* bypass the usage-based `deduct()` flow.
|
|
127
121
|
*/
|
|
128
|
-
deductCredits(userId: string, amount: Decimal | number, options?:
|
|
129
|
-
entryType?: string;
|
|
130
|
-
bucket?: string | null;
|
|
131
|
-
metadata?: CreditMetadata | null;
|
|
132
|
-
}): Promise<AddCreditsResult>;
|
|
122
|
+
deductCredits(userId: string, amount: Decimal | number, options?: DeductCreditsOptions): Promise<AddCreditsResult>;
|
|
133
123
|
/**
|
|
134
124
|
* Grant one billing-cycle's worth of credits — idempotent-safe for a
|
|
135
125
|
* payment-provider webhook handler (Stripe, etc. — bursar stays
|
|
@@ -138,32 +128,30 @@ export declare class CreditsService {
|
|
|
138
128
|
* 1. At most one of ``expiresAt``/``ttlDays`` may be given (throws
|
|
139
129
|
* ``ConfigError`` otherwise).
|
|
140
130
|
* 2. When ``ttlDays`` is given, ``expiresAt = now + ttlDays`` days.
|
|
141
|
-
* 3.
|
|
142
|
-
* ``bucket`` is expired immediately via a direct ``store.addCredits``
|
|
143
|
-
* negative adjustment — naturally idempotent (a replay finds the bucket
|
|
144
|
-
* already at zero and skips the call).
|
|
145
|
-
* 4. The new cycle is granted via a direct ``store.addCredits`` call
|
|
131
|
+
* 3. The new cycle is granted via a direct ``store.addCredits`` call
|
|
146
132
|
* (bypassing {@link addCredits} so only ``credits.cycle_renewed`` fires,
|
|
147
133
|
* not a duplicate ``credits.added``), threading ``idempotencyKey`` so a
|
|
148
134
|
* redelivered webhook replays the prior grant instead of double-crediting.
|
|
135
|
+
* 4. Existing bucket credits are never removed here. Subscription renewal
|
|
136
|
+
* policies that replace prior lots run atomically through BillingService.
|
|
149
137
|
* 5. When ``planKey`` is given, assigns it via {@link setUserPlan}.
|
|
150
138
|
* 6. Emits ``credits.cycle_renewed`` and returns the grant result.
|
|
151
139
|
*/
|
|
152
140
|
grantSubscriptionCycle(userId: string, amount: Decimal | number, options?: GrantSubscriptionCycleOptions): Promise<AddCreditsResult>;
|
|
153
|
-
reserve(userId: string, metricsOrAmount: MetricsOrAmount, options?: ReserveOptions): Promise<
|
|
141
|
+
reserve(userId: string, metricsOrAmount: MetricsOrAmount, options?: ReserveOptions): Promise<LeaseSuccess>;
|
|
154
142
|
settle(userId: string, leaseId: string, metricsOrAmount: MetricsOrAmount, options?: SettleOptions): Promise<DeductionResult>;
|
|
155
143
|
release(userId: string, leaseId: string): Promise<ReleaseResult>;
|
|
156
|
-
renew(userId: string, leaseId: string, ttl?: number | null): Promise<
|
|
144
|
+
renew(userId: string, leaseId: string, ttl?: number | null): Promise<LeaseSuccess>;
|
|
157
145
|
canAfford(userId: string, metricsOrAmount: MetricsOrAmount, options?: CanAffordOptions): Promise<CanAffordResult>;
|
|
158
146
|
getBucketBalances(userId: string): Promise<BucketBalancesResult>;
|
|
159
|
-
checkAllowance(userId: string): Promise<AllowanceResult>;
|
|
147
|
+
checkAllowance(userId: string): Promise<AllowanceResult | null>;
|
|
160
148
|
runBilled<T>(userId: string, options: RunBilledOptions<T>): Promise<{
|
|
161
149
|
result: T;
|
|
162
150
|
deduction: DeductionResult;
|
|
163
151
|
}>;
|
|
164
152
|
beginBilledOperation(userId: string, options: BeginBilledOperationOptions): Promise<BilledOperation>;
|
|
165
153
|
/**
|
|
166
|
-
* Full deduction flow as one atomic store call
|
|
154
|
+
* Full deduction flow as one atomic store call.
|
|
167
155
|
*
|
|
168
156
|
* 1. ``breakdown = engine.calculate(metrics)``; ``cost = breakdown.total``
|
|
169
157
|
* (exact `Decimal`, **no truncation**).
|
|
@@ -173,9 +161,14 @@ export declare class CreditsService {
|
|
|
173
161
|
* On a store ``error`` a ``credits.deduct_failed`` event is emitted and a
|
|
174
162
|
* typed exception is thrown. No success event is emitted on error.
|
|
175
163
|
*/
|
|
176
|
-
deduct(userId: string, metrics: UsageMetrics,
|
|
177
|
-
/**
|
|
178
|
-
|
|
164
|
+
deduct(userId: string, metrics: UsageMetrics, options?: DeductOptions): Promise<DeductionResult>;
|
|
165
|
+
/**
|
|
166
|
+
* Record priced usage for a workflow without debiting the account again.
|
|
167
|
+
*
|
|
168
|
+
* This supports priced usage receipts that should be retained without
|
|
169
|
+
* affecting the account balance, such as externally billed usage.
|
|
170
|
+
*/
|
|
171
|
+
recordUsage(userId: string, metrics: UsageMetrics, options?: RecordUsageOptions): Promise<UsageRecordResult>;
|
|
179
172
|
/**
|
|
180
173
|
* Refund a previous credit deduction.
|
|
181
174
|
*
|
|
@@ -185,16 +178,16 @@ export declare class CreditsService {
|
|
|
185
178
|
* refund).
|
|
186
179
|
*/
|
|
187
180
|
/** Deduct the configured fixed cost for one named job. */
|
|
188
|
-
deductFlatJob(userId: string, jobName: string,
|
|
189
|
-
refundCredits(entryId: string,
|
|
181
|
+
deductFlatJob(userId: string, jobName: string, options?: DeductFlatJobOptions): Promise<DeductionResult>;
|
|
182
|
+
refundCredits(entryId: string, options?: RefundCreditsOptions): Promise<RefundSuccess>;
|
|
190
183
|
/**
|
|
191
184
|
* Deduct from a team's shared balance pool.
|
|
192
185
|
*
|
|
193
186
|
* Calculates the cost via the pricing engine (exact `Decimal`, no truncation),
|
|
194
187
|
* then debits the team balance. Threads an optional ``idempotencyKey`` through
|
|
195
|
-
* to the store so retried team charges are not double-counted
|
|
188
|
+
* to the store so retried team charges are not double-counted.
|
|
196
189
|
*/
|
|
197
|
-
deductTeam(teamId: string, userId: string, metrics: UsageMetrics,
|
|
190
|
+
deductTeam(teamId: string, userId: string, metrics: UsageMetrics, options?: DeductTeamOptions): Promise<TeamDeductionResult>;
|
|
198
191
|
private runSweep;
|
|
199
192
|
/**
|
|
200
193
|
* Sweep expired credits from all users' balances.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/credits/service.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/credits/service.ts"],"names":[],"mappings":"AAAA,OAAO,O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