@01.software/sdk 0.5.9 → 0.6.0
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 +12 -0
- package/dist/auth.d.cts +1 -1
- package/dist/auth.d.ts +1 -1
- package/dist/{const-EdTT21dc.d.ts → const-Bk3-zigV.d.ts} +2 -2
- package/dist/{const-rK0y0s2r.d.cts → const-DQZQAXex.d.cts} +2 -2
- package/dist/index.cjs +210 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +207 -8
- package/dist/index.d.ts +207 -8
- package/dist/index.js +210 -3
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-D70l0uF9.d.cts → payload-types-DCVm1syH.d.cts} +387 -3
- package/dist/{payload-types-D70l0uF9.d.ts → payload-types-DCVm1syH.d.ts} +387 -3
- package/dist/realtime.cjs.map +1 -1
- package/dist/realtime.d.cts +2 -2
- package/dist/realtime.d.ts +2 -2
- package/dist/realtime.js.map +1 -1
- package/dist/ui/form.d.cts +1 -1
- package/dist/ui/form.d.ts +1 -1
- package/dist/ui/video.d.cts +1 -1
- package/dist/ui/video.d.ts +1 -1
- package/dist/{webhook-BVU0Qfsu.d.ts → webhook-BTtG_8f2.d.ts} +2 -2
- package/dist/{webhook-C_aXaaBz.d.cts → webhook-TDfT7aKA.d.cts} +2 -2
- package/dist/webhook.d.cts +3 -3
- package/dist/webhook.d.ts +3 -3
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, E as Exchange, c as Cart, d as CartItem, P as Product } from './payload-types-
|
|
2
|
-
export { o as ApiUsage,
|
|
1
|
+
import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, E as Exchange, c as Cart, d as CartItem, P as Product } from './payload-types-DCVm1syH.cjs';
|
|
2
|
+
export { o as ApiUsage, aF as ApiUsageSelect, A as Audience, aB as AudiencesSelect, bO as Auth, q as BillingHistory, aH as BillingHistorySelect, ap as Bookmark, bD as BookmarksSelect, y as Brand, B as BrandLogo, aQ as BrandLogosSelect, aP as BrandsSelect, b4 as CartItemsSelect, b3 as CartsSelect, g as CodeBlock, bN as CollectionsWidget, am as Comment, bA as CommentsSelect, ar as CommunityBan, bG as CommunityBansSelect, C as Config, G as Customer, J as CustomerAddress, b1 as CustomerAddressesSelect, e as CustomerAuthOperations, H as CustomerGroup, b2 as CustomerGroupsSelect, b0 as CustomersSelect, W as Discount, b5 as DiscountsSelect, $ as Document, bb as DocumentCategoriesSelect, a1 as DocumentCategory, a0 as DocumentType, bc as DocumentTypesSelect, ba as DocumentsSelect, m as EmailLog, aC as EmailLogsSelect, N as ExchangeProduct, a_ as ExchangeProductsSelect, aZ as ExchangesSelect, j as FieldConfig, ay as FieldConfigsSelect, af as Flow, bt as FlowCategoriesSelect, ag as FlowCategory, aj as FlowEdgeType, bs as FlowEdgeTypesSelect, ai as FlowNodeType, br as FlowNodeTypesSelect, ah as FlowTag, bu as FlowTagsSelect, bq as FlowsSelect, F as Form, as as FormSubmission, bI as FormSubmissionsSelect, bH as FormsSelect, K as FulfillmentItem, aW as FulfillmentItemsSelect, aV as FulfillmentsSelect, bj as GalleriesSelect, a8 as Gallery, bk as GalleryCategoriesSelect, a9 as GalleryCategory, ab as GalleryItem, bm as GalleryItemsSelect, aa as GalleryTag, bl as GalleryTagsSelect, I as IframeBlock, k as Image, az as ImagesSelect, ac as Link, bo as LinkCategoriesSelect, ad as LinkCategory, ae as LinkTag, bp as LinkTagsSelect, bn as LinksSelect, L as LiveStream, by as LiveStreamsSelect, a5 as Music, bh as MusicCategoriesSelect, a6 as MusicCategory, a7 as MusicTag, bi as MusicTagsSelect, bg as MusicsSelect, aS as OrderProductsSelect, Q as OrderStatusLog, aU as OrderStatusLogsSelect, aR as OrdersSelect, at as PayloadKv, bJ as PayloadKvSelect, au as PayloadLockedDocument, bK as PayloadLockedDocumentsSelect, aw as PayloadMigration, bM as PayloadMigrationsSelect, av as PayloadPreference, bL as PayloadPreferencesSelect, f as PlayerBlock, a2 as Playlist, be as PlaylistCategoriesSelect, a3 as PlaylistCategory, a4 as PlaylistTag, bf as PlaylistTagsSelect, bd as PlaylistsSelect, X as Post, Y as PostAuthor, b7 as PostAuthorsSelect, b8 as PostCategoriesSelect, Z as PostCategory, _ as PostTag, b9 as PostTagsSelect, b6 as PostsSelect, aM as ProductCategoriesSelect, w as ProductCategory, D as ProductCollection, aO as ProductCollectionsSelect, v as ProductOption, aL as ProductOptionsSelect, x as ProductTag, aN as ProductTagsSelect, u as ProductVariant, aK as ProductVariantsSelect, aJ as ProductsSelect, an as Reaction, ao as ReactionType, bC as ReactionTypesSelect, bB as ReactionsSelect, aq as Report, bF as ReportsSelect, M as ReturnProduct, aY as ReturnProductsSelect, aX as ReturnsSelect, a$ as ShippingPoliciesSelect, z as ShippingPolicy, p as Subscription, aG as SubscriptionsSelect, S as SupportedTimezones, l as SystemMedia, aA as SystemMediaSelect, i as Tenant, r as TenantLogo, aI as TenantLogosSelect, aE as TenantMetadataSelect, n as TenantMetadatum, aD as TenantsSelect, ak as Thread, bE as ThreadCategoriesSelect, al as ThreadCategory, bz as ThreadsSelect, aT as TransactionsSelect, h as User, U as UserAuthOperations, ax as UsersSelect, V as Video, bw as VideoCategoriesSelect, s as VideoCategory, t as VideoTag, bx as VideoTagsSelect, bv as VideosSelect } from './payload-types-DCVm1syH.cjs';
|
|
3
3
|
import { Sort, Where } from 'payload';
|
|
4
4
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
5
5
|
import { QueryClient, InfiniteData } from '@tanstack/react-query';
|
|
6
6
|
import { Metadata } from 'next';
|
|
7
|
-
import { P as PublicCollection } from './const-
|
|
8
|
-
export { a as COLLECTIONS, C as Collection } from './const-
|
|
9
|
-
import { C as CollectionType } from './webhook-
|
|
10
|
-
export { a as WebhookEvent, b as WebhookHandler, W as WebhookOperation, c as WebhookOptions, d as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-
|
|
7
|
+
import { P as PublicCollection } from './const-DQZQAXex.cjs';
|
|
8
|
+
export { a as COLLECTIONS, C as Collection } from './const-DQZQAXex.cjs';
|
|
9
|
+
import { C as CollectionType } from './webhook-TDfT7aKA.cjs';
|
|
10
|
+
export { a as WebhookEvent, b as WebhookHandler, W as WebhookOperation, c as WebhookOptions, d as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-TDfT7aKA.cjs';
|
|
11
11
|
export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-DupPIYx-.cjs';
|
|
12
12
|
export { b as IMAGE_SIZES, I as ImageData, a as ImagePalette, f as ImagePlaceholderOptions, d as getImageLqip, e as getImagePalette, h as getImagePlaceholderStyle, c as getImageSrcSet, g as getImageUrl } from './image-TT8lTsk5.cjs';
|
|
13
13
|
export { e as VideoGifOptions, V as VideoThumbnailOptions, a as getVideoGif, c as getVideoMp4Url, d as getVideoStoryboard, b as getVideoStreamUrl, g as getVideoThumbnail } from './video-DbLL8yuc.cjs';
|
|
@@ -96,6 +96,16 @@ interface ApiQueryOptions {
|
|
|
96
96
|
where?: Where;
|
|
97
97
|
depth?: number;
|
|
98
98
|
select?: Record<string, boolean>;
|
|
99
|
+
/** Per-collection field selection for populated relationships (keyed by collection slug) */
|
|
100
|
+
populate?: Record<string, boolean | Record<string, boolean>>;
|
|
101
|
+
/** Join field control: pagination/filter per join, or false to disable */
|
|
102
|
+
joins?: Record<string, {
|
|
103
|
+
limit?: number;
|
|
104
|
+
page?: number;
|
|
105
|
+
sort?: string;
|
|
106
|
+
where?: Where;
|
|
107
|
+
count?: boolean;
|
|
108
|
+
} | false> | false;
|
|
99
109
|
}
|
|
100
110
|
interface DebugConfig {
|
|
101
111
|
logRequests?: boolean;
|
|
@@ -466,7 +476,7 @@ declare class CollectionQueryBuilder<T extends PublicCollection> {
|
|
|
466
476
|
* GET /api/{collection}/{id}
|
|
467
477
|
* @returns Document object directly (no wrapper)
|
|
468
478
|
*/
|
|
469
|
-
findById(id: string, options?: ApiQueryOptions): Promise<CollectionType<T>>;
|
|
479
|
+
findById(id: string | number, options?: ApiQueryOptions): Promise<CollectionType<T>>;
|
|
470
480
|
/**
|
|
471
481
|
* Create a new document
|
|
472
482
|
* POST /api/{collection}
|
|
@@ -525,6 +535,193 @@ declare class CollectionQueryBuilder<T extends PublicCollection> {
|
|
|
525
535
|
removeMany(where: ApiQueryOptions['where']): Promise<PayloadFindResponse<CollectionType<T>>>;
|
|
526
536
|
}
|
|
527
537
|
|
|
538
|
+
interface CommunityClientOptions {
|
|
539
|
+
clientKey: string;
|
|
540
|
+
secretKey?: string;
|
|
541
|
+
customerToken?: string | (() => string | null);
|
|
542
|
+
baseUrl?: string;
|
|
543
|
+
onUnauthorized?: () => Promise<string | null>;
|
|
544
|
+
}
|
|
545
|
+
interface Thread {
|
|
546
|
+
id: string;
|
|
547
|
+
title: string;
|
|
548
|
+
content: unknown;
|
|
549
|
+
categories?: string[];
|
|
550
|
+
thumbnail?: string;
|
|
551
|
+
viewCount?: number;
|
|
552
|
+
createdAt?: string;
|
|
553
|
+
updatedAt?: string;
|
|
554
|
+
[key: string]: unknown;
|
|
555
|
+
}
|
|
556
|
+
interface Comment {
|
|
557
|
+
id: string;
|
|
558
|
+
content: string;
|
|
559
|
+
thread?: string;
|
|
560
|
+
parent?: string;
|
|
561
|
+
rootId?: string;
|
|
562
|
+
createdAt?: string;
|
|
563
|
+
updatedAt?: string;
|
|
564
|
+
[key: string]: unknown;
|
|
565
|
+
}
|
|
566
|
+
interface Reaction {
|
|
567
|
+
id: string;
|
|
568
|
+
thread?: string;
|
|
569
|
+
comment?: string;
|
|
570
|
+
type?: string;
|
|
571
|
+
createdAt?: string;
|
|
572
|
+
[key: string]: unknown;
|
|
573
|
+
}
|
|
574
|
+
interface ReactionSummary {
|
|
575
|
+
counts: Record<string, number>;
|
|
576
|
+
total: number;
|
|
577
|
+
userReactions: string[];
|
|
578
|
+
}
|
|
579
|
+
interface Bookmark {
|
|
580
|
+
id: string;
|
|
581
|
+
thread?: string;
|
|
582
|
+
createdAt?: string;
|
|
583
|
+
[key: string]: unknown;
|
|
584
|
+
}
|
|
585
|
+
interface ReactionType {
|
|
586
|
+
id: string;
|
|
587
|
+
title: string;
|
|
588
|
+
slug: string;
|
|
589
|
+
emoji?: string;
|
|
590
|
+
[key: string]: unknown;
|
|
591
|
+
}
|
|
592
|
+
interface CommunityBan {
|
|
593
|
+
id: string;
|
|
594
|
+
customer: string;
|
|
595
|
+
isPermanent?: boolean;
|
|
596
|
+
bannedUntil?: string;
|
|
597
|
+
reason?: string;
|
|
598
|
+
createdAt?: string;
|
|
599
|
+
updatedAt?: string;
|
|
600
|
+
[key: string]: unknown;
|
|
601
|
+
}
|
|
602
|
+
interface PaginatedResponse<T> {
|
|
603
|
+
docs: T[];
|
|
604
|
+
totalDocs: number;
|
|
605
|
+
limit: number;
|
|
606
|
+
totalPages: number;
|
|
607
|
+
page: number;
|
|
608
|
+
pagingCounter: number;
|
|
609
|
+
hasPrevPage: boolean;
|
|
610
|
+
hasNextPage: boolean;
|
|
611
|
+
prevPage: number | null;
|
|
612
|
+
nextPage: number | null;
|
|
613
|
+
}
|
|
614
|
+
declare class CommunityClient {
|
|
615
|
+
private readonly clientKey;
|
|
616
|
+
private readonly secretKey?;
|
|
617
|
+
private readonly customerToken?;
|
|
618
|
+
private readonly baseUrl?;
|
|
619
|
+
private readonly onUnauthorized?;
|
|
620
|
+
constructor(options: CommunityClientOptions);
|
|
621
|
+
private execute;
|
|
622
|
+
createThread(params: {
|
|
623
|
+
title: string;
|
|
624
|
+
content: unknown;
|
|
625
|
+
categories?: string[];
|
|
626
|
+
thumbnail?: string;
|
|
627
|
+
}): Promise<Thread>;
|
|
628
|
+
getMyThreads(params?: {
|
|
629
|
+
page?: number;
|
|
630
|
+
limit?: number;
|
|
631
|
+
}): Promise<PaginatedResponse<Thread>>;
|
|
632
|
+
getTrending(params?: {
|
|
633
|
+
page?: number;
|
|
634
|
+
limit?: number;
|
|
635
|
+
period?: string;
|
|
636
|
+
}): Promise<PaginatedResponse<Thread>>;
|
|
637
|
+
incrementView(params: {
|
|
638
|
+
threadId: string;
|
|
639
|
+
}): Promise<{
|
|
640
|
+
viewCount: number;
|
|
641
|
+
}>;
|
|
642
|
+
reportThread(params: {
|
|
643
|
+
threadId: string;
|
|
644
|
+
reason?: string;
|
|
645
|
+
reasonDetail?: string;
|
|
646
|
+
}): Promise<{
|
|
647
|
+
success: boolean;
|
|
648
|
+
}>;
|
|
649
|
+
createComment(params: {
|
|
650
|
+
threadId: string;
|
|
651
|
+
content: string;
|
|
652
|
+
parentId?: string;
|
|
653
|
+
}): Promise<Comment>;
|
|
654
|
+
listComments(params: {
|
|
655
|
+
threadId: string;
|
|
656
|
+
page?: number;
|
|
657
|
+
limit?: number;
|
|
658
|
+
rootId?: string;
|
|
659
|
+
}): Promise<PaginatedResponse<Comment>>;
|
|
660
|
+
updateComment(params: {
|
|
661
|
+
commentId: string;
|
|
662
|
+
content: string;
|
|
663
|
+
}): Promise<Comment>;
|
|
664
|
+
deleteComment(params: {
|
|
665
|
+
commentId: string;
|
|
666
|
+
}): Promise<{
|
|
667
|
+
success: boolean;
|
|
668
|
+
}>;
|
|
669
|
+
reportComment(params: {
|
|
670
|
+
commentId: string;
|
|
671
|
+
reason?: string;
|
|
672
|
+
reasonDetail?: string;
|
|
673
|
+
}): Promise<{
|
|
674
|
+
success: boolean;
|
|
675
|
+
}>;
|
|
676
|
+
addReaction(params: {
|
|
677
|
+
threadId: string;
|
|
678
|
+
type: string;
|
|
679
|
+
}): Promise<Reaction>;
|
|
680
|
+
removeReaction(params: {
|
|
681
|
+
threadId: string;
|
|
682
|
+
type: string;
|
|
683
|
+
}): Promise<{
|
|
684
|
+
success: boolean;
|
|
685
|
+
}>;
|
|
686
|
+
addCommentReaction(params: {
|
|
687
|
+
commentId: string;
|
|
688
|
+
type: string;
|
|
689
|
+
}): Promise<Reaction>;
|
|
690
|
+
removeCommentReaction(params: {
|
|
691
|
+
commentId: string;
|
|
692
|
+
type: string;
|
|
693
|
+
}): Promise<{
|
|
694
|
+
success: boolean;
|
|
695
|
+
}>;
|
|
696
|
+
getReactionSummary(params: {
|
|
697
|
+
threadId: string;
|
|
698
|
+
}): Promise<ReactionSummary>;
|
|
699
|
+
getReactionTypes(): Promise<PaginatedResponse<ReactionType>>;
|
|
700
|
+
addBookmark(params: {
|
|
701
|
+
threadId: string;
|
|
702
|
+
}): Promise<Bookmark>;
|
|
703
|
+
removeBookmark(params: {
|
|
704
|
+
threadId: string;
|
|
705
|
+
}): Promise<{
|
|
706
|
+
success: boolean;
|
|
707
|
+
}>;
|
|
708
|
+
getMyBookmarks(params?: {
|
|
709
|
+
page?: number;
|
|
710
|
+
limit?: number;
|
|
711
|
+
}): Promise<PaginatedResponse<Bookmark>>;
|
|
712
|
+
banCustomer(params: {
|
|
713
|
+
customerId: string;
|
|
714
|
+
isPermanent?: boolean;
|
|
715
|
+
bannedUntil?: string;
|
|
716
|
+
reason?: string;
|
|
717
|
+
}): Promise<CommunityBan>;
|
|
718
|
+
unbanCustomer(params: {
|
|
719
|
+
customerId: string;
|
|
720
|
+
}): Promise<{
|
|
721
|
+
success: boolean;
|
|
722
|
+
}>;
|
|
723
|
+
}
|
|
724
|
+
|
|
528
725
|
interface CustomerAuthResponse {
|
|
529
726
|
token: string;
|
|
530
727
|
customer: CustomerProfile;
|
|
@@ -908,6 +1105,7 @@ declare class QueryHooks extends CollectionHooks {
|
|
|
908
1105
|
|
|
909
1106
|
declare class Client {
|
|
910
1107
|
cart: CartApi;
|
|
1108
|
+
community: CommunityClient;
|
|
911
1109
|
query: ReadOnlyQueryHooks;
|
|
912
1110
|
collections: CollectionClient;
|
|
913
1111
|
queryClient: QueryClient;
|
|
@@ -930,6 +1128,7 @@ declare function createClient(options: ClientConfig): Client;
|
|
|
930
1128
|
declare class ServerClient {
|
|
931
1129
|
api: OrderApi;
|
|
932
1130
|
cart: CartApi;
|
|
1131
|
+
community: CommunityClient;
|
|
933
1132
|
product: ProductApi;
|
|
934
1133
|
query: QueryHooks;
|
|
935
1134
|
collections: CollectionClient;
|
|
@@ -968,4 +1167,4 @@ declare const formatOrderName: (items: OrderItem[]) => string;
|
|
|
968
1167
|
*/
|
|
969
1168
|
declare const resolveRelation: <T>(ref: T | string | number | null | undefined) => T | null;
|
|
970
1169
|
|
|
971
|
-
export { type AddItemParams, ApiError, type ApiQueryOptions, type ApplyDiscountParams, BaseApi, type CalculateShippingParams, type CalculateShippingResult, Cart, CartApi, type CartApiOptions, CartItem, type CheckoutParams, type ClearCartParams, Client, type ClientConfig, type ClientMetadata, type ClientServerConfig, type ClientState, Client as ClientType, CollectionClient, type CollectionDetailQueryParams, CollectionHooks, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, ConfigError, type CreateExchangeParams, type CreateFulfillmentParams, type CreateOrderParams, type CreateReturnParams, CustomerAuth, type CustomerAuthOptions, type CustomerAuthResponse, CustomerHooks, type CustomerLoginData, type CustomerProfile, type CustomerRefreshResponse, type CustomerRegisterData, type CustomerRegisterResponse, type CustomerSnapshot, type DebugConfig, type DeepPartial, Exchange, type ExtractArrayType, Fulfillment, type GenerateMetadataOptions, type GetOrderParams, GoneError, type InfiniteQueryOptions, NetworkError, Order, OrderApi, type OrderApiOptions, OrderProduct, type PaginationMeta, type PayloadFindResponse, type PayloadMutationResponse, Product, ProductApi, type ProductApiOptions, PublicCollection, QueryHooks, type QueryOptions, type ReadOnlyQueryBuilder, type ReadOnlyQueryHooks, type RemoveDiscountParams, type RemoveItemParams, type RequestOptions, type RetryConfig, Return, type ReturnProductItem, type ReturnReason, type ReturnWithRefundParams, SDKError, type ServerApiOptions, ServerClient, ServerClient as ServerClientType, ServiceUnavailableError, type StockCheckParams, type StockCheckResponse, type StockCheckResult, type SuspenseInfiniteQueryOptions, type SuspenseQueryOptions, TimeoutError, Transaction, type UpdateExchangeParams, type UpdateFulfillmentParams, type UpdateItemParams, type UpdateOrderParams, type UpdateProfileData, type UpdateReturnParams, type UpdateTransactionParams, UsageLimitError, type ValidateDiscountParams, type ValidateDiscountResult, ValidationError, collectionKeys, createClient, createServerClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, isApiError, isConfigError, isGoneError, isNetworkError, isSDKError, isServiceUnavailableError, isTimeoutError, isUsageLimitError, isValidationError, resolveApiUrl, resolveRelation };
|
|
1170
|
+
export { type AddItemParams, ApiError, type ApiQueryOptions, type ApplyDiscountParams, BaseApi, type CalculateShippingParams, type CalculateShippingResult, Cart, CartApi, type CartApiOptions, CartItem, type CheckoutParams, type ClearCartParams, Client, type ClientConfig, type ClientMetadata, type ClientServerConfig, type ClientState, Client as ClientType, CollectionClient, type CollectionDetailQueryParams, CollectionHooks, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, CommunityClient, type CommunityClientOptions, ConfigError, type CreateExchangeParams, type CreateFulfillmentParams, type CreateOrderParams, type CreateReturnParams, CustomerAuth, type CustomerAuthOptions, type CustomerAuthResponse, CustomerHooks, type CustomerLoginData, type CustomerProfile, type CustomerRefreshResponse, type CustomerRegisterData, type CustomerRegisterResponse, type CustomerSnapshot, type DebugConfig, type DeepPartial, Exchange, type ExtractArrayType, Fulfillment, type GenerateMetadataOptions, type GetOrderParams, GoneError, type InfiniteQueryOptions, NetworkError, Order, OrderApi, type OrderApiOptions, OrderProduct, type PaginationMeta, type PayloadFindResponse, type PayloadMutationResponse, Product, ProductApi, type ProductApiOptions, PublicCollection, QueryHooks, type QueryOptions, type ReadOnlyQueryBuilder, type ReadOnlyQueryHooks, type RemoveDiscountParams, type RemoveItemParams, type RequestOptions, type RetryConfig, Return, type ReturnProductItem, type ReturnReason, type ReturnWithRefundParams, SDKError, type ServerApiOptions, ServerClient, ServerClient as ServerClientType, ServiceUnavailableError, type StockCheckParams, type StockCheckResponse, type StockCheckResult, type SuspenseInfiniteQueryOptions, type SuspenseQueryOptions, TimeoutError, Transaction, type UpdateExchangeParams, type UpdateFulfillmentParams, type UpdateItemParams, type UpdateOrderParams, type UpdateProfileData, type UpdateReturnParams, type UpdateTransactionParams, UsageLimitError, type ValidateDiscountParams, type ValidateDiscountResult, ValidationError, collectionKeys, createClient, createServerClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, isApiError, isConfigError, isGoneError, isNetworkError, isSDKError, isServiceUnavailableError, isTimeoutError, isUsageLimitError, isValidationError, resolveApiUrl, resolveRelation };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, E as Exchange, c as Cart, d as CartItem, P as Product } from './payload-types-
|
|
2
|
-
export { o as ApiUsage,
|
|
1
|
+
import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, E as Exchange, c as Cart, d as CartItem, P as Product } from './payload-types-DCVm1syH.js';
|
|
2
|
+
export { o as ApiUsage, aF as ApiUsageSelect, A as Audience, aB as AudiencesSelect, bO as Auth, q as BillingHistory, aH as BillingHistorySelect, ap as Bookmark, bD as BookmarksSelect, y as Brand, B as BrandLogo, aQ as BrandLogosSelect, aP as BrandsSelect, b4 as CartItemsSelect, b3 as CartsSelect, g as CodeBlock, bN as CollectionsWidget, am as Comment, bA as CommentsSelect, ar as CommunityBan, bG as CommunityBansSelect, C as Config, G as Customer, J as CustomerAddress, b1 as CustomerAddressesSelect, e as CustomerAuthOperations, H as CustomerGroup, b2 as CustomerGroupsSelect, b0 as CustomersSelect, W as Discount, b5 as DiscountsSelect, $ as Document, bb as DocumentCategoriesSelect, a1 as DocumentCategory, a0 as DocumentType, bc as DocumentTypesSelect, ba as DocumentsSelect, m as EmailLog, aC as EmailLogsSelect, N as ExchangeProduct, a_ as ExchangeProductsSelect, aZ as ExchangesSelect, j as FieldConfig, ay as FieldConfigsSelect, af as Flow, bt as FlowCategoriesSelect, ag as FlowCategory, aj as FlowEdgeType, bs as FlowEdgeTypesSelect, ai as FlowNodeType, br as FlowNodeTypesSelect, ah as FlowTag, bu as FlowTagsSelect, bq as FlowsSelect, F as Form, as as FormSubmission, bI as FormSubmissionsSelect, bH as FormsSelect, K as FulfillmentItem, aW as FulfillmentItemsSelect, aV as FulfillmentsSelect, bj as GalleriesSelect, a8 as Gallery, bk as GalleryCategoriesSelect, a9 as GalleryCategory, ab as GalleryItem, bm as GalleryItemsSelect, aa as GalleryTag, bl as GalleryTagsSelect, I as IframeBlock, k as Image, az as ImagesSelect, ac as Link, bo as LinkCategoriesSelect, ad as LinkCategory, ae as LinkTag, bp as LinkTagsSelect, bn as LinksSelect, L as LiveStream, by as LiveStreamsSelect, a5 as Music, bh as MusicCategoriesSelect, a6 as MusicCategory, a7 as MusicTag, bi as MusicTagsSelect, bg as MusicsSelect, aS as OrderProductsSelect, Q as OrderStatusLog, aU as OrderStatusLogsSelect, aR as OrdersSelect, at as PayloadKv, bJ as PayloadKvSelect, au as PayloadLockedDocument, bK as PayloadLockedDocumentsSelect, aw as PayloadMigration, bM as PayloadMigrationsSelect, av as PayloadPreference, bL as PayloadPreferencesSelect, f as PlayerBlock, a2 as Playlist, be as PlaylistCategoriesSelect, a3 as PlaylistCategory, a4 as PlaylistTag, bf as PlaylistTagsSelect, bd as PlaylistsSelect, X as Post, Y as PostAuthor, b7 as PostAuthorsSelect, b8 as PostCategoriesSelect, Z as PostCategory, _ as PostTag, b9 as PostTagsSelect, b6 as PostsSelect, aM as ProductCategoriesSelect, w as ProductCategory, D as ProductCollection, aO as ProductCollectionsSelect, v as ProductOption, aL as ProductOptionsSelect, x as ProductTag, aN as ProductTagsSelect, u as ProductVariant, aK as ProductVariantsSelect, aJ as ProductsSelect, an as Reaction, ao as ReactionType, bC as ReactionTypesSelect, bB as ReactionsSelect, aq as Report, bF as ReportsSelect, M as ReturnProduct, aY as ReturnProductsSelect, aX as ReturnsSelect, a$ as ShippingPoliciesSelect, z as ShippingPolicy, p as Subscription, aG as SubscriptionsSelect, S as SupportedTimezones, l as SystemMedia, aA as SystemMediaSelect, i as Tenant, r as TenantLogo, aI as TenantLogosSelect, aE as TenantMetadataSelect, n as TenantMetadatum, aD as TenantsSelect, ak as Thread, bE as ThreadCategoriesSelect, al as ThreadCategory, bz as ThreadsSelect, aT as TransactionsSelect, h as User, U as UserAuthOperations, ax as UsersSelect, V as Video, bw as VideoCategoriesSelect, s as VideoCategory, t as VideoTag, bx as VideoTagsSelect, bv as VideosSelect } from './payload-types-DCVm1syH.js';
|
|
3
3
|
import { Sort, Where } from 'payload';
|
|
4
4
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
5
5
|
import { QueryClient, InfiniteData } from '@tanstack/react-query';
|
|
6
6
|
import { Metadata } from 'next';
|
|
7
|
-
import { P as PublicCollection } from './const-
|
|
8
|
-
export { a as COLLECTIONS, C as Collection } from './const-
|
|
9
|
-
import { C as CollectionType } from './webhook-
|
|
10
|
-
export { a as WebhookEvent, b as WebhookHandler, W as WebhookOperation, c as WebhookOptions, d as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-
|
|
7
|
+
import { P as PublicCollection } from './const-Bk3-zigV.js';
|
|
8
|
+
export { a as COLLECTIONS, C as Collection } from './const-Bk3-zigV.js';
|
|
9
|
+
import { C as CollectionType } from './webhook-BTtG_8f2.js';
|
|
10
|
+
export { a as WebhookEvent, b as WebhookHandler, W as WebhookOperation, c as WebhookOptions, d as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-BTtG_8f2.js';
|
|
11
11
|
export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-DupPIYx-.js';
|
|
12
12
|
export { b as IMAGE_SIZES, I as ImageData, a as ImagePalette, f as ImagePlaceholderOptions, d as getImageLqip, e as getImagePalette, h as getImagePlaceholderStyle, c as getImageSrcSet, g as getImageUrl } from './image-TT8lTsk5.js';
|
|
13
13
|
export { e as VideoGifOptions, V as VideoThumbnailOptions, a as getVideoGif, c as getVideoMp4Url, d as getVideoStoryboard, b as getVideoStreamUrl, g as getVideoThumbnail } from './video-DbLL8yuc.js';
|
|
@@ -96,6 +96,16 @@ interface ApiQueryOptions {
|
|
|
96
96
|
where?: Where;
|
|
97
97
|
depth?: number;
|
|
98
98
|
select?: Record<string, boolean>;
|
|
99
|
+
/** Per-collection field selection for populated relationships (keyed by collection slug) */
|
|
100
|
+
populate?: Record<string, boolean | Record<string, boolean>>;
|
|
101
|
+
/** Join field control: pagination/filter per join, or false to disable */
|
|
102
|
+
joins?: Record<string, {
|
|
103
|
+
limit?: number;
|
|
104
|
+
page?: number;
|
|
105
|
+
sort?: string;
|
|
106
|
+
where?: Where;
|
|
107
|
+
count?: boolean;
|
|
108
|
+
} | false> | false;
|
|
99
109
|
}
|
|
100
110
|
interface DebugConfig {
|
|
101
111
|
logRequests?: boolean;
|
|
@@ -466,7 +476,7 @@ declare class CollectionQueryBuilder<T extends PublicCollection> {
|
|
|
466
476
|
* GET /api/{collection}/{id}
|
|
467
477
|
* @returns Document object directly (no wrapper)
|
|
468
478
|
*/
|
|
469
|
-
findById(id: string, options?: ApiQueryOptions): Promise<CollectionType<T>>;
|
|
479
|
+
findById(id: string | number, options?: ApiQueryOptions): Promise<CollectionType<T>>;
|
|
470
480
|
/**
|
|
471
481
|
* Create a new document
|
|
472
482
|
* POST /api/{collection}
|
|
@@ -525,6 +535,193 @@ declare class CollectionQueryBuilder<T extends PublicCollection> {
|
|
|
525
535
|
removeMany(where: ApiQueryOptions['where']): Promise<PayloadFindResponse<CollectionType<T>>>;
|
|
526
536
|
}
|
|
527
537
|
|
|
538
|
+
interface CommunityClientOptions {
|
|
539
|
+
clientKey: string;
|
|
540
|
+
secretKey?: string;
|
|
541
|
+
customerToken?: string | (() => string | null);
|
|
542
|
+
baseUrl?: string;
|
|
543
|
+
onUnauthorized?: () => Promise<string | null>;
|
|
544
|
+
}
|
|
545
|
+
interface Thread {
|
|
546
|
+
id: string;
|
|
547
|
+
title: string;
|
|
548
|
+
content: unknown;
|
|
549
|
+
categories?: string[];
|
|
550
|
+
thumbnail?: string;
|
|
551
|
+
viewCount?: number;
|
|
552
|
+
createdAt?: string;
|
|
553
|
+
updatedAt?: string;
|
|
554
|
+
[key: string]: unknown;
|
|
555
|
+
}
|
|
556
|
+
interface Comment {
|
|
557
|
+
id: string;
|
|
558
|
+
content: string;
|
|
559
|
+
thread?: string;
|
|
560
|
+
parent?: string;
|
|
561
|
+
rootId?: string;
|
|
562
|
+
createdAt?: string;
|
|
563
|
+
updatedAt?: string;
|
|
564
|
+
[key: string]: unknown;
|
|
565
|
+
}
|
|
566
|
+
interface Reaction {
|
|
567
|
+
id: string;
|
|
568
|
+
thread?: string;
|
|
569
|
+
comment?: string;
|
|
570
|
+
type?: string;
|
|
571
|
+
createdAt?: string;
|
|
572
|
+
[key: string]: unknown;
|
|
573
|
+
}
|
|
574
|
+
interface ReactionSummary {
|
|
575
|
+
counts: Record<string, number>;
|
|
576
|
+
total: number;
|
|
577
|
+
userReactions: string[];
|
|
578
|
+
}
|
|
579
|
+
interface Bookmark {
|
|
580
|
+
id: string;
|
|
581
|
+
thread?: string;
|
|
582
|
+
createdAt?: string;
|
|
583
|
+
[key: string]: unknown;
|
|
584
|
+
}
|
|
585
|
+
interface ReactionType {
|
|
586
|
+
id: string;
|
|
587
|
+
title: string;
|
|
588
|
+
slug: string;
|
|
589
|
+
emoji?: string;
|
|
590
|
+
[key: string]: unknown;
|
|
591
|
+
}
|
|
592
|
+
interface CommunityBan {
|
|
593
|
+
id: string;
|
|
594
|
+
customer: string;
|
|
595
|
+
isPermanent?: boolean;
|
|
596
|
+
bannedUntil?: string;
|
|
597
|
+
reason?: string;
|
|
598
|
+
createdAt?: string;
|
|
599
|
+
updatedAt?: string;
|
|
600
|
+
[key: string]: unknown;
|
|
601
|
+
}
|
|
602
|
+
interface PaginatedResponse<T> {
|
|
603
|
+
docs: T[];
|
|
604
|
+
totalDocs: number;
|
|
605
|
+
limit: number;
|
|
606
|
+
totalPages: number;
|
|
607
|
+
page: number;
|
|
608
|
+
pagingCounter: number;
|
|
609
|
+
hasPrevPage: boolean;
|
|
610
|
+
hasNextPage: boolean;
|
|
611
|
+
prevPage: number | null;
|
|
612
|
+
nextPage: number | null;
|
|
613
|
+
}
|
|
614
|
+
declare class CommunityClient {
|
|
615
|
+
private readonly clientKey;
|
|
616
|
+
private readonly secretKey?;
|
|
617
|
+
private readonly customerToken?;
|
|
618
|
+
private readonly baseUrl?;
|
|
619
|
+
private readonly onUnauthorized?;
|
|
620
|
+
constructor(options: CommunityClientOptions);
|
|
621
|
+
private execute;
|
|
622
|
+
createThread(params: {
|
|
623
|
+
title: string;
|
|
624
|
+
content: unknown;
|
|
625
|
+
categories?: string[];
|
|
626
|
+
thumbnail?: string;
|
|
627
|
+
}): Promise<Thread>;
|
|
628
|
+
getMyThreads(params?: {
|
|
629
|
+
page?: number;
|
|
630
|
+
limit?: number;
|
|
631
|
+
}): Promise<PaginatedResponse<Thread>>;
|
|
632
|
+
getTrending(params?: {
|
|
633
|
+
page?: number;
|
|
634
|
+
limit?: number;
|
|
635
|
+
period?: string;
|
|
636
|
+
}): Promise<PaginatedResponse<Thread>>;
|
|
637
|
+
incrementView(params: {
|
|
638
|
+
threadId: string;
|
|
639
|
+
}): Promise<{
|
|
640
|
+
viewCount: number;
|
|
641
|
+
}>;
|
|
642
|
+
reportThread(params: {
|
|
643
|
+
threadId: string;
|
|
644
|
+
reason?: string;
|
|
645
|
+
reasonDetail?: string;
|
|
646
|
+
}): Promise<{
|
|
647
|
+
success: boolean;
|
|
648
|
+
}>;
|
|
649
|
+
createComment(params: {
|
|
650
|
+
threadId: string;
|
|
651
|
+
content: string;
|
|
652
|
+
parentId?: string;
|
|
653
|
+
}): Promise<Comment>;
|
|
654
|
+
listComments(params: {
|
|
655
|
+
threadId: string;
|
|
656
|
+
page?: number;
|
|
657
|
+
limit?: number;
|
|
658
|
+
rootId?: string;
|
|
659
|
+
}): Promise<PaginatedResponse<Comment>>;
|
|
660
|
+
updateComment(params: {
|
|
661
|
+
commentId: string;
|
|
662
|
+
content: string;
|
|
663
|
+
}): Promise<Comment>;
|
|
664
|
+
deleteComment(params: {
|
|
665
|
+
commentId: string;
|
|
666
|
+
}): Promise<{
|
|
667
|
+
success: boolean;
|
|
668
|
+
}>;
|
|
669
|
+
reportComment(params: {
|
|
670
|
+
commentId: string;
|
|
671
|
+
reason?: string;
|
|
672
|
+
reasonDetail?: string;
|
|
673
|
+
}): Promise<{
|
|
674
|
+
success: boolean;
|
|
675
|
+
}>;
|
|
676
|
+
addReaction(params: {
|
|
677
|
+
threadId: string;
|
|
678
|
+
type: string;
|
|
679
|
+
}): Promise<Reaction>;
|
|
680
|
+
removeReaction(params: {
|
|
681
|
+
threadId: string;
|
|
682
|
+
type: string;
|
|
683
|
+
}): Promise<{
|
|
684
|
+
success: boolean;
|
|
685
|
+
}>;
|
|
686
|
+
addCommentReaction(params: {
|
|
687
|
+
commentId: string;
|
|
688
|
+
type: string;
|
|
689
|
+
}): Promise<Reaction>;
|
|
690
|
+
removeCommentReaction(params: {
|
|
691
|
+
commentId: string;
|
|
692
|
+
type: string;
|
|
693
|
+
}): Promise<{
|
|
694
|
+
success: boolean;
|
|
695
|
+
}>;
|
|
696
|
+
getReactionSummary(params: {
|
|
697
|
+
threadId: string;
|
|
698
|
+
}): Promise<ReactionSummary>;
|
|
699
|
+
getReactionTypes(): Promise<PaginatedResponse<ReactionType>>;
|
|
700
|
+
addBookmark(params: {
|
|
701
|
+
threadId: string;
|
|
702
|
+
}): Promise<Bookmark>;
|
|
703
|
+
removeBookmark(params: {
|
|
704
|
+
threadId: string;
|
|
705
|
+
}): Promise<{
|
|
706
|
+
success: boolean;
|
|
707
|
+
}>;
|
|
708
|
+
getMyBookmarks(params?: {
|
|
709
|
+
page?: number;
|
|
710
|
+
limit?: number;
|
|
711
|
+
}): Promise<PaginatedResponse<Bookmark>>;
|
|
712
|
+
banCustomer(params: {
|
|
713
|
+
customerId: string;
|
|
714
|
+
isPermanent?: boolean;
|
|
715
|
+
bannedUntil?: string;
|
|
716
|
+
reason?: string;
|
|
717
|
+
}): Promise<CommunityBan>;
|
|
718
|
+
unbanCustomer(params: {
|
|
719
|
+
customerId: string;
|
|
720
|
+
}): Promise<{
|
|
721
|
+
success: boolean;
|
|
722
|
+
}>;
|
|
723
|
+
}
|
|
724
|
+
|
|
528
725
|
interface CustomerAuthResponse {
|
|
529
726
|
token: string;
|
|
530
727
|
customer: CustomerProfile;
|
|
@@ -908,6 +1105,7 @@ declare class QueryHooks extends CollectionHooks {
|
|
|
908
1105
|
|
|
909
1106
|
declare class Client {
|
|
910
1107
|
cart: CartApi;
|
|
1108
|
+
community: CommunityClient;
|
|
911
1109
|
query: ReadOnlyQueryHooks;
|
|
912
1110
|
collections: CollectionClient;
|
|
913
1111
|
queryClient: QueryClient;
|
|
@@ -930,6 +1128,7 @@ declare function createClient(options: ClientConfig): Client;
|
|
|
930
1128
|
declare class ServerClient {
|
|
931
1129
|
api: OrderApi;
|
|
932
1130
|
cart: CartApi;
|
|
1131
|
+
community: CommunityClient;
|
|
933
1132
|
product: ProductApi;
|
|
934
1133
|
query: QueryHooks;
|
|
935
1134
|
collections: CollectionClient;
|
|
@@ -968,4 +1167,4 @@ declare const formatOrderName: (items: OrderItem[]) => string;
|
|
|
968
1167
|
*/
|
|
969
1168
|
declare const resolveRelation: <T>(ref: T | string | number | null | undefined) => T | null;
|
|
970
1169
|
|
|
971
|
-
export { type AddItemParams, ApiError, type ApiQueryOptions, type ApplyDiscountParams, BaseApi, type CalculateShippingParams, type CalculateShippingResult, Cart, CartApi, type CartApiOptions, CartItem, type CheckoutParams, type ClearCartParams, Client, type ClientConfig, type ClientMetadata, type ClientServerConfig, type ClientState, Client as ClientType, CollectionClient, type CollectionDetailQueryParams, CollectionHooks, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, ConfigError, type CreateExchangeParams, type CreateFulfillmentParams, type CreateOrderParams, type CreateReturnParams, CustomerAuth, type CustomerAuthOptions, type CustomerAuthResponse, CustomerHooks, type CustomerLoginData, type CustomerProfile, type CustomerRefreshResponse, type CustomerRegisterData, type CustomerRegisterResponse, type CustomerSnapshot, type DebugConfig, type DeepPartial, Exchange, type ExtractArrayType, Fulfillment, type GenerateMetadataOptions, type GetOrderParams, GoneError, type InfiniteQueryOptions, NetworkError, Order, OrderApi, type OrderApiOptions, OrderProduct, type PaginationMeta, type PayloadFindResponse, type PayloadMutationResponse, Product, ProductApi, type ProductApiOptions, PublicCollection, QueryHooks, type QueryOptions, type ReadOnlyQueryBuilder, type ReadOnlyQueryHooks, type RemoveDiscountParams, type RemoveItemParams, type RequestOptions, type RetryConfig, Return, type ReturnProductItem, type ReturnReason, type ReturnWithRefundParams, SDKError, type ServerApiOptions, ServerClient, ServerClient as ServerClientType, ServiceUnavailableError, type StockCheckParams, type StockCheckResponse, type StockCheckResult, type SuspenseInfiniteQueryOptions, type SuspenseQueryOptions, TimeoutError, Transaction, type UpdateExchangeParams, type UpdateFulfillmentParams, type UpdateItemParams, type UpdateOrderParams, type UpdateProfileData, type UpdateReturnParams, type UpdateTransactionParams, UsageLimitError, type ValidateDiscountParams, type ValidateDiscountResult, ValidationError, collectionKeys, createClient, createServerClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, isApiError, isConfigError, isGoneError, isNetworkError, isSDKError, isServiceUnavailableError, isTimeoutError, isUsageLimitError, isValidationError, resolveApiUrl, resolveRelation };
|
|
1170
|
+
export { type AddItemParams, ApiError, type ApiQueryOptions, type ApplyDiscountParams, BaseApi, type CalculateShippingParams, type CalculateShippingResult, Cart, CartApi, type CartApiOptions, CartItem, type CheckoutParams, type ClearCartParams, Client, type ClientConfig, type ClientMetadata, type ClientServerConfig, type ClientState, Client as ClientType, CollectionClient, type CollectionDetailQueryParams, CollectionHooks, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, CommunityClient, type CommunityClientOptions, ConfigError, type CreateExchangeParams, type CreateFulfillmentParams, type CreateOrderParams, type CreateReturnParams, CustomerAuth, type CustomerAuthOptions, type CustomerAuthResponse, CustomerHooks, type CustomerLoginData, type CustomerProfile, type CustomerRefreshResponse, type CustomerRegisterData, type CustomerRegisterResponse, type CustomerSnapshot, type DebugConfig, type DeepPartial, Exchange, type ExtractArrayType, Fulfillment, type GenerateMetadataOptions, type GetOrderParams, GoneError, type InfiniteQueryOptions, NetworkError, Order, OrderApi, type OrderApiOptions, OrderProduct, type PaginationMeta, type PayloadFindResponse, type PayloadMutationResponse, Product, ProductApi, type ProductApiOptions, PublicCollection, QueryHooks, type QueryOptions, type ReadOnlyQueryBuilder, type ReadOnlyQueryHooks, type RemoveDiscountParams, type RemoveItemParams, type RequestOptions, type RetryConfig, Return, type ReturnProductItem, type ReturnReason, type ReturnWithRefundParams, SDKError, type ServerApiOptions, ServerClient, ServerClient as ServerClientType, ServiceUnavailableError, type StockCheckParams, type StockCheckResponse, type StockCheckResult, type SuspenseInfiniteQueryOptions, type SuspenseQueryOptions, TimeoutError, Transaction, type UpdateExchangeParams, type UpdateFulfillmentParams, type UpdateItemParams, type UpdateOrderParams, type UpdateProfileData, type UpdateReturnParams, type UpdateTransactionParams, UsageLimitError, type ValidateDiscountParams, type ValidateDiscountResult, ValidationError, collectionKeys, createClient, createServerClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, isApiError, isConfigError, isGoneError, isNetworkError, isSDKError, isServiceUnavailableError, isTimeoutError, isUsageLimitError, isValidationError, resolveApiUrl, resolveRelation };
|