@voyantjs/extras 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 +20 -20
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +10 -9
- package/dist/service.d.ts +14 -14
- package/package.json +6 -6
package/dist/routes.d.ts
CHANGED
|
@@ -44,11 +44,16 @@ export declare const extrasRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
44
44
|
input: {};
|
|
45
45
|
output: {
|
|
46
46
|
data: {
|
|
47
|
+
metadata: {
|
|
48
|
+
[x: string]: import("hono/utils/types").JSONValue;
|
|
49
|
+
} | null;
|
|
47
50
|
id: string;
|
|
48
51
|
name: string;
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
createdAt: string;
|
|
53
|
+
updatedAt: string;
|
|
51
54
|
description: string | null;
|
|
55
|
+
code: string | null;
|
|
56
|
+
productId: string;
|
|
52
57
|
selectionType: "optional" | "required" | "default_selected" | "unavailable";
|
|
53
58
|
pricingMode: "included" | "per_person" | "per_booking" | "quantity_based" | "on_request" | "free";
|
|
54
59
|
pricedPerPerson: boolean;
|
|
@@ -57,11 +62,6 @@ export declare const extrasRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
57
62
|
defaultQuantity: number | null;
|
|
58
63
|
active: boolean;
|
|
59
64
|
sortOrder: number;
|
|
60
|
-
metadata: {
|
|
61
|
-
[x: string]: import("hono/utils/types").JSONValue;
|
|
62
|
-
} | null;
|
|
63
|
-
createdAt: string;
|
|
64
|
-
updatedAt: string;
|
|
65
65
|
} | null;
|
|
66
66
|
};
|
|
67
67
|
outputFormat: "json";
|
|
@@ -223,7 +223,13 @@ export declare const extrasRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
223
223
|
input: {};
|
|
224
224
|
output: {
|
|
225
225
|
data: {
|
|
226
|
+
metadata: {
|
|
227
|
+
[x: string]: import("hono/utils/types").JSONValue;
|
|
228
|
+
} | null;
|
|
226
229
|
id: string;
|
|
230
|
+
createdAt: string;
|
|
231
|
+
updatedAt: string;
|
|
232
|
+
notes: string | null;
|
|
227
233
|
selectionType: "optional" | "required" | "default_selected" | "unavailable" | null;
|
|
228
234
|
pricingMode: "included" | "per_person" | "per_booking" | "quantity_based" | "on_request" | "free" | null;
|
|
229
235
|
pricedPerPerson: boolean | null;
|
|
@@ -232,15 +238,9 @@ export declare const extrasRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
232
238
|
defaultQuantity: number | null;
|
|
233
239
|
active: boolean;
|
|
234
240
|
sortOrder: number;
|
|
235
|
-
metadata: {
|
|
236
|
-
[x: string]: import("hono/utils/types").JSONValue;
|
|
237
|
-
} | null;
|
|
238
|
-
createdAt: string;
|
|
239
|
-
updatedAt: string;
|
|
240
241
|
optionId: string;
|
|
241
242
|
productExtraId: string;
|
|
242
243
|
isDefault: boolean;
|
|
243
|
-
notes: string | null;
|
|
244
244
|
} | null;
|
|
245
245
|
};
|
|
246
246
|
outputFormat: "json";
|
|
@@ -406,21 +406,21 @@ export declare const extrasRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
406
406
|
input: {};
|
|
407
407
|
output: {
|
|
408
408
|
data: {
|
|
409
|
-
id: string;
|
|
410
|
-
name: string;
|
|
411
|
-
description: string | null;
|
|
412
|
-
pricingMode: "included" | "per_person" | "per_booking" | "quantity_based" | "on_request" | "free";
|
|
413
|
-
pricedPerPerson: boolean;
|
|
414
409
|
metadata: {
|
|
415
410
|
[x: string]: import("hono/utils/types").JSONValue;
|
|
416
411
|
} | null;
|
|
412
|
+
id: string;
|
|
413
|
+
name: string;
|
|
417
414
|
createdAt: string;
|
|
418
415
|
updatedAt: string;
|
|
419
|
-
|
|
416
|
+
status: "draft" | "selected" | "confirmed" | "cancelled" | "fulfilled";
|
|
420
417
|
notes: string | null;
|
|
418
|
+
description: string | null;
|
|
419
|
+
pricingMode: "included" | "per_person" | "per_booking" | "quantity_based" | "on_request" | "free";
|
|
420
|
+
pricedPerPerson: boolean;
|
|
421
|
+
productExtraId: string | null;
|
|
421
422
|
bookingId: string;
|
|
422
423
|
optionExtraConfigId: string | null;
|
|
423
|
-
status: "draft" | "selected" | "confirmed" | "cancelled" | "fulfilled";
|
|
424
424
|
quantity: number;
|
|
425
425
|
sellCurrency: string;
|
|
426
426
|
unitSellAmountCents: number | null;
|
package/dist/routes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAgBjE,KAAK,GAAG,GAAG;IACT,SAAS,EAAE;QACT,EAAE,EAAE,kBAAkB,CAAA;QACtB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACF,CAAA;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAsGrB,CAAA;AAEJ,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAA"}
|
package/dist/routes.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import { parseJsonBody, parseQuery } from "@voyantjs/hono";
|
|
1
2
|
import { Hono } from "hono";
|
|
2
3
|
import { extrasService } from "./service.js";
|
|
3
4
|
import { bookingExtraListQuerySchema, insertBookingExtraSchema, insertOptionExtraConfigSchema, insertProductExtraSchema, optionExtraConfigListQuerySchema, productExtraListQuerySchema, updateBookingExtraSchema, updateOptionExtraConfigSchema, updateProductExtraSchema, } from "./validation.js";
|
|
4
5
|
export const extrasRoutes = new Hono()
|
|
5
6
|
.get("/product-extras", async (c) => {
|
|
6
|
-
const query =
|
|
7
|
+
const query = await parseQuery(c, productExtraListQuerySchema);
|
|
7
8
|
return c.json(await extrasService.listProductExtras(c.get("db"), query));
|
|
8
9
|
})
|
|
9
10
|
.post("/product-extras", async (c) => {
|
|
10
11
|
return c.json({
|
|
11
|
-
data: await extrasService.createProductExtra(c.get("db"),
|
|
12
|
+
data: await extrasService.createProductExtra(c.get("db"), await parseJsonBody(c, insertProductExtraSchema)),
|
|
12
13
|
}, 201);
|
|
13
14
|
})
|
|
14
15
|
.get("/product-extras/:id", async (c) => {
|
|
@@ -18,7 +19,7 @@ export const extrasRoutes = new Hono()
|
|
|
18
19
|
return c.json({ data: row });
|
|
19
20
|
})
|
|
20
21
|
.patch("/product-extras/:id", async (c) => {
|
|
21
|
-
const row = await extrasService.updateProductExtra(c.get("db"), c.req.param("id"),
|
|
22
|
+
const row = await extrasService.updateProductExtra(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateProductExtraSchema));
|
|
22
23
|
if (!row)
|
|
23
24
|
return c.json({ error: "Product extra not found" }, 404);
|
|
24
25
|
return c.json({ data: row });
|
|
@@ -30,12 +31,12 @@ export const extrasRoutes = new Hono()
|
|
|
30
31
|
return c.json({ success: true });
|
|
31
32
|
})
|
|
32
33
|
.get("/option-extra-configs", async (c) => {
|
|
33
|
-
const query =
|
|
34
|
+
const query = await parseQuery(c, optionExtraConfigListQuerySchema);
|
|
34
35
|
return c.json(await extrasService.listOptionExtraConfigs(c.get("db"), query));
|
|
35
36
|
})
|
|
36
37
|
.post("/option-extra-configs", async (c) => {
|
|
37
38
|
return c.json({
|
|
38
|
-
data: await extrasService.createOptionExtraConfig(c.get("db"),
|
|
39
|
+
data: await extrasService.createOptionExtraConfig(c.get("db"), await parseJsonBody(c, insertOptionExtraConfigSchema)),
|
|
39
40
|
}, 201);
|
|
40
41
|
})
|
|
41
42
|
.get("/option-extra-configs/:id", async (c) => {
|
|
@@ -45,7 +46,7 @@ export const extrasRoutes = new Hono()
|
|
|
45
46
|
return c.json({ data: row });
|
|
46
47
|
})
|
|
47
48
|
.patch("/option-extra-configs/:id", async (c) => {
|
|
48
|
-
const row = await extrasService.updateOptionExtraConfig(c.get("db"), c.req.param("id"),
|
|
49
|
+
const row = await extrasService.updateOptionExtraConfig(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateOptionExtraConfigSchema));
|
|
49
50
|
if (!row)
|
|
50
51
|
return c.json({ error: "Option extra config not found" }, 404);
|
|
51
52
|
return c.json({ data: row });
|
|
@@ -57,12 +58,12 @@ export const extrasRoutes = new Hono()
|
|
|
57
58
|
return c.json({ success: true });
|
|
58
59
|
})
|
|
59
60
|
.get("/booking-extras", async (c) => {
|
|
60
|
-
const query =
|
|
61
|
+
const query = await parseQuery(c, bookingExtraListQuerySchema);
|
|
61
62
|
return c.json(await extrasService.listBookingExtras(c.get("db"), query));
|
|
62
63
|
})
|
|
63
64
|
.post("/booking-extras", async (c) => {
|
|
64
65
|
return c.json({
|
|
65
|
-
data: await extrasService.createBookingExtra(c.get("db"),
|
|
66
|
+
data: await extrasService.createBookingExtra(c.get("db"), await parseJsonBody(c, insertBookingExtraSchema)),
|
|
66
67
|
}, 201);
|
|
67
68
|
})
|
|
68
69
|
.get("/booking-extras/:id", async (c) => {
|
|
@@ -72,7 +73,7 @@ export const extrasRoutes = new Hono()
|
|
|
72
73
|
return c.json({ data: row });
|
|
73
74
|
})
|
|
74
75
|
.patch("/booking-extras/:id", async (c) => {
|
|
75
|
-
const row = await extrasService.updateBookingExtra(c.get("db"), c.req.param("id"),
|
|
76
|
+
const row = await extrasService.updateBookingExtra(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateBookingExtraSchema));
|
|
76
77
|
if (!row)
|
|
77
78
|
return c.json({ error: "Booking extra not found" }, 404);
|
|
78
79
|
return c.json({ data: row });
|
package/dist/service.d.ts
CHANGED
|
@@ -53,11 +53,14 @@ export declare const extrasService: {
|
|
|
53
53
|
updatedAt: Date;
|
|
54
54
|
} | null>;
|
|
55
55
|
createProductExtra(db: PostgresJsDatabase, data: CreateProductExtraInput): Promise<{
|
|
56
|
+
metadata: Record<string, unknown> | null;
|
|
56
57
|
id: string;
|
|
57
58
|
name: string;
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
createdAt: Date;
|
|
60
|
+
updatedAt: Date;
|
|
60
61
|
description: string | null;
|
|
62
|
+
code: string | null;
|
|
63
|
+
productId: string;
|
|
61
64
|
selectionType: "optional" | "required" | "default_selected" | "unavailable";
|
|
62
65
|
pricingMode: "included" | "per_person" | "per_booking" | "quantity_based" | "on_request" | "free";
|
|
63
66
|
pricedPerPerson: boolean;
|
|
@@ -66,9 +69,6 @@ export declare const extrasService: {
|
|
|
66
69
|
defaultQuantity: number | null;
|
|
67
70
|
active: boolean;
|
|
68
71
|
sortOrder: number;
|
|
69
|
-
metadata: Record<string, unknown> | null;
|
|
70
|
-
createdAt: Date;
|
|
71
|
-
updatedAt: Date;
|
|
72
72
|
} | null>;
|
|
73
73
|
updateProductExtra(db: PostgresJsDatabase, id: string, data: UpdateProductExtraInput): Promise<{
|
|
74
74
|
id: string;
|
|
@@ -133,7 +133,11 @@ export declare const extrasService: {
|
|
|
133
133
|
updatedAt: Date;
|
|
134
134
|
} | null>;
|
|
135
135
|
createOptionExtraConfig(db: PostgresJsDatabase, data: CreateOptionExtraConfigInput): Promise<{
|
|
136
|
+
metadata: Record<string, unknown> | null;
|
|
136
137
|
id: string;
|
|
138
|
+
createdAt: Date;
|
|
139
|
+
updatedAt: Date;
|
|
140
|
+
notes: string | null;
|
|
137
141
|
selectionType: "optional" | "required" | "default_selected" | "unavailable" | null;
|
|
138
142
|
pricingMode: "included" | "per_person" | "per_booking" | "quantity_based" | "on_request" | "free" | null;
|
|
139
143
|
pricedPerPerson: boolean | null;
|
|
@@ -142,13 +146,9 @@ export declare const extrasService: {
|
|
|
142
146
|
defaultQuantity: number | null;
|
|
143
147
|
active: boolean;
|
|
144
148
|
sortOrder: number;
|
|
145
|
-
metadata: Record<string, unknown> | null;
|
|
146
|
-
createdAt: Date;
|
|
147
|
-
updatedAt: Date;
|
|
148
149
|
optionId: string;
|
|
149
150
|
productExtraId: string;
|
|
150
151
|
isDefault: boolean;
|
|
151
|
-
notes: string | null;
|
|
152
152
|
} | null>;
|
|
153
153
|
updateOptionExtraConfig(db: PostgresJsDatabase, id: string, data: UpdateOptionExtraConfigInput): Promise<{
|
|
154
154
|
id: string;
|
|
@@ -221,19 +221,19 @@ export declare const extrasService: {
|
|
|
221
221
|
updatedAt: Date;
|
|
222
222
|
} | null>;
|
|
223
223
|
createBookingExtra(db: PostgresJsDatabase, data: CreateBookingExtraInput): Promise<{
|
|
224
|
+
metadata: Record<string, unknown> | null;
|
|
224
225
|
id: string;
|
|
225
226
|
name: string;
|
|
227
|
+
createdAt: Date;
|
|
228
|
+
updatedAt: Date;
|
|
229
|
+
status: "draft" | "selected" | "confirmed" | "cancelled" | "fulfilled";
|
|
230
|
+
notes: string | null;
|
|
226
231
|
description: string | null;
|
|
227
232
|
pricingMode: "included" | "per_person" | "per_booking" | "quantity_based" | "on_request" | "free";
|
|
228
233
|
pricedPerPerson: boolean;
|
|
229
|
-
metadata: Record<string, unknown> | null;
|
|
230
|
-
createdAt: Date;
|
|
231
|
-
updatedAt: Date;
|
|
232
234
|
productExtraId: string | null;
|
|
233
|
-
notes: string | null;
|
|
234
235
|
bookingId: string;
|
|
235
236
|
optionExtraConfigId: string | null;
|
|
236
|
-
status: "draft" | "selected" | "confirmed" | "cancelled" | "fulfilled";
|
|
237
237
|
quantity: number;
|
|
238
238
|
sellCurrency: string;
|
|
239
239
|
unitSellAmountCents: number | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyantjs/extras",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"license": "FSL-1.1-Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
"drizzle-orm": "^0.45.2",
|
|
26
26
|
"hono": "^4.12.10",
|
|
27
27
|
"zod": "^4.3.6",
|
|
28
|
-
"@voyantjs/core": "0.
|
|
29
|
-
"@voyantjs/db": "0.
|
|
30
|
-
"@voyantjs/hono": "0.
|
|
28
|
+
"@voyantjs/core": "0.6.0",
|
|
29
|
+
"@voyantjs/db": "0.6.0",
|
|
30
|
+
"@voyantjs/hono": "0.6.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"typescript": "^6.0.2",
|
|
34
|
-
"@voyantjs/bookings": "0.
|
|
35
|
-
"@voyantjs/products": "0.
|
|
34
|
+
"@voyantjs/bookings": "0.6.0",
|
|
35
|
+
"@voyantjs/products": "0.6.0",
|
|
36
36
|
"@voyantjs/voyant-typescript-config": "0.1.0"
|
|
37
37
|
},
|
|
38
38
|
"files": [
|