@01.software/sdk 0.1.0-dev.260109.7cf07c9 → 0.1.0-dev.260206.8918543
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 +124 -404
- package/dist/index.cjs +261 -118
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +320 -33
- package/dist/index.d.ts +320 -33
- package/dist/index.js +266 -122
- package/dist/index.js.map +1 -1
- package/package.json +3 -4
package/dist/index.d.ts
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
|
|
@@ -591,7 +618,7 @@ interface ProductCategory {
|
|
|
591
618
|
* When enabled, the slug will auto-generate from the title field on save and autosave.
|
|
592
619
|
*/
|
|
593
620
|
generateSlug?: boolean | null;
|
|
594
|
-
slug
|
|
621
|
+
slug?: string | null;
|
|
595
622
|
description?: string | null;
|
|
596
623
|
image?: (number | null) | ProductImage;
|
|
597
624
|
parent?: (number | null) | ProductCategory;
|
|
@@ -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
|
*/
|
|
@@ -889,7 +915,7 @@ interface DocumentCategory {
|
|
|
889
915
|
* When enabled, the slug will auto-generate from the title field on save and autosave.
|
|
890
916
|
*/
|
|
891
917
|
generateSlug?: boolean | null;
|
|
892
|
-
slug
|
|
918
|
+
slug?: string | null;
|
|
893
919
|
description?: string | null;
|
|
894
920
|
updatedAt: string;
|
|
895
921
|
createdAt: string;
|
|
@@ -952,6 +978,7 @@ interface Post {
|
|
|
952
978
|
tenant?: (number | null) | Tenant;
|
|
953
979
|
thumbnail?: (number | null) | PostImage;
|
|
954
980
|
title: string;
|
|
981
|
+
subtitle?: string | null;
|
|
955
982
|
/**
|
|
956
983
|
* When enabled, the slug will auto-generate from the title field on save and autosave.
|
|
957
984
|
*/
|
|
@@ -1007,6 +1034,24 @@ interface PostImage {
|
|
|
1007
1034
|
height?: number | null;
|
|
1008
1035
|
focalX?: number | null;
|
|
1009
1036
|
focalY?: number | null;
|
|
1037
|
+
sizes?: {
|
|
1038
|
+
'512'?: {
|
|
1039
|
+
url?: string | null;
|
|
1040
|
+
width?: number | null;
|
|
1041
|
+
height?: number | null;
|
|
1042
|
+
mimeType?: string | null;
|
|
1043
|
+
filesize?: number | null;
|
|
1044
|
+
filename?: string | null;
|
|
1045
|
+
};
|
|
1046
|
+
'1024'?: {
|
|
1047
|
+
url?: string | null;
|
|
1048
|
+
width?: number | null;
|
|
1049
|
+
height?: number | null;
|
|
1050
|
+
mimeType?: string | null;
|
|
1051
|
+
filesize?: number | null;
|
|
1052
|
+
filename?: string | null;
|
|
1053
|
+
};
|
|
1054
|
+
};
|
|
1010
1055
|
}
|
|
1011
1056
|
/**
|
|
1012
1057
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
@@ -1021,7 +1066,7 @@ interface PostCategory {
|
|
|
1021
1066
|
* When enabled, the slug will auto-generate from the title field on save and autosave.
|
|
1022
1067
|
*/
|
|
1023
1068
|
generateSlug?: boolean | null;
|
|
1024
|
-
slug
|
|
1069
|
+
slug?: string | null;
|
|
1025
1070
|
description?: string | null;
|
|
1026
1071
|
parent?: (number | null) | PostCategory;
|
|
1027
1072
|
updatedAt: string;
|
|
@@ -1059,7 +1104,6 @@ interface Playlist {
|
|
|
1059
1104
|
*/
|
|
1060
1105
|
generateSlug?: boolean | null;
|
|
1061
1106
|
slug: string;
|
|
1062
|
-
status?: ('draft' | 'published') | null;
|
|
1063
1107
|
description?: string | null;
|
|
1064
1108
|
musics?: {
|
|
1065
1109
|
docs?: (number | Music)[];
|
|
@@ -1150,10 +1194,6 @@ interface Gallery {
|
|
|
1150
1194
|
slug: string;
|
|
1151
1195
|
description?: string | null;
|
|
1152
1196
|
images: (number | GalleryImage)[];
|
|
1153
|
-
/**
|
|
1154
|
-
* The status of the gallery
|
|
1155
|
-
*/
|
|
1156
|
-
status?: ('draft' | 'published') | null;
|
|
1157
1197
|
updatedAt: string;
|
|
1158
1198
|
createdAt: string;
|
|
1159
1199
|
}
|
|
@@ -1674,6 +1714,15 @@ interface TenantMetadataSelect<T extends boolean = true> {
|
|
|
1674
1714
|
interface TenantLogosSelect<T extends boolean = true> {
|
|
1675
1715
|
tenant?: T;
|
|
1676
1716
|
alt?: T;
|
|
1717
|
+
lqip?: T;
|
|
1718
|
+
palette?: T | {
|
|
1719
|
+
vibrant?: T;
|
|
1720
|
+
muted?: T;
|
|
1721
|
+
darkVibrant?: T;
|
|
1722
|
+
darkMuted?: T;
|
|
1723
|
+
lightVibrant?: T;
|
|
1724
|
+
lightMuted?: T;
|
|
1725
|
+
};
|
|
1677
1726
|
prefix?: T;
|
|
1678
1727
|
updatedAt?: T;
|
|
1679
1728
|
createdAt?: T;
|
|
@@ -1694,6 +1743,15 @@ interface TenantLogosSelect<T extends boolean = true> {
|
|
|
1694
1743
|
interface TenantOgImagesSelect<T extends boolean = true> {
|
|
1695
1744
|
tenant?: T;
|
|
1696
1745
|
alt?: T;
|
|
1746
|
+
lqip?: T;
|
|
1747
|
+
palette?: T | {
|
|
1748
|
+
vibrant?: T;
|
|
1749
|
+
muted?: T;
|
|
1750
|
+
darkVibrant?: T;
|
|
1751
|
+
darkMuted?: T;
|
|
1752
|
+
lightVibrant?: T;
|
|
1753
|
+
lightMuted?: T;
|
|
1754
|
+
};
|
|
1697
1755
|
prefix?: T;
|
|
1698
1756
|
updatedAt?: T;
|
|
1699
1757
|
createdAt?: T;
|
|
@@ -1719,7 +1777,6 @@ interface ProductsSelect<T extends boolean = true> {
|
|
|
1719
1777
|
slug?: T;
|
|
1720
1778
|
title?: T;
|
|
1721
1779
|
subTitle?: T;
|
|
1722
|
-
status?: T;
|
|
1723
1780
|
thumbnail?: T;
|
|
1724
1781
|
images?: T;
|
|
1725
1782
|
description?: T;
|
|
@@ -1733,6 +1790,7 @@ interface ProductsSelect<T extends boolean = true> {
|
|
|
1733
1790
|
isSoldOut?: T;
|
|
1734
1791
|
updatedAt?: T;
|
|
1735
1792
|
createdAt?: T;
|
|
1793
|
+
_status?: T;
|
|
1736
1794
|
}
|
|
1737
1795
|
/**
|
|
1738
1796
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
@@ -1866,6 +1924,15 @@ interface BrandsSelect<T extends boolean = true> {
|
|
|
1866
1924
|
interface BrandLogosSelect<T extends boolean = true> {
|
|
1867
1925
|
alt?: T;
|
|
1868
1926
|
type?: T;
|
|
1927
|
+
lqip?: T;
|
|
1928
|
+
palette?: T | {
|
|
1929
|
+
vibrant?: T;
|
|
1930
|
+
muted?: T;
|
|
1931
|
+
darkVibrant?: T;
|
|
1932
|
+
darkMuted?: T;
|
|
1933
|
+
lightVibrant?: T;
|
|
1934
|
+
lightMuted?: T;
|
|
1935
|
+
};
|
|
1869
1936
|
prefix?: T;
|
|
1870
1937
|
updatedAt?: T;
|
|
1871
1938
|
createdAt?: T;
|
|
@@ -1983,7 +2050,6 @@ interface DocumentsSelect<T extends boolean = true> {
|
|
|
1983
2050
|
generateSlug?: T;
|
|
1984
2051
|
slug?: T;
|
|
1985
2052
|
type?: T;
|
|
1986
|
-
status?: T;
|
|
1987
2053
|
version?: T;
|
|
1988
2054
|
effectiveDate?: T;
|
|
1989
2055
|
expiryDate?: T;
|
|
@@ -2070,6 +2136,7 @@ interface PostsSelect<T extends boolean = true> {
|
|
|
2070
2136
|
tenant?: T;
|
|
2071
2137
|
thumbnail?: T;
|
|
2072
2138
|
title?: T;
|
|
2139
|
+
subtitle?: T;
|
|
2073
2140
|
generateSlug?: T;
|
|
2074
2141
|
slug?: T;
|
|
2075
2142
|
categories?: T;
|
|
@@ -2136,6 +2203,24 @@ interface PostImagesSelect<T extends boolean = true> {
|
|
|
2136
2203
|
height?: T;
|
|
2137
2204
|
focalX?: T;
|
|
2138
2205
|
focalY?: T;
|
|
2206
|
+
sizes?: T | {
|
|
2207
|
+
'512'?: T | {
|
|
2208
|
+
url?: T;
|
|
2209
|
+
width?: T;
|
|
2210
|
+
height?: T;
|
|
2211
|
+
mimeType?: T;
|
|
2212
|
+
filesize?: T;
|
|
2213
|
+
filename?: T;
|
|
2214
|
+
};
|
|
2215
|
+
'1024'?: T | {
|
|
2216
|
+
url?: T;
|
|
2217
|
+
width?: T;
|
|
2218
|
+
height?: T;
|
|
2219
|
+
mimeType?: T;
|
|
2220
|
+
filesize?: T;
|
|
2221
|
+
filename?: T;
|
|
2222
|
+
};
|
|
2223
|
+
};
|
|
2139
2224
|
}
|
|
2140
2225
|
/**
|
|
2141
2226
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
@@ -2147,7 +2232,6 @@ interface PlaylistsSelect<T extends boolean = true> {
|
|
|
2147
2232
|
title?: T;
|
|
2148
2233
|
generateSlug?: T;
|
|
2149
2234
|
slug?: T;
|
|
2150
|
-
status?: T;
|
|
2151
2235
|
description?: T;
|
|
2152
2236
|
musics?: T;
|
|
2153
2237
|
updatedAt?: T;
|
|
@@ -2228,7 +2312,6 @@ interface GalleriesSelect<T extends boolean = true> {
|
|
|
2228
2312
|
slug?: T;
|
|
2229
2313
|
description?: T;
|
|
2230
2314
|
images?: T;
|
|
2231
|
-
status?: T;
|
|
2232
2315
|
updatedAt?: T;
|
|
2233
2316
|
createdAt?: T;
|
|
2234
2317
|
}
|
|
@@ -2493,8 +2576,55 @@ declare function isApiError(error: unknown): error is ApiError;
|
|
|
2493
2576
|
declare function isConfigError(error: unknown): error is ConfigError;
|
|
2494
2577
|
declare function isTimeoutError(error: unknown): error is TimeoutError;
|
|
2495
2578
|
|
|
2579
|
+
/**
|
|
2580
|
+
* Collection type derived from Payload Config.
|
|
2581
|
+
* This ensures type safety and automatic synchronization with payload-types.ts
|
|
2582
|
+
*/
|
|
2583
|
+
type Collection = keyof Config['collections'];
|
|
2584
|
+
/**
|
|
2585
|
+
* Internal Payload collections that should not be exposed via SDK.
|
|
2586
|
+
*/
|
|
2587
|
+
declare const INTERNAL_COLLECTIONS: readonly ["users", "payload-kv", "payload-locked-documents", "payload-preferences", "payload-migrations"];
|
|
2588
|
+
type InternalCollection = (typeof INTERNAL_COLLECTIONS)[number];
|
|
2589
|
+
/**
|
|
2590
|
+
* Public collections available for SDK access.
|
|
2591
|
+
* Excludes internal Payload system collections.
|
|
2592
|
+
*/
|
|
2593
|
+
type PublicCollection = Exclude<Collection, InternalCollection>;
|
|
2594
|
+
/**
|
|
2595
|
+
* Array of all public collection names for runtime use (e.g., Zod enum validation).
|
|
2596
|
+
* This is derived from Config to ensure type safety.
|
|
2597
|
+
*/
|
|
2598
|
+
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"];
|
|
2599
|
+
|
|
2600
|
+
type Environment = 'local' | 'development' | 'staging' | 'production';
|
|
2601
|
+
declare const API_URLS: Record<Environment, string>;
|
|
2602
|
+
/**
|
|
2603
|
+
* 환경에 맞는 API URL을 반환합니다.
|
|
2604
|
+
* 우선순위: baseUrl > environment > 환경변수 > 기본값(production)
|
|
2605
|
+
*/
|
|
2606
|
+
declare function resolveApiUrl(config?: {
|
|
2607
|
+
baseUrl?: string;
|
|
2608
|
+
environment?: Environment;
|
|
2609
|
+
}): string;
|
|
2496
2610
|
interface ClientBrowserConfig {
|
|
2497
2611
|
clientKey: string;
|
|
2612
|
+
/**
|
|
2613
|
+
* API 환경 설정.
|
|
2614
|
+
* - 'local': localhost:3000
|
|
2615
|
+
* - 'development': dev.01.software
|
|
2616
|
+
* - 'staging': stg.01.software
|
|
2617
|
+
* - 'production': api.01.software
|
|
2618
|
+
*
|
|
2619
|
+
* baseUrl이 설정되면 이 값은 무시됩니다.
|
|
2620
|
+
* @default 'production'
|
|
2621
|
+
*/
|
|
2622
|
+
environment?: Environment;
|
|
2623
|
+
/**
|
|
2624
|
+
* 커스텀 API URL. 설정 시 environment 값은 무시됩니다.
|
|
2625
|
+
* @example 'https://my-custom-api.example.com'
|
|
2626
|
+
*/
|
|
2627
|
+
baseUrl?: string;
|
|
2498
2628
|
}
|
|
2499
2629
|
interface ClientServerConfig extends ClientBrowserConfig {
|
|
2500
2630
|
secretKey: string;
|
|
@@ -2552,7 +2682,6 @@ interface RetryConfig {
|
|
|
2552
2682
|
interface ErrorLogger {
|
|
2553
2683
|
log(error: SDKError | Error, context?: Record<string, unknown>): void;
|
|
2554
2684
|
}
|
|
2555
|
-
type Collection = keyof Config['collections'];
|
|
2556
2685
|
type DeepPartial<T> = {
|
|
2557
2686
|
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
2558
2687
|
};
|
|
@@ -2570,12 +2699,95 @@ interface FetchOptions extends RequestInit {
|
|
|
2570
2699
|
debug?: boolean | DebugConfig;
|
|
2571
2700
|
retry?: RetryConfig;
|
|
2572
2701
|
}
|
|
2702
|
+
interface JwtPayload {
|
|
2703
|
+
clientKey: string;
|
|
2704
|
+
iat?: number;
|
|
2705
|
+
exp?: number;
|
|
2706
|
+
}
|
|
2707
|
+
/**
|
|
2708
|
+
* Creates a JWT token for server-side authentication.
|
|
2709
|
+
* The token is valid for 1 hour by default.
|
|
2710
|
+
*
|
|
2711
|
+
* @param clientKey - Client API key
|
|
2712
|
+
* @param secretKey - Secret key used for signing
|
|
2713
|
+
* @param expiresIn - Token expiration time (default: '1h')
|
|
2714
|
+
* @returns Promise<string> JWT token
|
|
2715
|
+
*
|
|
2716
|
+
* @example
|
|
2717
|
+
* ```typescript
|
|
2718
|
+
* const token = await createServerToken('client-key', 'secret-key')
|
|
2719
|
+
* // Use in Authorization header: `Bearer ${token}`
|
|
2720
|
+
* ```
|
|
2721
|
+
*/
|
|
2722
|
+
declare function createServerToken(clientKey: string, secretKey: string, expiresIn?: string): Promise<string>;
|
|
2723
|
+
/**
|
|
2724
|
+
* Verifies a JWT token and returns the payload.
|
|
2725
|
+
*
|
|
2726
|
+
* @param token - JWT token to verify
|
|
2727
|
+
* @param secretKey - Secret key used for verification
|
|
2728
|
+
* @returns Promise<JwtPayload> Verified payload containing clientKey
|
|
2729
|
+
* @throws Error if token is invalid or expired
|
|
2730
|
+
*
|
|
2731
|
+
* @example
|
|
2732
|
+
* ```typescript
|
|
2733
|
+
* const payload = await verifyServerToken(token, 'secret-key')
|
|
2734
|
+
* console.log(payload.clientKey)
|
|
2735
|
+
* ```
|
|
2736
|
+
*/
|
|
2737
|
+
declare function verifyServerToken(token: string, secretKey: string): Promise<JwtPayload>;
|
|
2738
|
+
/**
|
|
2739
|
+
* Decodes a JWT token without verification.
|
|
2740
|
+
* WARNING: Use this only when you need to inspect token contents.
|
|
2741
|
+
* Always use verifyServerToken for authentication.
|
|
2742
|
+
*
|
|
2743
|
+
* @param token - JWT token to decode
|
|
2744
|
+
* @returns JwtPayload Decoded payload (unverified)
|
|
2745
|
+
*
|
|
2746
|
+
* @example
|
|
2747
|
+
* ```typescript
|
|
2748
|
+
* const payload = decodeServerToken(token)
|
|
2749
|
+
* console.log(payload.clientKey) // Unverified!
|
|
2750
|
+
* ```
|
|
2751
|
+
*/
|
|
2752
|
+
declare function decodeServerToken(token: string): JwtPayload;
|
|
2753
|
+
/**
|
|
2754
|
+
* Creates a Base64-encoded API key from clientKey and secretKey.
|
|
2755
|
+
* Use this for MCP server authentication.
|
|
2756
|
+
*
|
|
2757
|
+
* @param clientKey - Client API key
|
|
2758
|
+
* @param secretKey - Secret key
|
|
2759
|
+
* @returns Base64-encoded API key
|
|
2760
|
+
*
|
|
2761
|
+
* @example
|
|
2762
|
+
* ```typescript
|
|
2763
|
+
* const apiKey = createApiKey('client-key', 'secret-key')
|
|
2764
|
+
* // Use in x-api-key header
|
|
2765
|
+
* ```
|
|
2766
|
+
*/
|
|
2767
|
+
declare function createApiKey(clientKey: string, secretKey: string): string;
|
|
2768
|
+
/**
|
|
2769
|
+
* Parses a Base64-encoded API key to extract clientKey and secretKey.
|
|
2770
|
+
*
|
|
2771
|
+
* @param apiKey - Base64-encoded API key
|
|
2772
|
+
* @returns Object containing clientKey and secretKey
|
|
2773
|
+
* @throws Error if API key is invalid
|
|
2774
|
+
*
|
|
2775
|
+
* @example
|
|
2776
|
+
* ```typescript
|
|
2777
|
+
* const { clientKey, secretKey } = parseApiKey(apiKey)
|
|
2778
|
+
* ```
|
|
2779
|
+
*/
|
|
2780
|
+
declare function parseApiKey(apiKey: string): {
|
|
2781
|
+
clientKey: string;
|
|
2782
|
+
secretKey: string;
|
|
2783
|
+
};
|
|
2573
2784
|
|
|
2574
2785
|
declare class BaseApiClient {
|
|
2575
2786
|
protected clientKey: string;
|
|
2576
2787
|
protected secretKey?: string;
|
|
2788
|
+
protected baseUrl?: string;
|
|
2577
2789
|
protected defaultOptions: FetchOptions;
|
|
2578
|
-
constructor(clientKey: string, secretKey?: string);
|
|
2790
|
+
constructor(clientKey: string, secretKey?: string, baseUrl?: string);
|
|
2579
2791
|
protected get<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<ApiResponse<T>>;
|
|
2580
2792
|
protected post<T = unknown>(endpoint: string, data?: unknown, options?: FetchOptions): Promise<ApiResponse<T>>;
|
|
2581
2793
|
protected patch<T = unknown>(endpoint: string, data?: unknown, options?: FetchOptions): Promise<ApiResponse<T>>;
|
|
@@ -2585,7 +2797,7 @@ declare class BaseApiClient {
|
|
|
2585
2797
|
}
|
|
2586
2798
|
|
|
2587
2799
|
declare class CollectionsApi extends BaseApiClient {
|
|
2588
|
-
constructor(clientKey: string, secretKey?: string);
|
|
2800
|
+
constructor(clientKey: string, secretKey?: string, baseUrl?: string);
|
|
2589
2801
|
from<T extends Collection>(collection: T): CollectionQueryBuilder<T>;
|
|
2590
2802
|
requestGet<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<ApiResponse<T>>;
|
|
2591
2803
|
requestPost<T = unknown>(endpoint: string, data?: unknown): Promise<ApiResponse<T>>;
|
|
@@ -2604,28 +2816,101 @@ declare class CollectionQueryBuilder<T extends Collection> {
|
|
|
2604
2816
|
remove(id: number | string): Promise<ApiResponse<void>>;
|
|
2605
2817
|
}
|
|
2606
2818
|
|
|
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
2819
|
interface UnifiedQueryOptions {
|
|
2610
|
-
|
|
2611
|
-
brandSecret?: string;
|
|
2820
|
+
clientKey?: string;
|
|
2612
2821
|
baseUrl?: string;
|
|
2613
2822
|
}
|
|
2823
|
+
declare function collectionKeys<T extends Collection>(collection: T): {
|
|
2824
|
+
all: readonly [T];
|
|
2825
|
+
lists: () => readonly [T, "list"];
|
|
2826
|
+
list: (options?: ApiQueryOptions) => readonly [T, "list", ApiQueryOptions | undefined];
|
|
2827
|
+
details: () => readonly [T, "detail"];
|
|
2828
|
+
detail: (id: string | number, options?: ApiQueryOptions) => readonly [T, "detail", string | number, ApiQueryOptions | undefined];
|
|
2829
|
+
infinites: () => readonly [T, "infinite"];
|
|
2830
|
+
infinite: (options?: Omit<ApiQueryOptions, "page">) => readonly [T, "infinite", Omit<ApiQueryOptions, "page"> | undefined];
|
|
2831
|
+
};
|
|
2832
|
+
interface CollectionQueryParams<T extends Collection> {
|
|
2833
|
+
collection: T;
|
|
2834
|
+
options?: ApiQueryOptions;
|
|
2835
|
+
}
|
|
2836
|
+
interface CollectionDetailQueryParams<T extends Collection> {
|
|
2837
|
+
collection: T;
|
|
2838
|
+
id: string | number;
|
|
2839
|
+
options?: ApiQueryOptions;
|
|
2840
|
+
}
|
|
2841
|
+
interface CollectionInfiniteQueryParams<T extends Collection> {
|
|
2842
|
+
collection: T;
|
|
2843
|
+
options?: Omit<ApiQueryOptions, 'page'>;
|
|
2844
|
+
pageSize?: number;
|
|
2845
|
+
}
|
|
2614
2846
|
declare class UnifiedQueryClient {
|
|
2615
2847
|
private queryClient;
|
|
2616
2848
|
private collectionsApi;
|
|
2617
2849
|
constructor(queryClient: QueryClient, options?: UnifiedQueryOptions);
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2850
|
+
useQuery<T extends Collection>(params: CollectionQueryParams<T>, options?: {
|
|
2851
|
+
enabled?: boolean;
|
|
2852
|
+
staleTime?: number;
|
|
2853
|
+
gcTime?: number;
|
|
2854
|
+
refetchOnWindowFocus?: boolean;
|
|
2855
|
+
refetchOnMount?: boolean;
|
|
2856
|
+
refetchInterval?: number | false;
|
|
2857
|
+
retry?: boolean | number;
|
|
2858
|
+
}): _tanstack_react_query.UseQueryResult<CollectionType<T>[], Error>;
|
|
2859
|
+
useSuspenseQuery<T extends Collection>(params: CollectionQueryParams<T>, options?: {
|
|
2860
|
+
staleTime?: number;
|
|
2861
|
+
gcTime?: number;
|
|
2862
|
+
refetchOnWindowFocus?: boolean;
|
|
2863
|
+
refetchOnMount?: boolean;
|
|
2864
|
+
refetchInterval?: number | false;
|
|
2865
|
+
retry?: boolean | number;
|
|
2866
|
+
}): _tanstack_react_query.UseSuspenseQueryResult<CollectionType<T>[], Error>;
|
|
2867
|
+
useQueryById<T extends Collection>(params: CollectionDetailQueryParams<T>, options?: {
|
|
2868
|
+
enabled?: boolean;
|
|
2869
|
+
staleTime?: number;
|
|
2870
|
+
gcTime?: number;
|
|
2871
|
+
refetchOnWindowFocus?: boolean;
|
|
2872
|
+
refetchOnMount?: boolean;
|
|
2873
|
+
refetchInterval?: number | false;
|
|
2874
|
+
retry?: boolean | number;
|
|
2875
|
+
}): _tanstack_react_query.UseQueryResult<_tanstack_react_query.NoInfer<CollectionType<T> | null>, Error>;
|
|
2876
|
+
useSuspenseQueryById<T extends Collection>(params: CollectionDetailQueryParams<T>, options?: {
|
|
2877
|
+
staleTime?: number;
|
|
2878
|
+
gcTime?: number;
|
|
2879
|
+
refetchOnWindowFocus?: boolean;
|
|
2880
|
+
refetchOnMount?: boolean;
|
|
2881
|
+
refetchInterval?: number | false;
|
|
2882
|
+
retry?: boolean | number;
|
|
2883
|
+
}): _tanstack_react_query.UseSuspenseQueryResult<CollectionType<T> | null, Error>;
|
|
2884
|
+
useInfiniteQuery<T extends Collection>(params: CollectionInfiniteQueryParams<T>, options?: {
|
|
2885
|
+
enabled?: boolean;
|
|
2886
|
+
staleTime?: number;
|
|
2887
|
+
gcTime?: number;
|
|
2888
|
+
refetchOnWindowFocus?: boolean;
|
|
2889
|
+
refetchOnMount?: boolean;
|
|
2890
|
+
retry?: boolean | number;
|
|
2891
|
+
}): _tanstack_react_query.UseInfiniteQueryResult<_tanstack_react_query.InfiniteData<CollectionType<T>[], unknown>, Error>;
|
|
2892
|
+
useSuspenseInfiniteQuery<T extends Collection>(params: CollectionInfiniteQueryParams<T>, options?: {
|
|
2893
|
+
staleTime?: number;
|
|
2894
|
+
gcTime?: number;
|
|
2895
|
+
refetchOnWindowFocus?: boolean;
|
|
2896
|
+
refetchOnMount?: boolean;
|
|
2897
|
+
retry?: boolean | number;
|
|
2898
|
+
}): _tanstack_react_query.UseSuspenseInfiniteQueryResult<_tanstack_react_query.InfiniteData<CollectionType<T>[], unknown>, Error>;
|
|
2899
|
+
prefetchQuery<T extends Collection>(params: CollectionQueryParams<T>, options?: {
|
|
2900
|
+
staleTime?: number;
|
|
2901
|
+
}): Promise<void>;
|
|
2902
|
+
prefetchQueryById<T extends Collection>(params: CollectionDetailQueryParams<T>, options?: {
|
|
2903
|
+
staleTime?: number;
|
|
2904
|
+
}): Promise<void>;
|
|
2905
|
+
prefetchInfiniteQuery<T extends Collection>(params: CollectionInfiniteQueryParams<T>, options?: {
|
|
2906
|
+
pages?: number;
|
|
2907
|
+
staleTime?: number;
|
|
2908
|
+
}): Promise<void>;
|
|
2909
|
+
invalidateQueries<T extends Collection>(collection: T, type?: 'list' | 'detail' | 'infinite'): Promise<void>;
|
|
2910
|
+
getQueryData<T extends Collection>(collection: T, type: 'list', options?: ApiQueryOptions): CollectionType<T>[] | undefined;
|
|
2911
|
+
getQueryData<T extends Collection>(collection: T, type: 'detail', id: string | number, options?: ApiQueryOptions): CollectionType<T> | null | undefined;
|
|
2912
|
+
setQueryData<T extends Collection>(collection: T, type: 'list', data: CollectionType<T>[], options?: ApiQueryOptions): void;
|
|
2913
|
+
setQueryData<T extends Collection>(collection: T, type: 'detail', id: string | number, data: CollectionType<T> | null, options?: ApiQueryOptions): void;
|
|
2629
2914
|
}
|
|
2630
2915
|
|
|
2631
2916
|
declare class BrowserClient<_Database = Config> {
|
|
@@ -2634,6 +2919,7 @@ declare class BrowserClient<_Database = Config> {
|
|
|
2634
2919
|
queryClient: QueryClient;
|
|
2635
2920
|
protected state: ClientState;
|
|
2636
2921
|
protected config: ClientBrowserConfig;
|
|
2922
|
+
protected baseUrl: string;
|
|
2637
2923
|
constructor(options: ClientBrowserConfig);
|
|
2638
2924
|
from<T extends Collection>(collection: T): CollectionQueryBuilder<T>;
|
|
2639
2925
|
getState(): ClientState;
|
|
@@ -2679,6 +2965,7 @@ declare class ServerClient<_Database = Config> {
|
|
|
2679
2965
|
collections: CollectionsApi;
|
|
2680
2966
|
protected state: ClientState;
|
|
2681
2967
|
protected config: ClientServerConfig;
|
|
2968
|
+
protected baseUrl: string;
|
|
2682
2969
|
constructor(options: ClientServerConfig);
|
|
2683
2970
|
from<T extends Collection>(collection: T): CollectionQueryBuilder<T>;
|
|
2684
2971
|
getState(): ClientState;
|
|
@@ -2727,4 +3014,4 @@ interface RichTextContentProps {
|
|
|
2727
3014
|
}
|
|
2728
3015
|
declare function RichTextContent({ data, className, internalDocToHref, blocks, }: RichTextContentProps): React.JSX.Element;
|
|
2729
3016
|
|
|
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 };
|
|
3017
|
+
export { API_URLS, ApiClient, type ApiClientOptions, ApiError, type ApiErrorResponse, type ApiQueryOptions, type ApiQueryReactOptions, type ApiResponse, type ApiSuccessResponse, type Auth, type Brand, type BrandLogo, type BrandLogosSelect, type BrandsSelect, BrowserClient, BrowserClient as BrowserClientType, COLLECTIONS, type ClientBrowserConfig, type ClientMetadata, type ClientServerConfig, type ClientState, type Collection, type CollectionDetailQueryParams, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, type CollectionType, CollectionsApi, type Config, ConfigError, type CreateOrderParams, type DebugConfig, type DeepPartial, type Document, type DocumentCategoriesSelect, type DocumentCategory, type DocumentImage, type DocumentImagesSelect, type DocumentsSelect, type Environment, type ErrorLogger, type ExtractArrayType, type Form, type FormSubmission, type FormSubmissionsSelect, type FormsSelect, type GalleriesSelect, type Gallery, type GalleryImage, type GalleryImagesSelect, type IframeBlock, type JwtPayload, type Media, type MediaSelect, type Music, type MusicsSelect, NetworkError, type Order, type OrderProduct, type OrderProductsSelect, type OrdersSelect, type PaginationMeta, type PayloadKv, type PayloadKvSelect, type PayloadLockedDocument, type PayloadLockedDocumentsSelect, type PayloadMigration, type PayloadMigrationsSelect, type PayloadPreference, type PayloadPreferencesSelect, type PlayerBlock, type Playlist, type PlaylistImage, type PlaylistImagesSelect, type PlaylistsSelect, type Post, type PostCategoriesSelect, type PostCategory, type PostImage, type PostImagesSelect, type PostTag, type PostTagsSelect, type PostsSelect, type Product, type ProductCategoriesSelect, type ProductCategory, type ProductImage, type ProductImagesSelect, type ProductOption, type ProductOptionsSelect, type ProductTag, type ProductTagsSelect, type ProductVariant, type ProductVariantsSelect, type ProductsSelect, type PublicCollection, type RetryConfig, type Return, type ReturnProduct, type ReturnProductsSelect, type ReturnsSelect, RichTextContent, type RichTextContentProps, type RichTextData, SDKError, ServerClient, ServerClient as ServerClientType, type SupportedTimezones, type Tenant, type TenantLogo, type TenantLogosSelect, type TenantMetadataSelect, type TenantMetadatum, type TenantOgImage, type TenantOgImagesSelect, type TenantsSelect, TimeoutError, type Transaction, type TransactionsSelect, UnifiedQueryClient, type UnifiedQueryOptions, type UpdateOrderParams, type UpdateTransactionParams, type User, type UserAuthOperations, type UsersSelect, ValidationError, type WebhookEvent, type WebhookHandler, type WebhookOperation, collectionKeys, createApiKey, createBrowserClient, createServerClient, createServerToken, createTypedWebhookHandler, decodeServerToken, formatOrderName, generateOrderNumber, getQueryClient, handleWebhook, isApiError, isConfigError, isErrorResponse, isNetworkError, isSDKError, isSuccessResponse, isTimeoutError, isValidWebhookEvent, isValidationError, objectFor, parseApiKey, resolveApiUrl, verifyServerToken };
|