@voyant-travel/inventory 0.1.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/LICENSE +201 -0
- package/dist/action-ledger-drift.d.ts +29 -0
- package/dist/action-ledger-drift.d.ts.map +1 -0
- package/dist/action-ledger-drift.js +338 -0
- package/dist/action-ledger.d.ts +104 -0
- package/dist/action-ledger.d.ts.map +1 -0
- package/dist/action-ledger.js +100 -0
- package/dist/authoring/builder.d.ts +37 -0
- package/dist/authoring/builder.d.ts.map +1 -0
- package/dist/authoring/builder.js +248 -0
- package/dist/authoring/clone-content.d.ts +38 -0
- package/dist/authoring/clone-content.d.ts.map +1 -0
- package/dist/authoring/clone-content.js +367 -0
- package/dist/authoring/clone-pricing.d.ts +9 -0
- package/dist/authoring/clone-pricing.d.ts.map +1 -0
- package/dist/authoring/clone-pricing.js +242 -0
- package/dist/authoring/clone.d.ts +45 -0
- package/dist/authoring/clone.d.ts.map +1 -0
- package/dist/authoring/clone.js +142 -0
- package/dist/authoring/errors.d.ts +21 -0
- package/dist/authoring/errors.d.ts.map +1 -0
- package/dist/authoring/errors.js +13 -0
- package/dist/authoring/extension.d.ts +248 -0
- package/dist/authoring/extension.d.ts.map +1 -0
- package/dist/authoring/extension.js +116 -0
- package/dist/authoring/index.d.ts +12 -0
- package/dist/authoring/index.d.ts.map +1 -0
- package/dist/authoring/index.js +11 -0
- package/dist/authoring/schema.d.ts +85 -0
- package/dist/authoring/schema.d.ts.map +1 -0
- package/dist/authoring/schema.js +16 -0
- package/dist/authoring/service.d.ts +28 -0
- package/dist/authoring/service.d.ts.map +1 -0
- package/dist/authoring/service.js +66 -0
- package/dist/authoring/spec.d.ts +524 -0
- package/dist/authoring/spec.d.ts.map +1 -0
- package/dist/authoring/spec.js +167 -0
- package/dist/authoring/validate.d.ts +17 -0
- package/dist/authoring/validate.d.ts.map +1 -0
- package/dist/authoring/validate.js +83 -0
- package/dist/authoring.d.ts +2 -0
- package/dist/authoring.d.ts.map +1 -0
- package/dist/authoring.js +1 -0
- package/dist/booking-engine/handler-support.d.ts +91 -0
- package/dist/booking-engine/handler-support.d.ts.map +1 -0
- package/dist/booking-engine/handler-support.js +355 -0
- package/dist/booking-engine/handler.d.ts +404 -0
- package/dist/booking-engine/handler.d.ts.map +1 -0
- package/dist/booking-engine/handler.js +398 -0
- package/dist/booking-engine/index.d.ts +8 -0
- package/dist/booking-engine/index.d.ts.map +1 -0
- package/dist/booking-engine/index.js +7 -0
- package/dist/booking-engine.d.ts +2 -0
- package/dist/booking-engine.d.ts.map +1 -0
- package/dist/booking-engine.js +1 -0
- package/dist/booking-extension.d.ts +278 -0
- package/dist/booking-extension.d.ts.map +1 -0
- package/dist/booking-extension.js +161 -0
- package/dist/catalog-policy-departures.d.ts +52 -0
- package/dist/catalog-policy-departures.d.ts.map +1 -0
- package/dist/catalog-policy-departures.js +169 -0
- package/dist/catalog-policy-destinations.d.ts +43 -0
- package/dist/catalog-policy-destinations.d.ts.map +1 -0
- package/dist/catalog-policy-destinations.js +165 -0
- package/dist/catalog-policy-pricing.d.ts +55 -0
- package/dist/catalog-policy-pricing.d.ts.map +1 -0
- package/dist/catalog-policy-pricing.js +109 -0
- package/dist/catalog-policy-promotions.d.ts +52 -0
- package/dist/catalog-policy-promotions.d.ts.map +1 -0
- package/dist/catalog-policy-promotions.js +270 -0
- package/dist/catalog-policy-taxonomy.d.ts +51 -0
- package/dist/catalog-policy-taxonomy.d.ts.map +1 -0
- package/dist/catalog-policy-taxonomy.js +191 -0
- package/dist/catalog-policy.d.ts +33 -0
- package/dist/catalog-policy.d.ts.map +1 -0
- package/dist/catalog-policy.js +733 -0
- package/dist/content-shape.d.ts +15 -0
- package/dist/content-shape.d.ts.map +1 -0
- package/dist/content-shape.js +28 -0
- package/dist/draft-shape.d.ts +43 -0
- package/dist/draft-shape.d.ts.map +1 -0
- package/dist/draft-shape.js +48 -0
- package/dist/events.d.ts +37 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +32 -0
- package/dist/extras/catalog-policy.d.ts +30 -0
- package/dist/extras/catalog-policy.d.ts.map +1 -0
- package/dist/extras/catalog-policy.js +319 -0
- package/dist/extras/content-shape.d.ts +5 -0
- package/dist/extras/content-shape.d.ts.map +1 -0
- package/dist/extras/content-shape.js +13 -0
- package/dist/extras/draft-shape.d.ts +34 -0
- package/dist/extras/draft-shape.d.ts.map +1 -0
- package/dist/extras/draft-shape.js +69 -0
- package/dist/extras/routes.d.ts +380 -0
- package/dist/extras/routes.d.ts.map +1 -0
- package/dist/extras/routes.js +59 -0
- package/dist/extras/schema-sourced-content.d.ts +254 -0
- package/dist/extras/schema-sourced-content.d.ts.map +1 -0
- package/dist/extras/schema-sourced-content.js +45 -0
- package/dist/extras/schema.d.ts +628 -0
- package/dist/extras/schema.d.ts.map +1 -0
- package/dist/extras/schema.js +87 -0
- package/dist/extras/service-catalog-plane.d.ts +77 -0
- package/dist/extras/service-catalog-plane.d.ts.map +1 -0
- package/dist/extras/service-catalog-plane.js +219 -0
- package/dist/extras/service-content-synthesizer.d.ts +41 -0
- package/dist/extras/service-content-synthesizer.d.ts.map +1 -0
- package/dist/extras/service-content-synthesizer.js +138 -0
- package/dist/extras/service-content.d.ts +48 -0
- package/dist/extras/service-content.d.ts.map +1 -0
- package/dist/extras/service-content.js +253 -0
- package/dist/extras/service.d.ts +185 -0
- package/dist/extras/service.d.ts.map +1 -0
- package/dist/extras/service.js +96 -0
- package/dist/extras/validation.d.ts +437 -0
- package/dist/extras/validation.d.ts.map +1 -0
- package/dist/extras/validation.js +149 -0
- package/dist/extras.d.ts +267 -0
- package/dist/extras.d.ts.map +1 -0
- package/dist/extras.js +19 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/interface.d.ts +5869 -0
- package/dist/interface.d.ts.map +1 -0
- package/dist/interface.js +54 -0
- package/dist/public-routes.d.ts +2 -0
- package/dist/public-routes.d.ts.map +1 -0
- package/dist/public-routes.js +1 -0
- package/dist/public-validation.d.ts +2 -0
- package/dist/public-validation.d.ts.map +1 -0
- package/dist/public-validation.js +1 -0
- package/dist/read-model.d.ts +25 -0
- package/dist/read-model.d.ts.map +1 -0
- package/dist/read-model.js +99 -0
- package/dist/route-env.d.ts +22 -0
- package/dist/route-env.d.ts.map +1 -0
- package/dist/route-env.js +1 -0
- package/dist/routes-associations.d.ts +164 -0
- package/dist/routes-associations.d.ts.map +1 -0
- package/dist/routes-associations.js +100 -0
- package/dist/routes-catalog.d.ts +436 -0
- package/dist/routes-catalog.d.ts.map +1 -0
- package/dist/routes-catalog.js +104 -0
- package/dist/routes-configuration.d.ts +773 -0
- package/dist/routes-configuration.d.ts.map +1 -0
- package/dist/routes-configuration.js +364 -0
- package/dist/routes-content.d.ts +74 -0
- package/dist/routes-content.d.ts.map +1 -0
- package/dist/routes-content.js +117 -0
- package/dist/routes-core.d.ts +331 -0
- package/dist/routes-core.d.ts.map +1 -0
- package/dist/routes-core.js +95 -0
- package/dist/routes-itinerary.d.ts +759 -0
- package/dist/routes-itinerary.d.ts.map +1 -0
- package/dist/routes-itinerary.js +387 -0
- package/dist/routes-maintenance.d.ts +32 -0
- package/dist/routes-maintenance.d.ts.map +1 -0
- package/dist/routes-maintenance.js +14 -0
- package/dist/routes-media.d.ts +634 -0
- package/dist/routes-media.d.ts.map +1 -0
- package/dist/routes-media.js +245 -0
- package/dist/routes-merchandising.d.ts +1120 -0
- package/dist/routes-merchandising.d.ts.map +1 -0
- package/dist/routes-merchandising.js +377 -0
- package/dist/routes-options.d.ts +363 -0
- package/dist/routes-options.d.ts.map +1 -0
- package/dist/routes-options.js +173 -0
- package/dist/routes-public.d.ts +776 -0
- package/dist/routes-public.d.ts.map +1 -0
- package/dist/routes-public.js +119 -0
- package/dist/routes-translations.d.ts +489 -0
- package/dist/routes-translations.d.ts.map +1 -0
- package/dist/routes-translations.js +258 -0
- package/dist/routes.d.ts +5097 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +64 -0
- package/dist/schema-core.d.ts +1238 -0
- package/dist/schema-core.d.ts.map +1 -0
- package/dist/schema-core.js +157 -0
- package/dist/schema-itinerary.d.ts +1169 -0
- package/dist/schema-itinerary.d.ts.map +1 -0
- package/dist/schema-itinerary.js +130 -0
- package/dist/schema-relations.d.ts +117 -0
- package/dist/schema-relations.d.ts.map +1 -0
- package/dist/schema-relations.js +192 -0
- package/dist/schema-settings.d.ts +1800 -0
- package/dist/schema-settings.d.ts.map +1 -0
- package/dist/schema-settings.js +220 -0
- package/dist/schema-shared.d.ts +15 -0
- package/dist/schema-shared.d.ts.map +1 -0
- package/dist/schema-shared.js +91 -0
- package/dist/schema-sourced-content.d.ts +262 -0
- package/dist/schema-sourced-content.d.ts.map +1 -0
- package/dist/schema-sourced-content.js +69 -0
- package/dist/schema-taxonomy.d.ts +1363 -0
- package/dist/schema-taxonomy.d.ts.map +1 -0
- package/dist/schema-taxonomy.js +203 -0
- package/dist/schema.d.ts +10 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +9 -0
- package/dist/service-aggregates.d.ts +29 -0
- package/dist/service-aggregates.d.ts.map +1 -0
- package/dist/service-aggregates.js +56 -0
- package/dist/service-catalog-plane-destinations.d.ts +30 -0
- package/dist/service-catalog-plane-destinations.d.ts.map +1 -0
- package/dist/service-catalog-plane-destinations.js +143 -0
- package/dist/service-catalog-plane-taxonomy.d.ts +73 -0
- package/dist/service-catalog-plane-taxonomy.d.ts.map +1 -0
- package/dist/service-catalog-plane-taxonomy.js +242 -0
- package/dist/service-catalog-plane.d.ts +179 -0
- package/dist/service-catalog-plane.d.ts.map +1 -0
- package/dist/service-catalog-plane.js +431 -0
- package/dist/service-catalog.d.ts +251 -0
- package/dist/service-catalog.d.ts.map +1 -0
- package/dist/service-catalog.js +517 -0
- package/dist/service-configuration.d.ts +261 -0
- package/dist/service-configuration.d.ts.map +1 -0
- package/dist/service-configuration.js +343 -0
- package/dist/service-content-owned.d.ts +68 -0
- package/dist/service-content-owned.d.ts.map +1 -0
- package/dist/service-content-owned.js +329 -0
- package/dist/service-content-synthesizer.d.ts +90 -0
- package/dist/service-content-synthesizer.d.ts.map +1 -0
- package/dist/service-content-synthesizer.js +178 -0
- package/dist/service-content.d.ts +106 -0
- package/dist/service-content.d.ts.map +1 -0
- package/dist/service-content.js +388 -0
- package/dist/service-core.d.ts +194 -0
- package/dist/service-core.d.ts.map +1 -0
- package/dist/service-core.js +213 -0
- package/dist/service-delivery-formats.d.ts +58 -0
- package/dist/service-delivery-formats.d.ts.map +1 -0
- package/dist/service-delivery-formats.js +107 -0
- package/dist/service-destinations.d.ts +223 -0
- package/dist/service-destinations.d.ts.map +1 -0
- package/dist/service-destinations.js +310 -0
- package/dist/service-itinerary-history.d.ts +457 -0
- package/dist/service-itinerary-history.d.ts.map +1 -0
- package/dist/service-itinerary-history.js +135 -0
- package/dist/service-itinerary.d.ts +1149 -0
- package/dist/service-itinerary.d.ts.map +1 -0
- package/dist/service-itinerary.js +419 -0
- package/dist/service-media.d.ts +272 -0
- package/dist/service-media.d.ts.map +1 -0
- package/dist/service-media.js +320 -0
- package/dist/service-merchandising.d.ts +184 -0
- package/dist/service-merchandising.d.ts.map +1 -0
- package/dist/service-merchandising.js +181 -0
- package/dist/service-option-translations.d.ts +268 -0
- package/dist/service-option-translations.d.ts.map +1 -0
- package/dist/service-option-translations.js +300 -0
- package/dist/service-options.d.ts +181 -0
- package/dist/service-options.d.ts.map +1 -0
- package/dist/service-options.js +179 -0
- package/dist/service-product-destinations.d.ts +37 -0
- package/dist/service-product-destinations.d.ts.map +1 -0
- package/dist/service-product-destinations.js +94 -0
- package/dist/service-public.d.ts +664 -0
- package/dist/service-public.d.ts.map +1 -0
- package/dist/service-public.js +374 -0
- package/dist/service-taxonomy.d.ts +197 -0
- package/dist/service-taxonomy.d.ts.map +1 -0
- package/dist/service-taxonomy.js +221 -0
- package/dist/service.d.ts +3929 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +28 -0
- package/dist/tasks/brochure-printers.d.ts +31 -0
- package/dist/tasks/brochure-printers.d.ts.map +1 -0
- package/dist/tasks/brochure-printers.js +149 -0
- package/dist/tasks/brochure-templates.d.ts +36 -0
- package/dist/tasks/brochure-templates.d.ts.map +1 -0
- package/dist/tasks/brochure-templates.js +110 -0
- package/dist/tasks/brochures.d.ts +43 -0
- package/dist/tasks/brochures.d.ts.map +1 -0
- package/dist/tasks/brochures.js +72 -0
- package/dist/tasks/generate-pdf.d.ts +8 -0
- package/dist/tasks/generate-pdf.d.ts.map +1 -0
- package/dist/tasks/generate-pdf.js +106 -0
- package/dist/tasks/index.d.ts +5 -0
- package/dist/tasks/index.d.ts.map +1 -0
- package/dist/tasks/index.js +4 -0
- package/dist/tasks/pdf-text.d.ts +2 -0
- package/dist/tasks/pdf-text.d.ts.map +1 -0
- package/dist/tasks/pdf-text.js +40 -0
- package/dist/tasks.d.ts +2 -0
- package/dist/tasks.d.ts.map +1 -0
- package/dist/tasks.js +1 -0
- package/dist/validation-catalog.d.ts +2 -0
- package/dist/validation-catalog.d.ts.map +1 -0
- package/dist/validation-catalog.js +3 -0
- package/dist/validation-config.d.ts +2 -0
- package/dist/validation-config.d.ts.map +1 -0
- package/dist/validation-config.js +3 -0
- package/dist/validation-content.d.ts +2 -0
- package/dist/validation-content.d.ts.map +1 -0
- package/dist/validation-content.js +3 -0
- package/dist/validation-core.d.ts +2 -0
- package/dist/validation-core.d.ts.map +1 -0
- package/dist/validation-core.js +3 -0
- package/dist/validation-public.d.ts +2 -0
- package/dist/validation-public.d.ts.map +1 -0
- package/dist/validation-public.js +3 -0
- package/dist/validation-shared.d.ts +2 -0
- package/dist/validation-shared.d.ts.map +1 -0
- package/dist/validation-shared.js +3 -0
- package/dist/validation.d.ts +2 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +3 -0
- package/package.json +204 -0
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
import type { Env } from "./route-env.js";
|
|
2
|
+
export declare const productOptionRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
3
|
+
"/options": {
|
|
4
|
+
$get: {
|
|
5
|
+
input: {};
|
|
6
|
+
output: {
|
|
7
|
+
data: {
|
|
8
|
+
id: string;
|
|
9
|
+
productId: string;
|
|
10
|
+
name: string;
|
|
11
|
+
code: string | null;
|
|
12
|
+
description: string | null;
|
|
13
|
+
status: "draft" | "active" | "archived";
|
|
14
|
+
isDefault: boolean;
|
|
15
|
+
sortOrder: number;
|
|
16
|
+
availableFrom: string | null;
|
|
17
|
+
availableTo: string | null;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
updatedAt: string;
|
|
20
|
+
}[];
|
|
21
|
+
total: number;
|
|
22
|
+
limit: number;
|
|
23
|
+
offset: number;
|
|
24
|
+
};
|
|
25
|
+
outputFormat: "json";
|
|
26
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
} & {
|
|
30
|
+
"/options/:optionId": {
|
|
31
|
+
$get: {
|
|
32
|
+
input: {
|
|
33
|
+
param: {
|
|
34
|
+
optionId: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
output: {
|
|
38
|
+
error: string;
|
|
39
|
+
};
|
|
40
|
+
outputFormat: "json";
|
|
41
|
+
status: 404;
|
|
42
|
+
} | {
|
|
43
|
+
input: {
|
|
44
|
+
param: {
|
|
45
|
+
optionId: string;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
output: {
|
|
49
|
+
data: {
|
|
50
|
+
id: string;
|
|
51
|
+
productId: string;
|
|
52
|
+
name: string;
|
|
53
|
+
code: string | null;
|
|
54
|
+
description: string | null;
|
|
55
|
+
status: "draft" | "active" | "archived";
|
|
56
|
+
isDefault: boolean;
|
|
57
|
+
sortOrder: number;
|
|
58
|
+
availableFrom: string | null;
|
|
59
|
+
availableTo: string | null;
|
|
60
|
+
createdAt: string;
|
|
61
|
+
updatedAt: string;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
outputFormat: "json";
|
|
65
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
} & {
|
|
69
|
+
"/:id/options": {
|
|
70
|
+
$post: {
|
|
71
|
+
input: {
|
|
72
|
+
param: {
|
|
73
|
+
id: string;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
output: {
|
|
77
|
+
error: string;
|
|
78
|
+
};
|
|
79
|
+
outputFormat: "json";
|
|
80
|
+
status: 404;
|
|
81
|
+
} | {
|
|
82
|
+
input: {
|
|
83
|
+
param: {
|
|
84
|
+
id: string;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
output: {
|
|
88
|
+
data: {
|
|
89
|
+
id: string;
|
|
90
|
+
name: string;
|
|
91
|
+
status: "draft" | "active" | "archived";
|
|
92
|
+
description: string | null;
|
|
93
|
+
createdAt: string;
|
|
94
|
+
updatedAt: string;
|
|
95
|
+
code: string | null;
|
|
96
|
+
productId: string;
|
|
97
|
+
isDefault: boolean;
|
|
98
|
+
sortOrder: number;
|
|
99
|
+
availableFrom: string | null;
|
|
100
|
+
availableTo: string | null;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
outputFormat: "json";
|
|
104
|
+
status: 201;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
} & {
|
|
108
|
+
"/options/:optionId": {
|
|
109
|
+
$patch: {
|
|
110
|
+
input: {
|
|
111
|
+
param: {
|
|
112
|
+
optionId: string;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
output: {
|
|
116
|
+
error: string;
|
|
117
|
+
};
|
|
118
|
+
outputFormat: "json";
|
|
119
|
+
status: 404;
|
|
120
|
+
} | {
|
|
121
|
+
input: {
|
|
122
|
+
param: {
|
|
123
|
+
optionId: string;
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
output: {
|
|
127
|
+
data: {
|
|
128
|
+
id: string;
|
|
129
|
+
productId: string;
|
|
130
|
+
name: string;
|
|
131
|
+
code: string | null;
|
|
132
|
+
description: string | null;
|
|
133
|
+
status: "draft" | "active" | "archived";
|
|
134
|
+
isDefault: boolean;
|
|
135
|
+
sortOrder: number;
|
|
136
|
+
availableFrom: string | null;
|
|
137
|
+
availableTo: string | null;
|
|
138
|
+
createdAt: string;
|
|
139
|
+
updatedAt: string;
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
outputFormat: "json";
|
|
143
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
} & {
|
|
147
|
+
"/options/:optionId": {
|
|
148
|
+
$delete: {
|
|
149
|
+
input: {
|
|
150
|
+
param: {
|
|
151
|
+
optionId: string;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
output: {
|
|
155
|
+
error: string;
|
|
156
|
+
};
|
|
157
|
+
outputFormat: "json";
|
|
158
|
+
status: 404;
|
|
159
|
+
} | {
|
|
160
|
+
input: {
|
|
161
|
+
param: {
|
|
162
|
+
optionId: string;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
output: {
|
|
166
|
+
success: true;
|
|
167
|
+
};
|
|
168
|
+
outputFormat: "json";
|
|
169
|
+
status: 200;
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
} & {
|
|
173
|
+
"/units": {
|
|
174
|
+
$get: {
|
|
175
|
+
input: {};
|
|
176
|
+
output: {
|
|
177
|
+
data: {
|
|
178
|
+
id: string;
|
|
179
|
+
optionId: string;
|
|
180
|
+
name: string;
|
|
181
|
+
code: string | null;
|
|
182
|
+
description: string | null;
|
|
183
|
+
unitType: "other" | "person" | "group" | "room" | "vehicle" | "service";
|
|
184
|
+
minQuantity: number | null;
|
|
185
|
+
maxQuantity: number | null;
|
|
186
|
+
minAge: number | null;
|
|
187
|
+
maxAge: number | null;
|
|
188
|
+
occupancyMin: number | null;
|
|
189
|
+
occupancyMax: number | null;
|
|
190
|
+
isRequired: boolean;
|
|
191
|
+
isHidden: boolean;
|
|
192
|
+
sortOrder: number;
|
|
193
|
+
createdAt: string;
|
|
194
|
+
updatedAt: string;
|
|
195
|
+
}[];
|
|
196
|
+
total: number;
|
|
197
|
+
limit: number;
|
|
198
|
+
offset: number;
|
|
199
|
+
};
|
|
200
|
+
outputFormat: "json";
|
|
201
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
} & {
|
|
205
|
+
"/units/:unitId": {
|
|
206
|
+
$get: {
|
|
207
|
+
input: {
|
|
208
|
+
param: {
|
|
209
|
+
unitId: string;
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
output: {
|
|
213
|
+
error: string;
|
|
214
|
+
};
|
|
215
|
+
outputFormat: "json";
|
|
216
|
+
status: 404;
|
|
217
|
+
} | {
|
|
218
|
+
input: {
|
|
219
|
+
param: {
|
|
220
|
+
unitId: string;
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
output: {
|
|
224
|
+
data: {
|
|
225
|
+
id: string;
|
|
226
|
+
optionId: string;
|
|
227
|
+
name: string;
|
|
228
|
+
code: string | null;
|
|
229
|
+
description: string | null;
|
|
230
|
+
unitType: "other" | "person" | "group" | "room" | "vehicle" | "service";
|
|
231
|
+
minQuantity: number | null;
|
|
232
|
+
maxQuantity: number | null;
|
|
233
|
+
minAge: number | null;
|
|
234
|
+
maxAge: number | null;
|
|
235
|
+
occupancyMin: number | null;
|
|
236
|
+
occupancyMax: number | null;
|
|
237
|
+
isRequired: boolean;
|
|
238
|
+
isHidden: boolean;
|
|
239
|
+
sortOrder: number;
|
|
240
|
+
createdAt: string;
|
|
241
|
+
updatedAt: string;
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
outputFormat: "json";
|
|
245
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
} & {
|
|
249
|
+
"/options/:optionId/units": {
|
|
250
|
+
$post: {
|
|
251
|
+
input: {
|
|
252
|
+
param: {
|
|
253
|
+
optionId: string;
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
output: {
|
|
257
|
+
error: string;
|
|
258
|
+
};
|
|
259
|
+
outputFormat: "json";
|
|
260
|
+
status: 404;
|
|
261
|
+
} | {
|
|
262
|
+
input: {
|
|
263
|
+
param: {
|
|
264
|
+
optionId: string;
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
output: {
|
|
268
|
+
data: {
|
|
269
|
+
id: string;
|
|
270
|
+
name: string;
|
|
271
|
+
description: string | null;
|
|
272
|
+
createdAt: string;
|
|
273
|
+
updatedAt: string;
|
|
274
|
+
code: string | null;
|
|
275
|
+
sortOrder: number;
|
|
276
|
+
optionId: string;
|
|
277
|
+
unitType: "other" | "person" | "group" | "room" | "vehicle" | "service";
|
|
278
|
+
minQuantity: number | null;
|
|
279
|
+
maxQuantity: number | null;
|
|
280
|
+
minAge: number | null;
|
|
281
|
+
maxAge: number | null;
|
|
282
|
+
occupancyMin: number | null;
|
|
283
|
+
occupancyMax: number | null;
|
|
284
|
+
isRequired: boolean;
|
|
285
|
+
isHidden: boolean;
|
|
286
|
+
};
|
|
287
|
+
};
|
|
288
|
+
outputFormat: "json";
|
|
289
|
+
status: 201;
|
|
290
|
+
};
|
|
291
|
+
};
|
|
292
|
+
} & {
|
|
293
|
+
"/units/:unitId": {
|
|
294
|
+
$patch: {
|
|
295
|
+
input: {
|
|
296
|
+
param: {
|
|
297
|
+
unitId: string;
|
|
298
|
+
};
|
|
299
|
+
};
|
|
300
|
+
output: {
|
|
301
|
+
error: string;
|
|
302
|
+
};
|
|
303
|
+
outputFormat: "json";
|
|
304
|
+
status: 404;
|
|
305
|
+
} | {
|
|
306
|
+
input: {
|
|
307
|
+
param: {
|
|
308
|
+
unitId: string;
|
|
309
|
+
};
|
|
310
|
+
};
|
|
311
|
+
output: {
|
|
312
|
+
data: {
|
|
313
|
+
id: string;
|
|
314
|
+
optionId: string;
|
|
315
|
+
name: string;
|
|
316
|
+
code: string | null;
|
|
317
|
+
description: string | null;
|
|
318
|
+
unitType: "other" | "person" | "group" | "room" | "vehicle" | "service";
|
|
319
|
+
minQuantity: number | null;
|
|
320
|
+
maxQuantity: number | null;
|
|
321
|
+
minAge: number | null;
|
|
322
|
+
maxAge: number | null;
|
|
323
|
+
occupancyMin: number | null;
|
|
324
|
+
occupancyMax: number | null;
|
|
325
|
+
isRequired: boolean;
|
|
326
|
+
isHidden: boolean;
|
|
327
|
+
sortOrder: number;
|
|
328
|
+
createdAt: string;
|
|
329
|
+
updatedAt: string;
|
|
330
|
+
};
|
|
331
|
+
};
|
|
332
|
+
outputFormat: "json";
|
|
333
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
334
|
+
};
|
|
335
|
+
};
|
|
336
|
+
} & {
|
|
337
|
+
"/units/:unitId": {
|
|
338
|
+
$delete: {
|
|
339
|
+
input: {
|
|
340
|
+
param: {
|
|
341
|
+
unitId: string;
|
|
342
|
+
};
|
|
343
|
+
};
|
|
344
|
+
output: {
|
|
345
|
+
error: string;
|
|
346
|
+
};
|
|
347
|
+
outputFormat: "json";
|
|
348
|
+
status: 404;
|
|
349
|
+
} | {
|
|
350
|
+
input: {
|
|
351
|
+
param: {
|
|
352
|
+
unitId: string;
|
|
353
|
+
};
|
|
354
|
+
};
|
|
355
|
+
output: {
|
|
356
|
+
success: true;
|
|
357
|
+
};
|
|
358
|
+
outputFormat: "json";
|
|
359
|
+
status: 200;
|
|
360
|
+
};
|
|
361
|
+
};
|
|
362
|
+
}, "/", "/units/:unitId">;
|
|
363
|
+
//# sourceMappingURL=routes-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes-options.d.ts","sourceRoot":"","sources":["../src/routes-options.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AAIzC,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAsM5B,CAAA"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { parseJsonBody, parseQuery } from "@voyant-travel/hono";
|
|
2
|
+
import { Hono } from "hono";
|
|
3
|
+
import { appendProductMutationLedgerEntry, changedMutationFields } from "./action-ledger.js";
|
|
4
|
+
import { emitProductContentChanged } from "./events.js";
|
|
5
|
+
import { productsService } from "./service.js";
|
|
6
|
+
import * as validation from "./validation.js";
|
|
7
|
+
export const productOptionRoutes = new Hono()
|
|
8
|
+
// ==========================================================================
|
|
9
|
+
// Options
|
|
10
|
+
// ==========================================================================
|
|
11
|
+
// GET /options — List options
|
|
12
|
+
.get("/options", async (c) => {
|
|
13
|
+
const query = parseQuery(c, validation.productOptionListQuerySchema);
|
|
14
|
+
return c.json(await productsService.listOptions(c.get("db"), query));
|
|
15
|
+
})
|
|
16
|
+
// GET /options/:optionId — Get single option
|
|
17
|
+
.get("/options/:optionId", async (c) => {
|
|
18
|
+
const row = await productsService.getOptionById(c.get("db"), c.req.param("optionId"));
|
|
19
|
+
if (!row) {
|
|
20
|
+
return c.json({ error: "Product option not found" }, 404);
|
|
21
|
+
}
|
|
22
|
+
return c.json({ data: row });
|
|
23
|
+
})
|
|
24
|
+
// POST /:id/options — Create option for product
|
|
25
|
+
.post("/:id/options", async (c) => {
|
|
26
|
+
const productId = c.req.param("id");
|
|
27
|
+
const body = await parseJsonBody(c, validation.insertProductOptionSchema);
|
|
28
|
+
const row = await productsService.createOption(c.get("db"), productId, body);
|
|
29
|
+
if (!row) {
|
|
30
|
+
return c.json({ error: "Product not found" }, 404);
|
|
31
|
+
}
|
|
32
|
+
await appendProductMutationLedgerEntry(c, {
|
|
33
|
+
action: "create",
|
|
34
|
+
productId,
|
|
35
|
+
changedFields: changedMutationFields(body, null, row),
|
|
36
|
+
subject: "product option",
|
|
37
|
+
actionName: "product.option.create",
|
|
38
|
+
routeOrToolName: "products.option.create",
|
|
39
|
+
});
|
|
40
|
+
await emitProductContentChanged(c.get("eventBus"), { id: productId, axis: "option" });
|
|
41
|
+
return c.json({ data: row }, 201);
|
|
42
|
+
})
|
|
43
|
+
// PATCH /options/:optionId — Update option
|
|
44
|
+
.patch("/options/:optionId", async (c) => {
|
|
45
|
+
const optionId = c.req.param("optionId");
|
|
46
|
+
const body = await parseJsonBody(c, validation.updateProductOptionSchema);
|
|
47
|
+
const before = await productsService.getOptionById(c.get("db"), optionId);
|
|
48
|
+
if (!before) {
|
|
49
|
+
return c.json({ error: "Product option not found" }, 404);
|
|
50
|
+
}
|
|
51
|
+
const row = await productsService.updateOption(c.get("db"), optionId, body);
|
|
52
|
+
if (!row) {
|
|
53
|
+
return c.json({ error: "Product option not found" }, 404);
|
|
54
|
+
}
|
|
55
|
+
await appendProductMutationLedgerEntry(c, {
|
|
56
|
+
action: "update",
|
|
57
|
+
productId: row.productId,
|
|
58
|
+
changedFields: changedMutationFields(body, before, row),
|
|
59
|
+
subject: "product option",
|
|
60
|
+
actionName: "product.option.update",
|
|
61
|
+
routeOrToolName: "products.option.update",
|
|
62
|
+
});
|
|
63
|
+
if (row.productId) {
|
|
64
|
+
await emitProductContentChanged(c.get("eventBus"), { id: row.productId, axis: "option" });
|
|
65
|
+
}
|
|
66
|
+
return c.json({ data: row });
|
|
67
|
+
})
|
|
68
|
+
// DELETE /options/:optionId — Delete option
|
|
69
|
+
.delete("/options/:optionId", async (c) => {
|
|
70
|
+
const optionId = c.req.param("optionId");
|
|
71
|
+
const before = await productsService.getOptionById(c.get("db"), optionId);
|
|
72
|
+
if (!before) {
|
|
73
|
+
return c.json({ error: "Product option not found" }, 404);
|
|
74
|
+
}
|
|
75
|
+
const row = await productsService.deleteOption(c.get("db"), optionId);
|
|
76
|
+
if (!row) {
|
|
77
|
+
return c.json({ error: "Product option not found" }, 404);
|
|
78
|
+
}
|
|
79
|
+
await appendProductMutationLedgerEntry(c, {
|
|
80
|
+
action: "delete",
|
|
81
|
+
productId: before.productId,
|
|
82
|
+
changedFields: [],
|
|
83
|
+
subject: "product option",
|
|
84
|
+
actionName: "product.option.delete",
|
|
85
|
+
routeOrToolName: "products.option.delete",
|
|
86
|
+
});
|
|
87
|
+
await emitProductContentChanged(c.get("eventBus"), { id: before.productId, axis: "option" });
|
|
88
|
+
return c.json({ success: true }, 200);
|
|
89
|
+
})
|
|
90
|
+
// ==========================================================================
|
|
91
|
+
// Option Units
|
|
92
|
+
// ==========================================================================
|
|
93
|
+
// GET /units — List units
|
|
94
|
+
.get("/units", async (c) => {
|
|
95
|
+
const query = parseQuery(c, validation.optionUnitListQuerySchema);
|
|
96
|
+
return c.json(await productsService.listUnits(c.get("db"), query));
|
|
97
|
+
})
|
|
98
|
+
// GET /units/:unitId — Get single unit
|
|
99
|
+
.get("/units/:unitId", async (c) => {
|
|
100
|
+
const row = await productsService.getUnitById(c.get("db"), c.req.param("unitId"));
|
|
101
|
+
if (!row) {
|
|
102
|
+
return c.json({ error: "Option unit not found" }, 404);
|
|
103
|
+
}
|
|
104
|
+
return c.json({ data: row });
|
|
105
|
+
})
|
|
106
|
+
// POST /options/:optionId/units — Create unit for option
|
|
107
|
+
.post("/options/:optionId/units", async (c) => {
|
|
108
|
+
const optionId = c.req.param("optionId");
|
|
109
|
+
const body = await parseJsonBody(c, validation.insertOptionUnitSchema);
|
|
110
|
+
const option = await productsService.getOptionById(c.get("db"), optionId);
|
|
111
|
+
if (!option) {
|
|
112
|
+
return c.json({ error: "Product option not found" }, 404);
|
|
113
|
+
}
|
|
114
|
+
const row = await productsService.createUnit(c.get("db"), optionId, body);
|
|
115
|
+
if (!row) {
|
|
116
|
+
return c.json({ error: "Product option not found" }, 404);
|
|
117
|
+
}
|
|
118
|
+
await appendProductMutationLedgerEntry(c, {
|
|
119
|
+
action: "create",
|
|
120
|
+
productId: option.productId,
|
|
121
|
+
changedFields: changedMutationFields(body, null, row),
|
|
122
|
+
subject: "product option unit",
|
|
123
|
+
actionName: "product.option_unit.create",
|
|
124
|
+
routeOrToolName: "products.option_unit.create",
|
|
125
|
+
});
|
|
126
|
+
await emitProductContentChanged(c.get("eventBus"), { id: option.productId, axis: "option" });
|
|
127
|
+
return c.json({ data: row }, 201);
|
|
128
|
+
})
|
|
129
|
+
// PATCH /units/:unitId — Update unit
|
|
130
|
+
.patch("/units/:unitId", async (c) => {
|
|
131
|
+
const unitId = c.req.param("unitId");
|
|
132
|
+
const body = await parseJsonBody(c, validation.updateOptionUnitSchema);
|
|
133
|
+
const before = await productsService.getUnitForProductMutation(c.get("db"), unitId);
|
|
134
|
+
if (!before) {
|
|
135
|
+
return c.json({ error: "Option unit not found" }, 404);
|
|
136
|
+
}
|
|
137
|
+
const row = await productsService.updateUnit(c.get("db"), unitId, body);
|
|
138
|
+
if (!row) {
|
|
139
|
+
return c.json({ error: "Option unit not found" }, 404);
|
|
140
|
+
}
|
|
141
|
+
await appendProductMutationLedgerEntry(c, {
|
|
142
|
+
action: "update",
|
|
143
|
+
productId: before.productId,
|
|
144
|
+
changedFields: changedMutationFields(body, before, row),
|
|
145
|
+
subject: "product option unit",
|
|
146
|
+
actionName: "product.option_unit.update",
|
|
147
|
+
routeOrToolName: "products.option_unit.update",
|
|
148
|
+
});
|
|
149
|
+
await emitProductContentChanged(c.get("eventBus"), { id: before.productId, axis: "option" });
|
|
150
|
+
return c.json({ data: row });
|
|
151
|
+
})
|
|
152
|
+
// DELETE /units/:unitId — Delete unit
|
|
153
|
+
.delete("/units/:unitId", async (c) => {
|
|
154
|
+
const unitId = c.req.param("unitId");
|
|
155
|
+
const before = await productsService.getUnitForProductMutation(c.get("db"), unitId);
|
|
156
|
+
if (!before) {
|
|
157
|
+
return c.json({ error: "Option unit not found" }, 404);
|
|
158
|
+
}
|
|
159
|
+
const row = await productsService.deleteUnit(c.get("db"), unitId);
|
|
160
|
+
if (!row) {
|
|
161
|
+
return c.json({ error: "Option unit not found" }, 404);
|
|
162
|
+
}
|
|
163
|
+
await appendProductMutationLedgerEntry(c, {
|
|
164
|
+
action: "delete",
|
|
165
|
+
productId: before.productId,
|
|
166
|
+
changedFields: [],
|
|
167
|
+
subject: "product option unit",
|
|
168
|
+
actionName: "product.option_unit.delete",
|
|
169
|
+
routeOrToolName: "products.option_unit.delete",
|
|
170
|
+
});
|
|
171
|
+
await emitProductContentChanged(c.get("eventBus"), { id: before.productId, axis: "option" });
|
|
172
|
+
return c.json({ success: true }, 200);
|
|
173
|
+
});
|