@01.software/sdk 0.1.0-dev.260206.8918543 → 0.1.0-dev.260210.4ecca43

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/dist/index.d.cts CHANGED
@@ -510,16 +510,12 @@ interface Product {
510
510
  id: number;
511
511
  _order?: string | null;
512
512
  tenant?: (number | null) | Tenant;
513
- /**
514
- * 영문, 숫자, _(언더스코어), -(하이픈)만 사용가능합니다.
515
- */
516
- sku: string;
513
+ title: string;
517
514
  /**
518
515
  * When enabled, the slug will auto-generate from the title field on save and autosave.
519
516
  */
520
517
  generateSlug?: boolean | null;
521
- slug: string;
522
- title: string;
518
+ slug?: string | null;
523
519
  subTitle?: string | null;
524
520
  thumbnail?: (number | null) | ProductImage;
525
521
  images?: (number | ProductImage)[] | null;
@@ -556,7 +552,6 @@ interface Product {
556
552
  isSoldOut?: boolean | null;
557
553
  updatedAt: string;
558
554
  createdAt: string;
559
- _status?: ('draft' | 'published') | null;
560
555
  }
561
556
  /**
562
557
  * This interface was referenced by `Config`'s JSON-Schema
@@ -656,7 +651,7 @@ interface Brand {
656
651
  * When enabled, the slug will auto-generate from the title field on save and autosave.
657
652
  */
658
653
  generateSlug?: boolean | null;
659
- slug: string;
654
+ slug?: string | null;
660
655
  /**
661
656
  * Primary brand logo
662
657
  */
@@ -983,7 +978,7 @@ interface Post {
983
978
  * When enabled, the slug will auto-generate from the title field on save and autosave.
984
979
  */
985
980
  generateSlug?: boolean | null;
986
- slug: string;
981
+ slug?: string | null;
987
982
  categories?: (number | PostCategory)[] | null;
988
983
  tags?: (number | PostTag)[] | null;
989
984
  content?: {
@@ -1772,10 +1767,9 @@ interface TenantOgImagesSelect<T extends boolean = true> {
1772
1767
  interface ProductsSelect<T extends boolean = true> {
1773
1768
  _order?: T;
1774
1769
  tenant?: T;
1775
- sku?: T;
1770
+ title?: T;
1776
1771
  generateSlug?: T;
1777
1772
  slug?: T;
1778
- title?: T;
1779
1773
  subTitle?: T;
1780
1774
  thumbnail?: T;
1781
1775
  images?: T;
@@ -1790,7 +1784,6 @@ interface ProductsSelect<T extends boolean = true> {
1790
1784
  isSoldOut?: T;
1791
1785
  updatedAt?: T;
1792
1786
  createdAt?: T;
1793
- _status?: T;
1794
1787
  }
1795
1788
  /**
1796
1789
  * This interface was referenced by `Config`'s JSON-Schema
@@ -2643,23 +2636,36 @@ interface PaginationMeta {
2643
2636
  totalPages: number;
2644
2637
  hasNextPage: boolean;
2645
2638
  hasPrevPage: boolean;
2639
+ pagingCounter: number;
2640
+ prevPage: number | null;
2641
+ nextPage: number | null;
2646
2642
  }
2647
- interface ApiSuccessResponse<T = unknown> {
2648
- data: T;
2649
- success: true;
2650
- message?: string;
2651
- pagination?: PaginationMeta;
2643
+ /**
2644
+ * Payload CMS Find (List) Response
2645
+ * GET /api/{collection}
2646
+ */
2647
+ interface PayloadFindResponse<T = unknown> {
2648
+ docs: T[];
2649
+ totalDocs: number;
2650
+ limit: number;
2651
+ totalPages: number;
2652
+ page: number;
2653
+ pagingCounter: number;
2654
+ hasPrevPage: boolean;
2655
+ hasNextPage: boolean;
2656
+ prevPage: number | null;
2657
+ nextPage: number | null;
2652
2658
  }
2653
- interface ApiErrorResponse {
2654
- data: null;
2655
- success: false;
2656
- error: {
2657
- code: string;
2658
- message: string;
2659
- details?: unknown;
2660
- };
2659
+ /**
2660
+ * Payload CMS Create/Update Response
2661
+ * POST /api/{collection}
2662
+ * PATCH /api/{collection}/{id}
2663
+ */
2664
+ interface PayloadMutationResponse<T = unknown> {
2665
+ message: string;
2666
+ doc: T;
2667
+ errors?: unknown[];
2661
2668
  }
2662
- type ApiResponse<T = unknown> = ApiSuccessResponse<T> | ApiErrorResponse;
2663
2669
  interface ApiQueryOptions {
2664
2670
  page?: number;
2665
2671
  limit?: number;
@@ -2686,8 +2692,6 @@ type DeepPartial<T> = {
2686
2692
  [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
2687
2693
  };
2688
2694
  type ExtractArrayType<T> = T extends (infer U)[] ? U : never;
2689
- declare function isSuccessResponse<T>(response: ApiResponse<T>): response is ApiSuccessResponse<T>;
2690
- declare function isErrorResponse(response: ApiResponse<unknown>): response is ApiErrorResponse;
2691
2695
 
2692
2696
  type CollectionType<T extends Collection> = T extends keyof Config['collections'] ? Config['collections'][T] : never;
2693
2697
 
@@ -2788,32 +2792,130 @@ declare class BaseApiClient {
2788
2792
  protected baseUrl?: string;
2789
2793
  protected defaultOptions: FetchOptions;
2790
2794
  constructor(clientKey: string, secretKey?: string, baseUrl?: string);
2791
- protected get<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<ApiResponse<T>>;
2792
- protected post<T = unknown>(endpoint: string, data?: unknown, options?: FetchOptions): Promise<ApiResponse<T>>;
2793
- protected patch<T = unknown>(endpoint: string, data?: unknown, options?: FetchOptions): Promise<ApiResponse<T>>;
2794
- protected delete<T = unknown>(endpoint: string, options?: FetchOptions): Promise<ApiResponse<T>>;
2795
2795
  protected buildUrl(endpoint: string, options?: ApiQueryOptions): string;
2796
- protected parseResponse<T>(response: Response): Promise<ApiResponse<T>>;
2796
+ /**
2797
+ * Parse Payload CMS find response (list query)
2798
+ * Returns native Payload response structure
2799
+ */
2800
+ protected parseFindResponse<T>(response: Response): Promise<PayloadFindResponse<T>>;
2801
+ /**
2802
+ * Parse Payload CMS mutation response (create/update)
2803
+ * Returns native Payload response structure
2804
+ */
2805
+ protected parseMutationResponse<T>(response: Response): Promise<PayloadMutationResponse<T>>;
2806
+ /**
2807
+ * Parse Payload CMS document response (findById/delete)
2808
+ * Returns document directly without wrapper
2809
+ */
2810
+ protected parseDocumentResponse<T>(response: Response): Promise<T>;
2797
2811
  }
2798
2812
 
2799
2813
  declare class CollectionsApi extends BaseApiClient {
2800
2814
  constructor(clientKey: string, secretKey?: string, baseUrl?: string);
2801
2815
  from<T extends Collection>(collection: T): CollectionQueryBuilder<T>;
2802
- requestGet<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<ApiResponse<T>>;
2803
- requestPost<T = unknown>(endpoint: string, data?: unknown): Promise<ApiResponse<T>>;
2804
- requestPatch<T = unknown>(endpoint: string, data?: unknown): Promise<ApiResponse<T>>;
2805
- requestDelete<T = unknown>(endpoint: string): Promise<ApiResponse<T>>;
2816
+ /**
2817
+ * Find documents (list query)
2818
+ * GET /api/{collection}
2819
+ */
2820
+ requestFind<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<PayloadFindResponse<T>>;
2821
+ /**
2822
+ * Find document by ID
2823
+ * GET /api/{collection}/{id}
2824
+ */
2825
+ requestFindById<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<T>;
2826
+ /**
2827
+ * Create document
2828
+ * POST /api/{collection}
2829
+ */
2830
+ requestCreate<T = unknown>(endpoint: string, data?: unknown): Promise<PayloadMutationResponse<T>>;
2831
+ /**
2832
+ * Update document
2833
+ * PATCH /api/{collection}/{id}
2834
+ */
2835
+ requestUpdate<T = unknown>(endpoint: string, data?: unknown): Promise<PayloadMutationResponse<T>>;
2836
+ /**
2837
+ * Count documents
2838
+ * GET /api/{collection}/count
2839
+ */
2840
+ requestCount(endpoint: string, options?: ApiQueryOptions): Promise<{
2841
+ totalDocs: number;
2842
+ }>;
2843
+ /**
2844
+ * Update multiple documents (bulk update)
2845
+ * PATCH /api/{collection}
2846
+ */
2847
+ requestUpdateMany<T = unknown>(endpoint: string, data: {
2848
+ where?: unknown;
2849
+ data: unknown;
2850
+ }): Promise<PayloadFindResponse<T>>;
2851
+ /**
2852
+ * Delete document
2853
+ * DELETE /api/{collection}/{id}
2854
+ */
2855
+ requestDelete<T = unknown>(endpoint: string): Promise<T>;
2856
+ /**
2857
+ * Delete multiple documents (bulk delete)
2858
+ * DELETE /api/{collection}
2859
+ */
2860
+ requestDeleteMany<T = unknown>(endpoint: string, data: {
2861
+ where?: unknown;
2862
+ }): Promise<PayloadFindResponse<T>>;
2806
2863
  }
2807
2864
 
2808
2865
  declare class CollectionQueryBuilder<T extends Collection> {
2809
2866
  private api;
2810
2867
  private collection;
2811
2868
  constructor(api: CollectionsApi, collection: T);
2812
- find(options?: ApiQueryOptions): Promise<ApiResponse<CollectionType<T>[]>>;
2813
- findById(id: number | string, options?: ApiQueryOptions): Promise<ApiResponse<CollectionType<T>>>;
2814
- create(data: Partial<CollectionType<T>>): Promise<ApiResponse<CollectionType<T>>>;
2815
- update(id: number | string, data: Partial<CollectionType<T>>): Promise<ApiResponse<CollectionType<T>>>;
2816
- remove(id: number | string): Promise<ApiResponse<void>>;
2869
+ /**
2870
+ * Find documents (list query)
2871
+ * GET /api/{collection}
2872
+ * @returns Payload CMS find response with docs array and pagination
2873
+ */
2874
+ find(options?: ApiQueryOptions): Promise<PayloadFindResponse<CollectionType<T>>>;
2875
+ /**
2876
+ * Find document by ID
2877
+ * GET /api/{collection}/{id}
2878
+ * @returns Document object directly (no wrapper)
2879
+ */
2880
+ findById(id: number | string, options?: ApiQueryOptions): Promise<CollectionType<T>>;
2881
+ /**
2882
+ * Create a new document
2883
+ * POST /api/{collection}
2884
+ * @returns Payload CMS mutation response with doc and message
2885
+ */
2886
+ create(data: Partial<CollectionType<T>>): Promise<PayloadMutationResponse<CollectionType<T>>>;
2887
+ /**
2888
+ * Update a document by ID
2889
+ * PATCH /api/{collection}/{id}
2890
+ * @returns Payload CMS mutation response with doc and message
2891
+ */
2892
+ update(id: number | string, data: Partial<CollectionType<T>>): Promise<PayloadMutationResponse<CollectionType<T>>>;
2893
+ /**
2894
+ * Count documents
2895
+ * GET /api/{collection}/count
2896
+ * @returns Count response with totalDocs
2897
+ */
2898
+ count(options?: ApiQueryOptions): Promise<{
2899
+ totalDocs: number;
2900
+ }>;
2901
+ /**
2902
+ * Update multiple documents (bulk update)
2903
+ * PATCH /api/{collection}
2904
+ * @returns Payload CMS find response with updated docs
2905
+ */
2906
+ updateMany(where: ApiQueryOptions['where'], data: Partial<CollectionType<T>>): Promise<PayloadFindResponse<CollectionType<T>>>;
2907
+ /**
2908
+ * Delete a document by ID
2909
+ * DELETE /api/{collection}/{id}
2910
+ * @returns Deleted document object directly (no wrapper)
2911
+ */
2912
+ remove(id: number | string): Promise<CollectionType<T>>;
2913
+ /**
2914
+ * Delete multiple documents (bulk delete)
2915
+ * DELETE /api/{collection}
2916
+ * @returns Payload CMS find response with deleted docs
2917
+ */
2918
+ removeMany(where: ApiQueryOptions['where']): Promise<PayloadFindResponse<CollectionType<T>>>;
2817
2919
  }
2818
2920
 
2819
2921
  interface UnifiedQueryOptions {
@@ -2872,7 +2974,7 @@ declare class UnifiedQueryClient {
2872
2974
  refetchOnMount?: boolean;
2873
2975
  refetchInterval?: number | false;
2874
2976
  retry?: boolean | number;
2875
- }): _tanstack_react_query.UseQueryResult<_tanstack_react_query.NoInfer<CollectionType<T> | null>, Error>;
2977
+ }): _tanstack_react_query.UseQueryResult<_tanstack_react_query.NoInfer<CollectionType<T>>, Error>;
2876
2978
  useSuspenseQueryById<T extends Collection>(params: CollectionDetailQueryParams<T>, options?: {
2877
2979
  staleTime?: number;
2878
2980
  gcTime?: number;
@@ -2880,7 +2982,7 @@ declare class UnifiedQueryClient {
2880
2982
  refetchOnMount?: boolean;
2881
2983
  refetchInterval?: number | false;
2882
2984
  retry?: boolean | number;
2883
- }): _tanstack_react_query.UseSuspenseQueryResult<CollectionType<T> | null, Error>;
2985
+ }): _tanstack_react_query.UseSuspenseQueryResult<CollectionType<T>, Error>;
2884
2986
  useInfiniteQuery<T extends Collection>(params: CollectionInfiniteQueryParams<T>, options?: {
2885
2987
  enabled?: boolean;
2886
2988
  staleTime?: number;
@@ -2888,14 +2990,14 @@ declare class UnifiedQueryClient {
2888
2990
  refetchOnWindowFocus?: boolean;
2889
2991
  refetchOnMount?: boolean;
2890
2992
  retry?: boolean | number;
2891
- }): _tanstack_react_query.UseInfiniteQueryResult<_tanstack_react_query.InfiniteData<CollectionType<T>[], unknown>, Error>;
2993
+ }): _tanstack_react_query.UseInfiniteQueryResult<_tanstack_react_query.InfiniteData<PayloadFindResponse<CollectionType<T>>, unknown>, Error>;
2892
2994
  useSuspenseInfiniteQuery<T extends Collection>(params: CollectionInfiniteQueryParams<T>, options?: {
2893
2995
  staleTime?: number;
2894
2996
  gcTime?: number;
2895
2997
  refetchOnWindowFocus?: boolean;
2896
2998
  refetchOnMount?: boolean;
2897
2999
  retry?: boolean | number;
2898
- }): _tanstack_react_query.UseSuspenseInfiniteQueryResult<_tanstack_react_query.InfiniteData<CollectionType<T>[], unknown>, Error>;
3000
+ }): _tanstack_react_query.UseSuspenseInfiniteQueryResult<_tanstack_react_query.InfiniteData<PayloadFindResponse<CollectionType<T>>, unknown>, Error>;
2899
3001
  prefetchQuery<T extends Collection>(params: CollectionQueryParams<T>, options?: {
2900
3002
  staleTime?: number;
2901
3003
  }): Promise<void>;
@@ -3014,4 +3116,4 @@ interface RichTextContentProps {
3014
3116
  }
3015
3117
  declare function RichTextContent({ data, className, internalDocToHref, blocks, }: RichTextContentProps): React.JSX.Element;
3016
3118
 
3017
- export { API_URLS, ApiClient, type ApiClientOptions, ApiError, type ApiErrorResponse, type ApiQueryOptions, type ApiQueryReactOptions, type ApiResponse, type ApiSuccessResponse, type Auth, type Brand, type BrandLogo, type BrandLogosSelect, type BrandsSelect, BrowserClient, BrowserClient as BrowserClientType, COLLECTIONS, type ClientBrowserConfig, type ClientMetadata, type ClientServerConfig, type ClientState, type Collection, type CollectionDetailQueryParams, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, type CollectionType, CollectionsApi, type Config, ConfigError, type CreateOrderParams, type DebugConfig, type DeepPartial, type Document, type DocumentCategoriesSelect, type DocumentCategory, type DocumentImage, type DocumentImagesSelect, type DocumentsSelect, type Environment, type ErrorLogger, type ExtractArrayType, type Form, type FormSubmission, type FormSubmissionsSelect, type FormsSelect, type GalleriesSelect, type Gallery, type GalleryImage, type GalleryImagesSelect, type IframeBlock, type JwtPayload, type Media, type MediaSelect, type Music, type MusicsSelect, NetworkError, type Order, type OrderProduct, type OrderProductsSelect, type OrdersSelect, type PaginationMeta, type PayloadKv, type PayloadKvSelect, type PayloadLockedDocument, type PayloadLockedDocumentsSelect, type PayloadMigration, type PayloadMigrationsSelect, type PayloadPreference, type PayloadPreferencesSelect, type PlayerBlock, type Playlist, type PlaylistImage, type PlaylistImagesSelect, type PlaylistsSelect, type Post, type PostCategoriesSelect, type PostCategory, type PostImage, type PostImagesSelect, type PostTag, type PostTagsSelect, type PostsSelect, type Product, type ProductCategoriesSelect, type ProductCategory, type ProductImage, type ProductImagesSelect, type ProductOption, type ProductOptionsSelect, type ProductTag, type ProductTagsSelect, type ProductVariant, type ProductVariantsSelect, type ProductsSelect, type PublicCollection, type RetryConfig, type Return, type ReturnProduct, type ReturnProductsSelect, type ReturnsSelect, RichTextContent, type RichTextContentProps, type RichTextData, SDKError, ServerClient, ServerClient as ServerClientType, type SupportedTimezones, type Tenant, type TenantLogo, type TenantLogosSelect, type TenantMetadataSelect, type TenantMetadatum, type TenantOgImage, type TenantOgImagesSelect, type TenantsSelect, TimeoutError, type Transaction, type TransactionsSelect, UnifiedQueryClient, type UnifiedQueryOptions, type UpdateOrderParams, type UpdateTransactionParams, type User, type UserAuthOperations, type UsersSelect, ValidationError, type WebhookEvent, type WebhookHandler, type WebhookOperation, collectionKeys, createApiKey, createBrowserClient, createServerClient, createServerToken, createTypedWebhookHandler, decodeServerToken, formatOrderName, generateOrderNumber, getQueryClient, handleWebhook, isApiError, isConfigError, isErrorResponse, isNetworkError, isSDKError, isSuccessResponse, isTimeoutError, isValidWebhookEvent, isValidationError, objectFor, parseApiKey, resolveApiUrl, verifyServerToken };
3119
+ export { API_URLS, ApiClient, type ApiClientOptions, ApiError, type ApiQueryOptions, type ApiQueryReactOptions, type Auth, type Brand, type BrandLogo, type BrandLogosSelect, type BrandsSelect, BrowserClient, BrowserClient as BrowserClientType, COLLECTIONS, type ClientBrowserConfig, type ClientMetadata, type ClientServerConfig, type ClientState, type Collection, type CollectionDetailQueryParams, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, type CollectionType, CollectionsApi, type Config, ConfigError, type CreateOrderParams, type DebugConfig, type DeepPartial, type Document, type DocumentCategoriesSelect, type DocumentCategory, type DocumentImage, type DocumentImagesSelect, type DocumentsSelect, type Environment, type ErrorLogger, type ExtractArrayType, type Form, type FormSubmission, type FormSubmissionsSelect, type FormsSelect, type GalleriesSelect, type Gallery, type GalleryImage, type GalleryImagesSelect, type IframeBlock, type JwtPayload, type Media, type MediaSelect, type Music, type MusicsSelect, NetworkError, type Order, type OrderProduct, type OrderProductsSelect, type OrdersSelect, type PaginationMeta, type PayloadFindResponse, type PayloadKv, type PayloadKvSelect, type PayloadLockedDocument, type PayloadLockedDocumentsSelect, type PayloadMigration, type PayloadMigrationsSelect, type PayloadMutationResponse, type PayloadPreference, type PayloadPreferencesSelect, type PlayerBlock, type Playlist, type PlaylistImage, type PlaylistImagesSelect, type PlaylistsSelect, type Post, type PostCategoriesSelect, type PostCategory, type PostImage, type PostImagesSelect, type PostTag, type PostTagsSelect, type PostsSelect, type Product, type ProductCategoriesSelect, type ProductCategory, type ProductImage, type ProductImagesSelect, type ProductOption, type ProductOptionsSelect, type ProductTag, type ProductTagsSelect, type ProductVariant, type ProductVariantsSelect, type ProductsSelect, type PublicCollection, type RetryConfig, type Return, type ReturnProduct, type ReturnProductsSelect, type ReturnsSelect, RichTextContent, type RichTextContentProps, type RichTextData, SDKError, ServerClient, ServerClient as ServerClientType, type SupportedTimezones, type Tenant, type TenantLogo, type TenantLogosSelect, type TenantMetadataSelect, type TenantMetadatum, type TenantOgImage, type TenantOgImagesSelect, type TenantsSelect, TimeoutError, type Transaction, type TransactionsSelect, UnifiedQueryClient, type UnifiedQueryOptions, type UpdateOrderParams, type UpdateTransactionParams, type User, type UserAuthOperations, type UsersSelect, ValidationError, type WebhookEvent, type WebhookHandler, type WebhookOperation, collectionKeys, createApiKey, createBrowserClient, createServerClient, createServerToken, createTypedWebhookHandler, decodeServerToken, formatOrderName, generateOrderNumber, getQueryClient, handleWebhook, isApiError, isConfigError, isNetworkError, isSDKError, isTimeoutError, isValidWebhookEvent, isValidationError, objectFor, parseApiKey, resolveApiUrl, verifyServerToken };
package/dist/index.d.ts CHANGED
@@ -510,16 +510,12 @@ interface Product {
510
510
  id: number;
511
511
  _order?: string | null;
512
512
  tenant?: (number | null) | Tenant;
513
- /**
514
- * 영문, 숫자, _(언더스코어), -(하이픈)만 사용가능합니다.
515
- */
516
- sku: string;
513
+ title: string;
517
514
  /**
518
515
  * When enabled, the slug will auto-generate from the title field on save and autosave.
519
516
  */
520
517
  generateSlug?: boolean | null;
521
- slug: string;
522
- title: string;
518
+ slug?: string | null;
523
519
  subTitle?: string | null;
524
520
  thumbnail?: (number | null) | ProductImage;
525
521
  images?: (number | ProductImage)[] | null;
@@ -556,7 +552,6 @@ interface Product {
556
552
  isSoldOut?: boolean | null;
557
553
  updatedAt: string;
558
554
  createdAt: string;
559
- _status?: ('draft' | 'published') | null;
560
555
  }
561
556
  /**
562
557
  * This interface was referenced by `Config`'s JSON-Schema
@@ -656,7 +651,7 @@ interface Brand {
656
651
  * When enabled, the slug will auto-generate from the title field on save and autosave.
657
652
  */
658
653
  generateSlug?: boolean | null;
659
- slug: string;
654
+ slug?: string | null;
660
655
  /**
661
656
  * Primary brand logo
662
657
  */
@@ -983,7 +978,7 @@ interface Post {
983
978
  * When enabled, the slug will auto-generate from the title field on save and autosave.
984
979
  */
985
980
  generateSlug?: boolean | null;
986
- slug: string;
981
+ slug?: string | null;
987
982
  categories?: (number | PostCategory)[] | null;
988
983
  tags?: (number | PostTag)[] | null;
989
984
  content?: {
@@ -1772,10 +1767,9 @@ interface TenantOgImagesSelect<T extends boolean = true> {
1772
1767
  interface ProductsSelect<T extends boolean = true> {
1773
1768
  _order?: T;
1774
1769
  tenant?: T;
1775
- sku?: T;
1770
+ title?: T;
1776
1771
  generateSlug?: T;
1777
1772
  slug?: T;
1778
- title?: T;
1779
1773
  subTitle?: T;
1780
1774
  thumbnail?: T;
1781
1775
  images?: T;
@@ -1790,7 +1784,6 @@ interface ProductsSelect<T extends boolean = true> {
1790
1784
  isSoldOut?: T;
1791
1785
  updatedAt?: T;
1792
1786
  createdAt?: T;
1793
- _status?: T;
1794
1787
  }
1795
1788
  /**
1796
1789
  * This interface was referenced by `Config`'s JSON-Schema
@@ -2643,23 +2636,36 @@ interface PaginationMeta {
2643
2636
  totalPages: number;
2644
2637
  hasNextPage: boolean;
2645
2638
  hasPrevPage: boolean;
2639
+ pagingCounter: number;
2640
+ prevPage: number | null;
2641
+ nextPage: number | null;
2646
2642
  }
2647
- interface ApiSuccessResponse<T = unknown> {
2648
- data: T;
2649
- success: true;
2650
- message?: string;
2651
- pagination?: PaginationMeta;
2643
+ /**
2644
+ * Payload CMS Find (List) Response
2645
+ * GET /api/{collection}
2646
+ */
2647
+ interface PayloadFindResponse<T = unknown> {
2648
+ docs: T[];
2649
+ totalDocs: number;
2650
+ limit: number;
2651
+ totalPages: number;
2652
+ page: number;
2653
+ pagingCounter: number;
2654
+ hasPrevPage: boolean;
2655
+ hasNextPage: boolean;
2656
+ prevPage: number | null;
2657
+ nextPage: number | null;
2652
2658
  }
2653
- interface ApiErrorResponse {
2654
- data: null;
2655
- success: false;
2656
- error: {
2657
- code: string;
2658
- message: string;
2659
- details?: unknown;
2660
- };
2659
+ /**
2660
+ * Payload CMS Create/Update Response
2661
+ * POST /api/{collection}
2662
+ * PATCH /api/{collection}/{id}
2663
+ */
2664
+ interface PayloadMutationResponse<T = unknown> {
2665
+ message: string;
2666
+ doc: T;
2667
+ errors?: unknown[];
2661
2668
  }
2662
- type ApiResponse<T = unknown> = ApiSuccessResponse<T> | ApiErrorResponse;
2663
2669
  interface ApiQueryOptions {
2664
2670
  page?: number;
2665
2671
  limit?: number;
@@ -2686,8 +2692,6 @@ type DeepPartial<T> = {
2686
2692
  [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
2687
2693
  };
2688
2694
  type ExtractArrayType<T> = T extends (infer U)[] ? U : never;
2689
- declare function isSuccessResponse<T>(response: ApiResponse<T>): response is ApiSuccessResponse<T>;
2690
- declare function isErrorResponse(response: ApiResponse<unknown>): response is ApiErrorResponse;
2691
2695
 
2692
2696
  type CollectionType<T extends Collection> = T extends keyof Config['collections'] ? Config['collections'][T] : never;
2693
2697
 
@@ -2788,32 +2792,130 @@ declare class BaseApiClient {
2788
2792
  protected baseUrl?: string;
2789
2793
  protected defaultOptions: FetchOptions;
2790
2794
  constructor(clientKey: string, secretKey?: string, baseUrl?: string);
2791
- protected get<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<ApiResponse<T>>;
2792
- protected post<T = unknown>(endpoint: string, data?: unknown, options?: FetchOptions): Promise<ApiResponse<T>>;
2793
- protected patch<T = unknown>(endpoint: string, data?: unknown, options?: FetchOptions): Promise<ApiResponse<T>>;
2794
- protected delete<T = unknown>(endpoint: string, options?: FetchOptions): Promise<ApiResponse<T>>;
2795
2795
  protected buildUrl(endpoint: string, options?: ApiQueryOptions): string;
2796
- protected parseResponse<T>(response: Response): Promise<ApiResponse<T>>;
2796
+ /**
2797
+ * Parse Payload CMS find response (list query)
2798
+ * Returns native Payload response structure
2799
+ */
2800
+ protected parseFindResponse<T>(response: Response): Promise<PayloadFindResponse<T>>;
2801
+ /**
2802
+ * Parse Payload CMS mutation response (create/update)
2803
+ * Returns native Payload response structure
2804
+ */
2805
+ protected parseMutationResponse<T>(response: Response): Promise<PayloadMutationResponse<T>>;
2806
+ /**
2807
+ * Parse Payload CMS document response (findById/delete)
2808
+ * Returns document directly without wrapper
2809
+ */
2810
+ protected parseDocumentResponse<T>(response: Response): Promise<T>;
2797
2811
  }
2798
2812
 
2799
2813
  declare class CollectionsApi extends BaseApiClient {
2800
2814
  constructor(clientKey: string, secretKey?: string, baseUrl?: string);
2801
2815
  from<T extends Collection>(collection: T): CollectionQueryBuilder<T>;
2802
- requestGet<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<ApiResponse<T>>;
2803
- requestPost<T = unknown>(endpoint: string, data?: unknown): Promise<ApiResponse<T>>;
2804
- requestPatch<T = unknown>(endpoint: string, data?: unknown): Promise<ApiResponse<T>>;
2805
- requestDelete<T = unknown>(endpoint: string): Promise<ApiResponse<T>>;
2816
+ /**
2817
+ * Find documents (list query)
2818
+ * GET /api/{collection}
2819
+ */
2820
+ requestFind<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<PayloadFindResponse<T>>;
2821
+ /**
2822
+ * Find document by ID
2823
+ * GET /api/{collection}/{id}
2824
+ */
2825
+ requestFindById<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<T>;
2826
+ /**
2827
+ * Create document
2828
+ * POST /api/{collection}
2829
+ */
2830
+ requestCreate<T = unknown>(endpoint: string, data?: unknown): Promise<PayloadMutationResponse<T>>;
2831
+ /**
2832
+ * Update document
2833
+ * PATCH /api/{collection}/{id}
2834
+ */
2835
+ requestUpdate<T = unknown>(endpoint: string, data?: unknown): Promise<PayloadMutationResponse<T>>;
2836
+ /**
2837
+ * Count documents
2838
+ * GET /api/{collection}/count
2839
+ */
2840
+ requestCount(endpoint: string, options?: ApiQueryOptions): Promise<{
2841
+ totalDocs: number;
2842
+ }>;
2843
+ /**
2844
+ * Update multiple documents (bulk update)
2845
+ * PATCH /api/{collection}
2846
+ */
2847
+ requestUpdateMany<T = unknown>(endpoint: string, data: {
2848
+ where?: unknown;
2849
+ data: unknown;
2850
+ }): Promise<PayloadFindResponse<T>>;
2851
+ /**
2852
+ * Delete document
2853
+ * DELETE /api/{collection}/{id}
2854
+ */
2855
+ requestDelete<T = unknown>(endpoint: string): Promise<T>;
2856
+ /**
2857
+ * Delete multiple documents (bulk delete)
2858
+ * DELETE /api/{collection}
2859
+ */
2860
+ requestDeleteMany<T = unknown>(endpoint: string, data: {
2861
+ where?: unknown;
2862
+ }): Promise<PayloadFindResponse<T>>;
2806
2863
  }
2807
2864
 
2808
2865
  declare class CollectionQueryBuilder<T extends Collection> {
2809
2866
  private api;
2810
2867
  private collection;
2811
2868
  constructor(api: CollectionsApi, collection: T);
2812
- find(options?: ApiQueryOptions): Promise<ApiResponse<CollectionType<T>[]>>;
2813
- findById(id: number | string, options?: ApiQueryOptions): Promise<ApiResponse<CollectionType<T>>>;
2814
- create(data: Partial<CollectionType<T>>): Promise<ApiResponse<CollectionType<T>>>;
2815
- update(id: number | string, data: Partial<CollectionType<T>>): Promise<ApiResponse<CollectionType<T>>>;
2816
- remove(id: number | string): Promise<ApiResponse<void>>;
2869
+ /**
2870
+ * Find documents (list query)
2871
+ * GET /api/{collection}
2872
+ * @returns Payload CMS find response with docs array and pagination
2873
+ */
2874
+ find(options?: ApiQueryOptions): Promise<PayloadFindResponse<CollectionType<T>>>;
2875
+ /**
2876
+ * Find document by ID
2877
+ * GET /api/{collection}/{id}
2878
+ * @returns Document object directly (no wrapper)
2879
+ */
2880
+ findById(id: number | string, options?: ApiQueryOptions): Promise<CollectionType<T>>;
2881
+ /**
2882
+ * Create a new document
2883
+ * POST /api/{collection}
2884
+ * @returns Payload CMS mutation response with doc and message
2885
+ */
2886
+ create(data: Partial<CollectionType<T>>): Promise<PayloadMutationResponse<CollectionType<T>>>;
2887
+ /**
2888
+ * Update a document by ID
2889
+ * PATCH /api/{collection}/{id}
2890
+ * @returns Payload CMS mutation response with doc and message
2891
+ */
2892
+ update(id: number | string, data: Partial<CollectionType<T>>): Promise<PayloadMutationResponse<CollectionType<T>>>;
2893
+ /**
2894
+ * Count documents
2895
+ * GET /api/{collection}/count
2896
+ * @returns Count response with totalDocs
2897
+ */
2898
+ count(options?: ApiQueryOptions): Promise<{
2899
+ totalDocs: number;
2900
+ }>;
2901
+ /**
2902
+ * Update multiple documents (bulk update)
2903
+ * PATCH /api/{collection}
2904
+ * @returns Payload CMS find response with updated docs
2905
+ */
2906
+ updateMany(where: ApiQueryOptions['where'], data: Partial<CollectionType<T>>): Promise<PayloadFindResponse<CollectionType<T>>>;
2907
+ /**
2908
+ * Delete a document by ID
2909
+ * DELETE /api/{collection}/{id}
2910
+ * @returns Deleted document object directly (no wrapper)
2911
+ */
2912
+ remove(id: number | string): Promise<CollectionType<T>>;
2913
+ /**
2914
+ * Delete multiple documents (bulk delete)
2915
+ * DELETE /api/{collection}
2916
+ * @returns Payload CMS find response with deleted docs
2917
+ */
2918
+ removeMany(where: ApiQueryOptions['where']): Promise<PayloadFindResponse<CollectionType<T>>>;
2817
2919
  }
2818
2920
 
2819
2921
  interface UnifiedQueryOptions {
@@ -2872,7 +2974,7 @@ declare class UnifiedQueryClient {
2872
2974
  refetchOnMount?: boolean;
2873
2975
  refetchInterval?: number | false;
2874
2976
  retry?: boolean | number;
2875
- }): _tanstack_react_query.UseQueryResult<_tanstack_react_query.NoInfer<CollectionType<T> | null>, Error>;
2977
+ }): _tanstack_react_query.UseQueryResult<_tanstack_react_query.NoInfer<CollectionType<T>>, Error>;
2876
2978
  useSuspenseQueryById<T extends Collection>(params: CollectionDetailQueryParams<T>, options?: {
2877
2979
  staleTime?: number;
2878
2980
  gcTime?: number;
@@ -2880,7 +2982,7 @@ declare class UnifiedQueryClient {
2880
2982
  refetchOnMount?: boolean;
2881
2983
  refetchInterval?: number | false;
2882
2984
  retry?: boolean | number;
2883
- }): _tanstack_react_query.UseSuspenseQueryResult<CollectionType<T> | null, Error>;
2985
+ }): _tanstack_react_query.UseSuspenseQueryResult<CollectionType<T>, Error>;
2884
2986
  useInfiniteQuery<T extends Collection>(params: CollectionInfiniteQueryParams<T>, options?: {
2885
2987
  enabled?: boolean;
2886
2988
  staleTime?: number;
@@ -2888,14 +2990,14 @@ declare class UnifiedQueryClient {
2888
2990
  refetchOnWindowFocus?: boolean;
2889
2991
  refetchOnMount?: boolean;
2890
2992
  retry?: boolean | number;
2891
- }): _tanstack_react_query.UseInfiniteQueryResult<_tanstack_react_query.InfiniteData<CollectionType<T>[], unknown>, Error>;
2993
+ }): _tanstack_react_query.UseInfiniteQueryResult<_tanstack_react_query.InfiniteData<PayloadFindResponse<CollectionType<T>>, unknown>, Error>;
2892
2994
  useSuspenseInfiniteQuery<T extends Collection>(params: CollectionInfiniteQueryParams<T>, options?: {
2893
2995
  staleTime?: number;
2894
2996
  gcTime?: number;
2895
2997
  refetchOnWindowFocus?: boolean;
2896
2998
  refetchOnMount?: boolean;
2897
2999
  retry?: boolean | number;
2898
- }): _tanstack_react_query.UseSuspenseInfiniteQueryResult<_tanstack_react_query.InfiniteData<CollectionType<T>[], unknown>, Error>;
3000
+ }): _tanstack_react_query.UseSuspenseInfiniteQueryResult<_tanstack_react_query.InfiniteData<PayloadFindResponse<CollectionType<T>>, unknown>, Error>;
2899
3001
  prefetchQuery<T extends Collection>(params: CollectionQueryParams<T>, options?: {
2900
3002
  staleTime?: number;
2901
3003
  }): Promise<void>;
@@ -3014,4 +3116,4 @@ interface RichTextContentProps {
3014
3116
  }
3015
3117
  declare function RichTextContent({ data, className, internalDocToHref, blocks, }: RichTextContentProps): React.JSX.Element;
3016
3118
 
3017
- export { API_URLS, ApiClient, type ApiClientOptions, ApiError, type ApiErrorResponse, type ApiQueryOptions, type ApiQueryReactOptions, type ApiResponse, type ApiSuccessResponse, type Auth, type Brand, type BrandLogo, type BrandLogosSelect, type BrandsSelect, BrowserClient, BrowserClient as BrowserClientType, COLLECTIONS, type ClientBrowserConfig, type ClientMetadata, type ClientServerConfig, type ClientState, type Collection, type CollectionDetailQueryParams, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, type CollectionType, CollectionsApi, type Config, ConfigError, type CreateOrderParams, type DebugConfig, type DeepPartial, type Document, type DocumentCategoriesSelect, type DocumentCategory, type DocumentImage, type DocumentImagesSelect, type DocumentsSelect, type Environment, type ErrorLogger, type ExtractArrayType, type Form, type FormSubmission, type FormSubmissionsSelect, type FormsSelect, type GalleriesSelect, type Gallery, type GalleryImage, type GalleryImagesSelect, type IframeBlock, type JwtPayload, type Media, type MediaSelect, type Music, type MusicsSelect, NetworkError, type Order, type OrderProduct, type OrderProductsSelect, type OrdersSelect, type PaginationMeta, type PayloadKv, type PayloadKvSelect, type PayloadLockedDocument, type PayloadLockedDocumentsSelect, type PayloadMigration, type PayloadMigrationsSelect, type PayloadPreference, type PayloadPreferencesSelect, type PlayerBlock, type Playlist, type PlaylistImage, type PlaylistImagesSelect, type PlaylistsSelect, type Post, type PostCategoriesSelect, type PostCategory, type PostImage, type PostImagesSelect, type PostTag, type PostTagsSelect, type PostsSelect, type Product, type ProductCategoriesSelect, type ProductCategory, type ProductImage, type ProductImagesSelect, type ProductOption, type ProductOptionsSelect, type ProductTag, type ProductTagsSelect, type ProductVariant, type ProductVariantsSelect, type ProductsSelect, type PublicCollection, type RetryConfig, type Return, type ReturnProduct, type ReturnProductsSelect, type ReturnsSelect, RichTextContent, type RichTextContentProps, type RichTextData, SDKError, ServerClient, ServerClient as ServerClientType, type SupportedTimezones, type Tenant, type TenantLogo, type TenantLogosSelect, type TenantMetadataSelect, type TenantMetadatum, type TenantOgImage, type TenantOgImagesSelect, type TenantsSelect, TimeoutError, type Transaction, type TransactionsSelect, UnifiedQueryClient, type UnifiedQueryOptions, type UpdateOrderParams, type UpdateTransactionParams, type User, type UserAuthOperations, type UsersSelect, ValidationError, type WebhookEvent, type WebhookHandler, type WebhookOperation, collectionKeys, createApiKey, createBrowserClient, createServerClient, createServerToken, createTypedWebhookHandler, decodeServerToken, formatOrderName, generateOrderNumber, getQueryClient, handleWebhook, isApiError, isConfigError, isErrorResponse, isNetworkError, isSDKError, isSuccessResponse, isTimeoutError, isValidWebhookEvent, isValidationError, objectFor, parseApiKey, resolveApiUrl, verifyServerToken };
3119
+ export { API_URLS, ApiClient, type ApiClientOptions, ApiError, type ApiQueryOptions, type ApiQueryReactOptions, type Auth, type Brand, type BrandLogo, type BrandLogosSelect, type BrandsSelect, BrowserClient, BrowserClient as BrowserClientType, COLLECTIONS, type ClientBrowserConfig, type ClientMetadata, type ClientServerConfig, type ClientState, type Collection, type CollectionDetailQueryParams, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, type CollectionType, CollectionsApi, type Config, ConfigError, type CreateOrderParams, type DebugConfig, type DeepPartial, type Document, type DocumentCategoriesSelect, type DocumentCategory, type DocumentImage, type DocumentImagesSelect, type DocumentsSelect, type Environment, type ErrorLogger, type ExtractArrayType, type Form, type FormSubmission, type FormSubmissionsSelect, type FormsSelect, type GalleriesSelect, type Gallery, type GalleryImage, type GalleryImagesSelect, type IframeBlock, type JwtPayload, type Media, type MediaSelect, type Music, type MusicsSelect, NetworkError, type Order, type OrderProduct, type OrderProductsSelect, type OrdersSelect, type PaginationMeta, type PayloadFindResponse, type PayloadKv, type PayloadKvSelect, type PayloadLockedDocument, type PayloadLockedDocumentsSelect, type PayloadMigration, type PayloadMigrationsSelect, type PayloadMutationResponse, type PayloadPreference, type PayloadPreferencesSelect, type PlayerBlock, type Playlist, type PlaylistImage, type PlaylistImagesSelect, type PlaylistsSelect, type Post, type PostCategoriesSelect, type PostCategory, type PostImage, type PostImagesSelect, type PostTag, type PostTagsSelect, type PostsSelect, type Product, type ProductCategoriesSelect, type ProductCategory, type ProductImage, type ProductImagesSelect, type ProductOption, type ProductOptionsSelect, type ProductTag, type ProductTagsSelect, type ProductVariant, type ProductVariantsSelect, type ProductsSelect, type PublicCollection, type RetryConfig, type Return, type ReturnProduct, type ReturnProductsSelect, type ReturnsSelect, RichTextContent, type RichTextContentProps, type RichTextData, SDKError, ServerClient, ServerClient as ServerClientType, type SupportedTimezones, type Tenant, type TenantLogo, type TenantLogosSelect, type TenantMetadataSelect, type TenantMetadatum, type TenantOgImage, type TenantOgImagesSelect, type TenantsSelect, TimeoutError, type Transaction, type TransactionsSelect, UnifiedQueryClient, type UnifiedQueryOptions, type UpdateOrderParams, type UpdateTransactionParams, type User, type UserAuthOperations, type UsersSelect, ValidationError, type WebhookEvent, type WebhookHandler, type WebhookOperation, collectionKeys, createApiKey, createBrowserClient, createServerClient, createServerToken, createTypedWebhookHandler, decodeServerToken, formatOrderName, generateOrderNumber, getQueryClient, handleWebhook, isApiError, isConfigError, isNetworkError, isSDKError, isTimeoutError, isValidWebhookEvent, isValidationError, objectFor, parseApiKey, resolveApiUrl, verifyServerToken };