@voyantjs/products 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,7 +2,10 @@ import type { LinkableDefinition, Module } from "@voyantjs/core";
2
2
  import type { HonoModule } from "@voyantjs/hono/module";
3
3
  export { productsBookingExtension } from "./booking-extension.js";
4
4
  export type { ProductRoutes } from "./routes.js";
5
+ export type { PublicProductRoutes } from "./routes-public.js";
6
+ export { publicProductRoutes } from "./routes-public.js";
5
7
  export { productsService } from "./service.js";
8
+ export { publicProductsService } from "./service-public.js";
6
9
  export declare const productLinkable: LinkableDefinition;
7
10
  export declare const productsModule: Module;
8
11
  export declare const productsHonoModule: HonoModule;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAIvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAA;AACjE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE9C,eAAO,MAAM,eAAe,EAAE,kBAK7B,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,MAK5B,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,UAGhC,CAAA;AAED,YAAY,EACV,aAAa,EACb,wBAAwB,EACxB,UAAU,EACV,2BAA2B,EAC3B,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,oBAAoB,EACpB,wBAAwB,EACxB,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,2BAA2B,EAC3B,aAAa,EACb,uBAAuB,EACvB,qBAAqB,EACrB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AsB,EACtB,8BAA8B,EAC9B,2BAA2B,EAC3B,4BAA4B,EAC5B,uCAAuC,EACvC,yBAAyB,EACzB,mCAAmC,EACnC,iCAAiC,EACjC,0BAA0B,EAC1B,uCAAuC,EACvC,yBAAyB,EACzB,mBAAmB,EACnB,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,iCAAiC,EACjC,oCAAoC,EACpC,6BAA6B,EAC7B,2BAA2B,EAC3B,iCAAiC,EACjC,sBAAsB,EACtB,0BAA0B,EAC1B,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,EACzB,oCAAoC,EACpC,mBAAmB,EACnB,sBAAsB,EACtB,gCAAgC,EAChC,8BAA8B,EAC9B,uBAAuB,EACvB,oCAAoC,GACrC,MAAM,iBAAiB,CAAA"}
package/dist/index.js CHANGED
@@ -1,6 +1,9 @@
1
1
  import { productRoutes } from "./routes.js";
2
+ import { publicProductRoutes } from "./routes-public.js";
2
3
  export { productsBookingExtension } from "./booking-extension.js";
4
+ export { publicProductRoutes } from "./routes-public.js";
3
5
  export { productsService } from "./service.js";
6
+ export { publicProductsService } from "./service-public.js";
4
7
  export const productLinkable = {
5
8
  module: "products",
6
9
  entity: "product",
@@ -15,6 +18,8 @@ export const productsModule = {
15
18
  };
16
19
  export const productsHonoModule = {
17
20
  module: productsModule,
21
+ adminRoutes: productRoutes,
22
+ publicRoutes: publicProductRoutes,
18
23
  routes: productRoutes,
19
24
  };
20
25
  export { optionUnits, optionUnitTranslations, productActivationSettings, productCapabilities, productCategories, productCategoryProducts, productDayServices, productDays, productDeliveryFormats, productFaqs, productFeatures, productLocations, productMedia, productMediaTypeEnum, productNotes, productOptions, productOptionTranslations, products, productTagProducts, productTags, productTicketSettings, productTranslations, productTypes, productVersions, productVisibilitySettings, } from "./schema.js";
@@ -0,0 +1,337 @@
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 publicProductRoutes: import("hono/hono-base").HonoBase<Env, {
9
+ "/": {
10
+ $get: {
11
+ input: {};
12
+ output: {
13
+ data: ({
14
+ id: string;
15
+ name: string;
16
+ description: string | null;
17
+ contentLanguageTag: string | null;
18
+ slug: string | null;
19
+ shortDescription: string | null;
20
+ seoTitle: string | null;
21
+ seoDescription: string | null;
22
+ bookingMode: "date" | "other" | "date_time" | "open" | "stay" | "transfer" | "itinerary";
23
+ capacityMode: "free_sale" | "limited" | "on_request";
24
+ visibility: "public" | "private" | "hidden";
25
+ sellCurrency: string;
26
+ sellAmountCents: number | null;
27
+ startDate: string | null;
28
+ endDate: string | null;
29
+ pax: number | null;
30
+ productType: {
31
+ id: string;
32
+ code: string;
33
+ name: string;
34
+ description: string | null;
35
+ } | null;
36
+ categories: {
37
+ id: string;
38
+ parentId: string | null;
39
+ name: string;
40
+ slug: string;
41
+ description: string | null;
42
+ sortOrder: number;
43
+ }[];
44
+ tags: {
45
+ id: string;
46
+ name: string;
47
+ }[];
48
+ capabilities: string[];
49
+ coverMedia: {
50
+ id: string;
51
+ mediaType: "image" | "video" | "document";
52
+ name: string;
53
+ url: string;
54
+ mimeType: string | null;
55
+ altText: string | null;
56
+ sortOrder: number;
57
+ isCover: boolean;
58
+ } | null;
59
+ isFeatured: boolean;
60
+ } | {
61
+ media: {
62
+ id: string;
63
+ mediaType: "image" | "video" | "document";
64
+ name: string;
65
+ url: string;
66
+ mimeType: string | null;
67
+ altText: string | null;
68
+ sortOrder: number;
69
+ isCover: boolean;
70
+ }[];
71
+ features: {
72
+ id: string;
73
+ featureType: "other" | "inclusion" | "exclusion" | "highlight" | "important_information";
74
+ title: string;
75
+ description: string | null;
76
+ sortOrder: number;
77
+ }[];
78
+ faqs: {
79
+ id: string;
80
+ question: string;
81
+ answer: string;
82
+ sortOrder: number;
83
+ }[];
84
+ locations: {
85
+ id: string;
86
+ locationType: "other" | "start" | "end" | "meeting_point" | "pickup" | "dropoff" | "point_of_interest";
87
+ title: string;
88
+ address: string | null;
89
+ city: string | null;
90
+ countryCode: string | null;
91
+ latitude: number | null;
92
+ longitude: number | null;
93
+ sortOrder: number;
94
+ }[];
95
+ id: string;
96
+ name: string;
97
+ description: string | null;
98
+ contentLanguageTag: string | null;
99
+ slug: string | null;
100
+ shortDescription: string | null;
101
+ seoTitle: string | null;
102
+ seoDescription: string | null;
103
+ bookingMode: "date" | "other" | "date_time" | "open" | "stay" | "transfer" | "itinerary";
104
+ capacityMode: "free_sale" | "limited" | "on_request";
105
+ visibility: "public" | "private" | "hidden";
106
+ sellCurrency: string;
107
+ sellAmountCents: number | null;
108
+ startDate: string | null;
109
+ endDate: string | null;
110
+ pax: number | null;
111
+ productType: {
112
+ id: string;
113
+ code: string;
114
+ name: string;
115
+ description: string | null;
116
+ } | null;
117
+ categories: {
118
+ id: string;
119
+ parentId: string | null;
120
+ name: string;
121
+ slug: string;
122
+ description: string | null;
123
+ sortOrder: number;
124
+ }[];
125
+ tags: {
126
+ id: string;
127
+ name: string;
128
+ }[];
129
+ capabilities: string[];
130
+ coverMedia: {
131
+ id: string;
132
+ mediaType: "image" | "video" | "document";
133
+ name: string;
134
+ url: string;
135
+ mimeType: string | null;
136
+ altText: string | null;
137
+ sortOrder: number;
138
+ isCover: boolean;
139
+ } | null;
140
+ isFeatured: boolean;
141
+ })[];
142
+ total: number;
143
+ limit: number;
144
+ offset: number;
145
+ };
146
+ outputFormat: "json";
147
+ status: import("hono/utils/http-status").ContentfulStatusCode;
148
+ };
149
+ };
150
+ } & {
151
+ "/slug/:slug": {
152
+ $get: {
153
+ input: {
154
+ param: {
155
+ slug: string;
156
+ };
157
+ };
158
+ output: {
159
+ error: string;
160
+ };
161
+ outputFormat: "json";
162
+ status: 404;
163
+ } | {
164
+ input: {
165
+ param: {
166
+ slug: string;
167
+ };
168
+ };
169
+ output: {
170
+ data: {
171
+ id: string;
172
+ name: string;
173
+ description: string | null;
174
+ contentLanguageTag: string | null;
175
+ slug: string | null;
176
+ shortDescription: string | null;
177
+ seoTitle: string | null;
178
+ seoDescription: string | null;
179
+ bookingMode: "date" | "other" | "date_time" | "open" | "stay" | "transfer" | "itinerary";
180
+ capacityMode: "free_sale" | "limited" | "on_request";
181
+ visibility: "public" | "private" | "hidden";
182
+ sellCurrency: string;
183
+ sellAmountCents: number | null;
184
+ startDate: string | null;
185
+ endDate: string | null;
186
+ pax: number | null;
187
+ productType: {
188
+ id: string;
189
+ code: string;
190
+ name: string;
191
+ description: string | null;
192
+ } | null;
193
+ categories: {
194
+ id: string;
195
+ parentId: string | null;
196
+ name: string;
197
+ slug: string;
198
+ description: string | null;
199
+ sortOrder: number;
200
+ }[];
201
+ tags: {
202
+ id: string;
203
+ name: string;
204
+ }[];
205
+ capabilities: string[];
206
+ coverMedia: {
207
+ id: string;
208
+ mediaType: "image" | "video" | "document";
209
+ name: string;
210
+ url: string;
211
+ mimeType: string | null;
212
+ altText: string | null;
213
+ sortOrder: number;
214
+ isCover: boolean;
215
+ } | null;
216
+ isFeatured: boolean;
217
+ };
218
+ };
219
+ outputFormat: "json";
220
+ status: import("hono/utils/http-status").ContentfulStatusCode;
221
+ };
222
+ };
223
+ } & {
224
+ "/categories": {
225
+ $get: {
226
+ input: {};
227
+ output: {
228
+ data: {
229
+ parentId: string | null;
230
+ description: string | null;
231
+ id: string;
232
+ name: string;
233
+ slug: string;
234
+ sortOrder: number;
235
+ }[];
236
+ total: number;
237
+ limit: number;
238
+ offset: number;
239
+ };
240
+ outputFormat: "json";
241
+ status: import("hono/utils/http-status").ContentfulStatusCode;
242
+ };
243
+ };
244
+ } & {
245
+ "/tags": {
246
+ $get: {
247
+ input: {};
248
+ output: {
249
+ data: {
250
+ id: string;
251
+ name: string;
252
+ }[];
253
+ total: number;
254
+ limit: number;
255
+ offset: number;
256
+ };
257
+ outputFormat: "json";
258
+ status: import("hono/utils/http-status").ContentfulStatusCode;
259
+ };
260
+ };
261
+ } & {
262
+ "/:id": {
263
+ $get: {
264
+ input: {
265
+ param: {
266
+ id: string;
267
+ };
268
+ };
269
+ output: {
270
+ error: string;
271
+ };
272
+ outputFormat: "json";
273
+ status: 404;
274
+ } | {
275
+ input: {
276
+ param: {
277
+ id: string;
278
+ };
279
+ };
280
+ output: {
281
+ data: {
282
+ id: string;
283
+ name: string;
284
+ description: string | null;
285
+ contentLanguageTag: string | null;
286
+ slug: string | null;
287
+ shortDescription: string | null;
288
+ seoTitle: string | null;
289
+ seoDescription: string | null;
290
+ bookingMode: "date" | "other" | "date_time" | "open" | "stay" | "transfer" | "itinerary";
291
+ capacityMode: "free_sale" | "limited" | "on_request";
292
+ visibility: "public" | "private" | "hidden";
293
+ sellCurrency: string;
294
+ sellAmountCents: number | null;
295
+ startDate: string | null;
296
+ endDate: string | null;
297
+ pax: number | null;
298
+ productType: {
299
+ id: string;
300
+ code: string;
301
+ name: string;
302
+ description: string | null;
303
+ } | null;
304
+ categories: {
305
+ id: string;
306
+ parentId: string | null;
307
+ name: string;
308
+ slug: string;
309
+ description: string | null;
310
+ sortOrder: number;
311
+ }[];
312
+ tags: {
313
+ id: string;
314
+ name: string;
315
+ }[];
316
+ capabilities: string[];
317
+ coverMedia: {
318
+ id: string;
319
+ mediaType: "image" | "video" | "document";
320
+ name: string;
321
+ url: string;
322
+ mimeType: string | null;
323
+ altText: string | null;
324
+ sortOrder: number;
325
+ isCover: boolean;
326
+ } | null;
327
+ isFeatured: boolean;
328
+ };
329
+ };
330
+ outputFormat: "json";
331
+ status: import("hono/utils/http-status").ContentfulStatusCode;
332
+ };
333
+ };
334
+ }, "/", "/:id">;
335
+ export type PublicProductRoutes = typeof publicProductRoutes;
336
+ export {};
337
+ //# 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;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,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAkD5B,CAAA;AAEJ,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAA"}
@@ -0,0 +1,32 @@
1
+ import { Hono } from "hono";
2
+ import { publicProductsService } from "./service-public.js";
3
+ import { publicCatalogCategoryListQuerySchema, publicCatalogProductListQuerySchema, publicCatalogProductLookupBySlugQuerySchema, publicCatalogTagListQuerySchema, } from "./validation-public.js";
4
+ export const publicProductRoutes = new Hono()
5
+ .get("/", async (c) => {
6
+ const query = publicCatalogProductListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
7
+ return c.json(await publicProductsService.listCatalogProducts(c.get("db"), query));
8
+ })
9
+ .get("/slug/:slug", async (c) => {
10
+ const query = publicCatalogProductLookupBySlugQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
11
+ const row = await publicProductsService.getCatalogProductBySlug(c.get("db"), c.req.param("slug"), query);
12
+ if (!row) {
13
+ return c.json({ error: "Catalog product not found" }, 404);
14
+ }
15
+ return c.json({ data: row });
16
+ })
17
+ .get("/categories", async (c) => {
18
+ const query = publicCatalogCategoryListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
19
+ return c.json(await publicProductsService.listCatalogCategories(c.get("db"), query));
20
+ })
21
+ .get("/tags", async (c) => {
22
+ const query = publicCatalogTagListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
23
+ return c.json(await publicProductsService.listCatalogTags(c.get("db"), query));
24
+ })
25
+ .get("/:id", async (c) => {
26
+ const query = publicCatalogProductLookupBySlugQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
27
+ const row = await publicProductsService.getCatalogProductById(c.get("db"), c.req.param("id"), query);
28
+ if (!row) {
29
+ return c.json({ error: "Catalog product not found" }, 404);
30
+ }
31
+ return c.json({ data: row });
32
+ });
@@ -0,0 +1,259 @@
1
+ import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
2
+ import type { PublicCatalogCategoryListQuery, PublicCatalogProductListQuery, PublicCatalogProductLookupBySlugQuery, PublicCatalogTagListQuery } from "./validation-public.js";
3
+ export declare const publicProductsService: {
4
+ listCatalogProducts(db: PostgresJsDatabase, query: PublicCatalogProductListQuery): Promise<{
5
+ data: ({
6
+ id: string;
7
+ name: string;
8
+ description: string | null;
9
+ contentLanguageTag: string | null;
10
+ slug: string | null;
11
+ shortDescription: string | null;
12
+ seoTitle: string | null;
13
+ seoDescription: string | null;
14
+ bookingMode: "date" | "other" | "date_time" | "open" | "stay" | "transfer" | "itinerary";
15
+ capacityMode: "free_sale" | "limited" | "on_request";
16
+ visibility: "public" | "private" | "hidden";
17
+ sellCurrency: string;
18
+ sellAmountCents: number | null;
19
+ startDate: string | null;
20
+ endDate: string | null;
21
+ pax: number | null;
22
+ productType: {
23
+ id: string;
24
+ code: string;
25
+ name: string;
26
+ description: string | null;
27
+ } | null;
28
+ categories: {
29
+ id: string;
30
+ parentId: string | null;
31
+ name: string;
32
+ slug: string;
33
+ description: string | null;
34
+ sortOrder: number;
35
+ }[];
36
+ tags: {
37
+ id: string;
38
+ name: string;
39
+ }[];
40
+ capabilities: string[];
41
+ coverMedia: {
42
+ id: string;
43
+ mediaType: "image" | "video" | "document";
44
+ name: string;
45
+ url: string;
46
+ mimeType: string | null;
47
+ altText: string | null;
48
+ sortOrder: number;
49
+ isCover: boolean;
50
+ } | null;
51
+ isFeatured: boolean;
52
+ } | {
53
+ media: {
54
+ id: string;
55
+ mediaType: "image" | "video" | "document";
56
+ name: string;
57
+ url: string;
58
+ mimeType: string | null;
59
+ altText: string | null;
60
+ sortOrder: number;
61
+ isCover: boolean;
62
+ }[];
63
+ features: {
64
+ id: string;
65
+ featureType: "other" | "inclusion" | "exclusion" | "highlight" | "important_information";
66
+ title: string;
67
+ description: string | null;
68
+ sortOrder: number;
69
+ }[];
70
+ faqs: {
71
+ id: string;
72
+ question: string;
73
+ answer: string;
74
+ sortOrder: number;
75
+ }[];
76
+ locations: {
77
+ id: string;
78
+ locationType: "other" | "start" | "end" | "meeting_point" | "pickup" | "dropoff" | "point_of_interest";
79
+ title: string;
80
+ address: string | null;
81
+ city: string | null;
82
+ countryCode: string | null;
83
+ latitude: number | null;
84
+ longitude: number | null;
85
+ sortOrder: number;
86
+ }[];
87
+ id: string;
88
+ name: string;
89
+ description: string | null;
90
+ contentLanguageTag: string | null;
91
+ slug: string | null;
92
+ shortDescription: string | null;
93
+ seoTitle: string | null;
94
+ seoDescription: string | null;
95
+ bookingMode: "date" | "other" | "date_time" | "open" | "stay" | "transfer" | "itinerary";
96
+ capacityMode: "free_sale" | "limited" | "on_request";
97
+ visibility: "public" | "private" | "hidden";
98
+ sellCurrency: string;
99
+ sellAmountCents: number | null;
100
+ startDate: string | null;
101
+ endDate: string | null;
102
+ pax: number | null;
103
+ productType: {
104
+ id: string;
105
+ code: string;
106
+ name: string;
107
+ description: string | null;
108
+ } | null;
109
+ categories: {
110
+ id: string;
111
+ parentId: string | null;
112
+ name: string;
113
+ slug: string;
114
+ description: string | null;
115
+ sortOrder: number;
116
+ }[];
117
+ tags: {
118
+ id: string;
119
+ name: string;
120
+ }[];
121
+ capabilities: string[];
122
+ coverMedia: {
123
+ id: string;
124
+ mediaType: "image" | "video" | "document";
125
+ name: string;
126
+ url: string;
127
+ mimeType: string | null;
128
+ altText: string | null;
129
+ sortOrder: number;
130
+ isCover: boolean;
131
+ } | null;
132
+ isFeatured: boolean;
133
+ })[];
134
+ total: number;
135
+ limit: number;
136
+ offset: number;
137
+ }>;
138
+ getCatalogProductById(db: PostgresJsDatabase, id: string, query?: {
139
+ languageTag?: string | null;
140
+ }): Promise<{
141
+ id: string;
142
+ name: string;
143
+ description: string | null;
144
+ contentLanguageTag: string | null;
145
+ slug: string | null;
146
+ shortDescription: string | null;
147
+ seoTitle: string | null;
148
+ seoDescription: string | null;
149
+ bookingMode: "date" | "other" | "date_time" | "open" | "stay" | "transfer" | "itinerary";
150
+ capacityMode: "free_sale" | "limited" | "on_request";
151
+ visibility: "public" | "private" | "hidden";
152
+ sellCurrency: string;
153
+ sellAmountCents: number | null;
154
+ startDate: string | null;
155
+ endDate: string | null;
156
+ pax: number | null;
157
+ productType: {
158
+ id: string;
159
+ code: string;
160
+ name: string;
161
+ description: string | null;
162
+ } | null;
163
+ categories: {
164
+ id: string;
165
+ parentId: string | null;
166
+ name: string;
167
+ slug: string;
168
+ description: string | null;
169
+ sortOrder: number;
170
+ }[];
171
+ tags: {
172
+ id: string;
173
+ name: string;
174
+ }[];
175
+ capabilities: string[];
176
+ coverMedia: {
177
+ id: string;
178
+ mediaType: "image" | "video" | "document";
179
+ name: string;
180
+ url: string;
181
+ mimeType: string | null;
182
+ altText: string | null;
183
+ sortOrder: number;
184
+ isCover: boolean;
185
+ } | null;
186
+ isFeatured: boolean;
187
+ } | null>;
188
+ getCatalogProductBySlug(db: PostgresJsDatabase, slug: string, query?: PublicCatalogProductLookupBySlugQuery): Promise<{
189
+ id: string;
190
+ name: string;
191
+ description: string | null;
192
+ contentLanguageTag: string | null;
193
+ slug: string | null;
194
+ shortDescription: string | null;
195
+ seoTitle: string | null;
196
+ seoDescription: string | null;
197
+ bookingMode: "date" | "other" | "date_time" | "open" | "stay" | "transfer" | "itinerary";
198
+ capacityMode: "free_sale" | "limited" | "on_request";
199
+ visibility: "public" | "private" | "hidden";
200
+ sellCurrency: string;
201
+ sellAmountCents: number | null;
202
+ startDate: string | null;
203
+ endDate: string | null;
204
+ pax: number | null;
205
+ productType: {
206
+ id: string;
207
+ code: string;
208
+ name: string;
209
+ description: string | null;
210
+ } | null;
211
+ categories: {
212
+ id: string;
213
+ parentId: string | null;
214
+ name: string;
215
+ slug: string;
216
+ description: string | null;
217
+ sortOrder: number;
218
+ }[];
219
+ tags: {
220
+ id: string;
221
+ name: string;
222
+ }[];
223
+ capabilities: string[];
224
+ coverMedia: {
225
+ id: string;
226
+ mediaType: "image" | "video" | "document";
227
+ name: string;
228
+ url: string;
229
+ mimeType: string | null;
230
+ altText: string | null;
231
+ sortOrder: number;
232
+ isCover: boolean;
233
+ } | null;
234
+ isFeatured: boolean;
235
+ } | null>;
236
+ listCatalogCategories(db: PostgresJsDatabase, query: PublicCatalogCategoryListQuery): Promise<{
237
+ data: {
238
+ parentId: string | null;
239
+ description: string | null;
240
+ id: string;
241
+ name: string;
242
+ slug: string;
243
+ sortOrder: number;
244
+ }[];
245
+ total: number;
246
+ limit: number;
247
+ offset: number;
248
+ }>;
249
+ listCatalogTags(db: PostgresJsDatabase, query: PublicCatalogTagListQuery): Promise<{
250
+ data: {
251
+ id: string;
252
+ name: string;
253
+ }[];
254
+ total: number;
255
+ limit: number;
256
+ offset: number;
257
+ }>;
258
+ };
259
+ //# 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":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAiBjE,OAAO,KAAK,EACV,8BAA8B,EAC9B,6BAA6B,EAC7B,qCAAqC,EACrC,yBAAyB,EAC1B,MAAM,wBAAwB,CAAA;AAiY/B,eAAO,MAAM,qBAAqB;4BACF,kBAAkB,SAAS,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BA8EhF,kBAAkB,MAClB,MAAM,UACH;QAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCA2BlC,kBAAkB,QAChB,MAAM,UACL,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAmCd,kBAAkB,SAAS,8BAA8B;;;;;;;;;;;;;wBAkD/D,kBAAkB,SAAS,yBAAyB;;;;;;;;;CA8B/E,CAAA"}