@stewardhq/sdk 0.3.0 → 0.5.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 +122 -92
- package/dist/_chunks/errors.js +1 -1
- package/dist/_chunks/events.d.ts +301 -4
- package/dist/_chunks/events.js +995 -17
- package/dist/_chunks/index.d.ts +3129 -63
- package/dist/_chunks/locale.d.ts +269 -1
- package/dist/_chunks/src.js +807 -25
- package/dist/_chunks/validators.d.ts +45 -1
- package/dist/_chunks/validators.js +128 -27
- package/dist/contract.d.ts +4 -4
- package/dist/contract.js +4 -4
- package/dist/index.d.ts +436 -22
- package/dist/index.js +1659 -26
- package/dist/server.d.ts +44 -6
- package/dist/server.js +29 -2
- package/package.json +2 -7
- package/dist/_chunks/steward.d.ts +0 -189
- package/dist/_chunks/steward.js +0 -564
- package/dist/testing/fixtures/events/LOCK.json +0 -27
- package/dist/testing/fixtures/events/account.deleted.json +0 -36
- package/dist/testing/fixtures/events/account.state_changed.json +0 -53
- package/dist/testing/fixtures/events/account.updated.json +0 -37
- package/dist/testing/fixtures/events/checkout.completed.json +0 -36
- package/dist/testing/fixtures/events/checkout.expired.json +0 -26
- package/dist/testing/fixtures/events/checkout.failed.json +0 -27
- package/dist/testing/fixtures/events/invoice.created.json +0 -37
- package/dist/testing/fixtures/events/invoice.issued.json +0 -38
- package/dist/testing/fixtures/events/invoice.voided.json +0 -39
- package/dist/testing/fixtures/events/subscription.activated.json +0 -40
- package/dist/testing/fixtures/events/subscription.cancel_scheduled.json +0 -38
- package/dist/testing/fixtures/events/subscription.canceled.json +0 -29
- package/dist/testing/fixtures/events/subscription.expired.json +0 -27
- package/dist/testing/fixtures/events/subscription.payment_failed.json +0 -38
- package/dist/testing/fixtures/events/subscription.reactivated.json +0 -36
- package/dist/testing/fixtures/events/subscription.renewed.json +0 -39
- package/dist/testing/fixtures/events/subscription.suspended.json +0 -36
- package/dist/testing/fixtures/events/subscription.terminated.json +0 -28
- package/dist/testing.d.ts +0 -656
- package/dist/testing.js +0 -3684
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { $ as Branding, $n as CancelSubscriptionInputSchema, $r as PriceDef, $t as PlanSetWarningSchema, A as buildDoctorReport, An as InvoiceIssueResponse, Ar as CheckoutSessionSchema, At as EmailTemplate, B as WebhookEndpointCreateInputSchema, Bn as InvoiceLineSchema, Br as AccountsRefreshResultSchema, Bt as emailTemplateOf, C as DoctorSeveritySchema, Cn as GrantCreateResponse, Cr as CheckoutReturnStatus, Ct as EmailLocale, D as DoctorWarning, Dn as HEADER_IDEMPOTENCY_KEY, Dr as CheckoutSessionCreateParsed, Dt as EmailSettingsPatch, E as DoctorUnsellableReason, En as HEADER_API_VERSION, Er as CheckoutSessionCreateInputSchema, Et as EmailSettings, F as EventTypeSchema, Fn as ManualInvoiceResponseSchema, Fr as MAX_CHECKOUT_CONSENT_DOCS, Ft as NotificationEmailsSchema, G as WebhookEndpointSchema, Gn as MANUAL_INVOICE_MAX_AMOUNT_MINOR, Gr as CatalogSyncResult, Gt as PlanSetInput, H as WebhookEndpointListSchema, Hn as InvoiceStatusSchema, Hr as CatalogSchema, Ht as isEmailRelevant, I as WEBHOOK_ENDPOINT_STATUSES, In as Invoice, Ir as ProviderPayload, It as applyEmailSettingsPatch, J as WebhookLastDelivery, Jn as ManualInvoiceLineInput, Jr as FeatureDefSchema, Jt as PlanSetModeSchema, K as WebhookEndpointStatus, Kn as ManualInvoiceInput, Kr as CatalogSyncResultSchema, Kt as PlanSetInputSchema, L as WEBHOOK_SECRET_PREFIX, Ln as InvoiceIssueInput, Lr as ProviderPayloadSchema, Lt as billingPageUrl, M as endpointDiagnosisOf, Mn as InvoiceVoidResponse, Mr as CheckoutStatusSchema, Mt as EmailTemplateSettings, N as hostedReadinessOf, Nn as InvoiceVoidResponseSchema, Nr as Consent, Nt as EmailTemplateSettingsSchema, O as DoctorWarningCode, On as HEADER_REQUEST_ID, Or as CheckoutSessionCreated, Ot as EmailSettingsPatchSchema, P as DEFAULT_ENDPOINT_EVENT_TYPES, Pn as ManualInvoiceResponse, Pr as ConsentSchema, Pt as MAX_NOTIFICATION_EMAILS, Q as webhookEndpointUrlProblem, Qn as CancelSubscriptionInput, Qr as Price, Qt as PlanSetWarningCode, R as WebhookEndpoint, Rn as InvoiceIssueInputSchema, Rr as checkoutRedirectUrl, Rt as emailLocaleOf, S as DoctorSeverity, Si as MetadataSchema, Sn as CheckoutSessionResponseSchema, Sr as CheckoutRedirectTarget, St as EmailExtraTextSchema, T as DoctorUnsellablePriceSchema, Tn as HEADER_ACTOR_REF, Tr as CheckoutSessionCreateInput, Tt as EmailSenderSchema, U as WebhookEndpointRotateInput, Un as InvoiceVoidInput, Ur as CatalogSyncInput, Ut as uniqueEmails, V as WebhookEndpointList, Vn as InvoiceSchema, Vr as Catalog, Vt as emailTemplateSettings, W as WebhookEndpointRotateInputSchema, Wn as InvoiceVoidInputSchema, Wr as CatalogSyncInputSchema, Wt as PLAN_SET_MODES, X as WebhookSecretSchema, Xn as manualInvoiceTotals, Xr as PlanDef, Xt as PlanSetResponseSchema, Y as WebhookLastDeliverySchema, Yn as ManualInvoiceLineInputSchema, Yr as FeatureTypeSchema, Yt as PlanSetResponse, Z as generateWebhookSecret, Zn as splitInclusiveTax, Zr as PlanDefSchema, Zt as PlanSetWarning, _ as DoctorProviderSchema, _i as ErrorResponseSchema, _n as AccountUpsertResponse, _r as CheckoutConsentInput, _t as BILLING_PATH_PLACEHOLDERS, a as DOCTOR_SEVERITIES, ai as CodeSchema, an as ResolveEntitlementsInput, ar as PaymentSchema, at as ProductSettingsPatch, b as DoctorSettings, bi as Interval, bn as CancelSubscriptionResponseSchema, br as CheckoutPrefill, bt as EMAIL_TEMPLATES, c as DoctorEmails, ci as DateTimeSchema, cn as isLiveSubscriptionStatus, cr as Subscription, ct as ReturnOriginSchema, d as DoctorEndpointDiagnosis, di as EntitlementValueSchema, dn as ErrorCode, dr as PortalSession, dt as SettingsLocaleSchema, ei as PriceDefSchema, en as ResyncResult, er as Grant, et as BrandingPatchSchema, f as DoctorEndpointSchema, fi as Entitlements, fn as ErrorCodeSpec, fr as PortalSessionCreateInput, ft as TtlMinutesSchema, g as DoctorProvider, gi as ErrorResponse, gn as AccountDetailSchema, gr as CHECKOUT_ERRORS, gt as returnOriginsOf, h as DoctorHostedSchema, hi as ErrorCategorySchema, hn as AccountDetail, hr as PortalSessionSchema, ht as isReturnUrlAllowed, i as DOCTOR_REQUIRED_LEGAL_LINKS, ii as AmountMinorSchema, in as LIVE_SUBSCRIPTION_STATUSES, ir as Payment, it as ProductSettings, j as emailReadinessOf, jn as InvoiceIssueResponseSchema, jr as CheckoutStatus, jt as EmailTemplateSchema, k as DoctorWarningSchema, kn as HEADER_SDK, kr as CheckoutSessionCreatedSchema, kt as EmailSettingsSchema, l as DoctorEmailsSchema, li as ERROR_CATEGORIES, ln as resolveEntitlements, lr as SubscriptionSchema, lt as SETTINGS_LOCALES, m as DoctorHosted, mi as ErrorCategory, mn as isKnownErrorCode, mr as PortalSessionError, mt as applySettingsPatch, n as DOCTOR_PROVIDER_ENVIRONMENTS, ni as API_VERSION, nn as EntitlementRulesCatalog, nr as GrantCreateInputSchema, nt as DEFAULT_CHECKOUT_TTL_MINUTES, o as DoctorCatalog, oi as Currency, on as ResolvedEntitlements, or as Stats, ot as ProductSettingsPatchSchema, p as DoctorFacts, pi as EntitlementsSchema, pn as errorCodeSpec, pr as PortalSessionCreateInputSchema, pt as WebUrlSchema, q as WebhookEndpointStatusSchema, qn as ManualInvoiceInputSchema, qr as FeatureDef, qt as PlanSetMode, r as DOCTOR_REQUIRED_BRANDING, ri as ActorRefSchema, rn as EntitlementRulesGrant, rr as GrantSchema, rt as DEFAULT_PORTAL_TTL_MINUTES, s as DoctorCatalogSchema, si as CurrencySchema, sn as isGrantActive, sr as StatsSchema, st as ProductSettingsSchema, t as DOCTOR_PENDING_BACKLOG_MS, ti as PriceSchema, tn as ResyncResultSchema, tr as GrantCreateInput, tt as BrandingSchema, u as DoctorEndpoint, ui as EntitlementValue, un as ERROR_CODES, ur as PORTAL_SESSION_ERRORS, ut as SettingsLocale, v as DoctorReport, vi as ExternalRefSchema, vn as AccountUpsertResponseSchema, vr as CheckoutConsentInputSchema, vt as BillingPathSchema, w as DoctorUnsellablePrice, wn as GrantCreateResponseSchema, wr as CheckoutSession, wt as EmailRelevanceFacts, x as DoctorSettingsSchema, xi as IntervalSchema, xn as CheckoutSessionResponse, xr as CheckoutPrefillSchema, xt as EMAIL_TEMPLATE_BY_EVENT, y as DoctorReportSchema, yi as IdSchema, yn as CancelSubscriptionResponse, yr as CheckoutError, yt as EMAIL_LOCALES, z as WebhookEndpointCreateInput, zn as InvoiceLine, zr as AccountsRefreshResult, zt as emailRecipients } from "./_chunks/index.js";
|
|
2
|
-
import { A as
|
|
3
|
-
import { n as isValidTckn, r as isValidVkn, t as isE164 } from "./_chunks/validators.js";
|
|
4
|
-
import { a as
|
|
5
|
-
import { i as httpStatusFor, n as HttpStatusResult, r as StewardLogger, t as StewardLocale } from "./_chunks/locale.js";
|
|
1
|
+
import { $ as WebhookEndpointStatus, $a as CatalogPlanSchema, $i as ManualInvoiceInputSchema, $n as matchesFilter, $o as MAX_METERED_PRICE_PER_UNITS, $r as ErrorCode, $s as canonicalMeterFilter, $t as EmailExtraTextSchema, A as DoctorSeveritySchema, Aa as CheckoutPrefillSchema, Ai as MeResponse, An as PLAN_SET_MODES, Ao as CatalogBenefit, Ar as IngestRejectCode, As as MeterFilterClause, At as PaymentDueDaysSchema, B as hostedReadinessOf, Ba as CheckoutStatus, Bi as InvoiceLineSchema, Bn as ResyncResult, Bo as featureValueMatchesType, Br as FEATURE_FLAG_BENEFIT_TYPE, Bs as MeterPeriod, Bt as WebUrlSchema, C as DoctorProvider, Ca as PortalSessionError, Cc as InvoiceBillingReason, Ci as InvoiceIssueResponseSchema, Cn as emailLocaleOf, Co as BenefitDefSchema, Cr as EventsIngestInput, Cs as MeterCreditEntrySchema, Ct as LateGraceMinutesSchema, D as DoctorSettings, Da as CheckoutConsentInputSchema, Dc as MetadataSchema, Di as InvoiceWaiveResponseSchema, Dn as isEmailRelevant, Do as BenefitSourceSchema, Dr as INGEST_REJECT_CODES, Ds as MeterDefInput, Dt as MeteringSettings, E as DoctorReportSchema, Ea as CheckoutConsentInput, Ec as InvoicePaymentStatusSchema, Ei as InvoiceWaiveResponse, En as emailTemplateSettings, Eo as BenefitFeatureType, Er as EventsIngestResultSchema, Es as MeterDef, Et as MeterChargeModeSchema, F as DoctorWarningCode, Fa as CheckoutSessionCreateInputSchema, Fi as UncancelSubscriptionResponseSchema, Fn as PlanSetResponse, Fo as FeatureFlagProperties, Fr as isEventTimestampInRange, Fs as MeterFilterSchema, Ft as ReturnOriginSchema, G as WebhookEndpoint, Ga as MAX_CHECKOUT_CONSENT_DOCS, Gi as InvoiceSchema, Gn as MeterCreditBenefit, Go as AccountMeters, Gr as ResolvedBenefit, Gs as MeterPeriodStatusSchema, Gt as meteringSettingsOf, H as EventTypeSchema, Ha as Consent, Hi as InvoicePaymentSessionCreateInput, Hn as GrantedMeterCredit, Ho as isMeterCreditBenefit, Hr as OVERRIDE_BENEFIT_SOURCE, Hs as MeterPeriodListSchema, Ht as billingSettingsOf, I as DoctorWarningSchema, Ia as CheckoutSessionCreateParsed, Ii as Invoice, In as PlanSetResponseSchema, Io as FeatureFlagPropertiesSchema, Ir as BenefitRulesDefinition, Is as MeterFilterValue, It as SETTINGS_LOCALES, J as WebhookEndpointList, Ja as checkoutRedirectUrl, Ji as InvoiceVoidInputSchema, Jn as MeterRulesMeter, Jo as CatalogMeterSchema, Jr as isGrantActive, Js as MeterUnitsSchema, Jt as BillingPathSchema, K as WebhookEndpointCreateInput, Ka as ProviderPayload, Ki as InvoiceStatusSchema, Kn as MeterCreditsOptions, Ko as AccountMetersSchema, Kr as ResolvedBenefits, Ks as MeterStanding, Kt as returnOriginsOf, L as buildDoctorReport, La as CheckoutSessionCreated, Li as InvoiceIssueInput, Ln as PlanSetWarning, Lo as MeterCreditAccountBenefit, Lr as BenefitRulesSubscription, Ls as MeterLabel, Lt as SettingsLocale, M as DoctorUnsellablePriceSchema, Ma as CheckoutReturnStatus, Mi as STEWARD_CAPABILITIES, Mn as PlanSetInputSchema, Mo as FeatureFlagAccountBenefit, Mr as IngestRejection, Ms as MeterFilterGroup, Mt as ProductSettingsPatch, N as DoctorUnsellableReason, Na as CheckoutSession, Ni as StewardCapability, Nn as PlanSetMode, No as FeatureFlagBenefitDef, Nr as IngestRejectionSchema, Ns as MeterFilterOperand, Nt as ProductSettingsPatchSchema, O as DoctorSettingsSchema, Oa as CheckoutError, Oi as ManualInvoiceResponse, On as liveSubscriptionOf, Oo as BenefitType, Or as IngestEvent, Os as MeterDefSchema, Ot as MeteringSettingsPatchSchema, P as DoctorWarning, Pa as CheckoutSessionCreateInput, Pi as UncancelSubscriptionResponse, Pn as PlanSetModeSchema, Po as FeatureFlagBenefitDefSchema, Pr as hasControlCharacters, Ps as MeterFilterOperator, Pt as ProductSettingsSchema, Q as WebhookEndpointSchema, Qa as CatalogPlan, Qi as ManualInvoiceInput, Qn as contributionOf, Qo as DecimalUnitsStringSchema, Qr as ERROR_CODES, Qs as MeteredPriceSchema, Qt as EMAIL_TEMPLATE_BY_EVENT, R as emailReadinessOf, Ra as CheckoutSessionCreatedSchema, Ri as InvoiceIssueInputSchema, Rn as PlanSetWarningCode, Ro as MeterCreditBenefitDef, Rr as EntitlementRulesCatalog, Rs as MeterLabelSchema, Rt as SettingsLocaleSchema, S as DoctorOverageSchema, Sa as PortalSessionCreateInputSchema, Sc as IntervalSchema, Si as InvoiceIssueResponse, Sn as billingPageUrl, So as BenefitDef, Sr as EventNameSchema, Ss as MeterCreditEntryKindSchema, St as EventsSettingsSchema, T as DoctorReport, Ta as CHECKOUT_ERRORS, Tc as InvoicePaymentStatus, Ti as InvoiceVoidResponseSchema, Tn as emailTemplateOf, To as BenefitDescriptionSchema, Tr as EventsIngestResult, Ts as MeterCreditPropertiesSchema, Tt as MeterChargeMode, U as WEBHOOK_ENDPOINT_STATUSES, Ua as ConsentSchema, Ui as InvoicePaymentSessionCreateInputSchema, Un as MeterChargeTotalsLine, Uo as AccountMeter, Ur as ResolveBenefitsInput, Us as MeterPeriodSchema, Ut as eventsSettingsOf, V as DEFAULT_ENDPOINT_EVENT_TYPES, Va as CheckoutStatusSchema, Vi as InvoicePaymentSession, Vn as ResyncResultSchema, Vo as isFeatureFlagBenefit, Vr as LIVE_SUBSCRIPTION_STATUSES, Vs as MeterPeriodList, Vt as applySettingsPatch, W as WEBHOOK_SECRET_PREFIX, Wa as INDIVIDUAL_IDENTITY_PLACEHOLDER, Wi as InvoicePaymentSessionSchema, Wn as MeterContribution, Wo as AccountMeterSchema, Wr as ResolveEntitlementsInput, Ws as MeterPeriodStatus, Wt as isReturnUrlAllowed, X as WebhookEndpointRotateInput, Xa as AccountsRefreshResultSchema, Xi as InvoiceWaiveInputSchema, Xn as addUtcMonths, Xo as CreditGrantInputSchema, Xr as resolveBenefits, Xs as MeteredPriceDef, Xt as EMAIL_PAYLOAD_SCHEMAS, Y as WebhookEndpointListSchema, Ya as AccountsRefreshResult, Yi as InvoiceWaiveInput, Yn as OverageRateInput, Yo as CreditGrantInput, Yr as isLiveSubscriptionStatus, Ys as MeteredPrice, Yt as EMAIL_LOCALES, Z as WebhookEndpointRotateInputSchema, Za as Catalog, Zi as MANUAL_INVOICE_MAX_AMOUNT_MINOR, Zn as consumptionOf, Zo as DEFAULT_METER_LOW_AT, Zr as resolveEntitlements, Zs as MeteredPriceDefSchema, Zt as EMAIL_TEMPLATES, _ as DoctorEventsSchema, _a as SubscriptionChangeInputSchema, _c as ExternalRefSchema, _i as HEADER_ACTOR_REF, _n as PriceChangeNoticeEmail, _o as PriceDefSchema, _r as EventMetadata, _s as MeterChargeSchema, _t as DEFAULT_PAYMENT_DUE_DAYS, a as DOCTOR_ROLLUP_LAG_WARN_SECONDS, aa as CancelSubscriptionInputSchema, ac as Currency, ai as AccountUpsertResponse, an as EmailSettingsPatchSchema, ao as FeatureDef, ar as rateOverage, as as METER_FILTER_MAX_DEPTH, at as webhookEndpointUrlProblem, b as DoctorHostedSchema, ba as PortalSession, bc as IdSchema, bi as HEADER_REQUEST_ID, bn as PriceChangeNoticeMeteredRateSchema, bo as AccountBenefitSchema, br as EventMetadataValue, bs as MeterCreditEntry, bt as EventsSettings, c as DoctorBillingSchema, ca as GrantCreateInputSchema, cc as ERROR_CATEGORIES, ci as CancelSubscriptionResponseSchema, cn as EmailTemplateSchema, co as MAX_CATALOG_BENEFITS, cr as EVENTS_INGEST_MAX_BYTES, cs as METER_STANDINGS, ct as BillingSettingsSchema, d as DoctorEmails, da as Payment, dc as Entitlements, di as CheckoutSessionResponse, dn as InvoicePaymentDueEmail, do as MAX_PLAN_BENEFITS, dr as EVENT_METADATA_MAX_PAIRS, ds as MeterAggregationSchema, dt as BrandingSchema, ea as ManualInvoiceLineInput, ec as meterFilterClauseOf, ei as ErrorCodeSpec, en as EmailLocale, eo as CatalogSchema, er as meterChargeTotals, es as MAX_METER_UNITS, et as WebhookEndpointStatusSchema, f as DoctorEmailsSchema, fa as PaymentSchema, fc as EntitlementsSchema, fi as CheckoutSessionResponseSchema, fn as InvoicePaymentDueEmailSchema, fo as METERED_PRICE_TAX_MISMATCH, fr as EVENT_METADATA_STRING_MAX_LENGTH, fs as MeterCharge, ft as DEFAULT_CHECKOUT_TTL_MINUTES, g as DoctorEvents, ga as SubscriptionChangeInput, gc as ErrorResponseSchema, gi as GrantCreateResponseSchema, gn as NotificationEmailsSchema, go as PriceDef, gr as EventExternalIdSchema, gs as MeterChargeListSchema, gt as DEFAULT_MIN_INVOICE_MINOR, h as DoctorEndpointSchema, ha as Subscription, hc as ErrorResponse, hi as GrantCreateResponse, hn as NoticedMeteredRateSchema, ho as Price, hr as EVENT_TIMESTAMP_MAX_SKEW_MINUTES, hs as MeterChargeList, ht as DEFAULT_METER_CHARGE_MODE, i as DOCTOR_REQUIRED_LEGAL_LINKS, ia as CancelSubscriptionInput, ic as CodeSchema, ii as AccountDetailSchema, in as EmailSettingsPatch, io as CatalogSyncResultSchema, ir as periodBoundsOf, is as METER_FILTER_MAX_CONDITIONS, it as generateWebhookSecret, j as DoctorUnsellablePrice, ja as CheckoutRedirectTarget, ji as MeResponseSchema, jn as PlanSetInput, jo as CatalogBenefitSchema, jr as IngestRejectCodeSchema, js as MeterFilterCondition, jt as ProductSettings, k as DoctorSeverity, ka as CheckoutPrefill, ki as ManualInvoiceResponseSchema, kn as uniqueEmails, ko as BenefitTypeSchema, kr as IngestEventSchema, ks as MeterFilter, kt as MeteringSettingsSchema, l as DoctorCatalog, la as GrantSchema, lc as EntitlementValue, li as ChangeSubscriptionResponse, ln as EmailTemplateSettings, lo as MAX_CATALOG_METERED_PRICES, lr as EVENTS_INGEST_MAX_EVENTS, ls as MeterAggregation, lt as Branding, m as DoctorEndpointDiagnosis, ma as StatsSchema, mc as ErrorCategorySchema, mi as CreditGrantResponseSchema, mn as NoticedMeteredRate, mo as PlanDefSchema, mr as EVENT_TIMESTAMP_MAX_AGE_DAYS, ms as MeterChargeLineSchema, mt as DEFAULT_LATE_GRACE_MINUTES, n as DOCTOR_PROVIDER_ENVIRONMENTS, na as manualInvoiceTotals, nc as ActorRefSchema, ni as isKnownErrorCode, nn as EmailSenderSchema, no as CatalogSyncInputSchema, nr as overageCapReached, ns as METER_CHARGE_STATUSES, nt as WebhookLastDeliverySchema, o as DOCTOR_SEVERITIES, oa as Grant, oc as CurrencySchema, oi as AccountUpsertResponseSchema, on as EmailSettingsSchema, oo as FeatureDefSchema, or as rolloverOf, os as METER_FILTER_OPERATORS, ot as BillingSettings, p as DoctorEndpoint, pa as Stats, pc as ErrorCategory, pi as CreditGrantResponse, pn as MAX_NOTIFICATION_EMAILS, po as PlanDef, pr as EVENT_NAME_MAX_LENGTH, ps as MeterChargeLine, pt as DEFAULT_EVENT_RETENTION_DAYS, q as WebhookEndpointCreateInputSchema, qa as ProviderPayloadSchema, qi as InvoiceVoidInput, qn as MeterRulesEvent, qo as CatalogMeter, qr as ResolvedEntitlements, qs as MeterStandingSchema, qt as BILLING_PATH_PLACEHOLDERS, r as DOCTOR_REQUIRED_BRANDING, ra as splitInclusiveTax, rc as AmountMinorSchema, ri as AccountDetail, rn as EmailSettings, ro as CatalogSyncResult, rr as overageOf, rs as METER_CREDIT_ENTRY_KINDS, rt as WebhookSecretSchema, s as DoctorBilling, sa as GrantCreateInput, sc as DateTimeSchema, si as CancelSubscriptionResponse, sn as EmailTemplate, so as FeatureTypeSchema, sr as standingOf, ss as METER_PERIOD_STATUSES, st as BillingSettingsPatchSchema, t as DOCTOR_PENDING_BACKLOG_MS, ta as ManualInvoiceLineInputSchema, tc as API_VERSION, ti as errorCodeSpec, tn as EmailRelevanceFacts, to as CatalogSyncInput, tr as meterCreditsOf, ts as METER_AGGREGATION_KINDS, tt as WebhookLastDelivery, u as DoctorCatalogSchema, ua as MAX_GRANT_BENEFITS, uc as EntitlementValueSchema, ui as ChangeSubscriptionResponseSchema, un as EmailTemplateSettingsSchema, uo as MAX_CATALOG_METERS, ur as EVENT_METADATA_KEY_MAX_LENGTH, us as MeterAggregationKind, ut as BrandingPatchSchema, v as DoctorFacts, va as SubscriptionSchema, vc as INVOICE_BILLING_REASONS, vi as HEADER_API_VERSION, vn as PriceChangeNoticeEmailSchema, vo as PriceSchema, vr as EventMetadataKeySchema, vs as MeterChargeStatus, vt as DEFAULT_PORTAL_TTL_MINUTES, w as DoctorProviderSchema, wa as PortalSessionSchema, wc as InvoiceBillingReasonSchema, wi as InvoiceVoidResponse, wn as emailRecipients, wo as BenefitDescription, wr as EventsIngestInputSchema, ws as MeterCreditProperties, wt as METER_CHARGE_MODES, x as DoctorOverage, xa as PortalSessionCreateInput, xc as Interval, xi as HEADER_SDK, xn as applyEmailSettingsPatch, xo as BENEFIT_TYPES, xr as EventMetadataValueSchema, xs as MeterCreditEntryKind, xt as EventsSettingsPatchSchema, y as DoctorHosted, ya as PORTAL_SESSION_ERRORS, yc as INVOICE_PAYMENT_STATUSES, yi as HEADER_IDEMPOTENCY_KEY, yn as PriceChangeNoticeMeteredRate, yo as AccountBenefit, yr as EventMetadataSchema, ys as MeterChargeStatusSchema, yt as EventRetentionDaysSchema, z as endpointDiagnosisOf, za as CheckoutSessionSchema, zi as InvoiceLine, zn as PlanSetWarningSchema, zo as MeterCreditBenefitDefSchema, zr as EntitlementRulesGrant, zs as MeterLowAtSchema, zt as TtlMinutesSchema } from "./_chunks/index.js";
|
|
2
|
+
import { $ as EntitlementSnapshot, A as AccountMeterState, B as AccountScheduledChange, C as Account, D as AccountDunningStateSchema, E as AccountDunningState, F as AccountOpenCheckoutSchema, G as AccountSubscriptionState, H as AccountSchema, I as AccountOpenInvoice, J as AccountUpsertInputSchema, K as AccountSubscriptionStateSchema, L as AccountOpenInvoiceSchema, M as AccountMetersState, N as AccountMetersStateSchema, O as AccountInclude, P as AccountOpenCheckout, Q as BillingProfileSchema, R as AccountProfileState, S as AccessStateSchema, T as AccountDeleteResponseSchema, U as AccountState, V as AccountScheduledChangeSchema, W as AccountStateSchema, X as BillingProfileInput, Y as BillingProfile, Z as BillingProfileKindSchema, _ as Ping, a as BillingEvent, b as ACCOUNT_INCLUDES, c as EVENT_DETAIL_SCHEMAS, d as EventIdSchema, et as EntitlementSnapshotSchema, f as EventType, g as PING_EVENT_TYPE, h as LegacyEventType, i as ApiVersionSchema, it as SubscriptionSummarySchema, j as AccountMeterStateSchema, k as AccountLocaleSchema, l as EVENT_TYPES, m as LEGACY_EVENT_TYPES, n as AnyBillingEvent, nt as SubscriptionStatusSchema, o as BillingEventOf, p as FULL_STATE_EVENT_TYPES, q as AccountUpsertInput, r as AnyBillingEventSchema, rt as SubscriptionSummary, s as BillingEventSchema, t as AccountStateChangeCause, tt as SubscriptionStatus, u as EventDetail, v as PingSchema, w as AccountDeleteResponse, x as AccessState, y as isEventType, z as AccountProfileStateSchema } from "./_chunks/events.js";
|
|
3
|
+
import { a as MICRO_UNITS_PER_UNIT, c as isMicroPrecise, d as plainDecimalOf, f as toMicroUnits, i as InvalidUnitValueError, l as microToDecimalString, n as isValidTckn, o as UNIT_DECIMALS, r as isValidVkn, s as fromMicroUnits, t as isE164, u as parseMicroUnits } from "./_chunks/validators.js";
|
|
4
|
+
import { a as CatalogRead, c as Steward, d as StewardOptions, f as createSteward, g as AccountStateRead, h as AccountMetersRead, i as httpStatusFor, l as StewardEnv, m as RetryOptions, n as HttpStatusResult, o as InvoiceDocument, p as RetryClass, r as StewardLogger, s as MutationOptions, t as StewardLocale, u as StewardMe } from "./_chunks/locale.js";
|
|
6
5
|
//#region src/catalog.d.ts
|
|
7
6
|
type FeatureType = "limit" | "boolean" | "string";
|
|
8
7
|
export type FeatureSpec<T extends FeatureType = FeatureType> = {
|
|
@@ -22,13 +21,172 @@ export type FeatureValue<F extends FeatureSpec> = F["type"] extends "limit" ? nu
|
|
|
22
21
|
export type FeatureSpecs = Record<string, FeatureSpec>;
|
|
23
22
|
/** Feature listesinin tam, tipli hak nesnesi. */
|
|
24
23
|
export type EntitlementsFor<F extends FeatureSpecs> = { [K in keyof F]: FeatureValue<F[K]>; };
|
|
25
|
-
|
|
24
|
+
/** Feature values a benefit may carry (K4 value types). */
|
|
25
|
+
export type FeatureFlagValues = Readonly<Record<string, EntitlementValue>>;
|
|
26
|
+
/** A `feature_flag` benefit (`featureFlag()`): the catalog feature values it grants. */
|
|
27
|
+
export type FeatureFlagSpec<V extends FeatureFlagValues = FeatureFlagValues> = {
|
|
28
|
+
readonly type: "feature_flag";
|
|
29
|
+
readonly properties: Readonly<V>;
|
|
30
|
+
/** Customer-facing text per locale (hosted checkout and portal "what's included"). */
|
|
31
|
+
readonly description?: BenefitDescription;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* A `meter_credit` benefit (`meterCredit()`, metering phase 2): `units` of the meter granted at
|
|
35
|
+
* the start of every meter period; `rolloverCapUnits` turns rollover on (M5, M6).
|
|
36
|
+
*/
|
|
37
|
+
export type MeterCreditSpec<M extends string = string> = {
|
|
38
|
+
readonly type: "meter_credit";
|
|
39
|
+
readonly properties: {
|
|
40
|
+
readonly meter: M;
|
|
41
|
+
readonly units: number;
|
|
42
|
+
readonly rolloverCapUnits?: number;
|
|
43
|
+
};
|
|
44
|
+
/** Customer-facing text per locale (hosted checkout and portal "what's included"). */
|
|
45
|
+
readonly description?: BenefitDescription;
|
|
46
|
+
};
|
|
47
|
+
/** Benefit definition in `defineCatalog({ benefits })`: `featureFlag()` or `meterCredit()`. */
|
|
48
|
+
export type BenefitSpec = FeatureFlagSpec | MeterCreditSpec;
|
|
49
|
+
export type BenefitSpecs = Record<string, BenefitSpec>;
|
|
50
|
+
export type BenefitOptions = {
|
|
51
|
+
description?: BenefitDescription;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* A `feature_flag` benefit: feature key → value it grants, e.g. `featureFlag({ sso: true })`.
|
|
55
|
+
* Keys are catalog features and values follow the feature's type (checked by `defineCatalog`).
|
|
56
|
+
*/
|
|
57
|
+
export declare function featureFlag<V extends Record<string, EntitlementValue>>(properties: V, options?: BenefitOptions): FeatureFlagSpec<V>;
|
|
58
|
+
export type MeterCreditOptions = {
|
|
59
|
+
/** Units granted per meter period; at most 6 decimals. */
|
|
60
|
+
units: number;
|
|
61
|
+
/** Carry unused credit into the next period, at most `capUnits` (M6). Absent: unused credit expires. */
|
|
62
|
+
rollover?: {
|
|
63
|
+
capUnits: number;
|
|
64
|
+
};
|
|
65
|
+
description?: BenefitDescription;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* A `meter_credit` benefit (metering phase 2, M5): `meterCredit("ai_tokens", { units: 50_000 })`,
|
|
69
|
+
* optionally `rollover: { capUnits }`. The meter must be a catalog meter (checked by `defineCatalog`);
|
|
70
|
+
* units may be decimals with at most 6 places.
|
|
71
|
+
*/
|
|
72
|
+
export declare function meterCredit<const M extends string>(meter: M, options: MeterCreditOptions): MeterCreditSpec<M>;
|
|
73
|
+
/** The value types a benefit must use: an undefined feature key or meter expects `never`. */
|
|
74
|
+
type CheckedBenefit<S, F extends FeatureSpecs, M extends string> = S extends FeatureFlagSpec<infer V> ? FeatureFlagSpec<{ [K in keyof V]: K extends keyof F ? FeatureValue<F[K]> : never; }> : S extends MeterCreditSpec<infer C> ? MeterCreditSpec<C extends M ? C : never> : BenefitSpec;
|
|
75
|
+
type CheckedBenefits<Bs, F extends FeatureSpecs, M extends string> = { [K in keyof Bs]: CheckedBenefit<Bs[K], F, M>; };
|
|
76
|
+
/** Benefit codes of a `benefits` map. */
|
|
77
|
+
export type BenefitCodeOf<Bs> = Extract<keyof Bs, string>;
|
|
78
|
+
/**
|
|
79
|
+
* Aggregations (M4): `count()` events, `sum(key)` / `max(key)` of the finite, non-negative number
|
|
80
|
+
* at `metadata.<key>` (decimals allowed), `unique(key)` distinct values at `metadata.<key>`.
|
|
81
|
+
*/
|
|
82
|
+
export declare const count: () => MeterAggregation;
|
|
83
|
+
export declare const sum: (key: string) => MeterAggregation;
|
|
84
|
+
export declare const max: (key: string) => MeterAggregation;
|
|
85
|
+
export declare const unique: (key: string) => MeterAggregation;
|
|
86
|
+
/** A filter property: the event `name` or `metadata.<key>`. */
|
|
87
|
+
export type MeterFilterProperty = "name" | `metadata.${string}`;
|
|
88
|
+
type NameOperand = string | {
|
|
89
|
+
readonly eq: string;
|
|
90
|
+
} | {
|
|
91
|
+
readonly ne: string;
|
|
92
|
+
} | {
|
|
93
|
+
readonly like: string;
|
|
94
|
+
} | {
|
|
95
|
+
readonly not_like: string;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Meter filter in the contract's `MeterFilterSchema` syntax, with its shorthands:
|
|
99
|
+
* `{ name: "api.request" }` (a bare value is `eq`), `{ "metadata.status": { lt: 500 } }` (one
|
|
100
|
+
* operator of `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `like`, `not_like`), `{ and: [...] }`,
|
|
101
|
+
* `{ or: [...] }` (≤ 3 deep, ≤ 20 conditions). One property per condition.
|
|
102
|
+
*/
|
|
103
|
+
export type MeterFilterSpec = {
|
|
104
|
+
readonly and: readonly MeterFilterSpec[];
|
|
105
|
+
} | {
|
|
106
|
+
readonly or: readonly MeterFilterSpec[];
|
|
107
|
+
} | {
|
|
108
|
+
readonly name: NameOperand;
|
|
109
|
+
} | {
|
|
110
|
+
readonly [property: `metadata.${string}`]: MeterFilterValue | MeterFilterOperand;
|
|
111
|
+
};
|
|
112
|
+
/** A meter (`meter()`); `E` is the `event` shorthand's name (`never` without it). */
|
|
113
|
+
export type MeterSpec<E extends string = string> = {
|
|
114
|
+
/** Shorthand: only events with this name; with `filter`, both must hold. */
|
|
115
|
+
readonly event?: E;
|
|
116
|
+
readonly filter?: MeterFilterSpec;
|
|
117
|
+
readonly aggregation: MeterAggregation;
|
|
118
|
+
/** Customer-facing name per locale (hosted checkout and portal). */
|
|
119
|
+
readonly label: MeterLabel;
|
|
120
|
+
/** Unit name per locale, e.g. `{ tr: "token", en: "tokens" }`. */
|
|
121
|
+
readonly unitLabel?: MeterLabel;
|
|
122
|
+
/** Display divisor on hosted pages, e.g. 1000 → "12.5K" (display only). */
|
|
123
|
+
readonly displayPer?: number;
|
|
124
|
+
/** Share of the credit at which standing becomes `low` (0 < x ≤ 1; default 0.8; `null` disables `low`). */
|
|
125
|
+
readonly lowAt?: number | null;
|
|
126
|
+
};
|
|
127
|
+
export type MeterSpecs = Record<string, MeterSpec>;
|
|
128
|
+
type MeterFields<E extends string> = {
|
|
129
|
+
event?: E;
|
|
130
|
+
filter?: MeterFilterSpec;
|
|
131
|
+
aggregate: MeterAggregation;
|
|
132
|
+
label: MeterLabel;
|
|
133
|
+
unitLabel?: MeterLabel;
|
|
134
|
+
displayPer?: number;
|
|
135
|
+
lowAt?: number | null;
|
|
136
|
+
};
|
|
137
|
+
/** `meter()` options: `event` and/or `filter` is required. */
|
|
138
|
+
export type MeterOptions<E extends string = never> = MeterFields<E> & ({
|
|
139
|
+
event: E;
|
|
140
|
+
} | {
|
|
141
|
+
filter: MeterFilterSpec;
|
|
142
|
+
});
|
|
143
|
+
/**
|
|
144
|
+
* A meter: a saved filter over the product's events plus an aggregation (M4), e.g.
|
|
145
|
+
* `meter({ event: "ai.completion", aggregate: sum("tokens"), label: { tr: "AI token", en: "AI tokens" } })`.
|
|
146
|
+
* Filter and aggregation lock once the meter's first period opened (a change means a new code).
|
|
147
|
+
*/
|
|
148
|
+
export declare function meter<const E extends string>(options: MeterFields<E> & {
|
|
149
|
+
event: E;
|
|
150
|
+
}): MeterSpec<E>;
|
|
151
|
+
export declare function meter(options: MeterFields<never> & {
|
|
152
|
+
filter: MeterFilterSpec;
|
|
153
|
+
}): MeterSpec<never>;
|
|
154
|
+
/** Meter codes of a `meters` map. */
|
|
155
|
+
export type MeterCodeOf<Ms> = Extract<keyof Ms, string>;
|
|
156
|
+
/** Event names of the meters' `event` shorthands (`typeof catalog.$event`). */
|
|
157
|
+
export type MeterEventOf<Ms> = { [K in keyof Ms]: Ms[K] extends {
|
|
158
|
+
readonly event?: infer E;
|
|
159
|
+
} ? Extract<E, string> : never; }[keyof Ms];
|
|
160
|
+
/** No meters (a catalog without `meters`). */
|
|
161
|
+
export type NoMeters = Record<never, never>;
|
|
162
|
+
/**
|
|
163
|
+
* Metered price (MF5, M20): overage above the credit is billed `amountMinor` per `perUnits` units
|
|
164
|
+
* ("₺12,50 / 1.000 token" = `{ amountMinor: 1_250, perUnits: 1_000 }`); tax terms equal the
|
|
165
|
+
* plan's base price in that currency; `capMinor` caps the overage amount per meter period.
|
|
166
|
+
*/
|
|
167
|
+
export type MeteredPriceSpec<P extends string, M extends string> = {
|
|
168
|
+
plan: P;
|
|
169
|
+
meter: M;
|
|
170
|
+
currency: string;
|
|
171
|
+
amountMinor: number;
|
|
172
|
+
perUnits: number;
|
|
173
|
+
taxInclusive: boolean;
|
|
174
|
+
/** Basis points: 20% = 2000. */
|
|
175
|
+
taxRateBps: number;
|
|
176
|
+
capMinor?: number;
|
|
177
|
+
};
|
|
178
|
+
export type PlanSpec<F extends FeatureSpecs, B extends string = never> = {
|
|
26
179
|
name: string;
|
|
27
|
-
/**
|
|
28
|
-
|
|
180
|
+
/**
|
|
181
|
+
* Yükseltme/düşürme sırası: büyük olan üst plan. Optional since billing core (M35): the benefits
|
|
182
|
+
* resolution does not read it; omitted = 0.
|
|
183
|
+
*/
|
|
184
|
+
rank?: number;
|
|
29
185
|
/** Self-servis satın alınabilir mi (false: yalnızca grant ile). */
|
|
30
186
|
sellable: boolean;
|
|
31
187
|
entitlements: EntitlementsFor<F>;
|
|
188
|
+
/** Codes of catalog `benefits` the plan includes, in display order. */
|
|
189
|
+
benefits?: readonly B[];
|
|
32
190
|
};
|
|
33
191
|
export type PriceSpec<P extends string> = {
|
|
34
192
|
plan: P;
|
|
@@ -40,11 +198,19 @@ export type PriceSpec<P extends string> = {
|
|
|
40
198
|
/** Baz puan: %20 = 2000. */
|
|
41
199
|
taxRateBps: number;
|
|
42
200
|
};
|
|
43
|
-
|
|
201
|
+
/** No benefits (a catalog without `benefits`). */
|
|
202
|
+
export type NoBenefits = Record<never, never>;
|
|
203
|
+
export type CatalogDefinition<F extends FeatureSpecs, P extends string, Bs extends BenefitSpecs = NoBenefits, Ms extends MeterSpecs = NoMeters> = {
|
|
44
204
|
defaultPlan: NoInfer<P>;
|
|
45
205
|
features: F;
|
|
46
|
-
|
|
206
|
+
/** Reusable benefits by code (`featureFlag()`, `meterCredit()`), listed by `plans.<code>.benefits`. */
|
|
207
|
+
benefits?: Bs & CheckedBenefits<NoInfer<Bs>, NoInfer<F>, NoInfer<MeterCodeOf<Ms>>>;
|
|
208
|
+
/** Meters by code (`meter()`; metering phase 2). */
|
|
209
|
+
meters?: Ms;
|
|
210
|
+
plans: { [K in P]: PlanSpec<NoInfer<F>, NoInfer<BenefitCodeOf<Bs>>>; };
|
|
47
211
|
prices: readonly PriceSpec<NoInfer<P>>[];
|
|
212
|
+
/** Metered prices (metering phase 2, MF5); omit for a credits-only plan. */
|
|
213
|
+
meteredPrices?: readonly MeteredPriceSpec<NoInfer<P>, NoInfer<MeterCodeOf<Ms>>>[];
|
|
48
214
|
};
|
|
49
215
|
/** `resolve` girdisi: `AccountState`/`EntitlementSnapshot` ya da projeksiyon satırı. */
|
|
50
216
|
export type EntitlementSource = {
|
|
@@ -62,18 +228,45 @@ export type CatalogResolveOptions = {
|
|
|
62
228
|
/** Snapshot'ta eksik ya da tipi uymayan anahtarlar (yedek değer kullanıldı); ALARM için. */
|
|
63
229
|
onFallback?: (keys: string[]) => void;
|
|
64
230
|
};
|
|
65
|
-
|
|
231
|
+
/**
|
|
232
|
+
* A granted benefit whose `code` suggests the catalog's codes (`typeof catalog.$benefit`). The set
|
|
233
|
+
* stays open: steward may already know a benefit this build of the catalog does not (catalog pushed
|
|
234
|
+
* before the product deployed), so any string is accepted.
|
|
235
|
+
*/
|
|
236
|
+
export type CatalogAccountBenefit<B extends string = string> = Omit<AccountBenefit, "code"> & {
|
|
237
|
+
code: B | (string & Record<never, never>) | null;
|
|
238
|
+
};
|
|
239
|
+
/** `AccountState` with `benefits[].code` typed by the catalog (see `CatalogAccountBenefit`). */
|
|
240
|
+
export type CatalogAccountState<B extends string = string> = Omit<AccountState, "benefits"> & {
|
|
241
|
+
benefits?: CatalogAccountBenefit<B>[] | undefined;
|
|
242
|
+
};
|
|
243
|
+
export type DefinedCatalog<F extends FeatureSpecs, P extends string, B extends string = never, M extends string = never, E extends string = never> = {
|
|
66
244
|
readonly defaultPlan: P;
|
|
67
245
|
readonly features: Readonly<F>;
|
|
68
|
-
readonly plans: { readonly [K in P]: Readonly<PlanSpec<F>>; };
|
|
246
|
+
readonly plans: { readonly [K in P]: Readonly<PlanSpec<F, B>>; };
|
|
69
247
|
readonly prices: readonly Readonly<PriceSpec<P>>[];
|
|
248
|
+
/** Benefit definitions by code (empty when the catalog defines none). */
|
|
249
|
+
readonly benefits: { readonly [K in B]: Readonly<BenefitSpec>; };
|
|
250
|
+
/** Meter definitions by code, as given to `meter()` (empty when the catalog defines none). */
|
|
251
|
+
readonly meters: { readonly [K in M]: Readonly<MeterSpec>; };
|
|
252
|
+
/** Metered prices (empty when the catalog defines none). */
|
|
253
|
+
readonly meteredPrices: readonly Readonly<MeteredPriceSpec<P, M>>[];
|
|
70
254
|
/** Yalnızca tip (`typeof catalog.$plan`); çalışma zamanında `undefined`. */
|
|
71
255
|
readonly $plan: P;
|
|
72
256
|
/** Yalnızca tip (`typeof catalog.$entitlements`); çalışma zamanında `undefined`. */
|
|
73
257
|
readonly $entitlements: EntitlementsFor<F>;
|
|
258
|
+
/** Type only (`typeof catalog.$benefit`, the union of benefit codes; `never` without benefits); `undefined` at runtime. */
|
|
259
|
+
readonly $benefit: B;
|
|
260
|
+
/** Type only (`typeof catalog.$meter`, the union of meter codes; `never` without meters); `undefined` at runtime. */
|
|
261
|
+
readonly $meter: M;
|
|
262
|
+
/** Type only (`typeof catalog.$event`, the union of the meters' `event` shorthands); `undefined` at runtime. */
|
|
263
|
+
readonly $event: E;
|
|
74
264
|
/** `PUT /v1/admin/catalog` gövdesi. */
|
|
75
265
|
toSyncInput(): CatalogSyncInput;
|
|
76
|
-
/**
|
|
266
|
+
/**
|
|
267
|
+
* Entitlements of an account on the plan (copy), resolved by the contract's rule
|
|
268
|
+
* (`resolveEntitlements`): the default plan's layer, then the plan's own entitlements and benefits.
|
|
269
|
+
*/
|
|
77
270
|
entitlementsOf(plan: P): EntitlementsFor<F>;
|
|
78
271
|
/**
|
|
79
272
|
* Snapshot → tipli haklar. K4 sonrası tam snapshot her anahtarı taşır; anahtar
|
|
@@ -87,12 +280,15 @@ export type DefinedCatalog<F extends FeatureSpecs, P extends string> = {
|
|
|
87
280
|
/**
|
|
88
281
|
* Katalogdan kurulan tam `AccountState` — steward'dan gelmeyen yer tutucu, `stateCache`
|
|
89
282
|
* `fallback`'i için: `version` 0, `updatedAt` 1970-01-01, `catalogVersion` null, haklar
|
|
90
|
-
* planın katalogdaki değerleri, abonelik ve açık checkout yok, profil yok. `plan`
|
|
283
|
+
* planın katalogdaki değerleri (`entitlementsOf`), abonelik ve açık checkout yok, profil yok. `plan`
|
|
91
284
|
* verilmezse varsayılan plan; katalogda olmayan plan `StewardConfigError` (`unknown_plan`).
|
|
285
|
+
* With meters, `meters` holds every catalog meter: `includedUnits` = the plan's `meter_credit`
|
|
286
|
+
* units (default plan layer + plan, summed; `null` without credit), `billable` = the plan has a
|
|
287
|
+
* metered price for the meter (never on the default plan: no subscription), `standing: "ok"`.
|
|
92
288
|
*/
|
|
93
289
|
stateOf(ref: string, plan?: P, options?: CatalogStateOptions): AccountState;
|
|
94
290
|
};
|
|
95
|
-
export declare function defineCatalog<F extends FeatureSpecs, P extends string>(definition: CatalogDefinition<F, P>): DefinedCatalog<F, P
|
|
291
|
+
export declare function defineCatalog<F extends FeatureSpecs, P extends string, Bs extends BenefitSpecs = NoBenefits, Ms extends MeterSpecs = NoMeters>(definition: CatalogDefinition<F, P, Bs, Ms>): DefinedCatalog<F, P, BenefitCodeOf<Bs>, MeterCodeOf<Ms>, MeterEventOf<Ms>>;
|
|
96
292
|
//#endregion
|
|
97
293
|
//#region src/state-cache.d.ts
|
|
98
294
|
export type StateReadOptions = {
|
|
@@ -128,14 +324,25 @@ export type StateCacheOptions = {
|
|
|
128
324
|
/** Saat, ms (test için). Varsayılan `Date.now`. */
|
|
129
325
|
now?: () => number;
|
|
130
326
|
};
|
|
131
|
-
|
|
132
|
-
|
|
327
|
+
/**
|
|
328
|
+
* State returned by a cache built with a catalog that defines benefits: `benefits[].code` suggests
|
|
329
|
+
* the catalog's codes (`CatalogAccountState`); without benefits (or without a catalog) `AccountState`.
|
|
330
|
+
*/
|
|
331
|
+
export type CachedAccountState<B extends string = never> = [B] extends [never] ? AccountState : CatalogAccountState<B>;
|
|
332
|
+
export type StateCache<E = Entitlements, B extends string = never> = {
|
|
333
|
+
state(ref: string, options?: StateReadOptions): Promise<CachedAccountState<B>>;
|
|
133
334
|
/** `catalog` verildiyse tipli ve tam (`catalog.resolve`), yoksa durumdaki haklar. */
|
|
134
335
|
entitlements(ref: string, options?: StateReadOptions): Promise<E>;
|
|
135
|
-
many(refs: Iterable<string>): Promise<Map<string,
|
|
336
|
+
many(refs: Iterable<string>): Promise<Map<string, CachedAccountState<B>>>;
|
|
136
337
|
invalidate(ref: string): void;
|
|
137
338
|
/** Daha yeni ya da aynı version'daki durumu yazar; `null`/`undefined` yok sayılır (eski steward `account` dönmeyebilir). */
|
|
138
339
|
prime(account: AccountState | null | undefined): void;
|
|
340
|
+
/**
|
|
341
|
+
* The last known state without a request (never reads steward): the value confirmed (read or
|
|
342
|
+
* primed) within `ttlMs + staleIfErrorMs`, else `null`. `Meters()` reads the account's coarse
|
|
343
|
+
* `meters` facts from it when steward is unreachable.
|
|
344
|
+
*/
|
|
345
|
+
peek(ref: string): CachedAccountState<B> | null;
|
|
139
346
|
};
|
|
140
347
|
/** Önbelleğin kullandığı istemci kısmı (`createSteward()` karşılar). */
|
|
141
348
|
export type StateCacheSteward = {
|
|
@@ -145,9 +352,9 @@ export type StateCacheSteward = {
|
|
|
145
352
|
}): Promise<AccountStateRead>;
|
|
146
353
|
};
|
|
147
354
|
};
|
|
148
|
-
export declare function stateCache<F extends FeatureSpecs, P extends string>(steward: StateCacheSteward, options: StateCacheOptions & {
|
|
149
|
-
catalog: DefinedCatalog<F, P>;
|
|
150
|
-
}): StateCache<EntitlementsFor<F
|
|
355
|
+
export declare function stateCache<F extends FeatureSpecs, P extends string, B extends string = never, M extends string = never, E extends string = never>(steward: StateCacheSteward, options: StateCacheOptions & {
|
|
356
|
+
catalog: DefinedCatalog<F, P, B, M, E>;
|
|
357
|
+
}): StateCache<EntitlementsFor<F>, B>;
|
|
151
358
|
export declare function stateCache(steward: StateCacheSteward, options?: StateCacheOptions & {
|
|
152
359
|
catalog?: undefined;
|
|
153
360
|
}): StateCache<Entitlements>;
|
|
@@ -203,4 +410,211 @@ export declare class StewardConfigError extends StewardError {
|
|
|
203
410
|
});
|
|
204
411
|
}
|
|
205
412
|
//#endregion
|
|
206
|
-
|
|
413
|
+
//#region src/events.d.ts
|
|
414
|
+
/** The steward client part `Events()` uses (`createSteward()` fits). */
|
|
415
|
+
export type EventsSteward = {
|
|
416
|
+
events: {
|
|
417
|
+
ingest(input: EventsIngestInput, options?: MutationOptions): Promise<EventsIngestResult>;
|
|
418
|
+
};
|
|
419
|
+
};
|
|
420
|
+
export type TrackOptions = {
|
|
421
|
+
/** Deterministic dedup key, unique within the product (`[A-Za-z0-9_.:-]{8,200}`); default: a generated UUID. */
|
|
422
|
+
externalId?: string;
|
|
423
|
+
/** When it happened (≤ 35 days ago, ≤ 5 minutes ahead); default: the `track()` call. */
|
|
424
|
+
timestamp?: Date | string;
|
|
425
|
+
};
|
|
426
|
+
/** An event for `ingest()`: `IngestEvent` with an optional `externalId` (generated) and `timestamp` (now). */
|
|
427
|
+
export type EventInput = Omit<IngestEvent, "externalId" | "timestamp"> & {
|
|
428
|
+
externalId?: string;
|
|
429
|
+
timestamp?: Date | string;
|
|
430
|
+
};
|
|
431
|
+
/** A per-event rejection of an accepted batch, with the event. */
|
|
432
|
+
export type EventsRejection = IngestRejection & {
|
|
433
|
+
event: IngestEvent;
|
|
434
|
+
};
|
|
435
|
+
export type EventsDropReason = "queue_full" | "invalid_event" | "request_failed";
|
|
436
|
+
export type EventsDropInfo = {
|
|
437
|
+
reason: EventsDropReason;
|
|
438
|
+
/** `invalid_event`: what is wrong; `request_failed`: the error code. */
|
|
439
|
+
message?: string;
|
|
440
|
+
/** `request_failed`: the error. */
|
|
441
|
+
error?: unknown;
|
|
442
|
+
};
|
|
443
|
+
/** An event of the account steward has not counted yet as far as this process knows. */
|
|
444
|
+
export type PendingEvent = {
|
|
445
|
+
readonly event: IngestEvent;
|
|
446
|
+
/** When steward acknowledged it (ms); `null` while queued or in flight. */
|
|
447
|
+
readonly ackedAt: number | null;
|
|
448
|
+
};
|
|
449
|
+
export type EventsOptions<E extends string = never> = {
|
|
450
|
+
steward: EventsSteward;
|
|
451
|
+
/** For typing only: `track` suggests `typeof catalog.$event` (any name is accepted). */
|
|
452
|
+
catalog?: {
|
|
453
|
+
readonly $event: E;
|
|
454
|
+
};
|
|
455
|
+
/** `X-Actor-Ref` of the ingest calls; default: `createSteward({ actorRef })`. */
|
|
456
|
+
actorRef?: string;
|
|
457
|
+
/** Longest wait of a queued event before its batch is sent, ms. Default 2 000. */
|
|
458
|
+
flushIntervalMs?: number;
|
|
459
|
+
/** Events per batch (1–1 000). Default 500. */
|
|
460
|
+
maxBatch?: number;
|
|
461
|
+
/** Most events waiting in memory; beyond it the oldest go to `onDrop`. Default 10 000. */
|
|
462
|
+
maxQueue?: number;
|
|
463
|
+
/** Send in the background (timer, full batch). Default `true`; `false` on the edge (`ctx.waitUntil(events.flush())`). */
|
|
464
|
+
autoFlush?: boolean;
|
|
465
|
+
/** Per-event rejections of an accepted batch (not retried). */
|
|
466
|
+
onRejected?: (rejected: EventsRejection[]) => void;
|
|
467
|
+
/** Events that will not be sent (queue full, invalid, permanent failure). */
|
|
468
|
+
onDrop?: (events: IngestEvent[], info: EventsDropInfo) => void;
|
|
469
|
+
/** Default `console`. */
|
|
470
|
+
logger?: Pick<StewardLogger, "warn">;
|
|
471
|
+
/** Clock, ms (tests). Default `Date.now`. */
|
|
472
|
+
now?: () => number;
|
|
473
|
+
/** Jitter source in [0, 1) (tests). Default `Math.random`. */
|
|
474
|
+
random?: () => number;
|
|
475
|
+
};
|
|
476
|
+
export type EventsClient<E extends string = never> = {
|
|
477
|
+
/** Queue an event (sync, never throws). `name` is free text; the catalog's `event` names are suggested. */
|
|
478
|
+
track(ref: string, name: E | (string & Record<never, never>), metadata?: EventMetadata, options?: TrackOptions): void;
|
|
479
|
+
/** Send everything queued now; resolves when done (never rejects: what failed stays queued). */
|
|
480
|
+
flush(): Promise<void>;
|
|
481
|
+
/** Send events directly (not queued): 1–1 000, one `Idempotency-Key` per call; throws on failure. */
|
|
482
|
+
ingest(events: readonly EventInput[], options?: {
|
|
483
|
+
idempotencyKey?: string;
|
|
484
|
+
}): Promise<EventsIngestResult>;
|
|
485
|
+
/** The account's events steward has not counted yet as far as this process knows (queued, in flight, recently acknowledged). */
|
|
486
|
+
pending(ref: string): readonly PendingEvent[];
|
|
487
|
+
};
|
|
488
|
+
/** How long an acknowledged event stays pending: the meter rollup lags behind ingestion (≤ 10 s target). */
|
|
489
|
+
export declare const EVENTS_RECENT_MS = 60000;
|
|
490
|
+
/** Events tracker (M16); see the comment above. */
|
|
491
|
+
export declare function Events<E extends string = never>(options: EventsOptions<E>): EventsClient<E>;
|
|
492
|
+
//#endregion
|
|
493
|
+
//#region src/meters.d.ts
|
|
494
|
+
/** The steward client part `Meters()` uses (`createSteward()` fits). */
|
|
495
|
+
export type MetersSteward = {
|
|
496
|
+
meters: {
|
|
497
|
+
read(ref: string, options?: {
|
|
498
|
+
etag?: string;
|
|
499
|
+
}): Promise<AccountMetersRead>;
|
|
500
|
+
};
|
|
501
|
+
};
|
|
502
|
+
/** The catalog part `Meters()` uses (`defineCatalog()` fits): meter codes and definitions. */
|
|
503
|
+
export type MetersCatalog<M extends string> = {
|
|
504
|
+
/** Type only. */
|
|
505
|
+
readonly $meter: M;
|
|
506
|
+
toSyncInput(): CatalogSyncInput;
|
|
507
|
+
};
|
|
508
|
+
/** The account state cache part `Meters()` uses (`stateCache()` fits): a lookup without a request. */
|
|
509
|
+
export type MetersCache = {
|
|
510
|
+
peek(ref: string): {
|
|
511
|
+
readonly meters?: AccountMetersState | undefined;
|
|
512
|
+
} | null | undefined;
|
|
513
|
+
};
|
|
514
|
+
/** The events part `Meters()` uses (`Events()` fits). */
|
|
515
|
+
export type MetersPendingEvents = {
|
|
516
|
+
pending(ref: string): readonly PendingEvent[];
|
|
517
|
+
};
|
|
518
|
+
export type MeterSource = "live" | "cached" | "stale" | "fallback";
|
|
519
|
+
/**
|
|
520
|
+
* A meter's open period as this process sees it: steward's values (`AccountMeter`) with this
|
|
521
|
+
* process's pending units added. Units are JSON numbers with at most 6 decimals.
|
|
522
|
+
*/
|
|
523
|
+
export type MeterBalance = {
|
|
524
|
+
/** Open period bounds; `null` for a fallback value. */
|
|
525
|
+
periodStart: string | null;
|
|
526
|
+
periodEnd: string | null;
|
|
527
|
+
/** Credit the account's `meter_credit` benefits grant per period; `null`: no credit (not gated by credit). */
|
|
528
|
+
includedUnits: number | null;
|
|
529
|
+
/** Consumption of the period, pending units included. */
|
|
530
|
+
consumedUnits: number;
|
|
531
|
+
creditedUnits: number;
|
|
532
|
+
/** `creditedUnits − consumedUnits` (negative past the credit). */
|
|
533
|
+
balance: number;
|
|
534
|
+
/** `max(0, consumedUnits − creditedUnits)`. */
|
|
535
|
+
overageUnits: number;
|
|
536
|
+
/** Units of this process's events steward has not counted yet (included above). */
|
|
537
|
+
pendingUnits: number;
|
|
538
|
+
standing: MeterStanding;
|
|
539
|
+
/** Overage is billed (metered price): the gate stays open until `capReached`. */
|
|
540
|
+
billable: boolean;
|
|
541
|
+
/** Steward's estimate of the open period's overage amount (without pending units); `null` unless billable. */
|
|
542
|
+
amountDueMinor: number | null;
|
|
543
|
+
currency: string | null;
|
|
544
|
+
/**
|
|
545
|
+
* The period's overage amount reached the locked rate's cap (steward's value, without pending
|
|
546
|
+
* units): further use is not billed, so `check` denies a billable meter. False when not billable,
|
|
547
|
+
* uncapped, from a fallback value or from an older steward.
|
|
548
|
+
*/
|
|
549
|
+
capReached: boolean;
|
|
550
|
+
source: MeterSource;
|
|
551
|
+
};
|
|
552
|
+
export type MeterCheck = {
|
|
553
|
+
allowed: boolean;
|
|
554
|
+
/** Balance after the pending units (before `units`). */
|
|
555
|
+
balance: number;
|
|
556
|
+
standing: MeterStanding;
|
|
557
|
+
billable: boolean;
|
|
558
|
+
source: MeterSource;
|
|
559
|
+
};
|
|
560
|
+
export type MeterCheckOptions = {
|
|
561
|
+
/** Units the work is about to consume (decimals up to 6 places). Default 1. */
|
|
562
|
+
units?: number;
|
|
563
|
+
/** Skip the TTL (ask steward). */
|
|
564
|
+
fresh?: boolean;
|
|
565
|
+
};
|
|
566
|
+
export type MeterReadOptions = {
|
|
567
|
+
fresh?: boolean;
|
|
568
|
+
};
|
|
569
|
+
/** What an `onUnavailable` function decides on. */
|
|
570
|
+
export type MeterUnavailableContext<M extends string = string> = {
|
|
571
|
+
ref: string;
|
|
572
|
+
meter: M;
|
|
573
|
+
units: number;
|
|
574
|
+
/** The fallback value (catalog or cached state facts, zero consumption, minus pending). */
|
|
575
|
+
balance: MeterBalance;
|
|
576
|
+
/** The error of the failed read (`StewardNetworkError`, `StewardApiError` 5xx/429). */
|
|
577
|
+
error: unknown;
|
|
578
|
+
};
|
|
579
|
+
export type MeterUnavailablePolicy<M extends string = string> = "allow" | "deny" | ((context: MeterUnavailableContext<M>) => boolean);
|
|
580
|
+
export type MeterFallbackEvent = {
|
|
581
|
+
ref: string;
|
|
582
|
+
/** The meter (`check`, `balance`, a meter steward does not report); `null` for `get`. */
|
|
583
|
+
meter: string | null;
|
|
584
|
+
/** The steward error code (`network_error`, `timeout`, `database_unavailable`…) or `meter_not_found`. */
|
|
585
|
+
reason: string;
|
|
586
|
+
};
|
|
587
|
+
export type MetersOptions<M extends string> = {
|
|
588
|
+
steward: MetersSteward;
|
|
589
|
+
catalog: MetersCatalog<M>;
|
|
590
|
+
/** The product's `stateCache`: the account's coarse meter facts for fallback values (read without a request). */
|
|
591
|
+
cache?: MetersCache;
|
|
592
|
+
/** The product's `Events()`: pending units are subtracted. */
|
|
593
|
+
events?: MetersPendingEvents;
|
|
594
|
+
/** Default 10 s. */
|
|
595
|
+
ttlMs?: number;
|
|
596
|
+
/** How long after its last confirmation a value is used while steward is unreachable. Default 10 min. */
|
|
597
|
+
staleIfErrorMs?: number;
|
|
598
|
+
/** `check` when steward is unreachable and no stale value is left. Default `"allow"`. */
|
|
599
|
+
onUnavailable?: MeterUnavailablePolicy<M>;
|
|
600
|
+
/** Every fallback answer (metric). */
|
|
601
|
+
onFallback?: (event: MeterFallbackEvent) => void;
|
|
602
|
+
/** Accounts kept (LRU). Default 10 000. */
|
|
603
|
+
maxEntries?: number;
|
|
604
|
+
/** Default `console`. */
|
|
605
|
+
logger?: Pick<StewardLogger, "warn">;
|
|
606
|
+
/** Clock, ms (tests). Default `Date.now`. */
|
|
607
|
+
now?: () => number;
|
|
608
|
+
};
|
|
609
|
+
export type MetersClient<M extends string> = {
|
|
610
|
+
/** Every catalog meter (and any other meter steward reports) of the account. */
|
|
611
|
+
get(ref: string, options?: MeterReadOptions): Promise<Record<M, MeterBalance>>;
|
|
612
|
+
balance(ref: string, meter: M, options?: MeterReadOptions): Promise<MeterBalance>;
|
|
613
|
+
check(ref: string, meter: M, options?: MeterCheckOptions): Promise<MeterCheck>;
|
|
614
|
+
/** Forget the cached read (the next call asks steward). */
|
|
615
|
+
invalidate(ref: string): void;
|
|
616
|
+
};
|
|
617
|
+
/** Meter reader and gate (M13, M15, M16); see the comment above. */
|
|
618
|
+
export declare function Meters<M extends string>(options: MetersOptions<M>): MetersClient<M>;
|
|
619
|
+
//#endregion
|
|
620
|
+
export { ACCOUNT_INCLUDES, API_VERSION, AccessState, AccessStateSchema, Account, AccountBenefit, AccountBenefitSchema, AccountDeleteResponse, AccountDeleteResponseSchema, AccountDetail, AccountDetailSchema, AccountDunningState, AccountDunningStateSchema, AccountInclude, AccountLocaleSchema, AccountMeter, AccountMeterSchema, AccountMeterState, AccountMeterStateSchema, AccountMeters, type AccountMetersRead, AccountMetersSchema, AccountMetersState, AccountMetersStateSchema, AccountOpenCheckout, AccountOpenCheckoutSchema, AccountOpenInvoice, AccountOpenInvoiceSchema, AccountProfileState, AccountProfileStateSchema, AccountScheduledChange, AccountScheduledChangeSchema, AccountSchema, AccountState, AccountStateChangeCause, type AccountStateRead, AccountStateSchema, AccountSubscriptionState, AccountSubscriptionStateSchema, AccountUpsertInput, AccountUpsertInputSchema, AccountUpsertResponse, AccountUpsertResponseSchema, AccountsRefreshResult, AccountsRefreshResultSchema, ActorRefSchema, AmountMinorSchema, AnyBillingEvent, AnyBillingEventSchema, ApiVersionSchema, BENEFIT_TYPES, BILLING_PATH_PLACEHOLDERS, BenefitDef, BenefitDefSchema, BenefitDescription, BenefitDescriptionSchema, BenefitFeatureType, BenefitRulesDefinition, BenefitRulesSubscription, BenefitSourceSchema, BenefitType, BenefitTypeSchema, BillingEvent, BillingEventOf, BillingEventSchema, BillingPathSchema, BillingProfile, BillingProfileInput, BillingProfileKindSchema, BillingProfileSchema, BillingSettings, BillingSettingsPatchSchema, BillingSettingsSchema, Branding, BrandingPatchSchema, BrandingSchema, CHECKOUT_ERRORS, CancelSubscriptionInput, CancelSubscriptionInputSchema, CancelSubscriptionResponse, CancelSubscriptionResponseSchema, Catalog, CatalogBenefit, CatalogBenefitSchema, CatalogMeter, CatalogMeterSchema, CatalogPlan, CatalogPlanSchema, CatalogRead, CatalogSchema, CatalogSyncInput, CatalogSyncInputSchema, CatalogSyncResult, CatalogSyncResultSchema, ChangeSubscriptionResponse, ChangeSubscriptionResponseSchema, CheckoutConsentInput, CheckoutConsentInputSchema, CheckoutError, CheckoutPrefill, CheckoutPrefillSchema, CheckoutRedirectTarget, CheckoutReturnStatus, CheckoutSession, CheckoutSessionCreateInput, CheckoutSessionCreateInputSchema, CheckoutSessionCreateParsed, CheckoutSessionCreated, CheckoutSessionCreatedSchema, CheckoutSessionResponse, CheckoutSessionResponseSchema, CheckoutSessionSchema, CheckoutStatus, CheckoutStatusSchema, CodeSchema, Consent, ConsentSchema, CreditGrantInput, CreditGrantInputSchema, CreditGrantResponse, CreditGrantResponseSchema, Currency, CurrencySchema, DEFAULT_CHECKOUT_TTL_MINUTES, DEFAULT_ENDPOINT_EVENT_TYPES, DEFAULT_EVENT_RETENTION_DAYS, DEFAULT_LATE_GRACE_MINUTES, DEFAULT_METER_CHARGE_MODE, DEFAULT_METER_LOW_AT, DEFAULT_MIN_INVOICE_MINOR, DEFAULT_PAYMENT_DUE_DAYS, DEFAULT_PORTAL_TTL_MINUTES, DOCTOR_PENDING_BACKLOG_MS, DOCTOR_PROVIDER_ENVIRONMENTS, DOCTOR_REQUIRED_BRANDING, DOCTOR_REQUIRED_LEGAL_LINKS, DOCTOR_ROLLUP_LAG_WARN_SECONDS, DOCTOR_SEVERITIES, DateTimeSchema, DecimalUnitsStringSchema, DoctorBilling, DoctorBillingSchema, DoctorCatalog, DoctorCatalogSchema, DoctorEmails, DoctorEmailsSchema, DoctorEndpoint, DoctorEndpointDiagnosis, DoctorEndpointSchema, DoctorEvents, DoctorEventsSchema, DoctorFacts, DoctorHosted, DoctorHostedSchema, DoctorOverage, DoctorOverageSchema, DoctorProvider, DoctorProviderSchema, DoctorReport, DoctorReportSchema, DoctorSettings, DoctorSettingsSchema, DoctorSeverity, DoctorSeveritySchema, DoctorUnsellablePrice, DoctorUnsellablePriceSchema, DoctorUnsellableReason, DoctorWarning, DoctorWarningCode, DoctorWarningSchema, EMAIL_LOCALES, EMAIL_PAYLOAD_SCHEMAS, EMAIL_TEMPLATES, EMAIL_TEMPLATE_BY_EVENT, ERROR_CATEGORIES, ERROR_CODES, EVENTS_INGEST_MAX_BYTES, EVENTS_INGEST_MAX_EVENTS, EVENT_DETAIL_SCHEMAS, EVENT_METADATA_KEY_MAX_LENGTH, EVENT_METADATA_MAX_PAIRS, EVENT_METADATA_STRING_MAX_LENGTH, EVENT_NAME_MAX_LENGTH, EVENT_TIMESTAMP_MAX_AGE_DAYS, EVENT_TIMESTAMP_MAX_SKEW_MINUTES, EVENT_TYPES, EmailExtraTextSchema, EmailLocale, EmailRelevanceFacts, EmailSenderSchema, EmailSettings, EmailSettingsPatch, EmailSettingsPatchSchema, EmailSettingsSchema, EmailTemplate, EmailTemplateSchema, EmailTemplateSettings, EmailTemplateSettingsSchema, EntitlementRulesCatalog, EntitlementRulesGrant, EntitlementSnapshot, EntitlementSnapshotSchema, EntitlementValue, EntitlementValueSchema, Entitlements, EntitlementsSchema, ErrorCategory, ErrorCategorySchema, ErrorCode, ErrorCodeSpec, ErrorResponse, ErrorResponseSchema, EventDetail, EventExternalIdSchema, EventIdSchema, EventMetadata, EventMetadataKeySchema, EventMetadataSchema, EventMetadataValue, EventMetadataValueSchema, EventNameSchema, EventRetentionDaysSchema, EventType, EventTypeSchema, EventsIngestInput, EventsIngestInputSchema, EventsIngestResult, EventsIngestResultSchema, EventsSettings, EventsSettingsPatchSchema, EventsSettingsSchema, ExternalRefSchema, FEATURE_FLAG_BENEFIT_TYPE, FULL_STATE_EVENT_TYPES, FeatureDef, FeatureDefSchema, FeatureFlagAccountBenefit, FeatureFlagBenefitDef, FeatureFlagBenefitDefSchema, FeatureFlagProperties, FeatureFlagPropertiesSchema, FeatureTypeSchema, Grant, GrantCreateInput, GrantCreateInputSchema, GrantCreateResponse, GrantCreateResponseSchema, GrantSchema, GrantedMeterCredit, HEADER_ACTOR_REF, HEADER_API_VERSION, HEADER_IDEMPOTENCY_KEY, HEADER_REQUEST_ID, HEADER_SDK, HttpStatusResult, INDIVIDUAL_IDENTITY_PLACEHOLDER, INGEST_REJECT_CODES, INVOICE_BILLING_REASONS, INVOICE_PAYMENT_STATUSES, IdSchema, IngestEvent, IngestEventSchema, IngestRejectCode, IngestRejectCodeSchema, IngestRejection, IngestRejectionSchema, Interval, IntervalSchema, InvalidUnitValueError, Invoice, InvoiceBillingReason, InvoiceBillingReasonSchema, InvoiceDocument, InvoiceIssueInput, InvoiceIssueInputSchema, InvoiceIssueResponse, InvoiceIssueResponseSchema, InvoiceLine, InvoiceLineSchema, InvoicePaymentDueEmail, InvoicePaymentDueEmailSchema, InvoicePaymentSession, InvoicePaymentSessionCreateInput, InvoicePaymentSessionCreateInputSchema, InvoicePaymentSessionSchema, InvoicePaymentStatus, InvoicePaymentStatusSchema, InvoiceSchema, InvoiceStatusSchema, InvoiceVoidInput, InvoiceVoidInputSchema, InvoiceVoidResponse, InvoiceVoidResponseSchema, InvoiceWaiveInput, InvoiceWaiveInputSchema, InvoiceWaiveResponse, InvoiceWaiveResponseSchema, LEGACY_EVENT_TYPES, LIVE_SUBSCRIPTION_STATUSES, LateGraceMinutesSchema, LegacyEventType, MANUAL_INVOICE_MAX_AMOUNT_MINOR, MAX_CATALOG_BENEFITS, MAX_CATALOG_METERED_PRICES, MAX_CATALOG_METERS, MAX_CHECKOUT_CONSENT_DOCS, MAX_GRANT_BENEFITS, MAX_METERED_PRICE_PER_UNITS, MAX_METER_UNITS, MAX_NOTIFICATION_EMAILS, MAX_PLAN_BENEFITS, METERED_PRICE_TAX_MISMATCH, METER_AGGREGATION_KINDS, METER_CHARGE_MODES, METER_CHARGE_STATUSES, METER_CREDIT_ENTRY_KINDS, METER_FILTER_MAX_CONDITIONS, METER_FILTER_MAX_DEPTH, METER_FILTER_OPERATORS, METER_PERIOD_STATUSES, METER_STANDINGS, MICRO_UNITS_PER_UNIT, ManualInvoiceInput, ManualInvoiceInputSchema, ManualInvoiceLineInput, ManualInvoiceLineInputSchema, ManualInvoiceResponse, ManualInvoiceResponseSchema, MeResponse, MeResponseSchema, MetadataSchema, MeterAggregation, MeterAggregationKind, MeterAggregationSchema, MeterCharge, MeterChargeLine, MeterChargeLineSchema, MeterChargeList, MeterChargeListSchema, MeterChargeMode, MeterChargeModeSchema, MeterChargeSchema, MeterChargeStatus, MeterChargeStatusSchema, MeterChargeTotalsLine, MeterContribution, MeterCreditAccountBenefit, MeterCreditBenefit, MeterCreditBenefitDef, MeterCreditBenefitDefSchema, MeterCreditEntry, MeterCreditEntryKind, MeterCreditEntryKindSchema, MeterCreditEntrySchema, MeterCreditProperties, MeterCreditPropertiesSchema, MeterCreditsOptions, MeterDef, MeterDefInput, MeterDefSchema, MeterFilter, MeterFilterClause, MeterFilterCondition, MeterFilterGroup, MeterFilterOperand, MeterFilterOperator, MeterFilterSchema, MeterFilterValue, MeterLabel, MeterLabelSchema, MeterLowAtSchema, MeterPeriod, MeterPeriodList, MeterPeriodListSchema, MeterPeriodSchema, MeterPeriodStatus, MeterPeriodStatusSchema, MeterRulesEvent, MeterRulesMeter, MeterStanding, MeterStandingSchema, MeterUnitsSchema, MeteredPrice, MeteredPriceDef, MeteredPriceDefSchema, MeteredPriceSchema, MeteringSettings, MeteringSettingsPatchSchema, MeteringSettingsSchema, MutationOptions, NoticedMeteredRate, NoticedMeteredRateSchema, NotificationEmailsSchema, OVERRIDE_BENEFIT_SOURCE, OverageRateInput, PING_EVENT_TYPE, PLAN_SET_MODES, PORTAL_SESSION_ERRORS, Payment, PaymentDueDaysSchema, PaymentSchema, Ping, PingSchema, PlanDef, PlanDefSchema, PlanSetInput, PlanSetInputSchema, PlanSetMode, PlanSetModeSchema, PlanSetResponse, PlanSetResponseSchema, PlanSetWarning, PlanSetWarningCode, PlanSetWarningSchema, PortalSession, PortalSessionCreateInput, PortalSessionCreateInputSchema, PortalSessionError, PortalSessionSchema, Price, PriceChangeNoticeEmail, PriceChangeNoticeEmailSchema, PriceChangeNoticeMeteredRate, PriceChangeNoticeMeteredRateSchema, PriceDef, PriceDefSchema, PriceSchema, ProductSettings, ProductSettingsPatch, ProductSettingsPatchSchema, ProductSettingsSchema, ProviderPayload, ProviderPayloadSchema, ResolveBenefitsInput, ResolveEntitlementsInput, ResolvedBenefit, ResolvedBenefits, ResolvedEntitlements, ResyncResult, ResyncResultSchema, type RetryClass, type RetryOptions, ReturnOriginSchema, SETTINGS_LOCALES, STEWARD_CAPABILITIES, SettingsLocale, SettingsLocaleSchema, Stats, StatsSchema, Steward, StewardCapability, StewardEnv, type StewardLocale, StewardLogger, StewardMe, StewardOptions, Subscription, SubscriptionChangeInput, SubscriptionChangeInputSchema, SubscriptionSchema, SubscriptionStatus, SubscriptionStatusSchema, SubscriptionSummary, SubscriptionSummarySchema, TtlMinutesSchema, UNIT_DECIMALS, UncancelSubscriptionResponse, UncancelSubscriptionResponseSchema, WEBHOOK_ENDPOINT_STATUSES, WEBHOOK_SECRET_PREFIX, WebUrlSchema, WebhookEndpoint, WebhookEndpointCreateInput, WebhookEndpointCreateInputSchema, WebhookEndpointList, WebhookEndpointListSchema, WebhookEndpointRotateInput, WebhookEndpointRotateInputSchema, WebhookEndpointSchema, WebhookEndpointStatus, WebhookEndpointStatusSchema, WebhookLastDelivery, WebhookLastDeliverySchema, WebhookSecretSchema, addUtcMonths, applyEmailSettingsPatch, applySettingsPatch, billingPageUrl, billingSettingsOf, buildDoctorReport, canonicalMeterFilter, checkoutRedirectUrl, consumptionOf, contributionOf, createSteward, emailLocaleOf, emailReadinessOf, emailRecipients, emailTemplateOf, emailTemplateSettings, endpointDiagnosisOf, errorCodeSpec, eventsSettingsOf, featureValueMatchesType, fromMicroUnits, generateWebhookSecret, hasControlCharacters, hostedReadinessOf, httpStatusFor, isE164, isEmailRelevant, isEventTimestampInRange, isEventType, isFeatureFlagBenefit, isGrantActive, isKnownErrorCode, isLiveSubscriptionStatus, isMeterCreditBenefit, isMicroPrecise, isReturnUrlAllowed, isValidTckn, isValidVkn, liveSubscriptionOf, manualInvoiceTotals, matchesFilter, meterChargeTotals, meterCreditsOf, meterFilterClauseOf, meteringSettingsOf, microToDecimalString, overageCapReached, overageOf, parseMicroUnits, periodBoundsOf, plainDecimalOf, rateOverage, resolveBenefits, resolveEntitlements, returnOriginsOf, rolloverOf, splitInclusiveTax, standingOf, toMicroUnits, uniqueEmails, webhookEndpointUrlProblem };
|