@01.software/sdk 0.1.0-dev.260119.0a66443 → 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
@@ -618,7 +613,7 @@ interface ProductCategory {
618
613
  * When enabled, the slug will auto-generate from the title field on save and autosave.
619
614
  */
620
615
  generateSlug?: boolean | null;
621
- slug: string;
616
+ slug?: string | null;
622
617
  description?: string | null;
623
618
  image?: (number | null) | ProductImage;
624
619
  parent?: (number | null) | ProductCategory;
@@ -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
  */
@@ -915,7 +910,7 @@ interface DocumentCategory {
915
910
  * When enabled, the slug will auto-generate from the title field on save and autosave.
916
911
  */
917
912
  generateSlug?: boolean | null;
918
- slug: string;
913
+ slug?: string | null;
919
914
  description?: string | null;
920
915
  updatedAt: string;
921
916
  createdAt: string;
@@ -978,11 +973,12 @@ interface Post {
978
973
  tenant?: (number | null) | Tenant;
979
974
  thumbnail?: (number | null) | PostImage;
980
975
  title: string;
976
+ subtitle?: string | null;
981
977
  /**
982
978
  * When enabled, the slug will auto-generate from the title field on save and autosave.
983
979
  */
984
980
  generateSlug?: boolean | null;
985
- slug: string;
981
+ slug?: string | null;
986
982
  categories?: (number | PostCategory)[] | null;
987
983
  tags?: (number | PostTag)[] | null;
988
984
  content?: {
@@ -1065,7 +1061,7 @@ interface PostCategory {
1065
1061
  * When enabled, the slug will auto-generate from the title field on save and autosave.
1066
1062
  */
1067
1063
  generateSlug?: boolean | null;
1068
- slug: string;
1064
+ slug?: string | null;
1069
1065
  description?: string | null;
1070
1066
  parent?: (number | null) | PostCategory;
1071
1067
  updatedAt: string;
@@ -1771,10 +1767,9 @@ interface TenantOgImagesSelect<T extends boolean = true> {
1771
1767
  interface ProductsSelect<T extends boolean = true> {
1772
1768
  _order?: T;
1773
1769
  tenant?: T;
1774
- sku?: T;
1770
+ title?: T;
1775
1771
  generateSlug?: T;
1776
1772
  slug?: T;
1777
- title?: T;
1778
1773
  subTitle?: T;
1779
1774
  thumbnail?: T;
1780
1775
  images?: T;
@@ -1789,7 +1784,6 @@ interface ProductsSelect<T extends boolean = true> {
1789
1784
  isSoldOut?: T;
1790
1785
  updatedAt?: T;
1791
1786
  createdAt?: T;
1792
- _status?: T;
1793
1787
  }
1794
1788
  /**
1795
1789
  * This interface was referenced by `Config`'s JSON-Schema
@@ -2135,6 +2129,7 @@ interface PostsSelect<T extends boolean = true> {
2135
2129
  tenant?: T;
2136
2130
  thumbnail?: T;
2137
2131
  title?: T;
2132
+ subtitle?: T;
2138
2133
  generateSlug?: T;
2139
2134
  slug?: T;
2140
2135
  categories?: T;
@@ -2641,23 +2636,36 @@ interface PaginationMeta {
2641
2636
  totalPages: number;
2642
2637
  hasNextPage: boolean;
2643
2638
  hasPrevPage: boolean;
2639
+ pagingCounter: number;
2640
+ prevPage: number | null;
2641
+ nextPage: number | null;
2644
2642
  }
2645
- interface ApiSuccessResponse<T = unknown> {
2646
- data: T;
2647
- success: true;
2648
- message?: string;
2649
- 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;
2650
2658
  }
2651
- interface ApiErrorResponse {
2652
- data: null;
2653
- success: false;
2654
- error: {
2655
- code: string;
2656
- message: string;
2657
- details?: unknown;
2658
- };
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[];
2659
2668
  }
2660
- type ApiResponse<T = unknown> = ApiSuccessResponse<T> | ApiErrorResponse;
2661
2669
  interface ApiQueryOptions {
2662
2670
  page?: number;
2663
2671
  limit?: number;
@@ -2684,8 +2692,6 @@ type DeepPartial<T> = {
2684
2692
  [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
2685
2693
  };
2686
2694
  type ExtractArrayType<T> = T extends (infer U)[] ? U : never;
2687
- declare function isSuccessResponse<T>(response: ApiResponse<T>): response is ApiSuccessResponse<T>;
2688
- declare function isErrorResponse(response: ApiResponse<unknown>): response is ApiErrorResponse;
2689
2695
 
2690
2696
  type CollectionType<T extends Collection> = T extends keyof Config['collections'] ? Config['collections'][T] : never;
2691
2697
 
@@ -2786,32 +2792,130 @@ declare class BaseApiClient {
2786
2792
  protected baseUrl?: string;
2787
2793
  protected defaultOptions: FetchOptions;
2788
2794
  constructor(clientKey: string, secretKey?: string, baseUrl?: string);
2789
- protected get<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<ApiResponse<T>>;
2790
- protected post<T = unknown>(endpoint: string, data?: unknown, options?: FetchOptions): Promise<ApiResponse<T>>;
2791
- protected patch<T = unknown>(endpoint: string, data?: unknown, options?: FetchOptions): Promise<ApiResponse<T>>;
2792
- protected delete<T = unknown>(endpoint: string, options?: FetchOptions): Promise<ApiResponse<T>>;
2793
2795
  protected buildUrl(endpoint: string, options?: ApiQueryOptions): string;
2794
- 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>;
2795
2811
  }
2796
2812
 
2797
2813
  declare class CollectionsApi extends BaseApiClient {
2798
2814
  constructor(clientKey: string, secretKey?: string, baseUrl?: string);
2799
2815
  from<T extends Collection>(collection: T): CollectionQueryBuilder<T>;
2800
- requestGet<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<ApiResponse<T>>;
2801
- requestPost<T = unknown>(endpoint: string, data?: unknown): Promise<ApiResponse<T>>;
2802
- requestPatch<T = unknown>(endpoint: string, data?: unknown): Promise<ApiResponse<T>>;
2803
- 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>>;
2804
2863
  }
2805
2864
 
2806
2865
  declare class CollectionQueryBuilder<T extends Collection> {
2807
2866
  private api;
2808
2867
  private collection;
2809
2868
  constructor(api: CollectionsApi, collection: T);
2810
- find(options?: ApiQueryOptions): Promise<ApiResponse<CollectionType<T>[]>>;
2811
- findById(id: number | string, options?: ApiQueryOptions): Promise<ApiResponse<CollectionType<T>>>;
2812
- create(data: Partial<CollectionType<T>>): Promise<ApiResponse<CollectionType<T>>>;
2813
- update(id: number | string, data: Partial<CollectionType<T>>): Promise<ApiResponse<CollectionType<T>>>;
2814
- 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>>>;
2815
2919
  }
2816
2920
 
2817
2921
  interface UnifiedQueryOptions {
@@ -2870,7 +2974,7 @@ declare class UnifiedQueryClient {
2870
2974
  refetchOnMount?: boolean;
2871
2975
  refetchInterval?: number | false;
2872
2976
  retry?: boolean | number;
2873
- }): _tanstack_react_query.UseQueryResult<_tanstack_react_query.NoInfer<CollectionType<T> | null>, Error>;
2977
+ }): _tanstack_react_query.UseQueryResult<_tanstack_react_query.NoInfer<CollectionType<T>>, Error>;
2874
2978
  useSuspenseQueryById<T extends Collection>(params: CollectionDetailQueryParams<T>, options?: {
2875
2979
  staleTime?: number;
2876
2980
  gcTime?: number;
@@ -2878,7 +2982,7 @@ declare class UnifiedQueryClient {
2878
2982
  refetchOnMount?: boolean;
2879
2983
  refetchInterval?: number | false;
2880
2984
  retry?: boolean | number;
2881
- }): _tanstack_react_query.UseSuspenseQueryResult<CollectionType<T> | null, Error>;
2985
+ }): _tanstack_react_query.UseSuspenseQueryResult<CollectionType<T>, Error>;
2882
2986
  useInfiniteQuery<T extends Collection>(params: CollectionInfiniteQueryParams<T>, options?: {
2883
2987
  enabled?: boolean;
2884
2988
  staleTime?: number;
@@ -2886,14 +2990,14 @@ declare class UnifiedQueryClient {
2886
2990
  refetchOnWindowFocus?: boolean;
2887
2991
  refetchOnMount?: boolean;
2888
2992
  retry?: boolean | number;
2889
- }): _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>;
2890
2994
  useSuspenseInfiniteQuery<T extends Collection>(params: CollectionInfiniteQueryParams<T>, options?: {
2891
2995
  staleTime?: number;
2892
2996
  gcTime?: number;
2893
2997
  refetchOnWindowFocus?: boolean;
2894
2998
  refetchOnMount?: boolean;
2895
2999
  retry?: boolean | number;
2896
- }): _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>;
2897
3001
  prefetchQuery<T extends Collection>(params: CollectionQueryParams<T>, options?: {
2898
3002
  staleTime?: number;
2899
3003
  }): Promise<void>;
@@ -3012,4 +3116,4 @@ interface RichTextContentProps {
3012
3116
  }
3013
3117
  declare function RichTextContent({ data, className, internalDocToHref, blocks, }: RichTextContentProps): React.JSX.Element;
3014
3118
 
3015
- 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 };