@01.software/sdk 0.29.0 → 0.31.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 +331 -77
- package/dist/analytics/react.cjs +4 -1
- package/dist/analytics/react.cjs.map +1 -1
- package/dist/analytics/react.js +4 -1
- package/dist/analytics/react.js.map +1 -1
- package/dist/analytics.cjs +4 -1
- package/dist/analytics.cjs.map +1 -1
- package/dist/analytics.js +4 -1
- package/dist/analytics.js.map +1 -1
- package/dist/client.cjs +1541 -0
- package/dist/client.cjs.map +1 -0
- package/dist/client.d.cts +28 -0
- package/dist/client.d.ts +28 -0
- package/dist/client.js +1518 -0
- package/dist/client.js.map +1 -0
- package/dist/collection-client-ByzY3hWK.d.ts +218 -0
- package/dist/collection-client-DFXXz0vk.d.cts +218 -0
- package/dist/{const-DAjQYNuM.d.ts → const-AytzliEu.d.cts} +5 -7
- package/dist/{const-Dsixdi6z.d.cts → const-BGCP-OJL.d.ts} +5 -7
- package/dist/index-BGEhoDUs.d.cts +106 -0
- package/dist/index-BGEhoDUs.d.ts +106 -0
- package/dist/index.cjs +1006 -1615
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -115
- package/dist/index.d.ts +11 -115
- package/dist/index.js +932 -1559
- package/dist/index.js.map +1 -1
- package/dist/metadata.cjs +91 -0
- package/dist/metadata.cjs.map +1 -0
- package/dist/metadata.d.cts +58 -0
- package/dist/metadata.d.ts +58 -0
- package/dist/metadata.js +68 -0
- package/dist/metadata.js.map +1 -0
- package/dist/{payload-types-Ci-ZA7aM.d.cts → payload-types-Wa4-eC6x.d.cts} +794 -532
- package/dist/{payload-types-Ci-ZA7aM.d.ts → payload-types-Wa4-eC6x.d.ts} +794 -532
- package/dist/query.cjs +1841 -0
- package/dist/query.cjs.map +1 -0
- package/dist/query.d.cts +244 -0
- package/dist/query.d.ts +244 -0
- package/dist/query.js +1836 -0
- package/dist/query.js.map +1 -0
- package/dist/realtime.cjs +4 -1
- 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 +4 -1
- package/dist/realtime.js.map +1 -1
- package/dist/{server-BINWywT8.d.cts → server-CrsPyqEc.d.cts} +14 -31
- package/dist/{server-BINWywT8.d.ts → server-CrsPyqEc.d.ts} +14 -31
- package/dist/server.cjs +430 -846
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +137 -7
- package/dist/server.d.ts +137 -7
- package/dist/server.js +430 -864
- package/dist/server.js.map +1 -1
- package/dist/{server-Cv0Q4dPQ.d.ts → types-BX2mqDf6.d.ts} +270 -743
- package/dist/{types-BWq_WlbB.d.ts → types-CVA10VC-.d.ts} +6 -2
- package/dist/{types-zKjATmDK.d.cts → types-CmLG-7RL.d.cts} +6 -2
- package/dist/{server-C0C8dtms.d.cts → types-DChFjQGz.d.cts} +270 -743
- package/dist/ui/canvas/server.cjs +7 -6
- package/dist/ui/canvas/server.cjs.map +1 -1
- package/dist/ui/canvas/server.d.cts +1 -3
- package/dist/ui/canvas/server.d.ts +1 -3
- package/dist/ui/canvas/server.js +7 -6
- package/dist/ui/canvas/server.js.map +1 -1
- package/dist/ui/canvas.cjs +11 -10
- package/dist/ui/canvas.cjs.map +1 -1
- package/dist/ui/canvas.d.cts +29 -6
- package/dist/ui/canvas.d.ts +29 -6
- package/dist/ui/canvas.js +11 -10
- 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.d.cts +3 -3
- package/dist/webhook.d.ts +3 -3
- package/package.json +84 -15
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { D as DebugConfig, R as RetryConfig, A as ApiQueryOptions, P as PayloadFindResponse, g as PayloadMutationResponse } from './types-DChFjQGz.cjs';
|
|
2
|
+
import { GenerateMetadataOptions, Metadata } from './metadata.cjs';
|
|
3
|
+
import { c as ServerCollection, P as PublicCollection } from './const-AytzliEu.cjs';
|
|
4
|
+
import { C as CollectionType } from './types-CmLG-7RL.cjs';
|
|
5
|
+
|
|
6
|
+
interface FetchOptions extends RequestInit {
|
|
7
|
+
apiUrl?: string;
|
|
8
|
+
publishableKey?: string;
|
|
9
|
+
secretKey?: string;
|
|
10
|
+
customerToken?: string;
|
|
11
|
+
timeout?: number;
|
|
12
|
+
debug?: boolean | DebugConfig;
|
|
13
|
+
retry?: RetryConfig;
|
|
14
|
+
/** Called on 401 when customerToken is set and reason=token_expired. Return a new token to retry, or null to fail. */
|
|
15
|
+
onUnauthorized?: () => Promise<string | null>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare class HttpClient {
|
|
19
|
+
protected publishableKey: string;
|
|
20
|
+
protected secretKey?: string;
|
|
21
|
+
private getCustomerToken?;
|
|
22
|
+
private onUnauthorized?;
|
|
23
|
+
private onRequestId?;
|
|
24
|
+
private apiUrl?;
|
|
25
|
+
constructor(publishableKey: string, secretKey?: string, getCustomerToken?: () => string | null, onUnauthorized?: () => Promise<string | null>, onRequestId?: (id: string | null) => void, apiUrl?: string);
|
|
26
|
+
protected get defaultOptions(): FetchOptions;
|
|
27
|
+
protected fetchWithTracking(url: string, opts: FetchOptions): Promise<Response>;
|
|
28
|
+
protected buildUrl(endpoint: string, options?: ApiQueryOptions): string;
|
|
29
|
+
protected assertJsonResponse(response: Response): void;
|
|
30
|
+
/**
|
|
31
|
+
* Parse Payload CMS find response (list query)
|
|
32
|
+
* Returns native Payload response structure
|
|
33
|
+
*/
|
|
34
|
+
protected parseFindResponse<T>(response: Response): Promise<PayloadFindResponse<T>>;
|
|
35
|
+
/**
|
|
36
|
+
* Parse Payload CMS mutation response (create/update)
|
|
37
|
+
* Returns native Payload response structure
|
|
38
|
+
*/
|
|
39
|
+
protected parseMutationResponse<T>(response: Response): Promise<PayloadMutationResponse<T>>;
|
|
40
|
+
/**
|
|
41
|
+
* Parse Payload CMS document response (findById/delete)
|
|
42
|
+
* Returns document directly without wrapper
|
|
43
|
+
*/
|
|
44
|
+
protected parseDocumentResponse<T>(response: Response): Promise<T>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
type ReadOnlyCollectionApi = Pick<CollectionClient, 'requestFind' | 'requestFindById' | 'requestCount'>;
|
|
48
|
+
/**
|
|
49
|
+
* Read-only subset of CollectionQueryBuilder.
|
|
50
|
+
* Client.from() returns this type to prevent write operations at compile time.
|
|
51
|
+
*/
|
|
52
|
+
type ReadOnlyQueryBuilder<T extends PublicCollection> = ReadOnlyCollectionQueryBuilder<T>;
|
|
53
|
+
declare class ReadOnlyCollectionQueryBuilder<T extends PublicCollection> {
|
|
54
|
+
private api;
|
|
55
|
+
private collection;
|
|
56
|
+
constructor(api: ReadOnlyCollectionApi, collection: T);
|
|
57
|
+
find(options?: ApiQueryOptions): Promise<PayloadFindResponse<CollectionType<T>>>;
|
|
58
|
+
findById(id: string | number, options?: ApiQueryOptions): Promise<CollectionType<T>>;
|
|
59
|
+
count(options?: ApiQueryOptions): Promise<{
|
|
60
|
+
totalDocs: number;
|
|
61
|
+
}>;
|
|
62
|
+
findMetadata(options?: ApiQueryOptions, metadataOptions?: GenerateMetadataOptions): Promise<Metadata | null>;
|
|
63
|
+
findMetadataById(id: string, metadataOptions?: GenerateMetadataOptions): Promise<Metadata>;
|
|
64
|
+
}
|
|
65
|
+
declare class CollectionQueryBuilder<T extends string> {
|
|
66
|
+
private api;
|
|
67
|
+
private collection;
|
|
68
|
+
constructor(api: CollectionClient, collection: T);
|
|
69
|
+
/**
|
|
70
|
+
* Find documents (list query)
|
|
71
|
+
* GET /api/{collection}
|
|
72
|
+
* @returns Payload CMS find response with docs array and pagination
|
|
73
|
+
*/
|
|
74
|
+
find(options?: ApiQueryOptions): Promise<PayloadFindResponse<CollectionType<T>>>;
|
|
75
|
+
/**
|
|
76
|
+
* Find document by ID
|
|
77
|
+
* GET /api/{collection}/{id}
|
|
78
|
+
* @returns Document object directly (no wrapper)
|
|
79
|
+
*/
|
|
80
|
+
findById(id: string | number, options?: ApiQueryOptions): Promise<CollectionType<T>>;
|
|
81
|
+
/**
|
|
82
|
+
* Create a new document
|
|
83
|
+
* POST /api/{collection}
|
|
84
|
+
* @returns Payload CMS mutation response with doc and message
|
|
85
|
+
*/
|
|
86
|
+
create(data: Partial<CollectionType<T>>, options?: {
|
|
87
|
+
file?: File | Blob;
|
|
88
|
+
filename?: string;
|
|
89
|
+
}): Promise<PayloadMutationResponse<CollectionType<T>>>;
|
|
90
|
+
/**
|
|
91
|
+
* Update a document by ID
|
|
92
|
+
* PATCH /api/{collection}/{id}
|
|
93
|
+
* @returns Payload CMS mutation response with doc and message
|
|
94
|
+
*/
|
|
95
|
+
update(id: string, data: Partial<CollectionType<T>>, options?: {
|
|
96
|
+
file?: File | Blob;
|
|
97
|
+
filename?: string;
|
|
98
|
+
}): Promise<PayloadMutationResponse<CollectionType<T>>>;
|
|
99
|
+
/**
|
|
100
|
+
* Count documents
|
|
101
|
+
* GET /api/{collection}/count
|
|
102
|
+
* @returns Count response with totalDocs
|
|
103
|
+
*/
|
|
104
|
+
count(options?: ApiQueryOptions): Promise<{
|
|
105
|
+
totalDocs: number;
|
|
106
|
+
}>;
|
|
107
|
+
/**
|
|
108
|
+
* Find first matching document and return its Next.js Metadata.
|
|
109
|
+
* Applies depth: 1 (SEO image populate) and limit: 1 automatically.
|
|
110
|
+
* @returns Metadata or null if no document matches
|
|
111
|
+
*/
|
|
112
|
+
findMetadata(options?: ApiQueryOptions, metadataOptions?: GenerateMetadataOptions): Promise<Metadata | null>;
|
|
113
|
+
/**
|
|
114
|
+
* Find document by ID and return its Next.js Metadata.
|
|
115
|
+
* Applies depth: 1 (SEO image populate) automatically.
|
|
116
|
+
* @returns Metadata (throws on 404)
|
|
117
|
+
*/
|
|
118
|
+
findMetadataById(id: string, metadataOptions?: GenerateMetadataOptions): Promise<Metadata>;
|
|
119
|
+
/**
|
|
120
|
+
* Update multiple documents (bulk update)
|
|
121
|
+
* PATCH /api/{collection}
|
|
122
|
+
* @returns Payload CMS find response with updated docs
|
|
123
|
+
*/
|
|
124
|
+
updateMany(where: ApiQueryOptions['where'], data: Partial<CollectionType<T>>): Promise<PayloadFindResponse<CollectionType<T>>>;
|
|
125
|
+
/**
|
|
126
|
+
* Delete a document by ID
|
|
127
|
+
* DELETE /api/{collection}/{id}
|
|
128
|
+
* @returns Deleted document object directly (no wrapper)
|
|
129
|
+
*/
|
|
130
|
+
remove(id: string): Promise<CollectionType<T>>;
|
|
131
|
+
/**
|
|
132
|
+
* Delete multiple documents (bulk delete)
|
|
133
|
+
* DELETE /api/{collection}
|
|
134
|
+
* @returns Payload CMS find response with deleted docs
|
|
135
|
+
*/
|
|
136
|
+
removeMany(where: ApiQueryOptions['where']): Promise<PayloadFindResponse<CollectionType<T>>>;
|
|
137
|
+
}
|
|
138
|
+
declare class ServerCollectionQueryBuilder<T extends ServerCollection> extends CollectionQueryBuilder<T> {
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
declare class CollectionClient<TCollection extends string = PublicCollection> extends HttpClient {
|
|
142
|
+
from<T extends TCollection>(collection: T): CollectionQueryBuilder<T>;
|
|
143
|
+
/**
|
|
144
|
+
* Find documents (list query)
|
|
145
|
+
* GET /api/{collection}
|
|
146
|
+
*/
|
|
147
|
+
requestFind<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<PayloadFindResponse<T>>;
|
|
148
|
+
/**
|
|
149
|
+
* Find-like response from a custom endpoint
|
|
150
|
+
* POST /api/...custom-endpoint
|
|
151
|
+
*/
|
|
152
|
+
requestFindEndpoint<T = unknown>(endpoint: string, data?: unknown): Promise<PayloadFindResponse<T>>;
|
|
153
|
+
/**
|
|
154
|
+
* Find document by ID
|
|
155
|
+
* GET /api/{collection}/{id}
|
|
156
|
+
*/
|
|
157
|
+
requestFindById<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<T>;
|
|
158
|
+
/**
|
|
159
|
+
* Create document
|
|
160
|
+
* POST /api/{collection}
|
|
161
|
+
*/
|
|
162
|
+
requestCreate<T = unknown>(endpoint: string, data?: unknown): Promise<PayloadMutationResponse<T>>;
|
|
163
|
+
/**
|
|
164
|
+
* Update document
|
|
165
|
+
* PATCH /api/{collection}/{id}
|
|
166
|
+
*/
|
|
167
|
+
requestUpdate<T = unknown>(endpoint: string, data?: unknown): Promise<PayloadMutationResponse<T>>;
|
|
168
|
+
/**
|
|
169
|
+
* Count documents
|
|
170
|
+
* GET /api/{collection}/count
|
|
171
|
+
*/
|
|
172
|
+
requestCount(endpoint: string, options?: ApiQueryOptions): Promise<{
|
|
173
|
+
totalDocs: number;
|
|
174
|
+
}>;
|
|
175
|
+
/**
|
|
176
|
+
* Update multiple documents (bulk update)
|
|
177
|
+
* PATCH /api/{collection}
|
|
178
|
+
*/
|
|
179
|
+
requestUpdateMany<T = unknown>(endpoint: string, data: {
|
|
180
|
+
where?: unknown;
|
|
181
|
+
data: unknown;
|
|
182
|
+
}): Promise<PayloadFindResponse<T>>;
|
|
183
|
+
/**
|
|
184
|
+
* Delete document
|
|
185
|
+
* DELETE /api/{collection}/{id}
|
|
186
|
+
*/
|
|
187
|
+
requestDelete<T = unknown>(endpoint: string): Promise<T>;
|
|
188
|
+
/**
|
|
189
|
+
* Delete multiple documents (bulk delete)
|
|
190
|
+
* DELETE /api/{collection}
|
|
191
|
+
*/
|
|
192
|
+
requestDeleteMany<T = unknown>(endpoint: string, data: {
|
|
193
|
+
where?: unknown;
|
|
194
|
+
}): Promise<PayloadFindResponse<T>>;
|
|
195
|
+
/**
|
|
196
|
+
* Create document with file upload
|
|
197
|
+
* POST /api/{collection} (multipart/form-data)
|
|
198
|
+
*/
|
|
199
|
+
requestCreateWithFile<T = unknown>(endpoint: string, data: unknown, file: File | Blob, filename?: string): Promise<PayloadMutationResponse<T>>;
|
|
200
|
+
/**
|
|
201
|
+
* Update document with file upload
|
|
202
|
+
* PATCH /api/{collection}/{id} (multipart/form-data)
|
|
203
|
+
*/
|
|
204
|
+
requestUpdateWithFile<T = unknown>(endpoint: string, data: unknown, file: File | Blob, filename?: string): Promise<PayloadMutationResponse<T>>;
|
|
205
|
+
}
|
|
206
|
+
declare class ServerCollectionClient extends CollectionClient<ServerCollection> {
|
|
207
|
+
from<T extends ServerCollection>(collection: T): ServerCollectionQueryBuilder<T>;
|
|
208
|
+
}
|
|
209
|
+
declare class ReadOnlyCollectionClient extends HttpClient {
|
|
210
|
+
from<T extends PublicCollection>(collection: T): ReadOnlyQueryBuilder<T>;
|
|
211
|
+
requestFind<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<PayloadFindResponse<T>>;
|
|
212
|
+
requestFindById<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<T>;
|
|
213
|
+
requestCount(endpoint: string, options?: ApiQueryOptions): Promise<{
|
|
214
|
+
totalDocs: number;
|
|
215
|
+
}>;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export { CollectionClient as C, ReadOnlyCollectionClient as R, ServerCollectionClient as S };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { e as Config } from './payload-types-Wa4-eC6x.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Collection type derived from Payload Config.
|
|
@@ -9,13 +9,12 @@ type Collection = keyof Config['collections'];
|
|
|
9
9
|
* Internal collections that should not be exposed via SDK.
|
|
10
10
|
* Includes Payload system collections and admin-only collections.
|
|
11
11
|
*/
|
|
12
|
-
declare const INTERNAL_COLLECTIONS: readonly ["users", "payload-kv", "payload-locked-documents", "payload-preferences", "payload-migrations", "payload-folders", "field-configs", "system-media", "track-assets", "audiences", "email-logs", "api-usage", "tenant-analytics-daily", "tenant-web-analytics-config", "analytics-event-schemas", "subscriptions", "billing-history", "inventory-reservations", "order-status-logs", "api-keys", "personal-access-tokens", "tenant-entitlements", "tenant-purge-jobs", "direct-upload-sessions", "webhook-events", "webhook-deliveries", "audit-logs", "plans", "webhooks", "event-registrations"];
|
|
13
|
-
type InternalCollection = (typeof INTERNAL_COLLECTIONS)[number];
|
|
12
|
+
declare const INTERNAL_COLLECTIONS: readonly ["users", "payload-kv", "payload-locked-documents", "payload-preferences", "payload-migrations", "payload-folders", "field-configs", "system-media", "track-assets", "audiences", "email-logs", "api-usage", "tenant-analytics-daily", "tenant-web-analytics-config", "analytics-event-schemas", "subscriptions", "billing-history", "inventory-reservations", "product-collection-items", "order-status-logs", "api-keys", "personal-access-tokens", "tenant-entitlements", "tenant-purge-jobs", "direct-upload-sessions", "webhook-events", "webhook-deliveries", "audit-logs", "plans", "webhooks", "event-registrations"];
|
|
14
13
|
/**
|
|
15
14
|
* Array of all public collection names for runtime use (e.g., Zod enum validation).
|
|
16
15
|
* This is the single source of truth for which collections are publicly accessible via SDK.
|
|
17
16
|
*/
|
|
18
|
-
declare const COLLECTIONS: readonly ["tenants", "tenant-metadata", "tenant-logos", "products", "product-variants", "product-options", "product-option-values", "product-categories", "product-tags", "product-collections", "brands", "brand-logos", "orders", "order-items", "returns", "return-items", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-profiles", "customer-
|
|
17
|
+
declare const COLLECTIONS: readonly ["tenants", "tenant-metadata", "tenant-logos", "products", "product-variants", "product-options", "product-option-values", "product-categories", "product-tags", "product-collections", "brands", "brand-logos", "orders", "order-items", "returns", "return-items", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-profiles", "customer-addresses", "carts", "cart-items", "discounts", "shipping-policies", "shipping-zones", "documents", "document-categories", "document-types", "articles", "article-authors", "article-categories", "article-tags", "playlists", "playlist-categories", "playlist-tags", "tracks", "track-categories", "track-tags", "galleries", "gallery-categories", "gallery-tags", "gallery-items", "links", "link-categories", "link-tags", "canvases", "canvas-node-types", "canvas-edge-types", "canvas-categories", "canvas-tags", "canvas-nodes", "canvas-edges", "videos", "video-categories", "video-tags", "live-streams", "images", "forms", "form-submissions", "posts", "comments", "reactions", "reaction-types", "bookmarks", "post-categories", "customer-profile-lists", "event-calendars", "events", "event-categories", "event-occurrences", "event-tags"];
|
|
19
18
|
/**
|
|
20
19
|
* Server-auth collection names for runtime use. These collections are safe for
|
|
21
20
|
* secret-key/PAT SDK and MCP server tools, but must not appear in browser or
|
|
@@ -27,8 +26,7 @@ declare const SERVER_ONLY_COLLECTIONS: readonly ["customer-groups", "reports", "
|
|
|
27
26
|
* Derived from the COLLECTIONS array (single source of truth).
|
|
28
27
|
*/
|
|
29
28
|
type PublicCollection = (typeof COLLECTIONS)[number];
|
|
30
|
-
|
|
31
|
-
declare const SERVER_COLLECTIONS: readonly ["tenants", "tenant-metadata", "tenant-logos", "products", "product-variants", "product-options", "product-option-values", "product-categories", "product-tags", "product-collections", "brands", "brand-logos", "orders", "order-items", "returns", "return-items", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-profiles", "customer-profile-lists", "customer-addresses", "carts", "cart-items", "discounts", "shipping-policies", "shipping-zones", "documents", "document-categories", "document-types", "articles", "article-authors", "article-categories", "article-tags", "playlists", "playlist-categories", "playlist-tags", "tracks", "track-categories", "track-tags", "galleries", "gallery-categories", "gallery-tags", "gallery-items", "links", "link-categories", "link-tags", "canvases", "canvas-node-types", "canvas-edge-types", "canvas-categories", "canvas-tags", "canvas-nodes", "canvas-edges", "videos", "video-categories", "video-tags", "live-streams", "images", "forms", "form-submissions", "posts", "comments", "reactions", "reaction-types", "bookmarks", "post-categories", "event-calendars", "events", "event-categories", "event-occurrences", "event-tags", "customer-groups", "reports", "community-bans"];
|
|
29
|
+
declare const SERVER_COLLECTIONS: readonly ["tenants", "tenant-metadata", "tenant-logos", "products", "product-variants", "product-options", "product-option-values", "product-categories", "product-tags", "product-collections", "brands", "brand-logos", "orders", "order-items", "returns", "return-items", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-profiles", "customer-addresses", "carts", "cart-items", "discounts", "shipping-policies", "shipping-zones", "documents", "document-categories", "document-types", "articles", "article-authors", "article-categories", "article-tags", "playlists", "playlist-categories", "playlist-tags", "tracks", "track-categories", "track-tags", "galleries", "gallery-categories", "gallery-tags", "gallery-items", "links", "link-categories", "link-tags", "canvases", "canvas-node-types", "canvas-edge-types", "canvas-categories", "canvas-tags", "canvas-nodes", "canvas-edges", "videos", "video-categories", "video-tags", "live-streams", "images", "forms", "form-submissions", "posts", "comments", "reactions", "reaction-types", "bookmarks", "post-categories", "customer-profile-lists", "event-calendars", "events", "event-categories", "event-occurrences", "event-tags", "customer-groups", "reports", "community-bans"];
|
|
32
30
|
type ServerCollection = (typeof SERVER_COLLECTIONS)[number];
|
|
33
31
|
|
|
34
|
-
export {
|
|
32
|
+
export { type Collection as C, INTERNAL_COLLECTIONS as I, type PublicCollection as P, SERVER_COLLECTIONS as S, COLLECTIONS as a, SERVER_ONLY_COLLECTIONS as b, type ServerCollection as c };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { e as Config } from './payload-types-Wa4-eC6x.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Collection type derived from Payload Config.
|
|
@@ -9,13 +9,12 @@ type Collection = keyof Config['collections'];
|
|
|
9
9
|
* Internal collections that should not be exposed via SDK.
|
|
10
10
|
* Includes Payload system collections and admin-only collections.
|
|
11
11
|
*/
|
|
12
|
-
declare const INTERNAL_COLLECTIONS: readonly ["users", "payload-kv", "payload-locked-documents", "payload-preferences", "payload-migrations", "payload-folders", "field-configs", "system-media", "track-assets", "audiences", "email-logs", "api-usage", "tenant-analytics-daily", "tenant-web-analytics-config", "analytics-event-schemas", "subscriptions", "billing-history", "inventory-reservations", "order-status-logs", "api-keys", "personal-access-tokens", "tenant-entitlements", "tenant-purge-jobs", "direct-upload-sessions", "webhook-events", "webhook-deliveries", "audit-logs", "plans", "webhooks", "event-registrations"];
|
|
13
|
-
type InternalCollection = (typeof INTERNAL_COLLECTIONS)[number];
|
|
12
|
+
declare const INTERNAL_COLLECTIONS: readonly ["users", "payload-kv", "payload-locked-documents", "payload-preferences", "payload-migrations", "payload-folders", "field-configs", "system-media", "track-assets", "audiences", "email-logs", "api-usage", "tenant-analytics-daily", "tenant-web-analytics-config", "analytics-event-schemas", "subscriptions", "billing-history", "inventory-reservations", "product-collection-items", "order-status-logs", "api-keys", "personal-access-tokens", "tenant-entitlements", "tenant-purge-jobs", "direct-upload-sessions", "webhook-events", "webhook-deliveries", "audit-logs", "plans", "webhooks", "event-registrations"];
|
|
14
13
|
/**
|
|
15
14
|
* Array of all public collection names for runtime use (e.g., Zod enum validation).
|
|
16
15
|
* This is the single source of truth for which collections are publicly accessible via SDK.
|
|
17
16
|
*/
|
|
18
|
-
declare const COLLECTIONS: readonly ["tenants", "tenant-metadata", "tenant-logos", "products", "product-variants", "product-options", "product-option-values", "product-categories", "product-tags", "product-collections", "brands", "brand-logos", "orders", "order-items", "returns", "return-items", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-profiles", "customer-
|
|
17
|
+
declare const COLLECTIONS: readonly ["tenants", "tenant-metadata", "tenant-logos", "products", "product-variants", "product-options", "product-option-values", "product-categories", "product-tags", "product-collections", "brands", "brand-logos", "orders", "order-items", "returns", "return-items", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-profiles", "customer-addresses", "carts", "cart-items", "discounts", "shipping-policies", "shipping-zones", "documents", "document-categories", "document-types", "articles", "article-authors", "article-categories", "article-tags", "playlists", "playlist-categories", "playlist-tags", "tracks", "track-categories", "track-tags", "galleries", "gallery-categories", "gallery-tags", "gallery-items", "links", "link-categories", "link-tags", "canvases", "canvas-node-types", "canvas-edge-types", "canvas-categories", "canvas-tags", "canvas-nodes", "canvas-edges", "videos", "video-categories", "video-tags", "live-streams", "images", "forms", "form-submissions", "posts", "comments", "reactions", "reaction-types", "bookmarks", "post-categories", "customer-profile-lists", "event-calendars", "events", "event-categories", "event-occurrences", "event-tags"];
|
|
19
18
|
/**
|
|
20
19
|
* Server-auth collection names for runtime use. These collections are safe for
|
|
21
20
|
* secret-key/PAT SDK and MCP server tools, but must not appear in browser or
|
|
@@ -27,8 +26,7 @@ declare const SERVER_ONLY_COLLECTIONS: readonly ["customer-groups", "reports", "
|
|
|
27
26
|
* Derived from the COLLECTIONS array (single source of truth).
|
|
28
27
|
*/
|
|
29
28
|
type PublicCollection = (typeof COLLECTIONS)[number];
|
|
30
|
-
|
|
31
|
-
declare const SERVER_COLLECTIONS: readonly ["tenants", "tenant-metadata", "tenant-logos", "products", "product-variants", "product-options", "product-option-values", "product-categories", "product-tags", "product-collections", "brands", "brand-logos", "orders", "order-items", "returns", "return-items", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-profiles", "customer-profile-lists", "customer-addresses", "carts", "cart-items", "discounts", "shipping-policies", "shipping-zones", "documents", "document-categories", "document-types", "articles", "article-authors", "article-categories", "article-tags", "playlists", "playlist-categories", "playlist-tags", "tracks", "track-categories", "track-tags", "galleries", "gallery-categories", "gallery-tags", "gallery-items", "links", "link-categories", "link-tags", "canvases", "canvas-node-types", "canvas-edge-types", "canvas-categories", "canvas-tags", "canvas-nodes", "canvas-edges", "videos", "video-categories", "video-tags", "live-streams", "images", "forms", "form-submissions", "posts", "comments", "reactions", "reaction-types", "bookmarks", "post-categories", "event-calendars", "events", "event-categories", "event-occurrences", "event-tags", "customer-groups", "reports", "community-bans"];
|
|
29
|
+
declare const SERVER_COLLECTIONS: readonly ["tenants", "tenant-metadata", "tenant-logos", "products", "product-variants", "product-options", "product-option-values", "product-categories", "product-tags", "product-collections", "brands", "brand-logos", "orders", "order-items", "returns", "return-items", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-profiles", "customer-addresses", "carts", "cart-items", "discounts", "shipping-policies", "shipping-zones", "documents", "document-categories", "document-types", "articles", "article-authors", "article-categories", "article-tags", "playlists", "playlist-categories", "playlist-tags", "tracks", "track-categories", "track-tags", "galleries", "gallery-categories", "gallery-tags", "gallery-items", "links", "link-categories", "link-tags", "canvases", "canvas-node-types", "canvas-edge-types", "canvas-categories", "canvas-tags", "canvas-nodes", "canvas-edges", "videos", "video-categories", "video-tags", "live-streams", "images", "forms", "form-submissions", "posts", "comments", "reactions", "reaction-types", "bookmarks", "post-categories", "customer-profile-lists", "event-calendars", "events", "event-categories", "event-occurrences", "event-tags", "customer-groups", "reports", "community-bans"];
|
|
32
30
|
type ServerCollection = (typeof SERVER_COLLECTIONS)[number];
|
|
33
31
|
|
|
34
|
-
export {
|
|
32
|
+
export { type Collection as C, INTERNAL_COLLECTIONS as I, type PublicCollection as P, SERVER_COLLECTIONS as S, COLLECTIONS as a, SERVER_ONLY_COLLECTIONS as b, type ServerCollection as c };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
declare class SDKError extends Error {
|
|
2
|
+
readonly code: string;
|
|
3
|
+
readonly status?: number;
|
|
4
|
+
readonly details?: unknown;
|
|
5
|
+
readonly userMessage?: string;
|
|
6
|
+
readonly suggestion?: string;
|
|
7
|
+
readonly requestId?: string;
|
|
8
|
+
constructor(code: string, message: string, status?: number, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string);
|
|
9
|
+
getUserMessage(): string;
|
|
10
|
+
toJSON(): {
|
|
11
|
+
requestId?: string | undefined;
|
|
12
|
+
name: string;
|
|
13
|
+
code: string;
|
|
14
|
+
message: string;
|
|
15
|
+
status: number | undefined;
|
|
16
|
+
details: unknown;
|
|
17
|
+
userMessage: string | undefined;
|
|
18
|
+
suggestion: string | undefined;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
declare class NetworkError extends SDKError {
|
|
22
|
+
constructor(message: string, status?: number, details?: unknown, userMessage?: string, suggestion?: string);
|
|
23
|
+
}
|
|
24
|
+
declare class ValidationError extends SDKError {
|
|
25
|
+
constructor(message: string, details?: unknown, userMessage?: string, suggestion?: string, status?: number);
|
|
26
|
+
}
|
|
27
|
+
declare class ApiError extends SDKError {
|
|
28
|
+
constructor(message: string, status: number, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string);
|
|
29
|
+
}
|
|
30
|
+
declare class ConfigError extends SDKError {
|
|
31
|
+
constructor(message: string, details?: unknown, userMessage?: string, suggestion?: string);
|
|
32
|
+
}
|
|
33
|
+
declare class TimeoutError extends SDKError {
|
|
34
|
+
constructor(message?: string, details?: unknown, userMessage?: string, suggestion?: string);
|
|
35
|
+
}
|
|
36
|
+
declare class GoneError extends SDKError {
|
|
37
|
+
constructor(message?: string, details?: unknown, userMessage?: string, suggestion?: string);
|
|
38
|
+
}
|
|
39
|
+
declare class ServiceUnavailableError extends SDKError {
|
|
40
|
+
readonly retryAfter?: number;
|
|
41
|
+
constructor(message?: string, retryAfter?: number, details?: unknown, userMessage?: string, suggestion?: string);
|
|
42
|
+
}
|
|
43
|
+
declare class UsageLimitError extends SDKError {
|
|
44
|
+
readonly usage: {
|
|
45
|
+
limit: number;
|
|
46
|
+
current: number;
|
|
47
|
+
remaining: number;
|
|
48
|
+
};
|
|
49
|
+
constructor(message: string, usage: {
|
|
50
|
+
limit: number;
|
|
51
|
+
current: number;
|
|
52
|
+
remaining: number;
|
|
53
|
+
}, details?: unknown, userMessage?: string, suggestion?: string);
|
|
54
|
+
toJSON(): {
|
|
55
|
+
usage: {
|
|
56
|
+
limit: number;
|
|
57
|
+
current: number;
|
|
58
|
+
remaining: number;
|
|
59
|
+
};
|
|
60
|
+
requestId?: string | undefined;
|
|
61
|
+
name: string;
|
|
62
|
+
code: string;
|
|
63
|
+
message: string;
|
|
64
|
+
status: number | undefined;
|
|
65
|
+
details: unknown;
|
|
66
|
+
userMessage: string | undefined;
|
|
67
|
+
suggestion: string | undefined;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
declare class AuthError extends SDKError {
|
|
71
|
+
constructor(message: string, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string);
|
|
72
|
+
}
|
|
73
|
+
declare class PermissionError extends SDKError {
|
|
74
|
+
constructor(message: string, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string);
|
|
75
|
+
}
|
|
76
|
+
declare class NotFoundError extends SDKError {
|
|
77
|
+
constructor(message: string, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string);
|
|
78
|
+
}
|
|
79
|
+
declare class ConflictError extends SDKError {
|
|
80
|
+
constructor(message: string, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string);
|
|
81
|
+
}
|
|
82
|
+
declare class RateLimitError extends SDKError {
|
|
83
|
+
readonly retryAfter?: number;
|
|
84
|
+
constructor(message: string, retryAfter?: number, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string);
|
|
85
|
+
}
|
|
86
|
+
declare function isSDKError(error: unknown): error is SDKError;
|
|
87
|
+
declare function isNetworkError(error: unknown): error is NetworkError;
|
|
88
|
+
declare function isValidationError(error: unknown): error is ValidationError;
|
|
89
|
+
declare function isApiError(error: unknown): error is ApiError;
|
|
90
|
+
declare function isConfigError(error: unknown): error is ConfigError;
|
|
91
|
+
declare function isTimeoutError(error: unknown): error is TimeoutError;
|
|
92
|
+
declare function isGoneError(error: unknown): error is GoneError;
|
|
93
|
+
declare function isServiceUnavailableError(error: unknown): error is ServiceUnavailableError;
|
|
94
|
+
declare function isUsageLimitError(error: unknown): error is UsageLimitError;
|
|
95
|
+
declare function isAuthError(error: unknown): error is AuthError;
|
|
96
|
+
declare function isPermissionError(error: unknown): error is PermissionError;
|
|
97
|
+
declare function isNotFoundError(error: unknown): error is NotFoundError;
|
|
98
|
+
declare function isConflictError(error: unknown): error is ConflictError;
|
|
99
|
+
declare function isRateLimitError(error: unknown): error is RateLimitError;
|
|
100
|
+
declare const createAuthError: (message: string, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string) => AuthError;
|
|
101
|
+
declare const createPermissionError: (message: string, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string) => PermissionError;
|
|
102
|
+
declare const createNotFoundError: (message: string, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string) => NotFoundError;
|
|
103
|
+
declare const createConflictError: (message: string, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string) => ConflictError;
|
|
104
|
+
declare const createRateLimitError: (message: string, retryAfter?: number, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string) => RateLimitError;
|
|
105
|
+
|
|
106
|
+
export { ApiError as A, ConfigError as C, GoneError as G, NetworkError as N, PermissionError as P, RateLimitError as R, SDKError as S, TimeoutError as T, UsageLimitError as U, ValidationError as V, AuthError as a, ConflictError as b, NotFoundError as c, ServiceUnavailableError as d, createAuthError as e, createConflictError as f, createNotFoundError as g, createPermissionError as h, createRateLimitError as i, isApiError as j, isAuthError as k, isConfigError as l, isConflictError as m, isGoneError as n, isNetworkError as o, isNotFoundError as p, isPermissionError as q, isRateLimitError as r, isSDKError as s, isServiceUnavailableError as t, isTimeoutError as u, isUsageLimitError as v, isValidationError as w };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
declare class SDKError extends Error {
|
|
2
|
+
readonly code: string;
|
|
3
|
+
readonly status?: number;
|
|
4
|
+
readonly details?: unknown;
|
|
5
|
+
readonly userMessage?: string;
|
|
6
|
+
readonly suggestion?: string;
|
|
7
|
+
readonly requestId?: string;
|
|
8
|
+
constructor(code: string, message: string, status?: number, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string);
|
|
9
|
+
getUserMessage(): string;
|
|
10
|
+
toJSON(): {
|
|
11
|
+
requestId?: string | undefined;
|
|
12
|
+
name: string;
|
|
13
|
+
code: string;
|
|
14
|
+
message: string;
|
|
15
|
+
status: number | undefined;
|
|
16
|
+
details: unknown;
|
|
17
|
+
userMessage: string | undefined;
|
|
18
|
+
suggestion: string | undefined;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
declare class NetworkError extends SDKError {
|
|
22
|
+
constructor(message: string, status?: number, details?: unknown, userMessage?: string, suggestion?: string);
|
|
23
|
+
}
|
|
24
|
+
declare class ValidationError extends SDKError {
|
|
25
|
+
constructor(message: string, details?: unknown, userMessage?: string, suggestion?: string, status?: number);
|
|
26
|
+
}
|
|
27
|
+
declare class ApiError extends SDKError {
|
|
28
|
+
constructor(message: string, status: number, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string);
|
|
29
|
+
}
|
|
30
|
+
declare class ConfigError extends SDKError {
|
|
31
|
+
constructor(message: string, details?: unknown, userMessage?: string, suggestion?: string);
|
|
32
|
+
}
|
|
33
|
+
declare class TimeoutError extends SDKError {
|
|
34
|
+
constructor(message?: string, details?: unknown, userMessage?: string, suggestion?: string);
|
|
35
|
+
}
|
|
36
|
+
declare class GoneError extends SDKError {
|
|
37
|
+
constructor(message?: string, details?: unknown, userMessage?: string, suggestion?: string);
|
|
38
|
+
}
|
|
39
|
+
declare class ServiceUnavailableError extends SDKError {
|
|
40
|
+
readonly retryAfter?: number;
|
|
41
|
+
constructor(message?: string, retryAfter?: number, details?: unknown, userMessage?: string, suggestion?: string);
|
|
42
|
+
}
|
|
43
|
+
declare class UsageLimitError extends SDKError {
|
|
44
|
+
readonly usage: {
|
|
45
|
+
limit: number;
|
|
46
|
+
current: number;
|
|
47
|
+
remaining: number;
|
|
48
|
+
};
|
|
49
|
+
constructor(message: string, usage: {
|
|
50
|
+
limit: number;
|
|
51
|
+
current: number;
|
|
52
|
+
remaining: number;
|
|
53
|
+
}, details?: unknown, userMessage?: string, suggestion?: string);
|
|
54
|
+
toJSON(): {
|
|
55
|
+
usage: {
|
|
56
|
+
limit: number;
|
|
57
|
+
current: number;
|
|
58
|
+
remaining: number;
|
|
59
|
+
};
|
|
60
|
+
requestId?: string | undefined;
|
|
61
|
+
name: string;
|
|
62
|
+
code: string;
|
|
63
|
+
message: string;
|
|
64
|
+
status: number | undefined;
|
|
65
|
+
details: unknown;
|
|
66
|
+
userMessage: string | undefined;
|
|
67
|
+
suggestion: string | undefined;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
declare class AuthError extends SDKError {
|
|
71
|
+
constructor(message: string, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string);
|
|
72
|
+
}
|
|
73
|
+
declare class PermissionError extends SDKError {
|
|
74
|
+
constructor(message: string, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string);
|
|
75
|
+
}
|
|
76
|
+
declare class NotFoundError extends SDKError {
|
|
77
|
+
constructor(message: string, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string);
|
|
78
|
+
}
|
|
79
|
+
declare class ConflictError extends SDKError {
|
|
80
|
+
constructor(message: string, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string);
|
|
81
|
+
}
|
|
82
|
+
declare class RateLimitError extends SDKError {
|
|
83
|
+
readonly retryAfter?: number;
|
|
84
|
+
constructor(message: string, retryAfter?: number, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string);
|
|
85
|
+
}
|
|
86
|
+
declare function isSDKError(error: unknown): error is SDKError;
|
|
87
|
+
declare function isNetworkError(error: unknown): error is NetworkError;
|
|
88
|
+
declare function isValidationError(error: unknown): error is ValidationError;
|
|
89
|
+
declare function isApiError(error: unknown): error is ApiError;
|
|
90
|
+
declare function isConfigError(error: unknown): error is ConfigError;
|
|
91
|
+
declare function isTimeoutError(error: unknown): error is TimeoutError;
|
|
92
|
+
declare function isGoneError(error: unknown): error is GoneError;
|
|
93
|
+
declare function isServiceUnavailableError(error: unknown): error is ServiceUnavailableError;
|
|
94
|
+
declare function isUsageLimitError(error: unknown): error is UsageLimitError;
|
|
95
|
+
declare function isAuthError(error: unknown): error is AuthError;
|
|
96
|
+
declare function isPermissionError(error: unknown): error is PermissionError;
|
|
97
|
+
declare function isNotFoundError(error: unknown): error is NotFoundError;
|
|
98
|
+
declare function isConflictError(error: unknown): error is ConflictError;
|
|
99
|
+
declare function isRateLimitError(error: unknown): error is RateLimitError;
|
|
100
|
+
declare const createAuthError: (message: string, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string) => AuthError;
|
|
101
|
+
declare const createPermissionError: (message: string, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string) => PermissionError;
|
|
102
|
+
declare const createNotFoundError: (message: string, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string) => NotFoundError;
|
|
103
|
+
declare const createConflictError: (message: string, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string) => ConflictError;
|
|
104
|
+
declare const createRateLimitError: (message: string, retryAfter?: number, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string) => RateLimitError;
|
|
105
|
+
|
|
106
|
+
export { ApiError as A, ConfigError as C, GoneError as G, NetworkError as N, PermissionError as P, RateLimitError as R, SDKError as S, TimeoutError as T, UsageLimitError as U, ValidationError as V, AuthError as a, ConflictError as b, NotFoundError as c, ServiceUnavailableError as d, createAuthError as e, createConflictError as f, createNotFoundError as g, createPermissionError as h, createRateLimitError as i, isApiError as j, isAuthError as k, isConfigError as l, isConflictError as m, isGoneError as n, isNetworkError as o, isNotFoundError as p, isPermissionError as q, isRateLimitError as r, isSDKError as s, isServiceUnavailableError as t, isTimeoutError as u, isUsageLimitError as v, isValidationError as w };
|