@01.software/sdk 0.8.0 → 0.10.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 +23 -25
- package/dist/{const-dv0zuAxG.d.cts → const-Dmgge6oQ.d.ts} +2 -2
- package/dist/{const-CCh99Gxu.d.ts → const-k0fqIBda.d.cts} +2 -2
- package/dist/index.cjs +52 -167
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -34
- package/dist/index.d.ts +22 -34
- package/dist/index.js +52 -167
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-FfZ2Zxp1.d.cts → payload-types-D0zFPijW.d.cts} +306 -112
- package/dist/{payload-types-FfZ2Zxp1.d.ts → payload-types-D0zFPijW.d.ts} +306 -112
- package/dist/{realtime-DupPIYx-.d.cts → realtime-D7HtUpqt.d.cts} +2 -2
- package/dist/{realtime-DupPIYx-.d.ts → realtime-D7HtUpqt.d.ts} +2 -2
- package/dist/realtime.cjs +8 -7
- package/dist/realtime.cjs.map +1 -1
- package/dist/realtime.d.cts +6 -6
- package/dist/realtime.d.ts +6 -6
- package/dist/realtime.js +8 -7
- package/dist/realtime.js.map +1 -1
- package/dist/{server-DxhuG-_s.d.cts → server-JR9TvKZ5.d.cts} +0 -2
- package/dist/{server-DxhuG-_s.d.ts → server-JR9TvKZ5.d.ts} +0 -2
- package/dist/ui/canvas/server.cjs +1 -2
- package/dist/ui/canvas/server.cjs.map +1 -1
- package/dist/ui/canvas/server.d.cts +1 -1
- package/dist/ui/canvas/server.d.ts +1 -1
- package/dist/ui/canvas/server.js +1 -2
- package/dist/ui/canvas/server.js.map +1 -1
- package/dist/ui/canvas.cjs +1 -2
- package/dist/ui/canvas.cjs.map +1 -1
- package/dist/ui/canvas.d.cts +2 -2
- package/dist/ui/canvas.d.ts +2 -2
- package/dist/ui/canvas.js +1 -2
- package/dist/ui/canvas.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-t7JGFLKQ.d.cts → webhook-DXr8B9E6.d.cts} +2 -2
- package/dist/{webhook-B9MDrH22.d.ts → webhook-caDRhnd7.d.ts} +2 -2
- package/dist/webhook.d.cts +3 -3
- package/dist/webhook.d.ts +3 -3
- package/package.json +1 -11
- package/dist/auth.cjs +0 -109
- package/dist/auth.cjs.map +0 -1
- package/dist/auth.d.cts +0 -36
- package/dist/auth.d.ts +0 -36
- package/dist/auth.js +0 -86
- package/dist/auth.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { O as Order, a as OrderItem$1, T as Transaction, b as Fulfillment, R as Return, c as Cart, d as CartItem, P as Product } from './payload-types-
|
|
2
|
-
export {
|
|
1
|
+
import { O as Order, a as OrderItem$1, T as Transaction, b as Fulfillment, R as Return, c as Cart, d as CartItem, P as Product } from './payload-types-D0zFPijW.cjs';
|
|
2
|
+
export { D as Document, I as Image, e as Post, f as PostCategory, g as PostTag, h as ProductVariant, i as Tenant, V as Video } from './payload-types-D0zFPijW.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-
|
|
11
|
-
export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-
|
|
7
|
+
import { P as PublicCollection } from './const-k0fqIBda.cjs';
|
|
8
|
+
export { a as COLLECTIONS, C as Collection } from './const-k0fqIBda.cjs';
|
|
9
|
+
import { C as CollectionType } from './webhook-DXr8B9E6.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-DXr8B9E6.cjs';
|
|
11
|
+
export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-D7HtUpqt.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';
|
|
14
|
-
export { JwtPayload, createApiKey, createServerToken, decodeServerToken, parseApiKey, verifyServerToken } from './auth.cjs';
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
16
|
* API URL을 반환합니다.
|
|
@@ -20,7 +19,7 @@ export { JwtPayload, createApiKey, createServerToken, decodeServerToken, parseAp
|
|
|
20
19
|
*/
|
|
21
20
|
declare function resolveApiUrl(): string;
|
|
22
21
|
interface ClientConfig {
|
|
23
|
-
|
|
22
|
+
publishableKey: string;
|
|
24
23
|
/**
|
|
25
24
|
* Customer authentication options.
|
|
26
25
|
* Used to initialize CustomerAuth on Client.
|
|
@@ -123,18 +122,16 @@ type DeepPartial<T> = {
|
|
|
123
122
|
type ExtractArrayType<T> = T extends (infer U)[] ? U : never;
|
|
124
123
|
|
|
125
124
|
interface ServerApiOptions {
|
|
126
|
-
|
|
125
|
+
publishableKey?: string;
|
|
127
126
|
secretKey: string;
|
|
128
|
-
baseUrl?: string;
|
|
129
127
|
}
|
|
130
128
|
interface RequestOptions {
|
|
131
129
|
method?: 'GET' | 'POST' | 'PATCH' | 'DELETE';
|
|
132
130
|
headers?: Record<string, string>;
|
|
133
131
|
}
|
|
134
132
|
declare abstract class BaseApi {
|
|
135
|
-
protected readonly
|
|
133
|
+
protected readonly publishableKey: string;
|
|
136
134
|
protected readonly secretKey: string;
|
|
137
|
-
protected readonly baseUrl?: string;
|
|
138
135
|
constructor(apiName: string, options: ServerApiOptions);
|
|
139
136
|
protected request<T>(endpoint: string, body: unknown, options?: RequestOptions): Promise<T>;
|
|
140
137
|
}
|
|
@@ -263,10 +260,9 @@ declare class OrderApi extends BaseApi {
|
|
|
263
260
|
}
|
|
264
261
|
|
|
265
262
|
interface CartApiOptions {
|
|
266
|
-
|
|
263
|
+
publishableKey?: string;
|
|
267
264
|
secretKey?: string;
|
|
268
265
|
customerToken?: string | (() => string | null);
|
|
269
|
-
baseUrl?: string;
|
|
270
266
|
onUnauthorized?: () => Promise<string | null>;
|
|
271
267
|
}
|
|
272
268
|
type AddItemParams = {
|
|
@@ -294,10 +290,9 @@ type ClearCartParams = {
|
|
|
294
290
|
cartId: string;
|
|
295
291
|
};
|
|
296
292
|
declare class CartApi {
|
|
297
|
-
private readonly
|
|
293
|
+
private readonly publishableKey;
|
|
298
294
|
private readonly secretKey?;
|
|
299
295
|
private readonly customerToken?;
|
|
300
|
-
private readonly baseUrl?;
|
|
301
296
|
private readonly onUnauthorized?;
|
|
302
297
|
constructor(options: CartApiOptions);
|
|
303
298
|
private execute;
|
|
@@ -342,11 +337,10 @@ interface GenerateMetadataOptions {
|
|
|
342
337
|
}
|
|
343
338
|
|
|
344
339
|
interface FetchOptions extends RequestInit {
|
|
345
|
-
|
|
340
|
+
publishableKey?: string;
|
|
346
341
|
secretKey?: string;
|
|
347
342
|
customerToken?: string;
|
|
348
343
|
timeout?: number;
|
|
349
|
-
baseUrl?: string;
|
|
350
344
|
debug?: boolean | DebugConfig;
|
|
351
345
|
retry?: RetryConfig;
|
|
352
346
|
/** Called on 401 when customerToken is set. Return a new token to retry, or null to fail. */
|
|
@@ -354,12 +348,11 @@ interface FetchOptions extends RequestInit {
|
|
|
354
348
|
}
|
|
355
349
|
|
|
356
350
|
declare class HttpClient {
|
|
357
|
-
protected
|
|
351
|
+
protected publishableKey: string;
|
|
358
352
|
protected secretKey?: string;
|
|
359
|
-
protected baseUrl?: string;
|
|
360
353
|
private getCustomerToken?;
|
|
361
354
|
private onUnauthorized?;
|
|
362
|
-
constructor(
|
|
355
|
+
constructor(publishableKey: string, secretKey?: string, getCustomerToken?: () => string | null, onUnauthorized?: () => Promise<string | null>);
|
|
363
356
|
protected get defaultOptions(): FetchOptions;
|
|
364
357
|
protected buildUrl(endpoint: string, options?: ApiQueryOptions): string;
|
|
365
358
|
protected assertJsonResponse(response: Response): void;
|
|
@@ -381,7 +374,6 @@ declare class HttpClient {
|
|
|
381
374
|
}
|
|
382
375
|
|
|
383
376
|
declare class CollectionClient extends HttpClient {
|
|
384
|
-
constructor(clientKey: string, secretKey?: string, baseUrl?: string, getCustomerToken?: () => string | null, onUnauthorized?: () => Promise<string | null>);
|
|
385
377
|
from<T extends PublicCollection>(collection: T): CollectionQueryBuilder<T>;
|
|
386
378
|
/**
|
|
387
379
|
* Find documents (list query)
|
|
@@ -522,10 +514,9 @@ declare class CollectionQueryBuilder<T extends PublicCollection> {
|
|
|
522
514
|
}
|
|
523
515
|
|
|
524
516
|
interface CommunityClientOptions {
|
|
525
|
-
|
|
517
|
+
publishableKey?: string;
|
|
526
518
|
secretKey?: string;
|
|
527
519
|
customerToken?: string | (() => string | null);
|
|
528
|
-
baseUrl?: string;
|
|
529
520
|
onUnauthorized?: () => Promise<string | null>;
|
|
530
521
|
}
|
|
531
522
|
interface Thread {
|
|
@@ -598,10 +589,9 @@ interface PaginatedResponse<T> {
|
|
|
598
589
|
nextPage: number | null;
|
|
599
590
|
}
|
|
600
591
|
declare class CommunityClient {
|
|
601
|
-
private readonly
|
|
592
|
+
private readonly publishableKey;
|
|
602
593
|
private readonly secretKey?;
|
|
603
594
|
private readonly customerToken?;
|
|
604
|
-
private readonly baseUrl?;
|
|
605
595
|
private readonly onUnauthorized?;
|
|
606
596
|
constructor(options: CommunityClientOptions);
|
|
607
597
|
private execute;
|
|
@@ -777,15 +767,15 @@ interface CustomerAuthOptions {
|
|
|
777
767
|
* Customer authentication client.
|
|
778
768
|
*
|
|
779
769
|
* Manages customer registration, login, logout, and token lifecycle.
|
|
780
|
-
* All requests include X-
|
|
770
|
+
* All requests include X-Publishable-Key for tenant resolution.
|
|
781
771
|
*/
|
|
782
772
|
declare class CustomerAuth {
|
|
783
|
-
private
|
|
773
|
+
private publishableKey;
|
|
784
774
|
private baseUrl;
|
|
785
775
|
private token;
|
|
786
776
|
private onTokenChange?;
|
|
787
777
|
private refreshPromise;
|
|
788
|
-
constructor(
|
|
778
|
+
constructor(publishableKey: string, options?: CustomerAuthOptions);
|
|
789
779
|
/**
|
|
790
780
|
* Register a new customer account
|
|
791
781
|
*/
|
|
@@ -1107,7 +1097,6 @@ declare class Client {
|
|
|
1107
1097
|
customer: CustomerAuth;
|
|
1108
1098
|
protected state: ClientState;
|
|
1109
1099
|
protected config: ClientConfig;
|
|
1110
|
-
protected baseUrl: string;
|
|
1111
1100
|
constructor(options: ClientConfig);
|
|
1112
1101
|
from<T extends PublicCollection>(collection: T): ReadOnlyQueryBuilder<T>;
|
|
1113
1102
|
getState(): ClientState;
|
|
@@ -1130,11 +1119,10 @@ declare class ServerClient {
|
|
|
1130
1119
|
queryClient: QueryClient;
|
|
1131
1120
|
protected state: ClientState;
|
|
1132
1121
|
protected config: ClientServerConfig;
|
|
1133
|
-
protected baseUrl: string;
|
|
1134
1122
|
constructor(options: ClientServerConfig);
|
|
1135
1123
|
from<T extends PublicCollection>(collection: T): CollectionQueryBuilder<T>;
|
|
1136
1124
|
getState(): ClientState;
|
|
1137
|
-
getConfig():
|
|
1125
|
+
getConfig(): Omit<ClientServerConfig, 'secretKey'>;
|
|
1138
1126
|
}
|
|
1139
1127
|
/**
|
|
1140
1128
|
* Create a server-only client with full read/write access. Requires secretKey.
|
|
@@ -1162,4 +1150,4 @@ declare const formatOrderName: (items: OrderItem[]) => string;
|
|
|
1162
1150
|
*/
|
|
1163
1151
|
declare const resolveRelation: <T>(ref: T | string | number | null | undefined) => T | null;
|
|
1164
1152
|
|
|
1165
|
-
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 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, type ExtractArrayType,
|
|
1153
|
+
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 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, type ExtractArrayType, type GenerateMetadataOptions, type GetOrderParams, GoneError, type InfiniteQueryOptions, NetworkError, Order, OrderApi, type OrderApiOptions, 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, 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, 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,17 +1,16 @@
|
|
|
1
|
-
import { O as Order, a as OrderItem$1, T as Transaction, b as Fulfillment, R as Return, c as Cart, d as CartItem, P as Product } from './payload-types-
|
|
2
|
-
export {
|
|
1
|
+
import { O as Order, a as OrderItem$1, T as Transaction, b as Fulfillment, R as Return, c as Cart, d as CartItem, P as Product } from './payload-types-D0zFPijW.js';
|
|
2
|
+
export { D as Document, I as Image, e as Post, f as PostCategory, g as PostTag, h as ProductVariant, i as Tenant, V as Video } from './payload-types-D0zFPijW.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-
|
|
11
|
-
export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-
|
|
7
|
+
import { P as PublicCollection } from './const-Dmgge6oQ.js';
|
|
8
|
+
export { a as COLLECTIONS, C as Collection } from './const-Dmgge6oQ.js';
|
|
9
|
+
import { C as CollectionType } from './webhook-caDRhnd7.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-caDRhnd7.js';
|
|
11
|
+
export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-D7HtUpqt.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';
|
|
14
|
-
export { JwtPayload, createApiKey, createServerToken, decodeServerToken, parseApiKey, verifyServerToken } from './auth.js';
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
16
|
* API URL을 반환합니다.
|
|
@@ -20,7 +19,7 @@ export { JwtPayload, createApiKey, createServerToken, decodeServerToken, parseAp
|
|
|
20
19
|
*/
|
|
21
20
|
declare function resolveApiUrl(): string;
|
|
22
21
|
interface ClientConfig {
|
|
23
|
-
|
|
22
|
+
publishableKey: string;
|
|
24
23
|
/**
|
|
25
24
|
* Customer authentication options.
|
|
26
25
|
* Used to initialize CustomerAuth on Client.
|
|
@@ -123,18 +122,16 @@ type DeepPartial<T> = {
|
|
|
123
122
|
type ExtractArrayType<T> = T extends (infer U)[] ? U : never;
|
|
124
123
|
|
|
125
124
|
interface ServerApiOptions {
|
|
126
|
-
|
|
125
|
+
publishableKey?: string;
|
|
127
126
|
secretKey: string;
|
|
128
|
-
baseUrl?: string;
|
|
129
127
|
}
|
|
130
128
|
interface RequestOptions {
|
|
131
129
|
method?: 'GET' | 'POST' | 'PATCH' | 'DELETE';
|
|
132
130
|
headers?: Record<string, string>;
|
|
133
131
|
}
|
|
134
132
|
declare abstract class BaseApi {
|
|
135
|
-
protected readonly
|
|
133
|
+
protected readonly publishableKey: string;
|
|
136
134
|
protected readonly secretKey: string;
|
|
137
|
-
protected readonly baseUrl?: string;
|
|
138
135
|
constructor(apiName: string, options: ServerApiOptions);
|
|
139
136
|
protected request<T>(endpoint: string, body: unknown, options?: RequestOptions): Promise<T>;
|
|
140
137
|
}
|
|
@@ -263,10 +260,9 @@ declare class OrderApi extends BaseApi {
|
|
|
263
260
|
}
|
|
264
261
|
|
|
265
262
|
interface CartApiOptions {
|
|
266
|
-
|
|
263
|
+
publishableKey?: string;
|
|
267
264
|
secretKey?: string;
|
|
268
265
|
customerToken?: string | (() => string | null);
|
|
269
|
-
baseUrl?: string;
|
|
270
266
|
onUnauthorized?: () => Promise<string | null>;
|
|
271
267
|
}
|
|
272
268
|
type AddItemParams = {
|
|
@@ -294,10 +290,9 @@ type ClearCartParams = {
|
|
|
294
290
|
cartId: string;
|
|
295
291
|
};
|
|
296
292
|
declare class CartApi {
|
|
297
|
-
private readonly
|
|
293
|
+
private readonly publishableKey;
|
|
298
294
|
private readonly secretKey?;
|
|
299
295
|
private readonly customerToken?;
|
|
300
|
-
private readonly baseUrl?;
|
|
301
296
|
private readonly onUnauthorized?;
|
|
302
297
|
constructor(options: CartApiOptions);
|
|
303
298
|
private execute;
|
|
@@ -342,11 +337,10 @@ interface GenerateMetadataOptions {
|
|
|
342
337
|
}
|
|
343
338
|
|
|
344
339
|
interface FetchOptions extends RequestInit {
|
|
345
|
-
|
|
340
|
+
publishableKey?: string;
|
|
346
341
|
secretKey?: string;
|
|
347
342
|
customerToken?: string;
|
|
348
343
|
timeout?: number;
|
|
349
|
-
baseUrl?: string;
|
|
350
344
|
debug?: boolean | DebugConfig;
|
|
351
345
|
retry?: RetryConfig;
|
|
352
346
|
/** Called on 401 when customerToken is set. Return a new token to retry, or null to fail. */
|
|
@@ -354,12 +348,11 @@ interface FetchOptions extends RequestInit {
|
|
|
354
348
|
}
|
|
355
349
|
|
|
356
350
|
declare class HttpClient {
|
|
357
|
-
protected
|
|
351
|
+
protected publishableKey: string;
|
|
358
352
|
protected secretKey?: string;
|
|
359
|
-
protected baseUrl?: string;
|
|
360
353
|
private getCustomerToken?;
|
|
361
354
|
private onUnauthorized?;
|
|
362
|
-
constructor(
|
|
355
|
+
constructor(publishableKey: string, secretKey?: string, getCustomerToken?: () => string | null, onUnauthorized?: () => Promise<string | null>);
|
|
363
356
|
protected get defaultOptions(): FetchOptions;
|
|
364
357
|
protected buildUrl(endpoint: string, options?: ApiQueryOptions): string;
|
|
365
358
|
protected assertJsonResponse(response: Response): void;
|
|
@@ -381,7 +374,6 @@ declare class HttpClient {
|
|
|
381
374
|
}
|
|
382
375
|
|
|
383
376
|
declare class CollectionClient extends HttpClient {
|
|
384
|
-
constructor(clientKey: string, secretKey?: string, baseUrl?: string, getCustomerToken?: () => string | null, onUnauthorized?: () => Promise<string | null>);
|
|
385
377
|
from<T extends PublicCollection>(collection: T): CollectionQueryBuilder<T>;
|
|
386
378
|
/**
|
|
387
379
|
* Find documents (list query)
|
|
@@ -522,10 +514,9 @@ declare class CollectionQueryBuilder<T extends PublicCollection> {
|
|
|
522
514
|
}
|
|
523
515
|
|
|
524
516
|
interface CommunityClientOptions {
|
|
525
|
-
|
|
517
|
+
publishableKey?: string;
|
|
526
518
|
secretKey?: string;
|
|
527
519
|
customerToken?: string | (() => string | null);
|
|
528
|
-
baseUrl?: string;
|
|
529
520
|
onUnauthorized?: () => Promise<string | null>;
|
|
530
521
|
}
|
|
531
522
|
interface Thread {
|
|
@@ -598,10 +589,9 @@ interface PaginatedResponse<T> {
|
|
|
598
589
|
nextPage: number | null;
|
|
599
590
|
}
|
|
600
591
|
declare class CommunityClient {
|
|
601
|
-
private readonly
|
|
592
|
+
private readonly publishableKey;
|
|
602
593
|
private readonly secretKey?;
|
|
603
594
|
private readonly customerToken?;
|
|
604
|
-
private readonly baseUrl?;
|
|
605
595
|
private readonly onUnauthorized?;
|
|
606
596
|
constructor(options: CommunityClientOptions);
|
|
607
597
|
private execute;
|
|
@@ -777,15 +767,15 @@ interface CustomerAuthOptions {
|
|
|
777
767
|
* Customer authentication client.
|
|
778
768
|
*
|
|
779
769
|
* Manages customer registration, login, logout, and token lifecycle.
|
|
780
|
-
* All requests include X-
|
|
770
|
+
* All requests include X-Publishable-Key for tenant resolution.
|
|
781
771
|
*/
|
|
782
772
|
declare class CustomerAuth {
|
|
783
|
-
private
|
|
773
|
+
private publishableKey;
|
|
784
774
|
private baseUrl;
|
|
785
775
|
private token;
|
|
786
776
|
private onTokenChange?;
|
|
787
777
|
private refreshPromise;
|
|
788
|
-
constructor(
|
|
778
|
+
constructor(publishableKey: string, options?: CustomerAuthOptions);
|
|
789
779
|
/**
|
|
790
780
|
* Register a new customer account
|
|
791
781
|
*/
|
|
@@ -1107,7 +1097,6 @@ declare class Client {
|
|
|
1107
1097
|
customer: CustomerAuth;
|
|
1108
1098
|
protected state: ClientState;
|
|
1109
1099
|
protected config: ClientConfig;
|
|
1110
|
-
protected baseUrl: string;
|
|
1111
1100
|
constructor(options: ClientConfig);
|
|
1112
1101
|
from<T extends PublicCollection>(collection: T): ReadOnlyQueryBuilder<T>;
|
|
1113
1102
|
getState(): ClientState;
|
|
@@ -1130,11 +1119,10 @@ declare class ServerClient {
|
|
|
1130
1119
|
queryClient: QueryClient;
|
|
1131
1120
|
protected state: ClientState;
|
|
1132
1121
|
protected config: ClientServerConfig;
|
|
1133
|
-
protected baseUrl: string;
|
|
1134
1122
|
constructor(options: ClientServerConfig);
|
|
1135
1123
|
from<T extends PublicCollection>(collection: T): CollectionQueryBuilder<T>;
|
|
1136
1124
|
getState(): ClientState;
|
|
1137
|
-
getConfig():
|
|
1125
|
+
getConfig(): Omit<ClientServerConfig, 'secretKey'>;
|
|
1138
1126
|
}
|
|
1139
1127
|
/**
|
|
1140
1128
|
* Create a server-only client with full read/write access. Requires secretKey.
|
|
@@ -1162,4 +1150,4 @@ declare const formatOrderName: (items: OrderItem[]) => string;
|
|
|
1162
1150
|
*/
|
|
1163
1151
|
declare const resolveRelation: <T>(ref: T | string | number | null | undefined) => T | null;
|
|
1164
1152
|
|
|
1165
|
-
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 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, type ExtractArrayType,
|
|
1153
|
+
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 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, type ExtractArrayType, type GenerateMetadataOptions, type GetOrderParams, GoneError, type InfiniteQueryOptions, NetworkError, Order, OrderApi, type OrderApiOptions, 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, 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, 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 };
|