@sylphx/sdk 0.32.1 → 0.32.2

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 (120) hide show
  1. package/README.md +105 -0
  2. package/dist/access.d.ts +16 -1
  3. package/dist/access.js +1 -1
  4. package/dist/access.js.map +1 -1
  5. package/dist/agents.d.ts +463 -25
  6. package/dist/agents.js +276 -5
  7. package/dist/agents.js.map +1 -1
  8. package/dist/ai.js +1 -1
  9. package/dist/ai.js.map +1 -1
  10. package/dist/analytics.d.ts +232 -0
  11. package/dist/analytics.js +126 -0
  12. package/dist/analytics.js.map +1 -0
  13. package/dist/artifacts.d.ts +47 -1
  14. package/dist/artifacts.js +30 -2
  15. package/dist/artifacts.js.map +1 -1
  16. package/dist/assets.js +1 -1
  17. package/dist/assets.js.map +1 -1
  18. package/dist/auth/client.d.ts +34 -3
  19. package/dist/auth/client.js +42 -5
  20. package/dist/auth/client.js.map +1 -1
  21. package/dist/auth/continue-mock.d.ts +21 -0
  22. package/dist/auth/continue-mock.js +75 -0
  23. package/dist/auth/continue-mock.js.map +1 -0
  24. package/dist/auth/end-user-keys-mock.js +1 -1
  25. package/dist/auth/end-user-keys-mock.js.map +1 -1
  26. package/dist/auth/end-user-keys.js +1 -1
  27. package/dist/auth/end-user-keys.js.map +1 -1
  28. package/dist/auth/verify.js +1 -1
  29. package/dist/auth/verify.js.map +1 -1
  30. package/dist/auth.d.ts +169 -0
  31. package/dist/auth.js +135 -1
  32. package/dist/auth.js.map +1 -1
  33. package/dist/billing.d.ts +13 -6
  34. package/dist/billing.js +3 -1
  35. package/dist/billing.js.map +1 -1
  36. package/dist/broker.d.ts +165 -33
  37. package/dist/broker.js +103 -7
  38. package/dist/broker.js.map +1 -1
  39. package/dist/browser-upload.d.ts +101 -0
  40. package/dist/browser-upload.js +130 -0
  41. package/dist/browser-upload.js.map +1 -0
  42. package/dist/build.js +1 -1
  43. package/dist/build.js.map +1 -1
  44. package/dist/common.d.ts +1 -1
  45. package/dist/common.js +1 -1
  46. package/dist/common.js.map +1 -1
  47. package/dist/config/flags.d.ts +12 -2
  48. package/dist/config/flags.js +54 -6
  49. package/dist/config/flags.js.map +1 -1
  50. package/dist/config.d.ts +24 -0
  51. package/dist/config.js +22 -1
  52. package/dist/config.js.map +1 -1
  53. package/dist/connections.d.ts +128 -25
  54. package/dist/connections.js +72 -25
  55. package/dist/connections.js.map +1 -1
  56. package/dist/data.d.ts +306 -13
  57. package/dist/data.js +110 -9
  58. package/dist/data.js.map +1 -1
  59. package/dist/entitlement.js +1 -1
  60. package/dist/entitlement.js.map +1 -1
  61. package/dist/events/realtime.js +1 -1
  62. package/dist/events/realtime.js.map +1 -1
  63. package/dist/events/webhooks.js +1 -1
  64. package/dist/events/webhooks.js.map +1 -1
  65. package/dist/events.d.ts +36 -0
  66. package/dist/events.js +29 -1
  67. package/dist/events.js.map +1 -1
  68. package/dist/flags.d.ts +2 -0
  69. package/dist/flags.js +5 -1
  70. package/dist/flags.js.map +1 -1
  71. package/dist/hosting.js +1 -1
  72. package/dist/hosting.js.map +1 -1
  73. package/dist/ids.d.ts +40 -0
  74. package/dist/ids.js +9 -1
  75. package/dist/ids.js.map +1 -1
  76. package/dist/index.d.ts +5 -1
  77. package/dist/index.js +14 -2
  78. package/dist/index.js.map +1 -1
  79. package/dist/keys.js +1 -1
  80. package/dist/keys.js.map +1 -1
  81. package/dist/knowledge.d.ts +32 -9
  82. package/dist/knowledge.js +21 -11
  83. package/dist/knowledge.js.map +1 -1
  84. package/dist/localization.js +1 -1
  85. package/dist/localization.js.map +1 -1
  86. package/dist/methods.js +408 -8
  87. package/dist/methods.js.map +1 -1
  88. package/dist/money.d.ts +263 -7
  89. package/dist/money.js +121 -7
  90. package/dist/money.js.map +1 -1
  91. package/dist/network.js +1 -1
  92. package/dist/network.js.map +1 -1
  93. package/dist/notify.d.ts +340 -0
  94. package/dist/notify.js +304 -1
  95. package/dist/notify.js.map +1 -1
  96. package/dist/observability.js +1 -1
  97. package/dist/observability.js.map +1 -1
  98. package/dist/realtime.js +1 -1
  99. package/dist/realtime.js.map +1 -1
  100. package/dist/release.js +1 -1
  101. package/dist/release.js.map +1 -1
  102. package/dist/runners.js +1 -1
  103. package/dist/runners.js.map +1 -1
  104. package/dist/runtime.d.ts +3 -0
  105. package/dist/runtime.js +54 -1
  106. package/dist/runtime.js.map +1 -1
  107. package/dist/sandboxes/stream-mock.d.ts +124 -0
  108. package/dist/sandboxes/stream-mock.js +476 -0
  109. package/dist/sandboxes/stream-mock.js.map +1 -0
  110. package/dist/sandboxes/stream.d.ts +407 -0
  111. package/dist/sandboxes/stream.js +335 -0
  112. package/dist/sandboxes/stream.js.map +1 -0
  113. package/dist/sandboxes.d.ts +94 -17
  114. package/dist/sandboxes.js +33 -4
  115. package/dist/sandboxes.js.map +1 -1
  116. package/dist/secrets.js +1 -1
  117. package/dist/secrets.js.map +1 -1
  118. package/dist/workflows.js +1 -1
  119. package/dist/workflows.js.map +1 -1
  120. package/package.json +1 -1
package/dist/money.d.ts CHANGED
@@ -45,6 +45,35 @@ export interface BatchIngestUsageEventsResponse {
45
45
  /** One per event, in request order. */
46
46
  results?: IngestedUsageEventResult[];
47
47
  }
48
+ /**
49
+ * Signed booked sales/refunds in native currency, sorted by dimensions.
50
+ * Only Money's own ledger-backed daily roll-up counts. It does not include
51
+ * pre-adoption history, unpriced purchases or external revenue reports.
52
+ */
53
+ export interface BookedVolumeLine {
54
+ /** The app's project resource name. */
55
+ project?: string;
56
+ /** The environment resource name. */
57
+ environment?: string;
58
+ /** The app/package, bundle or Stripe product reference; empty stays empty. */
59
+ productRef?: string;
60
+ /** stripe, app_store or google_play. */
61
+ channel?: string;
62
+ /** ISO 4217 currency; never sum amounts across currencies. */
63
+ currencyCode?: string;
64
+ /** Signed integer minor units in currency_code; refunds subtract. */
65
+ gross?: string;
66
+ /** Recorded processor fees, not an estimate of eventual settlement fees. */
67
+ fee?: string;
68
+ /** Recorded tax in native minor units. */
69
+ tax?: string;
70
+ /** Recorded net in native minor units. */
71
+ net?: string;
72
+ /** Signed units: full reversals subtract units, partial refunds may not. */
73
+ units?: string;
74
+ /** Number of booked ledger postings, including refund postings. */
75
+ postingCount?: string;
76
+ }
48
77
  /** The request of CancelCustomerSubscription. */
49
78
  export interface CancelCustomerSubscriptionRequest {
50
79
  /** The subscription to cancel. */
@@ -92,6 +121,15 @@ export interface CatalogSpec {
92
121
  * then means on.
93
122
  */
94
123
  refundClawBack?: boolean;
124
+ /**
125
+ * Caller-owned, publicly readable application data published atomically with
126
+ * the products in this revision. Money preserves it without interpreting its
127
+ * schema or using it for prices, grants, checkout or processor reconciliation.
128
+ * The caller validates its schema and version. At most 65536 UTF-8 bytes when
129
+ * serialized as compact JSON; must be an object. Never include secrets or
130
+ * personal data: the public catalog exposes this field.
131
+ */
132
+ applicationData?: Record<string, unknown>;
95
133
  }
96
134
  /** CatalogStatus is the observed state of a Catalog. */
97
135
  export interface CatalogStatus {
@@ -162,6 +200,47 @@ export interface CheckUsageStandingRequest {
162
200
  /** For a customer organization: the acting user's token. */
163
201
  actorProof?: string;
164
202
  }
203
+ /**
204
+ * The consent evidence of one checkout: what was asked, what the buyer
205
+ * answered, and when Money recorded it.
206
+ */
207
+ export interface CheckoutConsent {
208
+ /** Whether the buyer ticked the terms. */
209
+ readonly termsAccepted?: boolean;
210
+ /** The wording the buyer saw. */
211
+ readonly termsText?: string;
212
+ /** The version of that wording. */
213
+ readonly termsVersion?: string;
214
+ /** `opt_in`, `opt_out`, or empty when promotions were not asked. */
215
+ readonly promotions?: string;
216
+ /** When Money first recorded the answer. */
217
+ readonly recordTime?: string;
218
+ }
219
+ /** The consent a checkout page collects. */
220
+ export interface CheckoutConsentCollection {
221
+ /**
222
+ * Require a tick accepting `terms_text` before the buyer can pay. The
223
+ * merchant's Stripe account needs a terms of service URL in its public
224
+ * business details; without one the create fails with
225
+ * `processor_terms_url_missing`.
226
+ */
227
+ termsRequired?: boolean;
228
+ /**
229
+ * The wording shown next to the tick; at most 1200 characters. Required
230
+ * with `terms_required`.
231
+ */
232
+ termsText?: string;
233
+ /**
234
+ * Which version of the wording this is, recorded with the consent as
235
+ * evidence; at most 64 characters. Required with `terms_required`.
236
+ */
237
+ termsVersion?: string;
238
+ /**
239
+ * Offer the buyer an opt-in to promotional email where the processor
240
+ * allows it.
241
+ */
242
+ promotions?: boolean;
243
+ }
165
244
  /**
166
245
  * A Checkout Policy is an environment's seller setting for which buyers
167
246
  * consumer checkout refuses, by buyer country (docs/services/money/web-payments.md,
@@ -241,6 +320,11 @@ export interface CheckoutSession {
241
320
  * payment completes.
242
321
  */
243
322
  buyerCountryCode?: string;
323
+ /**
324
+ * Countries whose shipping address the hosted page collects, upper-case ISO
325
+ * 3166-1 alpha-2. Empty means no shipping address is collected.
326
+ */
327
+ shippingCountryCodes?: string[];
244
328
  /** The hosted page. */
245
329
  readonly url?: string;
246
330
  /** `open`, `complete`, or `expired`. */
@@ -266,6 +350,28 @@ export interface CheckoutSession {
266
350
  * Nothing else of the buyer's address is stored.
267
351
  */
268
352
  readonly billingSubdivisionCode?: string;
353
+ /**
354
+ * The consent the hosted page collects before it takes payment, for
355
+ * example a required tick for a withdrawal waiver or the terms of sale.
356
+ */
357
+ consentCollection?: CheckoutConsentCollection;
358
+ /** The consent the buyer gave, recorded once the processor reports it. */
359
+ readonly consent?: CheckoutConsent;
360
+ /** The buyer's email address, once the hosted checkout has collected it. */
361
+ readonly customerEmail?: string;
362
+ /**
363
+ * The physical delivery address, when `shipping_country_codes` was set and
364
+ * the hosted checkout has collected it.
365
+ */
366
+ readonly shippingAddress?: ShippingAddress;
367
+ /** The processor's current total in minor units, when it has reported one. */
368
+ readonly amountTotal?: string;
369
+ /** `unpaid`, `paid`, or `revoked`; empty until a one-time checkout settles. */
370
+ readonly paymentStatus?: string;
371
+ /** The processor's live/test mode, once the session has reported it. */
372
+ readonly livemode?: boolean;
373
+ /** The processor payment this checkout produced; empty before settlement. */
374
+ readonly processorPaymentId?: string;
269
375
  }
270
376
  /** The request of ClientVerifyStorePurchase. */
271
377
  export interface ClientVerifyStorePurchaseRequest {
@@ -487,6 +593,14 @@ export interface CustomerSubscription {
487
593
  readonly trialEndTime?: string;
488
594
  /** The checkout's metadata. */
489
595
  readonly metadata?: Record<string, unknown>;
596
+ /**
597
+ * The buyer's billing country, upper-case ISO 3166-1 alpha-2 (for example
598
+ * `HK`), for a web subscription: the processor customer's billing address
599
+ * (which checkout requires and saves), else the default payment method's
600
+ * billing address. Kept current when the processor reports a subscription
601
+ * or customer change. Empty when unknown, and for store subscriptions.
602
+ */
603
+ readonly billingCountryCode?: string;
490
604
  }
491
605
  /** The request of DeleteRevenueSource. */
492
606
  export interface DeleteRevenueSourceRequest {
@@ -540,7 +654,9 @@ export interface EntitlementGrant {
540
654
  reason?: string;
541
655
  /**
542
656
  * A free-text reference to the approval, for example `CEO 2026-10-02`
543
- * (input on create, up to 200 characters).
657
+ * (input on create, up to 200 characters). A test grant's (`test/<id>`) is
658
+ * set by the server, `synthetic:<env>:<synthetic_time>`, and the input is
659
+ * ignored.
544
660
  */
545
661
  approvalRef?: string;
546
662
  /**
@@ -576,6 +692,11 @@ export interface ExchangeRate {
576
692
  */
577
693
  readonly publicationDay?: string;
578
694
  }
695
+ /** The request of ExpireCheckoutSession. */
696
+ export interface ExpireCheckoutSessionRequest {
697
+ /** The Money checkout resource to expire. */
698
+ name: string;
699
+ }
579
700
  /**
580
701
  * A Feature is what an app checks, for example `plus` or
581
702
  * `exports.per_month`.
@@ -1302,6 +1423,16 @@ export interface Price {
1302
1423
  * currency is immutable there.
1303
1424
  */
1304
1425
  defaultCurrency?: string;
1426
+ /**
1427
+ * Optional introductory unit amounts for the first paid billing period of a
1428
+ * new subject's subscription to this product. `unit_amounts` remains the
1429
+ * renewal price. Must cover exactly the same currencies, each strictly lower
1430
+ * than its renewal amount and greater than zero. Recurring prices only;
1431
+ * cannot be combined with a free trial. Web checkout accepts one line item
1432
+ * for an introductory offer and does not combine it with promotion codes.
1433
+ * Store introductory offers are configured and enforced by the store.
1434
+ */
1435
+ introductoryUnitAmounts?: Record<string, string>;
1305
1436
  }
1306
1437
  /** A Product is one thing sold, with its prices and the features it grants. */
1307
1438
  export interface Product {
@@ -1345,6 +1476,37 @@ export interface RefreshMerchantAccountRequest {
1345
1476
  /** The merchant account to read back. */
1346
1477
  name: string;
1347
1478
  }
1479
+ /** A processor refund created for a one-time checkout. */
1480
+ export interface Refund {
1481
+ /** The processor's refund id. */
1482
+ readonly id?: string;
1483
+ /** The Money checkout resource this refund belongs to. */
1484
+ readonly checkoutSession?: string;
1485
+ /** The processor payment intent the refund applies to. */
1486
+ readonly paymentIntent?: string;
1487
+ /** Amount refunded in minor units. */
1488
+ readonly amountMinor?: string;
1489
+ /** ISO 4217 currency code. */
1490
+ readonly currencyCode?: string;
1491
+ /** The processor's refund status. */
1492
+ readonly status?: string;
1493
+ }
1494
+ /** The request of RefundCheckoutSession. */
1495
+ export interface RefundCheckoutSessionRequest {
1496
+ /** The Money checkout resource to refund. */
1497
+ name: string;
1498
+ /** Optional partial amount in minor units; empty refunds the remaining amount. */
1499
+ amountMinor?: string;
1500
+ /** Optional processor refund reason. */
1501
+ reason?: string;
1502
+ /** Caller metadata, such as the app's return and order ids. At most 20 keys. */
1503
+ metadata?: Record<string, string>;
1504
+ }
1505
+ /** The processor refund created for this checkout. */
1506
+ export interface RefundCheckoutSessionResponse {
1507
+ /** The refund receipt, read back from the processor after creation. */
1508
+ readonly refund?: Refund;
1509
+ }
1348
1510
  /** The request of ReleaseUsageInvoiceCollection. */
1349
1511
  export interface ReleaseUsageInvoiceCollectionRequest {
1350
1512
  /** The held invoice to release for collection. */
@@ -1484,6 +1646,12 @@ export interface RevenueSourceSpec {
1484
1646
  * never a credential. At most 32 entries.
1485
1647
  */
1486
1648
  config?: Record<string, string>;
1649
+ /**
1650
+ * The connector's credential, such as a Stripe live restricted key with
1651
+ * read access to balance transactions and payouts. Shared by all connector
1652
+ * kinds: sealed on write, never returned; omit it on update to keep it.
1653
+ */
1654
+ credential?: string;
1487
1655
  }
1488
1656
  /** RevenueSourceStatus is the observed state of a RevenueSource. */
1489
1657
  export interface RevenueSourceStatus {
@@ -1563,6 +1731,12 @@ export interface RevenueSummary {
1563
1731
  readonly unconvertedCount?: string;
1564
1732
  /** A stale source has not reported some day of the period. */
1565
1733
  readonly incomplete?: boolean;
1734
+ /**
1735
+ * Ledger-backed booked volume for this exact period, by app/environment,
1736
+ * channel and original currency. Never FX converted or replaced by imported
1737
+ * estimates/final reports; independent of amount, split and group_by.
1738
+ */
1739
+ readonly bookedVolume?: BookedVolumeLine[];
1566
1740
  }
1567
1741
  /** The request of RunRevenueSource. */
1568
1742
  export interface RunRevenueSourceRequest {
@@ -1601,6 +1775,56 @@ export interface SettleUsageReservationRequest {
1601
1775
  /** When the work happened; now when absent. */
1602
1776
  occurredTime?: string;
1603
1777
  }
1778
+ /** A shipping address collected by the hosted checkout for a physical order. */
1779
+ export interface ShippingAddress {
1780
+ /** Recipient name. */
1781
+ readonly recipient?: string;
1782
+ /** First address line. */
1783
+ readonly line1?: string;
1784
+ /** Optional second address line. */
1785
+ readonly line2?: string;
1786
+ /** City or town. */
1787
+ readonly city?: string;
1788
+ /** State, county or province. */
1789
+ readonly region?: string;
1790
+ /** Postcode. */
1791
+ readonly postalCode?: string;
1792
+ /** Upper-case ISO 3166-1 alpha-2 region code. */
1793
+ readonly regionCode?: string;
1794
+ }
1795
+ /** The request of SnapshotEntitlementGrants. */
1796
+ export interface SnapshotEntitlementGrantsRequest {
1797
+ /** The environment whose entitlement collection is read. */
1798
+ parent: string;
1799
+ /** At most this many; default 50, clamped to 1000. */
1800
+ pageSize?: number;
1801
+ /** `next_page_token` of the previous page of this snapshot. */
1802
+ pageToken?: string;
1803
+ /** AIP-160 filter over entitlement grant fields. */
1804
+ filter?: string;
1805
+ /**
1806
+ * Expected environment-wide collection revision, as a canonical decimal
1807
+ * string. Empty selects the current source snapshot; any nonempty value,
1808
+ * including "0", requires equality or returns HTTP 409 ETAG_MISMATCH.
1809
+ * Send the first response's revision on every subsequent page. Page tokens
1810
+ * also fence that revision and cannot be reused after a collection change.
1811
+ */
1812
+ snapshotRevision?: string;
1813
+ }
1814
+ /** The response of SnapshotEntitlementGrants. */
1815
+ export interface SnapshotEntitlementGrantsResponse {
1816
+ /** The page. */
1817
+ entitlementGrants?: EntitlementGrant[];
1818
+ /** The token of the next page; empty on the last page. */
1819
+ nextPageToken?: string;
1820
+ /**
1821
+ * Always present as a canonical decimal string, including "0" for a source
1822
+ * with no committed grant mutations. Versions all grants in the environment,
1823
+ * regardless of filter, including deletion of the last grant. Not a clock
1824
+ * or resource etag. Rows and revision are read in one database snapshot.
1825
+ */
1826
+ readonly snapshotRevision?: string;
1827
+ }
1604
1828
  /** A source named on a summary because it reports late. */
1605
1829
  export interface StaleRevenueSource {
1606
1830
  /** `orgs/{org}/revenue_sources/{id}`. */
@@ -2518,15 +2742,25 @@ export declare class EntitlementGrantsCollection {
2518
2742
  */
2519
2743
  get(request: GetEntitlementGrantRequest): Promise<EntitlementGrant>;
2520
2744
  /**
2521
- * Lists entitlement grants.
2745
+ * Lists entitlement grants. Continuation tokens reject collection changes
2746
+ * with ETAG_MISMATCH; restart without a page token after a conflict.
2522
2747
  *
2523
2748
  * `GET /v1/{parent=orgs/*\/projects/*\/envs/*}/entitlement_grants` · permission `billing:read` · effect `read`
2524
2749
  *
2525
- * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `PAGE_TOKEN_MISMATCH`.
2750
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `PAGE_TOKEN_MISMATCH`, `ETAG_MISMATCH`.
2526
2751
  */
2527
2752
  list(request: ListEntitlementGrantsRequest): Promise<ListEntitlementGrantsResponse>;
2528
2753
  /** Every item of every page of `list`. */
2529
2754
  listAll(request: ListEntitlementGrantsRequest): AsyncGenerator<EntitlementGrant>;
2755
+ /**
2756
+ * Reads a coherent entitlement snapshot with an environment-wide source
2757
+ * revision. Discard every page and restart after ETAG_MISMATCH.
2758
+ *
2759
+ * `GET /v1/{parent=orgs/*\/projects/*\/envs/*}/entitlement_grants:snapshot` · permission `billing:read` · effect `read`
2760
+ *
2761
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `PAGE_TOKEN_MISMATCH`, `ETAG_MISMATCH`.
2762
+ */
2763
+ snapshot(request: SnapshotEntitlementGrantsRequest): Promise<SnapshotEntitlementGrantsResponse>;
2530
2764
  /**
2531
2765
  * Answers whether a subject holds a feature now, and how much of it.
2532
2766
  *
@@ -2536,12 +2770,18 @@ export declare class EntitlementGrantsCollection {
2536
2770
  */
2537
2771
  check(request: CheckEntitlementRequest): Promise<CheckEntitlementResponse>;
2538
2772
  /**
2539
- * Creates a manual entitlement grant (support, comp, grace). Append-only;
2540
- * needs the approval-class scope. The approver recorded is the key's principal.
2773
+ * Creates a manual entitlement grant (support, comp, grace). Append-only.
2774
+ * The subject decides what it needs: an end user the env's Sylphx Auth
2775
+ * stamped as a born-synthetic test account gets a test grant (`test/<id>`,
2776
+ * at most 90 days, approval_ref set by the server) with
2777
+ * `billing:test_grants:write`; any other subject needs the approval-class
2778
+ * `billing:credits.approve` and is refused PERMISSION_DENIED
2779
+ * (`subject_not_synthetic`) otherwise. The approver recorded is the key's
2780
+ * principal.
2541
2781
  *
2542
- * `POST /v1/{parent=orgs/*\/projects/*\/envs/*}/entitlement_grants` · permission `billing:credits.approve` · effect `write`
2782
+ * `POST /v1/{parent=orgs/*\/projects/*\/envs/*}/entitlement_grants` · permission `billing:test_grants:write` · effect `write`
2543
2783
  *
2544
- * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `UNKNOWN_FIELD`, `RESOURCE_ALREADY_EXISTS`.
2784
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `UNKNOWN_FIELD`, `RESOURCE_ALREADY_EXISTS`, `UNAVAILABLE`.
2545
2785
  */
2546
2786
  create(request: CreateEntitlementGrantRequest): Promise<EntitlementGrant>;
2547
2787
  }
@@ -2623,6 +2863,22 @@ export declare class CheckoutSessionsCollection {
2623
2863
  * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`.
2624
2864
  */
2625
2865
  get(request: GetCheckoutSessionRequest): Promise<CheckoutSession>;
2866
+ /**
2867
+ * Expires an open hosted checkout so it can no longer be paid.
2868
+ *
2869
+ * `POST /v1/{name=orgs/*\/projects/*\/envs/*\/checkout_sessions/*}:expire` · permission `billing:write` · effect `write`
2870
+ *
2871
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `INVALID_STATE`, `UNAVAILABLE`, `IDEMPOTENCY_KEY_REUSED`, `IDEMPOTENCY_IN_PROGRESS`.
2872
+ */
2873
+ expire(request: ExpireCheckoutSessionRequest): Promise<CheckoutSession>;
2874
+ /**
2875
+ * Refund all or part of a paid one-time checkout.
2876
+ *
2877
+ * `POST /v1/{name=orgs/*\/projects/*\/envs/*\/checkout_sessions/*}:refund` · permission `billing:write` · effect `write`
2878
+ *
2879
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `INVALID_STATE`, `INVALID_FIELD`, `UNAVAILABLE`, `IDEMPOTENCY_KEY_REUSED`, `IDEMPOTENCY_IN_PROGRESS`.
2880
+ */
2881
+ refund(request: RefundCheckoutSessionRequest): Promise<RefundCheckoutSessionResponse>;
2626
2882
  }
2627
2883
  /** `tax_threshold_statuses` of Sylphx Money: Resource type `money.sylphx.com/TaxThresholdStatus`. */
2628
2884
  export declare class TaxThresholdStatusesCollection {
package/dist/money.js CHANGED
@@ -1,4 +1,4 @@
1
- // @generated by sylphx-gen 0.1.0 from contracts@c8a7361c53e572321b0ec9fb014fd1e8279b007b62562423038e0d0e5b9d767a. Do not edit.
1
+ // @generated by sylphx-gen. Do not edit.
2
2
  // `sylphx.money.v1`.
3
3
  import * as runtime from './runtime.js';
4
4
  import './common.js';
@@ -17,6 +17,11 @@ runtime.registerSchemas({
17
17
  'sylphx.money.v1.BatchIngestUsageEventsResponse': [
18
18
  ['results', 'results', 'sylphx.money.v1.IngestedUsageEventResult'],
19
19
  ],
20
+ 'sylphx.money.v1.BookedVolumeLine': [
21
+ ['productRef', 'product_ref'],
22
+ ['currencyCode', 'currency_code'],
23
+ ['postingCount', 'posting_count'],
24
+ ],
20
25
  'sylphx.money.v1.CancelCustomerSubscriptionRequest': [
21
26
  ['atPeriodEnd', 'at_period_end'],
22
27
  ['refundLastPayment', 'refund_last_payment'],
@@ -31,6 +36,7 @@ runtime.registerSchemas({
31
36
  ['products', 'products', 'sylphx.money.v1.Product'],
32
37
  ['clientGrantTtl', 'client_grant_ttl'],
33
38
  ['refundClawBack', 'refund_claw_back'],
39
+ ['applicationData', 'application_data', undefined, 'json'],
34
40
  ],
35
41
  'sylphx.money.v1.CatalogStatus': [
36
42
  ['observedGeneration', 'observed_generation'],
@@ -54,6 +60,17 @@ runtime.registerSchemas({
54
60
  ['subjectProof', 'subject_proof'],
55
61
  ['actorProof', 'actor_proof'],
56
62
  ],
63
+ 'sylphx.money.v1.CheckoutConsent': [
64
+ ['termsAccepted', 'terms_accepted'],
65
+ ['termsText', 'terms_text'],
66
+ ['termsVersion', 'terms_version'],
67
+ ['recordTime', 'record_time'],
68
+ ],
69
+ 'sylphx.money.v1.CheckoutConsentCollection': [
70
+ ['termsRequired', 'terms_required'],
71
+ ['termsText', 'terms_text'],
72
+ ['termsVersion', 'terms_version'],
73
+ ],
57
74
  'sylphx.money.v1.CheckoutPolicy': [
58
75
  ['meta', 'meta', 'sylphx.common.v1.ResourceMeta'],
59
76
  ['spec', 'spec', 'sylphx.money.v1.CheckoutPolicySpec'],
@@ -72,11 +89,19 @@ runtime.registerSchemas({
72
89
  ['metadata', 'metadata', undefined, 'map'],
73
90
  ['allowPromotionCodes', 'allow_promotion_codes'],
74
91
  ['buyerCountryCode', 'buyer_country_code'],
92
+ ['shippingCountryCodes', 'shipping_country_codes'],
75
93
  ['expireTime', 'expire_time'],
76
94
  ['processorSessionId', 'processor_session_id'],
77
95
  ['deniedReason', 'denied_reason'],
78
96
  ['billingCountryCode', 'billing_country_code'],
79
97
  ['billingSubdivisionCode', 'billing_subdivision_code'],
98
+ ['consentCollection', 'consent_collection', 'sylphx.money.v1.CheckoutConsentCollection'],
99
+ ['consent', 'consent', 'sylphx.money.v1.CheckoutConsent'],
100
+ ['customerEmail', 'customer_email'],
101
+ ['shippingAddress', 'shipping_address', 'sylphx.money.v1.ShippingAddress'],
102
+ ['amountTotal', 'amount_total'],
103
+ ['paymentStatus', 'payment_status'],
104
+ ['processorPaymentId', 'processor_payment_id'],
80
105
  ],
81
106
  'sylphx.money.v1.ClientVerifyStorePurchaseRequest': [
82
107
  ['subject', 'subject', 'sylphx.money.v1.Subject'],
@@ -148,6 +173,7 @@ runtime.registerSchemas({
148
173
  ['cancelAtPeriodEnd', 'cancel_at_period_end'],
149
174
  ['trialEndTime', 'trial_end_time'],
150
175
  ['metadata', 'metadata', undefined, 'json'],
176
+ ['billingCountryCode', 'billing_country_code'],
151
177
  ],
152
178
  'sylphx.money.v1.DeleteRevenueSourceRequest': [
153
179
  ['validateOnly', 'validate_only'],
@@ -166,6 +192,7 @@ runtime.registerSchemas({
166
192
  ['perUsd', 'per_usd'],
167
193
  ['publicationDay', 'publication_day'],
168
194
  ],
195
+ 'sylphx.money.v1.ExpireCheckoutSessionRequest': [],
169
196
  'sylphx.money.v1.Feature': [
170
197
  ['displayName', 'display_name'],
171
198
  ],
@@ -400,6 +427,7 @@ runtime.registerSchemas({
400
427
  ['taxBehavior', 'tax_behavior'],
401
428
  ['trialDays', 'trial_days'],
402
429
  ['defaultCurrency', 'default_currency'],
430
+ ['introductoryUnitAmounts', 'introductory_unit_amounts', undefined, 'map'],
403
431
  ],
404
432
  'sylphx.money.v1.Product': [
405
433
  ['displayName', 'display_name'],
@@ -410,6 +438,19 @@ runtime.registerSchemas({
410
438
  ['licence', 'licence', 'sylphx.money.v1.LicencePolicy'],
411
439
  ],
412
440
  'sylphx.money.v1.RefreshMerchantAccountRequest': [],
441
+ 'sylphx.money.v1.Refund': [
442
+ ['checkoutSession', 'checkout_session'],
443
+ ['paymentIntent', 'payment_intent'],
444
+ ['amountMinor', 'amount_minor'],
445
+ ['currencyCode', 'currency_code'],
446
+ ],
447
+ 'sylphx.money.v1.RefundCheckoutSessionRequest': [
448
+ ['amountMinor', 'amount_minor'],
449
+ ['metadata', 'metadata', undefined, 'map'],
450
+ ],
451
+ 'sylphx.money.v1.RefundCheckoutSessionResponse': [
452
+ ['refund', 'refund', 'sylphx.money.v1.Refund'],
453
+ ],
413
454
  'sylphx.money.v1.ReleaseUsageInvoiceCollectionRequest': [],
414
455
  'sylphx.money.v1.ReleaseUsageReservationRequest': [],
415
456
  'sylphx.money.v1.ResumeCustomerSubscriptionRequest': [],
@@ -458,6 +499,7 @@ runtime.registerSchemas({
458
499
  ['staleSources', 'stale_sources', 'sylphx.money.v1.StaleRevenueSource'],
459
500
  ['unconverted', 'unconverted', 'sylphx.money.v1.UnconvertedAmount'],
460
501
  ['unconvertedCount', 'unconverted_count'],
502
+ ['bookedVolume', 'booked_volume', 'sylphx.money.v1.BookedVolumeLine'],
461
503
  ],
462
504
  'sylphx.money.v1.RunRevenueSourceRequest': [
463
505
  ['startDay', 'start_day'],
@@ -470,6 +512,20 @@ runtime.registerSchemas({
470
512
  ['quantityUsed', 'quantity_used'],
471
513
  ['occurredTime', 'occurred_time'],
472
514
  ],
515
+ 'sylphx.money.v1.ShippingAddress': [
516
+ ['postalCode', 'postal_code'],
517
+ ['regionCode', 'region_code'],
518
+ ],
519
+ 'sylphx.money.v1.SnapshotEntitlementGrantsRequest': [
520
+ ['pageSize', 'page_size'],
521
+ ['pageToken', 'page_token'],
522
+ ['snapshotRevision', 'snapshot_revision'],
523
+ ],
524
+ 'sylphx.money.v1.SnapshotEntitlementGrantsResponse': [
525
+ ['entitlementGrants', 'entitlement_grants', 'sylphx.money.v1.EntitlementGrant'],
526
+ ['nextPageToken', 'next_page_token'],
527
+ ['snapshotRevision', 'snapshot_revision'],
528
+ ],
473
529
  'sylphx.money.v1.StaleRevenueSource': [
474
530
  ['displayName', 'display_name'],
475
531
  ['newestDay', 'newest_day'],
@@ -1187,11 +1243,12 @@ export class EntitlementGrantsCollection {
1187
1243
  });
1188
1244
  }
1189
1245
  /**
1190
- * Lists entitlement grants.
1246
+ * Lists entitlement grants. Continuation tokens reject collection changes
1247
+ * with ETAG_MISMATCH; restart without a page token after a conflict.
1191
1248
  *
1192
1249
  * `GET /v1/{parent=orgs/*\/projects/*\/envs/*}/entitlement_grants` · permission `billing:read` · effect `read`
1193
1250
  *
1194
- * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `PAGE_TOKEN_MISMATCH`.
1251
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `PAGE_TOKEN_MISMATCH`, `ETAG_MISMATCH`.
1195
1252
  */
1196
1253
  async list(request) {
1197
1254
  return this.client.call({
@@ -1213,6 +1270,23 @@ export class EntitlementGrantsCollection {
1213
1270
  next = { ...request, pageToken: page.nextPageToken };
1214
1271
  }
1215
1272
  }
1273
+ /**
1274
+ * Reads a coherent entitlement snapshot with an environment-wide source
1275
+ * revision. Discard every page and restart after ETAG_MISMATCH.
1276
+ *
1277
+ * `GET /v1/{parent=orgs/*\/projects/*\/envs/*}/entitlement_grants:snapshot` · permission `billing:read` · effect `read`
1278
+ *
1279
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `PAGE_TOKEN_MISMATCH`, `ETAG_MISMATCH`.
1280
+ */
1281
+ async snapshot(request) {
1282
+ return this.client.call({
1283
+ method: 'GET',
1284
+ path: `/v1/${runtime.pathParam(request.parent, 'orgs/*/projects/*/envs/*', 'parent')}/entitlement_grants:snapshot`,
1285
+ query: { page_size: request.pageSize, page_token: request.pageToken, filter: request.filter, snapshot_revision: request.snapshotRevision },
1286
+ responseType: 'sylphx.money.v1.SnapshotEntitlementGrantsResponse',
1287
+ mutation: false,
1288
+ });
1289
+ }
1216
1290
  /**
1217
1291
  * Answers whether a subject holds a feature now, and how much of it.
1218
1292
  *
@@ -1231,12 +1305,18 @@ export class EntitlementGrantsCollection {
1231
1305
  });
1232
1306
  }
1233
1307
  /**
1234
- * Creates a manual entitlement grant (support, comp, grace). Append-only;
1235
- * needs the approval-class scope. The approver recorded is the key's principal.
1308
+ * Creates a manual entitlement grant (support, comp, grace). Append-only.
1309
+ * The subject decides what it needs: an end user the env's Sylphx Auth
1310
+ * stamped as a born-synthetic test account gets a test grant (`test/<id>`,
1311
+ * at most 90 days, approval_ref set by the server) with
1312
+ * `billing:test_grants:write`; any other subject needs the approval-class
1313
+ * `billing:credits.approve` and is refused PERMISSION_DENIED
1314
+ * (`subject_not_synthetic`) otherwise. The approver recorded is the key's
1315
+ * principal.
1236
1316
  *
1237
- * `POST /v1/{parent=orgs/*\/projects/*\/envs/*}/entitlement_grants` · permission `billing:credits.approve` · effect `write`
1317
+ * `POST /v1/{parent=orgs/*\/projects/*\/envs/*}/entitlement_grants` · permission `billing:test_grants:write` · effect `write`
1238
1318
  *
1239
- * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `UNKNOWN_FIELD`, `RESOURCE_ALREADY_EXISTS`.
1319
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `UNKNOWN_FIELD`, `RESOURCE_ALREADY_EXISTS`, `UNAVAILABLE`.
1240
1320
  */
1241
1321
  async create(request) {
1242
1322
  return this.client.call({
@@ -1410,6 +1490,40 @@ export class CheckoutSessionsCollection {
1410
1490
  mutation: false,
1411
1491
  });
1412
1492
  }
1493
+ /**
1494
+ * Expires an open hosted checkout so it can no longer be paid.
1495
+ *
1496
+ * `POST /v1/{name=orgs/*\/projects/*\/envs/*\/checkout_sessions/*}:expire` · permission `billing:write` · effect `write`
1497
+ *
1498
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `INVALID_STATE`, `UNAVAILABLE`, `IDEMPOTENCY_KEY_REUSED`, `IDEMPOTENCY_IN_PROGRESS`.
1499
+ */
1500
+ async expire(request) {
1501
+ return this.client.call({
1502
+ method: 'POST',
1503
+ path: `/v1/${runtime.pathParam(request.name, 'orgs/*/projects/*/envs/*/checkout_sessions/*', 'name')}:expire`,
1504
+ body: runtime.omit(request, ['name']),
1505
+ bodyType: 'sylphx.money.v1.ExpireCheckoutSessionRequest',
1506
+ responseType: 'sylphx.money.v1.CheckoutSession',
1507
+ mutation: true,
1508
+ });
1509
+ }
1510
+ /**
1511
+ * Refund all or part of a paid one-time checkout.
1512
+ *
1513
+ * `POST /v1/{name=orgs/*\/projects/*\/envs/*\/checkout_sessions/*}:refund` · permission `billing:write` · effect `write`
1514
+ *
1515
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `INVALID_STATE`, `INVALID_FIELD`, `UNAVAILABLE`, `IDEMPOTENCY_KEY_REUSED`, `IDEMPOTENCY_IN_PROGRESS`.
1516
+ */
1517
+ async refund(request) {
1518
+ return this.client.call({
1519
+ method: 'POST',
1520
+ path: `/v1/${runtime.pathParam(request.name, 'orgs/*/projects/*/envs/*/checkout_sessions/*', 'name')}:refund`,
1521
+ body: runtime.omit(request, ['name']),
1522
+ bodyType: 'sylphx.money.v1.RefundCheckoutSessionRequest',
1523
+ responseType: 'sylphx.money.v1.RefundCheckoutSessionResponse',
1524
+ mutation: true,
1525
+ });
1526
+ }
1413
1527
  }
1414
1528
  /** `tax_threshold_statuses` of Sylphx Money: Resource type `money.sylphx.com/TaxThresholdStatus`. */
1415
1529
  export class TaxThresholdStatusesCollection {