@voyantjs/booking-requirements 0.3.0 → 0.3.1

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/index.d.ts CHANGED
@@ -2,10 +2,12 @@ import type { Module } from "@voyantjs/core";
2
2
  import type { HonoModule } from "@voyantjs/hono/module";
3
3
  import { bookingRequirementsService } from "./service.js";
4
4
  export type { BookingRequirementsRoutes } from "./routes.js";
5
+ export type { PublicBookingRequirementsRoutes } from "./routes-public.js";
5
6
  export declare const bookingRequirementsModule: Module;
6
7
  export declare const bookingRequirementsHonoModule: HonoModule;
8
+ export { publicBookingRequirementsRoutes } from "./routes-public.js";
7
9
  export type { BookingAnswer, BookingQuestionExtraTrigger, BookingQuestionOption, BookingQuestionOptionTrigger, BookingQuestionUnitTrigger, NewBookingAnswer, NewBookingQuestionExtraTrigger, NewBookingQuestionOption, NewBookingQuestionOptionTrigger, NewBookingQuestionUnitTrigger, NewOptionBookingQuestion, NewProductBookingQuestion, NewProductContactRequirement, OptionBookingQuestion, ProductBookingQuestion, ProductContactRequirement, } from "./schema.js";
8
10
  export { bookingAnswers, bookingAnswerTargetEnum, bookingQuestionExtraTriggers, bookingQuestionFieldTypeEnum, bookingQuestionOptions, bookingQuestionOptionTriggers, bookingQuestionTargetEnum, bookingQuestionTriggerModeEnum, bookingQuestionUnitTriggers, contactRequirementFieldEnum, contactRequirementScopeEnum, optionBookingQuestions, productBookingQuestions, productContactRequirements, } from "./schema.js";
9
- export { bookingAnswerListQuerySchema, bookingAnswerTargetSchema, bookingQuestionExtraTriggerListQuerySchema, bookingQuestionFieldTypeSchema, bookingQuestionOptionListQuerySchema, bookingQuestionOptionTriggerListQuerySchema, bookingQuestionTargetSchema, bookingQuestionTriggerModeSchema, bookingQuestionUnitTriggerListQuerySchema, contactRequirementFieldSchema, contactRequirementScopeSchema, insertBookingAnswerSchema, insertBookingQuestionExtraTriggerSchema, insertBookingQuestionOptionSchema, insertBookingQuestionOptionTriggerSchema, insertBookingQuestionUnitTriggerSchema, insertOptionBookingQuestionSchema, insertProductBookingQuestionSchema, insertProductContactRequirementSchema, optionBookingQuestionListQuerySchema, productBookingQuestionListQuerySchema, productContactRequirementListQuerySchema, updateBookingAnswerSchema, updateBookingQuestionExtraTriggerSchema, updateBookingQuestionOptionSchema, updateBookingQuestionOptionTriggerSchema, updateBookingQuestionUnitTriggerSchema, updateOptionBookingQuestionSchema, updateProductBookingQuestionSchema, updateProductContactRequirementSchema, } from "./validation.js";
11
+ export { bookingAnswerListQuerySchema, bookingAnswerTargetSchema, bookingQuestionExtraTriggerListQuerySchema, bookingQuestionFieldTypeSchema, bookingQuestionOptionListQuerySchema, bookingQuestionOptionTriggerListQuerySchema, bookingQuestionTargetSchema, bookingQuestionTriggerModeSchema, bookingQuestionUnitTriggerListQuerySchema, contactRequirementFieldSchema, contactRequirementScopeSchema, insertBookingAnswerSchema, insertBookingQuestionExtraTriggerSchema, insertBookingQuestionOptionSchema, insertBookingQuestionOptionTriggerSchema, insertBookingQuestionUnitTriggerSchema, insertOptionBookingQuestionSchema, insertProductBookingQuestionSchema, insertProductContactRequirementSchema, optionBookingQuestionListQuerySchema, productBookingQuestionListQuerySchema, productContactRequirementListQuerySchema, publicTransportRequirementSummarySchema, publicTransportRequirementsQuerySchema, publicTransportRequirementsSchema, transportRequirementFieldSchema, updateBookingAnswerSchema, updateBookingQuestionExtraTriggerSchema, updateBookingQuestionOptionSchema, updateBookingQuestionOptionTriggerSchema, updateBookingQuestionUnitTriggerSchema, updateOptionBookingQuestionSchema, updateProductBookingQuestionSchema, updateProductContactRequirementSchema, } from "./validation.js";
10
12
  export { bookingRequirementsService };
11
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,KAAK,EAAE,UAAU,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CAAiC,EACjC,wCAAwC,EACxC,sCAAsC,EACtC,iCAAiC,EACjC,kCAAkC,EAClC,qCAAqC,EACrC,oCAAoC,EACpC,qCAAqC,EACrC,wCAAwC,EACxC,uCAAuC,EACvC,sCAAsC,EACtC,iCAAiC,EACjC,+BAA+B,EAC/B,yBAAyB,EACzB,uCAAuC,EACvC,iCAAiC,EACjC,wCAAwC,EACxC,sCAAsC,EACtC,iCAAiC,EACjC,kCAAkC,EAClC,qCAAqC,GACtC,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,0BAA0B,EAAE,CAAA"}
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { bookingRequirementsRoutes } from "./routes.js";
2
+ import { publicBookingRequirementsRoutes } from "./routes-public.js";
2
3
  import { bookingRequirementsService } from "./service.js";
3
4
  export const bookingRequirementsModule = {
4
5
  name: "booking-requirements",
@@ -6,7 +7,9 @@ export const bookingRequirementsModule = {
6
7
  export const bookingRequirementsHonoModule = {
7
8
  module: bookingRequirementsModule,
8
9
  routes: bookingRequirementsRoutes,
10
+ publicRoutes: publicBookingRequirementsRoutes,
9
11
  };
12
+ export { publicBookingRequirementsRoutes } from "./routes-public.js";
10
13
  export { bookingAnswers, bookingAnswerTargetEnum, bookingQuestionExtraTriggers, bookingQuestionFieldTypeEnum, bookingQuestionOptions, bookingQuestionOptionTriggers, bookingQuestionTargetEnum, bookingQuestionTriggerModeEnum, bookingQuestionUnitTriggers, contactRequirementFieldEnum, contactRequirementScopeEnum, optionBookingQuestions, productBookingQuestions, productContactRequirements, } from "./schema.js";
11
- export { bookingAnswerListQuerySchema, bookingAnswerTargetSchema, bookingQuestionExtraTriggerListQuerySchema, bookingQuestionFieldTypeSchema, bookingQuestionOptionListQuerySchema, bookingQuestionOptionTriggerListQuerySchema, bookingQuestionTargetSchema, bookingQuestionTriggerModeSchema, bookingQuestionUnitTriggerListQuerySchema, contactRequirementFieldSchema, contactRequirementScopeSchema, insertBookingAnswerSchema, insertBookingQuestionExtraTriggerSchema, insertBookingQuestionOptionSchema, insertBookingQuestionOptionTriggerSchema, insertBookingQuestionUnitTriggerSchema, insertOptionBookingQuestionSchema, insertProductBookingQuestionSchema, insertProductContactRequirementSchema, optionBookingQuestionListQuerySchema, productBookingQuestionListQuerySchema, productContactRequirementListQuerySchema, updateBookingAnswerSchema, updateBookingQuestionExtraTriggerSchema, updateBookingQuestionOptionSchema, updateBookingQuestionOptionTriggerSchema, updateBookingQuestionUnitTriggerSchema, updateOptionBookingQuestionSchema, updateProductBookingQuestionSchema, updateProductContactRequirementSchema, } from "./validation.js";
14
+ export { bookingAnswerListQuerySchema, bookingAnswerTargetSchema, bookingQuestionExtraTriggerListQuerySchema, bookingQuestionFieldTypeSchema, bookingQuestionOptionListQuerySchema, bookingQuestionOptionTriggerListQuerySchema, bookingQuestionTargetSchema, bookingQuestionTriggerModeSchema, bookingQuestionUnitTriggerListQuerySchema, contactRequirementFieldSchema, contactRequirementScopeSchema, insertBookingAnswerSchema, insertBookingQuestionExtraTriggerSchema, insertBookingQuestionOptionSchema, insertBookingQuestionOptionTriggerSchema, insertBookingQuestionUnitTriggerSchema, insertOptionBookingQuestionSchema, insertProductBookingQuestionSchema, insertProductContactRequirementSchema, optionBookingQuestionListQuerySchema, productBookingQuestionListQuerySchema, productContactRequirementListQuerySchema, publicTransportRequirementSummarySchema, publicTransportRequirementsQuerySchema, publicTransportRequirementsSchema, transportRequirementFieldSchema, updateBookingAnswerSchema, updateBookingQuestionExtraTriggerSchema, updateBookingQuestionOptionSchema, updateBookingQuestionOptionTriggerSchema, updateBookingQuestionUnitTriggerSchema, updateOptionBookingQuestionSchema, updateProductBookingQuestionSchema, updateProductContactRequirementSchema, } from "./validation.js";
12
15
  export { bookingRequirementsService };
@@ -0,0 +1,59 @@
1
+ import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
2
+ type Env = {
3
+ Variables: {
4
+ db: PostgresJsDatabase;
5
+ userId?: string;
6
+ };
7
+ };
8
+ export declare const publicBookingRequirementsRoutes: import("hono/hono-base").HonoBase<Env, {
9
+ "/products/:productId/transport-requirements": {
10
+ $get: {
11
+ input: {
12
+ param: {
13
+ productId: string;
14
+ };
15
+ };
16
+ output: {
17
+ error: string;
18
+ };
19
+ outputFormat: "json";
20
+ status: 404;
21
+ } | {
22
+ input: {
23
+ param: {
24
+ productId: string;
25
+ };
26
+ };
27
+ output: {
28
+ data: {
29
+ productId: string;
30
+ optionId: string | null;
31
+ hasTransport: boolean;
32
+ requiresPassengerDocuments: boolean;
33
+ requiresPassport: boolean;
34
+ requiresNationality: boolean;
35
+ requiresDateOfBirth: boolean;
36
+ requiredFields: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
37
+ fieldsByScope: {
38
+ booking: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
39
+ lead_traveler: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
40
+ participant: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
41
+ booker: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
42
+ };
43
+ requirements: {
44
+ fieldKey: "date_of_birth" | "nationality" | "passport_number" | "passport_expiry";
45
+ scope: "booking" | "lead_traveler" | "participant" | "booker";
46
+ isRequired: boolean;
47
+ perParticipant: boolean;
48
+ notes: string | null;
49
+ }[];
50
+ };
51
+ };
52
+ outputFormat: "json";
53
+ status: import("hono/utils/http-status").ContentfulStatusCode;
54
+ };
55
+ };
56
+ }, "/", "/products/:productId/transport-requirements">;
57
+ export type PublicBookingRequirementsRoutes = typeof publicBookingRequirementsRoutes;
58
+ export {};
59
+ //# sourceMappingURL=routes-public.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes-public.d.ts","sourceRoot":"","sources":["../src/routes-public.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAMjE,KAAK,GAAG,GAAG;IACT,SAAS,EAAE;QACT,EAAE,EAAE,kBAAkB,CAAA;QACtB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACF,CAAA;AAED,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sDAmB3C,CAAA;AAED,MAAM,MAAM,+BAA+B,GAAG,OAAO,+BAA+B,CAAA"}
@@ -0,0 +1,11 @@
1
+ import { Hono } from "hono";
2
+ import { bookingRequirementsService } from "./service.js";
3
+ import { publicTransportRequirementsQuerySchema } from "./validation.js";
4
+ export const publicBookingRequirementsRoutes = new Hono().get("/products/:productId/transport-requirements", async (c) => {
5
+ const query = publicTransportRequirementsQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
6
+ const result = await bookingRequirementsService.getPublicTransportRequirements(c.get("db"), c.req.param("productId"), query);
7
+ if (!result) {
8
+ return c.json({ error: "Product not found" }, 404);
9
+ }
10
+ return c.json({ data: result });
11
+ });
@@ -0,0 +1,29 @@
1
+ import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
2
+ import type { PublicTransportRequirementsQuery } from "./service-shared.js";
3
+ declare const transportFieldKeys: readonly ["date_of_birth", "nationality", "passport_number", "passport_expiry"];
4
+ type TransportFieldKey = (typeof transportFieldKeys)[number];
5
+ export declare function getPublicTransportRequirements(db: PostgresJsDatabase, productId: string, query: PublicTransportRequirementsQuery): Promise<{
6
+ productId: string;
7
+ optionId: string | null;
8
+ hasTransport: boolean;
9
+ requiresPassengerDocuments: boolean;
10
+ requiresPassport: boolean;
11
+ requiresNationality: boolean;
12
+ requiresDateOfBirth: boolean;
13
+ requiredFields: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
14
+ fieldsByScope: {
15
+ booking: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
16
+ lead_traveler: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
17
+ participant: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
18
+ booker: ("date_of_birth" | "nationality" | "passport_number" | "passport_expiry")[];
19
+ };
20
+ requirements: {
21
+ fieldKey: TransportFieldKey;
22
+ scope: "booking" | "lead_traveler" | "participant" | "booker";
23
+ isRequired: boolean;
24
+ perParticipant: boolean;
25
+ notes: string | null;
26
+ }[];
27
+ } | null>;
28
+ export {};
29
+ //# sourceMappingURL=service-public.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-public.d.ts","sourceRoot":"","sources":["../src/service-public.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAGjE,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,qBAAqB,CAAA;AAE3E,QAAA,MAAM,kBAAkB,iFAKd,CAAA;AAEV,KAAK,iBAAiB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAA;AAgB5D,wBAAsB,8BAA8B,CAClD,EAAE,EAAE,kBAAkB,EACtB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,gCAAgC;;;;;;;;;;;;;;;;kBAiET,iBAAiB;;;;;;UAOhD"}
@@ -0,0 +1,66 @@
1
+ import { productCapabilities, products } from "@voyantjs/products/schema";
2
+ import { and, asc, eq, isNull, or } from "drizzle-orm";
3
+ import { productContactRequirements } from "./schema.js";
4
+ const transportFieldKeys = [
5
+ "date_of_birth",
6
+ "nationality",
7
+ "passport_number",
8
+ "passport_expiry",
9
+ ];
10
+ function uniqueSorted(values) {
11
+ return Array.from(new Set(values)).sort();
12
+ }
13
+ function summarizeFields(rows, scope) {
14
+ return uniqueSorted(rows.filter((row) => row.scope === scope).map((row) => row.fieldKey));
15
+ }
16
+ export async function getPublicTransportRequirements(db, productId, query) {
17
+ const [product, capabilityRows, requirementRows] = await Promise.all([
18
+ db
19
+ .select()
20
+ .from(products)
21
+ .where(eq(products.id, productId))
22
+ .limit(1)
23
+ .then((rows) => rows[0] ?? null),
24
+ db
25
+ .select({ capability: productCapabilities.capability })
26
+ .from(productCapabilities)
27
+ .where(and(eq(productCapabilities.productId, productId), eq(productCapabilities.enabled, true)))
28
+ .orderBy(asc(productCapabilities.capability)),
29
+ db
30
+ .select()
31
+ .from(productContactRequirements)
32
+ .where(and(eq(productContactRequirements.productId, productId), eq(productContactRequirements.active, true), query.optionId
33
+ ? or(eq(productContactRequirements.optionId, query.optionId), isNull(productContactRequirements.optionId))
34
+ : isNull(productContactRequirements.optionId)))
35
+ .orderBy(asc(productContactRequirements.sortOrder), asc(productContactRequirements.createdAt)),
36
+ ]);
37
+ if (!product) {
38
+ return null;
39
+ }
40
+ const relevantRows = requirementRows.filter((row) => transportFieldKeys.includes(row.fieldKey));
41
+ const requiredRows = relevantRows.filter((row) => row.isRequired);
42
+ const capabilitySet = new Set(capabilityRows.map((row) => row.capability));
43
+ return {
44
+ productId,
45
+ optionId: query.optionId ?? null,
46
+ hasTransport: product.bookingMode === "transfer" || capabilitySet.has("transport"),
47
+ requiresPassengerDocuments: requiredRows.length > 0,
48
+ requiresPassport: requiredRows.some((row) => row.fieldKey === "passport_number" || row.fieldKey === "passport_expiry"),
49
+ requiresNationality: requiredRows.some((row) => row.fieldKey === "nationality"),
50
+ requiresDateOfBirth: requiredRows.some((row) => row.fieldKey === "date_of_birth"),
51
+ requiredFields: uniqueSorted(requiredRows.map((row) => row.fieldKey)),
52
+ fieldsByScope: {
53
+ booking: summarizeFields(relevantRows, "booking"),
54
+ lead_traveler: summarizeFields(relevantRows, "lead_traveler"),
55
+ participant: summarizeFields(relevantRows, "participant"),
56
+ booker: summarizeFields(relevantRows, "booker"),
57
+ },
58
+ requirements: relevantRows.map((row) => ({
59
+ fieldKey: row.fieldKey,
60
+ scope: row.scope,
61
+ isRequired: row.isRequired,
62
+ perParticipant: row.perParticipant,
63
+ notes: row.notes ?? null,
64
+ })),
65
+ };
66
+ }
@@ -1,6 +1,8 @@
1
1
  import type { z } from "zod";
2
- import type { bookingAnswerListQuerySchema, bookingQuestionExtraTriggerListQuerySchema, bookingQuestionOptionListQuerySchema, bookingQuestionOptionTriggerListQuerySchema, bookingQuestionUnitTriggerListQuerySchema, insertBookingAnswerSchema, insertBookingQuestionExtraTriggerSchema, insertBookingQuestionOptionSchema, insertBookingQuestionOptionTriggerSchema, insertBookingQuestionUnitTriggerSchema, insertOptionBookingQuestionSchema, insertProductBookingQuestionSchema, insertProductContactRequirementSchema, optionBookingQuestionListQuerySchema, productBookingQuestionListQuerySchema, productContactRequirementListQuerySchema, updateBookingAnswerSchema, updateBookingQuestionExtraTriggerSchema, updateBookingQuestionOptionSchema, updateBookingQuestionOptionTriggerSchema, updateBookingQuestionUnitTriggerSchema, updateOptionBookingQuestionSchema, updateProductBookingQuestionSchema, updateProductContactRequirementSchema } from "./validation.js";
2
+ import type { bookingAnswerListQuerySchema, bookingQuestionExtraTriggerListQuerySchema, bookingQuestionOptionListQuerySchema, bookingQuestionOptionTriggerListQuerySchema, bookingQuestionUnitTriggerListQuerySchema, insertBookingAnswerSchema, insertBookingQuestionExtraTriggerSchema, insertBookingQuestionOptionSchema, insertBookingQuestionOptionTriggerSchema, insertBookingQuestionUnitTriggerSchema, insertOptionBookingQuestionSchema, insertProductBookingQuestionSchema, insertProductContactRequirementSchema, optionBookingQuestionListQuerySchema, productBookingQuestionListQuerySchema, productContactRequirementListQuerySchema, publicTransportRequirementsQuerySchema, publicTransportRequirementsSchema, updateBookingAnswerSchema, updateBookingQuestionExtraTriggerSchema, updateBookingQuestionOptionSchema, updateBookingQuestionOptionTriggerSchema, updateBookingQuestionUnitTriggerSchema, updateOptionBookingQuestionSchema, updateProductBookingQuestionSchema, updateProductContactRequirementSchema } from "./validation.js";
3
3
  export type ProductContactRequirementListQuery = z.infer<typeof productContactRequirementListQuerySchema>;
4
+ export type PublicTransportRequirementsQuery = z.infer<typeof publicTransportRequirementsQuerySchema>;
5
+ export type PublicTransportRequirements = z.infer<typeof publicTransportRequirementsSchema>;
4
6
  export type ProductBookingQuestionListQuery = z.infer<typeof productBookingQuestionListQuerySchema>;
5
7
  export type OptionBookingQuestionListQuery = z.infer<typeof optionBookingQuestionListQuerySchema>;
6
8
  export type BookingQuestionOptionListQuery = z.infer<typeof bookingQuestionOptionListQuerySchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"service-shared.d.ts","sourceRoot":"","sources":["../src/service-shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B,OAAO,KAAK,EACV,4BAA4B,EAC5B,0CAA0C,EAC1C,oCAAoC,EACpC,2CAA2C,EAC3C,yCAAyC,EACzC,yBAAyB,EACzB,uCAAuC,EACvC,iCAAiC,EACjC,wCAAwC,EACxC,sCAAsC,EACtC,iCAAiC,EACjC,kCAAkC,EAClC,qCAAqC,EACrC,oCAAoC,EACpC,qCAAqC,EACrC,wCAAwC,EACxC,yBAAyB,EACzB,uCAAuC,EACvC,iCAAiC,EACjC,wCAAwC,EACxC,sCAAsC,EACtC,iCAAiC,EACjC,kCAAkC,EAClC,qCAAqC,EACtC,MAAM,iBAAiB,CAAA;AAExB,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CACtD,OAAO,wCAAwC,CAChD,CAAA;AACD,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qCAAqC,CAAC,CAAA;AACnG,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAA;AACjG,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAA;AACjG,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,KAAK,CACvD,OAAO,yCAAyC,CACjD,CAAA;AACD,MAAM,MAAM,qCAAqC,GAAG,CAAC,CAAC,KAAK,CACzD,OAAO,2CAA2C,CACnD,CAAA;AACD,MAAM,MAAM,oCAAoC,GAAG,CAAC,CAAC,KAAK,CACxD,OAAO,0CAA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O,iCAAiC,CAAC,CAAA;AAChG,MAAM,MAAM,qCAAqC,GAAG,CAAC,CAAC,KAAK,CACzD,OAAO,sCAAsC,CAC9C,CAAA;AACD,MAAM,MAAM,qCAAqC,GAAG,CAAC,CAAC,KAAK,CACzD,OAAO,sCAAsC,CAC9C,CAAA;AACD,MAAM,MAAM,uCAAuC,GAAG,CAAC,CAAC,KAAK,CAC3D,OAAO,wCAAwC,CAChD,CAAA;AACD,MAAM,MAAM,uCAAuC,GAAG,CAAC,CAAC,KAAK,CAC3D,OAAO,wCAAwC,CAChD,CAAA;AACD,MAAM,MAAM,sCAAsC,GAAG,CAAC,CAAC,KAAK,CAC1D,OAAO,uCAAuC,CAC/C,CAAA;AACD,MAAM,MAAM,sCAAsC,GAAG,CAAC,CAAC,KAAK,CAC1D,OAAO,uCAAuC,CAC/C,CAAA;AACD,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAChF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAEhF,wBAAsB,QAAQ,CAAC,CAAC,SAAS,MAAM,EAC7C,SAAS,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,EACvB,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,EAC7C,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM;;;;;GAIf"}
package/dist/service.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { createBookingAnswer, deleteBookingAnswer, getBookingAnswerById, listBookingAnswers, updateBookingAnswer } from "./service-answers.js";
2
+ import { getPublicTransportRequirements } from "./service-public.js";
2
3
  import { createBookingQuestionExtraTrigger, createBookingQuestionOption, createBookingQuestionOptionTrigger, createBookingQuestionUnitTrigger, createOptionBookingQuestion, createProductBookingQuestion, createProductContactRequirement, deleteBookingQuestionExtraTrigger, deleteBookingQuestionOption, deleteBookingQuestionOptionTrigger, deleteBookingQuestionUnitTrigger, deleteOptionBookingQuestion, deleteProductBookingQuestion, deleteProductContactRequirement, getBookingQuestionExtraTriggerById, getBookingQuestionOptionById, getBookingQuestionOptionTriggerById, getBookingQuestionUnitTriggerById, getOptionBookingQuestionById, getProductBookingQuestionById, getProductContactRequirementById, listBookingQuestionExtraTriggers, listBookingQuestionOptions, listBookingQuestionOptionTriggers, listBookingQuestionUnitTriggers, listOptionBookingQuestions, listProductBookingQuestions, listProductContactRequirements, updateBookingQuestionExtraTrigger, updateBookingQuestionOption, updateBookingQuestionOptionTrigger, updateBookingQuestionUnitTrigger, updateOptionBookingQuestion, updateProductBookingQuestion, updateProductContactRequirement } from "./service-questions.js";
3
4
  export declare const bookingRequirementsService: {
5
+ getPublicTransportRequirements: typeof getPublicTransportRequirements;
4
6
  listProductContactRequirements: typeof listProductContactRequirements;
5
7
  getProductContactRequirementById: typeof getProductContactRequirementById;
6
8
  createProductContactRequirement: typeof createProductContactRequirement;
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,iCAAiC,EACjC,2BAA2B,EAC3B,kCAAkC,EAClC,gCAAgC,EAChC,2BAA2B,EAC3B,4BAA4B,EAC5B,+BAA+B,EAC/B,iCAAiC,EACjC,2BAA2B,EAC3B,kCAAkC,EAClC,gCAAgC,EAChC,2BAA2B,EAC3B,4BAA4B,EAC5B,+BAA+B,EAC/B,kCAAkC,EAClC,4BAA4B,EAC5B,mCAAmC,EACnC,iCAAiC,EACjC,4BAA4B,EAC5B,6BAA6B,EAC7B,gCAAgC,EAChC,gCAAgC,EAChC,0BAA0B,EAC1B,iCAAiC,EACjC,+BAA+B,EAC/B,0BAA0B,EAC1B,2BAA2B,EAC3B,8BAA8B,EAC9B,iCAAiC,EACjC,2BAA2B,EAC3B,kCAAkC,EAClC,gCAAgC,EAChC,2BAA2B,EAC3B,4BAA4B,EAC5B,+BAA+B,EAChC,MAAM,wBAAwB,CAAA;AAE/B,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCtC,CAAA"}
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAA;AACpE,OAAO,EACL,iCAAiC,EACjC,2BAA2B,EAC3B,kCAAkC,EAClC,gCAAgC,EAChC,2BAA2B,EAC3B,4BAA4B,EAC5B,+BAA+B,EAC/B,iCAAiC,EACjC,2BAA2B,EAC3B,kCAAkC,EAClC,gCAAgC,EAChC,2BAA2B,EAC3B,4BAA4B,EAC5B,+BAA+B,EAC/B,kCAAkC,EAClC,4BAA4B,EAC5B,mCAAmC,EACnC,iCAAiC,EACjC,4BAA4B,EAC5B,6BAA6B,EAC7B,gCAAgC,EAChC,gCAAgC,EAChC,0BAA0B,EAC1B,iCAAiC,EACjC,+BAA+B,EAC/B,0BAA0B,EAC1B,2BAA2B,EAC3B,8BAA8B,EAC9B,iCAAiC,EACjC,2BAA2B,EAC3B,kCAAkC,EAClC,gCAAgC,EAChC,2BAA2B,EAC3B,4BAA4B,EAC5B,+BAA+B,EAChC,MAAM,wBAAwB,CAAA;AAE/B,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0CtC,CAAA"}
package/dist/service.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import { createBookingAnswer, deleteBookingAnswer, getBookingAnswerById, listBookingAnswers, updateBookingAnswer, } from "./service-answers.js";
2
+ import { getPublicTransportRequirements } from "./service-public.js";
2
3
  import { createBookingQuestionExtraTrigger, createBookingQuestionOption, createBookingQuestionOptionTrigger, createBookingQuestionUnitTrigger, createOptionBookingQuestion, createProductBookingQuestion, createProductContactRequirement, deleteBookingQuestionExtraTrigger, deleteBookingQuestionOption, deleteBookingQuestionOptionTrigger, deleteBookingQuestionUnitTrigger, deleteOptionBookingQuestion, deleteProductBookingQuestion, deleteProductContactRequirement, getBookingQuestionExtraTriggerById, getBookingQuestionOptionById, getBookingQuestionOptionTriggerById, getBookingQuestionUnitTriggerById, getOptionBookingQuestionById, getProductBookingQuestionById, getProductContactRequirementById, listBookingQuestionExtraTriggers, listBookingQuestionOptions, listBookingQuestionOptionTriggers, listBookingQuestionUnitTriggers, listOptionBookingQuestions, listProductBookingQuestions, listProductContactRequirements, updateBookingQuestionExtraTrigger, updateBookingQuestionOption, updateBookingQuestionOptionTrigger, updateBookingQuestionUnitTrigger, updateOptionBookingQuestion, updateProductBookingQuestion, updateProductContactRequirement, } from "./service-questions.js";
3
4
  export const bookingRequirementsService = {
5
+ getPublicTransportRequirements,
4
6
  listProductContactRequirements,
5
7
  getProductContactRequirementById,
6
8
  createProductContactRequirement,
@@ -155,6 +155,90 @@ export declare const productContactRequirementListQuerySchema: z.ZodObject<{
155
155
  false: "false";
156
156
  }>, z.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
157
157
  }, z.core.$strip>;
158
+ export declare const publicTransportRequirementsQuerySchema: z.ZodObject<{
159
+ optionId: z.ZodOptional<z.ZodString>;
160
+ }, z.core.$strip>;
161
+ export declare const transportRequirementFieldSchema: z.ZodEnum<{
162
+ date_of_birth: "date_of_birth";
163
+ nationality: "nationality";
164
+ passport_number: "passport_number";
165
+ passport_expiry: "passport_expiry";
166
+ }>;
167
+ export declare const publicTransportRequirementSummarySchema: z.ZodObject<{
168
+ fieldKey: z.ZodEnum<{
169
+ date_of_birth: "date_of_birth";
170
+ nationality: "nationality";
171
+ passport_number: "passport_number";
172
+ passport_expiry: "passport_expiry";
173
+ }>;
174
+ scope: z.ZodEnum<{
175
+ booking: "booking";
176
+ lead_traveler: "lead_traveler";
177
+ participant: "participant";
178
+ booker: "booker";
179
+ }>;
180
+ isRequired: z.ZodBoolean;
181
+ perParticipant: z.ZodBoolean;
182
+ notes: z.ZodNullable<z.ZodString>;
183
+ }, z.core.$strip>;
184
+ export declare const publicTransportRequirementsSchema: z.ZodObject<{
185
+ productId: z.ZodString;
186
+ optionId: z.ZodNullable<z.ZodString>;
187
+ hasTransport: z.ZodBoolean;
188
+ requiresPassengerDocuments: z.ZodBoolean;
189
+ requiresPassport: z.ZodBoolean;
190
+ requiresNationality: z.ZodBoolean;
191
+ requiresDateOfBirth: z.ZodBoolean;
192
+ requiredFields: z.ZodArray<z.ZodEnum<{
193
+ date_of_birth: "date_of_birth";
194
+ nationality: "nationality";
195
+ passport_number: "passport_number";
196
+ passport_expiry: "passport_expiry";
197
+ }>>;
198
+ fieldsByScope: z.ZodObject<{
199
+ booking: z.ZodArray<z.ZodEnum<{
200
+ date_of_birth: "date_of_birth";
201
+ nationality: "nationality";
202
+ passport_number: "passport_number";
203
+ passport_expiry: "passport_expiry";
204
+ }>>;
205
+ lead_traveler: z.ZodArray<z.ZodEnum<{
206
+ date_of_birth: "date_of_birth";
207
+ nationality: "nationality";
208
+ passport_number: "passport_number";
209
+ passport_expiry: "passport_expiry";
210
+ }>>;
211
+ participant: z.ZodArray<z.ZodEnum<{
212
+ date_of_birth: "date_of_birth";
213
+ nationality: "nationality";
214
+ passport_number: "passport_number";
215
+ passport_expiry: "passport_expiry";
216
+ }>>;
217
+ booker: z.ZodArray<z.ZodEnum<{
218
+ date_of_birth: "date_of_birth";
219
+ nationality: "nationality";
220
+ passport_number: "passport_number";
221
+ passport_expiry: "passport_expiry";
222
+ }>>;
223
+ }, z.core.$strip>;
224
+ requirements: z.ZodArray<z.ZodObject<{
225
+ fieldKey: z.ZodEnum<{
226
+ date_of_birth: "date_of_birth";
227
+ nationality: "nationality";
228
+ passport_number: "passport_number";
229
+ passport_expiry: "passport_expiry";
230
+ }>;
231
+ scope: z.ZodEnum<{
232
+ booking: "booking";
233
+ lead_traveler: "lead_traveler";
234
+ participant: "participant";
235
+ booker: "booker";
236
+ }>;
237
+ isRequired: z.ZodBoolean;
238
+ perParticipant: z.ZodBoolean;
239
+ notes: z.ZodNullable<z.ZodString>;
240
+ }, z.core.$strip>>;
241
+ }, z.core.$strip>;
158
242
  export declare const productBookingQuestionCoreSchema: z.ZodObject<{
159
243
  productId: z.ZodString;
160
244
  code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -1 +1 @@
1
- {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAOvB,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;EAcxC,CAAA;AAEF,eAAO,MAAM,6BAA6B;;;;;EAKxC,CAAA;AAEF,eAAO,MAAM,2BAA2B;;;;;;;EAOtC,CAAA;AAEF,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;EAczC,CAAA;AAEF,eAAO,MAAM,gCAAgC;;;;EAA6C,CAAA;AAC1F,eAAO,MAAM,yBAAyB;;;;EAA8C,CAAA;AAEpF,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAU9C,CAAA;AAEF,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAsC,CAAA;AACxF,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAgD,CAAA;AAClG,eAAO,MAAM,wCAAwC;;;;;;;;;;;iBAInD,CAAA;AAEF,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAa3C,CAAA;AAEF,eAAO,MAAM,kCAAkC;;;;;;;;;;;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AA0C;;;;;;;;;;;;iBAKrD,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;iBAclC,CAAA;AAEF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;iBAA0B,CAAA;AAChE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;iBAAoC,CAAA;AAC1E,eAAO,MAAM,4BAA4B;;;;;;;;;;;;iBAMvC,CAAA"}
@@ -68,6 +68,39 @@ export const productContactRequirementListQuerySchema = paginationSchema.extend(
68
68
  optionId: z.string().optional(),
69
69
  active: booleanQueryParam.optional(),
70
70
  });
71
+ export const publicTransportRequirementsQuerySchema = z.object({
72
+ optionId: z.string().optional(),
73
+ });
74
+ export const transportRequirementFieldSchema = z.enum([
75
+ "date_of_birth",
76
+ "nationality",
77
+ "passport_number",
78
+ "passport_expiry",
79
+ ]);
80
+ export const publicTransportRequirementSummarySchema = z.object({
81
+ fieldKey: transportRequirementFieldSchema,
82
+ scope: contactRequirementScopeSchema,
83
+ isRequired: z.boolean(),
84
+ perParticipant: z.boolean(),
85
+ notes: z.string().nullable(),
86
+ });
87
+ export const publicTransportRequirementsSchema = z.object({
88
+ productId: z.string(),
89
+ optionId: z.string().nullable(),
90
+ hasTransport: z.boolean(),
91
+ requiresPassengerDocuments: z.boolean(),
92
+ requiresPassport: z.boolean(),
93
+ requiresNationality: z.boolean(),
94
+ requiresDateOfBirth: z.boolean(),
95
+ requiredFields: z.array(transportRequirementFieldSchema),
96
+ fieldsByScope: z.object({
97
+ booking: z.array(transportRequirementFieldSchema),
98
+ lead_traveler: z.array(transportRequirementFieldSchema),
99
+ participant: z.array(transportRequirementFieldSchema),
100
+ booker: z.array(transportRequirementFieldSchema),
101
+ }),
102
+ requirements: z.array(publicTransportRequirementSummarySchema),
103
+ });
71
104
  export const productBookingQuestionCoreSchema = z.object({
72
105
  productId: z.string(),
73
106
  code: z.string().max(100).nullable().optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voyantjs/booking-requirements",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "license": "FSL-1.1-Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {
@@ -19,20 +19,25 @@
19
19
  "./routes": {
20
20
  "types": "./dist/routes.d.ts",
21
21
  "import": "./dist/routes.js"
22
+ },
23
+ "./public-routes": {
24
+ "types": "./dist/routes-public.d.ts",
25
+ "import": "./dist/routes-public.js"
22
26
  }
23
27
  },
24
28
  "dependencies": {
25
29
  "drizzle-orm": "^0.45.2",
26
30
  "hono": "^4.12.10",
27
31
  "zod": "^4.3.6",
28
- "@voyantjs/core": "0.3.0",
29
- "@voyantjs/db": "0.3.0",
30
- "@voyantjs/hono": "0.3.0"
32
+ "@voyantjs/core": "0.3.1",
33
+ "@voyantjs/db": "0.3.1",
34
+ "@voyantjs/hono": "0.3.1",
35
+ "@voyantjs/products": "0.3.1"
31
36
  },
32
37
  "devDependencies": {
33
38
  "typescript": "^6.0.2",
34
- "@voyantjs/bookings": "0.3.0",
35
- "@voyantjs/products": "0.3.0",
39
+ "@voyantjs/bookings": "0.3.1",
40
+ "@voyantjs/products": "0.3.1",
36
41
  "@voyantjs/voyant-typescript-config": "0.1.0"
37
42
  },
38
43
  "files": [