@01.software/sdk 0.45.0 → 0.46.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.
- package/CHANGELOG.md +14 -0
- package/MIGRATION.md +19 -0
- package/README.md +49 -4
- package/dist/client.cjs +13 -0
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +6 -6
- package/dist/client.d.ts +6 -6
- package/dist/client.js +13 -0
- package/dist/client.js.map +1 -1
- package/dist/{collection-client-Ckfusuee.d.ts → collection-client-BEGXnfQe.d.ts} +4 -4
- package/dist/{collection-client-BSo7VXQE.d.cts → collection-client-L2rEgBaR.d.cts} +4 -4
- package/dist/{const-CaPq2AE4.d.ts → const-GYVwlXLr.d.ts} +1 -1
- package/dist/{const-BAG0MH0u.d.cts → const-y0eipvnQ.d.cts} +1 -1
- package/dist/{index-BNICJxBL.d.ts → index-Bei4WlVw.d.ts} +3 -3
- package/dist/{index-YGrZrxNn.d.cts → index-BfYL6Qb1.d.cts} +3 -3
- package/dist/index.cjs +13 -0
- 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 +13 -0
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-CJZuXcgF.d.cts → payload-types-3WNyC0gk.d.cts} +5 -0
- package/dist/{payload-types-CJZuXcgF.d.ts → payload-types-3WNyC0gk.d.ts} +5 -0
- package/dist/query.cjs +8 -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 +8 -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 +99 -1
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +7 -7
- package/dist/server.d.ts +7 -7
- package/dist/server.js +99 -1
- package/dist/server.js.map +1 -1
- package/dist/{types-D5p7-m1l.d.cts → types-CAicTn-o.d.cts} +2 -2
- package/dist/{types-C4WuJfw7.d.cts → types-CDJ2M-MJ.d.cts} +43 -4
- package/dist/{types-BC6rVmJa.d.ts → types-DpSyNTxy.d.ts} +2 -2
- package/dist/{types-BlOvjoTX.d.ts → types-mIROvhhP.d.ts} +43 -4
- 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 +4 -4
- package/dist/webhook.d.ts +4 -4
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @01.software/sdk
|
|
2
2
|
|
|
3
|
+
## 0.46.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 76e03f6: Synchronize generated types for the SDK-hidden private PaymentSession origin while keeping the public custom payment request and response wire unchanged.
|
|
8
|
+
|
|
9
|
+
## 0.46.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 8742373: Add a server-only custom PaymentSession bridge with typed create and confirm
|
|
14
|
+
operations, strict safe projections, exact-body optional HMAC proof signing,
|
|
15
|
+
and shared OpenAPI transport parity.
|
|
16
|
+
|
|
3
17
|
## 0.45.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
package/MIGRATION.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @01.software/sdk Migration Notes
|
|
2
2
|
|
|
3
|
+
## SDK 0.46 server-only custom-provider bridge (#3485)
|
|
4
|
+
|
|
5
|
+
SDK 0.46 adds
|
|
6
|
+
`createServerClient().commerce.paymentSessions.custom.create/confirm` for the
|
|
7
|
+
existing bounded custom PaymentSession endpoints. This is additive and
|
|
8
|
+
server-only: browser clients and the package root expose neither the namespace
|
|
9
|
+
nor its custom types.
|
|
10
|
+
|
|
11
|
+
Create requires a durable header idempotency key and returns only
|
|
12
|
+
`{ id, provider, providerSessionId, money }`. The caller independently verifies
|
|
13
|
+
its provider API response or signed webhook, then confirms the exact provider
|
|
14
|
+
session/payment/event identities and captured Money. Where tenant policy
|
|
15
|
+
requires custom-payment HMAC, pass `createProof(rawBody)` as the confirm option;
|
|
16
|
+
it signs the exact JSON bytes sent by the SDK.
|
|
17
|
+
|
|
18
|
+
This bridge does not restore `orders.create`, `orders.confirmPayment`, or
|
|
19
|
+
`orders.updateTransaction`, and it is not adapter support, refund authority, or
|
|
20
|
+
a manual/offline pending-order placement API.
|
|
21
|
+
|
|
3
22
|
## SDK 0.45 canonical commerce surface (#2375)
|
|
4
23
|
|
|
5
24
|
Target release: `0.45.0`. This is a `BREAKING (0.x minor)` release.
|
package/README.md
CHANGED
|
@@ -1383,6 +1383,49 @@ const checkoutPage = await server.commerce.checkouts.query({
|
|
|
1383
1383
|
void checkoutPage.nextCursor
|
|
1384
1384
|
```
|
|
1385
1385
|
|
|
1386
|
+
For a provider that is not backed by a first-party adapter, trusted server code
|
|
1387
|
+
can use the bounded custom bridge. The caller must first verify the provider's
|
|
1388
|
+
authoritative API response or signed webhook, then report the exact captured
|
|
1389
|
+
identity and Money. The create response is intentionally limited to
|
|
1390
|
+
`{ id, provider, providerSessionId, money }`.
|
|
1391
|
+
|
|
1392
|
+
```typescript
|
|
1393
|
+
const customSession = await server.commerce.paymentSessions.custom.create({
|
|
1394
|
+
provider: 'my-provider',
|
|
1395
|
+
checkoutToken,
|
|
1396
|
+
idempotencyKey: createCommerceIdempotencyKey(),
|
|
1397
|
+
})
|
|
1398
|
+
|
|
1399
|
+
const verifiedCapture = await verifyMyProviderCapture({
|
|
1400
|
+
expectedAmount: customSession.money.amountMinor,
|
|
1401
|
+
expectedCurrency: customSession.money.currency,
|
|
1402
|
+
})
|
|
1403
|
+
|
|
1404
|
+
if (!verifiedCapture.ok) throw new Error('Provider capture was not verified')
|
|
1405
|
+
|
|
1406
|
+
const customConfirmation = await server.commerce.paymentSessions.custom.confirm(
|
|
1407
|
+
{
|
|
1408
|
+
provider: customSession.provider,
|
|
1409
|
+
providerSessionId: customSession.providerSessionId,
|
|
1410
|
+
providerPaymentId: verifiedCapture.paymentId,
|
|
1411
|
+
providerEventId: verifiedCapture.eventId,
|
|
1412
|
+
amount: customSession.money.amountMinor,
|
|
1413
|
+
currency: customSession.money.currency,
|
|
1414
|
+
occurredAt: verifiedCapture.occurredAt,
|
|
1415
|
+
},
|
|
1416
|
+
)
|
|
1417
|
+
|
|
1418
|
+
console.log(customConfirmation.orderId)
|
|
1419
|
+
```
|
|
1420
|
+
|
|
1421
|
+
If the tenant's custom-provider policy requires HMAC, pass
|
|
1422
|
+
`{ createProof(rawBody) }` as the second argument to `custom.confirm`. The
|
|
1423
|
+
callback receives the exact JSON bytes the SDK sends and returns `{ timestamp,
|
|
1424
|
+
signature }`; signature headers are redacted from SDK debug output. This is not
|
|
1425
|
+
a generic “mark paid” API, adapter support, refund authority, or a manual/offline
|
|
1426
|
+
pending-order flow. Use Draft Orders for current back-office manual pending
|
|
1427
|
+
orders; storefront manual/offline placement is a separate capability.
|
|
1428
|
+
|
|
1386
1429
|
`checkoutToken` is returned only alongside Checkout creation; ordinary Checkout
|
|
1387
1430
|
DTOs never echo the bearer capability. Browser `checkouts.retrieve` and
|
|
1388
1431
|
PaymentSession retrieve/cancel calls accept that token. Server
|
|
@@ -1396,10 +1439,12 @@ is preserved as `reason: 'unknown_commerce_error'` plus `rawReason`.
|
|
|
1396
1439
|
### Commerce Orders (post-placement operations)
|
|
1397
1440
|
|
|
1398
1441
|
Provider-paid `orders.create`, `orders.confirmPayment`, and ordinary
|
|
1399
|
-
`orders.updateTransaction` were removed in SDK 0.45.
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1442
|
+
`orders.updateTransaction` were removed in SDK 0.45. The server-only custom
|
|
1443
|
+
PaymentSession bridge above does not restore those methods or expose a general
|
|
1444
|
+
manual Order API. After a PaymentSession commits an Order, trusted server code
|
|
1445
|
+
can use the remaining fulfillment, cancellation, and return operations.
|
|
1446
|
+
Customer order reads remain available through
|
|
1447
|
+
`client.commerce.orders.listMine()`.
|
|
1403
1448
|
|
|
1404
1449
|
The SDK root no longer exports raw generated `Order`, `Transaction`, `Cart`, or
|
|
1405
1450
|
`CartItem` Payload documents. Use the canonical `PublicOrder` / `PublicCart`
|
package/dist/client.cjs
CHANGED
|
@@ -403,6 +403,11 @@ function redactSensitiveHeaders(headers) {
|
|
|
403
403
|
redacted["x-preview-token"]
|
|
404
404
|
);
|
|
405
405
|
}
|
|
406
|
+
if (redacted["x-custom-payment-signature"]) {
|
|
407
|
+
redacted["x-custom-payment-signature"] = redactSensitiveHeader(
|
|
408
|
+
redacted["x-custom-payment-signature"]
|
|
409
|
+
);
|
|
410
|
+
}
|
|
406
411
|
return redacted;
|
|
407
412
|
}
|
|
408
413
|
function getErrorSuggestion(status) {
|
|
@@ -1396,6 +1401,14 @@ var COMMERCE_ENDPOINTS = {
|
|
|
1396
1401
|
create: endpoint("POST", "/api/payment-sessions/create"),
|
|
1397
1402
|
retrieve: endpoint("POST", "/api/payment-sessions/retrieve"),
|
|
1398
1403
|
cancel: endpoint("POST", "/api/payment-sessions/cancel"),
|
|
1404
|
+
custom: {
|
|
1405
|
+
create: sharedEndpoint(
|
|
1406
|
+
COMMERCE_ENDPOINT_OPERATIONS.paymentSessions.custom.create
|
|
1407
|
+
),
|
|
1408
|
+
confirm: sharedEndpoint(
|
|
1409
|
+
COMMERCE_ENDPOINT_OPERATIONS.paymentSessions.custom.confirm
|
|
1410
|
+
)
|
|
1411
|
+
},
|
|
1399
1412
|
server: {
|
|
1400
1413
|
create: endpoint("POST", "/api/payment-sessions/server/create"),
|
|
1401
1414
|
retrieve: endpoint("POST", "/api/payment-sessions/server/retrieve"),
|