@voyant-travel/quotes 0.119.2

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 (51) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +39 -0
  3. package/dist/booking-extension.d.ts +123 -0
  4. package/dist/booking-extension.d.ts.map +1 -0
  5. package/dist/booking-extension.js +87 -0
  6. package/dist/index.d.ts +16 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +32 -0
  9. package/dist/routes/index.d.ts +1410 -0
  10. package/dist/routes/index.d.ts.map +1 -0
  11. package/dist/routes/index.js +8 -0
  12. package/dist/routes/pipelines.d.ts +292 -0
  13. package/dist/routes/pipelines.d.ts.map +1 -0
  14. package/dist/routes/pipelines.js +59 -0
  15. package/dist/routes/quote-versions.d.ts +746 -0
  16. package/dist/routes/quote-versions.d.ts.map +1 -0
  17. package/dist/routes/quote-versions.js +175 -0
  18. package/dist/routes/quotes.d.ts +391 -0
  19. package/dist/routes/quotes.d.ts.map +1 -0
  20. package/dist/routes/quotes.js +70 -0
  21. package/dist/schema-relations.d.ts +30 -0
  22. package/dist/schema-relations.d.ts.map +1 -0
  23. package/dist/schema-relations.js +49 -0
  24. package/dist/schema-sales.d.ts +1511 -0
  25. package/dist/schema-sales.d.ts.map +1 -0
  26. package/dist/schema-sales.js +164 -0
  27. package/dist/schema-shared.d.ts +5 -0
  28. package/dist/schema-shared.d.ts.map +1 -0
  29. package/dist/schema-shared.js +18 -0
  30. package/dist/schema.d.ts +5 -0
  31. package/dist/schema.d.ts.map +1 -0
  32. package/dist/schema.js +4 -0
  33. package/dist/service/helpers.d.ts +22 -0
  34. package/dist/service/helpers.d.ts.map +1 -0
  35. package/dist/service/helpers.js +39 -0
  36. package/dist/service/index.d.ts +1734 -0
  37. package/dist/service/index.d.ts.map +1 -0
  38. package/dist/service/index.js +11 -0
  39. package/dist/service/pipelines.d.ts +113 -0
  40. package/dist/service/pipelines.d.ts.map +1 -0
  41. package/dist/service/pipelines.js +68 -0
  42. package/dist/service/quote-versions.d.ts +674 -0
  43. package/dist/service/quote-versions.d.ts.map +1 -0
  44. package/dist/service/quote-versions.js +400 -0
  45. package/dist/service/quotes.d.ts +826 -0
  46. package/dist/service/quotes.d.ts.map +1 -0
  47. package/dist/service/quotes.js +110 -0
  48. package/dist/validation.d.ts +2 -0
  49. package/dist/validation.d.ts.map +1 -0
  50. package/dist/validation.js +1 -0
  51. package/package.json +72 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routes/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAOjE,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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} from "./quotes.js";
5
+ export const quotesRoutes = new Hono()
6
+ .route("/", pipelineRoutes)
7
+ .route("/", quoteRoutes)
8
+ .route("/", quoteVersionRoutes);
@@ -0,0 +1,292 @@
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 pipelineRoutes: import("hono/hono-base").HonoBase<Env, {
9
+ "/pipelines": {
10
+ $get: {
11
+ input: {};
12
+ output: {
13
+ data: {
14
+ id: string;
15
+ entityType: "quote" | "organization" | "person" | "activity";
16
+ name: string;
17
+ isDefault: boolean;
18
+ sortOrder: number;
19
+ createdAt: string;
20
+ updatedAt: string;
21
+ }[];
22
+ total: number;
23
+ limit: number;
24
+ offset: number;
25
+ };
26
+ outputFormat: "json";
27
+ status: import("hono/utils/http-status").ContentfulStatusCode;
28
+ };
29
+ };
30
+ } & {
31
+ "/pipelines": {
32
+ $post: {
33
+ input: {};
34
+ output: {
35
+ data: {
36
+ name: string;
37
+ createdAt: string;
38
+ updatedAt: string;
39
+ id: string;
40
+ entityType: "quote" | "organization" | "person" | "activity";
41
+ isDefault: boolean;
42
+ sortOrder: number;
43
+ } | undefined;
44
+ };
45
+ outputFormat: "json";
46
+ status: 201;
47
+ };
48
+ };
49
+ } & {
50
+ "/pipelines/:id": {
51
+ $get: {
52
+ input: {
53
+ param: {
54
+ id: string;
55
+ };
56
+ };
57
+ output: {
58
+ error: string;
59
+ };
60
+ outputFormat: "json";
61
+ status: 404;
62
+ } | {
63
+ input: {
64
+ param: {
65
+ id: string;
66
+ };
67
+ };
68
+ output: {
69
+ data: {
70
+ id: string;
71
+ entityType: "quote" | "organization" | "person" | "activity";
72
+ name: string;
73
+ isDefault: boolean;
74
+ sortOrder: number;
75
+ createdAt: string;
76
+ updatedAt: string;
77
+ };
78
+ };
79
+ outputFormat: "json";
80
+ status: import("hono/utils/http-status").ContentfulStatusCode;
81
+ };
82
+ };
83
+ } & {
84
+ "/pipelines/:id": {
85
+ $patch: {
86
+ input: {
87
+ param: {
88
+ id: string;
89
+ };
90
+ };
91
+ output: {
92
+ error: string;
93
+ };
94
+ outputFormat: "json";
95
+ status: 404;
96
+ } | {
97
+ input: {
98
+ param: {
99
+ id: string;
100
+ };
101
+ };
102
+ output: {
103
+ data: {
104
+ id: string;
105
+ entityType: "quote" | "organization" | "person" | "activity";
106
+ name: string;
107
+ isDefault: boolean;
108
+ sortOrder: number;
109
+ createdAt: string;
110
+ updatedAt: string;
111
+ };
112
+ };
113
+ outputFormat: "json";
114
+ status: import("hono/utils/http-status").ContentfulStatusCode;
115
+ };
116
+ };
117
+ } & {
118
+ "/pipelines/:id": {
119
+ $delete: {
120
+ input: {
121
+ param: {
122
+ id: string;
123
+ };
124
+ };
125
+ output: {
126
+ error: string;
127
+ };
128
+ outputFormat: "json";
129
+ status: 404;
130
+ } | {
131
+ input: {
132
+ param: {
133
+ id: string;
134
+ };
135
+ };
136
+ output: {
137
+ success: true;
138
+ };
139
+ outputFormat: "json";
140
+ status: import("hono/utils/http-status").ContentfulStatusCode;
141
+ };
142
+ };
143
+ } & {
144
+ "/stages": {
145
+ $get: {
146
+ input: {};
147
+ output: {
148
+ data: {
149
+ id: string;
150
+ pipelineId: string;
151
+ name: string;
152
+ sortOrder: number;
153
+ probability: number | null;
154
+ isClosed: boolean;
155
+ isWon: boolean;
156
+ isLost: boolean;
157
+ createdAt: string;
158
+ updatedAt: string;
159
+ }[];
160
+ total: number;
161
+ limit: number;
162
+ offset: number;
163
+ };
164
+ outputFormat: "json";
165
+ status: import("hono/utils/http-status").ContentfulStatusCode;
166
+ };
167
+ };
168
+ } & {
169
+ "/stages": {
170
+ $post: {
171
+ input: {};
172
+ output: {
173
+ data: {
174
+ name: string;
175
+ createdAt: string;
176
+ updatedAt: string;
177
+ id: string;
178
+ sortOrder: number;
179
+ pipelineId: string;
180
+ probability: number | null;
181
+ isClosed: boolean;
182
+ isWon: boolean;
183
+ isLost: boolean;
184
+ } | undefined;
185
+ };
186
+ outputFormat: "json";
187
+ status: 201;
188
+ };
189
+ };
190
+ } & {
191
+ "/stages/:id": {
192
+ $get: {
193
+ input: {
194
+ param: {
195
+ id: string;
196
+ };
197
+ };
198
+ output: {
199
+ error: string;
200
+ };
201
+ outputFormat: "json";
202
+ status: 404;
203
+ } | {
204
+ input: {
205
+ param: {
206
+ id: string;
207
+ };
208
+ };
209
+ output: {
210
+ data: {
211
+ id: string;
212
+ pipelineId: string;
213
+ name: string;
214
+ sortOrder: number;
215
+ probability: number | null;
216
+ isClosed: boolean;
217
+ isWon: boolean;
218
+ isLost: boolean;
219
+ createdAt: string;
220
+ updatedAt: string;
221
+ };
222
+ };
223
+ outputFormat: "json";
224
+ status: import("hono/utils/http-status").ContentfulStatusCode;
225
+ };
226
+ };
227
+ } & {
228
+ "/stages/:id": {
229
+ $patch: {
230
+ input: {
231
+ param: {
232
+ id: string;
233
+ };
234
+ };
235
+ output: {
236
+ error: string;
237
+ };
238
+ outputFormat: "json";
239
+ status: 404;
240
+ } | {
241
+ input: {
242
+ param: {
243
+ id: string;
244
+ };
245
+ };
246
+ output: {
247
+ data: {
248
+ id: string;
249
+ pipelineId: string;
250
+ name: string;
251
+ sortOrder: number;
252
+ probability: number | null;
253
+ isClosed: boolean;
254
+ isWon: boolean;
255
+ isLost: boolean;
256
+ createdAt: string;
257
+ updatedAt: string;
258
+ };
259
+ };
260
+ outputFormat: "json";
261
+ status: import("hono/utils/http-status").ContentfulStatusCode;
262
+ };
263
+ };
264
+ } & {
265
+ "/stages/:id": {
266
+ $delete: {
267
+ input: {
268
+ param: {
269
+ id: string;
270
+ };
271
+ };
272
+ output: {
273
+ error: string;
274
+ };
275
+ outputFormat: "json";
276
+ status: 404;
277
+ } | {
278
+ input: {
279
+ param: {
280
+ id: string;
281
+ };
282
+ };
283
+ output: {
284
+ success: true;
285
+ };
286
+ outputFormat: "json";
287
+ status: import("hono/utils/http-status").ContentfulStatusCode;
288
+ };
289
+ };
290
+ }, "/", "/stages/:id">;
291
+ export {};
292
+ //# sourceMappingURL=pipelines.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipelines.d.ts","sourceRoot":"","sources":["../../src/routes/pipelines.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAajE,KAAK,GAAG,GAAG;IACT,SAAS,EAAE;QACT,EAAE,EAAE,kBAAkB,CAAA;QACtB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACF,CAAA;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAoEvB,CAAA"}
@@ -0,0 +1,59 @@
1
+ import { parseJsonBody, parseQuery } from "@voyant-travel/hono";
2
+ import { Hono } from "hono";
3
+ import { quotesService } from "../service/index.js";
4
+ import { insertPipelineSchema, insertStageSchema, pipelineListQuerySchema, stageListQuerySchema, updatePipelineSchema, updateStageSchema, } from "../validation.js";
5
+ export const pipelineRoutes = new Hono()
6
+ .get("/pipelines", async (c) => {
7
+ const query = await parseQuery(c, pipelineListQuerySchema);
8
+ return c.json(await quotesService.listPipelines(c.get("db"), query));
9
+ })
10
+ .post("/pipelines", async (c) => {
11
+ return c.json({
12
+ data: await quotesService.createPipeline(c.get("db"), await parseJsonBody(c, insertPipelineSchema)),
13
+ }, 201);
14
+ })
15
+ .get("/pipelines/:id", async (c) => {
16
+ const row = await quotesService.getPipelineById(c.get("db"), c.req.param("id"));
17
+ if (!row)
18
+ return c.json({ error: "Pipeline not found" }, 404);
19
+ return c.json({ data: row });
20
+ })
21
+ .patch("/pipelines/:id", async (c) => {
22
+ const row = await quotesService.updatePipeline(c.get("db"), c.req.param("id"), await parseJsonBody(c, updatePipelineSchema));
23
+ if (!row)
24
+ return c.json({ error: "Pipeline not found" }, 404);
25
+ return c.json({ data: row });
26
+ })
27
+ .delete("/pipelines/:id", async (c) => {
28
+ const row = await quotesService.deletePipeline(c.get("db"), c.req.param("id"));
29
+ if (!row)
30
+ return c.json({ error: "Pipeline not found" }, 404);
31
+ return c.json({ success: true });
32
+ })
33
+ .get("/stages", async (c) => {
34
+ const query = await parseQuery(c, stageListQuerySchema);
35
+ return c.json(await quotesService.listStages(c.get("db"), query));
36
+ })
37
+ .post("/stages", async (c) => {
38
+ return c.json({
39
+ data: await quotesService.createStage(c.get("db"), await parseJsonBody(c, insertStageSchema)),
40
+ }, 201);
41
+ })
42
+ .get("/stages/:id", async (c) => {
43
+ const row = await quotesService.getStageById(c.get("db"), c.req.param("id"));
44
+ if (!row)
45
+ return c.json({ error: "Stage not found" }, 404);
46
+ return c.json({ data: row });
47
+ })
48
+ .patch("/stages/:id", async (c) => {
49
+ const row = await quotesService.updateStage(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateStageSchema));
50
+ if (!row)
51
+ return c.json({ error: "Stage not found" }, 404);
52
+ return c.json({ data: row });
53
+ })
54
+ .delete("/stages/:id", async (c) => {
55
+ const row = await quotesService.deleteStage(c.get("db"), c.req.param("id"));
56
+ if (!row)
57
+ return c.json({ error: "Stage not found" }, 404);
58
+ return c.json({ success: true });
59
+ });