@01.software/sdk 0.37.0 → 0.38.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 +75 -53
- package/dist/client.cjs +67 -104
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +6 -6
- package/dist/client.d.ts +6 -6
- package/dist/client.js +67 -104
- package/dist/client.js.map +1 -1
- package/dist/{collection-client-zOmnxwdA.d.cts → collection-client-B0J9wMNE.d.cts} +5 -5
- package/dist/{collection-client-DyELGUcL.d.ts → collection-client-BroIWHY1.d.ts} +5 -5
- package/dist/const-6XHz_jej.d.ts +32 -0
- package/dist/const-B5KT72c7.d.cts +32 -0
- package/dist/{index-DRJs7QIh.d.cts → index-BOLQxveo.d.cts} +3 -3
- package/dist/{index-DTqoUZk_.d.ts → index-CSwR2HSg.d.ts} +3 -3
- package/dist/index.cjs +95 -123
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +95 -123
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-CREOjFNT.d.cts → payload-types-m3jjhxk9.d.cts} +418 -106
- package/dist/{payload-types-CREOjFNT.d.ts → payload-types-m3jjhxk9.d.ts} +418 -106
- package/dist/query.cjs +3 -1035
- package/dist/query.cjs.map +1 -1
- package/dist/query.d.cts +13 -13
- package/dist/query.d.ts +13 -13
- package/dist/query.js +3 -1035
- package/dist/query.js.map +1 -1
- package/dist/realtime.d.cts +2 -2
- package/dist/realtime.d.ts +2 -2
- package/dist/server.cjs +42 -21
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +7 -7
- package/dist/server.d.ts +7 -7
- package/dist/server.js +42 -21
- package/dist/server.js.map +1 -1
- package/dist/{types-DMvVHdb1.d.ts → types-CIGscmus.d.cts} +1455 -1208
- package/dist/{types-CxzWHspI.d.ts → types-Cmrd1ezc.d.ts} +1 -15
- package/dist/{types-BkZNhuBh.d.cts → types-D0ubzQw0.d.cts} +1 -15
- package/dist/{types-BWMUr3Zw.d.cts → types-D2xYdz4P.d.ts} +1455 -1208
- 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 +4 -4
- package/dist/webhook.d.ts +4 -4
- package/package.json +3 -3
- package/dist/const-CK_FPaIn.d.cts +0 -32
- package/dist/const-Dqz05oaG.d.ts +0 -32
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { D as DebugConfig,
|
|
1
|
+
import { D as DebugConfig, v as RetryConfig, e as ApiQueryOptions, P as PayloadFindResponse, l as PayloadMutationResponse } from './types-CIGscmus.cjs';
|
|
2
2
|
import { GenerateMetadataOptions, Metadata } from './metadata.cjs';
|
|
3
|
-
import { S as ServerCollection, P as PublicCollection } from './const-
|
|
4
|
-
import { C as CollectionType } from './types-
|
|
3
|
+
import { S as ServerCollection, P as PublicCollection } from './const-B5KT72c7.cjs';
|
|
4
|
+
import { C as CollectionType } from './types-D0ubzQw0.cjs';
|
|
5
5
|
|
|
6
6
|
interface FetchOptions extends RequestInit {
|
|
7
7
|
apiUrl?: string;
|
|
@@ -59,8 +59,6 @@ declare class ReadOnlyCollectionQueryBuilder<T extends PublicCollection> {
|
|
|
59
59
|
count(options?: ApiQueryOptions): Promise<{
|
|
60
60
|
totalDocs: number;
|
|
61
61
|
}>;
|
|
62
|
-
findMetadata(options?: ApiQueryOptions, metadataOptions?: GenerateMetadataOptions): Promise<Metadata | null>;
|
|
63
|
-
findMetadataById(id: string, metadataOptions?: GenerateMetadataOptions): Promise<Metadata>;
|
|
64
62
|
}
|
|
65
63
|
declare class CollectionQueryBuilder<T extends string> {
|
|
66
64
|
private api;
|
|
@@ -213,6 +211,8 @@ declare class ServerCollectionClient extends CollectionClient<ServerCollection>
|
|
|
213
211
|
declare class ReadOnlyCollectionClient extends HttpClient {
|
|
214
212
|
from<T extends PublicCollection>(collection: T): ReadOnlyQueryBuilder<T>;
|
|
215
213
|
requestFind<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<PayloadFindResponse<T>>;
|
|
214
|
+
requestFindEndpoint<T = unknown>(endpoint: string, data?: unknown): Promise<PayloadFindResponse<T>>;
|
|
215
|
+
requestFindEndpointGet<T = unknown>(endpoint: string): Promise<PayloadFindResponse<T>>;
|
|
216
216
|
requestFindById<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<T>;
|
|
217
217
|
requestCount(endpoint: string, options?: ApiQueryOptions): Promise<{
|
|
218
218
|
totalDocs: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { D as DebugConfig,
|
|
1
|
+
import { D as DebugConfig, v as RetryConfig, e as ApiQueryOptions, P as PayloadFindResponse, l as PayloadMutationResponse } from './types-D2xYdz4P.js';
|
|
2
2
|
import { GenerateMetadataOptions, Metadata } from './metadata.js';
|
|
3
|
-
import { S as ServerCollection, P as PublicCollection } from './const-
|
|
4
|
-
import { C as CollectionType } from './types-
|
|
3
|
+
import { S as ServerCollection, P as PublicCollection } from './const-6XHz_jej.js';
|
|
4
|
+
import { C as CollectionType } from './types-Cmrd1ezc.js';
|
|
5
5
|
|
|
6
6
|
interface FetchOptions extends RequestInit {
|
|
7
7
|
apiUrl?: string;
|
|
@@ -59,8 +59,6 @@ declare class ReadOnlyCollectionQueryBuilder<T extends PublicCollection> {
|
|
|
59
59
|
count(options?: ApiQueryOptions): Promise<{
|
|
60
60
|
totalDocs: number;
|
|
61
61
|
}>;
|
|
62
|
-
findMetadata(options?: ApiQueryOptions, metadataOptions?: GenerateMetadataOptions): Promise<Metadata | null>;
|
|
63
|
-
findMetadataById(id: string, metadataOptions?: GenerateMetadataOptions): Promise<Metadata>;
|
|
64
62
|
}
|
|
65
63
|
declare class CollectionQueryBuilder<T extends string> {
|
|
66
64
|
private api;
|
|
@@ -213,6 +211,8 @@ declare class ServerCollectionClient extends CollectionClient<ServerCollection>
|
|
|
213
211
|
declare class ReadOnlyCollectionClient extends HttpClient {
|
|
214
212
|
from<T extends PublicCollection>(collection: T): ReadOnlyQueryBuilder<T>;
|
|
215
213
|
requestFind<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<PayloadFindResponse<T>>;
|
|
214
|
+
requestFindEndpoint<T = unknown>(endpoint: string, data?: unknown): Promise<PayloadFindResponse<T>>;
|
|
215
|
+
requestFindEndpointGet<T = unknown>(endpoint: string): Promise<PayloadFindResponse<T>>;
|
|
216
216
|
requestFindById<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<T>;
|
|
217
217
|
requestCount(endpoint: string, options?: ApiQueryOptions): Promise<{
|
|
218
218
|
totalDocs: number;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { c as Config } from './payload-types-m3jjhxk9.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Collection type derived from Payload Config.
|
|
5
|
+
* This ensures type safety and automatic synchronization with payload-types.ts
|
|
6
|
+
*/
|
|
7
|
+
type Collection = keyof Config['collections'];
|
|
8
|
+
/**
|
|
9
|
+
* Internal collections that should not be exposed via SDK.
|
|
10
|
+
* Includes Payload system collections and admin-only collections.
|
|
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", "inventory-adjustments", "commerce-notification-intents", "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"];
|
|
13
|
+
/**
|
|
14
|
+
* Array of browser-public collection names for runtime use (e.g., Zod enum validation).
|
|
15
|
+
* This is the single source of truth for publishable-key collection discovery.
|
|
16
|
+
*/
|
|
17
|
+
declare const COLLECTIONS: readonly ["tenants", "tenant-metadata", "products", "product-variants", "product-options", "product-option-values", "product-categories", "product-tags", "product-collections", "brands", "customer-profiles", "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", "video-categories", "video-tags", "forms", "reaction-types", "post-categories", "post-tags", "customer-profile-lists", "event-calendars", "events", "event-categories", "event-occurrences", "event-tags"];
|
|
18
|
+
/**
|
|
19
|
+
* Server-auth collection names for runtime use. These collections are safe for
|
|
20
|
+
* secret-key/PAT SDK and MCP server tools, but must not appear in browser or
|
|
21
|
+
* publishable-key collection discovery.
|
|
22
|
+
*/
|
|
23
|
+
declare const SERVER_ONLY_COLLECTIONS: readonly ["tenant-logos", "brand-logos", "images", "videos", "orders", "order-items", "returns", "return-items", "fulfillment-orders", "fulfillment-order-items", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-addresses", "form-submissions", "carts", "cart-items", "posts", "comments", "reactions", "bookmarks", "live-streams", "customer-groups", "reports", "community-bans", "order-export-profiles"];
|
|
24
|
+
/**
|
|
25
|
+
* Browser-public collections available for publishable-key SDK access.
|
|
26
|
+
* Derived from the COLLECTIONS array (single source of truth).
|
|
27
|
+
*/
|
|
28
|
+
type PublicCollection = (typeof COLLECTIONS)[number];
|
|
29
|
+
declare const SERVER_COLLECTIONS: readonly ["tenants", "tenant-metadata", "products", "product-variants", "product-options", "product-option-values", "product-categories", "product-tags", "product-collections", "brands", "customer-profiles", "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", "video-categories", "video-tags", "forms", "reaction-types", "post-categories", "post-tags", "customer-profile-lists", "event-calendars", "events", "event-categories", "event-occurrences", "event-tags", "tenant-logos", "brand-logos", "images", "videos", "orders", "order-items", "returns", "return-items", "fulfillment-orders", "fulfillment-order-items", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-addresses", "form-submissions", "carts", "cart-items", "posts", "comments", "reactions", "bookmarks", "live-streams", "customer-groups", "reports", "community-bans", "order-export-profiles"];
|
|
30
|
+
type ServerCollection = (typeof SERVER_COLLECTIONS)[number];
|
|
31
|
+
|
|
32
|
+
export { type Collection as C, INTERNAL_COLLECTIONS as I, type PublicCollection as P, type ServerCollection as S, COLLECTIONS as a, SERVER_COLLECTIONS as b, SERVER_ONLY_COLLECTIONS as c };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { c as Config } from './payload-types-m3jjhxk9.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Collection type derived from Payload Config.
|
|
5
|
+
* This ensures type safety and automatic synchronization with payload-types.ts
|
|
6
|
+
*/
|
|
7
|
+
type Collection = keyof Config['collections'];
|
|
8
|
+
/**
|
|
9
|
+
* Internal collections that should not be exposed via SDK.
|
|
10
|
+
* Includes Payload system collections and admin-only collections.
|
|
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", "inventory-adjustments", "commerce-notification-intents", "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"];
|
|
13
|
+
/**
|
|
14
|
+
* Array of browser-public collection names for runtime use (e.g., Zod enum validation).
|
|
15
|
+
* This is the single source of truth for publishable-key collection discovery.
|
|
16
|
+
*/
|
|
17
|
+
declare const COLLECTIONS: readonly ["tenants", "tenant-metadata", "products", "product-variants", "product-options", "product-option-values", "product-categories", "product-tags", "product-collections", "brands", "customer-profiles", "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", "video-categories", "video-tags", "forms", "reaction-types", "post-categories", "post-tags", "customer-profile-lists", "event-calendars", "events", "event-categories", "event-occurrences", "event-tags"];
|
|
18
|
+
/**
|
|
19
|
+
* Server-auth collection names for runtime use. These collections are safe for
|
|
20
|
+
* secret-key/PAT SDK and MCP server tools, but must not appear in browser or
|
|
21
|
+
* publishable-key collection discovery.
|
|
22
|
+
*/
|
|
23
|
+
declare const SERVER_ONLY_COLLECTIONS: readonly ["tenant-logos", "brand-logos", "images", "videos", "orders", "order-items", "returns", "return-items", "fulfillment-orders", "fulfillment-order-items", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-addresses", "form-submissions", "carts", "cart-items", "posts", "comments", "reactions", "bookmarks", "live-streams", "customer-groups", "reports", "community-bans", "order-export-profiles"];
|
|
24
|
+
/**
|
|
25
|
+
* Browser-public collections available for publishable-key SDK access.
|
|
26
|
+
* Derived from the COLLECTIONS array (single source of truth).
|
|
27
|
+
*/
|
|
28
|
+
type PublicCollection = (typeof COLLECTIONS)[number];
|
|
29
|
+
declare const SERVER_COLLECTIONS: readonly ["tenants", "tenant-metadata", "products", "product-variants", "product-options", "product-option-values", "product-categories", "product-tags", "product-collections", "brands", "customer-profiles", "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", "video-categories", "video-tags", "forms", "reaction-types", "post-categories", "post-tags", "customer-profile-lists", "event-calendars", "events", "event-categories", "event-occurrences", "event-tags", "tenant-logos", "brand-logos", "images", "videos", "orders", "order-items", "returns", "return-items", "fulfillment-orders", "fulfillment-order-items", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-addresses", "form-submissions", "carts", "cart-items", "posts", "comments", "reactions", "bookmarks", "live-streams", "customer-groups", "reports", "community-bans", "order-export-profiles"];
|
|
30
|
+
type ServerCollection = (typeof SERVER_COLLECTIONS)[number];
|
|
31
|
+
|
|
32
|
+
export { type Collection as C, INTERNAL_COLLECTIONS as I, type PublicCollection as P, type ServerCollection as S, COLLECTIONS as a, SERVER_COLLECTIONS as b, SERVER_ONLY_COLLECTIONS as c };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as Collection } from './const-
|
|
2
|
-
import { C as CollectionType } from './types-
|
|
3
|
-
import './payload-types-
|
|
1
|
+
import { C as Collection } from './const-B5KT72c7.cjs';
|
|
2
|
+
import { C as CollectionType } from './types-D0ubzQw0.cjs';
|
|
3
|
+
import './payload-types-m3jjhxk9.cjs';
|
|
4
4
|
|
|
5
5
|
type WebhookOperation = string;
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as Collection } from './const-
|
|
2
|
-
import { C as CollectionType } from './types-
|
|
3
|
-
import './payload-types-
|
|
1
|
+
import { C as Collection } from './const-6XHz_jej.js';
|
|
2
|
+
import { C as CollectionType } from './types-Cmrd1ezc.js';
|
|
3
|
+
import './payload-types-m3jjhxk9.js';
|
|
4
4
|
|
|
5
5
|
type WebhookOperation = string;
|
|
6
6
|
/**
|
package/dist/index.cjs
CHANGED
|
@@ -953,66 +953,14 @@ function resolveRelation(ref) {
|
|
|
953
953
|
return ref;
|
|
954
954
|
}
|
|
955
955
|
|
|
956
|
-
// src/core/
|
|
957
|
-
|
|
958
|
-
var LEGACY_OPEN_GRAPH_IMAGE_SIZE = "1536";
|
|
959
|
-
function extractSeo(doc) {
|
|
960
|
-
const seo = doc.seo ?? {};
|
|
961
|
-
const og = seo.openGraph ?? {};
|
|
962
|
-
return {
|
|
963
|
-
title: seo.title ?? doc.title ?? null,
|
|
964
|
-
description: seo.description ?? null,
|
|
965
|
-
noIndex: seo.noIndex ?? null,
|
|
966
|
-
canonical: seo.canonical ?? null,
|
|
967
|
-
openGraph: {
|
|
968
|
-
title: og.title ?? null,
|
|
969
|
-
description: og.description ?? null,
|
|
970
|
-
image: og.image ?? null
|
|
971
|
-
}
|
|
972
|
-
};
|
|
973
|
-
}
|
|
974
|
-
function generateMetadata(input, options) {
|
|
975
|
-
const title = input.title ?? void 0;
|
|
976
|
-
const description = input.description ?? void 0;
|
|
977
|
-
const ogTitle = input.openGraph?.title ?? title;
|
|
978
|
-
const ogDescription = input.openGraph?.description ?? description;
|
|
979
|
-
const image = resolveMetaImage(input.openGraph?.image);
|
|
980
|
-
return {
|
|
981
|
-
title,
|
|
982
|
-
description,
|
|
983
|
-
...input.noIndex && { robots: { index: false, follow: false } },
|
|
984
|
-
...input.canonical && { alternates: { canonical: input.canonical } },
|
|
985
|
-
openGraph: {
|
|
986
|
-
...ogTitle && { title: ogTitle },
|
|
987
|
-
...ogDescription && { description: ogDescription },
|
|
988
|
-
...options?.siteName && { siteName: options.siteName },
|
|
989
|
-
...image && { images: [image] }
|
|
990
|
-
},
|
|
991
|
-
twitter: {
|
|
992
|
-
card: image ? "summary_large_image" : "summary",
|
|
993
|
-
...ogTitle && { title: ogTitle },
|
|
994
|
-
...ogDescription && { description: ogDescription },
|
|
995
|
-
...image && { images: [image.url] }
|
|
996
|
-
}
|
|
997
|
-
};
|
|
998
|
-
}
|
|
999
|
-
function resolveMetaImage(ref) {
|
|
1000
|
-
const image = resolveRelation(ref);
|
|
1001
|
-
if (!image) return null;
|
|
1002
|
-
const sized = image.sizes?.[OPEN_GRAPH_IMAGE_SIZE] ?? image.sizes?.[LEGACY_OPEN_GRAPH_IMAGE_SIZE];
|
|
1003
|
-
const url = sized?.url || image.url;
|
|
1004
|
-
if (!url) return null;
|
|
1005
|
-
const width = sized?.url ? sized.width : image.width;
|
|
1006
|
-
const height = sized?.url ? sized.height : image.height;
|
|
956
|
+
// src/core/collection/query-builder.ts
|
|
957
|
+
function withDefaultPublicReadOptions(options) {
|
|
1007
958
|
return {
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
...image.alt && { alt: image.alt }
|
|
959
|
+
...options,
|
|
960
|
+
depth: options?.depth ?? 0,
|
|
961
|
+
joins: options?.joins ?? false
|
|
1012
962
|
};
|
|
1013
963
|
}
|
|
1014
|
-
|
|
1015
|
-
// src/core/collection/query-builder.ts
|
|
1016
964
|
var ReadOnlyCollectionQueryBuilder = class {
|
|
1017
965
|
constructor(api, collection) {
|
|
1018
966
|
this.api = api;
|
|
@@ -1021,13 +969,13 @@ var ReadOnlyCollectionQueryBuilder = class {
|
|
|
1021
969
|
async find(options) {
|
|
1022
970
|
return this.api.requestFind(
|
|
1023
971
|
`/api/${String(this.collection)}`,
|
|
1024
|
-
options
|
|
972
|
+
withDefaultPublicReadOptions(options)
|
|
1025
973
|
);
|
|
1026
974
|
}
|
|
1027
975
|
async findById(id, options) {
|
|
1028
976
|
return this.api.requestFindById(
|
|
1029
977
|
`/api/${String(this.collection)}/${String(id)}`,
|
|
1030
|
-
options
|
|
978
|
+
withDefaultPublicReadOptions(options)
|
|
1031
979
|
);
|
|
1032
980
|
}
|
|
1033
981
|
async count(options) {
|
|
@@ -1036,22 +984,6 @@ var ReadOnlyCollectionQueryBuilder = class {
|
|
|
1036
984
|
options
|
|
1037
985
|
);
|
|
1038
986
|
}
|
|
1039
|
-
async findMetadata(options, metadataOptions) {
|
|
1040
|
-
const { docs } = await this.find({ ...options, limit: 1, depth: 1 });
|
|
1041
|
-
const doc = docs[0];
|
|
1042
|
-
if (!doc) return null;
|
|
1043
|
-
return generateMetadata(
|
|
1044
|
-
extractSeo(doc),
|
|
1045
|
-
metadataOptions
|
|
1046
|
-
);
|
|
1047
|
-
}
|
|
1048
|
-
async findMetadataById(id, metadataOptions) {
|
|
1049
|
-
const doc = await this.findById(id, { depth: 1 });
|
|
1050
|
-
return generateMetadata(
|
|
1051
|
-
extractSeo(doc),
|
|
1052
|
-
metadataOptions
|
|
1053
|
-
);
|
|
1054
|
-
}
|
|
1055
987
|
};
|
|
1056
988
|
|
|
1057
989
|
// src/core/collection/collection-client.ts
|
|
@@ -1067,6 +999,21 @@ var ReadOnlyCollectionClient = class extends HttpClient {
|
|
|
1067
999
|
});
|
|
1068
1000
|
return this.parseFindResponse(response);
|
|
1069
1001
|
}
|
|
1002
|
+
async requestFindEndpoint(endpoint, data) {
|
|
1003
|
+
const response = await this.fetchWithTracking(endpoint, {
|
|
1004
|
+
...this.defaultOptions,
|
|
1005
|
+
method: "POST",
|
|
1006
|
+
body: data ? JSON.stringify(data) : void 0
|
|
1007
|
+
});
|
|
1008
|
+
return this.parseFindResponse(response);
|
|
1009
|
+
}
|
|
1010
|
+
async requestFindEndpointGet(endpoint) {
|
|
1011
|
+
const response = await this.fetchWithTracking(endpoint, {
|
|
1012
|
+
...this.defaultOptions,
|
|
1013
|
+
method: "GET"
|
|
1014
|
+
});
|
|
1015
|
+
return this.parseFindResponse(response);
|
|
1016
|
+
}
|
|
1070
1017
|
async requestFindById(endpoint, options) {
|
|
1071
1018
|
const url = this.buildUrl(endpoint, options);
|
|
1072
1019
|
const response = await this.fetchWithTracking(url, {
|
|
@@ -1197,7 +1144,8 @@ var CommunityClient = class extends CustomerScopedApi {
|
|
|
1197
1144
|
const urlParams = new URLSearchParams();
|
|
1198
1145
|
const sort = params?.sort ?? DEFAULT_POST_LIST_SORT;
|
|
1199
1146
|
urlParams.set("sort", sort);
|
|
1200
|
-
if (params?.limit !== void 0)
|
|
1147
|
+
if (params?.limit !== void 0)
|
|
1148
|
+
urlParams.set("limit", String(params.limit));
|
|
1201
1149
|
if (params?.page !== void 0) urlParams.set("page", String(params.page));
|
|
1202
1150
|
if (params?.categoryId !== void 0) {
|
|
1203
1151
|
urlParams.set("where[categories][in]", params.categoryId);
|
|
@@ -1205,7 +1153,7 @@ var CommunityClient = class extends CustomerScopedApi {
|
|
|
1205
1153
|
if (params?.tagId !== void 0) {
|
|
1206
1154
|
urlParams.set("where[tags][in]", params.tagId);
|
|
1207
1155
|
}
|
|
1208
|
-
return `/api/posts?${urlParams.toString()}`;
|
|
1156
|
+
return `/api/posts/public?${urlParams.toString()}`;
|
|
1209
1157
|
}
|
|
1210
1158
|
buildCommentsListQuery(params) {
|
|
1211
1159
|
const urlParams = new URLSearchParams();
|
|
@@ -1225,7 +1173,7 @@ var CommunityClient = class extends CustomerScopedApi {
|
|
|
1225
1173
|
}
|
|
1226
1174
|
if (params.limit !== void 0) urlParams.set("limit", String(params.limit));
|
|
1227
1175
|
if (params.page !== void 0) urlParams.set("page", String(params.page));
|
|
1228
|
-
return `/api/comments?${urlParams.toString()}`;
|
|
1176
|
+
return `/api/comments/public?${urlParams.toString()}`;
|
|
1229
1177
|
}
|
|
1230
1178
|
async execute(endpoint, method, body) {
|
|
1231
1179
|
return this.request(endpoint, { method, body });
|
|
@@ -1235,7 +1183,11 @@ var CommunityClient = class extends CustomerScopedApi {
|
|
|
1235
1183
|
return unwrapPayloadDoc(response);
|
|
1236
1184
|
}
|
|
1237
1185
|
createPost(params) {
|
|
1238
|
-
return this.executeDoc(
|
|
1186
|
+
return this.executeDoc(
|
|
1187
|
+
"/api/posts",
|
|
1188
|
+
"POST",
|
|
1189
|
+
params
|
|
1190
|
+
);
|
|
1239
1191
|
}
|
|
1240
1192
|
/**
|
|
1241
1193
|
* Public post feed. Server applies the same visibility contract as
|
|
@@ -1292,7 +1244,11 @@ var CommunityClient = class extends CustomerScopedApi {
|
|
|
1292
1244
|
if (parentId !== void 0) {
|
|
1293
1245
|
body.parent = parentId;
|
|
1294
1246
|
}
|
|
1295
|
-
return this.executeDoc(
|
|
1247
|
+
return this.executeDoc(
|
|
1248
|
+
"/api/comments",
|
|
1249
|
+
"POST",
|
|
1250
|
+
body
|
|
1251
|
+
);
|
|
1296
1252
|
}
|
|
1297
1253
|
/**
|
|
1298
1254
|
* List comments for a post.
|
|
@@ -1361,10 +1317,14 @@ var CommunityClient = class extends CustomerScopedApi {
|
|
|
1361
1317
|
400
|
|
1362
1318
|
);
|
|
1363
1319
|
}
|
|
1364
|
-
return this.executeDoc(
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1320
|
+
return this.executeDoc(
|
|
1321
|
+
"/api/reactions",
|
|
1322
|
+
"POST",
|
|
1323
|
+
{
|
|
1324
|
+
post: postId,
|
|
1325
|
+
type: reactionType
|
|
1326
|
+
}
|
|
1327
|
+
);
|
|
1368
1328
|
}
|
|
1369
1329
|
removeReaction(params) {
|
|
1370
1330
|
const { postId, type } = params;
|
|
@@ -1383,10 +1343,14 @@ var CommunityClient = class extends CustomerScopedApi {
|
|
|
1383
1343
|
400
|
|
1384
1344
|
);
|
|
1385
1345
|
}
|
|
1386
|
-
return this.executeDoc(
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1346
|
+
return this.executeDoc(
|
|
1347
|
+
"/api/reactions",
|
|
1348
|
+
"POST",
|
|
1349
|
+
{
|
|
1350
|
+
comment: commentId,
|
|
1351
|
+
type: reactionType
|
|
1352
|
+
}
|
|
1353
|
+
);
|
|
1390
1354
|
}
|
|
1391
1355
|
removeCommentReaction(params) {
|
|
1392
1356
|
const { commentId, type } = params;
|
|
@@ -1415,9 +1379,13 @@ var CommunityClient = class extends CustomerScopedApi {
|
|
|
1415
1379
|
}
|
|
1416
1380
|
// Bookmarks
|
|
1417
1381
|
addBookmark(params) {
|
|
1418
|
-
return this.executeDoc(
|
|
1419
|
-
|
|
1420
|
-
|
|
1382
|
+
return this.executeDoc(
|
|
1383
|
+
"/api/bookmarks",
|
|
1384
|
+
"POST",
|
|
1385
|
+
{
|
|
1386
|
+
post: params.postId
|
|
1387
|
+
}
|
|
1388
|
+
);
|
|
1421
1389
|
}
|
|
1422
1390
|
removeBookmark(params) {
|
|
1423
1391
|
return this.execute(
|
|
@@ -1433,10 +1401,7 @@ var CommunityClient = class extends CustomerScopedApi {
|
|
|
1433
1401
|
}
|
|
1434
1402
|
// Profiles
|
|
1435
1403
|
listProfileLists(params) {
|
|
1436
|
-
return this.execute(
|
|
1437
|
-
`/api/customer-profile-lists${this.buildQuery(params)}`,
|
|
1438
|
-
"GET"
|
|
1439
|
-
);
|
|
1404
|
+
return this.execute(`/api/customer-profile-lists${this.buildQuery(params)}`, "GET");
|
|
1440
1405
|
}
|
|
1441
1406
|
async getProfileList(params) {
|
|
1442
1407
|
const query = "slug" in params ? `?where[slug][equals]=${encodeURIComponent(params.slug)}&limit=1` : `?where[id][equals]=${encodeURIComponent(params.id)}&limit=1`;
|
|
@@ -1674,7 +1639,10 @@ var CartApi = class extends CustomerScopedApi {
|
|
|
1674
1639
|
return this.request(endpoint, { method, body });
|
|
1675
1640
|
}
|
|
1676
1641
|
getCart(cartId) {
|
|
1677
|
-
return this.execute(
|
|
1642
|
+
return this.execute(
|
|
1643
|
+
`/api/carts/${cartId}?depth=0&joins=false`,
|
|
1644
|
+
"GET"
|
|
1645
|
+
);
|
|
1678
1646
|
}
|
|
1679
1647
|
addItem(params) {
|
|
1680
1648
|
return this.execute("/api/carts/add-item", "POST", params);
|
|
@@ -2043,7 +2011,9 @@ var CommerceClient = class {
|
|
|
2043
2011
|
stockCheck: (params) => api.post("/api/products/stock-check", params),
|
|
2044
2012
|
stockSnapshot: (params) => api.get(stockSnapshotQuery(params)),
|
|
2045
2013
|
listingGroups: (params) => api.get(listingGroupsQuery(params)),
|
|
2046
|
-
listingGroupsCatalog: (params) => api.get(
|
|
2014
|
+
listingGroupsCatalog: (params) => api.get(
|
|
2015
|
+
listingGroupsCatalogQuery(params)
|
|
2016
|
+
),
|
|
2047
2017
|
detail: async (params) => {
|
|
2048
2018
|
try {
|
|
2049
2019
|
const product = await api.get(productDetailQuery(params));
|
|
@@ -2604,6 +2574,7 @@ var INTERNAL_COLLECTIONS = [
|
|
|
2604
2574
|
"subscriptions",
|
|
2605
2575
|
"billing-history",
|
|
2606
2576
|
"inventory-reservations",
|
|
2577
|
+
"inventory-adjustments",
|
|
2607
2578
|
"commerce-notification-intents",
|
|
2608
2579
|
"product-collection-items",
|
|
2609
2580
|
"order-status-logs",
|
|
@@ -2622,7 +2593,6 @@ var INTERNAL_COLLECTIONS = [
|
|
|
2622
2593
|
var COLLECTIONS = [
|
|
2623
2594
|
"tenants",
|
|
2624
2595
|
"tenant-metadata",
|
|
2625
|
-
"tenant-logos",
|
|
2626
2596
|
"products",
|
|
2627
2597
|
"product-variants",
|
|
2628
2598
|
"product-options",
|
|
@@ -2631,21 +2601,7 @@ var COLLECTIONS = [
|
|
|
2631
2601
|
"product-tags",
|
|
2632
2602
|
"product-collections",
|
|
2633
2603
|
"brands",
|
|
2634
|
-
"brand-logos",
|
|
2635
|
-
"orders",
|
|
2636
|
-
"order-items",
|
|
2637
|
-
"returns",
|
|
2638
|
-
"return-items",
|
|
2639
|
-
"fulfillment-orders",
|
|
2640
|
-
"fulfillment-order-items",
|
|
2641
|
-
"fulfillments",
|
|
2642
|
-
"fulfillment-items",
|
|
2643
|
-
"transactions",
|
|
2644
|
-
"customers",
|
|
2645
2604
|
"customer-profiles",
|
|
2646
|
-
"customer-addresses",
|
|
2647
|
-
"carts",
|
|
2648
|
-
"cart-items",
|
|
2649
2605
|
"discounts",
|
|
2650
2606
|
"shipping-policies",
|
|
2651
2607
|
"shipping-zones",
|
|
@@ -2676,19 +2632,11 @@ var COLLECTIONS = [
|
|
|
2676
2632
|
"canvas-tags",
|
|
2677
2633
|
"canvas-nodes",
|
|
2678
2634
|
"canvas-edges",
|
|
2679
|
-
"videos",
|
|
2680
2635
|
"video-categories",
|
|
2681
2636
|
"video-tags",
|
|
2682
|
-
"live-streams",
|
|
2683
|
-
"images",
|
|
2684
2637
|
"forms",
|
|
2685
|
-
"form-submissions",
|
|
2686
2638
|
// Community
|
|
2687
|
-
"posts",
|
|
2688
|
-
"comments",
|
|
2689
|
-
"reactions",
|
|
2690
2639
|
"reaction-types",
|
|
2691
|
-
"bookmarks",
|
|
2692
2640
|
"post-categories",
|
|
2693
2641
|
"post-tags",
|
|
2694
2642
|
"customer-profile-lists",
|
|
@@ -2700,9 +2648,33 @@ var COLLECTIONS = [
|
|
|
2700
2648
|
"event-tags"
|
|
2701
2649
|
];
|
|
2702
2650
|
var SERVER_ONLY_COLLECTIONS = [
|
|
2651
|
+
"tenant-logos",
|
|
2652
|
+
"brand-logos",
|
|
2653
|
+
"images",
|
|
2654
|
+
"videos",
|
|
2655
|
+
"orders",
|
|
2656
|
+
"order-items",
|
|
2657
|
+
"returns",
|
|
2658
|
+
"return-items",
|
|
2659
|
+
"fulfillment-orders",
|
|
2660
|
+
"fulfillment-order-items",
|
|
2661
|
+
"fulfillments",
|
|
2662
|
+
"fulfillment-items",
|
|
2663
|
+
"transactions",
|
|
2664
|
+
"customers",
|
|
2665
|
+
"customer-addresses",
|
|
2666
|
+
"form-submissions",
|
|
2667
|
+
"carts",
|
|
2668
|
+
"cart-items",
|
|
2669
|
+
"posts",
|
|
2670
|
+
"comments",
|
|
2671
|
+
"reactions",
|
|
2672
|
+
"bookmarks",
|
|
2673
|
+
"live-streams",
|
|
2703
2674
|
"customer-groups",
|
|
2704
2675
|
"reports",
|
|
2705
|
-
"community-bans"
|
|
2676
|
+
"community-bans",
|
|
2677
|
+
"order-export-profiles"
|
|
2706
2678
|
];
|
|
2707
2679
|
var SERVER_COLLECTIONS = [
|
|
2708
2680
|
...COLLECTIONS,
|
|
@@ -4755,8 +4727,6 @@ function resolveLegacyMediaSet(input) {
|
|
|
4755
4727
|
};
|
|
4756
4728
|
}
|
|
4757
4729
|
function resolveProductGallery(input) {
|
|
4758
|
-
const legacyResolved = resolveLegacyMediaSet(input);
|
|
4759
|
-
if (legacyResolved && legacyResolved.source !== "none") return legacyResolved;
|
|
4760
4730
|
const selectedVariantId = mediaId(input.selectedVariantId);
|
|
4761
4731
|
const selectedOptionValueIds = relationshipIds(input.selectedOptionValueIds);
|
|
4762
4732
|
const selection = resolveProductSelectionMedia({
|
|
@@ -4768,6 +4738,8 @@ function resolveProductGallery(input) {
|
|
|
4768
4738
|
if (selection.source !== "none") {
|
|
4769
4739
|
return selection;
|
|
4770
4740
|
}
|
|
4741
|
+
const legacyResolved = resolveLegacyMediaSet(input);
|
|
4742
|
+
if (legacyResolved && legacyResolved.source !== "none") return legacyResolved;
|
|
4771
4743
|
return resolveProductDisplayMedia({
|
|
4772
4744
|
productMediaPool: input.productMediaPool ?? input.pool ?? null,
|
|
4773
4745
|
productPrimaryMediaItemId: input.productPrimaryMediaItemId,
|