@voyantjs/products 0.52.1 → 0.52.3

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.
Files changed (73) hide show
  1. package/dist/action-ledger-drift.d.ts +29 -0
  2. package/dist/action-ledger-drift.d.ts.map +1 -0
  3. package/dist/action-ledger-drift.js +335 -0
  4. package/dist/action-ledger.d.ts +104 -0
  5. package/dist/action-ledger.d.ts.map +1 -0
  6. package/dist/action-ledger.js +100 -0
  7. package/dist/booking-extension.d.ts +3 -3
  8. package/dist/catalog-policy.d.ts.map +1 -1
  9. package/dist/catalog-policy.js +18 -0
  10. package/dist/content-shape.d.ts +2 -0
  11. package/dist/content-shape.d.ts.map +1 -1
  12. package/dist/content-shape.js +2 -0
  13. package/dist/events.d.ts +1 -1
  14. package/dist/events.d.ts.map +1 -1
  15. package/dist/route-env.d.ts +22 -0
  16. package/dist/route-env.d.ts.map +1 -0
  17. package/dist/route-env.js +1 -0
  18. package/dist/routes-associations.d.ts +164 -0
  19. package/dist/routes-associations.d.ts.map +1 -0
  20. package/dist/routes-associations.js +100 -0
  21. package/dist/routes-catalog.d.ts +436 -0
  22. package/dist/routes-catalog.d.ts.map +1 -0
  23. package/dist/routes-catalog.js +104 -0
  24. package/dist/routes-configuration.d.ts +773 -0
  25. package/dist/routes-configuration.d.ts.map +1 -0
  26. package/dist/routes-configuration.js +364 -0
  27. package/dist/routes-core.d.ts +302 -0
  28. package/dist/routes-core.d.ts.map +1 -0
  29. package/dist/routes-core.js +79 -0
  30. package/dist/routes-itinerary.d.ts +614 -0
  31. package/dist/routes-itinerary.d.ts.map +1 -0
  32. package/dist/routes-itinerary.js +309 -0
  33. package/dist/routes-maintenance.d.ts +32 -0
  34. package/dist/routes-maintenance.d.ts.map +1 -0
  35. package/dist/routes-maintenance.js +14 -0
  36. package/dist/routes-media.d.ts +634 -0
  37. package/dist/routes-media.d.ts.map +1 -0
  38. package/dist/routes-media.js +245 -0
  39. package/dist/routes-merchandising.d.ts +1108 -0
  40. package/dist/routes-merchandising.d.ts.map +1 -0
  41. package/dist/routes-merchandising.js +376 -0
  42. package/dist/routes-options.d.ts +363 -0
  43. package/dist/routes-options.d.ts.map +1 -0
  44. package/dist/routes-options.js +173 -0
  45. package/dist/routes-public.d.ts +4 -4
  46. package/dist/routes-translations.d.ts +477 -0
  47. package/dist/routes-translations.d.ts.map +1 -0
  48. package/dist/routes-translations.js +258 -0
  49. package/dist/routes.d.ts +417 -355
  50. package/dist/routes.d.ts.map +1 -1
  51. package/dist/routes.js +21 -1133
  52. package/dist/schema-core.d.ts +3 -3
  53. package/dist/schema-itinerary.d.ts +1 -1
  54. package/dist/schema-settings.d.ts +4 -4
  55. package/dist/service-catalog-plane.d.ts.map +1 -1
  56. package/dist/service-catalog-plane.js +48 -1
  57. package/dist/service-catalog.d.ts +2 -2
  58. package/dist/service-content-owned.d.ts.map +1 -1
  59. package/dist/service-content-owned.js +98 -4
  60. package/dist/service-public.d.ts +4 -4
  61. package/dist/service.d.ts +225 -97
  62. package/dist/service.d.ts.map +1 -1
  63. package/dist/service.js +91 -0
  64. package/dist/tasks/brochures.d.ts +1 -1
  65. package/dist/validation-catalog.d.ts +10 -10
  66. package/dist/validation-config.d.ts +17 -17
  67. package/dist/validation-content.d.ts +26 -26
  68. package/dist/validation-core.d.ts +46 -46
  69. package/dist/validation-core.d.ts.map +1 -1
  70. package/dist/validation-core.js +17 -1
  71. package/dist/validation-public.d.ts +25 -25
  72. package/dist/validation-shared.d.ts +11 -11
  73. package/package.json +13 -7
package/dist/events.d.ts CHANGED
@@ -19,7 +19,7 @@ export interface ProductContentChangedEvent {
19
19
  * push hashes the full current content at push time so this field is
20
20
  * not load-bearing for correctness.
21
21
  */
22
- axis?: "product" | "option" | "day" | "media" | "feature" | "faq" | "location" | "destination" | "category" | "tag" | "translation";
22
+ axis?: "product" | "itinerary" | "option" | "day" | "media" | "feature" | "faq" | "location" | "destination" | "category" | "tag" | "translation";
23
23
  }
24
24
  /**
25
25
  * Helper for route handlers / services to fire `product.content.changed`
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9C,+BAA+B;AAC/B,eAAO,MAAM,6BAA6B,EAAG,yBAAkC,CAAA;AAE/E,MAAM,WAAW,0BAA0B;IACzC,wCAAwC;IACxC,EAAE,EAAE,MAAM,CAAA;IACV;;;;OAIG;IACH,IAAI,CAAC,EACD,SAAS,GACT,QAAQ,GACR,KAAK,GACL,OAAO,GACP,SAAS,GACT,KAAK,GACL,UAAU,GACV,aAAa,GACb,UAAU,GACV,KAAK,GACL,aAAa,CAAA;CAClB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,yBAAyB,CAC7C,QAAQ,EAAE,QAAQ,GAAG,SAAS,EAC9B,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,IAAI,CAAC,CAMf"}
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9C,+BAA+B;AAC/B,eAAO,MAAM,6BAA6B,EAAG,yBAAkC,CAAA;AAE/E,MAAM,WAAW,0BAA0B;IACzC,wCAAwC;IACxC,EAAE,EAAE,MAAM,CAAA;IACV;;;;OAIG;IACH,IAAI,CAAC,EACD,SAAS,GACT,WAAW,GACX,QAAQ,GACR,KAAK,GACL,OAAO,GACP,SAAS,GACT,KAAK,GACL,UAAU,GACV,aAAa,GACb,UAAU,GACV,KAAK,GACL,aAAa,CAAA;CAClB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,yBAAyB,CAC7C,QAAQ,EAAE,QAAQ,GAAG,SAAS,EAC9B,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,IAAI,CAAC,CAMf"}
@@ -0,0 +1,22 @@
1
+ import type { EventBus } from "@voyantjs/core";
2
+ import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
3
+ export type Env = {
4
+ Variables: {
5
+ db: PostgresJsDatabase;
6
+ userId?: string;
7
+ agentId?: string;
8
+ workflowPrincipalId?: string;
9
+ principalSubtype?: string;
10
+ sessionId?: string;
11
+ apiTokenId?: string;
12
+ apiKeyId?: string;
13
+ callerType?: string;
14
+ actor?: string;
15
+ isInternalRequest?: boolean;
16
+ organizationId?: string;
17
+ workflowRunId?: string;
18
+ workflowStepId?: string;
19
+ eventBus?: EventBus;
20
+ };
21
+ };
22
+ //# sourceMappingURL=route-env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-env.d.ts","sourceRoot":"","sources":["../src/route-env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAEjE,MAAM,MAAM,GAAG,GAAG;IAChB,SAAS,EAAE;QACT,EAAE,EAAE,kBAAkB,CAAA;QACtB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,mBAAmB,CAAC,EAAE,MAAM,CAAA;QAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAA;QACzB,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,UAAU,CAAC,EAAE,MAAM,CAAA;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,UAAU,CAAC,EAAE,MAAM,CAAA;QACnB,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,iBAAiB,CAAC,EAAE,OAAO,CAAA;QAC3B,cAAc,CAAC,EAAE,MAAM,CAAA;QACvB,aAAa,CAAC,EAAE,MAAM,CAAA;QACtB,cAAc,CAAC,EAAE,MAAM,CAAA;QACvB,QAAQ,CAAC,EAAE,QAAQ,CAAA;KACpB,CAAA;CACF,CAAA"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,164 @@
1
+ import type { Env } from "./route-env.js";
2
+ export declare const productAssociationRoutes: import("hono/hono-base").HonoBase<Env, {
3
+ "/:id/categories": {
4
+ $get: {
5
+ input: {
6
+ param: {
7
+ id: string;
8
+ };
9
+ };
10
+ output: {
11
+ data: {
12
+ id: string;
13
+ parentId: string | null;
14
+ name: string;
15
+ slug: string;
16
+ description: string | null;
17
+ sortOrder: number;
18
+ active: boolean;
19
+ customerPaymentPolicy: import("hono/utils/types").JSONValue;
20
+ metadata: {
21
+ [x: string]: import("hono/utils/types").JSONValue;
22
+ } | null;
23
+ createdAt: string;
24
+ updatedAt: string;
25
+ }[];
26
+ };
27
+ outputFormat: "json";
28
+ status: import("hono/utils/http-status").ContentfulStatusCode;
29
+ };
30
+ };
31
+ } & {
32
+ "/:id/categories": {
33
+ $post: {
34
+ input: {
35
+ param: {
36
+ id: string;
37
+ };
38
+ };
39
+ output: {
40
+ error: string;
41
+ };
42
+ outputFormat: "json";
43
+ status: 409;
44
+ } | {
45
+ input: {
46
+ param: {
47
+ id: string;
48
+ };
49
+ };
50
+ output: {
51
+ success: true;
52
+ };
53
+ outputFormat: "json";
54
+ status: 201;
55
+ };
56
+ };
57
+ } & {
58
+ "/:id/categories/:categoryId": {
59
+ $delete: {
60
+ input: {
61
+ param: {
62
+ id: string;
63
+ } & {
64
+ categoryId: string;
65
+ };
66
+ };
67
+ output: {
68
+ error: string;
69
+ };
70
+ outputFormat: "json";
71
+ status: 404;
72
+ } | {
73
+ input: {
74
+ param: {
75
+ id: string;
76
+ } & {
77
+ categoryId: string;
78
+ };
79
+ };
80
+ output: {
81
+ success: true;
82
+ };
83
+ outputFormat: "json";
84
+ status: 200;
85
+ };
86
+ };
87
+ } & {
88
+ "/:id/tags": {
89
+ $get: {
90
+ input: {
91
+ param: {
92
+ id: string;
93
+ };
94
+ };
95
+ output: {
96
+ data: {
97
+ id: string;
98
+ name: string;
99
+ createdAt: string;
100
+ updatedAt: string;
101
+ }[];
102
+ };
103
+ outputFormat: "json";
104
+ status: import("hono/utils/http-status").ContentfulStatusCode;
105
+ };
106
+ };
107
+ } & {
108
+ "/:id/tags": {
109
+ $post: {
110
+ input: {
111
+ param: {
112
+ id: string;
113
+ };
114
+ };
115
+ output: {
116
+ error: string;
117
+ };
118
+ outputFormat: "json";
119
+ status: 409;
120
+ } | {
121
+ input: {
122
+ param: {
123
+ id: string;
124
+ };
125
+ };
126
+ output: {
127
+ success: true;
128
+ };
129
+ outputFormat: "json";
130
+ status: 201;
131
+ };
132
+ };
133
+ } & {
134
+ "/:id/tags/:tagId": {
135
+ $delete: {
136
+ input: {
137
+ param: {
138
+ id: string;
139
+ } & {
140
+ tagId: string;
141
+ };
142
+ };
143
+ output: {
144
+ error: string;
145
+ };
146
+ outputFormat: "json";
147
+ status: 404;
148
+ } | {
149
+ input: {
150
+ param: {
151
+ id: string;
152
+ } & {
153
+ tagId: string;
154
+ };
155
+ };
156
+ output: {
157
+ success: true;
158
+ };
159
+ outputFormat: "json";
160
+ status: 200;
161
+ };
162
+ };
163
+ }, "/", "/:id/tags/:tagId">;
164
+ //# sourceMappingURL=routes-associations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes-associations.d.ts","sourceRoot":"","sources":["../src/routes-associations.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AAGzC,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAmHjC,CAAA"}
@@ -0,0 +1,100 @@
1
+ import { parseJsonBody } from "@voyantjs/hono";
2
+ import { Hono } from "hono";
3
+ import { z } from "zod";
4
+ import { appendProductMutationLedgerEntry, changedMutationFields } from "./action-ledger.js";
5
+ import { emitProductContentChanged } from "./events.js";
6
+ import { productsService } from "./service.js";
7
+ export const productAssociationRoutes = new Hono()
8
+ // ==========================================================================
9
+ // Product <-> Category associations
10
+ // ==========================================================================
11
+ .get("/:id/categories", async (c) => {
12
+ return c.json({
13
+ data: await productsService.listProductCategories_(c.get("db"), c.req.param("id")),
14
+ });
15
+ })
16
+ .post("/:id/categories", async (c) => {
17
+ const productId = c.req.param("id");
18
+ const body = await parseJsonBody(c, z.object({
19
+ categoryId: z.string(),
20
+ sortOrder: z.number().optional(),
21
+ }));
22
+ const { categoryId, sortOrder } = body;
23
+ const row = await productsService.addProductToCategory(c.get("db"), productId, categoryId, sortOrder);
24
+ if (!row) {
25
+ return c.json({ error: "Already assigned or not found" }, 409);
26
+ }
27
+ await appendProductMutationLedgerEntry(c, {
28
+ action: "create",
29
+ productId,
30
+ changedFields: changedMutationFields(body, null, row),
31
+ subject: "product category link",
32
+ actionName: "product.category_link.create",
33
+ routeOrToolName: "products.category_link.create",
34
+ });
35
+ await emitProductContentChanged(c.get("eventBus"), { id: productId, axis: "category" });
36
+ return c.json({ success: true }, 201);
37
+ })
38
+ .delete("/:id/categories/:categoryId", async (c) => {
39
+ const productId = c.req.param("id");
40
+ const row = await productsService.removeProductFromCategory(c.get("db"), productId, c.req.param("categoryId"));
41
+ if (!row) {
42
+ return c.json({ error: "Association not found" }, 404);
43
+ }
44
+ await appendProductMutationLedgerEntry(c, {
45
+ action: "delete",
46
+ productId,
47
+ changedFields: [],
48
+ subject: "product category link",
49
+ actionName: "product.category_link.delete",
50
+ routeOrToolName: "products.category_link.delete",
51
+ });
52
+ await emitProductContentChanged(c.get("eventBus"), { id: productId, axis: "category" });
53
+ return c.json({ success: true }, 200);
54
+ })
55
+ // ==========================================================================
56
+ // Product <-> Tag associations
57
+ // ==========================================================================
58
+ .get("/:id/tags", async (c) => {
59
+ return c.json({
60
+ data: await productsService.listProductTags_(c.get("db"), c.req.param("id")),
61
+ });
62
+ })
63
+ .post("/:id/tags", async (c) => {
64
+ const productId = c.req.param("id");
65
+ const body = await parseJsonBody(c, z.object({
66
+ tagId: z.string(),
67
+ }));
68
+ const { tagId } = body;
69
+ const row = await productsService.addProductTag(c.get("db"), productId, tagId);
70
+ if (!row) {
71
+ return c.json({ error: "Already assigned or not found" }, 409);
72
+ }
73
+ await appendProductMutationLedgerEntry(c, {
74
+ action: "create",
75
+ productId,
76
+ changedFields: changedMutationFields(body, null, row),
77
+ subject: "product tag link",
78
+ actionName: "product.tag_link.create",
79
+ routeOrToolName: "products.tag_link.create",
80
+ });
81
+ await emitProductContentChanged(c.get("eventBus"), { id: productId, axis: "tag" });
82
+ return c.json({ success: true }, 201);
83
+ })
84
+ .delete("/:id/tags/:tagId", async (c) => {
85
+ const productId = c.req.param("id");
86
+ const row = await productsService.removeProductTag(c.get("db"), productId, c.req.param("tagId"));
87
+ if (!row) {
88
+ return c.json({ error: "Association not found" }, 404);
89
+ }
90
+ await appendProductMutationLedgerEntry(c, {
91
+ action: "delete",
92
+ productId,
93
+ changedFields: [],
94
+ subject: "product tag link",
95
+ actionName: "product.tag_link.delete",
96
+ routeOrToolName: "products.tag_link.delete",
97
+ });
98
+ await emitProductContentChanged(c.get("eventBus"), { id: productId, axis: "tag" });
99
+ return c.json({ success: true }, 200);
100
+ });