@voyantjs/octo 0.4.5 → 0.6.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/routes.d.ts CHANGED
@@ -332,7 +332,7 @@ export declare const octoRoutes: import("hono/hono-base").HonoBase<Env, {
332
332
  unitItems: {
333
333
  bookingItemId: string;
334
334
  title: string;
335
- itemType: "other" | "unit" | "extra" | "service" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
335
+ itemType: "service" | "other" | "unit" | "extra" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
336
336
  status: "draft" | "on_hold" | "confirmed" | "expired" | "cancelled" | "fulfilled";
337
337
  quantity: number;
338
338
  productId: string | null;
@@ -405,7 +405,7 @@ export declare const octoRoutes: import("hono/hono-base").HonoBase<Env, {
405
405
  expiredAt: string | null;
406
406
  utcRedeemedAt: string | null;
407
407
  extensions: {
408
- sourceType: "internal" | "direct" | "manual" | "affiliate" | "ota" | "reseller" | "api_partner";
408
+ sourceType: "internal" | "reseller" | "direct" | "manual" | "affiliate" | "ota" | "api_partner";
409
409
  externalBookingRef: string | null;
410
410
  communicationLanguage: string | null;
411
411
  personId: string | null;
@@ -461,7 +461,7 @@ export declare const octoRoutes: import("hono/hono-base").HonoBase<Env, {
461
461
  unitItems: {
462
462
  bookingItemId: string;
463
463
  title: string;
464
- itemType: "other" | "unit" | "extra" | "service" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
464
+ itemType: "service" | "other" | "unit" | "extra" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
465
465
  status: "draft" | "on_hold" | "confirmed" | "expired" | "cancelled" | "fulfilled";
466
466
  quantity: number;
467
467
  productId: string | null;
@@ -534,7 +534,7 @@ export declare const octoRoutes: import("hono/hono-base").HonoBase<Env, {
534
534
  expiredAt: string | null;
535
535
  utcRedeemedAt: string | null;
536
536
  extensions: {
537
- sourceType: "internal" | "direct" | "manual" | "affiliate" | "ota" | "reseller" | "api_partner";
537
+ sourceType: "internal" | "reseller" | "direct" | "manual" | "affiliate" | "ota" | "api_partner";
538
538
  externalBookingRef: string | null;
539
539
  communicationLanguage: string | null;
540
540
  personId: string | null;
@@ -587,7 +587,7 @@ export declare const octoRoutes: import("hono/hono-base").HonoBase<Env, {
587
587
  unitItems: {
588
588
  bookingItemId: string;
589
589
  title: string;
590
- itemType: "other" | "unit" | "extra" | "service" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
590
+ itemType: "service" | "other" | "unit" | "extra" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
591
591
  status: "draft" | "on_hold" | "confirmed" | "expired" | "cancelled" | "fulfilled";
592
592
  quantity: number;
593
593
  productId: string | null;
@@ -660,7 +660,7 @@ export declare const octoRoutes: import("hono/hono-base").HonoBase<Env, {
660
660
  expiredAt: string | null;
661
661
  utcRedeemedAt: string | null;
662
662
  extensions: {
663
- sourceType: "internal" | "direct" | "manual" | "affiliate" | "ota" | "reseller" | "api_partner";
663
+ sourceType: "internal" | "reseller" | "direct" | "manual" | "affiliate" | "ota" | "api_partner";
664
664
  externalBookingRef: string | null;
665
665
  communicationLanguage: string | null;
666
666
  personId: string | null;
@@ -699,7 +699,7 @@ export declare const octoRoutes: import("hono/hono-base").HonoBase<Env, {
699
699
  unitItems: {
700
700
  bookingItemId: string;
701
701
  title: string;
702
- itemType: "other" | "unit" | "extra" | "service" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
702
+ itemType: "service" | "other" | "unit" | "extra" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
703
703
  status: "draft" | "on_hold" | "confirmed" | "expired" | "cancelled" | "fulfilled";
704
704
  quantity: number;
705
705
  productId: string | null;
@@ -772,7 +772,7 @@ export declare const octoRoutes: import("hono/hono-base").HonoBase<Env, {
772
772
  expiredAt: string | null;
773
773
  utcRedeemedAt: string | null;
774
774
  extensions: {
775
- sourceType: "internal" | "direct" | "manual" | "affiliate" | "ota" | "reseller" | "api_partner";
775
+ sourceType: "internal" | "reseller" | "direct" | "manual" | "affiliate" | "ota" | "api_partner";
776
776
  externalBookingRef: string | null;
777
777
  communicationLanguage: string | null;
778
778
  personId: string | null;
@@ -844,7 +844,7 @@ export declare const octoRoutes: import("hono/hono-base").HonoBase<Env, {
844
844
  unitItems: {
845
845
  bookingItemId: string;
846
846
  title: string;
847
- itemType: "other" | "unit" | "extra" | "service" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
847
+ itemType: "service" | "other" | "unit" | "extra" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
848
848
  status: "draft" | "on_hold" | "confirmed" | "expired" | "cancelled" | "fulfilled";
849
849
  quantity: number;
850
850
  productId: string | null;
@@ -917,7 +917,7 @@ export declare const octoRoutes: import("hono/hono-base").HonoBase<Env, {
917
917
  expiredAt: string | null;
918
918
  utcRedeemedAt: string | null;
919
919
  extensions: {
920
- sourceType: "internal" | "direct" | "manual" | "affiliate" | "ota" | "reseller" | "api_partner";
920
+ sourceType: "internal" | "reseller" | "direct" | "manual" | "affiliate" | "ota" | "api_partner";
921
921
  externalBookingRef: string | null;
922
922
  communicationLanguage: string | null;
923
923
  personId: string | null;
@@ -989,7 +989,7 @@ export declare const octoRoutes: import("hono/hono-base").HonoBase<Env, {
989
989
  unitItems: {
990
990
  bookingItemId: string;
991
991
  title: string;
992
- itemType: "other" | "unit" | "extra" | "service" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
992
+ itemType: "service" | "other" | "unit" | "extra" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
993
993
  status: "draft" | "on_hold" | "confirmed" | "expired" | "cancelled" | "fulfilled";
994
994
  quantity: number;
995
995
  productId: string | null;
@@ -1062,7 +1062,7 @@ export declare const octoRoutes: import("hono/hono-base").HonoBase<Env, {
1062
1062
  expiredAt: string | null;
1063
1063
  utcRedeemedAt: string | null;
1064
1064
  extensions: {
1065
- sourceType: "internal" | "direct" | "manual" | "affiliate" | "ota" | "reseller" | "api_partner";
1065
+ sourceType: "internal" | "reseller" | "direct" | "manual" | "affiliate" | "ota" | "api_partner";
1066
1066
  externalBookingRef: string | null;
1067
1067
  communicationLanguage: string | null;
1068
1068
  personId: string | null;
@@ -1134,7 +1134,7 @@ export declare const octoRoutes: import("hono/hono-base").HonoBase<Env, {
1134
1134
  unitItems: {
1135
1135
  bookingItemId: string;
1136
1136
  title: string;
1137
- itemType: "other" | "unit" | "extra" | "service" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
1137
+ itemType: "service" | "other" | "unit" | "extra" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
1138
1138
  status: "draft" | "on_hold" | "confirmed" | "expired" | "cancelled" | "fulfilled";
1139
1139
  quantity: number;
1140
1140
  productId: string | null;
@@ -1207,7 +1207,7 @@ export declare const octoRoutes: import("hono/hono-base").HonoBase<Env, {
1207
1207
  expiredAt: string | null;
1208
1208
  utcRedeemedAt: string | null;
1209
1209
  extensions: {
1210
- sourceType: "internal" | "direct" | "manual" | "affiliate" | "ota" | "reseller" | "api_partner";
1210
+ sourceType: "internal" | "reseller" | "direct" | "manual" | "affiliate" | "ota" | "api_partner";
1211
1211
  externalBookingRef: string | null;
1212
1212
  communicationLanguage: string | null;
1213
1213
  personId: string | null;
@@ -1339,7 +1339,7 @@ export declare const octoRoutes: import("hono/hono-base").HonoBase<Env, {
1339
1339
  unitItems: {
1340
1340
  bookingItemId: string;
1341
1341
  title: string;
1342
- itemType: "other" | "unit" | "extra" | "service" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
1342
+ itemType: "service" | "other" | "unit" | "extra" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
1343
1343
  status: "draft" | "on_hold" | "confirmed" | "expired" | "cancelled" | "fulfilled";
1344
1344
  quantity: number;
1345
1345
  productId: string | null;
@@ -1412,7 +1412,7 @@ export declare const octoRoutes: import("hono/hono-base").HonoBase<Env, {
1412
1412
  expiredAt: string | null;
1413
1413
  utcRedeemedAt: string | null;
1414
1414
  extensions: {
1415
- sourceType: "internal" | "direct" | "manual" | "affiliate" | "ota" | "reseller" | "api_partner";
1415
+ sourceType: "internal" | "reseller" | "direct" | "manual" | "affiliate" | "ota" | "api_partner";
1416
1416
  externalBookingRef: string | null;
1417
1417
  communicationLanguage: string | null;
1418
1418
  personId: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAWjE,KAAK,GAAG,GAAG;IACT,SAAS,EAAE;QACT,EAAE,EAAE,kBAAkB,CAAA;QACtB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACF,CAAA;AAED,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BA8InB,CAAA;AAEJ,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAA"}
package/dist/routes.js CHANGED
@@ -1,14 +1,15 @@
1
1
  import { cancelBookingSchema, confirmBookingSchema, expireBookingSchema, extendBookingHoldSchema, recordBookingRedemptionSchema, reserveBookingSchema, } from "@voyantjs/bookings";
2
+ import { parseJsonBody, parseQuery } from "@voyantjs/hono";
2
3
  import { Hono } from "hono";
3
4
  import { octoService } from "./service.js";
4
5
  import { octoAvailabilityCalendarQuerySchema, octoAvailabilityListQuerySchema, octoBookingListQuerySchema, octoProductListQuerySchema, } from "./validation.js";
5
6
  export const octoRoutes = new Hono()
6
7
  .get("/products", async (c) => {
7
- const query = octoProductListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
8
+ const query = await parseQuery(c, octoProductListQuerySchema);
8
9
  return c.json(await octoService.listProjectedProducts(c.get("db"), query));
9
10
  })
10
11
  .get("/availability", async (c) => {
11
- const query = octoAvailabilityListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
12
+ const query = await parseQuery(c, octoAvailabilityListQuerySchema);
12
13
  return c.json(await octoService.listProjectedAvailability(c.get("db"), query));
13
14
  })
14
15
  .get("/products/:id", async (c) => {
@@ -19,13 +20,13 @@ export const octoRoutes = new Hono()
19
20
  })
20
21
  .get("/products/:id/availability", async (c) => {
21
22
  const query = octoAvailabilityListQuerySchema.parse({
22
- ...Object.fromEntries(new URL(c.req.url).searchParams),
23
+ ...(await parseQuery(c, octoAvailabilityListQuerySchema.partial())),
23
24
  productId: c.req.param("id"),
24
25
  });
25
26
  return c.json(await octoService.listProjectedAvailability(c.get("db"), query));
26
27
  })
27
28
  .get("/products/:id/calendar", async (c) => {
28
- const query = octoAvailabilityCalendarQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
29
+ const query = await parseQuery(c, octoAvailabilityCalendarQuerySchema);
29
30
  return c.json(await octoService.getProjectedAvailabilityCalendar(c.get("db"), c.req.param("id"), query));
30
31
  })
31
32
  .get("/availability/:id", async (c) => {
@@ -35,7 +36,7 @@ export const octoRoutes = new Hono()
35
36
  return c.json({ data: row });
36
37
  })
37
38
  .post("/bookings", async (c) => {
38
- const result = await octoService.reserveProjectedBooking(c.get("db"), reserveBookingSchema.parse(await c.req.json()), c.get("userId"));
39
+ const result = await octoService.reserveProjectedBooking(c.get("db"), await parseJsonBody(c, reserveBookingSchema), c.get("userId"));
39
40
  if ("booking" in result && result.booking) {
40
41
  return c.json({ data: result.booking }, 201);
41
42
  }
@@ -51,7 +52,7 @@ export const octoRoutes = new Hono()
51
52
  return c.json({ error: "Unable to reserve booking" }, 400);
52
53
  })
53
54
  .get("/bookings", async (c) => {
54
- const query = octoBookingListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
55
+ const query = await parseQuery(c, octoBookingListQuerySchema);
55
56
  return c.json(await octoService.listProjectedBookings(c.get("db"), query));
56
57
  })
57
58
  .get("/bookings/:id", async (c) => {
@@ -61,7 +62,7 @@ export const octoRoutes = new Hono()
61
62
  return c.json({ data: row });
62
63
  })
63
64
  .post("/bookings/:id/confirm", async (c) => {
64
- const result = await octoService.confirmProjectedBooking(c.get("db"), c.req.param("id"), confirmBookingSchema.parse(await c.req.json()), c.get("userId"));
65
+ const result = await octoService.confirmProjectedBooking(c.get("db"), c.req.param("id"), await parseJsonBody(c, confirmBookingSchema), c.get("userId"));
65
66
  if ("booking" in result && result.booking)
66
67
  return c.json({ data: result.booking });
67
68
  if (result.status === "not_found")
@@ -73,7 +74,7 @@ export const octoRoutes = new Hono()
73
74
  return c.json({ error: "Unable to confirm booking" }, 400);
74
75
  })
75
76
  .post("/bookings/:id/extend-hold", async (c) => {
76
- const result = await octoService.extendProjectedBookingHold(c.get("db"), c.req.param("id"), extendBookingHoldSchema.parse(await c.req.json()), c.get("userId"));
77
+ const result = await octoService.extendProjectedBookingHold(c.get("db"), c.req.param("id"), await parseJsonBody(c, extendBookingHoldSchema), c.get("userId"));
77
78
  if ("booking" in result && result.booking)
78
79
  return c.json({ data: result.booking });
79
80
  if (result.status === "not_found")
@@ -85,7 +86,7 @@ export const octoRoutes = new Hono()
85
86
  return c.json({ error: "Unable to extend booking hold" }, 400);
86
87
  })
87
88
  .post("/bookings/:id/expire", async (c) => {
88
- const result = await octoService.expireProjectedBooking(c.get("db"), c.req.param("id"), expireBookingSchema.parse(await c.req.json()), c.get("userId"));
89
+ const result = await octoService.expireProjectedBooking(c.get("db"), c.req.param("id"), await parseJsonBody(c, expireBookingSchema), c.get("userId"));
89
90
  if ("booking" in result && result.booking)
90
91
  return c.json({ data: result.booking });
91
92
  if (result.status === "not_found")
@@ -95,7 +96,7 @@ export const octoRoutes = new Hono()
95
96
  return c.json({ error: "Unable to expire booking" }, 400);
96
97
  })
97
98
  .post("/bookings/:id/cancel", async (c) => {
98
- const result = await octoService.cancelProjectedBooking(c.get("db"), c.req.param("id"), cancelBookingSchema.parse(await c.req.json()), c.get("userId"));
99
+ const result = await octoService.cancelProjectedBooking(c.get("db"), c.req.param("id"), await parseJsonBody(c, cancelBookingSchema), c.get("userId"));
99
100
  if ("booking" in result && result.booking)
100
101
  return c.json({ data: result.booking });
101
102
  if (result.status === "not_found")
@@ -113,7 +114,7 @@ export const octoRoutes = new Hono()
113
114
  });
114
115
  })
115
116
  .post("/bookings/:id/redeem", async (c) => {
116
- const result = await octoService.recordProjectedRedemption(c.get("db"), c.req.param("id"), recordBookingRedemptionSchema.parse(await c.req.json()), c.get("userId"));
117
+ const result = await octoService.recordProjectedRedemption(c.get("db"), c.req.param("id"), await parseJsonBody(c, recordBookingRedemptionSchema), c.get("userId"));
117
118
  if (!result) {
118
119
  return c.json({ error: "Booking, item, or participant not found" }, 404);
119
120
  }
@@ -17,7 +17,7 @@ export declare function getProjectedBookingById(db: PostgresJsDatabase, id: stri
17
17
  unitItems: {
18
18
  bookingItemId: string;
19
19
  title: string;
20
- itemType: "other" | "unit" | "extra" | "service" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
20
+ itemType: "service" | "other" | "unit" | "extra" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
21
21
  status: "draft" | "on_hold" | "confirmed" | "expired" | "cancelled" | "fulfilled";
22
22
  quantity: number;
23
23
  productId: string | null;
@@ -86,7 +86,7 @@ export declare function getProjectedBookingById(db: PostgresJsDatabase, id: stri
86
86
  expiredAt: string | null;
87
87
  utcRedeemedAt: string | null;
88
88
  extensions: {
89
- sourceType: "internal" | "direct" | "manual" | "affiliate" | "ota" | "reseller" | "api_partner";
89
+ sourceType: "internal" | "reseller" | "direct" | "manual" | "affiliate" | "ota" | "api_partner";
90
90
  externalBookingRef: string | null;
91
91
  communicationLanguage: string | null;
92
92
  personId: string | null;
@@ -112,7 +112,7 @@ export declare function listProjectedBookings(db: PostgresJsDatabase, query: Oct
112
112
  unitItems: {
113
113
  bookingItemId: string;
114
114
  title: string;
115
- itemType: "other" | "unit" | "extra" | "service" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
115
+ itemType: "service" | "other" | "unit" | "extra" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
116
116
  status: "draft" | "on_hold" | "confirmed" | "expired" | "cancelled" | "fulfilled";
117
117
  quantity: number;
118
118
  productId: string | null;
@@ -181,7 +181,7 @@ export declare function listProjectedBookings(db: PostgresJsDatabase, query: Oct
181
181
  expiredAt: string | null;
182
182
  utcRedeemedAt: string | null;
183
183
  extensions: {
184
- sourceType: "internal" | "direct" | "manual" | "affiliate" | "ota" | "reseller" | "api_partner";
184
+ sourceType: "internal" | "reseller" | "direct" | "manual" | "affiliate" | "ota" | "api_partner";
185
185
  externalBookingRef: string | null;
186
186
  communicationLanguage: string | null;
187
187
  personId: string | null;
@@ -214,7 +214,7 @@ export declare function reserveProjectedBooking(db: PostgresJsDatabase, data: Pa
214
214
  unitItems: {
215
215
  bookingItemId: string;
216
216
  title: string;
217
- itemType: "other" | "unit" | "extra" | "service" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
217
+ itemType: "service" | "other" | "unit" | "extra" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
218
218
  status: "draft" | "on_hold" | "confirmed" | "expired" | "cancelled" | "fulfilled";
219
219
  quantity: number;
220
220
  productId: string | null;
@@ -283,7 +283,7 @@ export declare function reserveProjectedBooking(db: PostgresJsDatabase, data: Pa
283
283
  expiredAt: string | null;
284
284
  utcRedeemedAt: string | null;
285
285
  extensions: {
286
- sourceType: "internal" | "direct" | "manual" | "affiliate" | "ota" | "reseller" | "api_partner";
286
+ sourceType: "internal" | "reseller" | "direct" | "manual" | "affiliate" | "ota" | "api_partner";
287
287
  externalBookingRef: string | null;
288
288
  communicationLanguage: string | null;
289
289
  personId: string | null;
@@ -313,7 +313,7 @@ export declare function confirmProjectedBooking(db: PostgresJsDatabase, id: stri
313
313
  unitItems: {
314
314
  bookingItemId: string;
315
315
  title: string;
316
- itemType: "other" | "unit" | "extra" | "service" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
316
+ itemType: "service" | "other" | "unit" | "extra" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
317
317
  status: "draft" | "on_hold" | "confirmed" | "expired" | "cancelled" | "fulfilled";
318
318
  quantity: number;
319
319
  productId: string | null;
@@ -382,7 +382,7 @@ export declare function confirmProjectedBooking(db: PostgresJsDatabase, id: stri
382
382
  expiredAt: string | null;
383
383
  utcRedeemedAt: string | null;
384
384
  extensions: {
385
- sourceType: "internal" | "direct" | "manual" | "affiliate" | "ota" | "reseller" | "api_partner";
385
+ sourceType: "internal" | "reseller" | "direct" | "manual" | "affiliate" | "ota" | "api_partner";
386
386
  externalBookingRef: string | null;
387
387
  communicationLanguage: string | null;
388
388
  personId: string | null;
@@ -412,7 +412,7 @@ export declare function extendProjectedBookingHold(db: PostgresJsDatabase, id: s
412
412
  unitItems: {
413
413
  bookingItemId: string;
414
414
  title: string;
415
- itemType: "other" | "unit" | "extra" | "service" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
415
+ itemType: "service" | "other" | "unit" | "extra" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
416
416
  status: "draft" | "on_hold" | "confirmed" | "expired" | "cancelled" | "fulfilled";
417
417
  quantity: number;
418
418
  productId: string | null;
@@ -481,7 +481,7 @@ export declare function extendProjectedBookingHold(db: PostgresJsDatabase, id: s
481
481
  expiredAt: string | null;
482
482
  utcRedeemedAt: string | null;
483
483
  extensions: {
484
- sourceType: "internal" | "direct" | "manual" | "affiliate" | "ota" | "reseller" | "api_partner";
484
+ sourceType: "internal" | "reseller" | "direct" | "manual" | "affiliate" | "ota" | "api_partner";
485
485
  externalBookingRef: string | null;
486
486
  communicationLanguage: string | null;
487
487
  personId: string | null;
@@ -511,7 +511,7 @@ export declare function expireProjectedBooking(db: PostgresJsDatabase, id: strin
511
511
  unitItems: {
512
512
  bookingItemId: string;
513
513
  title: string;
514
- itemType: "other" | "unit" | "extra" | "service" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
514
+ itemType: "service" | "other" | "unit" | "extra" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
515
515
  status: "draft" | "on_hold" | "confirmed" | "expired" | "cancelled" | "fulfilled";
516
516
  quantity: number;
517
517
  productId: string | null;
@@ -580,7 +580,7 @@ export declare function expireProjectedBooking(db: PostgresJsDatabase, id: strin
580
580
  expiredAt: string | null;
581
581
  utcRedeemedAt: string | null;
582
582
  extensions: {
583
- sourceType: "internal" | "direct" | "manual" | "affiliate" | "ota" | "reseller" | "api_partner";
583
+ sourceType: "internal" | "reseller" | "direct" | "manual" | "affiliate" | "ota" | "api_partner";
584
584
  externalBookingRef: string | null;
585
585
  communicationLanguage: string | null;
586
586
  personId: string | null;
@@ -610,7 +610,7 @@ export declare function cancelProjectedBooking(db: PostgresJsDatabase, id: strin
610
610
  unitItems: {
611
611
  bookingItemId: string;
612
612
  title: string;
613
- itemType: "other" | "unit" | "extra" | "service" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
613
+ itemType: "service" | "other" | "unit" | "extra" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
614
614
  status: "draft" | "on_hold" | "confirmed" | "expired" | "cancelled" | "fulfilled";
615
615
  quantity: number;
616
616
  productId: string | null;
@@ -679,7 +679,7 @@ export declare function cancelProjectedBooking(db: PostgresJsDatabase, id: strin
679
679
  expiredAt: string | null;
680
680
  utcRedeemedAt: string | null;
681
681
  extensions: {
682
- sourceType: "internal" | "direct" | "manual" | "affiliate" | "ota" | "reseller" | "api_partner";
682
+ sourceType: "internal" | "reseller" | "direct" | "manual" | "affiliate" | "ota" | "api_partner";
683
683
  externalBookingRef: string | null;
684
684
  communicationLanguage: string | null;
685
685
  personId: string | null;
@@ -726,7 +726,7 @@ export declare function recordProjectedRedemption(db: PostgresJsDatabase, bookin
726
726
  unitItems: {
727
727
  bookingItemId: string;
728
728
  title: string;
729
- itemType: "other" | "unit" | "extra" | "service" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
729
+ itemType: "service" | "other" | "unit" | "extra" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
730
730
  status: "draft" | "on_hold" | "confirmed" | "expired" | "cancelled" | "fulfilled";
731
731
  quantity: number;
732
732
  productId: string | null;
@@ -795,7 +795,7 @@ export declare function recordProjectedRedemption(db: PostgresJsDatabase, bookin
795
795
  expiredAt: string | null;
796
796
  utcRedeemedAt: string | null;
797
797
  extensions: {
798
- sourceType: "internal" | "direct" | "manual" | "affiliate" | "ota" | "reseller" | "api_partner";
798
+ sourceType: "internal" | "reseller" | "direct" | "manual" | "affiliate" | "ota" | "api_partner";
799
799
  externalBookingRef: string | null;
800
800
  communicationLanguage: string | null;
801
801
  personId: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voyantjs/octo",
3
- "version": "0.4.5",
3
+ "version": "0.6.0",
4
4
  "license": "FSL-1.1-Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {
@@ -29,13 +29,13 @@
29
29
  "drizzle-orm": "^0.45.2",
30
30
  "hono": "^4.12.10",
31
31
  "zod": "^4.3.6",
32
- "@voyantjs/availability": "0.4.5",
33
- "@voyantjs/bookings": "0.4.5",
34
- "@voyantjs/core": "0.4.5",
35
- "@voyantjs/db": "0.4.5",
36
- "@voyantjs/hono": "0.4.5",
37
- "@voyantjs/products": "0.4.5",
38
- "@voyantjs/transactions": "0.4.5"
32
+ "@voyantjs/availability": "0.6.0",
33
+ "@voyantjs/bookings": "0.6.0",
34
+ "@voyantjs/core": "0.6.0",
35
+ "@voyantjs/db": "0.6.0",
36
+ "@voyantjs/hono": "0.6.0",
37
+ "@voyantjs/products": "0.6.0",
38
+ "@voyantjs/transactions": "0.6.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "typescript": "^6.0.2",