@01.software/sdk 0.2.7 → 0.2.9-dev.260305.4f1735b
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/README.md +11 -2
- package/dist/{auth-ZBsN9vPn.d.cts → auth-3qWmYUln.d.cts} +1 -1
- package/dist/{auth-D-_Ju7m5.d.ts → auth-BfGmV75P.d.ts} +1 -1
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +2 -2
- package/dist/auth.d.ts +2 -2
- package/dist/auth.js.map +1 -1
- package/dist/components.d.cts +1 -1
- package/dist/components.d.ts +1 -1
- package/dist/index.cjs +68 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +48 -21
- package/dist/index.d.ts +48 -21
- package/dist/index.js +68 -15
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-CRSz8jfP.d.cts → payload-types-Bpi16SHO.d.cts} +79 -79
- package/dist/{payload-types-CRSz8jfP.d.ts → payload-types-Bpi16SHO.d.ts} +79 -79
- package/dist/{webhook-C_DHB0Sw.d.ts → webhook-Bk-i0A59.d.ts} +1 -1
- package/dist/{webhook-Dn5o0LXq.d.cts → webhook-DMN-IPra.d.cts} +1 -1
- package/dist/webhook.d.cts +2 -2
- package/dist/webhook.d.ts +2 -2
- package/package.json +12 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, C as CartItem, P as ProductOption } from './payload-types-
|
|
2
|
-
export { k as ApiUsage, ae as ApiUsageSelect, A as Audience, aa as AudiencesSelect, b0 as Auth, m as BillingHistory, ag as BillingHistorySelect, u as Brand, B as BrandLogo, aq as BrandLogosSelect, ap as BrandsSelect, K as Cart, aG as CartItemsSelect, aF as CartsSelect, f as CodeBlock, a$ as CollectionsWidget, c as Config, w as Customer, z as CustomerAddress, aC as CustomerAddressesSelect, d as CustomerAuthOperations, x as CustomerGroup, y as CustomerGroupImage, aE as CustomerGroupImagesSelect, aD as CustomerGroupsSelect, aB as CustomersSelect, L as Discount, aH as DiscountsSelect, Y as Document, aP as DocumentCategoriesSelect, $ as DocumentCategory, _ as DocumentImage, aR as DocumentImagesSelect, Z as DocumentType, aQ as DocumentTypesSelect, aO as DocumentsSelect, E as EmailLog, ab as EmailLogsSelect, G as Exchange, H as ExchangeProduct,
|
|
3
|
-
import { F as FetchOptions, A as ApiQueryOptions, P as PayloadFindResponse, a as PayloadMutationResponse, C as ClientBrowserConfig, b as ClientState, c as ClientServerConfig } from './auth-
|
|
4
|
-
export { t as API_URLS, f as ApiError, y as ApiQueryReactOptions, w as ClientMetadata, g as ConfigError, d as DebugConfig, D as DeepPartial, s as Environment, e as ErrorLogger, E as ExtractArrayType, J as JwtPayload, N as NetworkError, x as PaginationMeta, R as RetryConfig, S as SDKError, T as TimeoutError, U as UsageLimitError, V as ValidationError, q as createApiKey, o as createServerToken, p as decodeServerToken, k as isApiError, l as isConfigError, h as isNetworkError, i as isSDKError, m as isTimeoutError, n as isUsageLimitError, j as isValidationError, r as parseApiKey, u as resolveApiUrl, v as verifyServerToken } from './auth-
|
|
1
|
+
import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, C as CartItem, P as ProductOption } from './payload-types-Bpi16SHO.cjs';
|
|
2
|
+
export { k as ApiUsage, ae as ApiUsageSelect, A as Audience, aa as AudiencesSelect, b0 as Auth, m as BillingHistory, ag as BillingHistorySelect, u as Brand, B as BrandLogo, aq as BrandLogosSelect, ap as BrandsSelect, K as Cart, aG as CartItemsSelect, aF as CartsSelect, f as CodeBlock, a$ as CollectionsWidget, c as Config, w as Customer, z as CustomerAddress, aC as CustomerAddressesSelect, d as CustomerAuthOperations, x as CustomerGroup, y as CustomerGroupImage, aE as CustomerGroupImagesSelect, aD as CustomerGroupsSelect, aB as CustomersSelect, L as Discount, aH as DiscountsSelect, Y as Document, aP as DocumentCategoriesSelect, $ as DocumentCategory, _ as DocumentImage, aR as DocumentImagesSelect, Z as DocumentType, aQ as DocumentTypesSelect, aO as DocumentsSelect, E as EmailLog, ab as EmailLogsSelect, G as Exchange, H as ExchangeProduct, aA as ExchangeProductsSelect, az as ExchangesSelect, F as Form, a3 as FormSubmission, aW as FormSubmissionsSelect, aV as FormsSelect, J as FulfillmentItem, aw as FulfillmentItemsSelect, av as FulfillmentsSelect, I as IframeBlock, M as Media, a9 as MediaSelect, a1 as Music, aT as MusicsSelect, at as OrderProductsSelect, as as OrdersSelect, a4 as PayloadKv, aX as PayloadKvSelect, a5 as PayloadLockedDocument, aY as PayloadLockedDocumentsSelect, a7 as PayloadMigration, a_ as PayloadMigrationsSelect, a6 as PayloadPreference, aZ as PayloadPreferencesSelect, e as PlayerBlock, a0 as Playlist, a2 as PlaylistImage, aU as PlaylistImagesSelect, aS as PlaylistsSelect, N as Post, V as PostAuthor, aK as PostAuthorsSelect, aL as PostCategoriesSelect, W as PostCategory, Q as PostImage, aN as PostImagesSelect, X as PostTag, aM as PostTagsSelect, aJ as PostsSelect, o as Product, am as ProductCategoriesSelect, r as ProductCategory, t as ProductCollection, ao as ProductCollectionsSelect, p as ProductImage, ar as ProductImagesSelect, al as ProductOptionsSelect, s as ProductTag, an as ProductTagsSelect, q as ProductVariant, ak as ProductVariantsSelect, aj as ProductsSelect, D as ReturnProduct, ay as ReturnProductsSelect, ax as ReturnsSelect, aI as ShippingPoliciesSelect, v as ShippingPolicy, l as Subscription, af as SubscriptionsSelect, S as SupportedTimezones, h as Tenant, n as TenantLogo, ah as TenantLogosSelect, ad as TenantMetadataSelect, i as TenantMetadatum, j as TenantOgImage, ai as TenantOgImagesSelect, ac as TenantsSelect, au as TransactionsSelect, g as User, U as UserAuthOperations, a8 as UsersSelect } from './payload-types-Bpi16SHO.cjs';
|
|
3
|
+
import { F as FetchOptions, A as ApiQueryOptions, P as PayloadFindResponse, a as PayloadMutationResponse, C as ClientBrowserConfig, b as ClientState, c as ClientServerConfig } from './auth-3qWmYUln.cjs';
|
|
4
|
+
export { t as API_URLS, f as ApiError, y as ApiQueryReactOptions, w as ClientMetadata, g as ConfigError, d as DebugConfig, D as DeepPartial, s as Environment, e as ErrorLogger, E as ExtractArrayType, J as JwtPayload, N as NetworkError, x as PaginationMeta, R as RetryConfig, S as SDKError, T as TimeoutError, U as UsageLimitError, V as ValidationError, q as createApiKey, o as createServerToken, p as decodeServerToken, k as isApiError, l as isConfigError, h as isNetworkError, i as isSDKError, m as isTimeoutError, n as isUsageLimitError, j as isValidationError, r as parseApiKey, u as resolveApiUrl, v as verifyServerToken } from './auth-3qWmYUln.cjs';
|
|
5
5
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
6
6
|
import { QueryClient } from '@tanstack/react-query';
|
|
7
|
-
import { P as PublicCollection, C as CollectionType } from './webhook-
|
|
8
|
-
export { b as COLLECTIONS, a as Collection, c as WebhookEvent, d as WebhookHandler, W as WebhookOperation, e as WebhookOptions, f as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-
|
|
7
|
+
import { P as PublicCollection, C as CollectionType } from './webhook-DMN-IPra.cjs';
|
|
8
|
+
export { b as COLLECTIONS, a as Collection, c as WebhookEvent, d as WebhookHandler, W as WebhookOperation, e as WebhookOptions, f as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-DMN-IPra.cjs';
|
|
9
9
|
import { Metadata } from 'next';
|
|
10
10
|
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';
|
|
11
11
|
import 'payload';
|
|
@@ -248,6 +248,16 @@ declare class CollectionClient extends HttpClient {
|
|
|
248
248
|
requestDeleteMany<T = unknown>(endpoint: string, data: {
|
|
249
249
|
where?: unknown;
|
|
250
250
|
}): Promise<PayloadFindResponse<T>>;
|
|
251
|
+
/**
|
|
252
|
+
* Create document with file upload
|
|
253
|
+
* POST /api/{collection} (multipart/form-data)
|
|
254
|
+
*/
|
|
255
|
+
requestCreateWithFile<T = unknown>(endpoint: string, data: unknown, file: File | Blob, filename?: string): Promise<PayloadMutationResponse<T>>;
|
|
256
|
+
/**
|
|
257
|
+
* Update document with file upload
|
|
258
|
+
* PATCH /api/{collection}/{id} (multipart/form-data)
|
|
259
|
+
*/
|
|
260
|
+
requestUpdateWithFile<T = unknown>(endpoint: string, data: unknown, file: File | Blob, filename?: string): Promise<PayloadMutationResponse<T>>;
|
|
251
261
|
}
|
|
252
262
|
|
|
253
263
|
/**
|
|
@@ -270,19 +280,25 @@ declare class CollectionQueryBuilder<T extends PublicCollection> {
|
|
|
270
280
|
* GET /api/{collection}/{id}
|
|
271
281
|
* @returns Document object directly (no wrapper)
|
|
272
282
|
*/
|
|
273
|
-
findById(id:
|
|
283
|
+
findById(id: string, options?: ApiQueryOptions): Promise<CollectionType<T>>;
|
|
274
284
|
/**
|
|
275
285
|
* Create a new document
|
|
276
286
|
* POST /api/{collection}
|
|
277
287
|
* @returns Payload CMS mutation response with doc and message
|
|
278
288
|
*/
|
|
279
|
-
create(data: Partial<CollectionType<T
|
|
289
|
+
create(data: Partial<CollectionType<T>>, options?: {
|
|
290
|
+
file?: File | Blob;
|
|
291
|
+
filename?: string;
|
|
292
|
+
}): Promise<PayloadMutationResponse<CollectionType<T>>>;
|
|
280
293
|
/**
|
|
281
294
|
* Update a document by ID
|
|
282
295
|
* PATCH /api/{collection}/{id}
|
|
283
296
|
* @returns Payload CMS mutation response with doc and message
|
|
284
297
|
*/
|
|
285
|
-
update(id:
|
|
298
|
+
update(id: string, data: Partial<CollectionType<T>>, options?: {
|
|
299
|
+
file?: File | Blob;
|
|
300
|
+
filename?: string;
|
|
301
|
+
}): Promise<PayloadMutationResponse<CollectionType<T>>>;
|
|
286
302
|
/**
|
|
287
303
|
* Count documents
|
|
288
304
|
* GET /api/{collection}/count
|
|
@@ -302,7 +318,7 @@ declare class CollectionQueryBuilder<T extends PublicCollection> {
|
|
|
302
318
|
* Applies depth: 1 (image populate) automatically.
|
|
303
319
|
* @returns Metadata (throws on 404)
|
|
304
320
|
*/
|
|
305
|
-
findMetadataById(id:
|
|
321
|
+
findMetadataById(id: string, metadataOptions?: GenerateMetadataOptions): Promise<Metadata>;
|
|
306
322
|
/**
|
|
307
323
|
* Update multiple documents (bulk update)
|
|
308
324
|
* PATCH /api/{collection}
|
|
@@ -314,7 +330,7 @@ declare class CollectionQueryBuilder<T extends PublicCollection> {
|
|
|
314
330
|
* DELETE /api/{collection}/{id}
|
|
315
331
|
* @returns Deleted document object directly (no wrapper)
|
|
316
332
|
*/
|
|
317
|
-
remove(id:
|
|
333
|
+
remove(id: string): Promise<CollectionType<T>>;
|
|
318
334
|
/**
|
|
319
335
|
* Delete multiple documents (bulk delete)
|
|
320
336
|
* DELETE /api/{collection}
|
|
@@ -328,11 +344,16 @@ interface CustomerAuthResponse {
|
|
|
328
344
|
customer: CustomerProfile;
|
|
329
345
|
}
|
|
330
346
|
interface CustomerProfile {
|
|
331
|
-
id:
|
|
347
|
+
id: string;
|
|
332
348
|
name: string;
|
|
333
349
|
email?: string | null;
|
|
334
350
|
phone?: string | null;
|
|
351
|
+
authProvider?: 'local' | 'google' | 'apple' | 'kakao' | 'naver' | null;
|
|
352
|
+
isGuest?: boolean | null;
|
|
335
353
|
isVerified?: boolean | null;
|
|
354
|
+
marketingConsent?: boolean | null;
|
|
355
|
+
metadata?: Record<string, unknown> | null;
|
|
356
|
+
groups?: string[];
|
|
336
357
|
}
|
|
337
358
|
interface CustomerRegisterData {
|
|
338
359
|
name: string;
|
|
@@ -437,7 +458,7 @@ declare function collectionKeys<T extends PublicCollection>(collection: T): {
|
|
|
437
458
|
lists: () => readonly [T, "list"];
|
|
438
459
|
list: (options?: ApiQueryOptions) => readonly [T, "list", ApiQueryOptions | undefined];
|
|
439
460
|
details: () => readonly [T, "detail"];
|
|
440
|
-
detail: (id: string
|
|
461
|
+
detail: (id: string, options?: ApiQueryOptions) => readonly [T, "detail", string, ApiQueryOptions | undefined];
|
|
441
462
|
infinites: () => readonly [T, "infinite"];
|
|
442
463
|
infinite: (options?: Omit<ApiQueryOptions, "page">) => readonly [T, "infinite", Omit<ApiQueryOptions, "page"> | undefined];
|
|
443
464
|
};
|
|
@@ -451,7 +472,7 @@ interface CollectionQueryParams<T extends PublicCollection> {
|
|
|
451
472
|
}
|
|
452
473
|
interface CollectionDetailQueryParams<T extends PublicCollection> {
|
|
453
474
|
collection: T;
|
|
454
|
-
id: string
|
|
475
|
+
id: string;
|
|
455
476
|
options?: ApiQueryOptions;
|
|
456
477
|
}
|
|
457
478
|
interface CollectionInfiniteQueryParams<T extends PublicCollection> {
|
|
@@ -531,7 +552,11 @@ declare class QueryHooks {
|
|
|
531
552
|
onSuccess?: (data: PayloadMutationResponse<CollectionType<T>>) => void;
|
|
532
553
|
onError?: (error: Error) => void;
|
|
533
554
|
onSettled?: () => void;
|
|
534
|
-
}): _tanstack_react_query.UseMutationResult<PayloadMutationResponse<CollectionType<T>>, Error,
|
|
555
|
+
}): _tanstack_react_query.UseMutationResult<PayloadMutationResponse<CollectionType<T>>, Error, {
|
|
556
|
+
data: Partial<CollectionType<T>>;
|
|
557
|
+
file?: File | Blob;
|
|
558
|
+
filename?: string;
|
|
559
|
+
}, unknown>;
|
|
535
560
|
useUpdate<T extends PublicCollection>(params: {
|
|
536
561
|
collection: T;
|
|
537
562
|
}, options?: {
|
|
@@ -539,8 +564,10 @@ declare class QueryHooks {
|
|
|
539
564
|
onError?: (error: Error) => void;
|
|
540
565
|
onSettled?: () => void;
|
|
541
566
|
}): _tanstack_react_query.UseMutationResult<PayloadMutationResponse<CollectionType<T>>, Error, {
|
|
542
|
-
id: string
|
|
567
|
+
id: string;
|
|
543
568
|
data: Partial<CollectionType<T>>;
|
|
569
|
+
file?: File | Blob;
|
|
570
|
+
filename?: string;
|
|
544
571
|
}, unknown>;
|
|
545
572
|
useRemove<T extends PublicCollection>(params: {
|
|
546
573
|
collection: T;
|
|
@@ -548,12 +575,12 @@ declare class QueryHooks {
|
|
|
548
575
|
onSuccess?: (data: CollectionType<T>) => void;
|
|
549
576
|
onError?: (error: Error) => void;
|
|
550
577
|
onSettled?: () => void;
|
|
551
|
-
}): _tanstack_react_query.UseMutationResult<CollectionType<T>, Error, string
|
|
578
|
+
}): _tanstack_react_query.UseMutationResult<CollectionType<T>, Error, string, unknown>;
|
|
552
579
|
invalidateQueries<T extends PublicCollection>(collection: T, type?: 'list' | 'detail' | 'infinite'): Promise<void>;
|
|
553
580
|
getQueryData<T extends PublicCollection>(collection: T, type: 'list', options?: ApiQueryOptions): CollectionType<T>[] | undefined;
|
|
554
|
-
getQueryData<T extends PublicCollection>(collection: T, type: 'detail', id: string
|
|
581
|
+
getQueryData<T extends PublicCollection>(collection: T, type: 'detail', id: string, options?: ApiQueryOptions): CollectionType<T> | null | undefined;
|
|
555
582
|
setQueryData<T extends PublicCollection>(collection: T, type: 'list', data: CollectionType<T>[], options?: ApiQueryOptions): void;
|
|
556
|
-
setQueryData<T extends PublicCollection>(collection: T, type: 'detail', id: string
|
|
583
|
+
setQueryData<T extends PublicCollection>(collection: T, type: 'detail', id: string, data: CollectionType<T> | null, options?: ApiQueryOptions): void;
|
|
557
584
|
useCustomerMe(options?: {
|
|
558
585
|
enabled?: boolean;
|
|
559
586
|
staleTime?: number;
|
|
@@ -665,8 +692,8 @@ declare const formatOrderName: (options: ProductOption[]) => string;
|
|
|
665
692
|
* @param ref - The relation field value (T, string, number, null, or undefined)
|
|
666
693
|
* @returns The resolved document object, or null if not populated
|
|
667
694
|
*/
|
|
668
|
-
declare const resolveRelation: <T>(ref: T | string |
|
|
695
|
+
declare const resolveRelation: <T>(ref: T | string | null | undefined) => T | null;
|
|
669
696
|
/** @deprecated Use `resolveRelation` instead */
|
|
670
|
-
declare const objectFor: <T>(ref: T | string |
|
|
697
|
+
declare const objectFor: <T>(ref: T | string | null | undefined) => T | null;
|
|
671
698
|
|
|
672
699
|
export { type AddItemParams, ApiQueryOptions, BrowserClient, BrowserClient as BrowserClientType, CartApi, type CartApiOptions, CartItem, type CheckoutParams, ClientBrowserConfig, ClientServerConfig, ClientState, CollectionClient, type CollectionDetailQueryParams, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, type CreateFulfillmentParams, type CreateOrderParams, type CreateReturnParams, CustomerAuth, type CustomerAuthOptions, type CustomerAuthResponse, type CustomerLoginData, type CustomerProfile, type CustomerRefreshResponse, type CustomerRegisterData, Fulfillment, type GenerateMetadataOptions, type GetOrderParams, Order, OrderApi, type OrderApiOptions, OrderProduct, PayloadFindResponse, PayloadMutationResponse, ProductApi, type ProductApiOptions, ProductOption, PublicCollection, QueryHooks, type ReadOnlyQueryBuilder, type ReadOnlyQueryHooks, type RemoveItemParams, Return, type ReturnWithRefundParams, ServerClient, ServerClient as ServerClientType, type StockCheckParams, type StockCheckResponse, type StockCheckResult, Transaction, type UpdateItemParams, type UpdateOrderParams, type UpdateReturnParams, type UpdateTransactionParams, collectionKeys, createBrowserClient, createServerClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, objectFor, resolveRelation };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, C as CartItem, P as ProductOption } from './payload-types-
|
|
2
|
-
export { k as ApiUsage, ae as ApiUsageSelect, A as Audience, aa as AudiencesSelect, b0 as Auth, m as BillingHistory, ag as BillingHistorySelect, u as Brand, B as BrandLogo, aq as BrandLogosSelect, ap as BrandsSelect, K as Cart, aG as CartItemsSelect, aF as CartsSelect, f as CodeBlock, a$ as CollectionsWidget, c as Config, w as Customer, z as CustomerAddress, aC as CustomerAddressesSelect, d as CustomerAuthOperations, x as CustomerGroup, y as CustomerGroupImage, aE as CustomerGroupImagesSelect, aD as CustomerGroupsSelect, aB as CustomersSelect, L as Discount, aH as DiscountsSelect, Y as Document, aP as DocumentCategoriesSelect, $ as DocumentCategory, _ as DocumentImage, aR as DocumentImagesSelect, Z as DocumentType, aQ as DocumentTypesSelect, aO as DocumentsSelect, E as EmailLog, ab as EmailLogsSelect, G as Exchange, H as ExchangeProduct,
|
|
3
|
-
import { F as FetchOptions, A as ApiQueryOptions, P as PayloadFindResponse, a as PayloadMutationResponse, C as ClientBrowserConfig, b as ClientState, c as ClientServerConfig } from './auth-
|
|
4
|
-
export { t as API_URLS, f as ApiError, y as ApiQueryReactOptions, w as ClientMetadata, g as ConfigError, d as DebugConfig, D as DeepPartial, s as Environment, e as ErrorLogger, E as ExtractArrayType, J as JwtPayload, N as NetworkError, x as PaginationMeta, R as RetryConfig, S as SDKError, T as TimeoutError, U as UsageLimitError, V as ValidationError, q as createApiKey, o as createServerToken, p as decodeServerToken, k as isApiError, l as isConfigError, h as isNetworkError, i as isSDKError, m as isTimeoutError, n as isUsageLimitError, j as isValidationError, r as parseApiKey, u as resolveApiUrl, v as verifyServerToken } from './auth-
|
|
1
|
+
import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, C as CartItem, P as ProductOption } from './payload-types-Bpi16SHO.js';
|
|
2
|
+
export { k as ApiUsage, ae as ApiUsageSelect, A as Audience, aa as AudiencesSelect, b0 as Auth, m as BillingHistory, ag as BillingHistorySelect, u as Brand, B as BrandLogo, aq as BrandLogosSelect, ap as BrandsSelect, K as Cart, aG as CartItemsSelect, aF as CartsSelect, f as CodeBlock, a$ as CollectionsWidget, c as Config, w as Customer, z as CustomerAddress, aC as CustomerAddressesSelect, d as CustomerAuthOperations, x as CustomerGroup, y as CustomerGroupImage, aE as CustomerGroupImagesSelect, aD as CustomerGroupsSelect, aB as CustomersSelect, L as Discount, aH as DiscountsSelect, Y as Document, aP as DocumentCategoriesSelect, $ as DocumentCategory, _ as DocumentImage, aR as DocumentImagesSelect, Z as DocumentType, aQ as DocumentTypesSelect, aO as DocumentsSelect, E as EmailLog, ab as EmailLogsSelect, G as Exchange, H as ExchangeProduct, aA as ExchangeProductsSelect, az as ExchangesSelect, F as Form, a3 as FormSubmission, aW as FormSubmissionsSelect, aV as FormsSelect, J as FulfillmentItem, aw as FulfillmentItemsSelect, av as FulfillmentsSelect, I as IframeBlock, M as Media, a9 as MediaSelect, a1 as Music, aT as MusicsSelect, at as OrderProductsSelect, as as OrdersSelect, a4 as PayloadKv, aX as PayloadKvSelect, a5 as PayloadLockedDocument, aY as PayloadLockedDocumentsSelect, a7 as PayloadMigration, a_ as PayloadMigrationsSelect, a6 as PayloadPreference, aZ as PayloadPreferencesSelect, e as PlayerBlock, a0 as Playlist, a2 as PlaylistImage, aU as PlaylistImagesSelect, aS as PlaylistsSelect, N as Post, V as PostAuthor, aK as PostAuthorsSelect, aL as PostCategoriesSelect, W as PostCategory, Q as PostImage, aN as PostImagesSelect, X as PostTag, aM as PostTagsSelect, aJ as PostsSelect, o as Product, am as ProductCategoriesSelect, r as ProductCategory, t as ProductCollection, ao as ProductCollectionsSelect, p as ProductImage, ar as ProductImagesSelect, al as ProductOptionsSelect, s as ProductTag, an as ProductTagsSelect, q as ProductVariant, ak as ProductVariantsSelect, aj as ProductsSelect, D as ReturnProduct, ay as ReturnProductsSelect, ax as ReturnsSelect, aI as ShippingPoliciesSelect, v as ShippingPolicy, l as Subscription, af as SubscriptionsSelect, S as SupportedTimezones, h as Tenant, n as TenantLogo, ah as TenantLogosSelect, ad as TenantMetadataSelect, i as TenantMetadatum, j as TenantOgImage, ai as TenantOgImagesSelect, ac as TenantsSelect, au as TransactionsSelect, g as User, U as UserAuthOperations, a8 as UsersSelect } from './payload-types-Bpi16SHO.js';
|
|
3
|
+
import { F as FetchOptions, A as ApiQueryOptions, P as PayloadFindResponse, a as PayloadMutationResponse, C as ClientBrowserConfig, b as ClientState, c as ClientServerConfig } from './auth-BfGmV75P.js';
|
|
4
|
+
export { t as API_URLS, f as ApiError, y as ApiQueryReactOptions, w as ClientMetadata, g as ConfigError, d as DebugConfig, D as DeepPartial, s as Environment, e as ErrorLogger, E as ExtractArrayType, J as JwtPayload, N as NetworkError, x as PaginationMeta, R as RetryConfig, S as SDKError, T as TimeoutError, U as UsageLimitError, V as ValidationError, q as createApiKey, o as createServerToken, p as decodeServerToken, k as isApiError, l as isConfigError, h as isNetworkError, i as isSDKError, m as isTimeoutError, n as isUsageLimitError, j as isValidationError, r as parseApiKey, u as resolveApiUrl, v as verifyServerToken } from './auth-BfGmV75P.js';
|
|
5
5
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
6
6
|
import { QueryClient } from '@tanstack/react-query';
|
|
7
|
-
import { P as PublicCollection, C as CollectionType } from './webhook-
|
|
8
|
-
export { b as COLLECTIONS, a as Collection, c as WebhookEvent, d as WebhookHandler, W as WebhookOperation, e as WebhookOptions, f as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-
|
|
7
|
+
import { P as PublicCollection, C as CollectionType } from './webhook-Bk-i0A59.js';
|
|
8
|
+
export { b as COLLECTIONS, a as Collection, c as WebhookEvent, d as WebhookHandler, W as WebhookOperation, e as WebhookOptions, f as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-Bk-i0A59.js';
|
|
9
9
|
import { Metadata } from 'next';
|
|
10
10
|
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';
|
|
11
11
|
import 'payload';
|
|
@@ -248,6 +248,16 @@ declare class CollectionClient extends HttpClient {
|
|
|
248
248
|
requestDeleteMany<T = unknown>(endpoint: string, data: {
|
|
249
249
|
where?: unknown;
|
|
250
250
|
}): Promise<PayloadFindResponse<T>>;
|
|
251
|
+
/**
|
|
252
|
+
* Create document with file upload
|
|
253
|
+
* POST /api/{collection} (multipart/form-data)
|
|
254
|
+
*/
|
|
255
|
+
requestCreateWithFile<T = unknown>(endpoint: string, data: unknown, file: File | Blob, filename?: string): Promise<PayloadMutationResponse<T>>;
|
|
256
|
+
/**
|
|
257
|
+
* Update document with file upload
|
|
258
|
+
* PATCH /api/{collection}/{id} (multipart/form-data)
|
|
259
|
+
*/
|
|
260
|
+
requestUpdateWithFile<T = unknown>(endpoint: string, data: unknown, file: File | Blob, filename?: string): Promise<PayloadMutationResponse<T>>;
|
|
251
261
|
}
|
|
252
262
|
|
|
253
263
|
/**
|
|
@@ -270,19 +280,25 @@ declare class CollectionQueryBuilder<T extends PublicCollection> {
|
|
|
270
280
|
* GET /api/{collection}/{id}
|
|
271
281
|
* @returns Document object directly (no wrapper)
|
|
272
282
|
*/
|
|
273
|
-
findById(id:
|
|
283
|
+
findById(id: string, options?: ApiQueryOptions): Promise<CollectionType<T>>;
|
|
274
284
|
/**
|
|
275
285
|
* Create a new document
|
|
276
286
|
* POST /api/{collection}
|
|
277
287
|
* @returns Payload CMS mutation response with doc and message
|
|
278
288
|
*/
|
|
279
|
-
create(data: Partial<CollectionType<T
|
|
289
|
+
create(data: Partial<CollectionType<T>>, options?: {
|
|
290
|
+
file?: File | Blob;
|
|
291
|
+
filename?: string;
|
|
292
|
+
}): Promise<PayloadMutationResponse<CollectionType<T>>>;
|
|
280
293
|
/**
|
|
281
294
|
* Update a document by ID
|
|
282
295
|
* PATCH /api/{collection}/{id}
|
|
283
296
|
* @returns Payload CMS mutation response with doc and message
|
|
284
297
|
*/
|
|
285
|
-
update(id:
|
|
298
|
+
update(id: string, data: Partial<CollectionType<T>>, options?: {
|
|
299
|
+
file?: File | Blob;
|
|
300
|
+
filename?: string;
|
|
301
|
+
}): Promise<PayloadMutationResponse<CollectionType<T>>>;
|
|
286
302
|
/**
|
|
287
303
|
* Count documents
|
|
288
304
|
* GET /api/{collection}/count
|
|
@@ -302,7 +318,7 @@ declare class CollectionQueryBuilder<T extends PublicCollection> {
|
|
|
302
318
|
* Applies depth: 1 (image populate) automatically.
|
|
303
319
|
* @returns Metadata (throws on 404)
|
|
304
320
|
*/
|
|
305
|
-
findMetadataById(id:
|
|
321
|
+
findMetadataById(id: string, metadataOptions?: GenerateMetadataOptions): Promise<Metadata>;
|
|
306
322
|
/**
|
|
307
323
|
* Update multiple documents (bulk update)
|
|
308
324
|
* PATCH /api/{collection}
|
|
@@ -314,7 +330,7 @@ declare class CollectionQueryBuilder<T extends PublicCollection> {
|
|
|
314
330
|
* DELETE /api/{collection}/{id}
|
|
315
331
|
* @returns Deleted document object directly (no wrapper)
|
|
316
332
|
*/
|
|
317
|
-
remove(id:
|
|
333
|
+
remove(id: string): Promise<CollectionType<T>>;
|
|
318
334
|
/**
|
|
319
335
|
* Delete multiple documents (bulk delete)
|
|
320
336
|
* DELETE /api/{collection}
|
|
@@ -328,11 +344,16 @@ interface CustomerAuthResponse {
|
|
|
328
344
|
customer: CustomerProfile;
|
|
329
345
|
}
|
|
330
346
|
interface CustomerProfile {
|
|
331
|
-
id:
|
|
347
|
+
id: string;
|
|
332
348
|
name: string;
|
|
333
349
|
email?: string | null;
|
|
334
350
|
phone?: string | null;
|
|
351
|
+
authProvider?: 'local' | 'google' | 'apple' | 'kakao' | 'naver' | null;
|
|
352
|
+
isGuest?: boolean | null;
|
|
335
353
|
isVerified?: boolean | null;
|
|
354
|
+
marketingConsent?: boolean | null;
|
|
355
|
+
metadata?: Record<string, unknown> | null;
|
|
356
|
+
groups?: string[];
|
|
336
357
|
}
|
|
337
358
|
interface CustomerRegisterData {
|
|
338
359
|
name: string;
|
|
@@ -437,7 +458,7 @@ declare function collectionKeys<T extends PublicCollection>(collection: T): {
|
|
|
437
458
|
lists: () => readonly [T, "list"];
|
|
438
459
|
list: (options?: ApiQueryOptions) => readonly [T, "list", ApiQueryOptions | undefined];
|
|
439
460
|
details: () => readonly [T, "detail"];
|
|
440
|
-
detail: (id: string
|
|
461
|
+
detail: (id: string, options?: ApiQueryOptions) => readonly [T, "detail", string, ApiQueryOptions | undefined];
|
|
441
462
|
infinites: () => readonly [T, "infinite"];
|
|
442
463
|
infinite: (options?: Omit<ApiQueryOptions, "page">) => readonly [T, "infinite", Omit<ApiQueryOptions, "page"> | undefined];
|
|
443
464
|
};
|
|
@@ -451,7 +472,7 @@ interface CollectionQueryParams<T extends PublicCollection> {
|
|
|
451
472
|
}
|
|
452
473
|
interface CollectionDetailQueryParams<T extends PublicCollection> {
|
|
453
474
|
collection: T;
|
|
454
|
-
id: string
|
|
475
|
+
id: string;
|
|
455
476
|
options?: ApiQueryOptions;
|
|
456
477
|
}
|
|
457
478
|
interface CollectionInfiniteQueryParams<T extends PublicCollection> {
|
|
@@ -531,7 +552,11 @@ declare class QueryHooks {
|
|
|
531
552
|
onSuccess?: (data: PayloadMutationResponse<CollectionType<T>>) => void;
|
|
532
553
|
onError?: (error: Error) => void;
|
|
533
554
|
onSettled?: () => void;
|
|
534
|
-
}): _tanstack_react_query.UseMutationResult<PayloadMutationResponse<CollectionType<T>>, Error,
|
|
555
|
+
}): _tanstack_react_query.UseMutationResult<PayloadMutationResponse<CollectionType<T>>, Error, {
|
|
556
|
+
data: Partial<CollectionType<T>>;
|
|
557
|
+
file?: File | Blob;
|
|
558
|
+
filename?: string;
|
|
559
|
+
}, unknown>;
|
|
535
560
|
useUpdate<T extends PublicCollection>(params: {
|
|
536
561
|
collection: T;
|
|
537
562
|
}, options?: {
|
|
@@ -539,8 +564,10 @@ declare class QueryHooks {
|
|
|
539
564
|
onError?: (error: Error) => void;
|
|
540
565
|
onSettled?: () => void;
|
|
541
566
|
}): _tanstack_react_query.UseMutationResult<PayloadMutationResponse<CollectionType<T>>, Error, {
|
|
542
|
-
id: string
|
|
567
|
+
id: string;
|
|
543
568
|
data: Partial<CollectionType<T>>;
|
|
569
|
+
file?: File | Blob;
|
|
570
|
+
filename?: string;
|
|
544
571
|
}, unknown>;
|
|
545
572
|
useRemove<T extends PublicCollection>(params: {
|
|
546
573
|
collection: T;
|
|
@@ -548,12 +575,12 @@ declare class QueryHooks {
|
|
|
548
575
|
onSuccess?: (data: CollectionType<T>) => void;
|
|
549
576
|
onError?: (error: Error) => void;
|
|
550
577
|
onSettled?: () => void;
|
|
551
|
-
}): _tanstack_react_query.UseMutationResult<CollectionType<T>, Error, string
|
|
578
|
+
}): _tanstack_react_query.UseMutationResult<CollectionType<T>, Error, string, unknown>;
|
|
552
579
|
invalidateQueries<T extends PublicCollection>(collection: T, type?: 'list' | 'detail' | 'infinite'): Promise<void>;
|
|
553
580
|
getQueryData<T extends PublicCollection>(collection: T, type: 'list', options?: ApiQueryOptions): CollectionType<T>[] | undefined;
|
|
554
|
-
getQueryData<T extends PublicCollection>(collection: T, type: 'detail', id: string
|
|
581
|
+
getQueryData<T extends PublicCollection>(collection: T, type: 'detail', id: string, options?: ApiQueryOptions): CollectionType<T> | null | undefined;
|
|
555
582
|
setQueryData<T extends PublicCollection>(collection: T, type: 'list', data: CollectionType<T>[], options?: ApiQueryOptions): void;
|
|
556
|
-
setQueryData<T extends PublicCollection>(collection: T, type: 'detail', id: string
|
|
583
|
+
setQueryData<T extends PublicCollection>(collection: T, type: 'detail', id: string, data: CollectionType<T> | null, options?: ApiQueryOptions): void;
|
|
557
584
|
useCustomerMe(options?: {
|
|
558
585
|
enabled?: boolean;
|
|
559
586
|
staleTime?: number;
|
|
@@ -665,8 +692,8 @@ declare const formatOrderName: (options: ProductOption[]) => string;
|
|
|
665
692
|
* @param ref - The relation field value (T, string, number, null, or undefined)
|
|
666
693
|
* @returns The resolved document object, or null if not populated
|
|
667
694
|
*/
|
|
668
|
-
declare const resolveRelation: <T>(ref: T | string |
|
|
695
|
+
declare const resolveRelation: <T>(ref: T | string | null | undefined) => T | null;
|
|
669
696
|
/** @deprecated Use `resolveRelation` instead */
|
|
670
|
-
declare const objectFor: <T>(ref: T | string |
|
|
697
|
+
declare const objectFor: <T>(ref: T | string | null | undefined) => T | null;
|
|
671
698
|
|
|
672
699
|
export { type AddItemParams, ApiQueryOptions, BrowserClient, BrowserClient as BrowserClientType, CartApi, type CartApiOptions, CartItem, type CheckoutParams, ClientBrowserConfig, ClientServerConfig, ClientState, CollectionClient, type CollectionDetailQueryParams, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, type CreateFulfillmentParams, type CreateOrderParams, type CreateReturnParams, CustomerAuth, type CustomerAuthOptions, type CustomerAuthResponse, type CustomerLoginData, type CustomerProfile, type CustomerRefreshResponse, type CustomerRegisterData, Fulfillment, type GenerateMetadataOptions, type GetOrderParams, Order, OrderApi, type OrderApiOptions, OrderProduct, PayloadFindResponse, PayloadMutationResponse, ProductApi, type ProductApiOptions, ProductOption, PublicCollection, QueryHooks, type ReadOnlyQueryBuilder, type ReadOnlyQueryHooks, type RemoveItemParams, Return, type ReturnWithRefundParams, ServerClient, ServerClient as ServerClientType, type StockCheckParams, type StockCheckResponse, type StockCheckResult, Transaction, type UpdateItemParams, type UpdateOrderParams, type UpdateReturnParams, type UpdateTransactionParams, collectionKeys, createBrowserClient, createServerClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, objectFor, resolveRelation };
|
package/dist/index.js
CHANGED
|
@@ -317,7 +317,7 @@ function _fetch(url, options) {
|
|
|
317
317
|
if (authToken) {
|
|
318
318
|
headers.set("Authorization", `Bearer ${authToken}`);
|
|
319
319
|
}
|
|
320
|
-
if (!headers.has("Content-Type") && requestInit.body) {
|
|
320
|
+
if (!headers.has("Content-Type") && requestInit.body && !(requestInit.body instanceof FormData)) {
|
|
321
321
|
headers.set("Content-Type", "application/json");
|
|
322
322
|
}
|
|
323
323
|
const redactedHeaders = Object.fromEntries(headers.entries());
|
|
@@ -633,7 +633,7 @@ var ProductApi = class {
|
|
|
633
633
|
|
|
634
634
|
// src/utils/types.ts
|
|
635
635
|
var resolveRelation = (ref) => {
|
|
636
|
-
if (typeof ref === "string" ||
|
|
636
|
+
if (typeof ref === "string" || ref === null || ref === void 0)
|
|
637
637
|
return null;
|
|
638
638
|
return ref;
|
|
639
639
|
};
|
|
@@ -721,12 +721,18 @@ var CollectionQueryBuilder = class {
|
|
|
721
721
|
* POST /api/{collection}
|
|
722
722
|
* @returns Payload CMS mutation response with doc and message
|
|
723
723
|
*/
|
|
724
|
-
create(data) {
|
|
724
|
+
create(data, options) {
|
|
725
725
|
return __async(this, null, function* () {
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
726
|
+
const endpoint = `/api/${String(this.collection)}`;
|
|
727
|
+
if (options == null ? void 0 : options.file) {
|
|
728
|
+
return this.api.requestCreateWithFile(
|
|
729
|
+
endpoint,
|
|
730
|
+
data,
|
|
731
|
+
options.file,
|
|
732
|
+
options.filename
|
|
733
|
+
);
|
|
734
|
+
}
|
|
735
|
+
return this.api.requestCreate(endpoint, data);
|
|
730
736
|
});
|
|
731
737
|
}
|
|
732
738
|
/**
|
|
@@ -734,12 +740,18 @@ var CollectionQueryBuilder = class {
|
|
|
734
740
|
* PATCH /api/{collection}/{id}
|
|
735
741
|
* @returns Payload CMS mutation response with doc and message
|
|
736
742
|
*/
|
|
737
|
-
update(id, data) {
|
|
743
|
+
update(id, data, options) {
|
|
738
744
|
return __async(this, null, function* () {
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
745
|
+
const endpoint = `/api/${String(this.collection)}/${String(id)}`;
|
|
746
|
+
if (options == null ? void 0 : options.file) {
|
|
747
|
+
return this.api.requestUpdateWithFile(
|
|
748
|
+
endpoint,
|
|
749
|
+
data,
|
|
750
|
+
options.file,
|
|
751
|
+
options.filename
|
|
752
|
+
);
|
|
753
|
+
}
|
|
754
|
+
return this.api.requestUpdate(endpoint, data);
|
|
743
755
|
});
|
|
744
756
|
}
|
|
745
757
|
/**
|
|
@@ -939,6 +951,14 @@ var HttpClient = class {
|
|
|
939
951
|
};
|
|
940
952
|
|
|
941
953
|
// src/core/collection/collection-client.ts
|
|
954
|
+
function buildPayloadFormData(data, file, filename) {
|
|
955
|
+
const formData = new FormData();
|
|
956
|
+
formData.append("file", file, filename);
|
|
957
|
+
if (data != null) {
|
|
958
|
+
formData.append("_payload", JSON.stringify(data));
|
|
959
|
+
}
|
|
960
|
+
return formData;
|
|
961
|
+
}
|
|
942
962
|
var CollectionClient = class extends HttpClient {
|
|
943
963
|
constructor(clientKey, secretKey, baseUrl, getCustomerToken) {
|
|
944
964
|
super(clientKey, secretKey, baseUrl, getCustomerToken);
|
|
@@ -1046,6 +1066,32 @@ var CollectionClient = class extends HttpClient {
|
|
|
1046
1066
|
return this.parseFindResponse(response);
|
|
1047
1067
|
});
|
|
1048
1068
|
}
|
|
1069
|
+
/**
|
|
1070
|
+
* Create document with file upload
|
|
1071
|
+
* POST /api/{collection} (multipart/form-data)
|
|
1072
|
+
*/
|
|
1073
|
+
requestCreateWithFile(endpoint, data, file, filename) {
|
|
1074
|
+
return __async(this, null, function* () {
|
|
1075
|
+
const response = yield _fetch(endpoint, __spreadProps(__spreadValues({}, this.defaultOptions), {
|
|
1076
|
+
method: "POST",
|
|
1077
|
+
body: buildPayloadFormData(data, file, filename)
|
|
1078
|
+
}));
|
|
1079
|
+
return this.parseMutationResponse(response);
|
|
1080
|
+
});
|
|
1081
|
+
}
|
|
1082
|
+
/**
|
|
1083
|
+
* Update document with file upload
|
|
1084
|
+
* PATCH /api/{collection}/{id} (multipart/form-data)
|
|
1085
|
+
*/
|
|
1086
|
+
requestUpdateWithFile(endpoint, data, file, filename) {
|
|
1087
|
+
return __async(this, null, function* () {
|
|
1088
|
+
const response = yield _fetch(endpoint, __spreadProps(__spreadValues({}, this.defaultOptions), {
|
|
1089
|
+
method: "PATCH",
|
|
1090
|
+
body: buildPayloadFormData(data, file, filename)
|
|
1091
|
+
}));
|
|
1092
|
+
return this.parseMutationResponse(response);
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1049
1095
|
};
|
|
1050
1096
|
|
|
1051
1097
|
// src/core/collection/const.ts
|
|
@@ -1494,8 +1540,11 @@ var QueryHooks = class {
|
|
|
1494
1540
|
useCreate(params, options) {
|
|
1495
1541
|
const { collection } = params;
|
|
1496
1542
|
return useMutationOriginal({
|
|
1497
|
-
mutationFn: (
|
|
1498
|
-
return yield this.collectionClient.from(collection).create(
|
|
1543
|
+
mutationFn: (variables) => __async(this, null, function* () {
|
|
1544
|
+
return yield this.collectionClient.from(collection).create(
|
|
1545
|
+
variables.data,
|
|
1546
|
+
variables.file ? { file: variables.file, filename: variables.filename } : void 0
|
|
1547
|
+
);
|
|
1499
1548
|
}),
|
|
1500
1549
|
onSuccess: (data) => {
|
|
1501
1550
|
var _a;
|
|
@@ -1510,7 +1559,11 @@ var QueryHooks = class {
|
|
|
1510
1559
|
const { collection } = params;
|
|
1511
1560
|
return useMutationOriginal({
|
|
1512
1561
|
mutationFn: (variables) => __async(this, null, function* () {
|
|
1513
|
-
return yield this.collectionClient.from(collection).update(
|
|
1562
|
+
return yield this.collectionClient.from(collection).update(
|
|
1563
|
+
variables.id,
|
|
1564
|
+
variables.data,
|
|
1565
|
+
variables.file ? { file: variables.file, filename: variables.filename } : void 0
|
|
1566
|
+
);
|
|
1514
1567
|
}),
|
|
1515
1568
|
onSuccess: (data) => {
|
|
1516
1569
|
var _a;
|