@01.software/sdk 0.4.3 → 0.5.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 (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-ikSyKVND.d.ts → const-CDpRB7XK.d.cts} +2 -2
  5. package/dist/{const-C3GC2SxR.d.cts → const-DQIDvvB-.d.ts} +2 -2
  6. package/dist/index.cjs +22 -20
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.d.cts +55 -34
  9. package/dist/index.d.ts +55 -34
  10. package/dist/index.js +22 -20
  11. package/dist/index.js.map +1 -1
  12. package/dist/{payload-types-DPka7hJu.d.cts → payload-types-C-keX5go.d.cts} +112 -41
  13. package/dist/{payload-types-DPka7hJu.d.ts → payload-types-C-keX5go.d.ts} +112 -41
  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-Dqe2_xMx.d.cts} +3 -3
  37. package/dist/{webhook-B8BfJ_Ka.d.cts → webhook-DseJdRFT.d.ts} +3 -3
  38. package/dist/webhook.d.cts +3 -3
  39. package/dist/webhook.d.ts +3 -3
  40. package/package.json +17 -12
package/dist/index.d.cts CHANGED
@@ -1,13 +1,13 @@
1
- import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, E as Exchange, c as Cart, d as CartItem, P as Product } from './payload-types-DPka7hJu.cjs';
2
- export { o as ApiUsage, as as ApiUsageSelect, A as Audience, ao as AudiencesSelect, bo as Auth, q as BillingHistory, au as BillingHistorySelect, y as Brand, B as BrandLogo, aD as BrandLogosSelect, aC as BrandsSelect, aT as CartItemsSelect, aS as CartsSelect, g as CodeBlock, bn as CollectionsWidget, C as Config, G as Customer, J as CustomerAddress, aQ as CustomerAddressesSelect, e as CustomerAuthOperations, H as CustomerGroup, aR as CustomerGroupsSelect, aP as CustomersSelect, W as Discount, aU as DiscountsSelect, $ as Document, a_ as DocumentCategoriesSelect, a1 as DocumentCategory, a0 as DocumentType, a$ as DocumentTypesSelect, aZ as DocumentsSelect, m as EmailLog, ap as EmailLogsSelect, N as ExchangeProduct, aN as ExchangeProductsSelect, aM as ExchangesSelect, j as FieldConfig, al as FieldConfigsSelect, aa as Flow, bb as FlowCategoriesSelect, ab as FlowCategory, ae as FlowEdgeType, ba as FlowEdgeTypesSelect, ad as FlowNodeType, b9 as FlowNodeTypesSelect, ac as FlowTag, bc as FlowTagsSelect, b8 as FlowsSelect, F as Form, af as FormSubmission, bi as FormSubmissionsSelect, bh as FormsSelect, K as FulfillmentItem, aJ as FulfillmentItemsSelect, aI as FulfillmentsSelect, b4 as GalleriesSelect, a6 as Gallery, b5 as GalleryCategoriesSelect, a7 as GalleryCategory, a9 as GalleryItem, b7 as GalleryItemsSelect, a8 as GalleryTag, b6 as GalleryTagsSelect, I as IframeBlock, k as Image, am as ImagesSelect, L as LiveStream, bg as LiveStreamsSelect, a5 as Music, b3 as MusicsSelect, aF as OrderProductsSelect, Q as OrderStatusLog, aH as OrderStatusLogsSelect, aE as OrdersSelect, ag as PayloadKv, bj as PayloadKvSelect, ah as PayloadLockedDocument, bk as PayloadLockedDocumentsSelect, aj as PayloadMigration, bm as PayloadMigrationsSelect, ai as PayloadPreference, bl as PayloadPreferencesSelect, f as PlayerBlock, a2 as Playlist, b1 as PlaylistCategoriesSelect, a3 as PlaylistCategory, a4 as PlaylistTag, b2 as PlaylistTagsSelect, b0 as PlaylistsSelect, X as Post, Y as PostAuthor, aW as PostAuthorsSelect, aX as PostCategoriesSelect, Z as PostCategory, _ as PostTag, aY as PostTagsSelect, aV as PostsSelect, az as ProductCategoriesSelect, w as ProductCategory, D as ProductCollection, aB as ProductCollectionsSelect, v as ProductOption, ay as ProductOptionsSelect, x as ProductTag, aA as ProductTagsSelect, u as ProductVariant, ax as ProductVariantsSelect, aw as ProductsSelect, M as ReturnProduct, aL as ReturnProductsSelect, aK as ReturnsSelect, aO as ShippingPoliciesSelect, z as ShippingPolicy, p as Subscription, at as SubscriptionsSelect, S as SupportedTimezones, l as SystemMedia, an as SystemMediaSelect, i as Tenant, r as TenantLogo, av as TenantLogosSelect, ar as TenantMetadataSelect, n as TenantMetadatum, aq as TenantsSelect, aG as TransactionsSelect, h as User, U as UserAuthOperations, ak as UsersSelect, V as Video, be as VideoCategoriesSelect, s as VideoCategory, t as VideoTag, bf as VideoTagsSelect, bd as VideosSelect } from './payload-types-DPka7hJu.cjs';
1
+ import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, E as Exchange, c as Cart, d as CartItem, P as Product } from './payload-types-C-keX5go.cjs';
2
+ export { o as ApiUsage, au as ApiUsageSelect, A as Audience, aq as AudiencesSelect, bs as Auth, q as BillingHistory, aw as BillingHistorySelect, y as Brand, B as BrandLogo, aF as BrandLogosSelect, aE as BrandsSelect, aV as CartItemsSelect, aU as CartsSelect, g as CodeBlock, br as CollectionsWidget, C as Config, G as Customer, J as CustomerAddress, aS as CustomerAddressesSelect, e as CustomerAuthOperations, H as CustomerGroup, aT as CustomerGroupsSelect, aR as CustomersSelect, W as Discount, aW as DiscountsSelect, $ as Document, b0 as DocumentCategoriesSelect, a1 as DocumentCategory, a0 as DocumentType, b1 as DocumentTypesSelect, a$ as DocumentsSelect, m as EmailLog, ar as EmailLogsSelect, N as ExchangeProduct, aP as ExchangeProductsSelect, aO as ExchangesSelect, j as FieldConfig, an as FieldConfigsSelect, ac as Flow, bf as FlowCategoriesSelect, ad as FlowCategory, ag as FlowEdgeType, be as FlowEdgeTypesSelect, af as FlowNodeType, bd as FlowNodeTypesSelect, ae as FlowTag, bg as FlowTagsSelect, bc as FlowsSelect, F as Form, ah as FormSubmission, bm as FormSubmissionsSelect, bl as FormsSelect, K as FulfillmentItem, aL as FulfillmentItemsSelect, aK as FulfillmentsSelect, b8 as GalleriesSelect, a8 as Gallery, b9 as GalleryCategoriesSelect, a9 as GalleryCategory, ab as GalleryItem, bb as GalleryItemsSelect, aa as GalleryTag, ba as GalleryTagsSelect, I as IframeBlock, k as Image, ao as ImagesSelect, L as LiveStream, bk as LiveStreamsSelect, a5 as Music, b6 as MusicCategoriesSelect, a6 as MusicCategory, a7 as MusicTag, b7 as MusicTagsSelect, b5 as MusicsSelect, aH as OrderProductsSelect, Q as OrderStatusLog, aJ as OrderStatusLogsSelect, aG as OrdersSelect, ai as PayloadKv, bn as PayloadKvSelect, aj as PayloadLockedDocument, bo as PayloadLockedDocumentsSelect, al as PayloadMigration, bq as PayloadMigrationsSelect, ak as PayloadPreference, bp as PayloadPreferencesSelect, f as PlayerBlock, a2 as Playlist, b3 as PlaylistCategoriesSelect, a3 as PlaylistCategory, a4 as PlaylistTag, b4 as PlaylistTagsSelect, b2 as PlaylistsSelect, X as Post, Y as PostAuthor, aY as PostAuthorsSelect, aZ as PostCategoriesSelect, Z as PostCategory, _ as PostTag, a_ as PostTagsSelect, aX as PostsSelect, aB as ProductCategoriesSelect, w as ProductCategory, D as ProductCollection, aD as ProductCollectionsSelect, v as ProductOption, aA as ProductOptionsSelect, x as ProductTag, aC as ProductTagsSelect, u as ProductVariant, az as ProductVariantsSelect, ay as ProductsSelect, M as ReturnProduct, aN as ReturnProductsSelect, aM as ReturnsSelect, aQ as ShippingPoliciesSelect, z as ShippingPolicy, p as Subscription, av as SubscriptionsSelect, S as SupportedTimezones, l as SystemMedia, ap as SystemMediaSelect, i as Tenant, r as TenantLogo, ax as TenantLogosSelect, at as TenantMetadataSelect, n as TenantMetadatum, as as TenantsSelect, aI as TransactionsSelect, h as User, U as UserAuthOperations, am as UsersSelect, V as Video, bi as VideoCategoriesSelect, s as VideoCategory, t as VideoTag, bj as VideoTagsSelect, bh as VideosSelect } from './payload-types-C-keX5go.cjs';
3
3
  import { Sort, Where } from 'payload';
4
4
  import * as _tanstack_react_query from '@tanstack/react-query';
5
- import { QueryClient } from '@tanstack/react-query';
6
- import { P as PublicCollection } from './const-C3GC2SxR.cjs';
7
- export { a as COLLECTIONS, C as Collection } from './const-C3GC2SxR.cjs';
5
+ import { QueryClient, InfiniteData } from '@tanstack/react-query';
8
6
  import { Metadata } from 'next';
9
- import { C as CollectionType } from './webhook-B8BfJ_Ka.cjs';
10
- export { a as WebhookEvent, b as WebhookHandler, W as WebhookOperation, c as WebhookOptions, d as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-B8BfJ_Ka.cjs';
7
+ import { P as PublicCollection } from './const-CDpRB7XK.cjs';
8
+ export { a as COLLECTIONS, C as Collection } from './const-CDpRB7XK.cjs';
9
+ import { C as CollectionType } from './webhook-Dqe2_xMx.cjs';
10
+ export { a as WebhookEvent, b as WebhookHandler, W as WebhookOperation, c as WebhookOptions, d as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-Dqe2_xMx.cjs';
11
11
  export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-DupPIYx-.cjs';
12
12
  export { b as IMAGE_SIZES, I as ImageData, a as ImagePalette, f as ImagePlaceholderOptions, d as getImageLqip, e as getImagePalette, h as getImagePlaceholderStyle, c as getImageSrcSet, g as getImageUrl } from './image-TT8lTsk5.cjs';
13
13
  export { e as VideoGifOptions, V as VideoThumbnailOptions, a as getVideoGif, c as getVideoMp4Url, d as getVideoStoryboard, b as getVideoStreamUrl, g as getVideoThumbnail } from './video-DbLL8yuc.cjs';
@@ -19,11 +19,11 @@ export { JwtPayload, createApiKey, createServerToken, decodeServerToken, parseAp
19
19
  * 빌드 시 버전에 따라 기본값 결정: dev 빌드 → api-dev, 정식 → api.01.software
20
20
  */
21
21
  declare function resolveApiUrl(): string;
22
- interface ClientBrowserConfig {
22
+ interface ClientConfig {
23
23
  clientKey: string;
24
24
  /**
25
25
  * Customer authentication options.
26
- * Used to initialize CustomerAuth on BrowserClient.
26
+ * Used to initialize CustomerAuth on Client.
27
27
  */
28
28
  customer?: {
29
29
  /**
@@ -42,7 +42,7 @@ interface ClientBrowserConfig {
42
42
  onTokenChange?: (token: string | null) => void;
43
43
  };
44
44
  }
45
- interface ClientServerConfig extends ClientBrowserConfig {
45
+ interface ClientServerConfig extends ClientConfig {
46
46
  secretKey: string;
47
47
  }
48
48
  interface ClientMetadata {
@@ -97,9 +97,6 @@ interface ApiQueryOptions {
97
97
  depth?: number;
98
98
  select?: Record<string, boolean>;
99
99
  }
100
- interface ApiQueryReactOptions {
101
- keepPreviousData?: boolean;
102
- }
103
100
  interface DebugConfig {
104
101
  logRequests?: boolean;
105
102
  logResponses?: boolean;
@@ -451,7 +448,7 @@ declare class CollectionClient extends HttpClient {
451
448
 
452
449
  /**
453
450
  * Read-only subset of CollectionQueryBuilder.
454
- * BrowserClient.from() returns this type to prevent write operations at compile time.
451
+ * Client.from() returns this type to prevent write operations at compile time.
455
452
  */
456
453
  type ReadOnlyQueryBuilder<T extends PublicCollection> = Pick<CollectionQueryBuilder<T>, 'find' | 'findById' | 'count' | 'findMetadata' | 'findMetadataById'>;
457
454
  declare class CollectionQueryBuilder<T extends PublicCollection> {
@@ -585,7 +582,7 @@ interface CustomerAuthOptions {
585
582
  }
586
583
 
587
584
  /**
588
- * Customer authentication client for BrowserClient.
585
+ * Customer authentication client.
589
586
  *
590
587
  * Manages customer registration, login, logout, and token lifecycle.
591
588
  * All requests include X-Client-Key for tenant resolution.
@@ -755,16 +752,31 @@ interface CollectionInfiniteQueryParams<T extends PublicCollection> {
755
752
  options?: Omit<ApiQueryOptions, 'page'>;
756
753
  pageSize?: number;
757
754
  }
758
- interface QueryOptions {
755
+ interface QueryOptions<TQueryFnData = unknown, TData = TQueryFnData> {
756
+ enabled?: boolean;
757
+ staleTime?: number;
758
+ gcTime?: number;
759
+ refetchOnWindowFocus?: boolean;
760
+ refetchOnMount?: boolean | 'always';
761
+ refetchInterval?: number | false;
762
+ retry?: boolean | number;
763
+ select?: (data: TQueryFnData) => TData;
764
+ placeholderData?: TQueryFnData | ((previousData: TData | undefined) => TQueryFnData | undefined);
765
+ initialData?: TQueryFnData | (() => TQueryFnData);
766
+ initialDataUpdatedAt?: number | (() => number | undefined);
767
+ }
768
+ type SuspenseQueryOptions<TQueryFnData = unknown, TData = TQueryFnData> = Omit<QueryOptions<TQueryFnData, TData>, 'enabled' | 'placeholderData'>;
769
+ interface InfiniteQueryOptions<TQueryFnData = unknown, TData = InfiniteData<TQueryFnData>> {
759
770
  enabled?: boolean;
760
771
  staleTime?: number;
761
772
  gcTime?: number;
762
773
  refetchOnWindowFocus?: boolean;
763
- refetchOnMount?: boolean;
774
+ refetchOnMount?: boolean | 'always';
764
775
  refetchInterval?: number | false;
765
776
  retry?: boolean | number;
777
+ select?: (data: InfiniteData<TQueryFnData>) => TData;
766
778
  }
767
- type SuspenseQueryOptions = Omit<QueryOptions, 'enabled'>;
779
+ type SuspenseInfiniteQueryOptions<TQueryFnData = unknown, TData = InfiniteData<TQueryFnData>> = Omit<InfiniteQueryOptions<TQueryFnData, TData>, 'enabled'>;
768
780
  interface MutationCallbacks$1<TData> {
769
781
  onSuccess?: (data: TData) => void;
770
782
  onError?: (error: SDKError) => void;
@@ -774,12 +786,12 @@ declare class CollectionHooks {
774
786
  protected queryClient: QueryClient;
775
787
  protected collectionClient: CollectionClient;
776
788
  constructor(queryClient: QueryClient, collectionClient: CollectionClient);
777
- useQuery<T extends PublicCollection>(params: CollectionQueryParams<T>, options?: QueryOptions): _tanstack_react_query.UseQueryResult<CollectionType<T>[], Error>;
778
- useSuspenseQuery<T extends PublicCollection>(params: CollectionQueryParams<T>, options?: SuspenseQueryOptions): _tanstack_react_query.UseSuspenseQueryResult<CollectionType<T>[], Error>;
779
- useQueryById<T extends PublicCollection>(params: CollectionDetailQueryParams<T>, options?: QueryOptions): _tanstack_react_query.UseQueryResult<_tanstack_react_query.NoInfer<CollectionType<T>>, Error>;
780
- useSuspenseQueryById<T extends PublicCollection>(params: CollectionDetailQueryParams<T>, options?: SuspenseQueryOptions): _tanstack_react_query.UseSuspenseQueryResult<CollectionType<T>, Error>;
781
- useInfiniteQuery<T extends PublicCollection>(params: CollectionInfiniteQueryParams<T>, options?: QueryOptions): _tanstack_react_query.UseInfiniteQueryResult<_tanstack_react_query.InfiniteData<PayloadFindResponse<CollectionType<T>>, unknown>, Error>;
782
- useSuspenseInfiniteQuery<T extends PublicCollection>(params: CollectionInfiniteQueryParams<T>, options?: SuspenseQueryOptions): _tanstack_react_query.UseSuspenseInfiniteQueryResult<_tanstack_react_query.InfiniteData<PayloadFindResponse<CollectionType<T>>, unknown>, Error>;
789
+ useQuery<T extends PublicCollection, TData = PayloadFindResponse<CollectionType<T>>>(params: CollectionQueryParams<T>, options?: QueryOptions<PayloadFindResponse<CollectionType<T>>, TData>): _tanstack_react_query.UseQueryResult<_tanstack_react_query.NoInfer<TData>, Error>;
790
+ useSuspenseQuery<T extends PublicCollection, TData = PayloadFindResponse<CollectionType<T>>>(params: CollectionQueryParams<T>, options?: SuspenseQueryOptions<PayloadFindResponse<CollectionType<T>>, TData>): _tanstack_react_query.UseSuspenseQueryResult<TData, Error>;
791
+ useQueryById<T extends PublicCollection, TData = CollectionType<T>>(params: CollectionDetailQueryParams<T>, options?: QueryOptions<CollectionType<T>, TData>): _tanstack_react_query.UseQueryResult<_tanstack_react_query.NoInfer<TData>, Error>;
792
+ useSuspenseQueryById<T extends PublicCollection, TData = CollectionType<T>>(params: CollectionDetailQueryParams<T>, options?: SuspenseQueryOptions<CollectionType<T>, TData>): _tanstack_react_query.UseSuspenseQueryResult<TData, Error>;
793
+ useInfiniteQuery<T extends PublicCollection, TData = InfiniteData<PayloadFindResponse<CollectionType<T>>>>(params: CollectionInfiniteQueryParams<T>, options?: InfiniteQueryOptions<PayloadFindResponse<CollectionType<T>>, TData>): _tanstack_react_query.UseInfiniteQueryResult<TData, Error>;
794
+ useSuspenseInfiniteQuery<T extends PublicCollection, TData = InfiniteData<PayloadFindResponse<CollectionType<T>>>>(params: CollectionInfiniteQueryParams<T>, options?: SuspenseInfiniteQueryOptions<PayloadFindResponse<CollectionType<T>>, TData>): _tanstack_react_query.UseSuspenseInfiniteQueryResult<TData, Error>;
783
795
  prefetchQuery<T extends PublicCollection>(params: CollectionQueryParams<T>, options?: {
784
796
  staleTime?: number;
785
797
  }): Promise<void>;
@@ -809,9 +821,9 @@ declare class CollectionHooks {
809
821
  collection: T;
810
822
  }, options?: MutationCallbacks$1<CollectionType<T>>): _tanstack_react_query.UseMutationResult<CollectionType<T>, SDKError, string, unknown>;
811
823
  invalidateQueries<T extends PublicCollection>(collection: T, type?: 'list' | 'detail' | 'infinite'): Promise<void>;
812
- getQueryData<T extends PublicCollection>(collection: T, type: 'list', options?: ApiQueryOptions): CollectionType<T>[] | undefined;
824
+ getQueryData<T extends PublicCollection>(collection: T, type: 'list', options?: ApiQueryOptions): PayloadFindResponse<CollectionType<T>> | undefined;
813
825
  getQueryData<T extends PublicCollection>(collection: T, type: 'detail', id: string, options?: ApiQueryOptions): CollectionType<T> | null | undefined;
814
- setQueryData<T extends PublicCollection>(collection: T, type: 'list', data: CollectionType<T>[], options?: ApiQueryOptions): void;
826
+ setQueryData<T extends PublicCollection>(collection: T, type: 'list', data: PayloadFindResponse<CollectionType<T>>, options?: ApiQueryOptions): void;
815
827
  setQueryData<T extends PublicCollection>(collection: T, type: 'detail', id: string, data: CollectionType<T> | null, options?: ApiQueryOptions): void;
816
828
  }
817
829
 
@@ -831,7 +843,7 @@ declare class CustomerHooks {
831
843
  staleTime?: number;
832
844
  gcTime?: number;
833
845
  refetchOnWindowFocus?: boolean;
834
- refetchOnMount?: boolean;
846
+ refetchOnMount?: boolean | 'always';
835
847
  refetchInterval?: number | false;
836
848
  retry?: boolean | number;
837
849
  }): _tanstack_react_query.UseQueryResult<CustomerProfile | null, Error>;
@@ -894,21 +906,26 @@ declare class QueryHooks extends CollectionHooks {
894
906
  setCustomerData: CustomerHooks['setCustomerData'];
895
907
  }
896
908
 
897
- declare class BrowserClient {
909
+ declare class Client {
898
910
  cart: CartApi;
899
911
  query: ReadOnlyQueryHooks;
900
912
  collections: CollectionClient;
901
913
  queryClient: QueryClient;
902
914
  customer: CustomerAuth;
903
915
  protected state: ClientState;
904
- protected config: ClientBrowserConfig;
916
+ protected config: ClientConfig;
905
917
  protected baseUrl: string;
906
- constructor(options: ClientBrowserConfig);
918
+ constructor(options: ClientConfig);
907
919
  from<T extends PublicCollection>(collection: T): ReadOnlyQueryBuilder<T>;
908
920
  getState(): ClientState;
909
- getConfig(): ClientBrowserConfig;
921
+ getConfig(): ClientConfig;
910
922
  }
911
- declare function createBrowserClient(options: ClientBrowserConfig): BrowserClient;
923
+ /**
924
+ * Create an SDK client. Works in both browser and server environments.
925
+ * Read-only collection queries + customer auth (cart, login, profile).
926
+ * Use `createServerClient()` when you need full CRUD with secretKey.
927
+ */
928
+ declare function createClient(options: ClientConfig): Client;
912
929
 
913
930
  declare class ServerClient {
914
931
  api: OrderApi;
@@ -923,8 +940,12 @@ declare class ServerClient {
923
940
  constructor(options: ClientServerConfig);
924
941
  from<T extends PublicCollection>(collection: T): CollectionQueryBuilder<T>;
925
942
  getState(): ClientState;
926
- getConfig(): ClientBrowserConfig;
943
+ getConfig(): ClientConfig;
927
944
  }
945
+ /**
946
+ * Create a server-only client with full read/write access. Requires secretKey.
947
+ * For read-only usage, prefer `createClient()` (no secretKey needed).
948
+ */
928
949
  declare function createServerClient(options: ClientServerConfig): ServerClient;
929
950
 
930
951
  declare function getQueryClient(): QueryClient;
@@ -947,4 +968,4 @@ declare const formatOrderName: (items: OrderItem[]) => string;
947
968
  */
948
969
  declare const resolveRelation: <T>(ref: T | string | number | null | undefined) => T | null;
949
970
 
950
- export { type AddItemParams, ApiError, type ApiQueryOptions, type ApiQueryReactOptions, type ApplyDiscountParams, BaseApi, BrowserClient, BrowserClient as BrowserClientType, type CalculateShippingParams, type CalculateShippingResult, Cart, CartApi, type CartApiOptions, CartItem, type CheckoutParams, type ClearCartParams, type ClientBrowserConfig, type ClientMetadata, type ClientServerConfig, type ClientState, CollectionClient, type CollectionDetailQueryParams, CollectionHooks, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, ConfigError, type CreateExchangeParams, type CreateFulfillmentParams, type CreateOrderParams, type CreateReturnParams, CustomerAuth, type CustomerAuthOptions, type CustomerAuthResponse, CustomerHooks, type CustomerLoginData, type CustomerProfile, type CustomerRefreshResponse, type CustomerRegisterData, type CustomerRegisterResponse, type CustomerSnapshot, type DebugConfig, type DeepPartial, Exchange, type ExtractArrayType, Fulfillment, type GenerateMetadataOptions, type GetOrderParams, GoneError, NetworkError, Order, OrderApi, type OrderApiOptions, OrderProduct, type PaginationMeta, type PayloadFindResponse, type PayloadMutationResponse, Product, ProductApi, type ProductApiOptions, PublicCollection, QueryHooks, type ReadOnlyQueryBuilder, type ReadOnlyQueryHooks, type RemoveDiscountParams, type RemoveItemParams, type RequestOptions, type RetryConfig, Return, type ReturnProductItem, type ReturnReason, type ReturnWithRefundParams, SDKError, type ServerApiOptions, ServerClient, ServerClient as ServerClientType, ServiceUnavailableError, type StockCheckParams, type StockCheckResponse, type StockCheckResult, TimeoutError, Transaction, type UpdateExchangeParams, type UpdateFulfillmentParams, type UpdateItemParams, type UpdateOrderParams, type UpdateProfileData, type UpdateReturnParams, type UpdateTransactionParams, UsageLimitError, type ValidateDiscountParams, type ValidateDiscountResult, ValidationError, collectionKeys, createBrowserClient, createServerClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, isApiError, isConfigError, isGoneError, isNetworkError, isSDKError, isServiceUnavailableError, isTimeoutError, isUsageLimitError, isValidationError, resolveApiUrl, resolveRelation };
971
+ export { type AddItemParams, ApiError, type ApiQueryOptions, type ApplyDiscountParams, BaseApi, type CalculateShippingParams, type CalculateShippingResult, Cart, CartApi, type CartApiOptions, CartItem, type CheckoutParams, type ClearCartParams, Client, type ClientConfig, type ClientMetadata, type ClientServerConfig, type ClientState, Client as ClientType, CollectionClient, type CollectionDetailQueryParams, CollectionHooks, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, ConfigError, type CreateExchangeParams, type CreateFulfillmentParams, type CreateOrderParams, type CreateReturnParams, CustomerAuth, type CustomerAuthOptions, type CustomerAuthResponse, CustomerHooks, type CustomerLoginData, type CustomerProfile, type CustomerRefreshResponse, type CustomerRegisterData, type CustomerRegisterResponse, type CustomerSnapshot, type DebugConfig, type DeepPartial, Exchange, type ExtractArrayType, Fulfillment, type GenerateMetadataOptions, type GetOrderParams, GoneError, type InfiniteQueryOptions, NetworkError, Order, OrderApi, type OrderApiOptions, OrderProduct, type PaginationMeta, type PayloadFindResponse, type PayloadMutationResponse, Product, ProductApi, type ProductApiOptions, PublicCollection, QueryHooks, type QueryOptions, type ReadOnlyQueryBuilder, type ReadOnlyQueryHooks, type RemoveDiscountParams, type RemoveItemParams, type RequestOptions, type RetryConfig, Return, type ReturnProductItem, type ReturnReason, type ReturnWithRefundParams, SDKError, type ServerApiOptions, ServerClient, ServerClient as ServerClientType, ServiceUnavailableError, type StockCheckParams, type StockCheckResponse, type StockCheckResult, type SuspenseInfiniteQueryOptions, type SuspenseQueryOptions, TimeoutError, Transaction, type UpdateExchangeParams, type UpdateFulfillmentParams, type UpdateItemParams, type UpdateOrderParams, type UpdateProfileData, type UpdateReturnParams, type UpdateTransactionParams, UsageLimitError, type ValidateDiscountParams, type ValidateDiscountResult, ValidationError, collectionKeys, createClient, createServerClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, isApiError, isConfigError, isGoneError, isNetworkError, isSDKError, isServiceUnavailableError, isTimeoutError, isUsageLimitError, isValidationError, resolveApiUrl, resolveRelation };
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, E as Exchange, c as Cart, d as CartItem, P as Product } from './payload-types-DPka7hJu.js';
2
- export { o as ApiUsage, as as ApiUsageSelect, A as Audience, ao as AudiencesSelect, bo as Auth, q as BillingHistory, au as BillingHistorySelect, y as Brand, B as BrandLogo, aD as BrandLogosSelect, aC as BrandsSelect, aT as CartItemsSelect, aS as CartsSelect, g as CodeBlock, bn as CollectionsWidget, C as Config, G as Customer, J as CustomerAddress, aQ as CustomerAddressesSelect, e as CustomerAuthOperations, H as CustomerGroup, aR as CustomerGroupsSelect, aP as CustomersSelect, W as Discount, aU as DiscountsSelect, $ as Document, a_ as DocumentCategoriesSelect, a1 as DocumentCategory, a0 as DocumentType, a$ as DocumentTypesSelect, aZ as DocumentsSelect, m as EmailLog, ap as EmailLogsSelect, N as ExchangeProduct, aN as ExchangeProductsSelect, aM as ExchangesSelect, j as FieldConfig, al as FieldConfigsSelect, aa as Flow, bb as FlowCategoriesSelect, ab as FlowCategory, ae as FlowEdgeType, ba as FlowEdgeTypesSelect, ad as FlowNodeType, b9 as FlowNodeTypesSelect, ac as FlowTag, bc as FlowTagsSelect, b8 as FlowsSelect, F as Form, af as FormSubmission, bi as FormSubmissionsSelect, bh as FormsSelect, K as FulfillmentItem, aJ as FulfillmentItemsSelect, aI as FulfillmentsSelect, b4 as GalleriesSelect, a6 as Gallery, b5 as GalleryCategoriesSelect, a7 as GalleryCategory, a9 as GalleryItem, b7 as GalleryItemsSelect, a8 as GalleryTag, b6 as GalleryTagsSelect, I as IframeBlock, k as Image, am as ImagesSelect, L as LiveStream, bg as LiveStreamsSelect, a5 as Music, b3 as MusicsSelect, aF as OrderProductsSelect, Q as OrderStatusLog, aH as OrderStatusLogsSelect, aE as OrdersSelect, ag as PayloadKv, bj as PayloadKvSelect, ah as PayloadLockedDocument, bk as PayloadLockedDocumentsSelect, aj as PayloadMigration, bm as PayloadMigrationsSelect, ai as PayloadPreference, bl as PayloadPreferencesSelect, f as PlayerBlock, a2 as Playlist, b1 as PlaylistCategoriesSelect, a3 as PlaylistCategory, a4 as PlaylistTag, b2 as PlaylistTagsSelect, b0 as PlaylistsSelect, X as Post, Y as PostAuthor, aW as PostAuthorsSelect, aX as PostCategoriesSelect, Z as PostCategory, _ as PostTag, aY as PostTagsSelect, aV as PostsSelect, az as ProductCategoriesSelect, w as ProductCategory, D as ProductCollection, aB as ProductCollectionsSelect, v as ProductOption, ay as ProductOptionsSelect, x as ProductTag, aA as ProductTagsSelect, u as ProductVariant, ax as ProductVariantsSelect, aw as ProductsSelect, M as ReturnProduct, aL as ReturnProductsSelect, aK as ReturnsSelect, aO as ShippingPoliciesSelect, z as ShippingPolicy, p as Subscription, at as SubscriptionsSelect, S as SupportedTimezones, l as SystemMedia, an as SystemMediaSelect, i as Tenant, r as TenantLogo, av as TenantLogosSelect, ar as TenantMetadataSelect, n as TenantMetadatum, aq as TenantsSelect, aG as TransactionsSelect, h as User, U as UserAuthOperations, ak as UsersSelect, V as Video, be as VideoCategoriesSelect, s as VideoCategory, t as VideoTag, bf as VideoTagsSelect, bd as VideosSelect } from './payload-types-DPka7hJu.js';
1
+ import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, E as Exchange, c as Cart, d as CartItem, P as Product } from './payload-types-C-keX5go.js';
2
+ export { o as ApiUsage, au as ApiUsageSelect, A as Audience, aq as AudiencesSelect, bs as Auth, q as BillingHistory, aw as BillingHistorySelect, y as Brand, B as BrandLogo, aF as BrandLogosSelect, aE as BrandsSelect, aV as CartItemsSelect, aU as CartsSelect, g as CodeBlock, br as CollectionsWidget, C as Config, G as Customer, J as CustomerAddress, aS as CustomerAddressesSelect, e as CustomerAuthOperations, H as CustomerGroup, aT as CustomerGroupsSelect, aR as CustomersSelect, W as Discount, aW as DiscountsSelect, $ as Document, b0 as DocumentCategoriesSelect, a1 as DocumentCategory, a0 as DocumentType, b1 as DocumentTypesSelect, a$ as DocumentsSelect, m as EmailLog, ar as EmailLogsSelect, N as ExchangeProduct, aP as ExchangeProductsSelect, aO as ExchangesSelect, j as FieldConfig, an as FieldConfigsSelect, ac as Flow, bf as FlowCategoriesSelect, ad as FlowCategory, ag as FlowEdgeType, be as FlowEdgeTypesSelect, af as FlowNodeType, bd as FlowNodeTypesSelect, ae as FlowTag, bg as FlowTagsSelect, bc as FlowsSelect, F as Form, ah as FormSubmission, bm as FormSubmissionsSelect, bl as FormsSelect, K as FulfillmentItem, aL as FulfillmentItemsSelect, aK as FulfillmentsSelect, b8 as GalleriesSelect, a8 as Gallery, b9 as GalleryCategoriesSelect, a9 as GalleryCategory, ab as GalleryItem, bb as GalleryItemsSelect, aa as GalleryTag, ba as GalleryTagsSelect, I as IframeBlock, k as Image, ao as ImagesSelect, L as LiveStream, bk as LiveStreamsSelect, a5 as Music, b6 as MusicCategoriesSelect, a6 as MusicCategory, a7 as MusicTag, b7 as MusicTagsSelect, b5 as MusicsSelect, aH as OrderProductsSelect, Q as OrderStatusLog, aJ as OrderStatusLogsSelect, aG as OrdersSelect, ai as PayloadKv, bn as PayloadKvSelect, aj as PayloadLockedDocument, bo as PayloadLockedDocumentsSelect, al as PayloadMigration, bq as PayloadMigrationsSelect, ak as PayloadPreference, bp as PayloadPreferencesSelect, f as PlayerBlock, a2 as Playlist, b3 as PlaylistCategoriesSelect, a3 as PlaylistCategory, a4 as PlaylistTag, b4 as PlaylistTagsSelect, b2 as PlaylistsSelect, X as Post, Y as PostAuthor, aY as PostAuthorsSelect, aZ as PostCategoriesSelect, Z as PostCategory, _ as PostTag, a_ as PostTagsSelect, aX as PostsSelect, aB as ProductCategoriesSelect, w as ProductCategory, D as ProductCollection, aD as ProductCollectionsSelect, v as ProductOption, aA as ProductOptionsSelect, x as ProductTag, aC as ProductTagsSelect, u as ProductVariant, az as ProductVariantsSelect, ay as ProductsSelect, M as ReturnProduct, aN as ReturnProductsSelect, aM as ReturnsSelect, aQ as ShippingPoliciesSelect, z as ShippingPolicy, p as Subscription, av as SubscriptionsSelect, S as SupportedTimezones, l as SystemMedia, ap as SystemMediaSelect, i as Tenant, r as TenantLogo, ax as TenantLogosSelect, at as TenantMetadataSelect, n as TenantMetadatum, as as TenantsSelect, aI as TransactionsSelect, h as User, U as UserAuthOperations, am as UsersSelect, V as Video, bi as VideoCategoriesSelect, s as VideoCategory, t as VideoTag, bj as VideoTagsSelect, bh as VideosSelect } from './payload-types-C-keX5go.js';
3
3
  import { Sort, Where } from 'payload';
4
4
  import * as _tanstack_react_query from '@tanstack/react-query';
5
- import { QueryClient } from '@tanstack/react-query';
6
- import { P as PublicCollection } from './const-ikSyKVND.js';
7
- export { a as COLLECTIONS, C as Collection } from './const-ikSyKVND.js';
5
+ import { QueryClient, InfiniteData } from '@tanstack/react-query';
8
6
  import { Metadata } from 'next';
9
- import { C as CollectionType } from './webhook-CvNTdBWV.js';
10
- export { a as WebhookEvent, b as WebhookHandler, W as WebhookOperation, c as WebhookOptions, d as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-CvNTdBWV.js';
7
+ import { P as PublicCollection } from './const-DQIDvvB-.js';
8
+ export { a as COLLECTIONS, C as Collection } from './const-DQIDvvB-.js';
9
+ import { C as CollectionType } from './webhook-DseJdRFT.js';
10
+ export { a as WebhookEvent, b as WebhookHandler, W as WebhookOperation, c as WebhookOptions, d as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-DseJdRFT.js';
11
11
  export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-DupPIYx-.js';
12
12
  export { b as IMAGE_SIZES, I as ImageData, a as ImagePalette, f as ImagePlaceholderOptions, d as getImageLqip, e as getImagePalette, h as getImagePlaceholderStyle, c as getImageSrcSet, g as getImageUrl } from './image-TT8lTsk5.js';
13
13
  export { e as VideoGifOptions, V as VideoThumbnailOptions, a as getVideoGif, c as getVideoMp4Url, d as getVideoStoryboard, b as getVideoStreamUrl, g as getVideoThumbnail } from './video-DbLL8yuc.js';
@@ -19,11 +19,11 @@ export { JwtPayload, createApiKey, createServerToken, decodeServerToken, parseAp
19
19
  * 빌드 시 버전에 따라 기본값 결정: dev 빌드 → api-dev, 정식 → api.01.software
20
20
  */
21
21
  declare function resolveApiUrl(): string;
22
- interface ClientBrowserConfig {
22
+ interface ClientConfig {
23
23
  clientKey: string;
24
24
  /**
25
25
  * Customer authentication options.
26
- * Used to initialize CustomerAuth on BrowserClient.
26
+ * Used to initialize CustomerAuth on Client.
27
27
  */
28
28
  customer?: {
29
29
  /**
@@ -42,7 +42,7 @@ interface ClientBrowserConfig {
42
42
  onTokenChange?: (token: string | null) => void;
43
43
  };
44
44
  }
45
- interface ClientServerConfig extends ClientBrowserConfig {
45
+ interface ClientServerConfig extends ClientConfig {
46
46
  secretKey: string;
47
47
  }
48
48
  interface ClientMetadata {
@@ -97,9 +97,6 @@ interface ApiQueryOptions {
97
97
  depth?: number;
98
98
  select?: Record<string, boolean>;
99
99
  }
100
- interface ApiQueryReactOptions {
101
- keepPreviousData?: boolean;
102
- }
103
100
  interface DebugConfig {
104
101
  logRequests?: boolean;
105
102
  logResponses?: boolean;
@@ -451,7 +448,7 @@ declare class CollectionClient extends HttpClient {
451
448
 
452
449
  /**
453
450
  * Read-only subset of CollectionQueryBuilder.
454
- * BrowserClient.from() returns this type to prevent write operations at compile time.
451
+ * Client.from() returns this type to prevent write operations at compile time.
455
452
  */
456
453
  type ReadOnlyQueryBuilder<T extends PublicCollection> = Pick<CollectionQueryBuilder<T>, 'find' | 'findById' | 'count' | 'findMetadata' | 'findMetadataById'>;
457
454
  declare class CollectionQueryBuilder<T extends PublicCollection> {
@@ -585,7 +582,7 @@ interface CustomerAuthOptions {
585
582
  }
586
583
 
587
584
  /**
588
- * Customer authentication client for BrowserClient.
585
+ * Customer authentication client.
589
586
  *
590
587
  * Manages customer registration, login, logout, and token lifecycle.
591
588
  * All requests include X-Client-Key for tenant resolution.
@@ -755,16 +752,31 @@ interface CollectionInfiniteQueryParams<T extends PublicCollection> {
755
752
  options?: Omit<ApiQueryOptions, 'page'>;
756
753
  pageSize?: number;
757
754
  }
758
- interface QueryOptions {
755
+ interface QueryOptions<TQueryFnData = unknown, TData = TQueryFnData> {
756
+ enabled?: boolean;
757
+ staleTime?: number;
758
+ gcTime?: number;
759
+ refetchOnWindowFocus?: boolean;
760
+ refetchOnMount?: boolean | 'always';
761
+ refetchInterval?: number | false;
762
+ retry?: boolean | number;
763
+ select?: (data: TQueryFnData) => TData;
764
+ placeholderData?: TQueryFnData | ((previousData: TData | undefined) => TQueryFnData | undefined);
765
+ initialData?: TQueryFnData | (() => TQueryFnData);
766
+ initialDataUpdatedAt?: number | (() => number | undefined);
767
+ }
768
+ type SuspenseQueryOptions<TQueryFnData = unknown, TData = TQueryFnData> = Omit<QueryOptions<TQueryFnData, TData>, 'enabled' | 'placeholderData'>;
769
+ interface InfiniteQueryOptions<TQueryFnData = unknown, TData = InfiniteData<TQueryFnData>> {
759
770
  enabled?: boolean;
760
771
  staleTime?: number;
761
772
  gcTime?: number;
762
773
  refetchOnWindowFocus?: boolean;
763
- refetchOnMount?: boolean;
774
+ refetchOnMount?: boolean | 'always';
764
775
  refetchInterval?: number | false;
765
776
  retry?: boolean | number;
777
+ select?: (data: InfiniteData<TQueryFnData>) => TData;
766
778
  }
767
- type SuspenseQueryOptions = Omit<QueryOptions, 'enabled'>;
779
+ type SuspenseInfiniteQueryOptions<TQueryFnData = unknown, TData = InfiniteData<TQueryFnData>> = Omit<InfiniteQueryOptions<TQueryFnData, TData>, 'enabled'>;
768
780
  interface MutationCallbacks$1<TData> {
769
781
  onSuccess?: (data: TData) => void;
770
782
  onError?: (error: SDKError) => void;
@@ -774,12 +786,12 @@ declare class CollectionHooks {
774
786
  protected queryClient: QueryClient;
775
787
  protected collectionClient: CollectionClient;
776
788
  constructor(queryClient: QueryClient, collectionClient: CollectionClient);
777
- useQuery<T extends PublicCollection>(params: CollectionQueryParams<T>, options?: QueryOptions): _tanstack_react_query.UseQueryResult<CollectionType<T>[], Error>;
778
- useSuspenseQuery<T extends PublicCollection>(params: CollectionQueryParams<T>, options?: SuspenseQueryOptions): _tanstack_react_query.UseSuspenseQueryResult<CollectionType<T>[], Error>;
779
- useQueryById<T extends PublicCollection>(params: CollectionDetailQueryParams<T>, options?: QueryOptions): _tanstack_react_query.UseQueryResult<_tanstack_react_query.NoInfer<CollectionType<T>>, Error>;
780
- useSuspenseQueryById<T extends PublicCollection>(params: CollectionDetailQueryParams<T>, options?: SuspenseQueryOptions): _tanstack_react_query.UseSuspenseQueryResult<CollectionType<T>, Error>;
781
- useInfiniteQuery<T extends PublicCollection>(params: CollectionInfiniteQueryParams<T>, options?: QueryOptions): _tanstack_react_query.UseInfiniteQueryResult<_tanstack_react_query.InfiniteData<PayloadFindResponse<CollectionType<T>>, unknown>, Error>;
782
- useSuspenseInfiniteQuery<T extends PublicCollection>(params: CollectionInfiniteQueryParams<T>, options?: SuspenseQueryOptions): _tanstack_react_query.UseSuspenseInfiniteQueryResult<_tanstack_react_query.InfiniteData<PayloadFindResponse<CollectionType<T>>, unknown>, Error>;
789
+ useQuery<T extends PublicCollection, TData = PayloadFindResponse<CollectionType<T>>>(params: CollectionQueryParams<T>, options?: QueryOptions<PayloadFindResponse<CollectionType<T>>, TData>): _tanstack_react_query.UseQueryResult<_tanstack_react_query.NoInfer<TData>, Error>;
790
+ useSuspenseQuery<T extends PublicCollection, TData = PayloadFindResponse<CollectionType<T>>>(params: CollectionQueryParams<T>, options?: SuspenseQueryOptions<PayloadFindResponse<CollectionType<T>>, TData>): _tanstack_react_query.UseSuspenseQueryResult<TData, Error>;
791
+ useQueryById<T extends PublicCollection, TData = CollectionType<T>>(params: CollectionDetailQueryParams<T>, options?: QueryOptions<CollectionType<T>, TData>): _tanstack_react_query.UseQueryResult<_tanstack_react_query.NoInfer<TData>, Error>;
792
+ useSuspenseQueryById<T extends PublicCollection, TData = CollectionType<T>>(params: CollectionDetailQueryParams<T>, options?: SuspenseQueryOptions<CollectionType<T>, TData>): _tanstack_react_query.UseSuspenseQueryResult<TData, Error>;
793
+ useInfiniteQuery<T extends PublicCollection, TData = InfiniteData<PayloadFindResponse<CollectionType<T>>>>(params: CollectionInfiniteQueryParams<T>, options?: InfiniteQueryOptions<PayloadFindResponse<CollectionType<T>>, TData>): _tanstack_react_query.UseInfiniteQueryResult<TData, Error>;
794
+ useSuspenseInfiniteQuery<T extends PublicCollection, TData = InfiniteData<PayloadFindResponse<CollectionType<T>>>>(params: CollectionInfiniteQueryParams<T>, options?: SuspenseInfiniteQueryOptions<PayloadFindResponse<CollectionType<T>>, TData>): _tanstack_react_query.UseSuspenseInfiniteQueryResult<TData, Error>;
783
795
  prefetchQuery<T extends PublicCollection>(params: CollectionQueryParams<T>, options?: {
784
796
  staleTime?: number;
785
797
  }): Promise<void>;
@@ -809,9 +821,9 @@ declare class CollectionHooks {
809
821
  collection: T;
810
822
  }, options?: MutationCallbacks$1<CollectionType<T>>): _tanstack_react_query.UseMutationResult<CollectionType<T>, SDKError, string, unknown>;
811
823
  invalidateQueries<T extends PublicCollection>(collection: T, type?: 'list' | 'detail' | 'infinite'): Promise<void>;
812
- getQueryData<T extends PublicCollection>(collection: T, type: 'list', options?: ApiQueryOptions): CollectionType<T>[] | undefined;
824
+ getQueryData<T extends PublicCollection>(collection: T, type: 'list', options?: ApiQueryOptions): PayloadFindResponse<CollectionType<T>> | undefined;
813
825
  getQueryData<T extends PublicCollection>(collection: T, type: 'detail', id: string, options?: ApiQueryOptions): CollectionType<T> | null | undefined;
814
- setQueryData<T extends PublicCollection>(collection: T, type: 'list', data: CollectionType<T>[], options?: ApiQueryOptions): void;
826
+ setQueryData<T extends PublicCollection>(collection: T, type: 'list', data: PayloadFindResponse<CollectionType<T>>, options?: ApiQueryOptions): void;
815
827
  setQueryData<T extends PublicCollection>(collection: T, type: 'detail', id: string, data: CollectionType<T> | null, options?: ApiQueryOptions): void;
816
828
  }
817
829
 
@@ -831,7 +843,7 @@ declare class CustomerHooks {
831
843
  staleTime?: number;
832
844
  gcTime?: number;
833
845
  refetchOnWindowFocus?: boolean;
834
- refetchOnMount?: boolean;
846
+ refetchOnMount?: boolean | 'always';
835
847
  refetchInterval?: number | false;
836
848
  retry?: boolean | number;
837
849
  }): _tanstack_react_query.UseQueryResult<CustomerProfile | null, Error>;
@@ -894,21 +906,26 @@ declare class QueryHooks extends CollectionHooks {
894
906
  setCustomerData: CustomerHooks['setCustomerData'];
895
907
  }
896
908
 
897
- declare class BrowserClient {
909
+ declare class Client {
898
910
  cart: CartApi;
899
911
  query: ReadOnlyQueryHooks;
900
912
  collections: CollectionClient;
901
913
  queryClient: QueryClient;
902
914
  customer: CustomerAuth;
903
915
  protected state: ClientState;
904
- protected config: ClientBrowserConfig;
916
+ protected config: ClientConfig;
905
917
  protected baseUrl: string;
906
- constructor(options: ClientBrowserConfig);
918
+ constructor(options: ClientConfig);
907
919
  from<T extends PublicCollection>(collection: T): ReadOnlyQueryBuilder<T>;
908
920
  getState(): ClientState;
909
- getConfig(): ClientBrowserConfig;
921
+ getConfig(): ClientConfig;
910
922
  }
911
- declare function createBrowserClient(options: ClientBrowserConfig): BrowserClient;
923
+ /**
924
+ * Create an SDK client. Works in both browser and server environments.
925
+ * Read-only collection queries + customer auth (cart, login, profile).
926
+ * Use `createServerClient()` when you need full CRUD with secretKey.
927
+ */
928
+ declare function createClient(options: ClientConfig): Client;
912
929
 
913
930
  declare class ServerClient {
914
931
  api: OrderApi;
@@ -923,8 +940,12 @@ declare class ServerClient {
923
940
  constructor(options: ClientServerConfig);
924
941
  from<T extends PublicCollection>(collection: T): CollectionQueryBuilder<T>;
925
942
  getState(): ClientState;
926
- getConfig(): ClientBrowserConfig;
943
+ getConfig(): ClientConfig;
927
944
  }
945
+ /**
946
+ * Create a server-only client with full read/write access. Requires secretKey.
947
+ * For read-only usage, prefer `createClient()` (no secretKey needed).
948
+ */
928
949
  declare function createServerClient(options: ClientServerConfig): ServerClient;
929
950
 
930
951
  declare function getQueryClient(): QueryClient;
@@ -947,4 +968,4 @@ declare const formatOrderName: (items: OrderItem[]) => string;
947
968
  */
948
969
  declare const resolveRelation: <T>(ref: T | string | number | null | undefined) => T | null;
949
970
 
950
- export { type AddItemParams, ApiError, type ApiQueryOptions, type ApiQueryReactOptions, type ApplyDiscountParams, BaseApi, BrowserClient, BrowserClient as BrowserClientType, type CalculateShippingParams, type CalculateShippingResult, Cart, CartApi, type CartApiOptions, CartItem, type CheckoutParams, type ClearCartParams, type ClientBrowserConfig, type ClientMetadata, type ClientServerConfig, type ClientState, CollectionClient, type CollectionDetailQueryParams, CollectionHooks, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, ConfigError, type CreateExchangeParams, type CreateFulfillmentParams, type CreateOrderParams, type CreateReturnParams, CustomerAuth, type CustomerAuthOptions, type CustomerAuthResponse, CustomerHooks, type CustomerLoginData, type CustomerProfile, type CustomerRefreshResponse, type CustomerRegisterData, type CustomerRegisterResponse, type CustomerSnapshot, type DebugConfig, type DeepPartial, Exchange, type ExtractArrayType, Fulfillment, type GenerateMetadataOptions, type GetOrderParams, GoneError, NetworkError, Order, OrderApi, type OrderApiOptions, OrderProduct, type PaginationMeta, type PayloadFindResponse, type PayloadMutationResponse, Product, ProductApi, type ProductApiOptions, PublicCollection, QueryHooks, type ReadOnlyQueryBuilder, type ReadOnlyQueryHooks, type RemoveDiscountParams, type RemoveItemParams, type RequestOptions, type RetryConfig, Return, type ReturnProductItem, type ReturnReason, type ReturnWithRefundParams, SDKError, type ServerApiOptions, ServerClient, ServerClient as ServerClientType, ServiceUnavailableError, type StockCheckParams, type StockCheckResponse, type StockCheckResult, TimeoutError, Transaction, type UpdateExchangeParams, type UpdateFulfillmentParams, type UpdateItemParams, type UpdateOrderParams, type UpdateProfileData, type UpdateReturnParams, type UpdateTransactionParams, UsageLimitError, type ValidateDiscountParams, type ValidateDiscountResult, ValidationError, collectionKeys, createBrowserClient, createServerClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, isApiError, isConfigError, isGoneError, isNetworkError, isSDKError, isServiceUnavailableError, isTimeoutError, isUsageLimitError, isValidationError, resolveApiUrl, resolveRelation };
971
+ export { type AddItemParams, ApiError, type ApiQueryOptions, type ApplyDiscountParams, BaseApi, type CalculateShippingParams, type CalculateShippingResult, Cart, CartApi, type CartApiOptions, CartItem, type CheckoutParams, type ClearCartParams, Client, type ClientConfig, type ClientMetadata, type ClientServerConfig, type ClientState, Client as ClientType, CollectionClient, type CollectionDetailQueryParams, CollectionHooks, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, ConfigError, type CreateExchangeParams, type CreateFulfillmentParams, type CreateOrderParams, type CreateReturnParams, CustomerAuth, type CustomerAuthOptions, type CustomerAuthResponse, CustomerHooks, type CustomerLoginData, type CustomerProfile, type CustomerRefreshResponse, type CustomerRegisterData, type CustomerRegisterResponse, type CustomerSnapshot, type DebugConfig, type DeepPartial, Exchange, type ExtractArrayType, Fulfillment, type GenerateMetadataOptions, type GetOrderParams, GoneError, type InfiniteQueryOptions, NetworkError, Order, OrderApi, type OrderApiOptions, OrderProduct, type PaginationMeta, type PayloadFindResponse, type PayloadMutationResponse, Product, ProductApi, type ProductApiOptions, PublicCollection, QueryHooks, type QueryOptions, type ReadOnlyQueryBuilder, type ReadOnlyQueryHooks, type RemoveDiscountParams, type RemoveItemParams, type RequestOptions, type RetryConfig, Return, type ReturnProductItem, type ReturnReason, type ReturnWithRefundParams, SDKError, type ServerApiOptions, ServerClient, ServerClient as ServerClientType, ServiceUnavailableError, type StockCheckParams, type StockCheckResponse, type StockCheckResult, type SuspenseInfiniteQueryOptions, type SuspenseQueryOptions, TimeoutError, Transaction, type UpdateExchangeParams, type UpdateFulfillmentParams, type UpdateItemParams, type UpdateOrderParams, type UpdateProfileData, type UpdateReturnParams, type UpdateTransactionParams, UsageLimitError, type ValidateDiscountParams, type ValidateDiscountResult, ValidationError, collectionKeys, createClient, createServerClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, isApiError, isConfigError, isGoneError, isNetworkError, isSDKError, isServiceUnavailableError, isTimeoutError, isUsageLimitError, isValidationError, resolveApiUrl, resolveRelation };
package/dist/index.js CHANGED
@@ -1260,6 +1260,8 @@ var COLLECTIONS = [
1260
1260
  "playlist-categories",
1261
1261
  "playlist-tags",
1262
1262
  "musics",
1263
+ "music-categories",
1264
+ "music-tags",
1263
1265
  "galleries",
1264
1266
  "gallery-categories",
1265
1267
  "gallery-tags",
@@ -1625,14 +1627,15 @@ var CollectionHooks = class {
1625
1627
  // ===== useQuery =====
1626
1628
  useQuery(params, options) {
1627
1629
  const { collection, options: queryOptions } = params;
1628
- return useQueryOriginal(__spreadValues({
1630
+ const _a = options != null ? options : {}, { placeholderData } = _a, restOptions = __objRest(_a, ["placeholderData"]);
1631
+ return useQueryOriginal(__spreadValues(__spreadValues({
1629
1632
  queryKey: collectionKeys(collection).list(queryOptions),
1630
1633
  queryFn: () => __async(this, null, function* () {
1631
- var _a;
1632
- const response = yield this.collectionClient.from(collection).find(queryOptions);
1633
- return (_a = response.docs) != null ? _a : [];
1634
+ return yield this.collectionClient.from(collection).find(queryOptions);
1634
1635
  })
1635
- }, options));
1636
+ }, restOptions), placeholderData !== void 0 && {
1637
+ placeholderData
1638
+ }));
1636
1639
  }
1637
1640
  // ===== useSuspenseQuery =====
1638
1641
  useSuspenseQuery(params, options) {
@@ -1640,21 +1643,22 @@ var CollectionHooks = class {
1640
1643
  return useSuspenseQueryOriginal(__spreadValues({
1641
1644
  queryKey: collectionKeys(collection).list(queryOptions),
1642
1645
  queryFn: () => __async(this, null, function* () {
1643
- var _a;
1644
- const response = yield this.collectionClient.from(collection).find(queryOptions);
1645
- return (_a = response.docs) != null ? _a : [];
1646
+ return yield this.collectionClient.from(collection).find(queryOptions);
1646
1647
  })
1647
1648
  }, options));
1648
1649
  }
1649
1650
  // ===== useQueryById =====
1650
1651
  useQueryById(params, options) {
1651
1652
  const { collection, id, options: queryOptions } = params;
1652
- return useQueryOriginal(__spreadValues({
1653
+ const _a = options != null ? options : {}, { placeholderData } = _a, restOptions = __objRest(_a, ["placeholderData"]);
1654
+ return useQueryOriginal(__spreadValues(__spreadValues({
1653
1655
  queryKey: collectionKeys(collection).detail(id, queryOptions),
1654
1656
  queryFn: () => __async(this, null, function* () {
1655
1657
  return yield this.collectionClient.from(collection).findById(id, queryOptions);
1656
1658
  })
1657
- }, options));
1659
+ }, restOptions), placeholderData !== void 0 && {
1660
+ placeholderData
1661
+ }));
1658
1662
  }
1659
1663
  // ===== useSuspenseQueryById =====
1660
1664
  useSuspenseQueryById(params, options) {
@@ -1711,9 +1715,7 @@ var CollectionHooks = class {
1711
1715
  return this.queryClient.prefetchQuery(__spreadValues({
1712
1716
  queryKey: collectionKeys(collection).list(queryOptions),
1713
1717
  queryFn: () => __async(this, null, function* () {
1714
- var _a;
1715
- const response = yield this.collectionClient.from(collection).find(queryOptions);
1716
- return (_a = response.docs) != null ? _a : [];
1718
+ return yield this.collectionClient.from(collection).find(queryOptions);
1717
1719
  })
1718
1720
  }, options));
1719
1721
  });
@@ -1871,7 +1873,7 @@ var CustomerHooks = class {
1871
1873
  ensureCustomerAuth() {
1872
1874
  if (!this.customerAuth) {
1873
1875
  throw createConfigError(
1874
- "Customer hooks require BrowserClient. Use createBrowserClient() instead of createServerClient()."
1876
+ "Customer hooks require Client. Use createClient() instead of createServerClient()."
1875
1877
  );
1876
1878
  }
1877
1879
  return this.customerAuth;
@@ -1995,7 +1997,7 @@ var QueryHooks = class extends CollectionHooks {
1995
1997
  };
1996
1998
 
1997
1999
  // src/core/client/client.ts
1998
- var BrowserClient = class {
2000
+ var Client = class {
1999
2001
  constructor(options) {
2000
2002
  var _a;
2001
2003
  if (!options.clientKey) {
@@ -2052,8 +2054,8 @@ var BrowserClient = class {
2052
2054
  return __spreadValues({}, this.config);
2053
2055
  }
2054
2056
  };
2055
- function createBrowserClient(options) {
2056
- return new BrowserClient(options);
2057
+ function createClient(options) {
2058
+ return new Client(options);
2057
2059
  }
2058
2060
 
2059
2061
  // src/core/client/client.server.ts
@@ -2061,7 +2063,7 @@ var ServerClient = class {
2061
2063
  constructor(options) {
2062
2064
  if (typeof window !== "undefined") {
2063
2065
  throw createConfigError(
2064
- "ServerClient must not be used in a browser environment. This risks exposing your secretKey in client bundles. Use createBrowserClient() for browser code instead."
2066
+ "ServerClient must not be used in a browser environment. This risks exposing your secretKey in client bundles. Use createClient() for browser code instead."
2065
2067
  );
2066
2068
  }
2067
2069
  if (!options.clientKey) {
@@ -2465,9 +2467,9 @@ function getVideoMp4Url(playbackId, resolution = "high") {
2465
2467
  export {
2466
2468
  ApiError,
2467
2469
  BaseApi,
2468
- BrowserClient,
2469
2470
  COLLECTIONS,
2470
2471
  CartApi,
2472
+ Client,
2471
2473
  CollectionClient,
2472
2474
  CollectionHooks,
2473
2475
  CollectionQueryBuilder,
@@ -2489,7 +2491,7 @@ export {
2489
2491
  ValidationError,
2490
2492
  collectionKeys,
2491
2493
  createApiKey,
2492
- createBrowserClient,
2494
+ createClient,
2493
2495
  createServerClient,
2494
2496
  createServerToken,
2495
2497
  createTypedWebhookHandler,