@voyant-travel/commerce 0.2.2 → 0.3.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 (45) hide show
  1. package/dist/checkout/acceptance-signature.d.ts +4 -0
  2. package/dist/checkout/acceptance-signature.d.ts.map +1 -0
  3. package/dist/checkout/acceptance-signature.js +95 -0
  4. package/dist/checkout/finalize.d.ts +42 -0
  5. package/dist/checkout/finalize.d.ts.map +1 -0
  6. package/dist/checkout/finalize.js +208 -0
  7. package/dist/checkout/index.d.ts +26 -0
  8. package/dist/checkout/index.d.ts.map +1 -0
  9. package/dist/checkout/index.js +24 -0
  10. package/dist/checkout/materialization-support.d.ts +105 -0
  11. package/dist/checkout/materialization-support.d.ts.map +1 -0
  12. package/dist/checkout/materialization-support.js +451 -0
  13. package/dist/checkout/materialization-support.test.d.ts +2 -0
  14. package/dist/checkout/materialization-support.test.d.ts.map +1 -0
  15. package/dist/checkout/materialization-support.test.js +196 -0
  16. package/dist/checkout/materialization-tax.d.ts +10 -0
  17. package/dist/checkout/materialization-tax.d.ts.map +1 -0
  18. package/dist/checkout/materialization-tax.js +113 -0
  19. package/dist/checkout/materialization-tax.test.d.ts +2 -0
  20. package/dist/checkout/materialization-tax.test.d.ts.map +1 -0
  21. package/dist/checkout/materialization-tax.test.js +69 -0
  22. package/dist/checkout/materialization.d.ts +99 -0
  23. package/dist/checkout/materialization.d.ts.map +1 -0
  24. package/dist/checkout/materialization.js +269 -0
  25. package/dist/checkout/options.d.ts +89 -0
  26. package/dist/checkout/options.d.ts.map +1 -0
  27. package/dist/checkout/options.js +21 -0
  28. package/dist/checkout/routes.d.ts +21 -0
  29. package/dist/checkout/routes.d.ts.map +1 -0
  30. package/dist/checkout/routes.js +59 -0
  31. package/dist/checkout/start-service.d.ts +75 -0
  32. package/dist/checkout/start-service.d.ts.map +1 -0
  33. package/dist/checkout/start-service.js +415 -0
  34. package/dist/checkout/start-service.test.d.ts +2 -0
  35. package/dist/checkout/start-service.test.d.ts.map +1 -0
  36. package/dist/checkout/start-service.test.js +57 -0
  37. package/dist/markets/routes.d.ts +1 -1
  38. package/dist/markets/service-core.d.ts +1 -1
  39. package/dist/pricing/routes-public.d.ts.map +1 -1
  40. package/dist/pricing/routes-public.js +12 -2
  41. package/dist/sellability/routes.d.ts +10 -10
  42. package/dist/sellability/service-records.d.ts +4 -4
  43. package/dist/sellability/service-snapshots.d.ts +2 -2
  44. package/dist/sellability/service.d.ts +10 -10
  45. package/package.json +28 -6
@@ -44,9 +44,9 @@ export declare const marketsRoutes: import("hono/hono-base").HonoBase<Env, {
44
44
  metadata: {
45
45
  [x: string]: import("hono/utils/types").JSONValue;
46
46
  } | null;
47
+ status: "active" | "inactive" | "archived";
47
48
  id: string;
48
49
  name: string;
49
- status: "active" | "inactive" | "archived";
50
50
  createdAt: string;
51
51
  code: string;
52
52
  updatedAt: string;
@@ -37,9 +37,9 @@ export declare function getMarketById(db: PostgresJsDatabase, id: string): Promi
37
37
  } | null>;
38
38
  export declare function createMarket(db: PostgresJsDatabase, data: CreateMarketInput): Promise<{
39
39
  metadata: Record<string, unknown> | null;
40
+ status: "active" | "inactive" | "archived";
40
41
  id: string;
41
42
  name: string;
42
- status: "active" | "inactive" | "archived";
43
43
  createdAt: Date;
44
44
  code: string;
45
45
  updatedAt: Date;
@@ -1 +1 @@
1
- {"version":3,"file":"routes-public.d.ts","sourceRoot":"","sources":["../../src/pricing/routes-public.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,GAAG,EAAY,MAAM,oBAAoB,CAAA;AAOvD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4CAkB5B,CAAA;AAEJ,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAA"}
1
+ {"version":3,"file":"routes-public.d.ts","sourceRoot":"","sources":["../../src/pricing/routes-public.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,GAAG,EAAY,MAAM,oBAAoB,CAAA;AAavD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4CAsB5B,CAAA;AAEJ,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAA"}
@@ -3,12 +3,22 @@ import { Hono } from "hono";
3
3
  import { notFound } from "./routes-shared.js";
4
4
  import { publicPricingService } from "./service-public.js";
5
5
  import { publicAvailabilitySnapshotQuerySchema, publicProductPricingQuerySchema, } from "./validation-public.js";
6
+ const PUBLIC_CACHE_CONTROL = "public, s-maxage=60, stale-while-revalidate=300";
7
+ function cachePublicRead(c) {
8
+ c.header("Cache-Control", PUBLIC_CACHE_CONTROL);
9
+ }
6
10
  export const publicPricingRoutes = new Hono()
7
11
  .get("/products/:productId/pricing", async (c) => {
8
12
  const snapshot = await publicPricingService.getProductPricingSnapshot(c.get("db"), c.req.param("productId"), parseQuery(c, publicProductPricingQuerySchema));
9
- return snapshot ? c.json({ data: snapshot }) : notFound(c, "Public pricing snapshot not found");
13
+ if (!snapshot)
14
+ return notFound(c, "Public pricing snapshot not found");
15
+ cachePublicRead(c);
16
+ return c.json({ data: snapshot });
10
17
  })
11
18
  .get("/products/:productId/availability", async (c) => {
12
19
  const snapshot = await publicPricingService.getAvailabilitySnapshot(c.get("db"), c.req.param("productId"), parseQuery(c, publicAvailabilitySnapshotQuerySchema));
13
- return snapshot ? c.json(snapshot) : notFound(c, "Public availability snapshot not found");
20
+ if (!snapshot)
21
+ return notFound(c, "Public availability snapshot not found");
22
+ cachePublicRead(c);
23
+ return c.json(snapshot);
14
24
  });
@@ -118,8 +118,8 @@ export declare function createSellabilityRoutes(options?: SellabilityRoutesOptio
118
118
  input: {};
119
119
  output: {
120
120
  snapshot: {
121
- id: string;
122
121
  status: "expired" | "resolved" | "offer_constructed";
122
+ id: string;
123
123
  createdAt: string;
124
124
  updatedAt: string;
125
125
  expiresAt: string | null;
@@ -588,8 +588,8 @@ export declare function createSellabilityRoutes(options?: SellabilityRoutesOptio
588
588
  output: {
589
589
  data: {
590
590
  message: string | null;
591
- id: string;
592
591
  status: "blocked" | "warning" | "passed" | "adjusted";
592
+ id: string;
593
593
  createdAt: string;
594
594
  details: {
595
595
  [x: string]: import("hono/utils/types").JSONValue;
@@ -742,8 +742,8 @@ export declare function createSellabilityRoutes(options?: SellabilityRoutesOptio
742
742
  metadata: {
743
743
  [x: string]: import("hono/utils/types").JSONValue;
744
744
  } | null;
745
- id: string;
746
745
  status: "failed" | "pending" | "running" | "completed" | "expired";
746
+ id: string;
747
747
  createdAt: string;
748
748
  startedAt: string;
749
749
  updatedAt: string;
@@ -897,14 +897,14 @@ export declare function createSellabilityRoutes(options?: SellabilityRoutesOptio
897
897
  metadata: {
898
898
  [x: string]: import("hono/utils/types").JSONValue;
899
899
  } | null;
900
- id: string;
901
900
  status: "cancelled" | "expired" | "scheduled" | "superseded";
901
+ id: string;
902
902
  createdAt: string;
903
903
  updatedAt: string;
904
904
  expiresAt: string;
905
905
  reason: string | null;
906
- snapshotId: string | null;
907
906
  expiredAt: string | null;
907
+ snapshotId: string | null;
908
908
  offerId: string;
909
909
  } | null;
910
910
  };
@@ -1277,8 +1277,8 @@ export declare const sellabilityRoutes: import("hono/hono-base").HonoBase<Env, {
1277
1277
  input: {};
1278
1278
  output: {
1279
1279
  snapshot: {
1280
- id: string;
1281
1280
  status: "expired" | "resolved" | "offer_constructed";
1281
+ id: string;
1282
1282
  createdAt: string;
1283
1283
  updatedAt: string;
1284
1284
  expiresAt: string | null;
@@ -1747,8 +1747,8 @@ export declare const sellabilityRoutes: import("hono/hono-base").HonoBase<Env, {
1747
1747
  output: {
1748
1748
  data: {
1749
1749
  message: string | null;
1750
- id: string;
1751
1750
  status: "blocked" | "warning" | "passed" | "adjusted";
1751
+ id: string;
1752
1752
  createdAt: string;
1753
1753
  details: {
1754
1754
  [x: string]: import("hono/utils/types").JSONValue;
@@ -1901,8 +1901,8 @@ export declare const sellabilityRoutes: import("hono/hono-base").HonoBase<Env, {
1901
1901
  metadata: {
1902
1902
  [x: string]: import("hono/utils/types").JSONValue;
1903
1903
  } | null;
1904
- id: string;
1905
1904
  status: "failed" | "pending" | "running" | "completed" | "expired";
1905
+ id: string;
1906
1906
  createdAt: string;
1907
1907
  startedAt: string;
1908
1908
  updatedAt: string;
@@ -2056,14 +2056,14 @@ export declare const sellabilityRoutes: import("hono/hono-base").HonoBase<Env, {
2056
2056
  metadata: {
2057
2057
  [x: string]: import("hono/utils/types").JSONValue;
2058
2058
  } | null;
2059
- id: string;
2060
2059
  status: "cancelled" | "expired" | "scheduled" | "superseded";
2060
+ id: string;
2061
2061
  createdAt: string;
2062
2062
  updatedAt: string;
2063
2063
  expiresAt: string;
2064
2064
  reason: string | null;
2065
- snapshotId: string | null;
2066
2065
  expiredAt: string | null;
2066
+ snapshotId: string | null;
2067
2067
  offerId: string;
2068
2068
  } | null;
2069
2069
  };
@@ -125,8 +125,8 @@ export declare function getPolicyResultById(db: PostgresJsDatabase, id: string):
125
125
  } | null>;
126
126
  export declare function createPolicyResult(db: PostgresJsDatabase, data: CreateSellabilityPolicyResultInput): Promise<{
127
127
  message: string | null;
128
- id: string;
129
128
  status: "blocked" | "warning" | "passed" | "adjusted";
129
+ id: string;
130
130
  createdAt: Date;
131
131
  details: Record<string, unknown> | null;
132
132
  snapshotId: string;
@@ -179,8 +179,8 @@ export declare function getOfferRefreshRunById(db: PostgresJsDatabase, id: strin
179
179
  } | null>;
180
180
  export declare function createOfferRefreshRun(db: PostgresJsDatabase, data: CreateOfferRefreshRunInput): Promise<{
181
181
  metadata: Record<string, unknown> | null;
182
- id: string;
183
182
  status: "failed" | "pending" | "running" | "completed" | "expired";
183
+ id: string;
184
184
  createdAt: Date;
185
185
  startedAt: Date;
186
186
  updatedAt: Date;
@@ -235,14 +235,14 @@ export declare function getOfferExpirationEventById(db: PostgresJsDatabase, id:
235
235
  } | null>;
236
236
  export declare function createOfferExpirationEvent(db: PostgresJsDatabase, data: CreateOfferExpirationEventInput): Promise<{
237
237
  metadata: Record<string, unknown> | null;
238
- id: string;
239
238
  status: "cancelled" | "expired" | "scheduled" | "superseded";
239
+ id: string;
240
240
  createdAt: Date;
241
241
  updatedAt: Date;
242
242
  expiresAt: Date;
243
243
  reason: string | null;
244
- snapshotId: string | null;
245
244
  expiredAt: Date | null;
245
+ snapshotId: string | null;
246
246
  offerId: string;
247
247
  } | null>;
248
248
  export declare function updateOfferExpirationEvent(db: PostgresJsDatabase, id: string, data: UpdateOfferExpirationEventInput): Promise<{
@@ -11,8 +11,8 @@ export declare function persistResolvedSnapshot(db: PostgresJsDatabase, input: {
11
11
  status?: "resolved" | "offer_constructed" | "expired";
12
12
  expiresAt?: string | null;
13
13
  }): Promise<{
14
- id: string;
15
14
  status: "expired" | "resolved" | "offer_constructed";
15
+ id: string;
16
16
  createdAt: Date;
17
17
  updatedAt: Date;
18
18
  expiresAt: Date | null;
@@ -30,8 +30,8 @@ export declare function persistResolvedSnapshot(db: PostgresJsDatabase, input: {
30
30
  }>;
31
31
  export declare function persistSnapshot(db: PostgresJsDatabase, input: SellabilityPersistSnapshotInput, resolver?: SellabilityResolver): Promise<{
32
32
  snapshot: {
33
- id: string;
34
33
  status: "expired" | "resolved" | "offer_constructed";
34
+ id: string;
35
35
  createdAt: Date;
36
36
  updatedAt: Date;
37
37
  expiresAt: Date | null;
@@ -167,8 +167,8 @@ export declare function createSellabilityService(_options?: SellabilityServiceOp
167
167
  details?: Record<string, unknown> | null | undefined;
168
168
  }): Promise<{
169
169
  message: string | null;
170
- id: string;
171
170
  status: "blocked" | "warning" | "passed" | "adjusted";
171
+ id: string;
172
172
  createdAt: Date;
173
173
  details: Record<string, unknown> | null;
174
174
  snapshotId: string;
@@ -243,8 +243,8 @@ export declare function createSellabilityService(_options?: SellabilityServiceOp
243
243
  metadata?: Record<string, unknown> | null | undefined;
244
244
  }): Promise<{
245
245
  metadata: Record<string, unknown> | null;
246
- id: string;
247
246
  status: "failed" | "pending" | "running" | "completed" | "expired";
247
+ id: string;
248
248
  createdAt: Date;
249
249
  startedAt: Date;
250
250
  updatedAt: Date;
@@ -321,14 +321,14 @@ export declare function createSellabilityService(_options?: SellabilityServiceOp
321
321
  metadata?: Record<string, unknown> | null | undefined;
322
322
  }): Promise<{
323
323
  metadata: Record<string, unknown> | null;
324
- id: string;
325
324
  status: "cancelled" | "expired" | "scheduled" | "superseded";
325
+ id: string;
326
326
  createdAt: Date;
327
327
  updatedAt: Date;
328
328
  expiresAt: Date;
329
329
  reason: string | null;
330
- snapshotId: string | null;
331
330
  expiredAt: Date | null;
331
+ snapshotId: string | null;
332
332
  offerId: string;
333
333
  } | null>;
334
334
  updateOfferExpirationEvent(db: PostgresJsDatabase, id: string, data: {
@@ -430,8 +430,8 @@ export declare function createSellabilityService(_options?: SellabilityServiceOp
430
430
  } | null>;
431
431
  persistSnapshot(db: PostgresJsDatabase, input: SellabilityPersistSnapshotInput): Promise<{
432
432
  snapshot: {
433
- id: string;
434
433
  status: "expired" | "resolved" | "offer_constructed";
434
+ id: string;
435
435
  createdAt: Date;
436
436
  updatedAt: Date;
437
437
  expiresAt: Date | null;
@@ -683,8 +683,8 @@ export declare const sellabilityService: {
683
683
  details?: Record<string, unknown> | null | undefined;
684
684
  }): Promise<{
685
685
  message: string | null;
686
- id: string;
687
686
  status: "blocked" | "warning" | "passed" | "adjusted";
687
+ id: string;
688
688
  createdAt: Date;
689
689
  details: Record<string, unknown> | null;
690
690
  snapshotId: string;
@@ -759,8 +759,8 @@ export declare const sellabilityService: {
759
759
  metadata?: Record<string, unknown> | null | undefined;
760
760
  }): Promise<{
761
761
  metadata: Record<string, unknown> | null;
762
- id: string;
763
762
  status: "failed" | "pending" | "running" | "completed" | "expired";
763
+ id: string;
764
764
  createdAt: Date;
765
765
  startedAt: Date;
766
766
  updatedAt: Date;
@@ -837,14 +837,14 @@ export declare const sellabilityService: {
837
837
  metadata?: Record<string, unknown> | null | undefined;
838
838
  }): Promise<{
839
839
  metadata: Record<string, unknown> | null;
840
- id: string;
841
840
  status: "cancelled" | "expired" | "scheduled" | "superseded";
841
+ id: string;
842
842
  createdAt: Date;
843
843
  updatedAt: Date;
844
844
  expiresAt: Date;
845
845
  reason: string | null;
846
- snapshotId: string | null;
847
846
  expiredAt: Date | null;
847
+ snapshotId: string | null;
848
848
  offerId: string;
849
849
  } | null>;
850
850
  updateOfferExpirationEvent(db: PostgresJsDatabase, id: string, data: {
@@ -946,8 +946,8 @@ export declare const sellabilityService: {
946
946
  } | null>;
947
947
  persistSnapshot(db: PostgresJsDatabase, input: SellabilityPersistSnapshotInput): Promise<{
948
948
  snapshot: {
949
- id: string;
950
949
  status: "expired" | "resolved" | "offer_constructed";
950
+ id: string;
951
951
  createdAt: Date;
952
952
  updatedAt: Date;
953
953
  expiresAt: Date | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voyant-travel/commerce",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {
@@ -13,6 +13,11 @@
13
13
  "types": "./dist/schema.d.ts",
14
14
  "import": "./dist/schema.js",
15
15
  "default": "./dist/schema.js"
16
+ },
17
+ "./checkout": {
18
+ "types": "./dist/checkout/index.d.ts",
19
+ "import": "./dist/checkout/index.js",
20
+ "default": "./dist/checkout/index.js"
16
21
  }
17
22
  },
18
23
  "dependencies": {
@@ -20,17 +25,34 @@
20
25
  "hono": "^4.12.10",
21
26
  "rrule": "^2.8.1",
22
27
  "zod": "^4.3.6",
23
- "@voyant-travel/catalog": "^0.118.0",
28
+ "@voyant-travel/bookings": "^0.121.0",
29
+ "@voyant-travel/catalog": "^0.119.0",
24
30
  "@voyant-travel/core": "^0.109.0",
25
31
  "@voyant-travel/db": "^0.108.1",
26
- "@voyant-travel/distribution": "^0.110.2",
27
- "@voyant-travel/hono": "^0.110.2",
28
- "@voyant-travel/products-contracts": "^0.105.4",
29
- "@voyant-travel/workflows": "^0.109.0"
32
+ "@voyant-travel/distribution": "^0.111.0",
33
+ "@voyant-travel/finance": "^0.121.0",
34
+ "@voyant-travel/hono": "^0.111.0",
35
+ "@voyant-travel/products-contracts": "^0.105.5",
36
+ "@voyant-travel/workflow-runs": "^0.109.2",
37
+ "@voyant-travel/workflows": "^0.109.2"
38
+ },
39
+ "peerDependencies": {
40
+ "@voyant-travel/legal": "^0.121.0",
41
+ "@voyant-travel/quotes": "^0.120.0"
42
+ },
43
+ "peerDependenciesMeta": {
44
+ "@voyant-travel/legal": {
45
+ "optional": true
46
+ },
47
+ "@voyant-travel/quotes": {
48
+ "optional": true
49
+ }
30
50
  },
31
51
  "devDependencies": {
32
52
  "typescript": "^6.0.2",
33
53
  "vitest": "^4.1.2",
54
+ "@voyant-travel/legal": "^0.121.0",
55
+ "@voyant-travel/quotes": "^0.120.0",
34
56
  "@voyant-travel/voyant-typescript-config": "^0.1.0"
35
57
  },
36
58
  "files": [