@cimplify/sdk 0.52.2 → 0.54.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/dist/{ads-BxbWrwqp.d.mts → ads-C2c2Aald.d.mts} +1 -1
- package/dist/{ads-BxbWrwqp.d.ts → ads-C2c2Aald.d.ts} +1 -1
- package/dist/advanced.d.mts +3 -3
- package/dist/advanced.d.ts +3 -3
- package/dist/advanced.js +20 -20
- package/dist/advanced.mjs +1 -1
- package/dist/{chunk-R3F55BRN.mjs → chunk-3G4QCENX.mjs} +42 -22
- package/dist/{chunk-APHYBBDD.mjs → chunk-6QZQQRBB.mjs} +20 -9
- package/dist/{chunk-GLAVTDDE.mjs → chunk-B3Y4C4A7.mjs} +56 -53
- package/dist/{chunk-ROURLUXG.js → chunk-EJUKGJTZ.js} +4 -4
- package/dist/{chunk-Q5VGDCQF.js → chunk-HCZTBWU4.js} +42 -22
- package/dist/{chunk-EMS6DQIX.js → chunk-IJ32BXKZ.js} +54 -43
- package/dist/{chunk-VZS453ON.mjs → chunk-NEK7CVE2.mjs} +2 -2
- package/dist/{chunk-EQLT46ZR.js → chunk-YJLOOC3L.js} +56 -53
- package/dist/{client-C6J_RGlr.d.mts → client-306peWZ0.d.ts} +47 -29
- package/dist/{client-CX7IFIkL.d.ts → client-Bj2apl_y.d.mts} +47 -29
- package/dist/{client-Lt7uGLmT.d.ts → client-C2bKMy5g.d.ts} +2 -2
- package/dist/{client-DdefKjcs.d.mts → client-D1Gknspz.d.mts} +2 -2
- package/dist/{index-Bo0NjgR6.d.mts → index-D8vnKlOQ.d.mts} +4 -4
- package/dist/{index-BAohYhdg.d.ts → index-DIIlPUOC.d.ts} +4 -4
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +61 -61
- package/dist/index.mjs +2 -2
- package/dist/mock/cli.mjs +42 -22
- package/dist/mock/library.js +42 -22
- package/dist/mock/library.mjs +42 -22
- package/dist/mock/msw.js +42 -22
- package/dist/mock/msw.mjs +42 -22
- package/dist/{payment-_e99nSRj.d.ts → payment-DVS7ZUEp.d.mts} +2 -2
- package/dist/{payment-9L_-GWqQ.d.mts → payment-sn-yGL7v.d.ts} +2 -2
- package/dist/{price-BjehlIhG.d.mts → price-9T1Y47oS.d.ts} +2 -2
- package/dist/{price-CWQ5TQmk.d.ts → price-Cm0tU0V5.d.mts} +2 -2
- package/dist/{product-C-xLzh7Q.d.ts → product-B_kS4Oxa.d.mts} +1 -1
- package/dist/{product-C-xLzh7Q.d.mts → product-B_kS4Oxa.d.ts} +1 -1
- package/dist/react.d.mts +6 -6
- package/dist/react.d.ts +6 -6
- package/dist/react.js +16 -16
- package/dist/react.mjs +2 -2
- package/dist/{server-72rzvJ4Y.d.ts → server-BQzz921M.d.ts} +1 -1
- package/dist/{server-BgccqOLT.d.mts → server-D8rwqZQ6.d.mts} +1 -1
- package/dist/server.d.mts +39 -47
- package/dist/server.d.ts +39 -47
- package/dist/server.js +3 -89
- package/dist/server.mjs +3 -88
- package/dist/testing/msw.d.mts +2 -2
- package/dist/testing/msw.d.ts +2 -2
- package/dist/testing/msw.js +2 -2
- package/dist/testing/msw.mjs +1 -1
- package/dist/testing/suite.d.mts +6 -6
- package/dist/testing/suite.d.ts +6 -6
- package/dist/testing/suite.js +23 -23
- package/dist/testing/suite.mjs +4 -4
- package/dist/testing.d.mts +5 -5
- package/dist/testing.d.ts +5 -5
- package/dist/testing.js +79 -79
- package/dist/testing.mjs +5 -5
- package/dist/utils.d.mts +4 -4
- package/dist/utils.d.ts +4 -4
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var chunkMN4PNKJA_js = require('./chunk-MN4PNKJA.js');
|
|
5
|
-
var
|
|
6
|
-
var
|
|
5
|
+
var chunkIJ32BXKZ_js = require('./chunk-IJ32BXKZ.js');
|
|
6
|
+
var chunkYJLOOC3L_js = require('./chunk-YJLOOC3L.js');
|
|
7
7
|
var chunk7Y2O3E4D_js = require('./chunk-7Y2O3E4D.js');
|
|
8
8
|
var chunkXA3ZNR75_js = require('./chunk-XA3ZNR75.js');
|
|
9
9
|
require('./chunk-OWW5GUSB.js');
|
|
@@ -1085,7 +1085,7 @@ var DEFAULT_COUNTRY = "US";
|
|
|
1085
1085
|
function createDefaultClient() {
|
|
1086
1086
|
const processRef = globalThis.process;
|
|
1087
1087
|
const envPublicKey = processRef?.env?.NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY || "";
|
|
1088
|
-
return
|
|
1088
|
+
return chunkIJ32BXKZ_js.createCimplifyClient({ publicKey: envPublicKey });
|
|
1089
1089
|
}
|
|
1090
1090
|
function getStoredLocationId() {
|
|
1091
1091
|
if (typeof window === "undefined" || !window.localStorage) {
|
|
@@ -3520,19 +3520,19 @@ function AuthElement({
|
|
|
3520
3520
|
}, [onReady, onAuthenticated, onRequiresOtp, onError]);
|
|
3521
3521
|
React10.useEffect(() => {
|
|
3522
3522
|
if (!elements || !containerRef.current) return;
|
|
3523
|
-
const element = elements.create(
|
|
3523
|
+
const element = elements.create(chunkYJLOOC3L_js.ELEMENT_TYPES.AUTH, { prefillEmail });
|
|
3524
3524
|
elementRef.current = element;
|
|
3525
|
-
element.on(
|
|
3525
|
+
element.on(chunkYJLOOC3L_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
|
|
3526
3526
|
element.on(
|
|
3527
|
-
|
|
3527
|
+
chunkYJLOOC3L_js.EVENT_TYPES.AUTHENTICATED,
|
|
3528
3528
|
(data) => onAuthenticatedRef.current?.(data)
|
|
3529
3529
|
);
|
|
3530
3530
|
element.on(
|
|
3531
|
-
|
|
3531
|
+
chunkYJLOOC3L_js.EVENT_TYPES.REQUIRES_OTP,
|
|
3532
3532
|
(data) => onRequiresOtpRef.current?.(data)
|
|
3533
3533
|
);
|
|
3534
3534
|
element.on(
|
|
3535
|
-
|
|
3535
|
+
chunkYJLOOC3L_js.EVENT_TYPES.ERROR,
|
|
3536
3536
|
(data) => onErrorRef.current?.(data)
|
|
3537
3537
|
);
|
|
3538
3538
|
element.mount(containerRef.current);
|
|
@@ -3561,15 +3561,15 @@ function AddressElement({
|
|
|
3561
3561
|
}, [onReady, onChange, onError]);
|
|
3562
3562
|
React10.useEffect(() => {
|
|
3563
3563
|
if (!elements || !containerRef.current) return;
|
|
3564
|
-
const element = elements.create(
|
|
3564
|
+
const element = elements.create(chunkYJLOOC3L_js.ELEMENT_TYPES.ADDRESS, { mode });
|
|
3565
3565
|
elementRef.current = element;
|
|
3566
|
-
element.on(
|
|
3566
|
+
element.on(chunkYJLOOC3L_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
|
|
3567
3567
|
element.on(
|
|
3568
|
-
|
|
3568
|
+
chunkYJLOOC3L_js.EVENT_TYPES.CHANGE,
|
|
3569
3569
|
(data) => onChangeRef.current?.(data)
|
|
3570
3570
|
);
|
|
3571
3571
|
element.on(
|
|
3572
|
-
|
|
3572
|
+
chunkYJLOOC3L_js.EVENT_TYPES.ERROR,
|
|
3573
3573
|
(data) => onErrorRef.current?.(data)
|
|
3574
3574
|
);
|
|
3575
3575
|
element.mount(containerRef.current);
|
|
@@ -3599,15 +3599,15 @@ function PaymentElement({
|
|
|
3599
3599
|
}, [onReady, onChange, onError]);
|
|
3600
3600
|
React10.useEffect(() => {
|
|
3601
3601
|
if (!elements || !containerRef.current) return;
|
|
3602
|
-
const element = elements.create(
|
|
3602
|
+
const element = elements.create(chunkYJLOOC3L_js.ELEMENT_TYPES.PAYMENT, { amount, currency });
|
|
3603
3603
|
elementRef.current = element;
|
|
3604
|
-
element.on(
|
|
3604
|
+
element.on(chunkYJLOOC3L_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
|
|
3605
3605
|
element.on(
|
|
3606
|
-
|
|
3606
|
+
chunkYJLOOC3L_js.EVENT_TYPES.CHANGE,
|
|
3607
3607
|
(data) => onChangeRef.current?.(data)
|
|
3608
3608
|
);
|
|
3609
3609
|
element.on(
|
|
3610
|
-
|
|
3610
|
+
chunkYJLOOC3L_js.EVENT_TYPES.ERROR,
|
|
3611
3611
|
(data) => onErrorRef.current?.(data)
|
|
3612
3612
|
);
|
|
3613
3613
|
element.mount(containerRef.current);
|
package/dist/react.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { DURATION_UNIT, getVariantDisplayName, INPUT_FIELD_TYPE, PRODUCT_TYPE, RENDER_HINT } from './chunk-NRDRVZ62.mjs';
|
|
3
3
|
export { getVariantDisplayName } from './chunk-NRDRVZ62.mjs';
|
|
4
|
-
import { createCimplifyClient } from './chunk-
|
|
5
|
-
import { ELEMENT_TYPES, EVENT_TYPES } from './chunk-
|
|
4
|
+
import { createCimplifyClient } from './chunk-6QZQQRBB.mjs';
|
|
5
|
+
import { ELEMENT_TYPES, EVENT_TYPES } from './chunk-B3Y4C4A7.mjs';
|
|
6
6
|
import { formatPrice, parsePrice, getUnitPriceAtQuantity, isOnSale, getDiscountPercentage, getBasePrice, getPriceRange, formatPriceRange } from './chunk-TD3AY34U.mjs';
|
|
7
7
|
import { isSupportedCurrency } from './chunk-AMZXALF6.mjs';
|
|
8
8
|
import './chunk-3G6RQLXK.mjs';
|
package/dist/server.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
import './payment-
|
|
1
|
+
import { ac as CimplifyClient } from './client-Bj2apl_y.mjs';
|
|
2
|
+
export { J as CacheOptions, c7 as ReadRequestOptions, ct as Result } from './client-Bj2apl_y.mjs';
|
|
3
|
+
export { Q as Category, T as CimplifyError, U as Collection, aX as Product, b9 as ProductWithDetails } from './product-B_kS4Oxa.mjs';
|
|
4
|
+
import './payment-DVS7ZUEp.mjs';
|
|
5
5
|
|
|
6
6
|
interface ServerClientOptions {
|
|
7
7
|
/**
|
|
@@ -27,9 +27,17 @@ interface ServerClientOptions {
|
|
|
27
27
|
*
|
|
28
28
|
* The returned client is the exact same surface the browser uses — every
|
|
29
29
|
* resource (catalogue, cart, checkout, …) and every method works identically.
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
30
|
+
*
|
|
31
|
+
* Caching is Next.js's responsibility. Pass `cacheOptions` per read method
|
|
32
|
+
* (`{ revalidate, tags }`); the SDK forwards them as `next: { revalidate, tags }`
|
|
33
|
+
* on the underlying fetch — Next 16's documented ISR API. Invalidate via the
|
|
34
|
+
* `revalidate*` helpers (also exported from this entry) or the bare
|
|
35
|
+
* `revalidateTag` / `revalidatePath` from `next/cache`.
|
|
36
|
+
*
|
|
37
|
+
* If you have `cacheComponents: true` in `next.config.ts` (Next 16 PPR-style
|
|
38
|
+
* caching), the `'use cache'` + `cacheTag` / `cacheLife` directives work too —
|
|
39
|
+
* but they require a Node-compatible runtime and won't function on Cloudflare
|
|
40
|
+
* Workers. For Workers / WfP storefronts, stay on the ISR (`cacheOptions`) path.
|
|
33
41
|
*
|
|
34
42
|
* Errors continue to flow through `Result<T, CimplifyError>`. Use the SDK's
|
|
35
43
|
* `unwrap()` helper, or `if (!result.ok) notFound()` — whichever is
|
|
@@ -37,13 +45,13 @@ interface ServerClientOptions {
|
|
|
37
45
|
*
|
|
38
46
|
* @example
|
|
39
47
|
* import { getServerClient, tags } from "@cimplify/sdk/server";
|
|
40
|
-
*
|
|
48
|
+
*
|
|
49
|
+
* export const revalidate = 3600;
|
|
41
50
|
*
|
|
42
51
|
* async function getProduct(slug: string) {
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* const r = await getServerClient().catalogue.getProductBySlug(slug);
|
|
52
|
+
* const r = await getServerClient().catalogue.getProductBySlug(slug, {
|
|
53
|
+
* cacheOptions: { revalidate: 3600, tags: [tags.product(slug)] },
|
|
54
|
+
* });
|
|
47
55
|
* if (!r.ok) throw new Error(r.error.message);
|
|
48
56
|
* return r.value;
|
|
49
57
|
* }
|
|
@@ -137,26 +145,26 @@ type CacheLifeDefault = typeof CACHE_LIFE_DEFAULT;
|
|
|
137
145
|
type CacheLifeProbe = typeof CACHE_LIFE_PROBE;
|
|
138
146
|
|
|
139
147
|
/** Next 16 cacheLife profile — a built-in name (`'max'`/`'hours'`/…) or `{expire: secs}`. */
|
|
140
|
-
type RevalidateProfile
|
|
148
|
+
type RevalidateProfile = string | {
|
|
141
149
|
expire: number;
|
|
142
150
|
};
|
|
143
|
-
declare function revalidateProducts(profile?: RevalidateProfile
|
|
144
|
-
declare function revalidateProduct(id: string, profile?: RevalidateProfile
|
|
145
|
-
declare function revalidateCategories(profile?: RevalidateProfile
|
|
146
|
-
declare function revalidateCategory(id: string, profile?: RevalidateProfile
|
|
147
|
-
declare function revalidateCollections(profile?: RevalidateProfile
|
|
148
|
-
declare function revalidateCollection(id: string, profile?: RevalidateProfile
|
|
149
|
-
declare function revalidateBusiness(profile?: RevalidateProfile
|
|
150
|
-
declare function revalidateBrand(profile?: RevalidateProfile
|
|
151
|
-
declare function revalidateLocations(profile?: RevalidateProfile
|
|
152
|
-
declare function revalidateLocation(id: string, profile?: RevalidateProfile
|
|
153
|
-
declare function revalidatePricing(profile?: RevalidateProfile
|
|
154
|
-
declare function revalidateAddOns(profile?: RevalidateProfile
|
|
155
|
-
declare function revalidateAddOn(id: string, profile?: RevalidateProfile
|
|
156
|
-
declare function revalidateSubscriptions(profile?: RevalidateProfile
|
|
157
|
-
declare function revalidateSubscription(id: string, profile?: RevalidateProfile
|
|
158
|
-
declare function revalidateStock(productId?: string, profile?: RevalidateProfile
|
|
159
|
-
declare function revalidateByTag(tag: string, profile?: RevalidateProfile
|
|
151
|
+
declare function revalidateProducts(profile?: RevalidateProfile): Promise<void>;
|
|
152
|
+
declare function revalidateProduct(id: string, profile?: RevalidateProfile): Promise<void>;
|
|
153
|
+
declare function revalidateCategories(profile?: RevalidateProfile): Promise<void>;
|
|
154
|
+
declare function revalidateCategory(id: string, profile?: RevalidateProfile): Promise<void>;
|
|
155
|
+
declare function revalidateCollections(profile?: RevalidateProfile): Promise<void>;
|
|
156
|
+
declare function revalidateCollection(id: string, profile?: RevalidateProfile): Promise<void>;
|
|
157
|
+
declare function revalidateBusiness(profile?: RevalidateProfile): Promise<void>;
|
|
158
|
+
declare function revalidateBrand(profile?: RevalidateProfile): Promise<void>;
|
|
159
|
+
declare function revalidateLocations(profile?: RevalidateProfile): Promise<void>;
|
|
160
|
+
declare function revalidateLocation(id: string, profile?: RevalidateProfile): Promise<void>;
|
|
161
|
+
declare function revalidatePricing(profile?: RevalidateProfile): Promise<void>;
|
|
162
|
+
declare function revalidateAddOns(profile?: RevalidateProfile): Promise<void>;
|
|
163
|
+
declare function revalidateAddOn(id: string, profile?: RevalidateProfile): Promise<void>;
|
|
164
|
+
declare function revalidateSubscriptions(profile?: RevalidateProfile): Promise<void>;
|
|
165
|
+
declare function revalidateSubscription(id: string, profile?: RevalidateProfile): Promise<void>;
|
|
166
|
+
declare function revalidateStock(productId?: string, profile?: RevalidateProfile): Promise<void>;
|
|
167
|
+
declare function revalidateByTag(tag: string, profile?: RevalidateProfile): Promise<void>;
|
|
160
168
|
|
|
161
169
|
declare function updateProducts(): Promise<void>;
|
|
162
170
|
declare function updateProduct(id: string): Promise<void>;
|
|
@@ -177,20 +185,4 @@ declare function updateStock(productId?: string): Promise<void>;
|
|
|
177
185
|
declare function updateByTag(tag: string): Promise<void>;
|
|
178
186
|
declare function refreshPage(): Promise<void>;
|
|
179
187
|
|
|
180
|
-
|
|
181
|
-
type RevalidateProfile = string | {
|
|
182
|
-
expire: number;
|
|
183
|
-
};
|
|
184
|
-
interface RevalidateRouteOptions {
|
|
185
|
-
/** Defaults to `process.env.CIMPLIFY_REVALIDATE_SECRET`. */
|
|
186
|
-
secret?: string;
|
|
187
|
-
/** Defaults to a lazy import of `next/cache.revalidateTag`. Override for tests. */
|
|
188
|
-
revalidateTag?: (tag: string, profile: RevalidateProfile) => void;
|
|
189
|
-
/** Defaults to `Date.now`. Override for tests. */
|
|
190
|
-
now?: () => number;
|
|
191
|
-
/** Profile used when the request body doesn't include one. Defaults to `'max'`. */
|
|
192
|
-
defaultProfile?: RevalidateProfile;
|
|
193
|
-
}
|
|
194
|
-
declare function revalidateRouteHandler(req: Request, options?: RevalidateRouteOptions): Promise<Response>;
|
|
195
|
-
|
|
196
|
-
export { CACHE_LIFE_DEFAULT, CACHE_LIFE_PROBE, type CacheLifeDefault, type CacheLifeProbe, CimplifyClient, type RevalidateProfile$1 as RevalidateProfile, type RevalidateRouteOptions, type RevalidateProfile as RevalidateRouteProfile, type ServerClientOptions, getServerClient, refreshPage, revalidateAddOn, revalidateAddOns, revalidateBrand, revalidateBusiness, revalidateByTag, revalidateCategories, revalidateCategory, revalidateCollection, revalidateCollections, revalidateLocation, revalidateLocations, revalidatePricing, revalidateProduct, revalidateProducts, revalidateRouteHandler, revalidateStock, revalidateSubscription, revalidateSubscriptions, tags, updateAddOn, updateAddOns, updateBrand, updateBusiness, updateByTag, updateCategories, updateCategory, updateCollection, updateCollections, updateLocation, updateLocations, updatePricing, updateProduct, updateProducts, updateStock, updateSubscription, updateSubscriptions };
|
|
188
|
+
export { CACHE_LIFE_DEFAULT, CACHE_LIFE_PROBE, type CacheLifeDefault, type CacheLifeProbe, CimplifyClient, type RevalidateProfile, type ServerClientOptions, getServerClient, refreshPage, revalidateAddOn, revalidateAddOns, revalidateBrand, revalidateBusiness, revalidateByTag, revalidateCategories, revalidateCategory, revalidateCollection, revalidateCollections, revalidateLocation, revalidateLocations, revalidatePricing, revalidateProduct, revalidateProducts, revalidateStock, revalidateSubscription, revalidateSubscriptions, tags, updateAddOn, updateAddOns, updateBrand, updateBusiness, updateByTag, updateCategories, updateCategory, updateCollection, updateCollections, updateLocation, updateLocations, updatePricing, updateProduct, updateProducts, updateStock, updateSubscription, updateSubscriptions };
|
package/dist/server.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
import './payment-
|
|
1
|
+
import { ac as CimplifyClient } from './client-306peWZ0.js';
|
|
2
|
+
export { J as CacheOptions, c7 as ReadRequestOptions, ct as Result } from './client-306peWZ0.js';
|
|
3
|
+
export { Q as Category, T as CimplifyError, U as Collection, aX as Product, b9 as ProductWithDetails } from './product-B_kS4Oxa.js';
|
|
4
|
+
import './payment-sn-yGL7v.js';
|
|
5
5
|
|
|
6
6
|
interface ServerClientOptions {
|
|
7
7
|
/**
|
|
@@ -27,9 +27,17 @@ interface ServerClientOptions {
|
|
|
27
27
|
*
|
|
28
28
|
* The returned client is the exact same surface the browser uses — every
|
|
29
29
|
* resource (catalogue, cart, checkout, …) and every method works identically.
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
30
|
+
*
|
|
31
|
+
* Caching is Next.js's responsibility. Pass `cacheOptions` per read method
|
|
32
|
+
* (`{ revalidate, tags }`); the SDK forwards them as `next: { revalidate, tags }`
|
|
33
|
+
* on the underlying fetch — Next 16's documented ISR API. Invalidate via the
|
|
34
|
+
* `revalidate*` helpers (also exported from this entry) or the bare
|
|
35
|
+
* `revalidateTag` / `revalidatePath` from `next/cache`.
|
|
36
|
+
*
|
|
37
|
+
* If you have `cacheComponents: true` in `next.config.ts` (Next 16 PPR-style
|
|
38
|
+
* caching), the `'use cache'` + `cacheTag` / `cacheLife` directives work too —
|
|
39
|
+
* but they require a Node-compatible runtime and won't function on Cloudflare
|
|
40
|
+
* Workers. For Workers / WfP storefronts, stay on the ISR (`cacheOptions`) path.
|
|
33
41
|
*
|
|
34
42
|
* Errors continue to flow through `Result<T, CimplifyError>`. Use the SDK's
|
|
35
43
|
* `unwrap()` helper, or `if (!result.ok) notFound()` — whichever is
|
|
@@ -37,13 +45,13 @@ interface ServerClientOptions {
|
|
|
37
45
|
*
|
|
38
46
|
* @example
|
|
39
47
|
* import { getServerClient, tags } from "@cimplify/sdk/server";
|
|
40
|
-
*
|
|
48
|
+
*
|
|
49
|
+
* export const revalidate = 3600;
|
|
41
50
|
*
|
|
42
51
|
* async function getProduct(slug: string) {
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* const r = await getServerClient().catalogue.getProductBySlug(slug);
|
|
52
|
+
* const r = await getServerClient().catalogue.getProductBySlug(slug, {
|
|
53
|
+
* cacheOptions: { revalidate: 3600, tags: [tags.product(slug)] },
|
|
54
|
+
* });
|
|
47
55
|
* if (!r.ok) throw new Error(r.error.message);
|
|
48
56
|
* return r.value;
|
|
49
57
|
* }
|
|
@@ -137,26 +145,26 @@ type CacheLifeDefault = typeof CACHE_LIFE_DEFAULT;
|
|
|
137
145
|
type CacheLifeProbe = typeof CACHE_LIFE_PROBE;
|
|
138
146
|
|
|
139
147
|
/** Next 16 cacheLife profile — a built-in name (`'max'`/`'hours'`/…) or `{expire: secs}`. */
|
|
140
|
-
type RevalidateProfile
|
|
148
|
+
type RevalidateProfile = string | {
|
|
141
149
|
expire: number;
|
|
142
150
|
};
|
|
143
|
-
declare function revalidateProducts(profile?: RevalidateProfile
|
|
144
|
-
declare function revalidateProduct(id: string, profile?: RevalidateProfile
|
|
145
|
-
declare function revalidateCategories(profile?: RevalidateProfile
|
|
146
|
-
declare function revalidateCategory(id: string, profile?: RevalidateProfile
|
|
147
|
-
declare function revalidateCollections(profile?: RevalidateProfile
|
|
148
|
-
declare function revalidateCollection(id: string, profile?: RevalidateProfile
|
|
149
|
-
declare function revalidateBusiness(profile?: RevalidateProfile
|
|
150
|
-
declare function revalidateBrand(profile?: RevalidateProfile
|
|
151
|
-
declare function revalidateLocations(profile?: RevalidateProfile
|
|
152
|
-
declare function revalidateLocation(id: string, profile?: RevalidateProfile
|
|
153
|
-
declare function revalidatePricing(profile?: RevalidateProfile
|
|
154
|
-
declare function revalidateAddOns(profile?: RevalidateProfile
|
|
155
|
-
declare function revalidateAddOn(id: string, profile?: RevalidateProfile
|
|
156
|
-
declare function revalidateSubscriptions(profile?: RevalidateProfile
|
|
157
|
-
declare function revalidateSubscription(id: string, profile?: RevalidateProfile
|
|
158
|
-
declare function revalidateStock(productId?: string, profile?: RevalidateProfile
|
|
159
|
-
declare function revalidateByTag(tag: string, profile?: RevalidateProfile
|
|
151
|
+
declare function revalidateProducts(profile?: RevalidateProfile): Promise<void>;
|
|
152
|
+
declare function revalidateProduct(id: string, profile?: RevalidateProfile): Promise<void>;
|
|
153
|
+
declare function revalidateCategories(profile?: RevalidateProfile): Promise<void>;
|
|
154
|
+
declare function revalidateCategory(id: string, profile?: RevalidateProfile): Promise<void>;
|
|
155
|
+
declare function revalidateCollections(profile?: RevalidateProfile): Promise<void>;
|
|
156
|
+
declare function revalidateCollection(id: string, profile?: RevalidateProfile): Promise<void>;
|
|
157
|
+
declare function revalidateBusiness(profile?: RevalidateProfile): Promise<void>;
|
|
158
|
+
declare function revalidateBrand(profile?: RevalidateProfile): Promise<void>;
|
|
159
|
+
declare function revalidateLocations(profile?: RevalidateProfile): Promise<void>;
|
|
160
|
+
declare function revalidateLocation(id: string, profile?: RevalidateProfile): Promise<void>;
|
|
161
|
+
declare function revalidatePricing(profile?: RevalidateProfile): Promise<void>;
|
|
162
|
+
declare function revalidateAddOns(profile?: RevalidateProfile): Promise<void>;
|
|
163
|
+
declare function revalidateAddOn(id: string, profile?: RevalidateProfile): Promise<void>;
|
|
164
|
+
declare function revalidateSubscriptions(profile?: RevalidateProfile): Promise<void>;
|
|
165
|
+
declare function revalidateSubscription(id: string, profile?: RevalidateProfile): Promise<void>;
|
|
166
|
+
declare function revalidateStock(productId?: string, profile?: RevalidateProfile): Promise<void>;
|
|
167
|
+
declare function revalidateByTag(tag: string, profile?: RevalidateProfile): Promise<void>;
|
|
160
168
|
|
|
161
169
|
declare function updateProducts(): Promise<void>;
|
|
162
170
|
declare function updateProduct(id: string): Promise<void>;
|
|
@@ -177,20 +185,4 @@ declare function updateStock(productId?: string): Promise<void>;
|
|
|
177
185
|
declare function updateByTag(tag: string): Promise<void>;
|
|
178
186
|
declare function refreshPage(): Promise<void>;
|
|
179
187
|
|
|
180
|
-
|
|
181
|
-
type RevalidateProfile = string | {
|
|
182
|
-
expire: number;
|
|
183
|
-
};
|
|
184
|
-
interface RevalidateRouteOptions {
|
|
185
|
-
/** Defaults to `process.env.CIMPLIFY_REVALIDATE_SECRET`. */
|
|
186
|
-
secret?: string;
|
|
187
|
-
/** Defaults to a lazy import of `next/cache.revalidateTag`. Override for tests. */
|
|
188
|
-
revalidateTag?: (tag: string, profile: RevalidateProfile) => void;
|
|
189
|
-
/** Defaults to `Date.now`. Override for tests. */
|
|
190
|
-
now?: () => number;
|
|
191
|
-
/** Profile used when the request body doesn't include one. Defaults to `'max'`. */
|
|
192
|
-
defaultProfile?: RevalidateProfile;
|
|
193
|
-
}
|
|
194
|
-
declare function revalidateRouteHandler(req: Request, options?: RevalidateRouteOptions): Promise<Response>;
|
|
195
|
-
|
|
196
|
-
export { CACHE_LIFE_DEFAULT, CACHE_LIFE_PROBE, type CacheLifeDefault, type CacheLifeProbe, CimplifyClient, type RevalidateProfile$1 as RevalidateProfile, type RevalidateRouteOptions, type RevalidateProfile as RevalidateRouteProfile, type ServerClientOptions, getServerClient, refreshPage, revalidateAddOn, revalidateAddOns, revalidateBrand, revalidateBusiness, revalidateByTag, revalidateCategories, revalidateCategory, revalidateCollection, revalidateCollections, revalidateLocation, revalidateLocations, revalidatePricing, revalidateProduct, revalidateProducts, revalidateRouteHandler, revalidateStock, revalidateSubscription, revalidateSubscriptions, tags, updateAddOn, updateAddOns, updateBrand, updateBusiness, updateByTag, updateCategories, updateCategory, updateCollection, updateCollections, updateLocation, updateLocations, updatePricing, updateProduct, updateProducts, updateStock, updateSubscription, updateSubscriptions };
|
|
188
|
+
export { CACHE_LIFE_DEFAULT, CACHE_LIFE_PROBE, type CacheLifeDefault, type CacheLifeProbe, CimplifyClient, type RevalidateProfile, type ServerClientOptions, getServerClient, refreshPage, revalidateAddOn, revalidateAddOns, revalidateBrand, revalidateBusiness, revalidateByTag, revalidateCategories, revalidateCategory, revalidateCollection, revalidateCollections, revalidateLocation, revalidateLocations, revalidatePricing, revalidateProduct, revalidateProducts, revalidateStock, revalidateSubscription, revalidateSubscriptions, tags, updateAddOn, updateAddOns, updateBrand, updateBusiness, updateByTag, updateCategories, updateCategory, updateCollection, updateCollections, updateLocation, updateLocations, updatePricing, updateProduct, updateProducts, updateStock, updateSubscription, updateSubscriptions };
|
package/dist/server.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var chunkIJ32BXKZ_js = require('./chunk-IJ32BXKZ.js');
|
|
4
|
+
require('./chunk-YJLOOC3L.js');
|
|
5
5
|
require('./chunk-7Y2O3E4D.js');
|
|
6
6
|
var chunkXA3ZNR75_js = require('./chunk-XA3ZNR75.js');
|
|
7
7
|
require('./chunk-OWW5GUSB.js');
|
|
@@ -25,7 +25,7 @@ function readEnv(...keys) {
|
|
|
25
25
|
var getServerClient = react.cache((opts = {}) => {
|
|
26
26
|
const baseUrl = opts.apiUrl ?? readEnv("CIMPLIFY_API_URL", "NEXT_PUBLIC_CIMPLIFY_API_URL") ?? defaultBaseUrl();
|
|
27
27
|
const publicKey = opts.secretKey ?? readEnv("CIMPLIFY_SECRET_KEY", "NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY") ?? "mock-dev";
|
|
28
|
-
const client =
|
|
28
|
+
const client = chunkIJ32BXKZ_js.createCimplifyClient({
|
|
29
29
|
baseUrl,
|
|
30
30
|
publicKey,
|
|
31
31
|
suppressPublicKeyWarning: true
|
|
@@ -234,91 +234,6 @@ async function refreshPage() {
|
|
|
234
234
|
fn();
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
// src/server/revalidate-route.ts
|
|
238
|
-
var TIMESTAMP_HEADER = "x-cimplify-timestamp";
|
|
239
|
-
var SIGNATURE_HEADER = "x-cimplify-signature";
|
|
240
|
-
var SIGNATURE_PREFIX = "sha256=";
|
|
241
|
-
var MAX_SKEW_MS = 5 * 60 * 1e3;
|
|
242
|
-
var SECRET_ENV = "CIMPLIFY_REVALIDATE_SECRET";
|
|
243
|
-
var DEFAULT_PROFILE2 = CACHE_LIFE_DEFAULT;
|
|
244
|
-
async function revalidateRouteHandler(req, options = {}) {
|
|
245
|
-
const secret = options.secret ?? envSecret();
|
|
246
|
-
if (!secret) return text(`revalidate disabled: ${SECRET_ENV} not set`, 500);
|
|
247
|
-
const timestamp = req.headers.get(TIMESTAMP_HEADER);
|
|
248
|
-
const signature = req.headers.get(SIGNATURE_HEADER);
|
|
249
|
-
if (!timestamp || !signature) return text("missing auth headers", 401);
|
|
250
|
-
const ts = Number.parseInt(timestamp, 10);
|
|
251
|
-
const now = options.now ?? Date.now;
|
|
252
|
-
if (!Number.isFinite(ts) || Math.abs(now() - ts) > MAX_SKEW_MS) {
|
|
253
|
-
return text("stale or invalid timestamp", 401);
|
|
254
|
-
}
|
|
255
|
-
const body = await req.text();
|
|
256
|
-
if (!await verifyHmac(secret, `${timestamp}.${body}`, signature)) {
|
|
257
|
-
return text("invalid signature", 401);
|
|
258
|
-
}
|
|
259
|
-
let parsed;
|
|
260
|
-
try {
|
|
261
|
-
parsed = JSON.parse(body);
|
|
262
|
-
} catch {
|
|
263
|
-
return text("invalid json", 400);
|
|
264
|
-
}
|
|
265
|
-
const tags2 = Array.isArray(parsed.tags) ? parsed.tags.filter((t) => typeof t === "string" && t.length > 0) : [];
|
|
266
|
-
if (tags2.length === 0) return text("no tags", 400);
|
|
267
|
-
const profile = parseProfile(parsed.profile) ?? options.defaultProfile ?? DEFAULT_PROFILE2;
|
|
268
|
-
const revalidate2 = options.revalidateTag ?? await loadRevalidateTag();
|
|
269
|
-
for (const tag of tags2) revalidate2(tag, profile);
|
|
270
|
-
return Response.json({ ok: true, revalidated: tags2.length, profile });
|
|
271
|
-
}
|
|
272
|
-
function parseProfile(raw) {
|
|
273
|
-
if (typeof raw === "string" && raw.length > 0) return raw;
|
|
274
|
-
if (raw && typeof raw === "object" && "expire" in raw && typeof raw.expire === "number") {
|
|
275
|
-
return { expire: raw.expire };
|
|
276
|
-
}
|
|
277
|
-
return void 0;
|
|
278
|
-
}
|
|
279
|
-
var cachedRevalidateTag = null;
|
|
280
|
-
async function loadRevalidateTag() {
|
|
281
|
-
if (cachedRevalidateTag) return cachedRevalidateTag;
|
|
282
|
-
const specifier = "next/cache";
|
|
283
|
-
const mod = await import(
|
|
284
|
-
/* webpackIgnore: true */
|
|
285
|
-
/* @vite-ignore */
|
|
286
|
-
specifier
|
|
287
|
-
);
|
|
288
|
-
cachedRevalidateTag = mod.revalidateTag;
|
|
289
|
-
return cachedRevalidateTag;
|
|
290
|
-
}
|
|
291
|
-
async function verifyHmac(secret, payload, signatureHeader) {
|
|
292
|
-
if (!signatureHeader.startsWith(SIGNATURE_PREFIX)) return false;
|
|
293
|
-
const providedBytes = hexToBytes(signatureHeader.slice(SIGNATURE_PREFIX.length));
|
|
294
|
-
if (!providedBytes) return false;
|
|
295
|
-
const enc = new TextEncoder();
|
|
296
|
-
const key = await crypto.subtle.importKey(
|
|
297
|
-
"raw",
|
|
298
|
-
enc.encode(secret),
|
|
299
|
-
{ name: "HMAC", hash: "SHA-256" },
|
|
300
|
-
false,
|
|
301
|
-
["verify"]
|
|
302
|
-
);
|
|
303
|
-
return crypto.subtle.verify("HMAC", key, providedBytes, enc.encode(payload));
|
|
304
|
-
}
|
|
305
|
-
function hexToBytes(hex) {
|
|
306
|
-
if (hex.length % 2 !== 0 || !/^[0-9a-f]+$/i.test(hex)) return null;
|
|
307
|
-
const buf = new ArrayBuffer(hex.length / 2);
|
|
308
|
-
const out = new Uint8Array(buf);
|
|
309
|
-
for (let i = 0; i < hex.length; i += 2) {
|
|
310
|
-
out[i / 2] = Number.parseInt(hex.slice(i, i + 2), 16);
|
|
311
|
-
}
|
|
312
|
-
return out;
|
|
313
|
-
}
|
|
314
|
-
function envSecret() {
|
|
315
|
-
const proc = globalThis.process;
|
|
316
|
-
return proc?.env?.[SECRET_ENV];
|
|
317
|
-
}
|
|
318
|
-
function text(message, status) {
|
|
319
|
-
return new Response(message, { status, headers: { "content-type": "text/plain" } });
|
|
320
|
-
}
|
|
321
|
-
|
|
322
237
|
Object.defineProperty(exports, "CimplifyError", {
|
|
323
238
|
enumerable: true,
|
|
324
239
|
get: function () { return chunkXA3ZNR75_js.CimplifyError; }
|
|
@@ -341,7 +256,6 @@ exports.revalidateLocations = revalidateLocations;
|
|
|
341
256
|
exports.revalidatePricing = revalidatePricing;
|
|
342
257
|
exports.revalidateProduct = revalidateProduct;
|
|
343
258
|
exports.revalidateProducts = revalidateProducts;
|
|
344
|
-
exports.revalidateRouteHandler = revalidateRouteHandler;
|
|
345
259
|
exports.revalidateStock = revalidateStock;
|
|
346
260
|
exports.revalidateSubscription = revalidateSubscription;
|
|
347
261
|
exports.revalidateSubscriptions = revalidateSubscriptions;
|
package/dist/server.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createCimplifyClient } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
import { createCimplifyClient } from './chunk-6QZQQRBB.mjs';
|
|
2
|
+
import './chunk-B3Y4C4A7.mjs';
|
|
3
3
|
import './chunk-TD3AY34U.mjs';
|
|
4
4
|
export { CimplifyError } from './chunk-AMZXALF6.mjs';
|
|
5
5
|
import './chunk-3G6RQLXK.mjs';
|
|
@@ -232,89 +232,4 @@ async function refreshPage() {
|
|
|
232
232
|
fn();
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
-
|
|
236
|
-
var TIMESTAMP_HEADER = "x-cimplify-timestamp";
|
|
237
|
-
var SIGNATURE_HEADER = "x-cimplify-signature";
|
|
238
|
-
var SIGNATURE_PREFIX = "sha256=";
|
|
239
|
-
var MAX_SKEW_MS = 5 * 60 * 1e3;
|
|
240
|
-
var SECRET_ENV = "CIMPLIFY_REVALIDATE_SECRET";
|
|
241
|
-
var DEFAULT_PROFILE2 = CACHE_LIFE_DEFAULT;
|
|
242
|
-
async function revalidateRouteHandler(req, options = {}) {
|
|
243
|
-
const secret = options.secret ?? envSecret();
|
|
244
|
-
if (!secret) return text(`revalidate disabled: ${SECRET_ENV} not set`, 500);
|
|
245
|
-
const timestamp = req.headers.get(TIMESTAMP_HEADER);
|
|
246
|
-
const signature = req.headers.get(SIGNATURE_HEADER);
|
|
247
|
-
if (!timestamp || !signature) return text("missing auth headers", 401);
|
|
248
|
-
const ts = Number.parseInt(timestamp, 10);
|
|
249
|
-
const now = options.now ?? Date.now;
|
|
250
|
-
if (!Number.isFinite(ts) || Math.abs(now() - ts) > MAX_SKEW_MS) {
|
|
251
|
-
return text("stale or invalid timestamp", 401);
|
|
252
|
-
}
|
|
253
|
-
const body = await req.text();
|
|
254
|
-
if (!await verifyHmac(secret, `${timestamp}.${body}`, signature)) {
|
|
255
|
-
return text("invalid signature", 401);
|
|
256
|
-
}
|
|
257
|
-
let parsed;
|
|
258
|
-
try {
|
|
259
|
-
parsed = JSON.parse(body);
|
|
260
|
-
} catch {
|
|
261
|
-
return text("invalid json", 400);
|
|
262
|
-
}
|
|
263
|
-
const tags2 = Array.isArray(parsed.tags) ? parsed.tags.filter((t) => typeof t === "string" && t.length > 0) : [];
|
|
264
|
-
if (tags2.length === 0) return text("no tags", 400);
|
|
265
|
-
const profile = parseProfile(parsed.profile) ?? options.defaultProfile ?? DEFAULT_PROFILE2;
|
|
266
|
-
const revalidate2 = options.revalidateTag ?? await loadRevalidateTag();
|
|
267
|
-
for (const tag of tags2) revalidate2(tag, profile);
|
|
268
|
-
return Response.json({ ok: true, revalidated: tags2.length, profile });
|
|
269
|
-
}
|
|
270
|
-
function parseProfile(raw) {
|
|
271
|
-
if (typeof raw === "string" && raw.length > 0) return raw;
|
|
272
|
-
if (raw && typeof raw === "object" && "expire" in raw && typeof raw.expire === "number") {
|
|
273
|
-
return { expire: raw.expire };
|
|
274
|
-
}
|
|
275
|
-
return void 0;
|
|
276
|
-
}
|
|
277
|
-
var cachedRevalidateTag = null;
|
|
278
|
-
async function loadRevalidateTag() {
|
|
279
|
-
if (cachedRevalidateTag) return cachedRevalidateTag;
|
|
280
|
-
const specifier = "next/cache";
|
|
281
|
-
const mod = await import(
|
|
282
|
-
/* webpackIgnore: true */
|
|
283
|
-
/* @vite-ignore */
|
|
284
|
-
specifier
|
|
285
|
-
);
|
|
286
|
-
cachedRevalidateTag = mod.revalidateTag;
|
|
287
|
-
return cachedRevalidateTag;
|
|
288
|
-
}
|
|
289
|
-
async function verifyHmac(secret, payload, signatureHeader) {
|
|
290
|
-
if (!signatureHeader.startsWith(SIGNATURE_PREFIX)) return false;
|
|
291
|
-
const providedBytes = hexToBytes(signatureHeader.slice(SIGNATURE_PREFIX.length));
|
|
292
|
-
if (!providedBytes) return false;
|
|
293
|
-
const enc = new TextEncoder();
|
|
294
|
-
const key = await crypto.subtle.importKey(
|
|
295
|
-
"raw",
|
|
296
|
-
enc.encode(secret),
|
|
297
|
-
{ name: "HMAC", hash: "SHA-256" },
|
|
298
|
-
false,
|
|
299
|
-
["verify"]
|
|
300
|
-
);
|
|
301
|
-
return crypto.subtle.verify("HMAC", key, providedBytes, enc.encode(payload));
|
|
302
|
-
}
|
|
303
|
-
function hexToBytes(hex) {
|
|
304
|
-
if (hex.length % 2 !== 0 || !/^[0-9a-f]+$/i.test(hex)) return null;
|
|
305
|
-
const buf = new ArrayBuffer(hex.length / 2);
|
|
306
|
-
const out = new Uint8Array(buf);
|
|
307
|
-
for (let i = 0; i < hex.length; i += 2) {
|
|
308
|
-
out[i / 2] = Number.parseInt(hex.slice(i, i + 2), 16);
|
|
309
|
-
}
|
|
310
|
-
return out;
|
|
311
|
-
}
|
|
312
|
-
function envSecret() {
|
|
313
|
-
const proc = globalThis.process;
|
|
314
|
-
return proc?.env?.[SECRET_ENV];
|
|
315
|
-
}
|
|
316
|
-
function text(message, status) {
|
|
317
|
-
return new Response(message, { status, headers: { "content-type": "text/plain" } });
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
export { CACHE_LIFE_DEFAULT, CACHE_LIFE_PROBE, getServerClient, refreshPage, revalidateAddOn, revalidateAddOns, revalidateBrand, revalidateBusiness, revalidateByTag, revalidateCategories, revalidateCategory, revalidateCollection, revalidateCollections, revalidateLocation, revalidateLocations, revalidatePricing, revalidateProduct, revalidateProducts, revalidateRouteHandler, revalidateStock, revalidateSubscription, revalidateSubscriptions, tags, updateAddOn, updateAddOns, updateBrand, updateBusiness, updateByTag, updateCategories, updateCategory, updateCollection, updateCollections, updateLocation, updateLocations, updatePricing, updateProduct, updateProducts, updateStock, updateSubscription, updateSubscriptions };
|
|
235
|
+
export { CACHE_LIFE_DEFAULT, CACHE_LIFE_PROBE, getServerClient, refreshPage, revalidateAddOn, revalidateAddOns, revalidateBrand, revalidateBusiness, revalidateByTag, revalidateCategories, revalidateCategory, revalidateCollection, revalidateCollections, revalidateLocation, revalidateLocations, revalidatePricing, revalidateProduct, revalidateProducts, revalidateStock, revalidateSubscription, revalidateSubscriptions, tags, updateAddOn, updateAddOns, updateBrand, updateBusiness, updateByTag, updateCategories, updateCategory, updateCollection, updateCollections, updateLocation, updateLocations, updatePricing, updateProduct, updateProducts, updateStock, updateSubscription, updateSubscriptions };
|
package/dist/testing/msw.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as AppHandle, C as CreateAppOptions } from '../server-
|
|
1
|
+
import { A as AppHandle, C as CreateAppOptions } from '../server-D8rwqZQ6.mjs';
|
|
2
2
|
import 'hono';
|
|
3
|
-
import '../product-
|
|
3
|
+
import '../product-B_kS4Oxa.mjs';
|
|
4
4
|
|
|
5
5
|
interface MswHandlerSetup {
|
|
6
6
|
handlers: unknown[];
|
package/dist/testing/msw.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as AppHandle, C as CreateAppOptions } from '../server-
|
|
1
|
+
import { A as AppHandle, C as CreateAppOptions } from '../server-BQzz921M.js';
|
|
2
2
|
import 'hono';
|
|
3
|
-
import '../product-
|
|
3
|
+
import '../product-B_kS4Oxa.js';
|
|
4
4
|
|
|
5
5
|
interface MswHandlerSetup {
|
|
6
6
|
handlers: unknown[];
|
package/dist/testing/msw.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkHCZTBWU4_js = require('../chunk-HCZTBWU4.js');
|
|
4
4
|
require('../chunk-XA3ZNR75.js');
|
|
5
5
|
require('../chunk-OWW5GUSB.js');
|
|
6
6
|
|
|
7
7
|
// src/mock/msw.ts
|
|
8
8
|
async function createMswHandlers(options = {}) {
|
|
9
9
|
const baseUrl = options.baseUrl ?? "http://localhost:8787";
|
|
10
|
-
const handle =
|
|
10
|
+
const handle = chunkHCZTBWU4_js.createMockApp(options);
|
|
11
11
|
const msw = await import('msw').catch(() => {
|
|
12
12
|
throw new Error("msw is required to use @cimplify/sdk/mock/msw \u2014 install it as a peer dependency");
|
|
13
13
|
});
|
package/dist/testing/msw.mjs
CHANGED
package/dist/testing/suite.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { TestAPI } from 'vitest';
|
|
2
|
-
import { T as TestClientHandle } from '../client-
|
|
3
|
-
import { C as CreateAppOptions } from '../server-
|
|
4
|
-
export { S as SeedName } from '../server-
|
|
5
|
-
import '../client-
|
|
6
|
-
import '../product-
|
|
7
|
-
import '../payment-
|
|
2
|
+
import { T as TestClientHandle } from '../client-D1Gknspz.mjs';
|
|
3
|
+
import { C as CreateAppOptions } from '../server-D8rwqZQ6.mjs';
|
|
4
|
+
export { S as SeedName } from '../server-D8rwqZQ6.mjs';
|
|
5
|
+
import '../client-Bj2apl_y.mjs';
|
|
6
|
+
import '../product-B_kS4Oxa.mjs';
|
|
7
|
+
import '../payment-DVS7ZUEp.mjs';
|
|
8
8
|
import 'hono';
|
|
9
9
|
|
|
10
10
|
/**
|