@01.software/sdk 0.1.0-dev.260206.8918543 → 0.1.0-dev.260211.a92d27b

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.ts CHANGED
@@ -510,17 +510,15 @@ 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;
514
+ subTitle?: string | null;
517
515
  /**
518
516
  * When enabled, the slug will auto-generate from the title field on save and autosave.
519
517
  */
520
518
  generateSlug?: boolean | null;
521
- slug: string;
522
- title: string;
523
- subTitle?: string | null;
519
+ slug?: string | null;
520
+ status?: ('draft' | 'published' | 'archived') | null;
521
+ isSoldOut?: boolean | null;
524
522
  thumbnail?: (number | null) | ProductImage;
525
523
  images?: (number | ProductImage)[] | null;
526
524
  description?: {
@@ -553,10 +551,8 @@ interface Product {
553
551
  hasNextPage?: boolean;
554
552
  totalDocs?: number;
555
553
  };
556
- isSoldOut?: boolean | null;
557
554
  updatedAt: string;
558
555
  createdAt: string;
559
- _status?: ('draft' | 'published') | null;
560
556
  }
561
557
  /**
562
558
  * This interface was referenced by `Config`'s JSON-Schema
@@ -656,7 +652,7 @@ interface Brand {
656
652
  * When enabled, the slug will auto-generate from the title field on save and autosave.
657
653
  */
658
654
  generateSlug?: boolean | null;
659
- slug: string;
655
+ slug?: string | null;
660
656
  /**
661
657
  * Primary brand logo
662
658
  */
@@ -724,6 +720,7 @@ interface Order {
724
720
  orderNumber: string;
725
721
  status: 'pending' | 'paid' | 'failed' | 'canceled' | 'preparing' | 'shipped' | 'delivered' | 'confirmed' | 'return_requested' | 'return_processing' | 'returned';
726
722
  totalAmount?: number | null;
723
+ name?: string | null;
727
724
  email?: string | null;
728
725
  shippingCarrier?: ('cj' | 'hanjin' | 'lotte' | 'epost' | 'logen' | 'other') | null;
729
726
  trackingNumber?: string | null;
@@ -767,7 +764,7 @@ interface OrderProduct {
767
764
  order: number | Order;
768
765
  product: number | Product;
769
766
  variant?: (number | null) | ProductVariant;
770
- option: number | ProductOption;
767
+ option?: (number | null) | ProductOption;
771
768
  quantity: number;
772
769
  title?: string | null;
773
770
  updatedAt: string;
@@ -983,7 +980,7 @@ interface Post {
983
980
  * When enabled, the slug will auto-generate from the title field on save and autosave.
984
981
  */
985
982
  generateSlug?: boolean | null;
986
- slug: string;
983
+ slug?: string | null;
987
984
  categories?: (number | PostCategory)[] | null;
988
985
  tags?: (number | PostTag)[] | null;
989
986
  content?: {
@@ -1772,11 +1769,12 @@ interface TenantOgImagesSelect<T extends boolean = true> {
1772
1769
  interface ProductsSelect<T extends boolean = true> {
1773
1770
  _order?: T;
1774
1771
  tenant?: T;
1775
- sku?: T;
1776
- generateSlug?: T;
1777
- slug?: T;
1778
1772
  title?: T;
1779
1773
  subTitle?: T;
1774
+ generateSlug?: T;
1775
+ slug?: T;
1776
+ status?: T;
1777
+ isSoldOut?: T;
1780
1778
  thumbnail?: T;
1781
1779
  images?: T;
1782
1780
  description?: T;
@@ -1787,10 +1785,8 @@ interface ProductsSelect<T extends boolean = true> {
1787
1785
  brand?: T;
1788
1786
  variants?: T;
1789
1787
  options?: T;
1790
- isSoldOut?: T;
1791
1788
  updatedAt?: T;
1792
1789
  createdAt?: T;
1793
- _status?: T;
1794
1790
  }
1795
1791
  /**
1796
1792
  * This interface was referenced by `Config`'s JSON-Schema
@@ -1955,6 +1951,7 @@ interface OrdersSelect<T extends boolean = true> {
1955
1951
  orderNumber?: T;
1956
1952
  status?: T;
1957
1953
  totalAmount?: T;
1954
+ name?: T;
1958
1955
  email?: T;
1959
1956
  shippingCarrier?: T;
1960
1957
  trackingNumber?: T;
@@ -2643,23 +2640,36 @@ interface PaginationMeta {
2643
2640
  totalPages: number;
2644
2641
  hasNextPage: boolean;
2645
2642
  hasPrevPage: boolean;
2643
+ pagingCounter: number;
2644
+ prevPage: number | null;
2645
+ nextPage: number | null;
2646
2646
  }
2647
- interface ApiSuccessResponse<T = unknown> {
2648
- data: T;
2649
- success: true;
2650
- message?: string;
2651
- pagination?: PaginationMeta;
2647
+ /**
2648
+ * Payload CMS Find (List) Response
2649
+ * GET /api/{collection}
2650
+ */
2651
+ interface PayloadFindResponse<T = unknown> {
2652
+ docs: T[];
2653
+ totalDocs: number;
2654
+ limit: number;
2655
+ totalPages: number;
2656
+ page: number;
2657
+ pagingCounter: number;
2658
+ hasPrevPage: boolean;
2659
+ hasNextPage: boolean;
2660
+ prevPage: number | null;
2661
+ nextPage: number | null;
2652
2662
  }
2653
- interface ApiErrorResponse {
2654
- data: null;
2655
- success: false;
2656
- error: {
2657
- code: string;
2658
- message: string;
2659
- details?: unknown;
2660
- };
2663
+ /**
2664
+ * Payload CMS Create/Update Response
2665
+ * POST /api/{collection}
2666
+ * PATCH /api/{collection}/{id}
2667
+ */
2668
+ interface PayloadMutationResponse<T = unknown> {
2669
+ message: string;
2670
+ doc: T;
2671
+ errors?: unknown[];
2661
2672
  }
2662
- type ApiResponse<T = unknown> = ApiSuccessResponse<T> | ApiErrorResponse;
2663
2673
  interface ApiQueryOptions {
2664
2674
  page?: number;
2665
2675
  limit?: number;
@@ -2686,8 +2696,6 @@ type DeepPartial<T> = {
2686
2696
  [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
2687
2697
  };
2688
2698
  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
2699
 
2692
2700
  type CollectionType<T extends Collection> = T extends keyof Config['collections'] ? Config['collections'][T] : never;
2693
2701
 
@@ -2788,32 +2796,130 @@ declare class BaseApiClient {
2788
2796
  protected baseUrl?: string;
2789
2797
  protected defaultOptions: FetchOptions;
2790
2798
  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
2799
  protected buildUrl(endpoint: string, options?: ApiQueryOptions): string;
2796
- protected parseResponse<T>(response: Response): Promise<ApiResponse<T>>;
2800
+ /**
2801
+ * Parse Payload CMS find response (list query)
2802
+ * Returns native Payload response structure
2803
+ */
2804
+ protected parseFindResponse<T>(response: Response): Promise<PayloadFindResponse<T>>;
2805
+ /**
2806
+ * Parse Payload CMS mutation response (create/update)
2807
+ * Returns native Payload response structure
2808
+ */
2809
+ protected parseMutationResponse<T>(response: Response): Promise<PayloadMutationResponse<T>>;
2810
+ /**
2811
+ * Parse Payload CMS document response (findById/delete)
2812
+ * Returns document directly without wrapper
2813
+ */
2814
+ protected parseDocumentResponse<T>(response: Response): Promise<T>;
2797
2815
  }
2798
2816
 
2799
2817
  declare class CollectionsApi extends BaseApiClient {
2800
2818
  constructor(clientKey: string, secretKey?: string, baseUrl?: string);
2801
2819
  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>>;
2820
+ /**
2821
+ * Find documents (list query)
2822
+ * GET /api/{collection}
2823
+ */
2824
+ requestFind<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<PayloadFindResponse<T>>;
2825
+ /**
2826
+ * Find document by ID
2827
+ * GET /api/{collection}/{id}
2828
+ */
2829
+ requestFindById<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<T>;
2830
+ /**
2831
+ * Create document
2832
+ * POST /api/{collection}
2833
+ */
2834
+ requestCreate<T = unknown>(endpoint: string, data?: unknown): Promise<PayloadMutationResponse<T>>;
2835
+ /**
2836
+ * Update document
2837
+ * PATCH /api/{collection}/{id}
2838
+ */
2839
+ requestUpdate<T = unknown>(endpoint: string, data?: unknown): Promise<PayloadMutationResponse<T>>;
2840
+ /**
2841
+ * Count documents
2842
+ * GET /api/{collection}/count
2843
+ */
2844
+ requestCount(endpoint: string, options?: ApiQueryOptions): Promise<{
2845
+ totalDocs: number;
2846
+ }>;
2847
+ /**
2848
+ * Update multiple documents (bulk update)
2849
+ * PATCH /api/{collection}
2850
+ */
2851
+ requestUpdateMany<T = unknown>(endpoint: string, data: {
2852
+ where?: unknown;
2853
+ data: unknown;
2854
+ }): Promise<PayloadFindResponse<T>>;
2855
+ /**
2856
+ * Delete document
2857
+ * DELETE /api/{collection}/{id}
2858
+ */
2859
+ requestDelete<T = unknown>(endpoint: string): Promise<T>;
2860
+ /**
2861
+ * Delete multiple documents (bulk delete)
2862
+ * DELETE /api/{collection}
2863
+ */
2864
+ requestDeleteMany<T = unknown>(endpoint: string, data: {
2865
+ where?: unknown;
2866
+ }): Promise<PayloadFindResponse<T>>;
2806
2867
  }
2807
2868
 
2808
2869
  declare class CollectionQueryBuilder<T extends Collection> {
2809
2870
  private api;
2810
2871
  private collection;
2811
2872
  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>>;
2873
+ /**
2874
+ * Find documents (list query)
2875
+ * GET /api/{collection}
2876
+ * @returns Payload CMS find response with docs array and pagination
2877
+ */
2878
+ find(options?: ApiQueryOptions): Promise<PayloadFindResponse<CollectionType<T>>>;
2879
+ /**
2880
+ * Find document by ID
2881
+ * GET /api/{collection}/{id}
2882
+ * @returns Document object directly (no wrapper)
2883
+ */
2884
+ findById(id: number | string, options?: ApiQueryOptions): Promise<CollectionType<T>>;
2885
+ /**
2886
+ * Create a new document
2887
+ * POST /api/{collection}
2888
+ * @returns Payload CMS mutation response with doc and message
2889
+ */
2890
+ create(data: Partial<CollectionType<T>>): Promise<PayloadMutationResponse<CollectionType<T>>>;
2891
+ /**
2892
+ * Update a document by ID
2893
+ * PATCH /api/{collection}/{id}
2894
+ * @returns Payload CMS mutation response with doc and message
2895
+ */
2896
+ update(id: number | string, data: Partial<CollectionType<T>>): Promise<PayloadMutationResponse<CollectionType<T>>>;
2897
+ /**
2898
+ * Count documents
2899
+ * GET /api/{collection}/count
2900
+ * @returns Count response with totalDocs
2901
+ */
2902
+ count(options?: ApiQueryOptions): Promise<{
2903
+ totalDocs: number;
2904
+ }>;
2905
+ /**
2906
+ * Update multiple documents (bulk update)
2907
+ * PATCH /api/{collection}
2908
+ * @returns Payload CMS find response with updated docs
2909
+ */
2910
+ updateMany(where: ApiQueryOptions['where'], data: Partial<CollectionType<T>>): Promise<PayloadFindResponse<CollectionType<T>>>;
2911
+ /**
2912
+ * Delete a document by ID
2913
+ * DELETE /api/{collection}/{id}
2914
+ * @returns Deleted document object directly (no wrapper)
2915
+ */
2916
+ remove(id: number | string): Promise<CollectionType<T>>;
2917
+ /**
2918
+ * Delete multiple documents (bulk delete)
2919
+ * DELETE /api/{collection}
2920
+ * @returns Payload CMS find response with deleted docs
2921
+ */
2922
+ removeMany(where: ApiQueryOptions['where']): Promise<PayloadFindResponse<CollectionType<T>>>;
2817
2923
  }
2818
2924
 
2819
2925
  interface UnifiedQueryOptions {
@@ -2872,7 +2978,7 @@ declare class UnifiedQueryClient {
2872
2978
  refetchOnMount?: boolean;
2873
2979
  refetchInterval?: number | false;
2874
2980
  retry?: boolean | number;
2875
- }): _tanstack_react_query.UseQueryResult<_tanstack_react_query.NoInfer<CollectionType<T> | null>, Error>;
2981
+ }): _tanstack_react_query.UseQueryResult<_tanstack_react_query.NoInfer<CollectionType<T>>, Error>;
2876
2982
  useSuspenseQueryById<T extends Collection>(params: CollectionDetailQueryParams<T>, options?: {
2877
2983
  staleTime?: number;
2878
2984
  gcTime?: number;
@@ -2880,7 +2986,7 @@ declare class UnifiedQueryClient {
2880
2986
  refetchOnMount?: boolean;
2881
2987
  refetchInterval?: number | false;
2882
2988
  retry?: boolean | number;
2883
- }): _tanstack_react_query.UseSuspenseQueryResult<CollectionType<T> | null, Error>;
2989
+ }): _tanstack_react_query.UseSuspenseQueryResult<CollectionType<T>, Error>;
2884
2990
  useInfiniteQuery<T extends Collection>(params: CollectionInfiniteQueryParams<T>, options?: {
2885
2991
  enabled?: boolean;
2886
2992
  staleTime?: number;
@@ -2888,14 +2994,14 @@ declare class UnifiedQueryClient {
2888
2994
  refetchOnWindowFocus?: boolean;
2889
2995
  refetchOnMount?: boolean;
2890
2996
  retry?: boolean | number;
2891
- }): _tanstack_react_query.UseInfiniteQueryResult<_tanstack_react_query.InfiniteData<CollectionType<T>[], unknown>, Error>;
2997
+ }): _tanstack_react_query.UseInfiniteQueryResult<_tanstack_react_query.InfiniteData<PayloadFindResponse<CollectionType<T>>, unknown>, Error>;
2892
2998
  useSuspenseInfiniteQuery<T extends Collection>(params: CollectionInfiniteQueryParams<T>, options?: {
2893
2999
  staleTime?: number;
2894
3000
  gcTime?: number;
2895
3001
  refetchOnWindowFocus?: boolean;
2896
3002
  refetchOnMount?: boolean;
2897
3003
  retry?: boolean | number;
2898
- }): _tanstack_react_query.UseSuspenseInfiniteQueryResult<_tanstack_react_query.InfiniteData<CollectionType<T>[], unknown>, Error>;
3004
+ }): _tanstack_react_query.UseSuspenseInfiniteQueryResult<_tanstack_react_query.InfiniteData<PayloadFindResponse<CollectionType<T>>, unknown>, Error>;
2899
3005
  prefetchQuery<T extends Collection>(params: CollectionQueryParams<T>, options?: {
2900
3006
  staleTime?: number;
2901
3007
  }): Promise<void>;
@@ -3014,4 +3120,4 @@ interface RichTextContentProps {
3014
3120
  }
3015
3121
  declare function RichTextContent({ data, className, internalDocToHref, blocks, }: RichTextContentProps): React.JSX.Element;
3016
3122
 
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 };
3123
+ 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 };