@01.software/sdk 0.16.0 → 0.17.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/README.md CHANGED
@@ -79,7 +79,7 @@ const { docs } = await client.collections.from('products').find({
79
79
  import { createServerClient } from '@01.software/sdk'
80
80
 
81
81
  const client = createServerClient({
82
- publishableKey: process.env.NEXT_PUBLIC_SOFTWARE_PUBLISHABLE_KEY,
82
+ publishableKey: process.env.SOFTWARE_PUBLISHABLE_KEY,
83
83
  secretKey: process.env.SOFTWARE_SECRET_KEY, // sk01_... opaque API key from Console
84
84
  })
85
85
 
@@ -113,7 +113,7 @@ const client = createClient({
113
113
  const server = createServerClient({
114
114
  publishableKey: string,
115
115
  secretKey: string, // sk01_... or pat01_...
116
- tenantId: string, // required when secretKey is pat01_
116
+ tenantId?: string, // for PAT workflows, must match the pinned tenant when supplied
117
117
  })
118
118
  ```
119
119
 
@@ -121,6 +121,7 @@ const server = createServerClient({
121
121
  | ---------------- | -------- | ---------------------------- |
122
122
  | `publishableKey` | `string` | API publishable key |
123
123
  | `secretKey` | `string` | API secret key (server only) |
124
+ | `tenantId` | `string` | Optional generally; required when a PAT must disambiguate multi-tenant access. Must match the pinned tenant when supplied. |
124
125
 
125
126
  API URL은 환경변수로 오버라이드 가능합니다:
126
127
 
@@ -464,22 +465,25 @@ const handler = createTypedWebhookHandler('orders', async (event) => {
464
465
 
465
466
  ## Supported Collections
466
467
 
467
- | Category | Collections |
468
- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
469
- | Tenant | `tenants`, `tenant-metadata`, `tenant-logos` |
470
- | Images | `images` (unified), `brand-logos` |
471
- | Products | `products`, `product-variants`, `product-options`, `product-option-values`, `product-categories`, `product-tags`, `product-collections`, `brands`, `brand-logos` |
472
- | Orders | `orders`, `order-items`, `returns`, `return-items`, `fulfillments`, `fulfillment-items`, `transactions`, `order-status-logs` |
473
- | Customers | `customers`, `customer-addresses`, `customer-groups` |
474
- | Carts | `carts`, `cart-items` |
475
- | Commerce | `discounts`, `shipping-policies` |
476
- | Content | `posts`, `post-authors`, `post-categories`, `post-tags`, `documents`, `document-categories`, `document-types` |
477
- | Playlists | `playlists`, `playlist-categories`, `playlist-tags`, `tracks`, `track-categories`, `track-tags` |
478
- | Galleries | `galleries`, `gallery-items`, `gallery-categories`, `gallery-tags` |
479
- | Canvas | `canvases`, `canvas-node-types`, `canvas-edge-types`, `canvas-categories`, `canvas-tags` |
480
- | Videos | `videos`, `video-categories`, `video-tags` |
481
- | Live Streams | `live-streams` |
482
- | Forms | `forms`, `form-submissions` |
468
+ Source of truth: `packages/sdk/src/core/collection/const.ts` (`COLLECTIONS`: 70).
469
+
470
+ | Category | Collections |
471
+ | --- | --- |
472
+ | Tenant | `tenants`, `tenant-metadata`, `tenant-logos` |
473
+ | Products | `products`, `product-variants`, `product-options`, `product-option-values`, `product-categories`, `product-tags`, `product-collections`, `brands`, `brand-logos` |
474
+ | Orders | `orders`, `order-items`, `returns`, `return-items`, `fulfillments`, `fulfillment-items`, `transactions` |
475
+ | Customers | `customers`, `customer-profiles`, `customer-addresses`, `customer-groups` |
476
+ | Carts | `carts`, `cart-items` |
477
+ | Commerce | `discounts`, `promotions`, `shipping-policies` |
478
+ | Content | `documents`, `document-categories`, `document-types`, `posts`, `post-authors`, `post-categories`, `post-tags`, `links`, `link-categories`, `link-tags` |
479
+ | Playlists / Tracks | `playlists`, `playlist-categories`, `playlist-tags`, `tracks`, `track-categories`, `track-tags` |
480
+ | Galleries | `galleries`, `gallery-categories`, `gallery-tags`, `gallery-items` |
481
+ | Canvas | `canvases`, `canvas-node-types`, `canvas-edge-types`, `canvas-categories`, `canvas-tags`, `canvas-nodes`, `canvas-edges` |
482
+ | Videos | `videos`, `video-categories`, `video-tags` |
483
+ | Live Streams | `live-streams` |
484
+ | Media | `images` |
485
+ | Forms | `forms`, `form-submissions` |
486
+ | Community | `threads`, `comments`, `reactions`, `reaction-types`, `bookmarks`, `thread-categories`, `reports`, `community-bans` |
483
487
 
484
488
  ## Utilities
485
489
 
@@ -581,6 +585,7 @@ Error classes: `SDKError`, `ApiError`, `NetworkError`, `ValidationError`, `Confi
581
585
 
582
586
  ```bash
583
587
  NEXT_PUBLIC_SOFTWARE_PUBLISHABLE_KEY=your_publishable_key
588
+ SOFTWARE_PUBLISHABLE_KEY=your_publishable_key
584
589
  SOFTWARE_SECRET_KEY=sk01_... # Server only — opaque API key from Console
585
590
  ```
586
591
 
@@ -597,7 +602,7 @@ New error codes propagated via `SDKError.code` (no breaking change; existing cal
597
602
  | Code | Phase | Trigger |
598
603
  |---|---|---|
599
604
  | `account_suspended` | P1 | Suspended session / `sk01_` / `pat01_` / customer JWT — 401 |
600
- | `pat_tenant_header_forbidden` | P1 | `pat01_` with `X-Tenant-Id` header — 401 (header rejected) |
605
+ | `pat_tenant_header_forbidden` | P1 | `pat01_` request with a forbidden or mismatched `X-Tenant-Id` header — 401 |
601
606
  | `tenant_mismatch` | P3 | Cross-tenant FK rejection (forms / community / orders) |
602
607
  | `server_derived` | P3 | Body-driven write into a server-derived state field — 422 |
603
608
  | `scope_denied` | P5 | `pat01_` whose `ApiKeys.scopes` lacks the operation |
@@ -1,4 +1,4 @@
1
- import { C as Config } from './payload-types-DRvL_bS2.js';
1
+ import { C as Config } from './payload-types-CMoyAOjJ.cjs';
2
2
 
3
3
  /**
4
4
  * Collection type derived from Payload Config.
@@ -14,7 +14,7 @@ declare const INTERNAL_COLLECTIONS: readonly ["users", "payload-kv", "payload-lo
14
14
  * Array of all public collection names for runtime use (e.g., Zod enum validation).
15
15
  * This is the single source of truth for which collections are publicly accessible via SDK.
16
16
  */
17
- declare const COLLECTIONS: readonly ["tenants", "tenant-metadata", "tenant-logos", "products", "product-variants", "product-options", "product-option-values", "product-categories", "product-tags", "product-collections", "brands", "brand-logos", "orders", "order-items", "returns", "return-items", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-addresses", "customer-groups", "carts", "cart-items", "discounts", "promotions", "shipping-policies", "documents", "document-categories", "document-types", "posts", "post-authors", "post-categories", "post-tags", "playlists", "playlist-categories", "playlist-tags", "tracks", "track-categories", "track-tags", "galleries", "gallery-categories", "gallery-tags", "gallery-items", "links", "link-categories", "link-tags", "canvases", "canvas-node-types", "canvas-edge-types", "canvas-categories", "canvas-tags", "canvas-nodes", "canvas-edges", "videos", "video-categories", "video-tags", "live-streams", "images", "forms", "form-submissions", "threads", "comments", "reactions", "reaction-types", "bookmarks", "thread-categories", "reports", "community-bans"];
17
+ declare const COLLECTIONS: readonly ["tenants", "tenant-metadata", "tenant-logos", "products", "product-variants", "product-options", "product-option-values", "product-categories", "product-tags", "product-collections", "brands", "brand-logos", "orders", "order-items", "returns", "return-items", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-profiles", "customer-addresses", "customer-groups", "carts", "cart-items", "discounts", "promotions", "shipping-policies", "documents", "document-categories", "document-types", "posts", "post-authors", "post-categories", "post-tags", "playlists", "playlist-categories", "playlist-tags", "tracks", "track-categories", "track-tags", "galleries", "gallery-categories", "gallery-tags", "gallery-items", "links", "link-categories", "link-tags", "canvases", "canvas-node-types", "canvas-edge-types", "canvas-categories", "canvas-tags", "canvas-nodes", "canvas-edges", "videos", "video-categories", "video-tags", "live-streams", "images", "forms", "form-submissions", "threads", "comments", "reactions", "reaction-types", "bookmarks", "thread-categories", "reports", "community-bans"];
18
18
  /**
19
19
  * Public collections available for SDK access.
20
20
  * Derived from the COLLECTIONS array (single source of truth).
@@ -1,4 +1,4 @@
1
- import { C as Config } from './payload-types-DRvL_bS2.cjs';
1
+ import { C as Config } from './payload-types-CMoyAOjJ.js';
2
2
 
3
3
  /**
4
4
  * Collection type derived from Payload Config.
@@ -14,7 +14,7 @@ declare const INTERNAL_COLLECTIONS: readonly ["users", "payload-kv", "payload-lo
14
14
  * Array of all public collection names for runtime use (e.g., Zod enum validation).
15
15
  * This is the single source of truth for which collections are publicly accessible via SDK.
16
16
  */
17
- declare const COLLECTIONS: readonly ["tenants", "tenant-metadata", "tenant-logos", "products", "product-variants", "product-options", "product-option-values", "product-categories", "product-tags", "product-collections", "brands", "brand-logos", "orders", "order-items", "returns", "return-items", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-addresses", "customer-groups", "carts", "cart-items", "discounts", "promotions", "shipping-policies", "documents", "document-categories", "document-types", "posts", "post-authors", "post-categories", "post-tags", "playlists", "playlist-categories", "playlist-tags", "tracks", "track-categories", "track-tags", "galleries", "gallery-categories", "gallery-tags", "gallery-items", "links", "link-categories", "link-tags", "canvases", "canvas-node-types", "canvas-edge-types", "canvas-categories", "canvas-tags", "canvas-nodes", "canvas-edges", "videos", "video-categories", "video-tags", "live-streams", "images", "forms", "form-submissions", "threads", "comments", "reactions", "reaction-types", "bookmarks", "thread-categories", "reports", "community-bans"];
17
+ declare const COLLECTIONS: readonly ["tenants", "tenant-metadata", "tenant-logos", "products", "product-variants", "product-options", "product-option-values", "product-categories", "product-tags", "product-collections", "brands", "brand-logos", "orders", "order-items", "returns", "return-items", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-profiles", "customer-addresses", "customer-groups", "carts", "cart-items", "discounts", "promotions", "shipping-policies", "documents", "document-categories", "document-types", "posts", "post-authors", "post-categories", "post-tags", "playlists", "playlist-categories", "playlist-tags", "tracks", "track-categories", "track-tags", "galleries", "gallery-categories", "gallery-tags", "gallery-items", "links", "link-categories", "link-tags", "canvases", "canvas-node-types", "canvas-edge-types", "canvas-categories", "canvas-tags", "canvas-nodes", "canvas-edges", "videos", "video-categories", "video-tags", "live-streams", "images", "forms", "form-submissions", "threads", "comments", "reactions", "reaction-types", "bookmarks", "thread-categories", "reports", "community-bans"];
18
18
  /**
19
19
  * Public collections available for SDK access.
20
20
  * Derived from the COLLECTIONS array (single source of truth).
package/dist/index.cjs CHANGED
@@ -1115,6 +1115,7 @@ var COLLECTIONS = [
1115
1115
  "fulfillment-items",
1116
1116
  "transactions",
1117
1117
  "customers",
1118
+ "customer-profiles",
1118
1119
  "customer-addresses",
1119
1120
  "customer-groups",
1120
1121
  "carts",