@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.
Files changed (39) hide show
  1. package/README.md +122 -92
  2. package/dist/_chunks/errors.js +1 -1
  3. package/dist/_chunks/events.d.ts +301 -4
  4. package/dist/_chunks/events.js +995 -17
  5. package/dist/_chunks/index.d.ts +3129 -63
  6. package/dist/_chunks/locale.d.ts +269 -1
  7. package/dist/_chunks/src.js +807 -25
  8. package/dist/_chunks/validators.d.ts +45 -1
  9. package/dist/_chunks/validators.js +128 -27
  10. package/dist/contract.d.ts +4 -4
  11. package/dist/contract.js +4 -4
  12. package/dist/index.d.ts +436 -22
  13. package/dist/index.js +1659 -26
  14. package/dist/server.d.ts +44 -6
  15. package/dist/server.js +29 -2
  16. package/package.json +2 -7
  17. package/dist/_chunks/steward.d.ts +0 -189
  18. package/dist/_chunks/steward.js +0 -564
  19. package/dist/testing/fixtures/events/LOCK.json +0 -27
  20. package/dist/testing/fixtures/events/account.deleted.json +0 -36
  21. package/dist/testing/fixtures/events/account.state_changed.json +0 -53
  22. package/dist/testing/fixtures/events/account.updated.json +0 -37
  23. package/dist/testing/fixtures/events/checkout.completed.json +0 -36
  24. package/dist/testing/fixtures/events/checkout.expired.json +0 -26
  25. package/dist/testing/fixtures/events/checkout.failed.json +0 -27
  26. package/dist/testing/fixtures/events/invoice.created.json +0 -37
  27. package/dist/testing/fixtures/events/invoice.issued.json +0 -38
  28. package/dist/testing/fixtures/events/invoice.voided.json +0 -39
  29. package/dist/testing/fixtures/events/subscription.activated.json +0 -40
  30. package/dist/testing/fixtures/events/subscription.cancel_scheduled.json +0 -38
  31. package/dist/testing/fixtures/events/subscription.canceled.json +0 -29
  32. package/dist/testing/fixtures/events/subscription.expired.json +0 -27
  33. package/dist/testing/fixtures/events/subscription.payment_failed.json +0 -38
  34. package/dist/testing/fixtures/events/subscription.reactivated.json +0 -36
  35. package/dist/testing/fixtures/events/subscription.renewed.json +0 -39
  36. package/dist/testing/fixtures/events/subscription.suspended.json +0 -36
  37. package/dist/testing/fixtures/events/subscription.terminated.json +0 -28
  38. package/dist/testing.d.ts +0 -656
  39. package/dist/testing.js +0 -3684
package/README.md CHANGED
@@ -17,13 +17,11 @@ ESM, Node ≥ 22. Tek çalışma zamanı bağımlılığı zod.
17
17
 
18
18
  | Import | İçerik |
19
19
  | --- | --- |
20
- | `@stewardhq/sdk` | Tüm şema/tipler + fırlatan istemci `createSteward`, hesap durumu önbelleği `stateCache`, `defineCatalog`, hata sınıfları + `httpStatusFor`, `isValidTckn`/`isValidVkn`/`isE164` |
20
+ | `@stewardhq/sdk` | Tüm şema/tipler + fırlatan istemci `createSteward`, hesap durumu önbelleği `stateCache`, `defineCatalog`, hata sınıfları + `httpStatusFor`, `isValidTckn`/`isValidVkn`/`isE164`; metering: `Events()`, `Meters()` |
21
21
  | `@stewardhq/sdk/contract` | Yalnızca şemalar ve tipler |
22
22
  | `@stewardhq/sdk/webhook` | `signWebhook` / `verifyWebhook` / `verifyWebhookRaw` (Node HMAC, senkron) |
23
23
  | `@stewardhq/sdk/webhook/web` | Aynı API WebCrypto ile (async; edge/workerd/tarayıcı) |
24
- | `@stewardhq/sdk/testing/fixtures/events/<tür>.json` | Her event türünün örnek gövdesi |
25
24
  | `@stewardhq/sdk/server` | `Webhooks()`: imzalı event alıcısı, canlı durum + önbellek, tipli hook'lar (Node); `Checkout()`: hosted checkout oturumu (`create` → `url`) ve dönüş sonucu (`result`); `CustomerPortal()`: hosted müşteri portalı oturumu (`create` → `url`) |
26
- | `@stewardhq/sdk/testing` | Test çiftleri (Node): `createFakeSteward()` (HTTP düzeyinde sahte steward, `simulate.*`, `connect`), `signedEvent()` |
27
25
 
28
26
  Kök giriş, `./contract` ve `./webhook/web` `node:*` kullanmaz (edge/tarayıcı);
29
27
  `./webhook` senkron Node HMAC'idir.
@@ -304,6 +302,101 @@ const placeholder = catalog.stateOf("org_1", "team", { accessState: "active", di
304
302
  katalogda yoksa varsayılan plandan) alır, asla "sınırsız" üretmez; `onFallback`
305
303
  ile alarm verilebilir. Snapshot yoksa varsayılan planın hakları.
306
304
 
305
+ Benefits (billing core) — reusable definitions plans list by code; `rank` is optional (the
306
+ benefits resolution does not read it). A `featureFlag()` sets catalog features with their
307
+ types; an undefined benefit or feature key and a wrong value type do not compile:
308
+
309
+ ```ts
310
+ import { defineCatalog, featureFlag, flag, limit } from "@stewardhq/sdk";
311
+
312
+ export const catalog = defineCatalog({
313
+ defaultPlan: "free",
314
+ features: { max_projects: limit(), sso: flag() },
315
+ benefits: { sso: featureFlag({ sso: true }, { description: { tr: "Tek oturum açma", en: "Single sign-on" } }) },
316
+ plans: {
317
+ free: { name: "Free", sellable: false, entitlements: { max_projects: 1, sso: false } },
318
+ team: { name: "Team", sellable: true, entitlements: { max_projects: null, sso: false }, benefits: ["sso"] },
319
+ },
320
+ prices: [{ plan: "team", interval: "month", currency: "TRY", amountMinor: 125_000, taxInclusive: true, taxRateBps: 2000 }],
321
+ });
322
+ type BenefitCode = typeof catalog.$benefit; // "sso"
323
+ const { benefits } = await state.state(orgId); // [{ code, type, properties, source, grantedAt }]; code typed
324
+ ```
325
+
326
+ `entitlementsOf`, `resolve` and `stateOf` take a plan's entitlements from the contract's
327
+ resolver (`resolveEntitlements`), the rule steward applies. `steward catalog push` sends a
328
+ catalog with benefits only to a steward whose `me().capabilities` lists `"benefits"`.
329
+
330
+ `Webhooks()` gains `onInvoicePaid` (`invoice.paid`) and `onBenefitGranted` / `onBenefitRevoked`
331
+ (`benefit_grant.created` / `.revoked`, with `benefit` and `grantId`; list these types in the
332
+ endpoint's `eventTypes`); like every hook they get the live `state`. Invoices and subscriptions
333
+ (billing core): `steward.invoices.createPaymentSession(id, { locale?, returnUrl? })` → `{ id, url,
334
+ expiresAt }` (redirect to steward's pay page), `steward.invoices.waive(id, { reason })`,
335
+ `steward.subscriptions.change(id, { planCode?, interval?, price?: "current", when: "next_period" })`,
336
+ `steward.subscriptions.uncancel(id)`.
337
+
338
+ Metering (phase 2) — the product records WHAT HAPPENED as events; catalog meters (a saved filter
339
+ + an aggregation) decide what counts as usage; credits are `meterCredit()` benefits; a metered
340
+ price bills overage on the renewal invoice. Units may be decimals (≤ 6 places; the SDK computes in
341
+ micro units, never float math):
342
+
343
+ ```ts
344
+ import { count, defineCatalog, Events, meter, meterCredit, Meters, sum } from "@stewardhq/sdk";
345
+
346
+ export const catalog = defineCatalog({
347
+ defaultPlan: "free",
348
+ features: { max_projects: limit(), sso: flag() },
349
+ benefits: { tokens_50k: meterCredit("ai_tokens", { units: 50_000 }), tokens_2m: meterCredit("ai_tokens", { units: 2_000_000, rollover: { capUnits: 1_000_000 } }) },
350
+ meters: {
351
+ ai_tokens: meter({ event: "ai.completion", aggregate: sum("tokens"), label: { tr: "AI token", en: "AI tokens" } }),
352
+ api_calls: meter({ aggregate: count(), label: { tr: "API isteği", en: "API requests" },
353
+ filter: { and: [{ name: "api.request" }, { "metadata.status": { lt: 500 } }] } }),
354
+ },
355
+ plans: { free: { …, benefits: ["tokens_50k"] }, team: { …, benefits: ["tokens_2m"] } },
356
+ prices: [{ plan: "team", interval: "month", currency: "TRY", amountMinor: 125_000, taxInclusive: true, taxRateBps: 2000 }],
357
+ meteredPrices: [{ plan: "team", meter: "ai_tokens", currency: "TRY", amountMinor: 1_250, perUnits: 1_000, taxInclusive: true, taxRateBps: 2000 }],
358
+ });
359
+ type Meter = typeof catalog.$meter; // "ai_tokens" | "api_calls"
360
+ type Event = typeof catalog.$event; // "ai.completion" (the `event` shorthands)
361
+
362
+ export const events = Events({ steward, catalog, actorRef: "service:api" });
363
+ export const meters = Meters({ steward, catalog, cache: state, events });
364
+
365
+ const gate = await meters.check(org.id, "ai_tokens", { units: estimatedTokens });
366
+ if (!gate.allowed) return c.json({ error: "credits_exhausted", balance: gate.balance }, 402);
367
+ events.track(org.id, "ai.completion", { tokens: 1500, model: "gpt-4o" }, { externalId: `cmpl_${res.id}` });
368
+ process.once("SIGTERM", () => void events.flush()); // the SDK never hooks process events
369
+ ```
370
+
371
+ - `Events({ steward, catalog?, actorRef?, flushIntervalMs = 2000, maxBatch = 500, maxQueue = 10_000,
372
+ autoFlush = true, onRejected?, onDrop? })`: `track(ref, name, metadata?, { externalId?, timestamp? })`
373
+ is sync and never throws (an invalid event → WARN + `onDrop`); batches go to `POST
374
+ /v1/events/ingest` with one `Idempotency-Key` per batch, reused by every retry (`503
375
+ events_backlog` included); after the retries the batch waits at the front of the queue (backoff
376
+ ≤ 30 s); a full queue hands its OLDEST events to `onDrop(events, { reason: "queue_full" })`, an
377
+ invalid event and a batch refused for good (4xx) go there too (`"invalid_event"`,
378
+ `"request_failed"`); per-event rejections go to `onRejected(rejected)` (not retried). `track`
379
+ stamps `timestamp` with the call's time unless given. Give a deterministic `externalId`
380
+ (`cmpl_<id>`): the generated UUID only protects against the SDK's own retries. On the edge:
381
+ `Events({ autoFlush: false })` + `ctx.waitUntil(events.flush())`; `flush()` never rejects (what
382
+ failed stays queued). `ingest(events, { idempotencyKey? })` sends directly and throws;
383
+ `pending(ref)` lists the account's events steward has not counted yet (queued, in flight, acked in
384
+ the last minute) — `Meters({ events })` subtracts them.
385
+ - `Meters({ steward, catalog, cache?, events?, ttlMs = 10_000, staleIfErrorMs = 600_000,
386
+ onUnavailable = "allow", onFallback? })`: `get(ref)` (every meter, `Record<Meter, MeterBalance>`),
387
+ `balance(ref, meter)`, `check(ref, meter, { units = 1 })` → `{ allowed, balance, standing,
388
+ billable, source }` with `allowed = billable ? !capReached : includedUnits === null || balance −
389
+ pending ≥ units` (a billable meter closes once steward reports its period overage reached the
390
+ rate's `capMinor`). Reads are cached (ETag/304); this process's queued (and not yet rolled up) events are
391
+ subtracted; when steward is unreachable the stale value is used for 10 min, then the catalog's
392
+ default-plan credit (or the account's coarse facts from `cache`) and `onUnavailable` decide.
393
+ - `stateOf()` carries the `meters` block when the catalog has meters; `Webhooks()` gains
394
+ `onMeterThreshold` (standing `ok → low → exhausted`, also as the cause of
395
+ `account.state_changed`), `onMeterPeriodClosed` (with `period`) and `onBenefitCycled`
396
+ (`benefit_grant.cycled`). `steward.events.ingest`, `steward.meters.get/read/periods`,
397
+ `steward.credits.grant`, `steward.meterCharges.list` are the raw calls. Push a catalog with
398
+ meters only to a steward whose `me().capabilities` lists `"meters"` (an older one drops them).
399
+
307
400
  Hatalar — ürün API'sinin durum kodu:
308
401
 
309
402
  ```ts
@@ -324,93 +417,6 @@ sayfalarındadır; SDK para biçimlendirme yardımcısı taşımaz.
324
417
  Doğrulayıcılar: `isValidTckn`, `isValidVkn` (sağlama hanesi), `isE164(value, {country: "TR"}?)`
325
418
  değeri olduğu gibi denetler (boşluk kırpmaz).
326
419
 
327
- Testler (`/testing`, Node) — sahte steward sunucu açmaz, `fetch` verir; başlıkları
328
- (`Bearer`, `X-Actor-Ref`, `Idempotency-Key` tekrarı), ETag/304, hata gövdelerini ve
329
- event kurallarını servis gibi uygular. Aynı uyumluluk paketi hem sahteye hem gerçek
330
- servis imajına karşı koşar:
331
-
332
- ```ts
333
- import { createFakeSteward, signedEvent } from "@stewardhq/sdk/testing";
334
-
335
- const fake = createFakeSteward({
336
- catalog, // oluşturmada senkronlanır
337
- webhook: { secret }, // eventTypes verilmezse ["account.state_changed"]; "legacy" = 15 eski tip
338
- });
339
- fake.connect((req) => webhooks.handle(req)); // alıcı sonradan (ya da webhook.handler); uygulama fake'ten sonra kurulabilir
340
- const steward = fake.steward; // ya da ürünün kendi createSteward({ fetch: fake.fetch, baseUrl: fake.baseUrl, … })
341
- await steward.accounts.upsert("org_1", { displayName: "Org", notificationEmails: ["owner@acme.com"] }); // billing email recipients (optional)
342
- const session = await steward.checkoutSessions.create("org_1", input);
343
- await fake.simulate.checkoutCompleted(session.id); // ya da checkoutFailed; hosted oturumda checkoutCanceled da
344
-
345
- // Hosted (Checkout().create): url sahte steward'ın sayfası; tarayıcı gibi sürülebilir
346
- const { id, url } = await checkout.create({ ref: "org_1", planCode: "team", interval: "month", actorRef: "user:1" });
347
- const { redirectUrl, session: done } = await fake.simulate.completeHostedCheckout(url); // sayfa GET + "Tamamla" (outcome: "failed" → Reddet)
348
- const page = await fake.fetch(url); // ya da elle: "Tamamla / Reddet / Vazgeç" formları (k gizli alanda)
349
- const paid = await fake.fetch(new URL(`${id}/pay`, url), { method: "POST", body: new URLSearchParams({ k: new URL(url).searchParams.get("k")!, outcome: "succeeded" }) });
350
- paid.headers.get("location"); // successUrl, yer tutucular servisle aynı kuralla dolu
351
-
352
- // Portal (CustomerPortal().create): url sahte portal sayfası; servisle aynı rotalar ve bildirim kodları
353
- const portalSession = await portal.create({ ref: "org_1", actorRef: "user:1" });
354
- const k = new URL(portalSession.url).searchParams.get("k")!;
355
- const base = `${fake.baseUrl}/public/v1/portal/${portalSession.id}`;
356
- await fake.fetch(`${base}/cancel`, { method: "POST", body: new URLSearchParams({ k }) }); // 200 onay sayfası
357
- await fake.fetch(`${base}/cancel`, { method: "POST", body: new URLSearchParams({ k, confirm: "1" }) }); // 303 …&done=canceled
358
- await fake.simulate.portalCancel(portalSession.id); // ya da doğrudan: { result: "ok" | "already_scheduled" | "no_subscription", account }
359
- await fake.simulate.portalRetryPayment(portalSession.id); // past_due'da { result: "ok" } — durum değişmez; sonuç renewal ile
360
-
361
- await fake.simulate.flush(); // bekleyen event'ler alıcıya, sırayla (2xx dışı → bekler)
362
-
363
- await fake.simulate.renewal("org_1", { fail: true }); // saat dönem sonuna; past_due + dunning
364
- await fake.simulate.advance({ days: 7 }); // zamanlanmış işler kendi anında (dunning, dönem sonu iptali, checkout süresi, grant penceresi, portal oturumu silme)
365
- fake.simulate.outage(true, { mode: "503" }); // ya da "network": fetch reddeder
366
- await fake.simulate.deliver("account.state_changed", { ref: "org_1", duplicate: true, outOfOrder: true });
367
- fake.simulate.redeliver(eventId); // operatörün pod CLI `redeliver-event`'i: aynı event sonraki flush'ta yeniden
368
-
369
- fake.emails("org_1"); // billing emails steward would send: [{ template, to, locale, eventId, … }]
370
-
371
- const { request } = signedEvent("subscription.renewed", { accountRef: "org_1" }, { secret });
372
- await webhooks.handle(request());
373
- ```
374
-
375
- `fake.requests` gelen istekleri, `fake.events(ref?)` yayınlanan event'leri tutar. `fake.emails(ref?)`
376
- steward'ın göndereceği faturalandırma e-postalarını servisle aynı kurallarla (şablon, gönderim anındaki
377
- alaka, alıcılar, dil, kapatılmış şablon) listeler; içerik render edilmez ve gönderim gecikmesizdir
378
- ([e-postalar](../docs/integrate/emails.md#test)). Endpoint `webhook`
379
- seçeneğiyle oluşturmada açılır; filtre verilmezse yönetim ucunun yeni ürüne verdiği
380
- `["account.state_changed"]`, `eventTypes: "legacy"` pod CLI'nın filtresiz (15 eski tip) endpoint'i.
381
- Alıcı bağlanmadan `flush`/`deliver` fırlatır (event'ler outbox'ta bekler); `connect` alıcıyı değiştirir.
382
- Sahtenin bilerek farklı olduğu yerler: teslimat asenkron değil (`flush()`), `dead`
383
- olmaz ve geri çekilme beklenmez; sağlayıcı hata vermez; dönüş origin'i (`settings.appUrl`,
384
- `settings.extraReturnOrigins` ya da kısayolu `returnOrigins`) hiç ayarlanmazsa her
385
- `successUrl`/`cancelUrl`/`returnUrl` kabul; `admin.endpoints` ile açılan endpoint yalnızca kayıttır (teslimat
386
- `webhook` seçeneğinin alıcısına gider, `lastDelivery` hep null; `doctor()`'da teşhisi
387
- `no_deliveries`, sağlayıcı `fake` ve sağlıklı); dunning'de yeniden deneme
388
- sonucu `renewal` ile gelir; her yanıt `X-Request-Id` (hata gövdesinde `requestId`) taşır;
389
- idempotency kayıtları süpürülmez. Hosted checkout'ta sahte sayfa servisin sayfasını taklit
390
- etmez, yalnızca `url` ↔ `simulate` sözleşmesini sürülebilir kılar: profil formu, TCKN/VKN
391
- doğrulaması, onay kutuları, deneme hakkı, CSP ve POST kaynak denetimi yok. Servis profili
392
- müşterinin `details` gönderiminde yazar; sahte bunu tamamlanma/red anında yapar — hesabın
393
- profili yoksa `prefill`den (ad, e-posta, tür; geri kalanı sabit test verisi, kurumsalda VKN
394
- `1234567890`) sahte profil yazılır (`billing_profile.updated`), varsa aynen kalır; belgeler
395
- o anda onaylanmış sayılır. Sayfada sağlayıcı formu olmadığından vazgeç her zaman `canceled`
396
- olur ve süresi dolan hosted oturumun nedeni `expired`dır.
397
-
398
- Portal oturumu (`portalSessions.create`) servisle aynı kurallarla açılır (hesap yoksa 404,
399
- `returnUrl` origin politikası, süre `portalTtlMinutes`, 43 karakterlik sayfa anahtarı; süresi
400
- geçen, anahtarsız ya da anahtarı yanlış oturum aynı 404). Sahte portal sayfası da servisin
401
- sayfasını taklit etmez — marka, tr/en metinler, CSP, POST kaynak denetimi (`Sec-Fetch-Site`),
402
- IP başına yanlış anahtar ve oturum başına aksiyon sayaçları (429) yok — ama rotaları
403
- (`GET ?k=`, `POST …/cancel` iki adım `confirm=1`, `…/retry-payment`, `…/profile`,
404
- `GET …/invoices/:id/document?k=`), 303 bildirim kodları (`done=canceled|retry_requested|profile_saved`,
405
- `error=no_subscription|already_canceled|nothing_to_retry|retry_too_soon`), profil alan hata kodları
406
- (422) ve sonuçları servisle aynıdır; uyumluluk paketi iki hedefi de sayfa üzerinden sürer.
407
- Yönlendirmeler mutlak adrestir (servis köke göre yol verir). Sahte sağlayıcı hata vermediğinden
408
- `provider_error` bildirimi yok. "Ödemeyi yeniden dene" isteği kabul eder (`ok`, abonelik başına
409
- 10 dakikada bir; dry-run olmayan dunning retry adımı da sayılır) ama tahsilatı kendisi
410
- sonuçlandırmaz: servisteki gibi sonuç sonradan gelir — `simulate.renewal(ref)` aynı başarısız
411
- siparişi başarılı sayar (`subscription.reactivated`), `{fail: true}` yine başarısız.
412
- `simulate.portalCancel/portalRetryPayment` bilinmeyen ya da süresi geçmiş oturumda fırlatır.
413
-
414
420
  ## `@steward/contract`'tan geçiş
415
421
 
416
422
  | Eski | Yeni |
@@ -418,9 +424,10 @@ siparişi başarılı sayar (`subscription.reactivated`), `{fail: true}` yine ba
418
424
  | `@z9cloud/steward-contract` | `@stewardhq/sdk` (ya da yalnız şema için `@stewardhq/sdk/contract`) |
419
425
  | `@z9cloud/steward-contract/client` | `@stewardhq/sdk` `createSteward` (fırlatan; fırlatmayan `createBillingClient` dışa açılmaz) |
420
426
  | `@z9cloud/steward-contract/webhook` | `@stewardhq/sdk/webhook` |
421
- | `@z9cloud/steward-contract/fixtures/events/*.json` | `@stewardhq/sdk/testing/fixtures/events/*.json` |
427
+ | `@z9cloud/steward-contract/fixtures/events/*.json` | Yok (paketle yayınlanmaz) |
428
+ | `@stewardhq/sdk/testing` (`signedEvent`, `createFakeSteward`) | Yok (0.4.0): servise karşı entegrasyon testi ya da `fetch` saplaması |
422
429
  | `getEntitlements(ref)` / `accounts.entitlements(ref)` | `accounts.state(ref)` ya da `stateCache` (tek okuma modeli `AccountState`; uç 2026-09-16'da kaldırıldı) |
423
- | `listEvents` / `redeliverEvent` / `events.*` | Yok (2026-09-16): kaçırılan durum için `accounts.resync(ref)`; dead teslimatı operatör pod CLI `redeliver-event` ile yeniden gönderir (testte `fake.simulate.redeliver`) |
430
+ | `listEvents` / `redeliverEvent` / `events.*` | Yok (2026-09-16): kaçırılan durum için `accounts.resync(ref)`; dead teslimatı operatör pod CLI `redeliver-event` ile yeniden gönderir |
424
431
 
425
432
  GitHub Packages `.npmrc` satırı ve Docker `--secret` bağlaması artık gerekmez.
426
433
 
@@ -429,3 +436,26 @@ GitHub Packages `.npmrc` satırı ve Docker `--secret` bağlaması artık gerekm
429
436
  Semver. Alan kaldırma/yeniden adlandırma kırıcıdır (major; 1.0 öncesi minor).
430
437
  Yayın: `sdk/package.json` sürümü artırılır, `sdk-v<sürüm>` etiketi push edilir
431
438
  (`.github/workflows/sdk-publish.yml`).
439
+
440
+ **0.5.0** (contract 0.4.0, metering phase 2; additive; `API_VERSION` `2026-10-01` unchanged):
441
+
442
+ - Catalog: `meters` + `meter()`, `count()` / `sum(key)` / `max(key)` / `unique(key)`, `meterCredit()`
443
+ benefits, `meteredPrices`; `typeof catalog.$meter` / `$event`; `stateOf()` adds `meters`.
444
+ - `Events()` (`track`, `flush`, `ingest`, `pending`; `onRejected`, `onDrop(events, {reason})`) and `Meters()`
445
+ (`get`, `balance` → `MeterBalance`, `check`, `invalidate`) in the root entry, no `node:*`; `stateCache().peek(ref)`.
446
+ - Client: `events.ingest`, `meters.get/read/periods`, `credits.grant`, `meterCharges.list`.
447
+ - Hooks: `onMeterThreshold`, `onMeterPeriodClosed` (+ `period`), `onBenefitCycled`.
448
+
449
+ **0.4.0** (sözleşme 0.3.0, faturalama çekirdeği Faz 1; `API_VERSION` `2026-10-01` aynı):
450
+
451
+ - Kırıcı (0.x minor): `@stewardhq/sdk/testing` alt yolu (`signedEvent`, fixture'lar, sahte steward)
452
+ kaldırıldı; testler gerçek servise ya da `fetch` saplamasına karşı yazılır.
453
+ - Katalog: `benefits` + `featureFlag()`, `plans[].benefits`, `typeof catalog.$benefit`; `PlanSpec.rank`
454
+ isteğe bağlı ve hak çözümünde okunmaz (katman birleşimi, sözleşmenin `resolveBenefits`'i).
455
+ - Durum: `AccountState.benefits`, `subscriptions[]` (tekil `subscription` birincil abonelik),
456
+ `openInvoices[]`; abonelikteki `amountMinor` aboneliğin kilitli tutarıdır.
457
+ - Olaylar (endpoint'in `eventTypes`'ında istenirse): `invoice.paid`, `benefit_grant.created/updated/revoked`;
458
+ hook'lar `onInvoicePaid`, `onBenefitGranted`, `onBenefitRevoked` (ve tipten türeyen
459
+ `onBenefitGrantCreated/Updated/Revoked`).
460
+ - İstemci: `invoices.createPaymentSession`, `invoices.waive`, `subscriptions.change`,
461
+ `subscriptions.uncancel`; `me()` yanıtında `capabilities`.
@@ -1,4 +1,4 @@
1
- import { B as errorCodeSpec } from "./src.js";
1
+ import { nt as errorCodeSpec } from "./src.js";
2
2
  //#region src/errors.ts
3
3
  var StewardError = class extends Error {
4
4
  code;
@@ -104,7 +104,10 @@ declare const AccountDunningStateSchema: z.ZodObject<{
104
104
  nextActionAt: z.ZodNullable<z.ZodISODateTime>;
105
105
  }, z.core.$strip>;
106
106
  type AccountDunningState = z.infer<typeof AccountDunningStateSchema>;
107
- /** Dönem sonunda uygulanacak plan değişikliği. F4b'ye kadar her zaman null. */
107
+ /**
108
+ * Change applied at the period end (`POST /v1/subscriptions/:id/change`, MF9). Null until then.
109
+ * `price: "current"` on the same plan shows the same `planCode`/`interval` with the new `amountMinor`.
110
+ */
108
111
  declare const AccountScheduledChangeSchema: z.ZodObject<{
109
112
  planCode: z.ZodString;
110
113
  interval: z.ZodEnum<{
@@ -112,6 +115,7 @@ declare const AccountScheduledChangeSchema: z.ZodObject<{
112
115
  year: "year";
113
116
  }>;
114
117
  effectiveAt: z.ZodISODateTime;
118
+ amountMinor: z.ZodOptional<z.ZodNumber>;
115
119
  }, z.core.$strip>;
116
120
  type AccountScheduledChange = z.infer<typeof AccountScheduledChangeSchema>;
117
121
  declare const AccountSubscriptionStateSchema: z.ZodObject<{
@@ -146,6 +150,7 @@ declare const AccountSubscriptionStateSchema: z.ZodObject<{
146
150
  year: "year";
147
151
  }>;
148
152
  effectiveAt: z.ZodISODateTime;
153
+ amountMinor: z.ZodOptional<z.ZodNumber>;
149
154
  }, z.core.$strip>>;
150
155
  }, z.core.$strip>;
151
156
  type AccountSubscriptionState = z.infer<typeof AccountSubscriptionStateSchema>;
@@ -163,6 +168,52 @@ declare const AccountOpenCheckoutSchema: z.ZodObject<{
163
168
  expiresAt: z.ZodISODateTime;
164
169
  }, z.core.$strip>;
165
170
  type AccountOpenCheckout = z.infer<typeof AccountOpenCheckoutSchema>;
171
+ /**
172
+ * An unpaid invoice of the account (billing core, M22/M34): renewal or final invoices written
173
+ * before payment. Account level (not under a subscription) so the final invoice of an ended
174
+ * subscription stays visible; the product can show a banner before `dueAt`.
175
+ */
176
+ declare const AccountOpenInvoiceSchema: z.ZodObject<{
177
+ id: z.ZodUUID;
178
+ subscriptionId: z.ZodNullable<z.ZodUUID>;
179
+ billingReason: z.ZodEnum<{
180
+ subscription_create: "subscription_create";
181
+ subscription_cycle: "subscription_cycle";
182
+ subscription_update: "subscription_update";
183
+ purchase: "purchase";
184
+ manual: "manual";
185
+ }>;
186
+ totalMinor: z.ZodNumber;
187
+ currency: z.ZodString;
188
+ dueAt: z.ZodISODateTime;
189
+ }, z.core.$strip>;
190
+ type AccountOpenInvoice = z.infer<typeof AccountOpenInvoiceSchema>;
191
+ /**
192
+ * Low-churn meter facts of the account state (metering, M13; Polar `active_meters`, coarse). One
193
+ * entry per catalog meter. Balances and period bounds are NOT here (they change with every event;
194
+ * read them with `GET /v1/accounts/:ref/meters`): this block changes when the plan changes, a
195
+ * threshold is crossed or a new period resets the standing — never per event.
196
+ */
197
+ declare const AccountMeterStateSchema: z.ZodObject<{
198
+ includedUnits: z.ZodNullable<z.ZodNumber>;
199
+ billable: z.ZodBoolean;
200
+ standing: z.ZodEnum<{
201
+ ok: "ok";
202
+ low: "low";
203
+ exhausted: "exhausted";
204
+ }>;
205
+ }, z.core.$strip>;
206
+ type AccountMeterState = z.infer<typeof AccountMeterStateSchema>;
207
+ declare const AccountMetersStateSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
208
+ includedUnits: z.ZodNullable<z.ZodNumber>;
209
+ billable: z.ZodBoolean;
210
+ standing: z.ZodEnum<{
211
+ ok: "ok";
212
+ low: "low";
213
+ exhausted: "exhausted";
214
+ }>;
215
+ }, z.core.$strip>>;
216
+ type AccountMetersState = z.infer<typeof AccountMetersStateSchema>;
166
217
  /** Fatura profili özeti: yalnızca var mı ve türü (alanlar PII, burada yok). */
167
218
  declare const AccountProfileStateSchema: z.ZodObject<{
168
219
  present: z.ZodBoolean;
@@ -216,6 +267,7 @@ declare const AccountStateSchema: z.ZodObject<{
216
267
  year: "year";
217
268
  }>;
218
269
  effectiveAt: z.ZodISODateTime;
270
+ amountMinor: z.ZodOptional<z.ZodNumber>;
219
271
  }, z.core.$strip>>;
220
272
  }, z.core.$strip>>;
221
273
  openCheckout: z.ZodNullable<z.ZodObject<{
@@ -237,6 +289,71 @@ declare const AccountStateSchema: z.ZodObject<{
237
289
  company: "company";
238
290
  }>>;
239
291
  }, z.core.$strip>;
292
+ subscriptions: z.ZodOptional<z.ZodArray<z.ZodObject<{
293
+ id: z.ZodUUID;
294
+ status: z.ZodEnum<{
295
+ active: "active";
296
+ suspended: "suspended";
297
+ past_due: "past_due";
298
+ canceled: "canceled";
299
+ expired: "expired";
300
+ }>;
301
+ planCode: z.ZodString;
302
+ interval: z.ZodEnum<{
303
+ month: "month";
304
+ year: "year";
305
+ }>;
306
+ amountMinor: z.ZodNumber;
307
+ currency: z.ZodString;
308
+ currentPeriodEnd: z.ZodNullable<z.ZodISODateTime>;
309
+ cancelAt: z.ZodNullable<z.ZodISODateTime>;
310
+ cancelAtPeriodEnd: z.ZodBoolean;
311
+ pastDueSince: z.ZodNullable<z.ZodISODateTime>;
312
+ currentPeriodStart: z.ZodNullable<z.ZodISODateTime>;
313
+ dunning: z.ZodNullable<z.ZodObject<{
314
+ step: z.ZodNumber;
315
+ nextActionAt: z.ZodNullable<z.ZodISODateTime>;
316
+ }, z.core.$strip>>;
317
+ scheduledChange: z.ZodNullable<z.ZodObject<{
318
+ planCode: z.ZodString;
319
+ interval: z.ZodEnum<{
320
+ month: "month";
321
+ year: "year";
322
+ }>;
323
+ effectiveAt: z.ZodISODateTime;
324
+ amountMinor: z.ZodOptional<z.ZodNumber>;
325
+ }, z.core.$strip>>;
326
+ }, z.core.$strip>>>;
327
+ openInvoices: z.ZodOptional<z.ZodArray<z.ZodObject<{
328
+ id: z.ZodUUID;
329
+ subscriptionId: z.ZodNullable<z.ZodUUID>;
330
+ billingReason: z.ZodEnum<{
331
+ subscription_create: "subscription_create";
332
+ subscription_cycle: "subscription_cycle";
333
+ subscription_update: "subscription_update";
334
+ purchase: "purchase";
335
+ manual: "manual";
336
+ }>;
337
+ totalMinor: z.ZodNumber;
338
+ currency: z.ZodString;
339
+ dueAt: z.ZodISODateTime;
340
+ }, z.core.$strip>>>;
341
+ benefits: z.ZodOptional<z.ZodArray<z.ZodObject<{
342
+ code: z.ZodNullable<z.ZodString>;
343
+ type: z.ZodString;
344
+ properties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
345
+ source: z.ZodString;
346
+ grantedAt: z.ZodISODateTime;
347
+ }, z.core.$strip>>>;
348
+ meters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
349
+ includedUnits: z.ZodNullable<z.ZodNumber>;
350
+ billable: z.ZodBoolean;
351
+ standing: z.ZodEnum<{
352
+ ok: "ok";
353
+ low: "low";
354
+ exhausted: "exhausted";
355
+ }>;
356
+ }, z.core.$strip>>>;
240
357
  }, z.core.$strip>;
241
358
  type AccountState = z.infer<typeof AccountStateSchema>;
242
359
  declare const AccountSchema: z.ZodObject<{
@@ -327,6 +444,7 @@ declare const EVENT_DETAIL_SCHEMAS: {
327
444
  paymentId: z.ZodNullable<z.ZodUUID>;
328
445
  attempt: z.ZodNumber;
329
446
  nextRetryAt: z.ZodNullable<z.ZodISODateTime>;
447
+ invoiceId: z.ZodOptional<z.ZodUUID>;
330
448
  subscriptionId: z.ZodUUID;
331
449
  }, z.core.$strip>;
332
450
  readonly "subscription.suspended": z.ZodObject<{
@@ -386,6 +504,94 @@ declare const EVENT_DETAIL_SCHEMAS: {
386
504
  deletedAt: z.ZodISODateTime;
387
505
  actorRef: z.ZodNullable<z.ZodString>;
388
506
  }, z.core.$strip>;
507
+ readonly "invoice.paid": z.ZodObject<{
508
+ invoiceId: z.ZodUUID;
509
+ subscriptionId: z.ZodNullable<z.ZodUUID>;
510
+ paymentId: z.ZodUUID;
511
+ billingReason: z.ZodNullable<z.ZodEnum<{
512
+ subscription_create: "subscription_create";
513
+ subscription_cycle: "subscription_cycle";
514
+ subscription_update: "subscription_update";
515
+ purchase: "purchase";
516
+ manual: "manual";
517
+ }>>;
518
+ totalMinor: z.ZodNumber;
519
+ currency: z.ZodString;
520
+ paidAt: z.ZodISODateTime;
521
+ }, z.core.$strip>;
522
+ readonly "benefit_grant.created": z.ZodObject<{
523
+ grantId: z.ZodUUID;
524
+ benefit: z.ZodObject<{
525
+ code: z.ZodNullable<z.ZodString>;
526
+ type: z.ZodString;
527
+ properties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
528
+ source: z.ZodString;
529
+ grantedAt: z.ZodISODateTime;
530
+ }, z.core.$strip>;
531
+ }, z.core.$strip>;
532
+ readonly "benefit_grant.updated": z.ZodObject<{
533
+ previousProperties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
534
+ grantId: z.ZodUUID;
535
+ benefit: z.ZodObject<{
536
+ code: z.ZodNullable<z.ZodString>;
537
+ type: z.ZodString;
538
+ properties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
539
+ source: z.ZodString;
540
+ grantedAt: z.ZodISODateTime;
541
+ }, z.core.$strip>;
542
+ }, z.core.$strip>;
543
+ readonly "benefit_grant.revoked": z.ZodObject<{
544
+ revokedAt: z.ZodISODateTime;
545
+ grantId: z.ZodUUID;
546
+ benefit: z.ZodObject<{
547
+ code: z.ZodNullable<z.ZodString>;
548
+ type: z.ZodString;
549
+ properties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
550
+ source: z.ZodString;
551
+ grantedAt: z.ZodISODateTime;
552
+ }, z.core.$strip>;
553
+ }, z.core.$strip>;
554
+ readonly "benefit_grant.cycled": z.ZodObject<{
555
+ periodStart: z.ZodISODateTime;
556
+ periodEnd: z.ZodISODateTime;
557
+ grantId: z.ZodUUID;
558
+ benefit: z.ZodObject<{
559
+ code: z.ZodNullable<z.ZodString>;
560
+ type: z.ZodString;
561
+ properties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
562
+ source: z.ZodString;
563
+ grantedAt: z.ZodISODateTime;
564
+ }, z.core.$strip>;
565
+ }, z.core.$strip>;
566
+ readonly "meter.threshold_crossed": z.ZodObject<{
567
+ meter: z.ZodString;
568
+ standing: z.ZodEnum<{
569
+ ok: "ok";
570
+ low: "low";
571
+ exhausted: "exhausted";
572
+ }>;
573
+ previous: z.ZodEnum<{
574
+ ok: "ok";
575
+ low: "low";
576
+ exhausted: "exhausted";
577
+ }>;
578
+ periodStart: z.ZodISODateTime;
579
+ periodEnd: z.ZodISODateTime;
580
+ consumedUnits: z.ZodNumber;
581
+ creditedUnits: z.ZodNumber;
582
+ }, z.core.$strip>;
583
+ readonly "meter.period_closed": z.ZodObject<{
584
+ periodStart: z.ZodISODateTime;
585
+ periodEnd: z.ZodISODateTime;
586
+ subscriptionId: z.ZodNullable<z.ZodUUID>;
587
+ meters: z.ZodArray<z.ZodObject<{
588
+ meter: z.ZodString;
589
+ consumedUnits: z.ZodNumber;
590
+ creditedUnits: z.ZodNumber;
591
+ overageUnits: z.ZodNumber;
592
+ }, z.core.$strip>>;
593
+ meterChargeId: z.ZodNullable<z.ZodUUID>;
594
+ }, z.core.$strip>;
389
595
  };
390
596
  type EventType = keyof typeof EVENT_DETAIL_SCHEMAS;
391
597
  /** Tüm event tipleri (yenileri dahil). */
@@ -397,9 +603,11 @@ declare const EVENT_TYPES: EventType[];
397
603
  declare const LEGACY_EVENT_TYPES: readonly ["account.updated", "checkout.completed", "checkout.failed", "checkout.expired", "subscription.activated", "subscription.renewed", "subscription.payment_failed", "subscription.suspended", "subscription.reactivated", "subscription.cancel_scheduled", "subscription.canceled", "subscription.expired", "subscription.terminated", "invoice.created", "invoice.issued"];
398
604
  type LegacyEventType = (typeof LEGACY_EVENT_TYPES)[number];
399
605
  /** `account.state_changed.detail.cause` — bilinen değerler; küme açık. */
400
- type AccountStateChangeCause = LegacyEventType | "account.upserted" | "billing_profile.updated" | "checkout.opened" | "checkout.initialize_failed" | "checkout.canceled" | "grant.created" | "grant.revoked" | "grant.window_applied" | "dunning.advanced" | "dunning_policy.updated" | "payment.recorded" | "catalog.synced" | "account.refreshed" | "grant.plan_set" | "resync" | "account.deleted" | (string & Record<never, never>);
401
- type FullStateEventType = "account.state_changed" | "account.deleted";
606
+ type AccountStateChangeCause = LegacyEventType | "account.upserted" | "billing_profile.updated" | "checkout.opened" | "checkout.initialize_failed" | "checkout.canceled" | "grant.created" | "grant.revoked" | "grant.window_applied" | "dunning.advanced" | "dunning_policy.updated" | "payment.recorded" | "catalog.synced" | "account.refreshed" | "grant.plan_set" | "resync" | "account.deleted" | "invoice.paid" | "subscription.period_advanced" | "subscription.uncanceled" | "subscription.change_scheduled" | "invoice.waived" | "invoice.payment_reminder" | "meter.threshold_crossed" | "meter.period_rolled" | "credits.granted" | (string & Record<never, never>);
607
+ type FullStateEventType = "account.state_changed" | "account.deleted" | "invoice.paid" | "benefit_grant.created" | "benefit_grant.updated" | "benefit_grant.revoked" | "benefit_grant.cycled" | "meter.threshold_crossed" | "meter.period_closed";
402
608
  type AccountSchemaOf<T extends EventType> = T extends FullStateEventType ? typeof AccountStateSchema : typeof EntitlementSnapshotSchema;
609
+ /** Event types whose `data.account` is the full `AccountState` (the others: the entitlement snapshot). */
610
+ declare const FULL_STATE_EVENT_TYPES: ReadonlySet<string>;
403
611
  declare function envelope<T extends EventType>(type: T): z.ZodObject<{
404
612
  id: z.ZodString;
405
613
  type: z.ZodLiteral<T>;
@@ -446,6 +654,7 @@ declare function envelope<T extends EventType>(type: T): z.ZodObject<{
446
654
  paymentId: z.ZodNullable<z.ZodUUID>;
447
655
  attempt: z.ZodNumber;
448
656
  nextRetryAt: z.ZodNullable<z.ZodISODateTime>;
657
+ invoiceId: z.ZodOptional<z.ZodUUID>;
449
658
  subscriptionId: z.ZodUUID;
450
659
  }, z.core.$strip>;
451
660
  readonly "subscription.suspended": z.ZodObject<{
@@ -505,6 +714,94 @@ declare function envelope<T extends EventType>(type: T): z.ZodObject<{
505
714
  deletedAt: z.ZodISODateTime;
506
715
  actorRef: z.ZodNullable<z.ZodString>;
507
716
  }, z.core.$strip>;
717
+ readonly "invoice.paid": z.ZodObject<{
718
+ invoiceId: z.ZodUUID;
719
+ subscriptionId: z.ZodNullable<z.ZodUUID>;
720
+ paymentId: z.ZodUUID;
721
+ billingReason: z.ZodNullable<z.ZodEnum<{
722
+ subscription_create: "subscription_create";
723
+ subscription_cycle: "subscription_cycle";
724
+ subscription_update: "subscription_update";
725
+ purchase: "purchase";
726
+ manual: "manual";
727
+ }>>;
728
+ totalMinor: z.ZodNumber;
729
+ currency: z.ZodString;
730
+ paidAt: z.ZodISODateTime;
731
+ }, z.core.$strip>;
732
+ readonly "benefit_grant.created": z.ZodObject<{
733
+ grantId: z.ZodUUID;
734
+ benefit: z.ZodObject<{
735
+ code: z.ZodNullable<z.ZodString>;
736
+ type: z.ZodString;
737
+ properties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
738
+ source: z.ZodString;
739
+ grantedAt: z.ZodISODateTime;
740
+ }, z.core.$strip>;
741
+ }, z.core.$strip>;
742
+ readonly "benefit_grant.updated": z.ZodObject<{
743
+ previousProperties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
744
+ grantId: z.ZodUUID;
745
+ benefit: z.ZodObject<{
746
+ code: z.ZodNullable<z.ZodString>;
747
+ type: z.ZodString;
748
+ properties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
749
+ source: z.ZodString;
750
+ grantedAt: z.ZodISODateTime;
751
+ }, z.core.$strip>;
752
+ }, z.core.$strip>;
753
+ readonly "benefit_grant.revoked": z.ZodObject<{
754
+ revokedAt: z.ZodISODateTime;
755
+ grantId: z.ZodUUID;
756
+ benefit: z.ZodObject<{
757
+ code: z.ZodNullable<z.ZodString>;
758
+ type: z.ZodString;
759
+ properties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
760
+ source: z.ZodString;
761
+ grantedAt: z.ZodISODateTime;
762
+ }, z.core.$strip>;
763
+ }, z.core.$strip>;
764
+ readonly "benefit_grant.cycled": z.ZodObject<{
765
+ periodStart: z.ZodISODateTime;
766
+ periodEnd: z.ZodISODateTime;
767
+ grantId: z.ZodUUID;
768
+ benefit: z.ZodObject<{
769
+ code: z.ZodNullable<z.ZodString>;
770
+ type: z.ZodString;
771
+ properties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
772
+ source: z.ZodString;
773
+ grantedAt: z.ZodISODateTime;
774
+ }, z.core.$strip>;
775
+ }, z.core.$strip>;
776
+ readonly "meter.threshold_crossed": z.ZodObject<{
777
+ meter: z.ZodString;
778
+ standing: z.ZodEnum<{
779
+ ok: "ok";
780
+ low: "low";
781
+ exhausted: "exhausted";
782
+ }>;
783
+ previous: z.ZodEnum<{
784
+ ok: "ok";
785
+ low: "low";
786
+ exhausted: "exhausted";
787
+ }>;
788
+ periodStart: z.ZodISODateTime;
789
+ periodEnd: z.ZodISODateTime;
790
+ consumedUnits: z.ZodNumber;
791
+ creditedUnits: z.ZodNumber;
792
+ }, z.core.$strip>;
793
+ readonly "meter.period_closed": z.ZodObject<{
794
+ periodStart: z.ZodISODateTime;
795
+ periodEnd: z.ZodISODateTime;
796
+ subscriptionId: z.ZodNullable<z.ZodUUID>;
797
+ meters: z.ZodArray<z.ZodObject<{
798
+ meter: z.ZodString;
799
+ consumedUnits: z.ZodNumber;
800
+ creditedUnits: z.ZodNumber;
801
+ overageUnits: z.ZodNumber;
802
+ }, z.core.$strip>>;
803
+ meterChargeId: z.ZodNullable<z.ZodUUID>;
804
+ }, z.core.$strip>;
508
805
  }[T];
509
806
  }, z.core.$strip>;
510
807
  }, z.core.$strip>;
@@ -548,4 +845,4 @@ declare const PingSchema: z.ZodObject<{
548
845
  }, z.core.$strip>;
549
846
  type Ping = z.infer<typeof PingSchema>;
550
847
  //#endregion
551
- export { AccountOpenCheckoutSchema as A, AccountUpsertInput as B, AccountDeleteResponse as C, AccountInclude as D, AccountDunningStateSchema as E, AccountSchema as F, BillingProfileSchema as G, BillingProfile as H, AccountState as I, SubscriptionStatus as J, EntitlementSnapshot as K, AccountStateSchema as L, AccountProfileStateSchema as M, AccountScheduledChange as N, AccountLocaleSchema as O, AccountScheduledChangeSchema as P, AccountSubscriptionState as R, Account as S, AccountDunningState as T, BillingProfileInput as U, AccountUpsertInputSchema as V, BillingProfileKindSchema as W, SubscriptionSummary as X, SubscriptionStatusSchema as Y, SubscriptionSummarySchema as Z, PingSchema as _, BillingEvent as a, AccessState as b, EVENT_DETAIL_SCHEMAS as c, EventIdSchema as d, EventType as f, Ping as g, PING_EVENT_TYPE as h, ApiVersionSchema as i, AccountProfileState as j, AccountOpenCheckout as k, EVENT_TYPES as l, LegacyEventType as m, AnyBillingEvent as n, BillingEventOf as o, LEGACY_EVENT_TYPES as p, EntitlementSnapshotSchema as q, AnyBillingEventSchema as r, BillingEventSchema as s, AccountStateChangeCause as t, EventDetail as u, isEventType as v, AccountDeleteResponseSchema as w, AccessStateSchema as x, ACCOUNT_INCLUDES as y, AccountSubscriptionStateSchema as z };
848
+ export { EntitlementSnapshot as $, AccountMeterState as A, AccountScheduledChange as B, Account as C, AccountDunningStateSchema as D, AccountDunningState as E, AccountOpenCheckoutSchema as F, AccountSubscriptionState as G, AccountSchema as H, AccountOpenInvoice as I, AccountUpsertInputSchema as J, AccountSubscriptionStateSchema as K, AccountOpenInvoiceSchema as L, AccountMetersState as M, AccountMetersStateSchema as N, AccountInclude as O, AccountOpenCheckout as P, BillingProfileSchema as Q, AccountProfileState as R, AccessStateSchema as S, AccountDeleteResponseSchema as T, AccountState as U, AccountScheduledChangeSchema as V, AccountStateSchema as W, BillingProfileInput as X, BillingProfile as Y, BillingProfileKindSchema as Z, Ping as _, BillingEvent as a, ACCOUNT_INCLUDES as b, EVENT_DETAIL_SCHEMAS as c, EventIdSchema as d, EntitlementSnapshotSchema as et, EventType as f, PING_EVENT_TYPE as g, LegacyEventType as h, ApiVersionSchema as i, SubscriptionSummarySchema as it, AccountMeterStateSchema as j, AccountLocaleSchema as k, EVENT_TYPES as l, LEGACY_EVENT_TYPES as m, AnyBillingEvent as n, SubscriptionStatusSchema as nt, BillingEventOf as o, FULL_STATE_EVENT_TYPES as p, AccountUpsertInput as q, AnyBillingEventSchema as r, SubscriptionSummary as rt, BillingEventSchema as s, AccountStateChangeCause as t, SubscriptionStatus as tt, EventDetail as u, PingSchema as v, AccountDeleteResponse as w, AccessState as x, isEventType as y, AccountProfileStateSchema as z };