@cimplify/sdk 0.81.0 → 0.83.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.
Files changed (48) hide show
  1. package/dist/advanced.d.mts +3 -3
  2. package/dist/advanced.d.ts +3 -3
  3. package/dist/{chunk-SRJEMEVZ.js → chunk-FKBXZ2A6.js} +212 -6
  4. package/dist/{chunk-7PAQR3VC.mjs → chunk-I6RE4BKH.mjs} +4 -2
  5. package/dist/{chunk-IZDJEDR4.js → chunk-ODEPW244.js} +5 -3
  6. package/dist/{chunk-BRVIXGUW.mjs → chunk-PLTP6HWW.mjs} +212 -6
  7. package/dist/{client-C51FFhDz.d.mts → client-Cogz7C1t.d.mts} +2 -2
  8. package/dist/{client-Q_m-GkTl.d.ts → client-Cq3B-WXv.d.ts} +2 -2
  9. package/dist/{client-Cx3WLhMj.d.mts → client-DnHP_2Jw.d.mts} +3 -2
  10. package/dist/{client-BmDNlUMx.d.ts → client-xc2aQSB4.d.ts} +3 -2
  11. package/dist/{index-Moe4cGMB.d.ts → index-C4xE31-D.d.ts} +3 -3
  12. package/dist/{index-Bu76UyFz.d.mts → index-Dy8D3r9b.d.mts} +3 -3
  13. package/dist/index.d.mts +6 -6
  14. package/dist/index.d.ts +6 -6
  15. package/dist/mock/cli.mjs +309 -19
  16. package/dist/mock/library.js +223 -6
  17. package/dist/mock/library.mjs +216 -7
  18. package/dist/mock/msw.js +212 -6
  19. package/dist/mock/msw.mjs +212 -6
  20. package/dist/{payment-B7qzWdaJ.d.mts → payment-T_0MUE9o.d.mts} +1 -1
  21. package/dist/{payment-mVIJIJcq.d.ts → payment-nH9OCUg2.d.ts} +1 -1
  22. package/dist/{price-CS1IsORZ.d.ts → price-B8WMoldA.d.ts} +1 -1
  23. package/dist/{price-BfOaGqjx.d.mts → price-Bg7hujK_.d.mts} +1 -1
  24. package/dist/{product-BgFOFmQw.d.mts → product-DXhjLQ_w.d.mts} +1 -0
  25. package/dist/{product-BgFOFmQw.d.ts → product-DXhjLQ_w.d.ts} +1 -0
  26. package/dist/react.d.mts +4 -4
  27. package/dist/react.d.ts +4 -4
  28. package/dist/react.js +2 -1
  29. package/dist/react.mjs +2 -1
  30. package/dist/{server-hP9NLtTh.d.mts → server-DaovvB9J.d.mts} +87 -3
  31. package/dist/{server-N4Q24CnO.d.ts → server-ZGCyuz4V.d.ts} +87 -3
  32. package/dist/server.d.mts +4 -4
  33. package/dist/server.d.ts +4 -4
  34. package/dist/testing/msw.d.mts +2 -2
  35. package/dist/testing/msw.d.ts +2 -2
  36. package/dist/testing/msw.js +2 -2
  37. package/dist/testing/msw.mjs +1 -1
  38. package/dist/testing/suite.d.mts +6 -6
  39. package/dist/testing/suite.d.ts +6 -6
  40. package/dist/testing/suite.js +21 -21
  41. package/dist/testing/suite.mjs +2 -2
  42. package/dist/testing.d.mts +11 -5
  43. package/dist/testing.d.ts +11 -5
  44. package/dist/testing.js +77 -77
  45. package/dist/testing.mjs +3 -3
  46. package/dist/utils.d.mts +4 -4
  47. package/dist/utils.d.ts +4 -4
  48. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { Hono } from 'hono';
2
- import { b1 as ProductInputField } from './product-BgFOFmQw.mjs';
2
+ import { b1 as ProductInputField } from './product-DXhjLQ_w.mjs';
3
3
 
4
4
  interface Clock {
5
5
  now(): Date;
@@ -1096,10 +1096,94 @@ interface LinkService {
1096
1096
  revokeAllSessions(customerId: string): number;
1097
1097
  }
1098
1098
 
1099
+ /** A whole-registry JSON snapshot: `storeName -> id -> row`. */
1100
+ type RegistrySnapshot = Record<string, Record<string, unknown>>;
1101
+
1099
1102
  type SeedName = "default" | "empty" | "reesa-storefront" | "restaurant" | "retail" | "services" | "grocery" | "fashion" | "pharmacy" | "auto";
1100
1103
 
1104
+ interface SeedBusinessInput extends Partial<Omit<MockBusiness, "id" | "name">> {
1105
+ name: string;
1106
+ }
1107
+ interface SeedCategoryInput {
1108
+ name: string;
1109
+ slug?: string;
1110
+ description?: string;
1111
+ image?: string;
1112
+ displayOrder?: number;
1113
+ }
1114
+ interface SeedCollectionInput {
1115
+ name: string;
1116
+ slug?: string;
1117
+ description?: string;
1118
+ }
1119
+ interface SeedProductInput {
1120
+ name: string;
1121
+ price: string;
1122
+ slug?: string;
1123
+ description?: string;
1124
+ productType?: string;
1125
+ currency?: string;
1126
+ image?: string;
1127
+ images?: string[];
1128
+ category?: MockCategory | string;
1129
+ collection?: MockCollection | string;
1130
+ tags?: string[];
1131
+ isSignature?: boolean;
1132
+ isNew?: boolean;
1133
+ ingredients?: string[];
1134
+ allergies?: string[];
1135
+ calories?: number;
1136
+ durationMinutes?: number;
1137
+ metadata?: Record<string, unknown>;
1138
+ }
1139
+ interface SeedServiceInput {
1140
+ name: string;
1141
+ price: string;
1142
+ durationMinutes: number;
1143
+ description?: string;
1144
+ }
1145
+ /**
1146
+ * Ergonomic builder over the mock state registry. Hands seed authors the same
1147
+ * id-minting, defaulting, and back-reference wiring the built-in seeds do by
1148
+ * hand, while keeping a stable surface even if the underlying store shapes
1149
+ * change. `registry` is the escape hatch for anything not modeled here.
1150
+ */
1151
+ interface SeedContext {
1152
+ readonly registry: StateRegistry;
1153
+ business(input: SeedBusinessInput): MockBusiness;
1154
+ category(input: SeedCategoryInput): MockCategory;
1155
+ collection(input: SeedCollectionInput): MockCollection;
1156
+ product(input: SeedProductInput): MockProduct;
1157
+ service(input: SeedServiceInput): MockService;
1158
+ image(industry: string, slug: string): string;
1159
+ /** Apply a built-in seed first, then keep mutating from there. */
1160
+ extend(name: SeedName): {
1161
+ businessId: string;
1162
+ };
1163
+ }
1164
+ type SeedFn = (ctx: SeedContext) => {
1165
+ businessId: string;
1166
+ };
1167
+
1168
+ /**
1169
+ * Where the mock's initial state comes from. A bare string is a built-in seed
1170
+ * name (back-compat); the object forms open the door to user-supplied data
1171
+ * (`json`) and logic (`fn`).
1172
+ */
1173
+ type SeedSource = SeedName | {
1174
+ kind: "builtin";
1175
+ name: SeedName;
1176
+ } | {
1177
+ kind: "json";
1178
+ data: RegistrySnapshot;
1179
+ businessId?: string;
1180
+ } | {
1181
+ kind: "fn";
1182
+ seed: SeedFn;
1183
+ };
1184
+
1101
1185
  interface MockOptions {
1102
- seed?: SeedName;
1186
+ seed?: SeedSource;
1103
1187
  authMode?: "permissive" | "strict";
1104
1188
  defaultOtp?: string;
1105
1189
  rngSeed?: number;
@@ -1143,7 +1227,7 @@ interface Deps {
1143
1227
  link: LinkService;
1144
1228
  defaultBusinessId: string;
1145
1229
  chaos: ChaosState;
1146
- resetAll: (seed?: SeedName) => string;
1230
+ resetAll: (seed?: SeedSource) => string;
1147
1231
  }
1148
1232
 
1149
1233
  interface CreateAppOptions extends MockOptions {
@@ -1,5 +1,5 @@
1
1
  import { Hono } from 'hono';
2
- import { b1 as ProductInputField } from './product-BgFOFmQw.js';
2
+ import { b1 as ProductInputField } from './product-DXhjLQ_w.js';
3
3
 
4
4
  interface Clock {
5
5
  now(): Date;
@@ -1096,10 +1096,94 @@ interface LinkService {
1096
1096
  revokeAllSessions(customerId: string): number;
1097
1097
  }
1098
1098
 
1099
+ /** A whole-registry JSON snapshot: `storeName -> id -> row`. */
1100
+ type RegistrySnapshot = Record<string, Record<string, unknown>>;
1101
+
1099
1102
  type SeedName = "default" | "empty" | "reesa-storefront" | "restaurant" | "retail" | "services" | "grocery" | "fashion" | "pharmacy" | "auto";
1100
1103
 
1104
+ interface SeedBusinessInput extends Partial<Omit<MockBusiness, "id" | "name">> {
1105
+ name: string;
1106
+ }
1107
+ interface SeedCategoryInput {
1108
+ name: string;
1109
+ slug?: string;
1110
+ description?: string;
1111
+ image?: string;
1112
+ displayOrder?: number;
1113
+ }
1114
+ interface SeedCollectionInput {
1115
+ name: string;
1116
+ slug?: string;
1117
+ description?: string;
1118
+ }
1119
+ interface SeedProductInput {
1120
+ name: string;
1121
+ price: string;
1122
+ slug?: string;
1123
+ description?: string;
1124
+ productType?: string;
1125
+ currency?: string;
1126
+ image?: string;
1127
+ images?: string[];
1128
+ category?: MockCategory | string;
1129
+ collection?: MockCollection | string;
1130
+ tags?: string[];
1131
+ isSignature?: boolean;
1132
+ isNew?: boolean;
1133
+ ingredients?: string[];
1134
+ allergies?: string[];
1135
+ calories?: number;
1136
+ durationMinutes?: number;
1137
+ metadata?: Record<string, unknown>;
1138
+ }
1139
+ interface SeedServiceInput {
1140
+ name: string;
1141
+ price: string;
1142
+ durationMinutes: number;
1143
+ description?: string;
1144
+ }
1145
+ /**
1146
+ * Ergonomic builder over the mock state registry. Hands seed authors the same
1147
+ * id-minting, defaulting, and back-reference wiring the built-in seeds do by
1148
+ * hand, while keeping a stable surface even if the underlying store shapes
1149
+ * change. `registry` is the escape hatch for anything not modeled here.
1150
+ */
1151
+ interface SeedContext {
1152
+ readonly registry: StateRegistry;
1153
+ business(input: SeedBusinessInput): MockBusiness;
1154
+ category(input: SeedCategoryInput): MockCategory;
1155
+ collection(input: SeedCollectionInput): MockCollection;
1156
+ product(input: SeedProductInput): MockProduct;
1157
+ service(input: SeedServiceInput): MockService;
1158
+ image(industry: string, slug: string): string;
1159
+ /** Apply a built-in seed first, then keep mutating from there. */
1160
+ extend(name: SeedName): {
1161
+ businessId: string;
1162
+ };
1163
+ }
1164
+ type SeedFn = (ctx: SeedContext) => {
1165
+ businessId: string;
1166
+ };
1167
+
1168
+ /**
1169
+ * Where the mock's initial state comes from. A bare string is a built-in seed
1170
+ * name (back-compat); the object forms open the door to user-supplied data
1171
+ * (`json`) and logic (`fn`).
1172
+ */
1173
+ type SeedSource = SeedName | {
1174
+ kind: "builtin";
1175
+ name: SeedName;
1176
+ } | {
1177
+ kind: "json";
1178
+ data: RegistrySnapshot;
1179
+ businessId?: string;
1180
+ } | {
1181
+ kind: "fn";
1182
+ seed: SeedFn;
1183
+ };
1184
+
1101
1185
  interface MockOptions {
1102
- seed?: SeedName;
1186
+ seed?: SeedSource;
1103
1187
  authMode?: "permissive" | "strict";
1104
1188
  defaultOtp?: string;
1105
1189
  rngSeed?: number;
@@ -1143,7 +1227,7 @@ interface Deps {
1143
1227
  link: LinkService;
1144
1228
  defaultBusinessId: string;
1145
1229
  chaos: ChaosState;
1146
- resetAll: (seed?: SeedName) => string;
1230
+ resetAll: (seed?: SeedSource) => string;
1147
1231
  }
1148
1232
 
1149
1233
  interface CreateAppOptions extends MockOptions {
package/dist/server.d.mts CHANGED
@@ -1,8 +1,8 @@
1
- import { ad as CimplifyClient } from './client-Cx3WLhMj.mjs';
2
- export { K as CacheOptions, ct as ReadRequestOptions, cP as Result } from './client-Cx3WLhMj.mjs';
3
- export { Q as Category, T as CimplifyError, U as Collection, aX as Product, b9 as ProductWithDetails } from './product-BgFOFmQw.mjs';
1
+ import { ad as CimplifyClient } from './client-DnHP_2Jw.mjs';
2
+ export { K as CacheOptions, ct as ReadRequestOptions, cP as Result } from './client-DnHP_2Jw.mjs';
3
+ export { Q as Category, T as CimplifyError, U as Collection, aX as Product, b9 as ProductWithDetails } from './product-DXhjLQ_w.mjs';
4
4
  import { JWTVerifyResult } from 'jose';
5
- import './payment-B7qzWdaJ.mjs';
5
+ import './payment-T_0MUE9o.mjs';
6
6
 
7
7
  interface ServerClientOptions {
8
8
  /**
package/dist/server.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { ad as CimplifyClient } from './client-BmDNlUMx.js';
2
- export { K as CacheOptions, ct as ReadRequestOptions, cP as Result } from './client-BmDNlUMx.js';
3
- export { Q as Category, T as CimplifyError, U as Collection, aX as Product, b9 as ProductWithDetails } from './product-BgFOFmQw.js';
1
+ import { ad as CimplifyClient } from './client-xc2aQSB4.js';
2
+ export { K as CacheOptions, ct as ReadRequestOptions, cP as Result } from './client-xc2aQSB4.js';
3
+ export { Q as Category, T as CimplifyError, U as Collection, aX as Product, b9 as ProductWithDetails } from './product-DXhjLQ_w.js';
4
4
  import { JWTVerifyResult } from 'jose';
5
- import './payment-mVIJIJcq.js';
5
+ import './payment-nH9OCUg2.js';
6
6
 
7
7
  interface ServerClientOptions {
8
8
  /**
@@ -1,6 +1,6 @@
1
- import { A as AppHandle, C as CreateAppOptions } from '../server-hP9NLtTh.mjs';
1
+ import { A as AppHandle, C as CreateAppOptions } from '../server-DaovvB9J.mjs';
2
2
  import 'hono';
3
- import '../product-BgFOFmQw.mjs';
3
+ import '../product-DXhjLQ_w.mjs';
4
4
 
5
5
  interface MswHandlerSetup {
6
6
  handlers: unknown[];
@@ -1,6 +1,6 @@
1
- import { A as AppHandle, C as CreateAppOptions } from '../server-N4Q24CnO.js';
1
+ import { A as AppHandle, C as CreateAppOptions } from '../server-ZGCyuz4V.js';
2
2
  import 'hono';
3
- import '../product-BgFOFmQw.js';
3
+ import '../product-DXhjLQ_w.js';
4
4
 
5
5
  interface MswHandlerSetup {
6
6
  handlers: unknown[];
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkSRJEMEVZ_js = require('../chunk-SRJEMEVZ.js');
3
+ var chunkFKBXZ2A6_js = require('../chunk-FKBXZ2A6.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 = chunkSRJEMEVZ_js.createMockApp(options);
10
+ const handle = chunkFKBXZ2A6_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
  });
@@ -1,4 +1,4 @@
1
- import { createMockApp } from '../chunk-BRVIXGUW.mjs';
1
+ import { createMockApp } from '../chunk-PLTP6HWW.mjs';
2
2
  import '../chunk-AMZXALF6.mjs';
3
3
  import '../chunk-3G6RQLXK.mjs';
4
4
 
@@ -1,10 +1,10 @@
1
1
  import { TestAPI } from 'vitest';
2
- import { T as TestClientHandle } from '../client-C51FFhDz.mjs';
3
- import { C as CreateAppOptions } from '../server-hP9NLtTh.mjs';
4
- export { S as SeedName } from '../server-hP9NLtTh.mjs';
5
- import '../client-Cx3WLhMj.mjs';
6
- import '../product-BgFOFmQw.mjs';
7
- import '../payment-B7qzWdaJ.mjs';
2
+ import { T as TestClientHandle } from '../client-Cogz7C1t.mjs';
3
+ import { C as CreateAppOptions } from '../server-DaovvB9J.mjs';
4
+ export { S as SeedName } from '../server-DaovvB9J.mjs';
5
+ import '../client-DnHP_2Jw.mjs';
6
+ import '../product-DXhjLQ_w.mjs';
7
+ import '../payment-T_0MUE9o.mjs';
8
8
  import 'hono';
9
9
 
10
10
  /**
@@ -1,10 +1,10 @@
1
1
  import { TestAPI } from 'vitest';
2
- import { T as TestClientHandle } from '../client-Q_m-GkTl.js';
3
- import { C as CreateAppOptions } from '../server-N4Q24CnO.js';
4
- export { S as SeedName } from '../server-N4Q24CnO.js';
5
- import '../client-BmDNlUMx.js';
6
- import '../product-BgFOFmQw.js';
7
- import '../payment-mVIJIJcq.js';
2
+ import { T as TestClientHandle } from '../client-Cq3B-WXv.js';
3
+ import { C as CreateAppOptions } from '../server-ZGCyuz4V.js';
4
+ export { S as SeedName } from '../server-ZGCyuz4V.js';
5
+ import '../client-xc2aQSB4.js';
6
+ import '../product-DXhjLQ_w.js';
7
+ import '../payment-nH9OCUg2.js';
8
8
  import 'hono';
9
9
 
10
10
  /**
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkIZDJEDR4_js = require('../chunk-IZDJEDR4.js');
4
- require('../chunk-SRJEMEVZ.js');
3
+ var chunkODEPW244_js = require('../chunk-ODEPW244.js');
4
+ require('../chunk-FKBXZ2A6.js');
5
5
  require('../chunk-GFM5JW45.js');
6
6
  require('../chunk-HPN5R3K2.js');
7
7
  require('../chunk-7Y2O3E4D.js');
@@ -20,11 +20,11 @@ var PLACEHOLDER_PHRASES = [
20
20
  function createBrandSuite(opts) {
21
21
  vitest.describe(opts.label ?? "brand schema", () => {
22
22
  vitest.it("conforms to the Cimplify brand contract", () => {
23
- vitest.expect(() => chunkIZDJEDR4_js.assertBrand(opts.brand)).not.toThrow();
23
+ vitest.expect(() => chunkODEPW244_js.assertBrand(opts.brand)).not.toThrow();
24
24
  });
25
25
  vitest.it("declares a known mock seed", () => {
26
26
  const b = opts.brand;
27
- vitest.expect(chunkIZDJEDR4_js.SeedNameSchema.safeParse(b.mock?.seed).success).toBe(true);
27
+ vitest.expect(chunkODEPW244_js.SeedNameSchema.safeParse(b.mock?.seed).success).toBe(true);
28
28
  });
29
29
  vitest.it("has no placeholder copy left in", () => {
30
30
  const offenders = [];
@@ -56,7 +56,7 @@ ${msg}`);
56
56
  vitest.expect(b.mock?.businessId).toMatch(/^bus_/);
57
57
  });
58
58
  vitest.it("zod-parses cleanly", () => {
59
- const result = chunkIZDJEDR4_js.BrandSchema.safeParse(opts.brand);
59
+ const result = chunkODEPW244_js.BrandSchema.safeParse(opts.brand);
60
60
  if (!result.success) {
61
61
  throw new Error(
62
62
  "Brand schema violations:\n" + result.error.issues.map((i) => ` \u2022 brand.${i.path.join(".")}: ${i.message}`).join("\n")
@@ -71,23 +71,23 @@ function createCartFlowSuite(opts = {}) {
71
71
  vitest.describe(opts.label ?? "cart flow against in-process mock", () => {
72
72
  let h;
73
73
  vitest.beforeEach(() => {
74
- h = chunkIZDJEDR4_js.createTestClient(opts);
74
+ h = chunkODEPW244_js.createTestClient(opts);
75
75
  });
76
76
  vitest.afterEach(() => h.dispose());
77
77
  vitest.it("starts with an empty cart matching the canonical shape", async () => {
78
78
  const res = await h.client.cart.get();
79
79
  vitest.expect(res.ok).toBe(true);
80
80
  if (!res.ok) return;
81
- vitest.expect(() => chunkIZDJEDR4_js.assertCart(res.value)).not.toThrow();
81
+ vitest.expect(() => chunkODEPW244_js.assertCart(res.value)).not.toThrow();
82
82
  vitest.expect(res.value.items).toHaveLength(0);
83
83
  });
84
84
  vitest.it("adds the first product, persists it, and returns a shape-valid cart", async () => {
85
- const { product, variantId } = await chunkIZDJEDR4_js.fixtures.addFirstProduct(h.client);
85
+ const { product, variantId } = await chunkODEPW244_js.fixtures.addFirstProduct(h.client);
86
86
  vitest.expect(product.id).toBeTruthy();
87
87
  const get = await h.client.cart.get();
88
88
  vitest.expect(get.ok).toBe(true);
89
89
  if (!get.ok) return;
90
- vitest.expect(() => chunkIZDJEDR4_js.assertCart(get.value)).not.toThrow();
90
+ vitest.expect(() => chunkODEPW244_js.assertCart(get.value)).not.toThrow();
91
91
  vitest.expect(get.value.items).toHaveLength(1);
92
92
  vitest.expect(get.value.items[0]?.item_id).toBe(product.id);
93
93
  if (variantId) {
@@ -98,8 +98,8 @@ function createCartFlowSuite(opts = {}) {
98
98
  vitest.expect(parseFloat(String(get.value.pricing.subtotal))).toBeGreaterThan(0);
99
99
  });
100
100
  vitest.it("dedupes by line_key when adding the same product twice", async () => {
101
- await chunkIZDJEDR4_js.fixtures.addFirstProduct(h.client);
102
- await chunkIZDJEDR4_js.fixtures.addFirstProduct(h.client);
101
+ await chunkODEPW244_js.fixtures.addFirstProduct(h.client);
102
+ await chunkODEPW244_js.fixtures.addFirstProduct(h.client);
103
103
  const res = await h.client.cart.get();
104
104
  vitest.expect(res.ok).toBe(true);
105
105
  if (!res.ok) return;
@@ -107,7 +107,7 @@ function createCartFlowSuite(opts = {}) {
107
107
  vitest.expect(res.value.items[0]?.quantity).toBe(2);
108
108
  });
109
109
  vitest.it("removes items and zeroes the subtotal", async () => {
110
- await chunkIZDJEDR4_js.fixtures.addFirstProduct(h.client);
110
+ await chunkODEPW244_js.fixtures.addFirstProduct(h.client);
111
111
  const before = await h.client.cart.get();
112
112
  if (!before.ok) throw before.error;
113
113
  const itemId = before.value.items[0]?.id;
@@ -133,28 +133,28 @@ function createContractSuite(opts = {}) {
133
133
  vitest.describe(opts.label ?? "SDK \u2194 mock contract", () => {
134
134
  let h;
135
135
  vitest.beforeEach(() => {
136
- h = chunkIZDJEDR4_js.createTestClient(opts);
136
+ h = chunkODEPW244_js.createTestClient(opts);
137
137
  });
138
138
  vitest.afterEach(() => h.dispose());
139
139
  vitest.it("AddItemPayload schema accepts a minimal valid body", () => {
140
- const result = chunkIZDJEDR4_js.AddItemPayloadSchema.safeParse({ item_id: "prod_x", quantity: 1 });
140
+ const result = chunkODEPW244_js.AddItemPayloadSchema.safeParse({ item_id: "prod_x", quantity: 1 });
141
141
  vitest.expect(result.success).toBe(true);
142
142
  });
143
143
  vitest.it("AddItemPayload schema rejects negative quantity", () => {
144
- const result = chunkIZDJEDR4_js.AddItemPayloadSchema.safeParse({ item_id: "prod_x", quantity: -1 });
144
+ const result = chunkODEPW244_js.AddItemPayloadSchema.safeParse({ item_id: "prod_x", quantity: -1 });
145
145
  vitest.expect(result.success).toBe(false);
146
146
  });
147
147
  vitest.it("AddItemPayload schema rejects empty item_id", () => {
148
- const result = chunkIZDJEDR4_js.AddItemPayloadSchema.safeParse({ item_id: "", quantity: 1 });
148
+ const result = chunkODEPW244_js.AddItemPayloadSchema.safeParse({ item_id: "", quantity: 1 });
149
149
  vitest.expect(result.success).toBe(false);
150
150
  });
151
151
  vitest.it("Cart line items returned by the mock match CartItemSchema", async () => {
152
- const { product } = await chunkIZDJEDR4_js.fixtures.addFirstProduct(h.client);
152
+ const { product } = await chunkODEPW244_js.fixtures.addFirstProduct(h.client);
153
153
  const get = await h.client.cart.get();
154
154
  if (!get.ok) throw get.error;
155
155
  vitest.expect(get.value.items.length).toBeGreaterThan(0);
156
156
  for (const item of get.value.items) {
157
- const result = chunkIZDJEDR4_js.CartItemSchema.safeParse(item);
157
+ const result = chunkODEPW244_js.CartItemSchema.safeParse(item);
158
158
  if (!result.success) {
159
159
  const issues = result.error.issues.map((i) => ` \u2022 ${i.path.join(".")}: ${i.message}`).join("\n");
160
160
  throw new Error(`Cart item shape mismatch for ${product.name}:
@@ -164,19 +164,19 @@ ${issues}`);
164
164
  }
165
165
  });
166
166
  vitest.it("CheckoutResponse from the mock includes bill_token", async () => {
167
- await chunkIZDJEDR4_js.fixtures.addFirstProduct(h.client);
167
+ await chunkODEPW244_js.fixtures.addFirstProduct(h.client);
168
168
  const cartRes = await h.client.cart.get();
169
169
  if (!cartRes.ok) throw cartRes.error;
170
170
  const checkout = await h.client.checkout.process({
171
171
  cart_id: cartRes.value.id,
172
- customer: chunkIZDJEDR4_js.fixtures.customer(),
172
+ customer: chunkODEPW244_js.fixtures.customer(),
173
173
  order_type: "delivery",
174
174
  payment_method: "mobile_money",
175
175
  mobile_money_details: { phone_number: "+233244000000", provider: "mtn" }
176
176
  });
177
177
  vitest.expect(checkout.ok).toBe(true);
178
178
  if (!checkout.ok) return;
179
- const result = chunkIZDJEDR4_js.CheckoutResponseSchema.safeParse(checkout.value);
179
+ const result = chunkODEPW244_js.CheckoutResponseSchema.safeParse(checkout.value);
180
180
  if (!result.success) {
181
181
  const issues = result.error.issues.map((i) => ` \u2022 ${i.path.join(".")}: ${i.message}`).join("\n");
182
182
  throw new Error(`CheckoutResponse shape mismatch:
@@ -1,5 +1,5 @@
1
- import { assertBrand, SeedNameSchema, BrandSchema, createTestClient, assertCart, fixtures, AddItemPayloadSchema, CartItemSchema, CheckoutResponseSchema } from '../chunk-7PAQR3VC.mjs';
2
- import '../chunk-BRVIXGUW.mjs';
1
+ import { assertBrand, SeedNameSchema, BrandSchema, createTestClient, assertCart, fixtures, AddItemPayloadSchema, CartItemSchema, CheckoutResponseSchema } from '../chunk-I6RE4BKH.mjs';
2
+ import '../chunk-PLTP6HWW.mjs';
3
3
  import '../chunk-NWUEWUX2.mjs';
4
4
  import '../chunk-7BM56JET.mjs';
5
5
  import '../chunk-TD3AY34U.mjs';
@@ -1,10 +1,10 @@
1
1
  import { z } from 'zod';
2
2
  import { $ZodType } from 'zod/v4/core';
3
- export { A as AddFirstProductOptions, a as AddFirstProductResult, P as ProductSummary, T as TestClientHandle, c as createTestClient, f as fixtures } from './client-C51FFhDz.mjs';
4
- import './client-Cx3WLhMj.mjs';
5
- import './product-BgFOFmQw.mjs';
6
- import './payment-B7qzWdaJ.mjs';
7
- import './server-hP9NLtTh.mjs';
3
+ export { A as AddFirstProductOptions, a as AddFirstProductResult, P as ProductSummary, T as TestClientHandle, c as createTestClient, f as fixtures } from './client-Cogz7C1t.mjs';
4
+ import './client-DnHP_2Jw.mjs';
5
+ import './product-DXhjLQ_w.mjs';
6
+ import './payment-T_0MUE9o.mjs';
7
+ import './server-DaovvB9J.mjs';
8
8
  import 'hono';
9
9
 
10
10
  /**
@@ -1242,6 +1242,7 @@ declare const CartSchema: z.ZodObject<{
1242
1242
  status: z.ZodString;
1243
1243
  source: z.ZodString;
1244
1244
  channel: z.ZodString;
1245
+ requires_delivery: z.ZodOptional<z.ZodBoolean>;
1245
1246
  }, z.core.$loose>;
1246
1247
  type Cart = z.infer<typeof CartSchema>;
1247
1248
  declare const assertCart: (value: unknown) => asserts value is {
@@ -1410,6 +1411,7 @@ declare const assertCart: (value: unknown) => asserts value is {
1410
1411
  status: string;
1411
1412
  source: string;
1412
1413
  channel: string;
1414
+ requires_delivery?: boolean | undefined;
1413
1415
  };
1414
1416
 
1415
1417
  /**
@@ -1436,6 +1438,7 @@ declare const CheckoutBodySchema: z.ZodObject<{
1436
1438
  }, z.core.$strip>;
1437
1439
  order_type: z.ZodString;
1438
1440
  address_info: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1441
+ delivery_rate_id: z.ZodOptional<z.ZodString>;
1439
1442
  payment_method: z.ZodString;
1440
1443
  mobile_money_details: z.ZodOptional<z.ZodObject<{
1441
1444
  phone_number: z.ZodString;
@@ -1460,6 +1463,7 @@ declare const assertCheckoutBody: (value: unknown) => asserts value is {
1460
1463
  payment_method: string;
1461
1464
  location_id?: string | undefined;
1462
1465
  address_info?: Record<string, unknown> | undefined;
1466
+ delivery_rate_id?: string | undefined;
1463
1467
  mobile_money_details?: {
1464
1468
  phone_number: string;
1465
1469
  provider: string;
@@ -1957,6 +1961,7 @@ declare const PUBLIC_SCHEMAS: {
1957
1961
  status: z.ZodString;
1958
1962
  source: z.ZodString;
1959
1963
  channel: z.ZodString;
1964
+ requires_delivery: z.ZodOptional<z.ZodBoolean>;
1960
1965
  }, z.core.$loose>;
1961
1966
  readonly CartItem: z.ZodObject<{
1962
1967
  id: z.ZodString;
@@ -2128,6 +2133,7 @@ declare const PUBLIC_SCHEMAS: {
2128
2133
  }, z.core.$strip>;
2129
2134
  order_type: z.ZodString;
2130
2135
  address_info: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2136
+ delivery_rate_id: z.ZodOptional<z.ZodString>;
2131
2137
  payment_method: z.ZodString;
2132
2138
  mobile_money_details: z.ZodOptional<z.ZodObject<{
2133
2139
  phone_number: z.ZodString;
package/dist/testing.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { z } from 'zod';
2
2
  import { $ZodType } from 'zod/v4/core';
3
- export { A as AddFirstProductOptions, a as AddFirstProductResult, P as ProductSummary, T as TestClientHandle, c as createTestClient, f as fixtures } from './client-Q_m-GkTl.js';
4
- import './client-BmDNlUMx.js';
5
- import './product-BgFOFmQw.js';
6
- import './payment-mVIJIJcq.js';
7
- import './server-N4Q24CnO.js';
3
+ export { A as AddFirstProductOptions, a as AddFirstProductResult, P as ProductSummary, T as TestClientHandle, c as createTestClient, f as fixtures } from './client-Cq3B-WXv.js';
4
+ import './client-xc2aQSB4.js';
5
+ import './product-DXhjLQ_w.js';
6
+ import './payment-nH9OCUg2.js';
7
+ import './server-ZGCyuz4V.js';
8
8
  import 'hono';
9
9
 
10
10
  /**
@@ -1242,6 +1242,7 @@ declare const CartSchema: z.ZodObject<{
1242
1242
  status: z.ZodString;
1243
1243
  source: z.ZodString;
1244
1244
  channel: z.ZodString;
1245
+ requires_delivery: z.ZodOptional<z.ZodBoolean>;
1245
1246
  }, z.core.$loose>;
1246
1247
  type Cart = z.infer<typeof CartSchema>;
1247
1248
  declare const assertCart: (value: unknown) => asserts value is {
@@ -1410,6 +1411,7 @@ declare const assertCart: (value: unknown) => asserts value is {
1410
1411
  status: string;
1411
1412
  source: string;
1412
1413
  channel: string;
1414
+ requires_delivery?: boolean | undefined;
1413
1415
  };
1414
1416
 
1415
1417
  /**
@@ -1436,6 +1438,7 @@ declare const CheckoutBodySchema: z.ZodObject<{
1436
1438
  }, z.core.$strip>;
1437
1439
  order_type: z.ZodString;
1438
1440
  address_info: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1441
+ delivery_rate_id: z.ZodOptional<z.ZodString>;
1439
1442
  payment_method: z.ZodString;
1440
1443
  mobile_money_details: z.ZodOptional<z.ZodObject<{
1441
1444
  phone_number: z.ZodString;
@@ -1460,6 +1463,7 @@ declare const assertCheckoutBody: (value: unknown) => asserts value is {
1460
1463
  payment_method: string;
1461
1464
  location_id?: string | undefined;
1462
1465
  address_info?: Record<string, unknown> | undefined;
1466
+ delivery_rate_id?: string | undefined;
1463
1467
  mobile_money_details?: {
1464
1468
  phone_number: string;
1465
1469
  provider: string;
@@ -1957,6 +1961,7 @@ declare const PUBLIC_SCHEMAS: {
1957
1961
  status: z.ZodString;
1958
1962
  source: z.ZodString;
1959
1963
  channel: z.ZodString;
1964
+ requires_delivery: z.ZodOptional<z.ZodBoolean>;
1960
1965
  }, z.core.$loose>;
1961
1966
  readonly CartItem: z.ZodObject<{
1962
1967
  id: z.ZodString;
@@ -2128,6 +2133,7 @@ declare const PUBLIC_SCHEMAS: {
2128
2133
  }, z.core.$strip>;
2129
2134
  order_type: z.ZodString;
2130
2135
  address_info: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2136
+ delivery_rate_id: z.ZodOptional<z.ZodString>;
2131
2137
  payment_method: z.ZodString;
2132
2138
  mobile_money_details: z.ZodOptional<z.ZodObject<{
2133
2139
  phone_number: z.ZodString;