@sixtyninecommerce/client 0.24.0 → 0.26.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 +21 -0
- package/dist/admin/forms.js +19 -0
- package/dist/admin/forms.js.map +1 -1
- package/dist/admin/http.d.ts +9 -0
- package/dist/admin/http.d.ts.map +1 -1
- package/dist/admin/http.js +3 -0
- package/dist/admin/http.js.map +1 -1
- package/dist/admin/index.d.ts +63 -0
- package/dist/admin/index.d.ts.map +1 -1
- package/dist/admin/index.js +67 -0
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/redirects.d.ts +6 -0
- package/dist/admin/redirects.d.ts.map +1 -1
- package/dist/admin/redirects.js +12 -0
- package/dist/admin/redirects.js.map +1 -1
- package/dist/admin/types.d.ts +63 -0
- package/dist/admin/types.d.ts.map +1 -1
- package/dist/cache-tags.d.ts +19 -0
- package/dist/cache-tags.d.ts.map +1 -1
- package/dist/cache-tags.js +19 -0
- package/dist/cache-tags.js.map +1 -1
- package/dist/client.d.ts +17 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +17 -0
- package/dist/client.js.map +1 -1
- package/dist/commerce/age-verification.js +3 -3
- package/dist/commerce/age-verification.js.map +1 -1
- package/dist/commerce/branding.js +7 -0
- package/dist/commerce/branding.js.map +1 -1
- package/dist/commerce/cart.js +25 -0
- package/dist/commerce/cart.js.map +1 -1
- package/dist/commerce/checkout.d.ts +68 -0
- package/dist/commerce/checkout.d.ts.map +1 -1
- package/dist/commerce/checkout.js +83 -0
- package/dist/commerce/checkout.js.map +1 -1
- package/dist/commerce/customer.d.ts +58 -0
- package/dist/commerce/customer.d.ts.map +1 -1
- package/dist/commerce/customer.js +65 -0
- package/dist/commerce/customer.js.map +1 -1
- package/dist/commerce/pickup-location-parser.d.ts +18 -0
- package/dist/commerce/pickup-location-parser.d.ts.map +1 -1
- package/dist/commerce/pickup-location-parser.js +28 -0
- package/dist/commerce/pickup-location-parser.js.map +1 -1
- package/dist/commerce/placement-error.d.ts +52 -0
- package/dist/commerce/placement-error.d.ts.map +1 -1
- package/dist/commerce/placement-error.js +87 -0
- package/dist/commerce/placement-error.js.map +1 -1
- package/dist/commerce/products.d.ts +48 -0
- package/dist/commerce/products.d.ts.map +1 -1
- package/dist/commerce/products.js +92 -0
- package/dist/commerce/products.js.map +1 -1
- package/dist/commerce/queries.d.ts +113 -27
- package/dist/commerce/queries.d.ts.map +1 -1
- package/dist/commerce/queries.js +188 -2
- package/dist/commerce/queries.js.map +1 -1
- package/dist/commerce/quotes.js +33 -0
- package/dist/commerce/quotes.js.map +1 -1
- package/dist/commerce/saved-lists.d.ts +7 -7
- package/dist/commerce/saved-lists.d.ts.map +1 -1
- package/dist/commerce/saved-lists.js +1 -1
- package/dist/commerce/search.js +3 -0
- package/dist/commerce/search.js.map +1 -1
- package/dist/commerce/shipping.js +3 -3
- package/dist/commerce/shipping.js.map +1 -1
- package/dist/commerce/stock-notifications.d.ts +11 -0
- package/dist/commerce/stock-notifications.d.ts.map +1 -1
- package/dist/commerce/stock-notifications.js +11 -0
- package/dist/commerce/stock-notifications.js.map +1 -1
- package/dist/commerce/vat-validation.js +4 -4
- package/dist/commerce/vat-validation.js.map +1 -1
- package/dist/constants.d.ts +31 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +32 -0
- package/dist/constants.js.map +1 -1
- package/dist/content/asset-urls.d.ts +50 -0
- package/dist/content/asset-urls.d.ts.map +1 -1
- package/dist/content/asset-urls.js +92 -0
- package/dist/content/asset-urls.js.map +1 -1
- package/dist/content/assets.d.ts +15 -0
- package/dist/content/assets.d.ts.map +1 -1
- package/dist/content/assets.js +15 -0
- package/dist/content/assets.js.map +1 -1
- package/dist/content/collection-pages.d.ts +5 -0
- package/dist/content/collection-pages.d.ts.map +1 -1
- package/dist/content/collection-pages.js +8 -0
- package/dist/content/collection-pages.js.map +1 -1
- package/dist/content/collections.d.ts +14 -0
- package/dist/content/collections.d.ts.map +1 -1
- package/dist/content/collections.js +16 -0
- package/dist/content/collections.js.map +1 -1
- package/dist/content/filtered-products.d.ts +18 -0
- package/dist/content/filtered-products.d.ts.map +1 -1
- package/dist/content/filtered-products.js +16 -0
- package/dist/content/filtered-products.js.map +1 -1
- package/dist/content/form-field-types.d.ts +6 -0
- package/dist/content/form-field-types.d.ts.map +1 -1
- package/dist/content/form-field-types.js +12 -0
- package/dist/content/form-field-types.js.map +1 -1
- package/dist/content/forms.d.ts +16 -0
- package/dist/content/forms.d.ts.map +1 -1
- package/dist/content/forms.js +23 -0
- package/dist/content/forms.js.map +1 -1
- package/dist/content/items.d.ts +26 -0
- package/dist/content/items.d.ts.map +1 -1
- package/dist/content/items.js +33 -0
- package/dist/content/items.js.map +1 -1
- package/dist/content/resolve.js +6 -0
- package/dist/content/resolve.js.map +1 -1
- package/dist/content/sitemap.d.ts +5 -0
- package/dist/content/sitemap.d.ts.map +1 -1
- package/dist/content/sitemap.js +5 -0
- package/dist/content/sitemap.js.map +1 -1
- package/dist/core/context.js +6 -0
- package/dist/core/context.js.map +1 -1
- package/dist/core/headers.js +2 -0
- package/dist/core/headers.js.map +1 -1
- package/dist/core/http.d.ts +8 -0
- package/dist/core/http.d.ts.map +1 -1
- package/dist/core/http.js +89 -1
- package/dist/core/http.js.map +1 -1
- package/dist/credit/credit-status.js +2 -2
- package/dist/credit/credit-status.js.map +1 -1
- package/dist/credit/payment-terms.js +2 -2
- package/dist/credit/payment-terms.js.map +1 -1
- package/dist/currency/exchange.d.ts +11 -0
- package/dist/currency/exchange.d.ts.map +1 -1
- package/dist/currency/exchange.js +11 -0
- package/dist/currency/exchange.js.map +1 -1
- package/dist/errors.d.ts +50 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +48 -2
- package/dist/errors.js.map +1 -1
- package/dist/events/envelope.d.ts +60 -0
- package/dist/events/envelope.d.ts.map +1 -1
- package/dist/events/envelope.js +12 -0
- package/dist/events/envelope.js.map +1 -1
- package/dist/events/index.d.ts +14 -1
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +13 -0
- package/dist/events/index.js.map +1 -1
- package/dist/events/payloads.d.ts +19 -0
- package/dist/events/payloads.d.ts.map +1 -1
- package/dist/events/payloads.js +12 -0
- package/dist/events/payloads.js.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/media/index.js +2 -0
- package/dist/media/index.js.map +1 -1
- package/dist/media/urls.d.ts +52 -0
- package/dist/media/urls.d.ts.map +1 -1
- package/dist/media/urls.js +38 -0
- package/dist/media/urls.js.map +1 -1
- package/dist/media/video.d.ts +16 -0
- package/dist/media/video.d.ts.map +1 -1
- package/dist/media/video.js +16 -0
- package/dist/media/video.js.map +1 -1
- package/dist/next/artifact-handler.d.ts +22 -0
- package/dist/next/artifact-handler.d.ts.map +1 -1
- package/dist/next/artifact-handler.js +22 -0
- package/dist/next/artifact-handler.js.map +1 -1
- package/dist/next/event-revalidate-handler.d.ts +67 -0
- package/dist/next/event-revalidate-handler.d.ts.map +1 -1
- package/dist/next/event-revalidate-handler.js +48 -0
- package/dist/next/event-revalidate-handler.js.map +1 -1
- package/dist/next/index.d.ts +6 -0
- package/dist/next/index.d.ts.map +1 -1
- package/dist/next/index.js +6 -0
- package/dist/next/index.js.map +1 -1
- package/dist/next/json-ld.d.ts +9 -0
- package/dist/next/json-ld.d.ts.map +1 -1
- package/dist/next/json-ld.js +9 -0
- package/dist/next/json-ld.js.map +1 -1
- package/dist/next/metadata.d.ts +18 -0
- package/dist/next/metadata.d.ts.map +1 -1
- package/dist/next/metadata.js +21 -0
- package/dist/next/metadata.js.map +1 -1
- package/dist/next/redirect-middleware.d.ts +39 -0
- package/dist/next/redirect-middleware.d.ts.map +1 -1
- package/dist/next/redirect-middleware.js +32 -0
- package/dist/next/redirect-middleware.js.map +1 -1
- package/dist/next/revalidate-handler.d.ts +30 -0
- package/dist/next/revalidate-handler.d.ts.map +1 -1
- package/dist/next/revalidate-handler.js +22 -0
- package/dist/next/revalidate-handler.js.map +1 -1
- package/dist/order-scope.d.ts +27 -0
- package/dist/order-scope.d.ts.map +1 -1
- package/dist/order-scope.js +29 -0
- package/dist/order-scope.js.map +1 -1
- package/dist/pricing/format.d.ts +17 -0
- package/dist/pricing/format.d.ts.map +1 -1
- package/dist/pricing/format.js +19 -0
- package/dist/pricing/format.js.map +1 -1
- package/dist/pricing/index.d.ts +8 -1
- package/dist/pricing/index.d.ts.map +1 -1
- package/dist/pricing/index.js +18 -2
- package/dist/pricing/index.js.map +1 -1
- package/dist/pricing/tax-display.d.ts +77 -0
- package/dist/pricing/tax-display.d.ts.map +1 -1
- package/dist/pricing/tax-display.js +85 -0
- package/dist/pricing/tax-display.js.map +1 -1
- package/dist/pricing/tiers.d.ts +9 -0
- package/dist/pricing/tiers.d.ts.map +1 -1
- package/dist/pricing/tiers.js +9 -0
- package/dist/pricing/tiers.js.map +1 -1
- package/dist/pricing/validation.d.ts +56 -1
- package/dist/pricing/validation.d.ts.map +1 -1
- package/dist/pricing/validation.js +61 -0
- package/dist/pricing/validation.js.map +1 -1
- package/dist/redirects/index.d.ts +1 -0
- package/dist/redirects/index.d.ts.map +1 -1
- package/dist/redirects/index.js +1 -0
- package/dist/redirects/index.js.map +1 -1
- package/dist/redirects/store.d.ts +20 -0
- package/dist/redirects/store.d.ts.map +1 -1
- package/dist/redirects/store.js +57 -0
- package/dist/redirects/store.js.map +1 -1
- package/dist/redirects/types.d.ts +24 -0
- package/dist/redirects/types.d.ts.map +1 -1
- package/dist/redirects/types.js +1 -0
- package/dist/redirects/types.js.map +1 -1
- package/dist/revalidation/event-plan.d.ts +48 -0
- package/dist/revalidation/event-plan.d.ts.map +1 -1
- package/dist/revalidation/event-plan.js +61 -0
- package/dist/revalidation/event-plan.js.map +1 -1
- package/dist/revalidation/event-verify.d.ts +25 -0
- package/dist/revalidation/event-verify.d.ts.map +1 -1
- package/dist/revalidation/event-verify.js +27 -0
- package/dist/revalidation/event-verify.js.map +1 -1
- package/dist/revalidation/types.d.ts +20 -0
- package/dist/revalidation/types.d.ts.map +1 -1
- package/dist/revalidation/types.js +10 -0
- package/dist/revalidation/types.js.map +1 -1
- package/dist/revalidation/url-context.d.ts +25 -0
- package/dist/revalidation/url-context.d.ts.map +1 -1
- package/dist/revalidation/url-context.js +17 -0
- package/dist/revalidation/url-context.js.map +1 -1
- package/dist/revalidation/verify.d.ts +8 -0
- package/dist/revalidation/verify.d.ts.map +1 -1
- package/dist/revalidation/verify.js +8 -0
- package/dist/revalidation/verify.js.map +1 -1
- package/dist/seo/ai.d.ts +17 -0
- package/dist/seo/ai.d.ts.map +1 -1
- package/dist/seo/ai.js +12 -0
- package/dist/seo/ai.js.map +1 -1
- package/dist/seo/alternates.js +13 -0
- package/dist/seo/alternates.js.map +1 -1
- package/dist/seo/artifacts.d.ts +13 -0
- package/dist/seo/artifacts.d.ts.map +1 -1
- package/dist/seo/artifacts.js +19 -0
- package/dist/seo/artifacts.js.map +1 -1
- package/dist/seo/canonical.d.ts +15 -0
- package/dist/seo/canonical.d.ts.map +1 -1
- package/dist/seo/canonical.js +24 -0
- package/dist/seo/canonical.js.map +1 -1
- package/dist/seo/index.js +6 -0
- package/dist/seo/index.js.map +1 -1
- package/dist/seo/json-ld.d.ts +13 -0
- package/dist/seo/json-ld.d.ts.map +1 -1
- package/dist/seo/json-ld.js +32 -0
- package/dist/seo/json-ld.js.map +1 -1
- package/dist/seo/locale-tag.d.ts +31 -0
- package/dist/seo/locale-tag.d.ts.map +1 -1
- package/dist/seo/locale-tag.js +31 -0
- package/dist/seo/locale-tag.js.map +1 -1
- package/dist/seo/meta-tags.d.ts +29 -0
- package/dist/seo/meta-tags.d.ts.map +1 -1
- package/dist/seo/meta-tags.js +28 -0
- package/dist/seo/meta-tags.js.map +1 -1
- package/dist/seo/metadata-parser.d.ts +24 -0
- package/dist/seo/metadata-parser.d.ts.map +1 -1
- package/dist/seo/metadata-parser.js +38 -0
- package/dist/seo/metadata-parser.js.map +1 -1
- package/dist/seo/metadata-types.d.ts +16 -0
- package/dist/seo/metadata-types.d.ts.map +1 -1
- package/dist/seo/product-path.d.ts +96 -0
- package/dist/seo/product-path.d.ts.map +1 -1
- package/dist/seo/product-path.js +96 -0
- package/dist/seo/product-path.js.map +1 -1
- package/dist/seo/robots.d.ts +17 -0
- package/dist/seo/robots.d.ts.map +1 -1
- package/dist/seo/robots.js +12 -0
- package/dist/seo/robots.js.map +1 -1
- package/dist/seo/types.d.ts +39 -0
- package/dist/seo/types.d.ts.map +1 -1
- package/dist/seo/url-builder.d.ts +31 -0
- package/dist/seo/url-builder.d.ts.map +1 -1
- package/dist/seo/url-builder.js +36 -0
- package/dist/seo/url-builder.js.map +1 -1
- package/dist/types.d.ts +1163 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
import type { HttpClient } from '../core/http.js';
|
|
2
2
|
import type { CmsCollection, CmsCollectionDetail, CmsCollectionItem, CmsCollectionItemList, CollectionItemsQuery, RequestOptions, StoreContext } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Direct (database-backed) CMS collection reads. Unlike `getContent` /
|
|
5
|
+
* `searchContent`, which go through the Meilisearch index, these read the
|
|
6
|
+
* CMS database directly — use them for canonical content fetches (detail
|
|
7
|
+
* pages, build-time rendering) where index freshness must not matter.
|
|
8
|
+
* Public callers only ever receive published items.
|
|
9
|
+
*/
|
|
3
10
|
export declare function createCmsCollectionMethods(http: HttpClient, ctx: StoreContext): {
|
|
11
|
+
/** List the channel's CMS collections (content types). */
|
|
4
12
|
getCollections(options?: RequestOptions): Promise<CmsCollection[]>;
|
|
13
|
+
/** A single CMS collection including its field definitions. */
|
|
5
14
|
getCollection(collectionId: string, options?: RequestOptions): Promise<CmsCollectionDetail>;
|
|
15
|
+
/**
|
|
16
|
+
* List a collection's items with locale-aware field values. Pass
|
|
17
|
+
* `parentId: 'root'` for top-level items of a hierarchical collection.
|
|
18
|
+
*/
|
|
6
19
|
getCollectionItems(collectionId: string, query?: CollectionItemsQuery, options?: RequestOptions): Promise<CmsCollectionItemList>;
|
|
20
|
+
/** A single collection item with field values and slug translations. */
|
|
7
21
|
getCollectionItem(collectionId: string, itemId: string, languageCode?: string, options?: RequestOptions): Promise<CmsCollectionItem>;
|
|
8
22
|
};
|
|
9
23
|
//# sourceMappingURL=collections.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../src/content/collections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,cAAc,EACd,YAAY,EACb,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../src/content/collections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,cAAc,EACd,YAAY,EACb,MAAM,aAAa,CAAC;AAoBrB;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,YAAY;IAU1E,0DAA0D;6BAC3B,cAAc,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAKxE,+DAA+D;gCAE/C,MAAM,YACV,cAAc,GACvB,OAAO,CAAC,mBAAmB,CAAC;IAS/B;;;OAGG;qCAEa,MAAM,UACZ,oBAAoB,YAClB,cAAc,GACvB,OAAO,CAAC,qBAAqB,CAAC;IAkBjC,wEAAwE;oCAExD,MAAM,UACZ,MAAM,iBACC,MAAM,YACX,cAAc,GACvB,OAAO,CAAC,iBAAiB,CAAC;EAWhC"}
|
|
@@ -1,20 +1,35 @@
|
|
|
1
1
|
import { createContextAssetUrlResolver } from '../media/urls.js';
|
|
2
2
|
import { resolveContentFieldValues } from './asset-urls.js';
|
|
3
|
+
/**
|
|
4
|
+
* Direct (database-backed) CMS collection reads. Unlike `getContent` /
|
|
5
|
+
* `searchContent`, which go through the Meilisearch index, these read the
|
|
6
|
+
* CMS database directly — use them for canonical content fetches (detail
|
|
7
|
+
* pages, build-time rendering) where index freshness must not matter.
|
|
8
|
+
* Public callers only ever receive published items.
|
|
9
|
+
*/
|
|
3
10
|
export function createCmsCollectionMethods(http, ctx) {
|
|
11
|
+
// Built once: ctx is fixed for the client's lifetime.
|
|
4
12
|
const resolve = createContextAssetUrlResolver(ctx);
|
|
13
|
+
/** Content values carry asset references as storage keys; resolve on read. */
|
|
5
14
|
const withResolvedValues = (item) => ({
|
|
6
15
|
...item,
|
|
7
16
|
values: resolveContentFieldValues(item.values, resolve),
|
|
8
17
|
});
|
|
9
18
|
return {
|
|
19
|
+
/** List the channel's CMS collections (content types). */
|
|
10
20
|
async getCollections(options) {
|
|
11
21
|
const envelope = await http.cmsGet('/collections', {}, options);
|
|
12
22
|
return envelope.data;
|
|
13
23
|
},
|
|
24
|
+
/** A single CMS collection including its field definitions. */
|
|
14
25
|
async getCollection(collectionId, options) {
|
|
15
26
|
const envelope = await http.cmsGet(`/collections/${collectionId}`, {}, options);
|
|
16
27
|
return envelope.data;
|
|
17
28
|
},
|
|
29
|
+
/**
|
|
30
|
+
* List a collection's items with locale-aware field values. Pass
|
|
31
|
+
* `parentId: 'root'` for top-level items of a hierarchical collection.
|
|
32
|
+
*/
|
|
18
33
|
async getCollectionItems(collectionId, query, options) {
|
|
19
34
|
const params = {};
|
|
20
35
|
if (query?.parentId)
|
|
@@ -34,6 +49,7 @@ export function createCmsCollectionMethods(http, ctx) {
|
|
|
34
49
|
const envelope = await http.cmsGet(`/collections/${collectionId}/items`, params, options);
|
|
35
50
|
return { items: envelope.data.map(withResolvedValues), total: envelope.pagination.total };
|
|
36
51
|
},
|
|
52
|
+
/** A single collection item with field values and slug translations. */
|
|
37
53
|
async getCollectionItem(collectionId, itemId, languageCode, options) {
|
|
38
54
|
const params = {};
|
|
39
55
|
if (languageCode)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collections.js","sourceRoot":"","sources":["../../src/content/collections.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AAUjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"collections.js","sourceRoot":"","sources":["../../src/content/collections.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AAUjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAmB5D;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B,CAAC,IAAgB,EAAE,GAAiB;IAC5E,sDAAsD;IACtD,MAAM,OAAO,GAAG,6BAA6B,CAAC,GAAG,CAAC,CAAC;IACnD,8EAA8E;IAC9E,MAAM,kBAAkB,GAAG,CAAgD,IAAO,EAAK,EAAE,CAAC,CAAC;QACzF,GAAG,IAAI;QACP,MAAM,EAAE,yBAAyB,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC;KACxD,CAAC,CAAC;IAEH,OAAO;QACL,0DAA0D;QAC1D,KAAK,CAAC,cAAc,CAAC,OAAwB;YAC3C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAyB,cAAc,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;YACxF,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;QAED,+DAA+D;QAC/D,KAAK,CAAC,aAAa,CACjB,YAAoB,EACpB,OAAwB;YAExB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAChC,gBAAgB,YAAY,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B,MAAM,MAAM,GAA2B,EAAE,CAAC;YAC1C,IAAI,YAAY;gBAAE,MAAM,CAAC,aAAa,GAAG,YAAY,CAAC;YACtD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAChC,gBAAgB,YAAY,UAAU,MAAM,EAAE,EAC9C,MAAM,EACN,OAAO,CACR,CAAC;YACF,OAAO,kBAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC3C,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SearchInput } from '../types.js';
|
|
2
|
+
/** Value stored by the `filtered_products` CMS field type. */
|
|
2
3
|
export interface FilteredProductsValue {
|
|
3
4
|
filters: Array<{
|
|
4
5
|
property_slug: string;
|
|
@@ -6,11 +7,28 @@ export interface FilteredProductsValue {
|
|
|
6
7
|
}>;
|
|
7
8
|
collection_id?: string | null;
|
|
8
9
|
}
|
|
10
|
+
/** Field-level config for the `filtered_products` CMS field type. */
|
|
9
11
|
export interface FilteredProductsConfig {
|
|
10
12
|
filtered_sort_field?: string;
|
|
11
13
|
filtered_sort_direction?: string;
|
|
12
14
|
filtered_limit?: number;
|
|
13
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Convert a `filtered_products` CMS field value + config into SearchInput params
|
|
18
|
+
* for use with `searchProducts()`.
|
|
19
|
+
*
|
|
20
|
+
* Sort and limit come from the field config (set in the content type builder),
|
|
21
|
+
* filters and collection scope come from the per-item value.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* const field = collection.fields.find(f => f.slug === 'featured');
|
|
26
|
+
* const value = item.values.featured as FilteredProductsValue;
|
|
27
|
+
* const results = await client.commerce.searchProducts(
|
|
28
|
+
* buildFilteredProductsSearch(value, field?.config),
|
|
29
|
+
* );
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
14
32
|
export declare function buildFilteredProductsSearch(value: FilteredProductsValue, config?: FilteredProductsConfig, overrides?: {
|
|
15
33
|
term?: string;
|
|
16
34
|
take?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filtered-products.d.ts","sourceRoot":"","sources":["../../src/content/filtered-products.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"filtered-products.d.ts","sourceRoot":"","sources":["../../src/content/filtered-products.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,8DAA8D;AAC9D,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,KAAK,CAAC;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IACrE,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,qEAAqE;AACrE,MAAM,WAAW,sBAAsB;IACrC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,qBAAqB,EAC5B,MAAM,CAAC,EAAE,sBAAsB,EAC/B,SAAS,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1D,WAAW,CAiBb"}
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert a `filtered_products` CMS field value + config into SearchInput params
|
|
3
|
+
* for use with `searchProducts()`.
|
|
4
|
+
*
|
|
5
|
+
* Sort and limit come from the field config (set in the content type builder),
|
|
6
|
+
* filters and collection scope come from the per-item value.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const field = collection.fields.find(f => f.slug === 'featured');
|
|
11
|
+
* const value = item.values.featured as FilteredProductsValue;
|
|
12
|
+
* const results = await client.commerce.searchProducts(
|
|
13
|
+
* buildFilteredProductsSearch(value, field?.config),
|
|
14
|
+
* );
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
1
17
|
export function buildFilteredProductsSearch(value, config, overrides) {
|
|
2
18
|
const sort = config?.filtered_sort_field
|
|
3
19
|
? {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filtered-products.js","sourceRoot":"","sources":["../../src/content/filtered-products.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"filtered-products.js","sourceRoot":"","sources":["../../src/content/filtered-products.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,2BAA2B,CACzC,KAA4B,EAC5B,MAA+B,EAC/B,SAA2D;IAE3D,MAAM,IAAI,GAAoC,MAAM,EAAE,mBAAmB;QACvE,CAAC,CAAE;YACC,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC,uBAAuB,IAAI,KAAK;SAC9C;QAC3B,CAAC,CAAC,SAAS,CAAC;IAEd,OAAO;QACL,IAAI,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE;QAC3B,iBAAiB,EAAE,KAAK,CAAC,OAAO;aAC7B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC;aAC3C,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC;QAC1C,YAAY,EAAE,KAAK,CAAC,aAAa,IAAI,SAAS;QAC9C,IAAI,EAAE,SAAS,EAAE,IAAI,IAAI,MAAM,EAAE,cAAc;QAC/C,IAAI,EAAE,SAAS,EAAE,IAAI;QACrB,IAAI;KACL,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { FormFieldTypeDescriptor, FormSlugRules } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Static mirror of the CMS slug rules (services/cms field-type-registry.ts),
|
|
4
|
+
* served live in the `meta.slugRules` of GET /forms/field-types. Form slugs are
|
|
5
|
+
* HYPHEN-separated and field slugs are UNDERSCORE-separated — the mix-up the
|
|
6
|
+
* CMS rejects with a 400.
|
|
7
|
+
*/
|
|
2
8
|
export declare const FORM_SLUG_RULES: FormSlugRules;
|
|
3
9
|
export declare const FORM_FIELD_TYPES: FormFieldTypeDescriptor[];
|
|
4
10
|
//# sourceMappingURL=form-field-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-field-types.d.ts","sourceRoot":"","sources":["../../src/content/form-field-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA2B,uBAAuB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"form-field-types.d.ts","sourceRoot":"","sources":["../../src/content/form-field-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA2B,uBAAuB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEnG;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,aAiB7B,CAAC;AA4BF,eAAO,MAAM,gBAAgB,EAAE,uBAAuB,EAoFrD,CAAC"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Static mirror of the CMS slug rules (services/cms field-type-registry.ts),
|
|
3
|
+
* served live in the `meta.slugRules` of GET /forms/field-types. Form slugs are
|
|
4
|
+
* HYPHEN-separated and field slugs are UNDERSCORE-separated — the mix-up the
|
|
5
|
+
* CMS rejects with a 400.
|
|
6
|
+
*/
|
|
1
7
|
export const FORM_SLUG_RULES = {
|
|
2
8
|
form: {
|
|
3
9
|
pattern: '^[a-z0-9]+(?:-[a-z0-9]+)*$',
|
|
@@ -14,6 +20,12 @@ export const FORM_SLUG_RULES = {
|
|
|
14
20
|
invalidExamples: ['Email', 'first-name', '_email', 'first__name'],
|
|
15
21
|
},
|
|
16
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* Static mirror of the CMS field-type registry (services/cms field-type-registry.ts),
|
|
25
|
+
* so a storefront can author forms without a round-trip. Keep this data
|
|
26
|
+
* IDENTICAL to what `GET /forms/field-types` (content.getFormFieldTypes())
|
|
27
|
+
* returns — the endpoint is authoritative; this is the offline copy.
|
|
28
|
+
*/
|
|
17
29
|
const STRING_CONSTRAINTS = [
|
|
18
30
|
{ key: 'min_length', valueType: 'integer', description: 'Minimum number of characters.' },
|
|
19
31
|
{ key: 'max_length', valueType: 'integer', description: 'Maximum number of characters.' },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-field-types.js","sourceRoot":"","sources":["../../src/content/form-field-types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"form-field-types.js","sourceRoot":"","sources":["../../src/content/form-field-types.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAkB;IAC5C,IAAI,EAAE;QACJ,OAAO,EAAE,4BAA4B;QACrC,SAAS,EAAE,GAAG;QACd,WAAW,EACT,yIAAyI;QAC3I,aAAa,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,wBAAwB,CAAC;QAClE,eAAe,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,CAAC;KACtE;IACD,KAAK,EAAE;QACL,OAAO,EAAE,4BAA4B;QACrC,SAAS,EAAE,GAAG;QACd,WAAW,EACT,0NAA0N;QAC5N,aAAa,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,aAAa,CAAC;QACrD,eAAe,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,CAAC;KAClE;CACF,CAAC;AAEF;;;;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E,oCAAoC,EAAE;YACtF,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,oCAAoC,EAAE;SACvF;KACF;IACD;QACE,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,0BAA0B;QACjC,WAAW,EAAE,gDAAgD;QAC7D,SAAS,EAAE,QAAQ;QACnB,WAAW,EAAE,kBAAkB;KAChC;IACD;QACE,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,2BAA2B;QAClC,WAAW,EACT,uFAAuF;QACzF,SAAS,EAAE,oBAAoB;QAC/B,WAAW,EAAE,kBAAkB;QAC/B,KAAK,EAAE,+EAA+E;KACvF;IACD;QACE,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,uBAAuB;QAC9B,WAAW,EAAE,gDAAgD;QAC7D,SAAS,EAAE,QAAQ;QACnB,WAAW,EAAE,kBAAkB;KAChC;IACD;QACE,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,MAAM;QACb,WAAW,EAAE,+CAA+C;QAC5D,SAAS,EAAE,mBAAmB;QAC9B,WAAW,EAAE,EAAE;KAChB;IACD;QACE,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,gBAAgB;QACvB,WAAW,EAAE,wDAAwD;QACrE,SAAS,EAAE,QAAQ;QACnB,WAAW,EAAE,kBAAkB;KAChC;IACD;QACE,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,iEAAiE;QAC9E,SAAS,EAAE,QAAQ;QACnB,WAAW,EAAE,kBAAkB;KAChC;CACF,CAAC"}
|
package/dist/content/forms.d.ts
CHANGED
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
import type { HttpClient } from '../core/http.js';
|
|
2
2
|
import type { FormDefinition, FormFieldTypeDescriptor, FormFieldTypeRegistry, FormListOptions, FormListResult, FormSubmissionResult, RequestOptions, StoreContext } from '../types.js';
|
|
3
3
|
export declare function createFormMethods(http: HttpClient, ctx: StoreContext): {
|
|
4
|
+
/**
|
|
5
|
+
* Discover the channel's forms (public projection). Returns summaries —
|
|
6
|
+
* `fields`/`translations` are empty here; call getForm/getFormBySlug for a
|
|
7
|
+
* single form's fields.
|
|
8
|
+
*/
|
|
4
9
|
listForms(options?: FormListOptions & RequestOptions): Promise<FormListResult>;
|
|
5
10
|
getForm(id: string, options?: RequestOptions): Promise<FormDefinition>;
|
|
11
|
+
/** Look up a form by its stable slug instead of its UUID. */
|
|
6
12
|
getFormBySlug(slug: string, options?: RequestOptions): Promise<FormDefinition>;
|
|
13
|
+
/**
|
|
14
|
+
* The field-type registry served by GET /forms/field-types. For an offline
|
|
15
|
+
* copy that needs no round-trip, import the static `FORM_FIELD_TYPES`.
|
|
16
|
+
*/
|
|
7
17
|
getFormFieldTypes(options?: RequestOptions): Promise<FormFieldTypeDescriptor[]>;
|
|
18
|
+
/**
|
|
19
|
+
* Field types AND slug rules from the same request. `meta.slugRules` was
|
|
20
|
+
* added to the endpoint after the SDK shipped, so a CMS that predates it
|
|
21
|
+
* falls back to the static mirror rather than handing back an undefined
|
|
22
|
+
* rule an author would then have to guess at.
|
|
23
|
+
*/
|
|
8
24
|
getFormFieldTypeRegistry(options?: RequestOptions): Promise<FormFieldTypeRegistry>;
|
|
9
25
|
submitForm(id: string, values: Record<string, unknown>, options?: RequestOptions): Promise<FormSubmissionResult>;
|
|
10
26
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forms.d.ts","sourceRoot":"","sources":["../../src/content/forms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,KAAK,EACV,cAAc,EACd,uBAAuB,EACvB,qBAAqB,EACrB,eAAe,EACf,cAAc,EAEd,oBAAoB,EACpB,cAAc,EACd,YAAY,EACb,MAAM,aAAa,CAAC;AAGrB,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,YAAY;
|
|
1
|
+
{"version":3,"file":"forms.d.ts","sourceRoot":"","sources":["../../src/content/forms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,KAAK,EACV,cAAc,EACd,uBAAuB,EACvB,qBAAqB,EACrB,eAAe,EACf,cAAc,EAEd,oBAAoB,EACpB,cAAc,EACd,YAAY,EACb,MAAM,aAAa,CAAC;AAGrB,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,YAAY;IAcjE;;;;OAIG;wBACuB,eAAe,GAAG,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;gBAUlE,MAAM,YAAY,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;IAK5E,6DAA6D;wBACnC,MAAM,YAAY,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;IASpF;;;OAGG;gCAC+B,cAAc,GAAG,OAAO,CAAC,uBAAuB,EAAE,CAAC;IASrF;;;;;OAKG;uCACsC,cAAc,GAAG,OAAO,CAAC,qBAAqB,CAAC;mBASlF,MAAM,UACF,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YACrB,cAAc,GACvB,OAAO,CAAC,oBAAoB,CAAC;EAgCnC"}
|
package/dist/content/forms.js
CHANGED
|
@@ -13,6 +13,11 @@ export function createFormMethods(http, ctx) {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
return {
|
|
16
|
+
/**
|
|
17
|
+
* Discover the channel's forms (public projection). Returns summaries —
|
|
18
|
+
* `fields`/`translations` are empty here; call getForm/getFormBySlug for a
|
|
19
|
+
* single form's fields.
|
|
20
|
+
*/
|
|
16
21
|
async listForms(options) {
|
|
17
22
|
const params = {};
|
|
18
23
|
if (options?.limit !== undefined)
|
|
@@ -31,19 +36,37 @@ export function createFormMethods(http, ctx) {
|
|
|
31
36
|
const data = await http.cmsGet(`/forms/${id}`, undefined, options);
|
|
32
37
|
return withSubmitTarget(data.data);
|
|
33
38
|
},
|
|
39
|
+
/** Look up a form by its stable slug instead of its UUID. */
|
|
34
40
|
async getFormBySlug(slug, options) {
|
|
35
41
|
const data = await http.cmsGet(`/forms/by-slug/${encodeURIComponent(slug)}`, undefined, options);
|
|
36
42
|
return withSubmitTarget(data.data);
|
|
37
43
|
},
|
|
44
|
+
/**
|
|
45
|
+
* The field-type registry served by GET /forms/field-types. For an offline
|
|
46
|
+
* copy that needs no round-trip, import the static `FORM_FIELD_TYPES`.
|
|
47
|
+
*/
|
|
38
48
|
async getFormFieldTypes(options) {
|
|
39
49
|
const data = await http.cmsGet('/forms/field-types', undefined, options);
|
|
40
50
|
return data.data;
|
|
41
51
|
},
|
|
52
|
+
/**
|
|
53
|
+
* Field types AND slug rules from the same request. `meta.slugRules` was
|
|
54
|
+
* added to the endpoint after the SDK shipped, so a CMS that predates it
|
|
55
|
+
* falls back to the static mirror rather than handing back an undefined
|
|
56
|
+
* rule an author would then have to guess at.
|
|
57
|
+
*/
|
|
42
58
|
async getFormFieldTypeRegistry(options) {
|
|
43
59
|
const data = await http.cmsGet('/forms/field-types', undefined, options);
|
|
44
60
|
return { fieldTypes: data.data, slugRules: data.meta?.slugRules ?? FORM_SLUG_RULES };
|
|
45
61
|
},
|
|
46
62
|
async submitForm(id, values, options) {
|
|
63
|
+
// The CMS expects the field values wrapped in `data`, with an optional
|
|
64
|
+
// locale taken from the store context. On success it returns
|
|
65
|
+
// { data: { id, created_at } }. A 400 carrying field-level details is a
|
|
66
|
+
// VALIDATION failure — resolved as { success: false, errors } so
|
|
67
|
+
// storefronts can render inline field messages without try/catch.
|
|
68
|
+
// Everything else (429 rate limit with retryAfterSeconds, non-field
|
|
69
|
+
// 400s, 5xx, transport) still throws.
|
|
47
70
|
const body = { data: values };
|
|
48
71
|
if (ctx.languageCode) {
|
|
49
72
|
body.locale_code = ctx.languageCode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forms.js","sourceRoot":"","sources":["../../src/content/forms.ts"],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
|
+
/**
|
|
3
|
+
* The lookup endpoints reject more than this many ids per call (they used to
|
|
4
|
+
* silently return the first 50), so every call site here splits its input.
|
|
5
|
+
*/
|
|
2
6
|
export declare const ITEM_LOOKUP_MAX_IDS = 50;
|
|
3
7
|
import type { ContentItemSummary, ContentItemWithFields, ContentQueryOptions, ContentSearchQuery, ContentSearchResult, RequestOptions, StoreContext } from '../types.js';
|
|
4
8
|
export declare function createContentItemMethods(http: HttpClient, ctx: StoreContext): {
|
|
5
9
|
getContent(queryOptions: ContentQueryOptions, options?: RequestOptions): Promise<Record<string, unknown>>;
|
|
10
|
+
/**
|
|
11
|
+
* Typed channel-wide search across CMS content items. Returns the search
|
|
12
|
+
* envelope (hits, total, paging) with each hit's field values flattened
|
|
13
|
+
* on the document. Pass `collectionId` or `collectionSlug` to scope the
|
|
14
|
+
* search; omit both to search every collection in the store.
|
|
15
|
+
*
|
|
16
|
+
* Wraps the same endpoint as `getContent`, but with a defined return
|
|
17
|
+
* shape suitable for site-wide search bars.
|
|
18
|
+
*/
|
|
6
19
|
searchContent(query: ContentSearchQuery, options?: RequestOptions): Promise<ContentSearchResult>;
|
|
20
|
+
/**
|
|
21
|
+
* Bulk look up CMS items by ID. Used to resolve content reference field
|
|
22
|
+
* values (`content_item`, `multi_collection_ref`, etc.) which store arrays
|
|
23
|
+
* of item UUIDs. Public callers see only published items.
|
|
24
|
+
*
|
|
25
|
+
* Any number of ids may be passed: the endpoint rejects more than
|
|
26
|
+
* {@link ITEM_LOOKUP_MAX_IDS} per call, so requests are split here.
|
|
27
|
+
*/
|
|
7
28
|
lookupContentItems(ids: string[], options?: RequestOptions): Promise<ContentItemSummary[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Like `lookupContentItems`, but additionally returns the requested field
|
|
31
|
+
* values for each item. Useful when rendering reference field previews
|
|
32
|
+
* (e.g. show the title and featured image of every linked blog post).
|
|
33
|
+
*/
|
|
8
34
|
lookupContentItemsWithFields(ids: string[], fieldSlugs: string[], options?: RequestOptions): Promise<ContentItemWithFields[]>;
|
|
9
35
|
};
|
|
10
36
|
//# sourceMappingURL=items.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"items.d.ts","sourceRoot":"","sources":["../../src/content/items.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"items.d.ts","sourceRoot":"","sources":["../../src/content/items.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAQlD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAQtC,OAAO,KAAK,EACV,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,YAAY,EACb,MAAM,aAAa,CAAC;AAcrB,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,YAAY;6BAexD,mBAAmB,YACvB,cAAc,GACvB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAoBnC;;;;;;;;OAQG;yBAEM,kBAAkB,YACf,cAAc,GACvB,OAAO,CAAC,mBAAmB,CAAC;IAuB/B;;;;;;;OAOG;4BAEI,MAAM,EAAE,YACH,cAAc,GACvB,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAUhC;;;;OAIG;sCAEI,MAAM,EAAE,cACD,MAAM,EAAE,YACV,cAAc,GACvB,OAAO,CAAC,qBAAqB,EAAE,CAAC;EActC"}
|
package/dist/content/items.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { createContextAssetUrlResolver } from '../media/urls.js';
|
|
2
2
|
import { resolveContentFieldValues, resolveSearchEnvelope, resolveSearchHitValues, } from './asset-urls.js';
|
|
3
|
+
/**
|
|
4
|
+
* The lookup endpoints reject more than this many ids per call (they used to
|
|
5
|
+
* silently return the first 50), so every call site here splits its input.
|
|
6
|
+
*/
|
|
3
7
|
export const ITEM_LOOKUP_MAX_IDS = 50;
|
|
4
8
|
function batched(items, size) {
|
|
5
9
|
const out = [];
|
|
@@ -8,6 +12,11 @@ function batched(items, size) {
|
|
|
8
12
|
return out;
|
|
9
13
|
}
|
|
10
14
|
export function createContentItemMethods(http, ctx) {
|
|
15
|
+
/**
|
|
16
|
+
* Content values reference assets by storage key. Resolving happens here, at
|
|
17
|
+
* render time, so a channel rename or a change of CDN origin cannot strand
|
|
18
|
+
* stored content. Legacy absolute URLs pass through untouched.
|
|
19
|
+
*/
|
|
11
20
|
const resolveAssets = (items) => {
|
|
12
21
|
const resolve = createContextAssetUrlResolver(ctx);
|
|
13
22
|
return items.map((item) => ({
|
|
@@ -32,9 +41,20 @@ export function createContentItemMethods(http, ctx) {
|
|
|
32
41
|
params.sort = queryOptions.sort;
|
|
33
42
|
if (queryOptions.languageCode)
|
|
34
43
|
params.language_code = queryOptions.languageCode;
|
|
44
|
+
// Search hits carry the same stored values as a direct read, so they
|
|
45
|
+
// need the same resolution — Meilisearch holds `value_json` verbatim.
|
|
35
46
|
const envelope = await http.cmsGet('/search/collection-items', params, options);
|
|
36
47
|
return resolveSearchEnvelope(envelope, createContextAssetUrlResolver(ctx));
|
|
37
48
|
},
|
|
49
|
+
/**
|
|
50
|
+
* Typed channel-wide search across CMS content items. Returns the search
|
|
51
|
+
* envelope (hits, total, paging) with each hit's field values flattened
|
|
52
|
+
* on the document. Pass `collectionId` or `collectionSlug` to scope the
|
|
53
|
+
* search; omit both to search every collection in the store.
|
|
54
|
+
*
|
|
55
|
+
* Wraps the same endpoint as `getContent`, but with a defined return
|
|
56
|
+
* shape suitable for site-wide search bars.
|
|
57
|
+
*/
|
|
38
58
|
async searchContent(query, options) {
|
|
39
59
|
const params = {};
|
|
40
60
|
params.q = query.q ?? '';
|
|
@@ -59,12 +79,25 @@ export function createContentItemMethods(http, ctx) {
|
|
|
59
79
|
hits: envelope.data.hits.map((hit) => resolveSearchHitValues(hit, resolve)),
|
|
60
80
|
};
|
|
61
81
|
},
|
|
82
|
+
/**
|
|
83
|
+
* Bulk look up CMS items by ID. Used to resolve content reference field
|
|
84
|
+
* values (`content_item`, `multi_collection_ref`, etc.) which store arrays
|
|
85
|
+
* of item UUIDs. Public callers see only published items.
|
|
86
|
+
*
|
|
87
|
+
* Any number of ids may be passed: the endpoint rejects more than
|
|
88
|
+
* {@link ITEM_LOOKUP_MAX_IDS} per call, so requests are split here.
|
|
89
|
+
*/
|
|
62
90
|
async lookupContentItems(ids, options) {
|
|
63
91
|
if (ids.length === 0)
|
|
64
92
|
return [];
|
|
65
93
|
const pages = await Promise.all(batched(ids, ITEM_LOOKUP_MAX_IDS).map((batch) => http.cmsGet('/items/lookup', { ids: batch.join(',') }, options)));
|
|
66
94
|
return pages.flatMap((page) => page.data);
|
|
67
95
|
},
|
|
96
|
+
/**
|
|
97
|
+
* Like `lookupContentItems`, but additionally returns the requested field
|
|
98
|
+
* values for each item. Useful when rendering reference field previews
|
|
99
|
+
* (e.g. show the title and featured image of every linked blog post).
|
|
100
|
+
*/
|
|
68
101
|
async lookupContentItemsWithFields(ids, fieldSlugs, options) {
|
|
69
102
|
if (ids.length === 0 || fieldSlugs.length === 0)
|
|
70
103
|
return [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"items.js","sourceRoot":"","sources":["../../src/content/items.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"items.js","sourceRoot":"","sources":["../../src/content/items.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,iBAAiB,CAAC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O,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAC9C,IAAI,CAAC,MAAM,CACT,2BAA2B,EAC3B,EAAE,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAC3D,OAAO,CACR,CACF,CACF,CAAC;YACF,OAAO,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC3D,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/content/resolve.js
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import { createContextAssetUrlResolver } from '../media/urls.js';
|
|
2
2
|
import { resolveContentFieldValues } from './asset-urls.js';
|
|
3
3
|
export function createResolveMethods(http, ctx) {
|
|
4
|
+
// Built once: ctx is fixed for the client's lifetime, matching how the media
|
|
5
|
+
// and seo modules construct theirs.
|
|
4
6
|
const resolve = createContextAssetUrlResolver(ctx);
|
|
5
7
|
return {
|
|
6
8
|
async resolvePath(path, locale, options) {
|
|
7
9
|
const params = { path };
|
|
8
10
|
if (locale)
|
|
9
11
|
params.locale = locale;
|
|
12
|
+
// The CMS wraps the payload in a `{ data }` envelope (like the other CMS
|
|
13
|
+
// endpoints); unwrap it so callers receive `ResolvedContent` directly.
|
|
10
14
|
const res = await http.cmsGet('/resolve', params, options);
|
|
11
15
|
const resolved = res.data;
|
|
16
|
+
// This is the documented entry point for rendering a CMS route, so its
|
|
17
|
+
// values are the ones most likely to hold asset references.
|
|
12
18
|
return resolved?.values
|
|
13
19
|
? { ...resolved, values: resolveContentFieldValues(resolved.values, resolve) }
|
|
14
20
|
: resolved;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../src/content/resolve.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AAEjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,MAAM,UAAU,oBAAoB,CAAC,IAAgB,EAAE,GAAiB;
|
|
1
|
+
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../src/content/resolve.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AAEjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,MAAM,UAAU,oBAAoB,CAAC,IAAgB,EAAE,GAAiB;IACtE,6EAA6E;IAC7E,oCAAoC;IACpC,MAAM,OAAO,GAAG,6BAA6B,CAAC,GAAG,CAAC,CAAC;IAEnD,OAAO;QACL,KAAK,CAAC,WAAW,CACf,IAAY,EACZ,MAAe,EACf,OAAwB;YAExB,MAAM,MAAM,GAA2B,EAAE,IAAI,EAAE,CAAC;YAChD,IAAI,MAAM;gBAAE,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;YACnC,yEAAyE;YACzE,uEAAuE;YACvE,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAA4B,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;YACtF,MAAM,QAAQ,GAAG,GAAG,CAAC,IAAI,CAAC;YAC1B,uEAAuE;YACvE,4DAA4D;YAC5D,OAAO,QAAQ,EAAE,MAAM;gBACrB,CAAC,CAAC,EAAE,GAAG,QAAQ,EAAE,MAAM,EAAE,yBAAyB,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE;gBAC9E,CAAC,CAAC,QAAQ,CAAC;QACf,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { HttpClient } from '../core/http.js';
|
|
2
2
|
import type { RequestOptions, SitemapEntry } from '../types.js';
|
|
3
3
|
export declare function createSitemapMethods(http: HttpClient): {
|
|
4
|
+
/**
|
|
5
|
+
* Fetch the CMS sitemap — every routable published item plus collection
|
|
6
|
+
* basePaths. Used by storefronts to generate `sitemap.xml` and pre-render
|
|
7
|
+
* routes at build time.
|
|
8
|
+
*/
|
|
4
9
|
getSitemap(languageCode?: string, options?: RequestOptions): Promise<SitemapEntry[]>;
|
|
5
10
|
};
|
|
6
11
|
//# sourceMappingURL=sitemap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sitemap.d.ts","sourceRoot":"","sources":["../../src/content/sitemap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAMhE,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,UAAU;
|
|
1
|
+
{"version":3,"file":"sitemap.d.ts","sourceRoot":"","sources":["../../src/content/sitemap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAMhE,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,UAAU;IAEjD;;;;OAIG;8BAC6B,MAAM,YAAY,cAAc,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;EAO7F"}
|
package/dist/content/sitemap.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
export function createSitemapMethods(http) {
|
|
2
2
|
return {
|
|
3
|
+
/**
|
|
4
|
+
* Fetch the CMS sitemap — every routable published item plus collection
|
|
5
|
+
* basePaths. Used by storefronts to generate `sitemap.xml` and pre-render
|
|
6
|
+
* routes at build time.
|
|
7
|
+
*/
|
|
3
8
|
async getSitemap(languageCode, options) {
|
|
4
9
|
const params = {};
|
|
5
10
|
if (languageCode)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sitemap.js","sourceRoot":"","sources":["../../src/content/sitemap.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,oBAAoB,CAAC,IAAgB;IACnD,OAAO;
|
|
1
|
+
{"version":3,"file":"sitemap.js","sourceRoot":"","sources":["../../src/content/sitemap.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,oBAAoB,CAAC,IAAgB;IACnD,OAAO;QACL;;;;WAIG;QACH,KAAK,CAAC,UAAU,CAAC,YAAqB,EAAE,OAAwB;YAC9D,MAAM,MAAM,GAA2B,EAAE,CAAC;YAC1C,IAAI,YAAY;gBAAE,MAAM,CAAC,aAAa,GAAG,YAAY,CAAC;YACtD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAkB,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;YACjF,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/core/context.js
CHANGED
|
@@ -17,6 +17,8 @@ export async function createStoreContext(config) {
|
|
|
17
17
|
const vendureUrl = (config.vendureUrl ?? DEFAULT_VENDURE_URL).replace(/\/+$/, '');
|
|
18
18
|
const cmsUrl = (config.cmsUrl ?? DEFAULT_CMS_URL).replace(/\/+$/, '');
|
|
19
19
|
const pluginsUrl = (config.pluginsUrl ?? DEFAULT_PLUGINS_URL).replace(/\/+$/, '');
|
|
20
|
+
// Single startup roundtrip — the CMS /channels/by-code/:code endpoint now
|
|
21
|
+
// also returns custom_fields (proxied from Vendure with a server-side cache).
|
|
20
22
|
const channel = await resolveChannel(cmsUrl, config.storeCode, fetchFn);
|
|
21
23
|
const rawCdnDomain = channel.customFields.cdnDomain;
|
|
22
24
|
const channelCdnDomain = typeof rawCdnDomain === 'string' && rawCdnDomain.trim() !== '' ? rawCdnDomain.trim() : null;
|
|
@@ -31,6 +33,8 @@ export async function createStoreContext(config) {
|
|
|
31
33
|
currencyCode: channel.defaultCurrencyCode,
|
|
32
34
|
pricesIncludeTax: channel.pricesIncludeTax,
|
|
33
35
|
authToken: null,
|
|
36
|
+
// `null`, not a default of CONSUMER: a client that never opted into scopes
|
|
37
|
+
// must send no header at all, so the engine keeps its legacy behaviour.
|
|
34
38
|
orderScope: config.orderScope ?? null,
|
|
35
39
|
fetch: fetchFn,
|
|
36
40
|
onAuthToken: config.onAuthToken,
|
|
@@ -63,6 +67,8 @@ async function resolveChannel(cmsUrl, storeCode, fetchFn) {
|
|
|
63
67
|
token: json.data.token,
|
|
64
68
|
defaultLanguageCode: json.data.default_language_code,
|
|
65
69
|
defaultCurrencyCode: json.data.default_currency_code,
|
|
70
|
+
// Older CMS deployments omit this field — default to false (tax-exclusive
|
|
71
|
+
// storage, Vendure's default) rather than guessing gross.
|
|
66
72
|
pricesIncludeTax: json.data.prices_include_tax === true,
|
|
67
73
|
customFields: json.data.custom_fields ?? {},
|
|
68
74
|
};
|
package/dist/core/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/core/context.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,MAA8B;IACrE,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;QACtB,MAAM,IAAI,eAAe,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC;IAC5D,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACnB,MAAM,IAAI,eAAe,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;IACzD,CAAC;IACD,IACE,MAAM,CAAC,SAAS,KAAK,SAAS;QAC9B,OAAO,MAAM,CAAC,SAAS,KAAK,SAAS;QACrC,OAAO,MAAM,CAAC,SAAS,KAAK,UAAU,EACt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AAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAUlC,CAAC;QAEF,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE;YAChB,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI;YACpB,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK;YACtB,mBAAmB,EAAE,IAAI,CAAC,IAAI,CAAC,qBAAqB;YACpD,mBAAmB,EAAE,IAAI,CAAC,IAAI,CAAC,qBAAqB;YACpD,0EAA0E;YAC1E,0DAA0D;YAC1D,gBAAgB,EAAE,IAAI,CAAC,IAAI,CAAC,kBAAkB,KAAK,IAAI;YACvD,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,EAAE;SAC5C,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,eAAe;YAAE,MAAM,KAAK,CAAC;QAClD,IAAK,KAAe,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;YAC3C,MAAM,IAAI,eAAe,CACvB,kCAAkC,MAAM,2BAA2B,EACnE,KAAK,CACN,CAAC;QACJ,CAAC;QACD,MAAM,IAAI,eAAe,CAAC,8BAA+B,KAAe,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,CAAC;IAC7F,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,SAAS,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC"}
|
package/dist/core/headers.js
CHANGED
|
@@ -10,6 +10,8 @@ export function buildVendureHeaders(ctx) {
|
|
|
10
10
|
if (ctx.authToken) {
|
|
11
11
|
headers.Authorization = `Bearer ${ctx.authToken}`;
|
|
12
12
|
}
|
|
13
|
+
// Only sent when a scope is actually configured. An absent header means
|
|
14
|
+
// "legacy" to the engine; an empty one would be a malformed scope.
|
|
13
15
|
if (ctx.orderScope) {
|
|
14
16
|
headers[ORDER_SCOPE_HEADER] = ctx.orderScope;
|
|
15
17
|
}
|
package/dist/core/headers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"headers.js","sourceRoot":"","sources":["../../src/core/headers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGrD,MAAM,UAAU,mBAAmB,CAAC,GAAiB;IACnD,MAAM,OAAO,GAA2B;QACtC,cAAc,EAAE,kBAAkB;QAClC,eAAe,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK;KACnC,CAAC;IACF,IAAI,GAAG,CAAC,YAAY,EAAE,CAAC;QACrB,OAAO,CAAC,YAAY,GAAG,GAAG,CAAC,YAAY,CAAC;IAC1C,CAAC;IACD,IAAI,GAAG,CAAC,SAAS,EAAE,CAAC;QAClB,OAAO,CAAC,aAAa,GAAG,UAAU,GAAG,CAAC,SAAS,EAAE,CAAC;IACpD,CAAC;
|
|
1
|
+
{"version":3,"file":"headers.js","sourceRoot":"","sources":["../../src/core/headers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGrD,MAAM,UAAU,mBAAmB,CAAC,GAAiB;IACnD,MAAM,OAAO,GAA2B;QACtC,cAAc,EAAE,kBAAkB;QAClC,eAAe,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK;KACnC,CAAC;IACF,IAAI,GAAG,CAAC,YAAY,EAAE,CAAC;QACrB,OAAO,CAAC,YAAY,GAAG,GAAG,CAAC,YAAY,CAAC;IAC1C,CAAC;IACD,IAAI,GAAG,CAAC,SAAS,EAAE,CAAC;QAClB,OAAO,CAAC,aAAa,GAAG,UAAU,GAAG,CAAC,SAAS,EAAE,CAAC;IACpD,CAAC;IACD,wEAAwE;IACxE,mEAAmE;IACnE,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC;QACnB,OAAO,CAAC,kBAAkB,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC;IAC/C,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,GAAiB;IAC/C,OAAO,EAAE,cAAc,EAAE,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,GAAiB;IACnD,OAAO;QACL,cAAc,EAAE,GAAG,CAAC,OAAO,CAAC,EAAE;QAC9B,eAAe,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK;KACnC,CAAC;AACJ,CAAC"}
|
package/dist/core/http.d.ts
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import type { StoreContext } from '../types.js';
|
|
2
|
+
/** Optional per-request controls. */
|
|
2
3
|
export interface RequestOptions {
|
|
4
|
+
/** External AbortSignal — cancels the request even before the internal timeout. */
|
|
3
5
|
signal?: AbortSignal;
|
|
6
|
+
/** Extra cache tags for this Vendure request — see `StorefrontClientConfig.cacheTags`. */
|
|
4
7
|
cacheTags?: readonly string[];
|
|
8
|
+
/**
|
|
9
|
+
* SDK-internal: the calling method and the tags it derives from its inputs.
|
|
10
|
+
* Only requests that carry this (or caller `cacheTags`) are tagged at all.
|
|
11
|
+
*/
|
|
5
12
|
cacheTagging?: {
|
|
6
13
|
readonly operation: string;
|
|
7
14
|
readonly tags: readonly string[];
|
|
8
15
|
};
|
|
9
16
|
}
|
|
17
|
+
/** Mark a request as a taggable catalogue read, keeping the caller's own options. */
|
|
10
18
|
export declare function tagRequest(options: RequestOptions | undefined, operation: string, tags?: readonly string[]): RequestOptions;
|
|
11
19
|
export interface HttpClient {
|
|
12
20
|
graphql<T = unknown>(query: string, variables?: Record<string, unknown>, options?: RequestOptions): Promise<T>;
|
package/dist/core/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/core/http.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAmB,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":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