@01.software/sdk 0.1.0-dev.260109.7cf07c9 → 0.1.0-dev.260119.0a66443
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 +29 -21
- package/dist/index.cjs +261 -118
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +315 -30
- package/dist/index.d.ts +315 -30
- package/dist/index.js +266 -122
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.cts
CHANGED
|
@@ -420,6 +420,15 @@ interface BrandLogo {
|
|
|
420
420
|
* Type of logo asset
|
|
421
421
|
*/
|
|
422
422
|
type?: ('primary' | 'secondary' | 'logomark' | 'wordmark' | 'dark' | 'light') | null;
|
|
423
|
+
lqip?: string | null;
|
|
424
|
+
palette?: {
|
|
425
|
+
vibrant?: string | null;
|
|
426
|
+
muted?: string | null;
|
|
427
|
+
darkVibrant?: string | null;
|
|
428
|
+
darkMuted?: string | null;
|
|
429
|
+
lightVibrant?: string | null;
|
|
430
|
+
lightMuted?: string | null;
|
|
431
|
+
};
|
|
423
432
|
prefix?: string | null;
|
|
424
433
|
updatedAt: string;
|
|
425
434
|
createdAt: string;
|
|
@@ -441,6 +450,15 @@ interface TenantOgImage {
|
|
|
441
450
|
id: number;
|
|
442
451
|
tenant?: (number | null) | Tenant;
|
|
443
452
|
alt: string;
|
|
453
|
+
lqip?: string | null;
|
|
454
|
+
palette?: {
|
|
455
|
+
vibrant?: string | null;
|
|
456
|
+
muted?: string | null;
|
|
457
|
+
darkVibrant?: string | null;
|
|
458
|
+
darkMuted?: string | null;
|
|
459
|
+
lightVibrant?: string | null;
|
|
460
|
+
lightMuted?: string | null;
|
|
461
|
+
};
|
|
444
462
|
prefix?: string | null;
|
|
445
463
|
updatedAt: string;
|
|
446
464
|
createdAt: string;
|
|
@@ -462,6 +480,15 @@ interface TenantLogo {
|
|
|
462
480
|
id: number;
|
|
463
481
|
tenant?: (number | null) | Tenant;
|
|
464
482
|
alt: string;
|
|
483
|
+
lqip?: string | null;
|
|
484
|
+
palette?: {
|
|
485
|
+
vibrant?: string | null;
|
|
486
|
+
muted?: string | null;
|
|
487
|
+
darkVibrant?: string | null;
|
|
488
|
+
darkMuted?: string | null;
|
|
489
|
+
lightVibrant?: string | null;
|
|
490
|
+
lightMuted?: string | null;
|
|
491
|
+
};
|
|
465
492
|
prefix?: string | null;
|
|
466
493
|
updatedAt: string;
|
|
467
494
|
createdAt: string;
|
|
@@ -494,7 +521,6 @@ interface Product {
|
|
|
494
521
|
slug: string;
|
|
495
522
|
title: string;
|
|
496
523
|
subTitle?: string | null;
|
|
497
|
-
status?: ('draft' | 'preparing' | 'published' | 'closed' | 'archived') | null;
|
|
498
524
|
thumbnail?: (number | null) | ProductImage;
|
|
499
525
|
images?: (number | ProductImage)[] | null;
|
|
500
526
|
description?: {
|
|
@@ -530,6 +556,7 @@ interface Product {
|
|
|
530
556
|
isSoldOut?: boolean | null;
|
|
531
557
|
updatedAt: string;
|
|
532
558
|
createdAt: string;
|
|
559
|
+
_status?: ('draft' | 'published') | null;
|
|
533
560
|
}
|
|
534
561
|
/**
|
|
535
562
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
@@ -824,7 +851,6 @@ interface Document {
|
|
|
824
851
|
* 문서 유형 선택
|
|
825
852
|
*/
|
|
826
853
|
type: 'terms_of_service' | 'privacy_policy' | 'service_guide' | 'notice' | 'legal_notice' | 'refund_policy' | 'other';
|
|
827
|
-
status: 'draft' | 'review' | 'approved' | 'active' | 'expired';
|
|
828
854
|
/**
|
|
829
855
|
* 문서 버전 (예: 1.0, 1.1, 2.0)
|
|
830
856
|
*/
|
|
@@ -1007,6 +1033,24 @@ interface PostImage {
|
|
|
1007
1033
|
height?: number | null;
|
|
1008
1034
|
focalX?: number | null;
|
|
1009
1035
|
focalY?: number | null;
|
|
1036
|
+
sizes?: {
|
|
1037
|
+
'512'?: {
|
|
1038
|
+
url?: string | null;
|
|
1039
|
+
width?: number | null;
|
|
1040
|
+
height?: number | null;
|
|
1041
|
+
mimeType?: string | null;
|
|
1042
|
+
filesize?: number | null;
|
|
1043
|
+
filename?: string | null;
|
|
1044
|
+
};
|
|
1045
|
+
'1024'?: {
|
|
1046
|
+
url?: string | null;
|
|
1047
|
+
width?: number | null;
|
|
1048
|
+
height?: number | null;
|
|
1049
|
+
mimeType?: string | null;
|
|
1050
|
+
filesize?: number | null;
|
|
1051
|
+
filename?: string | null;
|
|
1052
|
+
};
|
|
1053
|
+
};
|
|
1010
1054
|
}
|
|
1011
1055
|
/**
|
|
1012
1056
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
@@ -1059,7 +1103,6 @@ interface Playlist {
|
|
|
1059
1103
|
*/
|
|
1060
1104
|
generateSlug?: boolean | null;
|
|
1061
1105
|
slug: string;
|
|
1062
|
-
status?: ('draft' | 'published') | null;
|
|
1063
1106
|
description?: string | null;
|
|
1064
1107
|
musics?: {
|
|
1065
1108
|
docs?: (number | Music)[];
|
|
@@ -1150,10 +1193,6 @@ interface Gallery {
|
|
|
1150
1193
|
slug: string;
|
|
1151
1194
|
description?: string | null;
|
|
1152
1195
|
images: (number | GalleryImage)[];
|
|
1153
|
-
/**
|
|
1154
|
-
* The status of the gallery
|
|
1155
|
-
*/
|
|
1156
|
-
status?: ('draft' | 'published') | null;
|
|
1157
1196
|
updatedAt: string;
|
|
1158
1197
|
createdAt: string;
|
|
1159
1198
|
}
|
|
@@ -1674,6 +1713,15 @@ interface TenantMetadataSelect<T extends boolean = true> {
|
|
|
1674
1713
|
interface TenantLogosSelect<T extends boolean = true> {
|
|
1675
1714
|
tenant?: T;
|
|
1676
1715
|
alt?: T;
|
|
1716
|
+
lqip?: T;
|
|
1717
|
+
palette?: T | {
|
|
1718
|
+
vibrant?: T;
|
|
1719
|
+
muted?: T;
|
|
1720
|
+
darkVibrant?: T;
|
|
1721
|
+
darkMuted?: T;
|
|
1722
|
+
lightVibrant?: T;
|
|
1723
|
+
lightMuted?: T;
|
|
1724
|
+
};
|
|
1677
1725
|
prefix?: T;
|
|
1678
1726
|
updatedAt?: T;
|
|
1679
1727
|
createdAt?: T;
|
|
@@ -1694,6 +1742,15 @@ interface TenantLogosSelect<T extends boolean = true> {
|
|
|
1694
1742
|
interface TenantOgImagesSelect<T extends boolean = true> {
|
|
1695
1743
|
tenant?: T;
|
|
1696
1744
|
alt?: T;
|
|
1745
|
+
lqip?: T;
|
|
1746
|
+
palette?: T | {
|
|
1747
|
+
vibrant?: T;
|
|
1748
|
+
muted?: T;
|
|
1749
|
+
darkVibrant?: T;
|
|
1750
|
+
darkMuted?: T;
|
|
1751
|
+
lightVibrant?: T;
|
|
1752
|
+
lightMuted?: T;
|
|
1753
|
+
};
|
|
1697
1754
|
prefix?: T;
|
|
1698
1755
|
updatedAt?: T;
|
|
1699
1756
|
createdAt?: T;
|
|
@@ -1719,7 +1776,6 @@ interface ProductsSelect<T extends boolean = true> {
|
|
|
1719
1776
|
slug?: T;
|
|
1720
1777
|
title?: T;
|
|
1721
1778
|
subTitle?: T;
|
|
1722
|
-
status?: T;
|
|
1723
1779
|
thumbnail?: T;
|
|
1724
1780
|
images?: T;
|
|
1725
1781
|
description?: T;
|
|
@@ -1733,6 +1789,7 @@ interface ProductsSelect<T extends boolean = true> {
|
|
|
1733
1789
|
isSoldOut?: T;
|
|
1734
1790
|
updatedAt?: T;
|
|
1735
1791
|
createdAt?: T;
|
|
1792
|
+
_status?: T;
|
|
1736
1793
|
}
|
|
1737
1794
|
/**
|
|
1738
1795
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
@@ -1866,6 +1923,15 @@ interface BrandsSelect<T extends boolean = true> {
|
|
|
1866
1923
|
interface BrandLogosSelect<T extends boolean = true> {
|
|
1867
1924
|
alt?: T;
|
|
1868
1925
|
type?: T;
|
|
1926
|
+
lqip?: T;
|
|
1927
|
+
palette?: T | {
|
|
1928
|
+
vibrant?: T;
|
|
1929
|
+
muted?: T;
|
|
1930
|
+
darkVibrant?: T;
|
|
1931
|
+
darkMuted?: T;
|
|
1932
|
+
lightVibrant?: T;
|
|
1933
|
+
lightMuted?: T;
|
|
1934
|
+
};
|
|
1869
1935
|
prefix?: T;
|
|
1870
1936
|
updatedAt?: T;
|
|
1871
1937
|
createdAt?: T;
|
|
@@ -1983,7 +2049,6 @@ interface DocumentsSelect<T extends boolean = true> {
|
|
|
1983
2049
|
generateSlug?: T;
|
|
1984
2050
|
slug?: T;
|
|
1985
2051
|
type?: T;
|
|
1986
|
-
status?: T;
|
|
1987
2052
|
version?: T;
|
|
1988
2053
|
effectiveDate?: T;
|
|
1989
2054
|
expiryDate?: T;
|
|
@@ -2136,6 +2201,24 @@ interface PostImagesSelect<T extends boolean = true> {
|
|
|
2136
2201
|
height?: T;
|
|
2137
2202
|
focalX?: T;
|
|
2138
2203
|
focalY?: T;
|
|
2204
|
+
sizes?: T | {
|
|
2205
|
+
'512'?: T | {
|
|
2206
|
+
url?: T;
|
|
2207
|
+
width?: T;
|
|
2208
|
+
height?: T;
|
|
2209
|
+
mimeType?: T;
|
|
2210
|
+
filesize?: T;
|
|
2211
|
+
filename?: T;
|
|
2212
|
+
};
|
|
2213
|
+
'1024'?: T | {
|
|
2214
|
+
url?: T;
|
|
2215
|
+
width?: T;
|
|
2216
|
+
height?: T;
|
|
2217
|
+
mimeType?: T;
|
|
2218
|
+
filesize?: T;
|
|
2219
|
+
filename?: T;
|
|
2220
|
+
};
|
|
2221
|
+
};
|
|
2139
2222
|
}
|
|
2140
2223
|
/**
|
|
2141
2224
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
@@ -2147,7 +2230,6 @@ interface PlaylistsSelect<T extends boolean = true> {
|
|
|
2147
2230
|
title?: T;
|
|
2148
2231
|
generateSlug?: T;
|
|
2149
2232
|
slug?: T;
|
|
2150
|
-
status?: T;
|
|
2151
2233
|
description?: T;
|
|
2152
2234
|
musics?: T;
|
|
2153
2235
|
updatedAt?: T;
|
|
@@ -2228,7 +2310,6 @@ interface GalleriesSelect<T extends boolean = true> {
|
|
|
2228
2310
|
slug?: T;
|
|
2229
2311
|
description?: T;
|
|
2230
2312
|
images?: T;
|
|
2231
|
-
status?: T;
|
|
2232
2313
|
updatedAt?: T;
|
|
2233
2314
|
createdAt?: T;
|
|
2234
2315
|
}
|
|
@@ -2493,8 +2574,55 @@ declare function isApiError(error: unknown): error is ApiError;
|
|
|
2493
2574
|
declare function isConfigError(error: unknown): error is ConfigError;
|
|
2494
2575
|
declare function isTimeoutError(error: unknown): error is TimeoutError;
|
|
2495
2576
|
|
|
2577
|
+
/**
|
|
2578
|
+
* Collection type derived from Payload Config.
|
|
2579
|
+
* This ensures type safety and automatic synchronization with payload-types.ts
|
|
2580
|
+
*/
|
|
2581
|
+
type Collection = keyof Config['collections'];
|
|
2582
|
+
/**
|
|
2583
|
+
* Internal Payload collections that should not be exposed via SDK.
|
|
2584
|
+
*/
|
|
2585
|
+
declare const INTERNAL_COLLECTIONS: readonly ["users", "payload-kv", "payload-locked-documents", "payload-preferences", "payload-migrations"];
|
|
2586
|
+
type InternalCollection = (typeof INTERNAL_COLLECTIONS)[number];
|
|
2587
|
+
/**
|
|
2588
|
+
* Public collections available for SDK access.
|
|
2589
|
+
* Excludes internal Payload system collections.
|
|
2590
|
+
*/
|
|
2591
|
+
type PublicCollection = Exclude<Collection, InternalCollection>;
|
|
2592
|
+
/**
|
|
2593
|
+
* Array of all public collection names for runtime use (e.g., Zod enum validation).
|
|
2594
|
+
* This is derived from Config to ensure type safety.
|
|
2595
|
+
*/
|
|
2596
|
+
declare const COLLECTIONS: readonly ["tenants", "tenant-metadata", "tenant-logos", "tenant-og-images", "products", "product-variants", "product-options", "product-categories", "product-tags", "product-images", "brands", "brand-logos", "orders", "order-products", "returns", "return-products", "transactions", "documents", "document-categories", "document-images", "posts", "post-categories", "post-tags", "post-images", "playlists", "playlist-images", "musics", "galleries", "gallery-images", "forms", "form-submissions", "media"];
|
|
2597
|
+
|
|
2598
|
+
type Environment = 'local' | 'development' | 'staging' | 'production';
|
|
2599
|
+
declare const API_URLS: Record<Environment, string>;
|
|
2600
|
+
/**
|
|
2601
|
+
* 환경에 맞는 API URL을 반환합니다.
|
|
2602
|
+
* 우선순위: baseUrl > environment > 환경변수 > 기본값(production)
|
|
2603
|
+
*/
|
|
2604
|
+
declare function resolveApiUrl(config?: {
|
|
2605
|
+
baseUrl?: string;
|
|
2606
|
+
environment?: Environment;
|
|
2607
|
+
}): string;
|
|
2496
2608
|
interface ClientBrowserConfig {
|
|
2497
2609
|
clientKey: string;
|
|
2610
|
+
/**
|
|
2611
|
+
* API 환경 설정.
|
|
2612
|
+
* - 'local': localhost:3000
|
|
2613
|
+
* - 'development': dev.01.software
|
|
2614
|
+
* - 'staging': stg.01.software
|
|
2615
|
+
* - 'production': api.01.software
|
|
2616
|
+
*
|
|
2617
|
+
* baseUrl이 설정되면 이 값은 무시됩니다.
|
|
2618
|
+
* @default 'production'
|
|
2619
|
+
*/
|
|
2620
|
+
environment?: Environment;
|
|
2621
|
+
/**
|
|
2622
|
+
* 커스텀 API URL. 설정 시 environment 값은 무시됩니다.
|
|
2623
|
+
* @example 'https://my-custom-api.example.com'
|
|
2624
|
+
*/
|
|
2625
|
+
baseUrl?: string;
|
|
2498
2626
|
}
|
|
2499
2627
|
interface ClientServerConfig extends ClientBrowserConfig {
|
|
2500
2628
|
secretKey: string;
|
|
@@ -2552,7 +2680,6 @@ interface RetryConfig {
|
|
|
2552
2680
|
interface ErrorLogger {
|
|
2553
2681
|
log(error: SDKError | Error, context?: Record<string, unknown>): void;
|
|
2554
2682
|
}
|
|
2555
|
-
type Collection = keyof Config['collections'];
|
|
2556
2683
|
type DeepPartial<T> = {
|
|
2557
2684
|
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
2558
2685
|
};
|
|
@@ -2570,12 +2697,95 @@ interface FetchOptions extends RequestInit {
|
|
|
2570
2697
|
debug?: boolean | DebugConfig;
|
|
2571
2698
|
retry?: RetryConfig;
|
|
2572
2699
|
}
|
|
2700
|
+
interface JwtPayload {
|
|
2701
|
+
clientKey: string;
|
|
2702
|
+
iat?: number;
|
|
2703
|
+
exp?: number;
|
|
2704
|
+
}
|
|
2705
|
+
/**
|
|
2706
|
+
* Creates a JWT token for server-side authentication.
|
|
2707
|
+
* The token is valid for 1 hour by default.
|
|
2708
|
+
*
|
|
2709
|
+
* @param clientKey - Client API key
|
|
2710
|
+
* @param secretKey - Secret key used for signing
|
|
2711
|
+
* @param expiresIn - Token expiration time (default: '1h')
|
|
2712
|
+
* @returns Promise<string> JWT token
|
|
2713
|
+
*
|
|
2714
|
+
* @example
|
|
2715
|
+
* ```typescript
|
|
2716
|
+
* const token = await createServerToken('client-key', 'secret-key')
|
|
2717
|
+
* // Use in Authorization header: `Bearer ${token}`
|
|
2718
|
+
* ```
|
|
2719
|
+
*/
|
|
2720
|
+
declare function createServerToken(clientKey: string, secretKey: string, expiresIn?: string): Promise<string>;
|
|
2721
|
+
/**
|
|
2722
|
+
* Verifies a JWT token and returns the payload.
|
|
2723
|
+
*
|
|
2724
|
+
* @param token - JWT token to verify
|
|
2725
|
+
* @param secretKey - Secret key used for verification
|
|
2726
|
+
* @returns Promise<JwtPayload> Verified payload containing clientKey
|
|
2727
|
+
* @throws Error if token is invalid or expired
|
|
2728
|
+
*
|
|
2729
|
+
* @example
|
|
2730
|
+
* ```typescript
|
|
2731
|
+
* const payload = await verifyServerToken(token, 'secret-key')
|
|
2732
|
+
* console.log(payload.clientKey)
|
|
2733
|
+
* ```
|
|
2734
|
+
*/
|
|
2735
|
+
declare function verifyServerToken(token: string, secretKey: string): Promise<JwtPayload>;
|
|
2736
|
+
/**
|
|
2737
|
+
* Decodes a JWT token without verification.
|
|
2738
|
+
* WARNING: Use this only when you need to inspect token contents.
|
|
2739
|
+
* Always use verifyServerToken for authentication.
|
|
2740
|
+
*
|
|
2741
|
+
* @param token - JWT token to decode
|
|
2742
|
+
* @returns JwtPayload Decoded payload (unverified)
|
|
2743
|
+
*
|
|
2744
|
+
* @example
|
|
2745
|
+
* ```typescript
|
|
2746
|
+
* const payload = decodeServerToken(token)
|
|
2747
|
+
* console.log(payload.clientKey) // Unverified!
|
|
2748
|
+
* ```
|
|
2749
|
+
*/
|
|
2750
|
+
declare function decodeServerToken(token: string): JwtPayload;
|
|
2751
|
+
/**
|
|
2752
|
+
* Creates a Base64-encoded API key from clientKey and secretKey.
|
|
2753
|
+
* Use this for MCP server authentication.
|
|
2754
|
+
*
|
|
2755
|
+
* @param clientKey - Client API key
|
|
2756
|
+
* @param secretKey - Secret key
|
|
2757
|
+
* @returns Base64-encoded API key
|
|
2758
|
+
*
|
|
2759
|
+
* @example
|
|
2760
|
+
* ```typescript
|
|
2761
|
+
* const apiKey = createApiKey('client-key', 'secret-key')
|
|
2762
|
+
* // Use in x-api-key header
|
|
2763
|
+
* ```
|
|
2764
|
+
*/
|
|
2765
|
+
declare function createApiKey(clientKey: string, secretKey: string): string;
|
|
2766
|
+
/**
|
|
2767
|
+
* Parses a Base64-encoded API key to extract clientKey and secretKey.
|
|
2768
|
+
*
|
|
2769
|
+
* @param apiKey - Base64-encoded API key
|
|
2770
|
+
* @returns Object containing clientKey and secretKey
|
|
2771
|
+
* @throws Error if API key is invalid
|
|
2772
|
+
*
|
|
2773
|
+
* @example
|
|
2774
|
+
* ```typescript
|
|
2775
|
+
* const { clientKey, secretKey } = parseApiKey(apiKey)
|
|
2776
|
+
* ```
|
|
2777
|
+
*/
|
|
2778
|
+
declare function parseApiKey(apiKey: string): {
|
|
2779
|
+
clientKey: string;
|
|
2780
|
+
secretKey: string;
|
|
2781
|
+
};
|
|
2573
2782
|
|
|
2574
2783
|
declare class BaseApiClient {
|
|
2575
2784
|
protected clientKey: string;
|
|
2576
2785
|
protected secretKey?: string;
|
|
2786
|
+
protected baseUrl?: string;
|
|
2577
2787
|
protected defaultOptions: FetchOptions;
|
|
2578
|
-
constructor(clientKey: string, secretKey?: string);
|
|
2788
|
+
constructor(clientKey: string, secretKey?: string, baseUrl?: string);
|
|
2579
2789
|
protected get<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<ApiResponse<T>>;
|
|
2580
2790
|
protected post<T = unknown>(endpoint: string, data?: unknown, options?: FetchOptions): Promise<ApiResponse<T>>;
|
|
2581
2791
|
protected patch<T = unknown>(endpoint: string, data?: unknown, options?: FetchOptions): Promise<ApiResponse<T>>;
|
|
@@ -2585,7 +2795,7 @@ declare class BaseApiClient {
|
|
|
2585
2795
|
}
|
|
2586
2796
|
|
|
2587
2797
|
declare class CollectionsApi extends BaseApiClient {
|
|
2588
|
-
constructor(clientKey: string, secretKey?: string);
|
|
2798
|
+
constructor(clientKey: string, secretKey?: string, baseUrl?: string);
|
|
2589
2799
|
from<T extends Collection>(collection: T): CollectionQueryBuilder<T>;
|
|
2590
2800
|
requestGet<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<ApiResponse<T>>;
|
|
2591
2801
|
requestPost<T = unknown>(endpoint: string, data?: unknown): Promise<ApiResponse<T>>;
|
|
@@ -2604,28 +2814,101 @@ declare class CollectionQueryBuilder<T extends Collection> {
|
|
|
2604
2814
|
remove(id: number | string): Promise<ApiResponse<void>>;
|
|
2605
2815
|
}
|
|
2606
2816
|
|
|
2607
|
-
declare const COLLECTIONS: readonly ["tenants", "products", "product-variants", "product-options", "product-categories", "product-tags", "product-images", "orders", "order-products", "returns", "return-products", "transactions", "links", "link-images", "playlists", "playlist-images", "musics", "posts", "post-categories", "post-tags", "post-images", "documents", "document-images", "entities", "entity-categories", "entity-tags", "entity-images", "nodes", "galleries", "gallery-images", "forms"];
|
|
2608
|
-
|
|
2609
2817
|
interface UnifiedQueryOptions {
|
|
2610
|
-
|
|
2611
|
-
brandSecret?: string;
|
|
2818
|
+
clientKey?: string;
|
|
2612
2819
|
baseUrl?: string;
|
|
2613
2820
|
}
|
|
2821
|
+
declare function collectionKeys<T extends Collection>(collection: T): {
|
|
2822
|
+
all: readonly [T];
|
|
2823
|
+
lists: () => readonly [T, "list"];
|
|
2824
|
+
list: (options?: ApiQueryOptions) => readonly [T, "list", ApiQueryOptions | undefined];
|
|
2825
|
+
details: () => readonly [T, "detail"];
|
|
2826
|
+
detail: (id: string | number, options?: ApiQueryOptions) => readonly [T, "detail", string | number, ApiQueryOptions | undefined];
|
|
2827
|
+
infinites: () => readonly [T, "infinite"];
|
|
2828
|
+
infinite: (options?: Omit<ApiQueryOptions, "page">) => readonly [T, "infinite", Omit<ApiQueryOptions, "page"> | undefined];
|
|
2829
|
+
};
|
|
2830
|
+
interface CollectionQueryParams<T extends Collection> {
|
|
2831
|
+
collection: T;
|
|
2832
|
+
options?: ApiQueryOptions;
|
|
2833
|
+
}
|
|
2834
|
+
interface CollectionDetailQueryParams<T extends Collection> {
|
|
2835
|
+
collection: T;
|
|
2836
|
+
id: string | number;
|
|
2837
|
+
options?: ApiQueryOptions;
|
|
2838
|
+
}
|
|
2839
|
+
interface CollectionInfiniteQueryParams<T extends Collection> {
|
|
2840
|
+
collection: T;
|
|
2841
|
+
options?: Omit<ApiQueryOptions, 'page'>;
|
|
2842
|
+
pageSize?: number;
|
|
2843
|
+
}
|
|
2614
2844
|
declare class UnifiedQueryClient {
|
|
2615
2845
|
private queryClient;
|
|
2616
2846
|
private collectionsApi;
|
|
2617
2847
|
constructor(queryClient: QueryClient, options?: UnifiedQueryOptions);
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2848
|
+
useQuery<T extends Collection>(params: CollectionQueryParams<T>, options?: {
|
|
2849
|
+
enabled?: boolean;
|
|
2850
|
+
staleTime?: number;
|
|
2851
|
+
gcTime?: number;
|
|
2852
|
+
refetchOnWindowFocus?: boolean;
|
|
2853
|
+
refetchOnMount?: boolean;
|
|
2854
|
+
refetchInterval?: number | false;
|
|
2855
|
+
retry?: boolean | number;
|
|
2856
|
+
}): _tanstack_react_query.UseQueryResult<CollectionType<T>[], Error>;
|
|
2857
|
+
useSuspenseQuery<T extends Collection>(params: CollectionQueryParams<T>, options?: {
|
|
2858
|
+
staleTime?: number;
|
|
2859
|
+
gcTime?: number;
|
|
2860
|
+
refetchOnWindowFocus?: boolean;
|
|
2861
|
+
refetchOnMount?: boolean;
|
|
2862
|
+
refetchInterval?: number | false;
|
|
2863
|
+
retry?: boolean | number;
|
|
2864
|
+
}): _tanstack_react_query.UseSuspenseQueryResult<CollectionType<T>[], Error>;
|
|
2865
|
+
useQueryById<T extends Collection>(params: CollectionDetailQueryParams<T>, options?: {
|
|
2866
|
+
enabled?: boolean;
|
|
2867
|
+
staleTime?: number;
|
|
2868
|
+
gcTime?: number;
|
|
2869
|
+
refetchOnWindowFocus?: boolean;
|
|
2870
|
+
refetchOnMount?: boolean;
|
|
2871
|
+
refetchInterval?: number | false;
|
|
2872
|
+
retry?: boolean | number;
|
|
2873
|
+
}): _tanstack_react_query.UseQueryResult<_tanstack_react_query.NoInfer<CollectionType<T> | null>, Error>;
|
|
2874
|
+
useSuspenseQueryById<T extends Collection>(params: CollectionDetailQueryParams<T>, options?: {
|
|
2875
|
+
staleTime?: number;
|
|
2876
|
+
gcTime?: number;
|
|
2877
|
+
refetchOnWindowFocus?: boolean;
|
|
2878
|
+
refetchOnMount?: boolean;
|
|
2879
|
+
refetchInterval?: number | false;
|
|
2880
|
+
retry?: boolean | number;
|
|
2881
|
+
}): _tanstack_react_query.UseSuspenseQueryResult<CollectionType<T> | null, Error>;
|
|
2882
|
+
useInfiniteQuery<T extends Collection>(params: CollectionInfiniteQueryParams<T>, options?: {
|
|
2883
|
+
enabled?: boolean;
|
|
2884
|
+
staleTime?: number;
|
|
2885
|
+
gcTime?: number;
|
|
2886
|
+
refetchOnWindowFocus?: boolean;
|
|
2887
|
+
refetchOnMount?: boolean;
|
|
2888
|
+
retry?: boolean | number;
|
|
2889
|
+
}): _tanstack_react_query.UseInfiniteQueryResult<_tanstack_react_query.InfiniteData<CollectionType<T>[], unknown>, Error>;
|
|
2890
|
+
useSuspenseInfiniteQuery<T extends Collection>(params: CollectionInfiniteQueryParams<T>, options?: {
|
|
2891
|
+
staleTime?: number;
|
|
2892
|
+
gcTime?: number;
|
|
2893
|
+
refetchOnWindowFocus?: boolean;
|
|
2894
|
+
refetchOnMount?: boolean;
|
|
2895
|
+
retry?: boolean | number;
|
|
2896
|
+
}): _tanstack_react_query.UseSuspenseInfiniteQueryResult<_tanstack_react_query.InfiniteData<CollectionType<T>[], unknown>, Error>;
|
|
2897
|
+
prefetchQuery<T extends Collection>(params: CollectionQueryParams<T>, options?: {
|
|
2898
|
+
staleTime?: number;
|
|
2899
|
+
}): Promise<void>;
|
|
2900
|
+
prefetchQueryById<T extends Collection>(params: CollectionDetailQueryParams<T>, options?: {
|
|
2901
|
+
staleTime?: number;
|
|
2902
|
+
}): Promise<void>;
|
|
2903
|
+
prefetchInfiniteQuery<T extends Collection>(params: CollectionInfiniteQueryParams<T>, options?: {
|
|
2904
|
+
pages?: number;
|
|
2905
|
+
staleTime?: number;
|
|
2906
|
+
}): Promise<void>;
|
|
2907
|
+
invalidateQueries<T extends Collection>(collection: T, type?: 'list' | 'detail' | 'infinite'): Promise<void>;
|
|
2908
|
+
getQueryData<T extends Collection>(collection: T, type: 'list', options?: ApiQueryOptions): CollectionType<T>[] | undefined;
|
|
2909
|
+
getQueryData<T extends Collection>(collection: T, type: 'detail', id: string | number, options?: ApiQueryOptions): CollectionType<T> | null | undefined;
|
|
2910
|
+
setQueryData<T extends Collection>(collection: T, type: 'list', data: CollectionType<T>[], options?: ApiQueryOptions): void;
|
|
2911
|
+
setQueryData<T extends Collection>(collection: T, type: 'detail', id: string | number, data: CollectionType<T> | null, options?: ApiQueryOptions): void;
|
|
2629
2912
|
}
|
|
2630
2913
|
|
|
2631
2914
|
declare class BrowserClient<_Database = Config> {
|
|
@@ -2634,6 +2917,7 @@ declare class BrowserClient<_Database = Config> {
|
|
|
2634
2917
|
queryClient: QueryClient;
|
|
2635
2918
|
protected state: ClientState;
|
|
2636
2919
|
protected config: ClientBrowserConfig;
|
|
2920
|
+
protected baseUrl: string;
|
|
2637
2921
|
constructor(options: ClientBrowserConfig);
|
|
2638
2922
|
from<T extends Collection>(collection: T): CollectionQueryBuilder<T>;
|
|
2639
2923
|
getState(): ClientState;
|
|
@@ -2679,6 +2963,7 @@ declare class ServerClient<_Database = Config> {
|
|
|
2679
2963
|
collections: CollectionsApi;
|
|
2680
2964
|
protected state: ClientState;
|
|
2681
2965
|
protected config: ClientServerConfig;
|
|
2966
|
+
protected baseUrl: string;
|
|
2682
2967
|
constructor(options: ClientServerConfig);
|
|
2683
2968
|
from<T extends Collection>(collection: T): CollectionQueryBuilder<T>;
|
|
2684
2969
|
getState(): ClientState;
|
|
@@ -2727,4 +3012,4 @@ interface RichTextContentProps {
|
|
|
2727
3012
|
}
|
|
2728
3013
|
declare function RichTextContent({ data, className, internalDocToHref, blocks, }: RichTextContentProps): React.JSX.Element;
|
|
2729
3014
|
|
|
2730
|
-
export { ApiClient, type ApiClientOptions, ApiError, type ApiErrorResponse, type ApiQueryOptions, type ApiQueryReactOptions, type ApiResponse, type ApiSuccessResponse, type Auth, type Brand, type BrandLogo, type BrandLogosSelect, type BrandsSelect, BrowserClient, BrowserClient as BrowserClientType, COLLECTIONS, type ClientBrowserConfig, type ClientMetadata, type ClientServerConfig, type ClientState, type Collection, CollectionQueryBuilder, type CollectionType, CollectionsApi, type Config, ConfigError, type CreateOrderParams, type DebugConfig, type DeepPartial, type Document, type DocumentCategoriesSelect, type DocumentCategory, type DocumentImage, type DocumentImagesSelect, type DocumentsSelect, type ErrorLogger, type ExtractArrayType, type Form, type FormSubmission, type FormSubmissionsSelect, type FormsSelect, type GalleriesSelect, type Gallery, type GalleryImage, type GalleryImagesSelect, type IframeBlock, type Media, type MediaSelect, type Music, type MusicsSelect, NetworkError, type Order, type OrderProduct, type OrderProductsSelect, type OrdersSelect, type PaginationMeta, type PayloadKv, type PayloadKvSelect, type PayloadLockedDocument, type PayloadLockedDocumentsSelect, type PayloadMigration, type PayloadMigrationsSelect, type PayloadPreference, type PayloadPreferencesSelect, type PlayerBlock, type Playlist, type PlaylistImage, type PlaylistImagesSelect, type PlaylistsSelect, type Post, type PostCategoriesSelect, type PostCategory, type PostImage, type PostImagesSelect, type PostTag, type PostTagsSelect, type PostsSelect, type Product, type ProductCategoriesSelect, type ProductCategory, type ProductImage, type ProductImagesSelect, type ProductOption, type ProductOptionsSelect, type ProductTag, type ProductTagsSelect, type ProductVariant, type ProductVariantsSelect, type ProductsSelect, type RetryConfig, type Return, type ReturnProduct, type ReturnProductsSelect, type ReturnsSelect, RichTextContent, type RichTextContentProps, type RichTextData, SDKError, ServerClient, ServerClient as ServerClientType, type SupportedTimezones, type Tenant, type TenantLogo, type TenantLogosSelect, type TenantMetadataSelect, type TenantMetadatum, type TenantOgImage, type TenantOgImagesSelect, type TenantsSelect, TimeoutError, type Transaction, type TransactionsSelect, UnifiedQueryClient, type UnifiedQueryOptions, type UpdateOrderParams, type UpdateTransactionParams, type User, type UserAuthOperations, type UsersSelect, ValidationError, type WebhookEvent, type WebhookHandler, type WebhookOperation, createBrowserClient, createServerClient, createTypedWebhookHandler, formatOrderName, generateOrderNumber, getQueryClient, handleWebhook, isApiError, isConfigError, isErrorResponse, isNetworkError, isSDKError, isSuccessResponse, isTimeoutError, isValidWebhookEvent, isValidationError, objectFor };
|
|
3015
|
+
export { API_URLS, ApiClient, type ApiClientOptions, ApiError, type ApiErrorResponse, type ApiQueryOptions, type ApiQueryReactOptions, type ApiResponse, type ApiSuccessResponse, type Auth, type Brand, type BrandLogo, type BrandLogosSelect, type BrandsSelect, BrowserClient, BrowserClient as BrowserClientType, COLLECTIONS, type ClientBrowserConfig, type ClientMetadata, type ClientServerConfig, type ClientState, type Collection, type CollectionDetailQueryParams, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, type CollectionType, CollectionsApi, type Config, ConfigError, type CreateOrderParams, type DebugConfig, type DeepPartial, type Document, type DocumentCategoriesSelect, type DocumentCategory, type DocumentImage, type DocumentImagesSelect, type DocumentsSelect, type Environment, type ErrorLogger, type ExtractArrayType, type Form, type FormSubmission, type FormSubmissionsSelect, type FormsSelect, type GalleriesSelect, type Gallery, type GalleryImage, type GalleryImagesSelect, type IframeBlock, type JwtPayload, type Media, type MediaSelect, type Music, type MusicsSelect, NetworkError, type Order, type OrderProduct, type OrderProductsSelect, type OrdersSelect, type PaginationMeta, type PayloadKv, type PayloadKvSelect, type PayloadLockedDocument, type PayloadLockedDocumentsSelect, type PayloadMigration, type PayloadMigrationsSelect, type PayloadPreference, type PayloadPreferencesSelect, type PlayerBlock, type Playlist, type PlaylistImage, type PlaylistImagesSelect, type PlaylistsSelect, type Post, type PostCategoriesSelect, type PostCategory, type PostImage, type PostImagesSelect, type PostTag, type PostTagsSelect, type PostsSelect, type Product, type ProductCategoriesSelect, type ProductCategory, type ProductImage, type ProductImagesSelect, type ProductOption, type ProductOptionsSelect, type ProductTag, type ProductTagsSelect, type ProductVariant, type ProductVariantsSelect, type ProductsSelect, type PublicCollection, type RetryConfig, type Return, type ReturnProduct, type ReturnProductsSelect, type ReturnsSelect, RichTextContent, type RichTextContentProps, type RichTextData, SDKError, ServerClient, ServerClient as ServerClientType, type SupportedTimezones, type Tenant, type TenantLogo, type TenantLogosSelect, type TenantMetadataSelect, type TenantMetadatum, type TenantOgImage, type TenantOgImagesSelect, type TenantsSelect, TimeoutError, type Transaction, type TransactionsSelect, UnifiedQueryClient, type UnifiedQueryOptions, type UpdateOrderParams, type UpdateTransactionParams, type User, type UserAuthOperations, type UsersSelect, ValidationError, type WebhookEvent, type WebhookHandler, type WebhookOperation, collectionKeys, createApiKey, createBrowserClient, createServerClient, createServerToken, createTypedWebhookHandler, decodeServerToken, formatOrderName, generateOrderNumber, getQueryClient, handleWebhook, isApiError, isConfigError, isErrorResponse, isNetworkError, isSDKError, isSuccessResponse, isTimeoutError, isValidWebhookEvent, isValidationError, objectFor, parseApiKey, resolveApiUrl, verifyServerToken };
|