@01.software/sdk 0.69.0 → 0.70.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 (65) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +26 -7
  3. package/dist/client.cjs +35 -7
  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 +35 -7
  8. package/dist/client.js.map +1 -1
  9. package/dist/{collection-client-C2VGBnCC.d.ts → collection-client-B1FSJ24_.d.ts} +5 -5
  10. package/dist/{collection-client-DvWkDxSM.d.cts → collection-client-BHLStm1K.d.cts} +5 -5
  11. package/dist/{const-AtPEgg__.d.cts → const-BfQfV-rr.d.cts} +1 -1
  12. package/dist/{const-DR96Chal.d.ts → const-ty8u0TDI.d.ts} +1 -1
  13. package/dist/embedded-admin/server.cjs +5 -0
  14. package/dist/embedded-admin/server.cjs.map +1 -1
  15. package/dist/embedded-admin/server.js +5 -0
  16. package/dist/embedded-admin/server.js.map +1 -1
  17. package/dist/embedded-admin.cjs +5 -0
  18. package/dist/embedded-admin.cjs.map +1 -1
  19. package/dist/embedded-admin.js +5 -0
  20. package/dist/embedded-admin.js.map +1 -1
  21. package/dist/errors.cjs +5 -0
  22. package/dist/errors.cjs.map +1 -1
  23. package/dist/errors.d.cts +3 -3
  24. package/dist/errors.d.ts +3 -3
  25. package/dist/errors.js +5 -0
  26. package/dist/errors.js.map +1 -1
  27. package/dist/{index-Ce11c_Oh.d.cts → index-CX6si6YC.d.cts} +3 -3
  28. package/dist/{index-D8fmTrZk.d.ts → index-DnKgjPGM.d.ts} +3 -3
  29. package/dist/index.cjs +35 -7
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +7 -7
  32. package/dist/index.d.ts +7 -7
  33. package/dist/index.js +35 -7
  34. package/dist/index.js.map +1 -1
  35. package/dist/{payload-types-rhnw3rR8.d.cts → payload-types-DTAaWKrp.d.cts} +18 -4
  36. package/dist/{payload-types-rhnw3rR8.d.ts → payload-types-DTAaWKrp.d.ts} +18 -4
  37. package/dist/query.cjs +14 -0
  38. package/dist/query.cjs.map +1 -1
  39. package/dist/query.d.cts +5 -5
  40. package/dist/query.d.ts +5 -5
  41. package/dist/query.js +14 -0
  42. package/dist/query.js.map +1 -1
  43. package/dist/realtime.d.cts +2 -2
  44. package/dist/realtime.d.ts +2 -2
  45. package/dist/server.cjs +35 -7
  46. package/dist/server.cjs.map +1 -1
  47. package/dist/server.d.cts +7 -7
  48. package/dist/server.d.ts +7 -7
  49. package/dist/server.js +35 -7
  50. package/dist/server.js.map +1 -1
  51. package/dist/storefront-cache.cjs +5 -0
  52. package/dist/storefront-cache.cjs.map +1 -1
  53. package/dist/storefront-cache.js +5 -0
  54. package/dist/storefront-cache.js.map +1 -1
  55. package/dist/{types-B99utaKU.d.cts → types-Bzgf4mTo.d.cts} +3 -3
  56. package/dist/{types-CHK8VIPa.d.ts → types-CpSiyJud.d.cts} +8 -2
  57. package/dist/{types-BR0D4AaW.d.cts → types-DX8Z44yQ.d.ts} +8 -2
  58. package/dist/{types-L0xmn_iT.d.ts → types-DdlhpNVv.d.ts} +3 -3
  59. package/dist/ui/form.d.cts +1 -1
  60. package/dist/ui/form.d.ts +1 -1
  61. package/dist/ui/video.d.cts +1 -1
  62. package/dist/ui/video.d.ts +1 -1
  63. package/dist/webhook.d.cts +5 -5
  64. package/dist/webhook.d.ts +5 -5
  65. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,44 @@
1
1
  # @01.software/sdk
2
2
 
3
+ ## 0.70.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 063fa7b: Guarantee one safe request resend after a successful token_expired refresh independently of the transient retry budget, including maxRetries: 0 and expiry on the final attempt. Preserve the single-refresh bound, unsafe-method replay restriction, and typed errors with request IDs.
8
+
9
+ Keep the refreshed response's retry admission authoritative, including canonical retry denial and an excessive Retry-After hint, while retaining retries for actual transport failures.
10
+
11
+ - 86272b6: Sync the generated Order return-status help with the Console display label
12
+ “No return”. Field types and stored status values are unchanged.
13
+ - 45817d4: Synchronize generated Payload types for the internal `audit-logs` collection. `AuditLog` and `AuditLogsSelect` gain one optional, nullable `entryKey` field, a private deduplication digest that every caller-facing read denies.
14
+
15
+ Additive only. No collection becomes addressable, no existing field changes, and no SDK runtime behavior changes.
16
+
17
+ - d2a88cd: Keep unavailable refund funding fields out of public collection types and
18
+ native reads, including populated refund relationships. Preserve existing
19
+ server-only collection availability, ordinary refund fields, and internal
20
+ funding evidence.
21
+
22
+ Exclude owning Refund metadata from caller responses and unavailable fields from
23
+ tenant schema discovery. Reject private metadata predicates, whole-metadata
24
+ comparisons other than existence, whole-metadata sorting (including subpath
25
+ sort spellings), and caller Local distinct over Refund metadata. These native
26
+ 400 query errors preserve ordinary metadata subpath filters, non-metadata sorts,
27
+ server collection access and internal overrideAccess owning reads/replay.
28
+
29
+ ## 0.70.0
30
+
31
+ ### Minor Changes
32
+
33
+ - e5849e7: Preserve `admission_not_eligible`, `admission_eligibility_unavailable`, `admission_authority_unavailable`, `admission_customer_binding_required`, and `admission_eligibility_unproven` as typed commerce error reasons across Cart, Checkout, and PaymentSession operations. Their existing meanings and HTTP statuses are unchanged. Older SDKs retain unrecognized reasons as `unknown_commerce_error` with `rawReason`.
34
+
35
+ ### Patch Changes
36
+
37
+ - 729e6cc: Synchronize generated internal Refund types with frozen funding attribution and optional capture linkage for refunds without a provider leg. Public credit operations remain unavailable.
38
+ - 6e7f1e3: Sync the generated customer collection documentation with its neutral Admin description.
39
+ - c93137c: Use the shared HTTP operation manifest for the existing event registration and guest helpers, preserving their request signatures and terminal rate-limit errors.
40
+ - 054184f: After a token-expired 401, refresh the customer token but resend the original request only for GET, HEAD, or OPTIONS. Unsafe requests retain the original authentication error so callers can explicitly retry.
41
+
3
42
  ## 0.69.0
4
43
 
5
44
  ### Minor Changes
package/README.md CHANGED
@@ -80,7 +80,7 @@ entry.
80
80
  | `@01.software/sdk/ui/form` | `FormRenderer` | `react`, `react-dom` |
81
81
  | `@01.software/sdk/ui/code-block` | `CodeBlock`, `highlight` | `react`, `react-dom`, `shiki`, `hast-util-to-jsx-runtime` |
82
82
  | `@01.software/sdk/ui/canvas` | `CanvasRenderer`, `CanvasFrame`, `useCanvas`, `prefetchCanvas` | `react`, `react-dom`, `@tanstack/react-query`, `@xyflow/react`, `quickjs-emscripten`, `postcss`, `sucrase` |
83
- | `@01.software/sdk/ui/canvas/server` | canvas server helpers | none |
83
+ | `@01.software/sdk/ui/canvas/server` | canvas server helpers | `postcss` >=8 (optional peer) |
84
84
  | `@01.software/sdk/ui/video` | `VideoPlayer` | `react`, `react-dom`, `@mux/mux-player-react` |
85
85
  | `@01.software/sdk/ui/image` | `Image` | `react`, `react-dom` |
86
86
 
@@ -896,6 +896,10 @@ const query = createQueryHooks(client, getStorefrontQueryClient())
896
896
 
897
897
  Most consumers should use the helper APIs above (`commerce.product.detail`, etc.). The query builder below is the escape hatch for advanced cases the helpers do not cover: bulk operations, custom filter combinations, or fields the helper response does not expose.
898
898
 
899
+ Refund and refund-line-item collection reads remain server-only. Their public
900
+ types and native reads omit private funding fields, including populated refund
901
+ relationships. Generated storage types do not grant access to those fields.
902
+
899
903
  ### `depth` — how deep to populate relationship fields
900
904
 
901
905
  `depth` is the primary control for populating relationships like `category`, `images`, `brand`. Browser publishable-key raw collection reads are constrained to `depth: 0` with `joins: false` and no `populate`; relationship-rich storefront reads should use shaped helpers such as `commerce.product.detail()` / `listingPage()`, or a `createServerClient()` raw query when server credentials are appropriate. Browser SDK raw reads add those safe defaults automatically and reject relationship-expanded raw read options before making a request.
@@ -1509,11 +1513,14 @@ their state fields before reading state-specific data such as `nextAction` or
1509
1513
  customer JWT when a resource is customer-bound. Server calls use the secret
1510
1514
  credential and never expose provider secrets in returned DTOs.
1511
1515
 
1512
- Browser and server commerce writes use separate transports even when their JSON
1513
- shapes match. `createServerClient()` routes every Cart operation, Checkout
1514
- create/retrieve/query, and PaymentSession create/retrieve/cancel/confirm through
1515
- the resource-owned `/server/*` namespace. Public paths retain only their exact
1516
- capability/customer bodies and never advertise the server credential.
1516
+ Cart and Checkout browser/server aliases reuse the same registered operations
1517
+ in their respective credential contexts; sharing an endpoint does not grant the
1518
+ same permissions. SDK alias mappings follow the `@01.software/http-contracts`
1519
+ manifest. Managed PaymentSession server operations use the resource-owned
1520
+ `/server/*` transport, while the server-only custom PaymentSession bridge uses
1521
+ separate orders-owned manifest operations. Keep Secret Keys on trusted servers;
1522
+ public calls retain their capability/customer bodies and never include server
1523
+ credentials.
1517
1524
 
1518
1525
  Generate one idempotency key per logical mutation, persist it with the pending
1519
1526
  operation, and reuse it after timeouts or lost responses. Creating a fresh key
@@ -2023,7 +2030,7 @@ your own baseline, retaining every option, value, and variant you intend to
2023
2030
  keep. Media IDs must already belong to the saved product's image pool.
2024
2031
 
2025
2032
  ```ts
2026
- await client.commerce.product.upsert({
2033
+ await server.commerce.product.upsert({
2027
2034
  productId: 'prod_123',
2028
2035
  graphRevision: draft.graphRevision,
2029
2036
  options: [
@@ -2520,6 +2527,18 @@ try {
2520
2527
 
2521
2528
  Error classes: `SDKError`, `ApiError`, `NetworkError`, `ValidationError`, `ConfigError`, `TimeoutError`
2522
2529
 
2530
+ A customer-token `401 token_expired` permits at most one configured token
2531
+ refresh. After a successful refresh, GET/HEAD/OPTIONS may be resent once
2532
+ independently of the transient retry budget, including `retry.maxRetries: 0`
2533
+ or expiry on the final attempt. This does not reset the transient retry budget.
2534
+ Another 401 returns its typed authentication error and request ID without a
2535
+ second refresh; unsafe methods return the original authentication error without
2536
+ resending the request.
2537
+
2538
+ After refresh, a canonical commerce response with `retryable: false` or no
2539
+ `retryable` field, or a `Retry-After` beyond the automatic wait bound, returns
2540
+ its typed error and request ID without another automatic retry.
2541
+
2523
2542
  ## Environment Variables
2524
2543
 
2525
2544
  ```bash
package/dist/client.cjs CHANGED
@@ -153,6 +153,11 @@ var COMMERCE_ERROR_CODES = [
153
153
  "checkout_reservation_release_requires_transaction",
154
154
  "admission_metadata_invalid",
155
155
  "admission_metadata_required",
156
+ "admission_not_eligible",
157
+ "admission_eligibility_unavailable",
158
+ "admission_authority_unavailable",
159
+ "admission_customer_binding_required",
160
+ "admission_eligibility_unproven",
156
161
  "capacity_exceeded",
157
162
  "admission_required",
158
163
  "occurrence_lock_unavailable",
@@ -822,6 +827,7 @@ async function httpFetch(url, options) {
822
827
  let lastError;
823
828
  let hasRetried401 = false;
824
829
  for (let attempt = 0; attempt <= retryConfig.maxRetries; attempt++) {
830
+ let terminalResponseError;
825
831
  try {
826
832
  const headers = new Headers(requestInit.headers);
827
833
  if (publishableKey) {
@@ -890,8 +896,9 @@ async function httpFetch(url, options) {
890
896
  hasRetried401 = true;
891
897
  try {
892
898
  const newToken = await onUnauthorized();
893
- if (newToken) {
899
+ if (newToken && SAFE_METHODS.includes((requestInit.method || "GET").toUpperCase())) {
894
900
  authToken = newToken;
901
+ attempt--;
895
902
  continue;
896
903
  }
897
904
  } catch {
@@ -924,11 +931,15 @@ async function httpFetch(url, options) {
924
931
  await delay(retryDelay);
925
932
  continue;
926
933
  }
934
+ terminalResponseError = error;
927
935
  throw error;
928
936
  }
929
937
  return response;
930
938
  } catch (error) {
931
939
  debugLog(debug, "error", url, error);
940
+ if (terminalResponseError && error === terminalResponseError) {
941
+ throw error;
942
+ }
932
943
  const method2 = (requestInit.method || "GET").toUpperCase();
933
944
  const isSafe = SAFE_METHODS.includes(method2);
934
945
  if (error instanceof Error && error.name === "AbortError") {
@@ -1340,6 +1351,15 @@ var EMBEDDED_ADMIN_ENDPOINT_OPERATIONS = {
1340
1351
  };
1341
1352
  var EVENTS_ENDPOINT_OPERATIONS = {
1342
1353
  registrations: {
1354
+ register: operation("event-registrations", "post", "/register"),
1355
+ guestLookup: operation("event-registrations", "post", "/guest/lookup"),
1356
+ guestLookupByUrl: operation("event-registrations", "get", "/guest/:token"),
1357
+ guestCancel: operation("event-registrations", "post", "/guest/cancel"),
1358
+ guestCancelByUrl: operation(
1359
+ "event-registrations",
1360
+ "post",
1361
+ "/guest/:token/cancel"
1362
+ ),
1343
1363
  listMine: operation("event-registrations", "get", "/my")
1344
1364
  },
1345
1365
  events: {
@@ -6358,24 +6378,32 @@ var EventsClient = class {
6358
6378
  }
6359
6379
  register(params) {
6360
6380
  return this.execute(
6361
- "/api/event-registrations/register",
6362
- "POST",
6381
+ resolveOperationPath(EVENTS_ENDPOINT_OPERATIONS.registrations.register),
6382
+ resolveOperationMethod(EVENTS_ENDPOINT_OPERATIONS.registrations.register),
6363
6383
  buildRegistrationRequestBody(params),
6364
6384
  { useCustomerAuth: true }
6365
6385
  );
6366
6386
  }
6367
6387
  getGuestRegistration(token) {
6368
6388
  return this.execute(
6369
- "/api/event-registrations/guest/lookup",
6370
- "POST",
6389
+ resolveOperationPath(
6390
+ EVENTS_ENDPOINT_OPERATIONS.registrations.guestLookup
6391
+ ),
6392
+ resolveOperationMethod(
6393
+ EVENTS_ENDPOINT_OPERATIONS.registrations.guestLookup
6394
+ ),
6371
6395
  { token },
6372
6396
  { useCustomerAuth: false }
6373
6397
  );
6374
6398
  }
6375
6399
  cancelGuestRegistration(token, params = {}) {
6376
6400
  return this.execute(
6377
- "/api/event-registrations/guest/cancel",
6378
- "POST",
6401
+ resolveOperationPath(
6402
+ EVENTS_ENDPOINT_OPERATIONS.registrations.guestCancel
6403
+ ),
6404
+ resolveOperationMethod(
6405
+ EVENTS_ENDPOINT_OPERATIONS.registrations.guestCancel
6406
+ ),
6379
6407
  buildGuestCancelRequestBody(token, params),
6380
6408
  { useCustomerAuth: false }
6381
6409
  );