@01.software/sdk 0.51.0 → 0.56.1

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 (51) hide show
  1. package/CHANGELOG.md +127 -0
  2. package/README.md +54 -11
  3. package/dist/client.cjs +420 -53
  4. package/dist/client.cjs.map +1 -1
  5. package/dist/client.d.cts +6 -6
  6. package/dist/client.d.ts +6 -6
  7. package/dist/client.js +420 -53
  8. package/dist/client.js.map +1 -1
  9. package/dist/{collection-client-hYvVfHIm.d.ts → collection-client-Bmr53saa.d.ts} +4 -4
  10. package/dist/{collection-client-CWAeuzV4.d.cts → collection-client-DxuBDso_.d.cts} +4 -4
  11. package/dist/{const-D8LixhAJ.d.cts → const-BKUqg96Q.d.ts} +2 -2
  12. package/dist/{const-JD8obaKg.d.ts → const-Cv1DCsp6.d.cts} +2 -2
  13. package/dist/{index-Bu0kCc6o.d.cts → index-CGsT4AQ8.d.cts} +24 -7
  14. package/dist/{index-B0Hjh3Ey.d.ts → index-DFHLLqYu.d.ts} +24 -7
  15. package/dist/index.cjs +434 -55
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +11 -10
  18. package/dist/index.d.ts +11 -10
  19. package/dist/index.js +434 -55
  20. package/dist/index.js.map +1 -1
  21. package/dist/{payload-types-BOsckg8B.d.cts → payload-types-Bk-duc5k.d.cts} +295 -100
  22. package/dist/{payload-types-BOsckg8B.d.ts → payload-types-Bk-duc5k.d.ts} +295 -100
  23. package/dist/query.cjs +14 -1
  24. package/dist/query.cjs.map +1 -1
  25. package/dist/query.d.cts +5 -5
  26. package/dist/query.d.ts +5 -5
  27. package/dist/query.js +14 -1
  28. package/dist/query.js.map +1 -1
  29. package/dist/realtime.d.cts +2 -2
  30. package/dist/realtime.d.ts +2 -2
  31. package/dist/server.cjs +98 -13
  32. package/dist/server.cjs.map +1 -1
  33. package/dist/server.d.cts +9 -8
  34. package/dist/server.d.ts +9 -8
  35. package/dist/server.js +98 -13
  36. package/dist/server.js.map +1 -1
  37. package/dist/{types-Bj8j7VHU.d.ts → types-CEK8uTvU.d.ts} +212 -11
  38. package/dist/{types-B14sEt1z.d.cts → types-CNdpj2fI.d.cts} +2 -2
  39. package/dist/{types-5ZlcAFuU.d.ts → types-D4mjGFj4.d.ts} +2 -2
  40. package/dist/{types-CM5qiR2k.d.cts → types-Dhk5NX7Z.d.cts} +212 -11
  41. package/dist/ui/form.d.cts +1 -1
  42. package/dist/ui/form.d.ts +1 -1
  43. package/dist/ui/video.d.cts +1 -1
  44. package/dist/ui/video.d.ts +1 -1
  45. package/dist/webhook.cjs +13 -2
  46. package/dist/webhook.cjs.map +1 -1
  47. package/dist/webhook.d.cts +5 -5
  48. package/dist/webhook.d.ts +5 -5
  49. package/dist/webhook.js +13 -2
  50. package/dist/webhook.js.map +1 -1
  51. package/package.json +6 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,132 @@
1
1
  # @01.software/sdk
2
2
 
3
+ ## 0.56.1
4
+
5
+ ### Patch Changes
6
+
7
+ - d7ac700: Sync the shipping policy free-shipping field description from Console schemas.
8
+ - e15348a: The generated `Article` type now documents `slug` as the URL slug that stays fixed once an article is created.
9
+ - c3ab3b9: Sync the product slug field description, which now notes that the slug is fixed after creation.
10
+
11
+ ## 0.56.0
12
+
13
+ ### Minor Changes
14
+
15
+ - bab54b6: BREAKING (0.x minor): Make paid membership subscribe return a first-charge prepare instruction instead of accepting a caller payment identifier. Tenant billing now uses the returned idempotency key and the existing signed charge-result flow.
16
+
17
+ ## 0.55.1
18
+
19
+ ### Patch Changes
20
+
21
+ - 9ee5438: Synchronize generated Payload event hold and internal TicketPurchase draft types
22
+ with the Console schema.
23
+
24
+ ## 0.55.0
25
+
26
+ ### Minor Changes
27
+
28
+ - 3ddc653: BREAKING (0.x minor): Generated Membership payment method and credential types
29
+ now expose delegated-only fields. Legacy connect and backend-charge metadata is
30
+ removed from the SDK type surface; stored database columns remain intact.
31
+
32
+ ### Patch Changes
33
+
34
+ - 4732259: Sync event registration provenance fields from Console schemas.
35
+ - 313ed5b: Synchronize generated Payload membership-charge types with normalized terminal
36
+ decline evidence fields.
37
+
38
+ ## 0.54.2
39
+
40
+ ### Patch Changes
41
+
42
+ - c040018: Add typed webhook support for thin membership lifecycle notifications.
43
+
44
+ ## 0.54.1
45
+
46
+ ### Patch Changes
47
+
48
+ - d09060b: Add generated internal usage-attribution fields for Project environment billing evidence.
49
+
50
+ ## 0.54.0
51
+
52
+ ### Minor Changes
53
+
54
+ - 1e2f5ce: Add server-only source-aware Customer Group member listing, grant, and revoke helpers.
55
+
56
+ ### Patch Changes
57
+
58
+ - 5d183fd: Add optional Checkout and Order discount snapshot fields for canonical
59
+ condition digests and private customer-eligibility evidence.
60
+
61
+ ## 0.53.0
62
+
63
+ ### Minor Changes
64
+
65
+ - b3b3878: Synchronize generated Payload types for Project-scoped subscription authority.
66
+ `Project.authorityMode` now includes `project-billing`, and `Subscription` gains
67
+ an optional `project` relationship while retaining its required Live tenant
68
+ anchor.
69
+
70
+ This is additive only: no collection becomes publicly addressable, existing
71
+ tenant identifiers keep their meaning, and tenant-scoped SDK behavior is
72
+ unchanged.
73
+
74
+ ## 0.52.2
75
+
76
+ ### Patch Changes
77
+
78
+ - e808fb7: Improve PaymentSession provider-mismatch cancellation recovery guidance after
79
+ validating the complete actual-provider response and cancellation state.
80
+
81
+ **BREAKING (0.x minor):** `01 payment-session retrieve` and `01 payment-session cancel` now require `--provider toss` or `--provider portone`; the CLI no longer assumes Toss when it is omitted.
82
+
83
+ ## 0.52.1
84
+
85
+ ### Patch Changes
86
+
87
+ - 1f62cb3: Keep managed payment-provider response validation aligned with the SDK's public checkout provider type.
88
+ - 2848ab8: Remove retired stg smoke reconciliation wording from the generated PAT type mirror.
89
+
90
+ ## 0.52.0
91
+
92
+ ### Minor Changes
93
+
94
+ - ebd2544: Synchronize generated types for the Project environment expand phase (ADR 0056). A `Project` interface is added, and `Tenant` gains five optional, nullable fields describing its Project/environment binding: `project`, `environmentKind`, `environmentGeneration`, `environmentState`, and `environmentIsCurrent`.
95
+
96
+ Additive only. Every new field is optional, no existing field becomes nullable, and `tenantId` keeps its exact meaning. The `projects` slug is deliberately absent from `COLLECTIONS`, `SERVER_ONLY_COLLECTIONS`, and `INTERNAL_COLLECTIONS`, so no collection is newly addressable and no runtime behavior changes; the additive public client context is owned by a later issue.
97
+
98
+ ### Patch Changes
99
+
100
+ - 9620154: Keep generated SDK collection metadata and Payload types aligned with the Console customer-group grant authority.
101
+
102
+ ## 0.51.2
103
+
104
+ ### Patch Changes
105
+
106
+ - 6f08721: Align the generated Order field order with the Admin Panel order information tab.
107
+ - 18c9eb7: Synchronize the generated Payload types after the Console `customers`
108
+ collection declares `email` before `name`: `Customer` and `CustomersSelect`
109
+ change property order only. This does not add, remove, or retype any SDK
110
+ surface.
111
+ - 6d2e6ac: Update the audited Next runtime dependencies used by SDK verification and the
112
+ published app templates.
113
+ - 7eb25b2: Payload CMS 3.89.0 선행 업그레이드에 맞춰 SDK 검증용 개발 의존성을 갱신하고,
114
+ upstream 실제 수정 전까지 보상 통제를 유지합니다.
115
+
116
+ ## 0.51.1
117
+
118
+ ### Patch Changes
119
+
120
+ - ff7a716: Serialize persisted `CustomerAuth` refresh rotation across browser contexts and make the persisted session atomic.
121
+
122
+ The canonical session now lives in a single versioned JSON record at `<key>:session` holding the access/refresh pair plus a monotonic revision. Writing the pair in one store operation removes the torn write that could publish a new access token beside an already-consumed refresh token, and every write re-reads the record first and carries forward the field it does not change, which keeps a stale instance from carrying its own outdated counterpart into the write. That merge is best-effort, not a compare-and-swap.
123
+
124
+ Refresh-token rotation — and only rotation — is serialized through a Web Locks lease keyed by the storage key plus the canonical API/tenant identity (equivalent URL spellings share one namespace; token material never appears in a lease name). Inside the lease the rotation re-reads canonical state and classifies it on the credential it will present, so it never replays a credential the record already replaced, never strands the successor it already paid for, and preserves an access token another context deliberately replaced while committing the successor refresh in the same write. `getToken()` / `getRefreshToken()` re-read canonical state before use, so another tab's rotation or logout is observed before the next credential use.
125
+
126
+ Limits, stated rather than implied: Web Storage has no compare-and-swap, so the read preceding a write is not atomic with it, and the synchronous mutators (`logout`, `setToken`, `setRefreshToken`) cannot await the lease. A commit landing inside that window is lost by ordering — including a counterpart the merge just read, which is then republished stale. Those interleavings are last-writer-wins; server-side single-use rotation and refresh-family reuse detection remain the only authority. Browsers without Web Locks, a throwing `navigator.locks` accessor, a failed acquisition, an expired bounded wait, or storage that denies access all degrade to a per-instance or memory-only session while still presenting the canonical credential.
127
+
128
+ Storage compatibility: `<key>` still holds the current access token as a single-value publication for code that reads it directly, and an existing pair under the older `<key>` / `<key>:refresh` layout is migrated on first read — but only while `<key>:session` is absent. `logout()` writes a cleared record even against empty storage, so an ended session cannot be migrated back out of the older keys. The older refresh entry is retired before any newer access token is mirrored, so those two are never published together, and if that retirement fails the newer access token is not mirrored beside it; such a reader falls back to the bearer refresh path, and server-side reuse detection resolves an older pair it may still hold. A record this version cannot interpret fails closed to a memory-only session rather than being reinterpreted through the older keys. A context running an SDK version that predates the record is outside the coordination guarantee. `persist: false` and SSR behavior are unchanged.
129
+
3
130
  ## 0.51.0
4
131
 
5
132
  ### Minor Changes
package/README.md CHANGED
@@ -779,8 +779,8 @@ Membership self-service is split by credential boundary:
779
779
  - Browser/customer JWT clients can read the signed-in customer's current or
780
780
  latest membership and request cancellation for active, trialing, or past-due
781
781
  memberships.
782
- - Server clients with a Secret Key can subscribe a customer after the storefront
783
- has completed the delegated first charge.
782
+ - Server clients with a Secret Key prepare a paid customer subscription before
783
+ the tenant's PSP executes the first charge.
784
784
 
785
785
  ```typescript
786
786
  import { createClient } from '@01.software/sdk'
@@ -801,28 +801,71 @@ const server = createServerClient({
801
801
  secretKey: process.env.SOFTWARE_SECRET_KEY!,
802
802
  })
803
803
 
804
- await server.memberships.subscribe({
804
+ const prepared = await server.memberships.subscribe({
805
805
  planId: 'plan_123',
806
+ priceId: 'price_monthly_123',
806
807
  customerId: 'customer_123',
807
808
  customerRef: 'cus_provider_123',
808
- pgPaymentId: 'pay_123',
809
- amount: 9900,
810
- currency: 'KRW',
811
809
  subscribeIntentKey: 'checkout-session-123',
812
810
  card: { last4: '4242', brand: 'visa' },
813
811
  })
812
+
813
+ if (prepared.status === 'incomplete') {
814
+ await tenantPsp.charge({
815
+ idempotencyKey: prepared.firstCharge.idempotencyKey,
816
+ amount: prepared.firstCharge.amount,
817
+ currency: prepared.firstCharge.currency,
818
+ })
819
+ // Post the PSP outcome to Console's existing signed charge-result webhook.
820
+ }
814
821
  ```
815
822
 
816
823
  `subscribeIntentKey` is sent as `X-Idempotency-Key`; it is not part of the JSON
817
- body. Replays must use the same plan, customer reference, amount, currency, and
818
- paid-start provider payment id snapshot as the original incomplete membership.
819
- Trial subscriptions may omit `pgPaymentId` because no first-period charge has
820
- been captured yet; paid starts must include the provider payment id that funded
821
- the first period.
824
+ body. A paid response is `incomplete` and contains the immutable first-charge
825
+ instruction. The tenant charges its PSP with `firstCharge.idempotencyKey`, then
826
+ posts the signed outcome through the configured charge-result webhook. A trial
827
+ response is immediately `trialing` and has no `firstCharge` field. Before a paid
828
+ subscribe, configure an active delegated billing connection for
829
+ the tenant; otherwise Console returns `409 conflict` without lifecycle writes.
830
+ Do not start
831
+ the PSP payment at or after `expiresAt`; deduplicate PSP work with
832
+ `firstCharge.idempotencyKey`. A late paid result remains evidence but cannot
833
+ activate the Membership, so the tenant handles any refund outside this API. Replays use
834
+ the same plan, price, customer reference, and idempotency key while the first
835
+ charge is pending. A replay after settlement or `expiresAt` returns `409`
836
+ instead of a payment instruction.
822
837
  `memberships.me()` and browser `memberships.cancel()` require the customer JWT
823
838
  configured on the client. Refund webhook `refundedAmount` values are cumulative
824
839
  charge totals, not per-event deltas.
825
840
 
841
+ ### Source-aware customer groups (server only)
842
+
843
+ Manage manual Customer Group membership through the shaped server API. The
844
+ read result includes every current reason a customer qualifies, so revoking a
845
+ manual source does not hide a still-active Membership source.
846
+
847
+ ```typescript
848
+ const page = await server.customerGroups.listMembers({
849
+ groupId: '00000000-0000-4000-8000-000000000002',
850
+ limit: 100,
851
+ })
852
+
853
+ await server.customerGroups.grantMember({
854
+ groupId: '00000000-0000-4000-8000-000000000002',
855
+ customerId: '00000000-0000-4000-8000-000000000003',
856
+ reason: 'support-approved',
857
+ })
858
+
859
+ await server.customerGroups.revokeMember({
860
+ groupId: '00000000-0000-4000-8000-000000000002',
861
+ customerId: '00000000-0000-4000-8000-000000000003',
862
+ })
863
+ ```
864
+
865
+ Keep these calls in trusted server code. Do not mutate `customers.groups`
866
+ directly: after source-authority activation it is a read-compatible projection
867
+ and direct writes return `customer_groups_direct_write_retired`.
868
+
826
869
  ## Storefront performance defaults
827
870
 
828
871
  - **PLP:** prefer `commerce.product.listingPage()` or `useProductListingPage()` (GET `/api/products/listing-groups/query/catalog`, CDN-cacheable, card-ready). Use `listingGroupsCatalog({ productIds })` only when IDs are already known. Treat the full listing-groups response shape as a server-auth escape hatch because it can include operational stock fields. Avoid fetching a product list and then calling `detail()` per card.