@01.software/sdk 0.67.0 → 0.69.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/README.md +124 -6
- package/dist/client.cjs +422 -319
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +11 -6
- package/dist/client.d.ts +11 -6
- package/dist/client.js +422 -319
- package/dist/client.js.map +1 -1
- package/dist/{collection-client-D4HEOoO_.d.ts → collection-client-C2VGBnCC.d.ts} +4 -4
- package/dist/{collection-client-jrNFGbrO.d.cts → collection-client-DvWkDxSM.d.cts} +4 -4
- package/dist/{const-CCQ3MdLE.d.cts → const-AtPEgg__.d.cts} +2 -2
- package/dist/{const-BU79hCFB.d.ts → const-DR96Chal.d.ts} +2 -2
- package/dist/embedded-admin/server.cjs +19 -1
- package/dist/embedded-admin/server.cjs.map +1 -1
- package/dist/embedded-admin/server.d.cts +4 -2
- package/dist/embedded-admin/server.d.ts +4 -2
- package/dist/embedded-admin/server.js +19 -1
- package/dist/embedded-admin/server.js.map +1 -1
- package/dist/embedded-admin.cjs +22 -0
- package/dist/embedded-admin.cjs.map +1 -1
- package/dist/embedded-admin.d.cts +7 -1
- package/dist/embedded-admin.d.ts +7 -1
- package/dist/embedded-admin.js +22 -0
- package/dist/embedded-admin.js.map +1 -1
- package/dist/errors.cjs +3 -0
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.cts +3 -3
- package/dist/errors.d.ts +3 -3
- package/dist/errors.js +3 -0
- package/dist/errors.js.map +1 -1
- package/dist/{index-DiyhsVHd.d.cts → index-Ce11c_Oh.d.cts} +3 -3
- package/dist/{index-CwKxWHIa.d.ts → index-D8fmTrZk.d.ts} +3 -3
- package/dist/index.cjs +427 -323
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +427 -323
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-jdsUXunB.d.cts → payload-types-rhnw3rR8.d.cts} +48 -1
- package/dist/{payload-types-jdsUXunB.d.ts → payload-types-rhnw3rR8.d.ts} +48 -1
- package/dist/query.cjs +11 -0
- package/dist/query.cjs.map +1 -1
- package/dist/query.d.cts +5 -5
- package/dist/query.d.ts +5 -5
- package/dist/query.js +11 -0
- package/dist/query.js.map +1 -1
- package/dist/realtime.d.cts +2 -2
- package/dist/realtime.d.ts +2 -2
- package/dist/server.cjs +1186 -1071
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +9 -8
- package/dist/server.d.ts +9 -8
- package/dist/server.js +1186 -1071
- package/dist/server.js.map +1 -1
- package/dist/storefront-cache.cjs +3 -0
- package/dist/storefront-cache.cjs.map +1 -1
- package/dist/storefront-cache.js +3 -0
- package/dist/storefront-cache.js.map +1 -1
- package/dist/{types-CvdBV3ri.d.cts → types-B99utaKU.d.cts} +147 -40
- package/dist/{types-BPwXAFZ7.d.cts → types-BR0D4AaW.d.cts} +2 -2
- package/dist/{types-BusejG-v.d.ts → types-CHK8VIPa.d.ts} +2 -2
- package/dist/{types-I2k6Laad.d.ts → types-L0xmn_iT.d.ts} +147 -40
- package/dist/ui/form.d.cts +1 -1
- package/dist/ui/form.d.ts +1 -1
- package/dist/ui/video.d.cts +1 -1
- package/dist/ui/video.d.ts +1 -1
- package/dist/webhook.d.cts +5 -5
- package/dist/webhook.d.ts +5 -5
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @01.software/sdk
|
|
2
2
|
|
|
3
|
+
## 0.69.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 88a5db7: 상품의 고객별 누적 구매 한도 타입과 `purchase_limit_exceeded` 오류 reason을 추가합니다.
|
|
8
|
+
|
|
9
|
+
운영 주의: 애플리케이션을 rollback하면 이 상한 집행이 사라집니다. **rollback 전 한도 상품 판매 중지**가 필요합니다. 스키마 마이그레이션은 forward-only이며, 컬럼·미검증 CHECK 추가 → CHECK 검증 → 트랜잭션 밖 동시 인덱스 생성 순서로 적용합니다.
|
|
10
|
+
|
|
11
|
+
- 349785e: Add the `product_not_eligible` commerce reason for products restricted to eligible Customer Groups. Restricted purchases require a Customer-bound Cart and verified Customer session or server delegation; unrestricted products retain existing behavior.
|
|
12
|
+
- 7488329: Add the stable `admission_required` error reason for public event registration.
|
|
13
|
+
RSVP/approval registration now rejects applicable non-deleted admission types,
|
|
14
|
+
including inactive, out-of-sale and zero-price types. Use the admission purchase
|
|
15
|
+
flow for these events; the SDK preserves the 409 reason without retrying.
|
|
16
|
+
|
|
17
|
+
## 0.68.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- 0211dc7: Add server benefitVouchers issue/get/list/redeem/voidVoucher commands and Customer listMine. Vouchers are single-use non-monetary benefits; source identity and request UUIDs make explicit retries safe.
|
|
22
|
+
- 0211dc7: Support explicit embedded app execution-role opt-in on both the tenant binding
|
|
23
|
+
and receiver verifier, preserving administrator-only defaults. Add CLI
|
|
24
|
+
allowed-role configuration and binding-state readback.
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- 342cda2: Sync the generated benefit voucher definition documentation with its bilingual Admin description.
|
|
29
|
+
|
|
3
30
|
## 0.67.0
|
|
4
31
|
|
|
5
32
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -158,6 +158,20 @@ The assertion proves operator and tenant context only. It is not a Console API
|
|
|
158
158
|
credential; the external backend must use its own server-held credential and
|
|
159
159
|
authorization policy for tenant data.
|
|
160
160
|
|
|
161
|
+
The verifier defaults to `super-admin` and `tenant-admin` only. To allow an
|
|
162
|
+
editor or viewer, both the administrator-managed binding `allowedRoles` and the
|
|
163
|
+
receiver's trusted server `allowedRoles` option must include that exact role.
|
|
164
|
+
For example, a receiver can pass
|
|
165
|
+
`allowedRoles: ['super-admin', 'tenant-admin', 'tenant-viewer']`; never take this
|
|
166
|
+
allowlist from browser input. Only opted-in operators see the execution view;
|
|
167
|
+
binding configuration remains administrator-only.
|
|
168
|
+
|
|
169
|
+
The receiver server must enforce each app feature's permissions from verified
|
|
170
|
+
`tenant_role` and `operator_id`, independently of its server credential. Direct
|
|
171
|
+
platform viewer mutation denial remains unchanged. The 60-second assertion
|
|
172
|
+
expiry does not revoke an app-local session; the receiver owns its session
|
|
173
|
+
expiry, authorization rechecks, and revocation.
|
|
174
|
+
|
|
161
175
|
Migration quick reference:
|
|
162
176
|
|
|
163
177
|
- `createClient` remains available from `@01.software/sdk` and
|
|
@@ -1998,20 +2012,92 @@ if (!result.ok) {
|
|
|
1998
2012
|
}
|
|
1999
2013
|
```
|
|
2000
2014
|
|
|
2001
|
-
Existing product graph edits send the saved product id and the
|
|
2002
|
-
baseline, without product document fields
|
|
2015
|
+
Existing product graph edits send the saved product id and the revision from
|
|
2016
|
+
the composer draft baseline, without product document fields. The draft is an
|
|
2017
|
+
editor read model, not an SDK mutation payload: construct `options` and
|
|
2018
|
+
`variants` explicitly instead of forwarding `draft.options` / `draft.variants`.
|
|
2019
|
+
|
|
2020
|
+
This example assumes the complete persisted graph has one Color option, two
|
|
2021
|
+
values, and two variants. Replace the sample IDs and reviewed values with
|
|
2022
|
+
your own baseline, retaining every option, value, and variant you intend to
|
|
2023
|
+
keep. Media IDs must already belong to the saved product's image pool.
|
|
2003
2024
|
|
|
2004
2025
|
```ts
|
|
2005
2026
|
await client.commerce.product.upsert({
|
|
2006
2027
|
productId: 'prod_123',
|
|
2007
2028
|
graphRevision: draft.graphRevision,
|
|
2008
|
-
options:
|
|
2009
|
-
|
|
2029
|
+
options: [
|
|
2030
|
+
{
|
|
2031
|
+
id: 'opt_color',
|
|
2032
|
+
title: 'Color',
|
|
2033
|
+
slug: 'color',
|
|
2034
|
+
values: [
|
|
2035
|
+
{
|
|
2036
|
+
id: 'val_black',
|
|
2037
|
+
value: 'Black',
|
|
2038
|
+
slug: 'black',
|
|
2039
|
+
swatch: { type: 'color', color: '#111111' },
|
|
2040
|
+
},
|
|
2041
|
+
{
|
|
2042
|
+
id: 'val_white',
|
|
2043
|
+
value: 'White',
|
|
2044
|
+
slug: 'white',
|
|
2045
|
+
swatch: { type: 'media', mediaItemId: 'img_white' },
|
|
2046
|
+
},
|
|
2047
|
+
],
|
|
2048
|
+
},
|
|
2049
|
+
],
|
|
2050
|
+
variants: [
|
|
2051
|
+
{
|
|
2052
|
+
id: 'var_black',
|
|
2053
|
+
optionValues: { color: { valueId: 'val_black' } },
|
|
2054
|
+
price: 29000,
|
|
2055
|
+
images: ['img_black'],
|
|
2056
|
+
},
|
|
2057
|
+
{
|
|
2058
|
+
id: 'var_white',
|
|
2059
|
+
optionValues: { color: { valueId: 'val_white' } },
|
|
2060
|
+
price: 29000,
|
|
2061
|
+
images: ['img_white'],
|
|
2062
|
+
},
|
|
2063
|
+
],
|
|
2010
2064
|
})
|
|
2011
2065
|
```
|
|
2012
2066
|
|
|
2013
|
-
|
|
2014
|
-
|
|
2067
|
+
Keep persisted option/value/variant `id`s and select existing values by
|
|
2068
|
+
`valueId`; do not regenerate identity from labels or change stored slugs.
|
|
2069
|
+
Resolve editor `optionValueKeys` (client keys) to SDK `optionValues`, as above,
|
|
2070
|
+
whose record keys are option slugs or titles, not option IDs. Do not send
|
|
2071
|
+
unsaved matrix proposal rows (`included: false` with no `id`). Preserve IDs
|
|
2072
|
+
for persisted rows you retain, and send `isActive: false` when deliberately
|
|
2073
|
+
deactivating one. Copy only mutation fields, excluding `clientKey`, `included`,
|
|
2074
|
+
and other editor state. SDK `images` contains string IDs, not hydrated media
|
|
2075
|
+
objects.
|
|
2076
|
+
An SDK swatch object requires `type: 'color'` with a color string or
|
|
2077
|
+
`type: 'media'` with a `mediaItemId` string. For an existing value, omit
|
|
2078
|
+
`swatch` to preserve its stored swatch. The SDK type also accepts `swatch: null`;
|
|
2079
|
+
runtime clearing with it is not verified here. Do not copy a draft swatch
|
|
2080
|
+
with a missing/null tag or null active value into that object shape.
|
|
2081
|
+
|
|
2082
|
+
Upsert synchronizes the full graph, not just changed rows: omitted options or
|
|
2083
|
+
values can be deleted, and omitted variants can be deleted or deactivated.
|
|
2084
|
+
If reservation history prevents variant deletion, omission can instead reject
|
|
2085
|
+
the write with `409` and roll it back.
|
|
2086
|
+
Keep the revision of the reviewed baseline and review fresh values after a
|
|
2087
|
+
`graph_conflict`; do not substitute a newer revision onto stale values.
|
|
2088
|
+
`graphRevision` excludes inventory-only changes, so this graph edit omits
|
|
2089
|
+
loaded `stock` on persisted variants. New finite variants may carry initial
|
|
2090
|
+
stock. An intentional stock write is different from replaying loaded stock;
|
|
2091
|
+
this example does not perform one.
|
|
2092
|
+
|
|
2093
|
+
This example is for a persisted option graph. For editor-only placeholders,
|
|
2094
|
+
use the simple-variant branch only when `editorPlaceholderGraph` is true and
|
|
2095
|
+
the structure still matches: one unsaved `Default` option, one unsaved value
|
|
2096
|
+
with a nonempty label (not necessarily `Standard`), and one included variant
|
|
2097
|
+
selecting only that value. Send `options: []` and that simple variant with
|
|
2098
|
+
`optionValues: {}`. Preserve its variant ID if persisted; a new variant has
|
|
2099
|
+
no saved ID. Omit loaded stock on persisted variants. Base-price-only changes
|
|
2100
|
+
use `updateVariantPrices()` above, rather than a full graph upsert.
|
|
2015
2101
|
|
|
2016
2102
|
```typescript
|
|
2017
2103
|
// Batch stock check (point-in-time read, NOT a reservation)
|
|
@@ -2543,3 +2629,35 @@ P5 also adds JWT-`jti` revocation: `revokeCustomerJti(jti, ttl)` on the server i
|
|
|
2543
2629
|
**Boolean field renames** (6 collections):
|
|
2544
2630
|
|
|
2545
2631
|
- `status: 'active' | 'inactive'` → `isActive: boolean` on Forms, ArticleAuthors, CustomerGroups, ShippingPolicies, ProductVariants
|
|
2632
|
+
|
|
2633
|
+
### Customer benefit vouchers
|
|
2634
|
+
|
|
2635
|
+
Tenant-admins manage benefit voucher definitions in Console. These are single-use, non-monetary benefits, with no Checkout discount or credit effect. Your server decides recipients and timing (for example from a membership webhook or your own cron); source uniqueness prevents duplicate effects only.
|
|
2636
|
+
|
|
2637
|
+
```ts
|
|
2638
|
+
import { createServerClient } from '@01.software/sdk/server'
|
|
2639
|
+
|
|
2640
|
+
const server = createServerClient({ publishableKey, secretKey })
|
|
2641
|
+
const { voucher, created } = await server.benefitVouchers.issue({
|
|
2642
|
+
definitionId,
|
|
2643
|
+
customerId,
|
|
2644
|
+
sourceNamespace: 'member-benefits',
|
|
2645
|
+
sourceRef: 'period:2030-01:member-opaque-id',
|
|
2646
|
+
})
|
|
2647
|
+
const redeemed = await server.benefitVouchers.redeem({
|
|
2648
|
+
customerId,
|
|
2649
|
+
voucherId: voucher.id,
|
|
2650
|
+
requestId,
|
|
2651
|
+
actorRef: 'staff:opaque-id',
|
|
2652
|
+
})
|
|
2653
|
+
```
|
|
2654
|
+
|
|
2655
|
+
`server.benefitVouchers.get({ customerId, voucherId })` and `list({ customerId, state?, definitionId?, limit?, cursor? })` require a read-scoped server key. `issue`, `redeem`, and `voidVoucher({ customerId, voucherId, requestId, actorRef, reason })` require write scope, sk01 credentials and no browser Origin. Void reasons are `issued_in_error`, `benefit_revoked`, `customer_request`, and `other`. Issuing and redeeming require effective Ecommerce and Customers; reads and void remain available after feature loss.
|
|
2656
|
+
|
|
2657
|
+
Reuse the same sourceNamespace/sourceRef and identical issue input on an unknown outcome. For redeem/void, create a request UUID once and reuse it on retries; these POSTs are not automatically retried. Reusing an identity with different input returns 409. A successful transition is irreversible. Expiry uses database time and is inclusive at expiresAt. Correct an issued benefit by voiding it and issuing a new source identity.
|
|
2658
|
+
|
|
2659
|
+
`client.benefitVouchers.listMine({ status: 'available', limit: 20 })` uses the Customer JWT and returns only identity, customer-visible copy, state and timestamps. Use `status: 'all'` for history and the returned `nextCursor` for another page (maximum 100). The response is private, no-store. Server lists return the server DTO and require customerId; cross-customer/tenant targets are masked as 404. Console customer detail shows a read-only list; Console action buttons follow separately.
|
|
2660
|
+
|
|
2661
|
+
The staff app server must verify the staff member and Customer before redeeming: voucherId is not a bearer capability. `actorRef` is app-attested evidence, never a platform-verified staff identity or an authorization input. Use opaque references without personal data in sourceRef and actorRef. Definitions snapshot name, description and expiry at issue; later edits do not change issued vouchers. Voucher history survives Customer erasure and blocks tenant hard deletion. Referenced definitions must be archived.
|
|
2662
|
+
|
|
2663
|
+
Product purchase quantity policies are enforced by Console at Cart ingress and Checkout creation. A product's optional `maxQuantityPerCustomer` combines all variants, committed Orders minus completed Returns, and open Checkouts. Limited products require a verified Customer; delegated server purchases use the existing `customerToken`. Handle `409 purchase_limit_exceeded` by its scalar `details.productId`, `maxQuantityPerCustomer` and `remainingQuantity`; guests receive `product_not_eligible`. See the [Commerce guide](https://docs.01.software/en/commerce).
|