@01.software/sdk 0.4.3 → 0.5.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.
Files changed (40) hide show
  1. package/README.md +13 -13
  2. package/dist/auth.d.cts +1 -1
  3. package/dist/auth.d.ts +1 -1
  4. package/dist/{const-C3GC2SxR.d.cts → const-BO4SPN7f.d.ts} +2 -2
  5. package/dist/{const-ikSyKVND.d.ts → const-hqVXNZoy.d.cts} +2 -2
  6. package/dist/index.cjs +9 -7
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.d.cts +27 -18
  9. package/dist/index.d.ts +27 -18
  10. package/dist/index.js +9 -7
  11. package/dist/index.js.map +1 -1
  12. package/dist/{payload-types-DPka7hJu.d.cts → payload-types-mZpmjJBz.d.cts} +102 -4
  13. package/dist/{payload-types-DPka7hJu.d.ts → payload-types-mZpmjJBz.d.ts} +102 -4
  14. package/dist/realtime.cjs.map +1 -1
  15. package/dist/realtime.d.cts +2 -2
  16. package/dist/realtime.d.ts +2 -2
  17. package/dist/realtime.js.map +1 -1
  18. package/dist/server-B80o7igg.d.cts +242 -0
  19. package/dist/server-B80o7igg.d.ts +242 -0
  20. package/dist/ui/flow/server.cjs +233 -0
  21. package/dist/ui/flow/server.cjs.map +1 -0
  22. package/dist/ui/flow/server.d.cts +3 -0
  23. package/dist/ui/flow/server.d.ts +3 -0
  24. package/dist/ui/flow/server.js +213 -0
  25. package/dist/ui/flow/server.js.map +1 -0
  26. package/dist/ui/flow.cjs +540 -127
  27. package/dist/ui/flow.cjs.map +1 -1
  28. package/dist/ui/flow.d.cts +39 -189
  29. package/dist/ui/flow.d.ts +39 -189
  30. package/dist/ui/flow.js +544 -135
  31. package/dist/ui/flow.js.map +1 -1
  32. package/dist/ui/form.d.cts +1 -1
  33. package/dist/ui/form.d.ts +1 -1
  34. package/dist/ui/video.d.cts +1 -1
  35. package/dist/ui/video.d.ts +1 -1
  36. package/dist/{webhook-CvNTdBWV.d.ts → webhook-CMi4JRCp.d.ts} +3 -3
  37. package/dist/{webhook-B8BfJ_Ka.d.cts → webhook-D65mzWt2.d.cts} +3 -3
  38. package/dist/webhook.d.cts +3 -3
  39. package/dist/webhook.d.ts +3 -3
  40. package/package.json +19 -14
package/README.md CHANGED
@@ -15,19 +15,19 @@ pnpm add @01.software/sdk
15
15
 
16
16
  - Full TypeScript type inference
17
17
  - Browser and server environment support
18
- - React Query integration (both BrowserClient and ServerClient)
18
+ - React Query integration (both Client and ServerClient)
19
19
  - Mutation hooks (useCreate, useUpdate, useRemove) with automatic cache invalidation
20
20
  - Customer auth hooks (useCustomerMe, useCustomerLogin, etc.) with cache management
21
21
  - Automatic retry with exponential backoff (non-retryable: 401, 403, 404, 422)
22
22
  - Webhook handling with HMAC-SHA256 signature verification
23
23
  - Sub-path imports (`./auth`, `./webhook`, `./components`) for tree-shaking
24
- - Type-safe read-only `from()` for BrowserClient (compile-time write prevention)
24
+ - Type-safe read-only `from()` for Client (compile-time write prevention)
25
25
 
26
26
  ### Sub-path Imports
27
27
 
28
28
  ```typescript
29
29
  // Main entry - clients, query builder, hooks, utilities
30
- import { createBrowserClient, createServerClient } from '@01.software/sdk'
30
+ import { createClient, createServerClient } from '@01.software/sdk'
31
31
 
32
32
  // Auth only - JWT & API Key utilities (smaller bundle)
33
33
  import {
@@ -53,12 +53,12 @@ import { VideoPlayer } from '@01.software/sdk/ui/video'
53
53
 
54
54
  ## Getting Started
55
55
 
56
- ### Browser Client
56
+ ### Client
57
57
 
58
58
  ```typescript
59
- import { createBrowserClient } from '@01.software/sdk'
59
+ import { createClient } from '@01.software/sdk'
60
60
 
61
- const client = createBrowserClient({
61
+ const client = createClient({
62
62
  clientKey: process.env.NEXT_PUBLIC_SOFTWARE_CLIENT_KEY,
63
63
  })
64
64
 
@@ -102,7 +102,7 @@ await client.query.prefetchQuery({
102
102
  ### Client Configuration
103
103
 
104
104
  ```typescript
105
- const client = createBrowserClient({
105
+ const client = createClient({
106
106
  clientKey: string, // Required
107
107
  })
108
108
  ```
@@ -121,7 +121,7 @@ API URL은 환경변수로 오버라이드 가능합니다:
121
121
 
122
122
  Access collections via `client.from(collection)` method.
123
123
 
124
- > **Note:** `BrowserClient.from()` returns a `ReadOnlyQueryBuilder` (only `find`, `findById`, `count`, `findMetadata`, `findMetadataById`). Write operations (`create`, `update`, `remove`, `updateMany`, `removeMany`) are only available on `ServerClient.from()`.
124
+ > **Note:** `Client.from()` returns a `ReadOnlyQueryBuilder` (only `find`, `findById`, `count`, `findMetadata`, `findMetadataById`). Write operations (`create`, `update`, `remove`, `updateMany`, `removeMany`) are only available on `ServerClient.from()`.
125
125
 
126
126
  ```typescript
127
127
  // List query - returns PayloadFindResponse
@@ -218,7 +218,7 @@ interface PayloadMutationResponse<T> {
218
218
 
219
219
  ### React Query Hooks
220
220
 
221
- Read hooks are available on both `BrowserClient` and `ServerClient` via `client.query.*`. Mutation hooks (`useCreate`, `useUpdate`, `useRemove`) are only available on `ServerClient`.
221
+ Read hooks are available on both `Client` and `ServerClient` via `client.query.*`. Mutation hooks (`useCreate`, `useUpdate`, `useRemove`) are only available on `ServerClient`.
222
222
 
223
223
  ```typescript
224
224
  // List query
@@ -273,7 +273,7 @@ client.query.invalidateQueries('products')
273
273
  client.query.getQueryData('products', 'list', options)
274
274
  client.query.setQueryData('products', 'detail', id, data)
275
275
 
276
- // Customer auth hooks (BrowserClient only)
276
+ // Customer auth hooks (Client only)
277
277
  const { data: profile } = client.query.useCustomerMe()
278
278
  const { mutate: login } = client.query.useCustomerLogin()
279
279
  const { mutate: register } = client.query.useCustomerRegister()
@@ -295,10 +295,10 @@ client.query.setCustomerData(profile)
295
295
 
296
296
  ### Customer Auth
297
297
 
298
- Available on BrowserClient via `client.customer.*`.
298
+ Available on Client via `client.customer.*`.
299
299
 
300
300
  ```typescript
301
- const client = createBrowserClient({
301
+ const client = createClient({
302
302
  clientKey: process.env.NEXT_PUBLIC_SOFTWARE_CLIENT_KEY,
303
303
  customer: { persist: true },
304
304
  })
@@ -370,7 +370,7 @@ const { results, allAvailable } = await client.product.stockCheck({
370
370
 
371
371
  ### Cart API
372
372
 
373
- Available in both ServerClient and BrowserClient via `client.cart.*`.
373
+ Available in both ServerClient and Client via `client.cart.*`.
374
374
 
375
375
  ```typescript
376
376
  // Add item to cart
package/dist/auth.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import './payload-types-DPka7hJu.cjs';
1
+ import './payload-types-mZpmjJBz.cjs';
2
2
 
3
3
  interface JwtPayload {
4
4
  clientKey: string;
package/dist/auth.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import './payload-types-DPka7hJu.js';
1
+ import './payload-types-mZpmjJBz.js';
2
2
 
3
3
  interface JwtPayload {
4
4
  clientKey: string;
@@ -1,4 +1,4 @@
1
- import { C as Config } from './payload-types-DPka7hJu.cjs';
1
+ import { C as Config } from './payload-types-mZpmjJBz.js';
2
2
 
3
3
  /**
4
4
  * Collection type derived from Payload Config.
@@ -9,7 +9,7 @@ type Collection = keyof Config['collections'];
9
9
  * Array of all public collection names for runtime use (e.g., Zod enum validation).
10
10
  * This is the single source of truth for which collections are publicly accessible via SDK.
11
11
  */
12
- declare const COLLECTIONS: readonly ["tenants", "tenant-metadata", "tenant-logos", "products", "product-variants", "product-options", "product-categories", "product-tags", "product-collections", "brands", "brand-logos", "orders", "order-products", "returns", "return-products", "exchanges", "exchange-products", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-addresses", "customer-groups", "carts", "cart-items", "discounts", "shipping-policies", "documents", "document-categories", "document-types", "posts", "post-authors", "post-categories", "post-tags", "playlists", "playlist-categories", "playlist-tags", "musics", "galleries", "gallery-categories", "gallery-tags", "gallery-items", "flows", "flow-node-types", "flow-edge-types", "flow-categories", "flow-tags", "videos", "video-categories", "video-tags", "live-streams", "images", "forms", "form-submissions"];
12
+ declare const COLLECTIONS: readonly ["tenants", "tenant-metadata", "tenant-logos", "products", "product-variants", "product-options", "product-categories", "product-tags", "product-collections", "brands", "brand-logos", "orders", "order-products", "returns", "return-products", "exchanges", "exchange-products", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-addresses", "customer-groups", "carts", "cart-items", "discounts", "shipping-policies", "documents", "document-categories", "document-types", "posts", "post-authors", "post-categories", "post-tags", "playlists", "playlist-categories", "playlist-tags", "musics", "music-categories", "music-tags", "galleries", "gallery-categories", "gallery-tags", "gallery-items", "flows", "flow-node-types", "flow-edge-types", "flow-categories", "flow-tags", "videos", "video-categories", "video-tags", "live-streams", "images", "forms", "form-submissions"];
13
13
  /**
14
14
  * Public collections available for SDK access.
15
15
  * Derived from the COLLECTIONS array (single source of truth).
@@ -1,4 +1,4 @@
1
- import { C as Config } from './payload-types-DPka7hJu.js';
1
+ import { C as Config } from './payload-types-mZpmjJBz.cjs';
2
2
 
3
3
  /**
4
4
  * Collection type derived from Payload Config.
@@ -9,7 +9,7 @@ type Collection = keyof Config['collections'];
9
9
  * Array of all public collection names for runtime use (e.g., Zod enum validation).
10
10
  * This is the single source of truth for which collections are publicly accessible via SDK.
11
11
  */
12
- declare const COLLECTIONS: readonly ["tenants", "tenant-metadata", "tenant-logos", "products", "product-variants", "product-options", "product-categories", "product-tags", "product-collections", "brands", "brand-logos", "orders", "order-products", "returns", "return-products", "exchanges", "exchange-products", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-addresses", "customer-groups", "carts", "cart-items", "discounts", "shipping-policies", "documents", "document-categories", "document-types", "posts", "post-authors", "post-categories", "post-tags", "playlists", "playlist-categories", "playlist-tags", "musics", "galleries", "gallery-categories", "gallery-tags", "gallery-items", "flows", "flow-node-types", "flow-edge-types", "flow-categories", "flow-tags", "videos", "video-categories", "video-tags", "live-streams", "images", "forms", "form-submissions"];
12
+ declare const COLLECTIONS: readonly ["tenants", "tenant-metadata", "tenant-logos", "products", "product-variants", "product-options", "product-categories", "product-tags", "product-collections", "brands", "brand-logos", "orders", "order-products", "returns", "return-products", "exchanges", "exchange-products", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-addresses", "customer-groups", "carts", "cart-items", "discounts", "shipping-policies", "documents", "document-categories", "document-types", "posts", "post-authors", "post-categories", "post-tags", "playlists", "playlist-categories", "playlist-tags", "musics", "music-categories", "music-tags", "galleries", "gallery-categories", "gallery-tags", "gallery-items", "flows", "flow-node-types", "flow-edge-types", "flow-categories", "flow-tags", "videos", "video-categories", "video-tags", "live-streams", "images", "forms", "form-submissions"];
13
13
  /**
14
14
  * Public collections available for SDK access.
15
15
  * Derived from the COLLECTIONS array (single source of truth).
package/dist/index.cjs CHANGED
@@ -72,9 +72,9 @@ var src_exports = {};
72
72
  __export(src_exports, {
73
73
  ApiError: () => ApiError,
74
74
  BaseApi: () => BaseApi,
75
- BrowserClient: () => BrowserClient,
76
75
  COLLECTIONS: () => COLLECTIONS,
77
76
  CartApi: () => CartApi,
77
+ Client: () => Client,
78
78
  CollectionClient: () => CollectionClient,
79
79
  CollectionHooks: () => CollectionHooks,
80
80
  CollectionQueryBuilder: () => CollectionQueryBuilder,
@@ -96,7 +96,7 @@ __export(src_exports, {
96
96
  ValidationError: () => ValidationError,
97
97
  collectionKeys: () => collectionKeys,
98
98
  createApiKey: () => createApiKey,
99
- createBrowserClient: () => createBrowserClient,
99
+ createClient: () => createClient,
100
100
  createServerClient: () => createServerClient,
101
101
  createServerToken: () => createServerToken,
102
102
  createTypedWebhookHandler: () => createTypedWebhookHandler,
@@ -1341,6 +1341,8 @@ var COLLECTIONS = [
1341
1341
  "playlist-categories",
1342
1342
  "playlist-tags",
1343
1343
  "musics",
1344
+ "music-categories",
1345
+ "music-tags",
1344
1346
  "galleries",
1345
1347
  "gallery-categories",
1346
1348
  "gallery-tags",
@@ -1939,7 +1941,7 @@ var CustomerHooks = class {
1939
1941
  ensureCustomerAuth() {
1940
1942
  if (!this.customerAuth) {
1941
1943
  throw createConfigError(
1942
- "Customer hooks require BrowserClient. Use createBrowserClient() instead of createServerClient()."
1944
+ "Customer hooks require Client. Use createClient() instead of createServerClient()."
1943
1945
  );
1944
1946
  }
1945
1947
  return this.customerAuth;
@@ -2063,7 +2065,7 @@ var QueryHooks = class extends CollectionHooks {
2063
2065
  };
2064
2066
 
2065
2067
  // src/core/client/client.ts
2066
- var BrowserClient = class {
2068
+ var Client = class {
2067
2069
  constructor(options) {
2068
2070
  var _a;
2069
2071
  if (!options.clientKey) {
@@ -2120,8 +2122,8 @@ var BrowserClient = class {
2120
2122
  return __spreadValues({}, this.config);
2121
2123
  }
2122
2124
  };
2123
- function createBrowserClient(options) {
2124
- return new BrowserClient(options);
2125
+ function createClient(options) {
2126
+ return new Client(options);
2125
2127
  }
2126
2128
 
2127
2129
  // src/core/client/client.server.ts
@@ -2129,7 +2131,7 @@ var ServerClient = class {
2129
2131
  constructor(options) {
2130
2132
  if (typeof window !== "undefined") {
2131
2133
  throw createConfigError(
2132
- "ServerClient must not be used in a browser environment. This risks exposing your secretKey in client bundles. Use createBrowserClient() for browser code instead."
2134
+ "ServerClient must not be used in a browser environment. This risks exposing your secretKey in client bundles. Use createClient() for browser code instead."
2133
2135
  );
2134
2136
  }
2135
2137
  if (!options.clientKey) {