@voyant-travel/distribution 0.109.8

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 (168) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +42 -0
  3. package/dist/booking-extension.d.ts +168 -0
  4. package/dist/booking-extension.d.ts.map +1 -0
  5. package/dist/booking-extension.js +102 -0
  6. package/dist/channel-push/admin-routes.d.ts +31 -0
  7. package/dist/channel-push/admin-routes.d.ts.map +1 -0
  8. package/dist/channel-push/admin-routes.js +165 -0
  9. package/dist/channel-push/availability-push.d.ts +76 -0
  10. package/dist/channel-push/availability-push.d.ts.map +1 -0
  11. package/dist/channel-push/availability-push.js +236 -0
  12. package/dist/channel-push/booking-push-helpers.d.ts +36 -0
  13. package/dist/channel-push/booking-push-helpers.d.ts.map +1 -0
  14. package/dist/channel-push/booking-push-helpers.js +169 -0
  15. package/dist/channel-push/booking-push.d.ts +108 -0
  16. package/dist/channel-push/booking-push.d.ts.map +1 -0
  17. package/dist/channel-push/booking-push.js +335 -0
  18. package/dist/channel-push/boundary-sql.d.ts +23 -0
  19. package/dist/channel-push/boundary-sql.d.ts.map +1 -0
  20. package/dist/channel-push/boundary-sql.js +75 -0
  21. package/dist/channel-push/content-push.d.ts +60 -0
  22. package/dist/channel-push/content-push.d.ts.map +1 -0
  23. package/dist/channel-push/content-push.js +252 -0
  24. package/dist/channel-push/index.d.ts +15 -0
  25. package/dist/channel-push/index.d.ts.map +1 -0
  26. package/dist/channel-push/index.js +18 -0
  27. package/dist/channel-push/plugin.d.ts +18 -0
  28. package/dist/channel-push/plugin.d.ts.map +1 -0
  29. package/dist/channel-push/plugin.js +21 -0
  30. package/dist/channel-push/reconciler.d.ts +85 -0
  31. package/dist/channel-push/reconciler.d.ts.map +1 -0
  32. package/dist/channel-push/reconciler.js +179 -0
  33. package/dist/channel-push/subscriber.d.ts +40 -0
  34. package/dist/channel-push/subscriber.d.ts.map +1 -0
  35. package/dist/channel-push/subscriber.js +199 -0
  36. package/dist/channel-push/types.d.ts +43 -0
  37. package/dist/channel-push/types.d.ts.map +1 -0
  38. package/dist/channel-push/types.js +32 -0
  39. package/dist/channel-push/workflows.d.ts +56 -0
  40. package/dist/channel-push/workflows.d.ts.map +1 -0
  41. package/dist/channel-push/workflows.js +100 -0
  42. package/dist/external-refs/index.d.ts +11 -0
  43. package/dist/external-refs/index.d.ts.map +1 -0
  44. package/dist/external-refs/index.js +12 -0
  45. package/dist/external-refs/routes.d.ts +253 -0
  46. package/dist/external-refs/routes.d.ts.map +1 -0
  47. package/dist/external-refs/routes.js +52 -0
  48. package/dist/external-refs/schema.d.ts +251 -0
  49. package/dist/external-refs/schema.d.ts.map +1 -0
  50. package/dist/external-refs/schema.js +32 -0
  51. package/dist/external-refs/service.d.ts +82 -0
  52. package/dist/external-refs/service.d.ts.map +1 -0
  53. package/dist/external-refs/service.js +112 -0
  54. package/dist/external-refs/validation.d.ts +91 -0
  55. package/dist/external-refs/validation.d.ts.map +1 -0
  56. package/dist/external-refs/validation.js +40 -0
  57. package/dist/index.d.ts +21 -0
  58. package/dist/index.d.ts.map +1 -0
  59. package/dist/index.js +20 -0
  60. package/dist/interface-types.d.ts +128 -0
  61. package/dist/interface-types.d.ts.map +1 -0
  62. package/dist/interface-types.js +1 -0
  63. package/dist/interface.d.ts +10 -0
  64. package/dist/interface.d.ts.map +1 -0
  65. package/dist/interface.js +286 -0
  66. package/dist/rate-limit.d.ts +69 -0
  67. package/dist/rate-limit.d.ts.map +1 -0
  68. package/dist/rate-limit.js +135 -0
  69. package/dist/routes/batch.d.ts +200 -0
  70. package/dist/routes/batch.d.ts.map +1 -0
  71. package/dist/routes/batch.js +52 -0
  72. package/dist/routes/env.d.ts +8 -0
  73. package/dist/routes/env.d.ts.map +1 -0
  74. package/dist/routes/env.js +1 -0
  75. package/dist/routes/inventory.d.ts +604 -0
  76. package/dist/routes/inventory.d.ts.map +1 -0
  77. package/dist/routes/inventory.js +138 -0
  78. package/dist/routes/settlements.d.ts +1649 -0
  79. package/dist/routes/settlements.d.ts.map +1 -0
  80. package/dist/routes/settlements.js +265 -0
  81. package/dist/routes.d.ts +3909 -0
  82. package/dist/routes.d.ts.map +1 -0
  83. package/dist/routes.js +323 -0
  84. package/dist/schema-automation.d.ts +680 -0
  85. package/dist/schema-automation.d.ts.map +1 -0
  86. package/dist/schema-automation.js +76 -0
  87. package/dist/schema-core.d.ts +1674 -0
  88. package/dist/schema-core.d.ts.map +1 -0
  89. package/dist/schema-core.js +227 -0
  90. package/dist/schema-finance.d.ts +1372 -0
  91. package/dist/schema-finance.d.ts.map +1 -0
  92. package/dist/schema-finance.js +153 -0
  93. package/dist/schema-inventory.d.ts +855 -0
  94. package/dist/schema-inventory.d.ts.map +1 -0
  95. package/dist/schema-inventory.js +102 -0
  96. package/dist/schema-push-intents.d.ts +387 -0
  97. package/dist/schema-push-intents.d.ts.map +1 -0
  98. package/dist/schema-push-intents.js +77 -0
  99. package/dist/schema-relations.d.ts +95 -0
  100. package/dist/schema-relations.d.ts.map +1 -0
  101. package/dist/schema-relations.js +196 -0
  102. package/dist/schema-shared.d.ts +24 -0
  103. package/dist/schema-shared.d.ts.map +1 -0
  104. package/dist/schema-shared.js +123 -0
  105. package/dist/schema.d.ts +9 -0
  106. package/dist/schema.d.ts.map +1 -0
  107. package/dist/schema.js +8 -0
  108. package/dist/service/channels.d.ts +167 -0
  109. package/dist/service/channels.d.ts.map +1 -0
  110. package/dist/service/channels.js +305 -0
  111. package/dist/service/commercial.d.ts +385 -0
  112. package/dist/service/commercial.d.ts.map +1 -0
  113. package/dist/service/commercial.js +248 -0
  114. package/dist/service/helpers.d.ts +10 -0
  115. package/dist/service/helpers.d.ts.map +1 -0
  116. package/dist/service/helpers.js +7 -0
  117. package/dist/service/inventory.d.ts +193 -0
  118. package/dist/service/inventory.d.ts.map +1 -0
  119. package/dist/service/inventory.js +154 -0
  120. package/dist/service/settlement-policies.d.ts +325 -0
  121. package/dist/service/settlement-policies.d.ts.map +1 -0
  122. package/dist/service/settlement-policies.js +272 -0
  123. package/dist/service/settlements.d.ts +357 -0
  124. package/dist/service/settlements.d.ts.map +1 -0
  125. package/dist/service/settlements.js +319 -0
  126. package/dist/service/types.d.ts +60 -0
  127. package/dist/service/types.d.ts.map +1 -0
  128. package/dist/service/types.js +1 -0
  129. package/dist/service.d.ts +1418 -0
  130. package/dist/service.d.ts.map +1 -0
  131. package/dist/service.js +17 -0
  132. package/dist/suppliers/index.d.ts +15 -0
  133. package/dist/suppliers/index.d.ts.map +1 -0
  134. package/dist/suppliers/index.js +23 -0
  135. package/dist/suppliers/routes.d.ts +1202 -0
  136. package/dist/suppliers/routes.d.ts.map +1 -0
  137. package/dist/suppliers/routes.js +290 -0
  138. package/dist/suppliers/schema.d.ts +1272 -0
  139. package/dist/suppliers/schema.d.ts.map +1 -0
  140. package/dist/suppliers/schema.js +219 -0
  141. package/dist/suppliers/service-aggregates.d.ts +23 -0
  142. package/dist/suppliers/service-aggregates.d.ts.map +1 -0
  143. package/dist/suppliers/service-aggregates.js +51 -0
  144. package/dist/suppliers/service-core.d.ts +89 -0
  145. package/dist/suppliers/service-core.d.ts.map +1 -0
  146. package/dist/suppliers/service-core.js +164 -0
  147. package/dist/suppliers/service-identity.d.ts +162 -0
  148. package/dist/suppliers/service-identity.d.ts.map +1 -0
  149. package/dist/suppliers/service-identity.js +101 -0
  150. package/dist/suppliers/service-operations.d.ts +1500 -0
  151. package/dist/suppliers/service-operations.d.ts.map +1 -0
  152. package/dist/suppliers/service-operations.js +157 -0
  153. package/dist/suppliers/service-shared.d.ts +45 -0
  154. package/dist/suppliers/service-shared.d.ts.map +1 -0
  155. package/dist/suppliers/service-shared.js +294 -0
  156. package/dist/suppliers/service.d.ts +41 -0
  157. package/dist/suppliers/service.d.ts.map +1 -0
  158. package/dist/suppliers/service.js +40 -0
  159. package/dist/suppliers/validation.d.ts +2 -0
  160. package/dist/suppliers/validation.d.ts.map +1 -0
  161. package/dist/suppliers/validation.js +1 -0
  162. package/dist/validation.d.ts +1371 -0
  163. package/dist/validation.d.ts.map +1 -0
  164. package/dist/validation.js +445 -0
  165. package/dist/webhook-deliveries.d.ts +86 -0
  166. package/dist/webhook-deliveries.d.ts.map +1 -0
  167. package/dist/webhook-deliveries.js +296 -0
  168. package/package.json +71 -0
@@ -0,0 +1,11 @@
1
+ import type { Module } from "@voyant-travel/core";
2
+ import type { HonoModule } from "@voyant-travel/hono/module";
3
+ import { externalRefsService } from "./service.js";
4
+ export type { ExternalRefsRoutes } from "./routes.js";
5
+ export declare const externalRefsModule: Module;
6
+ export declare const externalRefsHonoModule: HonoModule;
7
+ export type { ExternalRef, NewExternalRef } from "./schema.js";
8
+ export { externalRefStatusEnum, externalRefs } from "./schema.js";
9
+ export { externalRefListQuerySchema, externalRefStatusSchema, insertExternalRefForEntitySchema, insertExternalRefSchema, selectExternalRefSchema, updateExternalRefSchema, } from "./validation.js";
10
+ export { externalRefsService };
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/external-refs/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAG5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAElD,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAErD,eAAO,MAAM,kBAAkB,EAAE,MAEhC,CAAA;AAED,eAAO,MAAM,sBAAsB,EAAE,UAGpC,CAAA;AAED,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC9D,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AACjE,OAAO,EACL,0BAA0B,EAC1B,uBAAuB,EACvB,gCAAgC,EAChC,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
@@ -0,0 +1,12 @@
1
+ import { externalRefsRoutes } from "./routes.js";
2
+ import { externalRefsService } from "./service.js";
3
+ export const externalRefsModule = {
4
+ name: "external-refs",
5
+ };
6
+ export const externalRefsHonoModule = {
7
+ module: externalRefsModule,
8
+ routes: externalRefsRoutes,
9
+ };
10
+ export { externalRefStatusEnum, externalRefs } from "./schema.js";
11
+ export { externalRefListQuerySchema, externalRefStatusSchema, insertExternalRefForEntitySchema, insertExternalRefSchema, selectExternalRefSchema, updateExternalRefSchema, } from "./validation.js";
12
+ export { externalRefsService };
@@ -0,0 +1,253 @@
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 externalRefsRoutes: import("hono/hono-base").HonoBase<Env, {
9
+ "/refs": {
10
+ $get: {
11
+ input: {};
12
+ output: {
13
+ data: {
14
+ id: string;
15
+ entityType: string;
16
+ entityId: string;
17
+ sourceSystem: string;
18
+ objectType: string;
19
+ namespace: string;
20
+ externalId: string;
21
+ externalParentId: string | null;
22
+ isPrimary: boolean;
23
+ status: "active" | "inactive" | "archived";
24
+ lastSyncedAt: string | null;
25
+ metadata: {
26
+ [x: string]: import("hono/utils/types").JSONValue;
27
+ } | null;
28
+ createdAt: string;
29
+ updatedAt: string;
30
+ }[];
31
+ total: number;
32
+ limit: number;
33
+ offset: number;
34
+ };
35
+ outputFormat: "json";
36
+ status: import("hono/utils/http-status").ContentfulStatusCode;
37
+ };
38
+ };
39
+ } & {
40
+ "/refs": {
41
+ $post: {
42
+ input: {};
43
+ output: {
44
+ data: {
45
+ createdAt: string;
46
+ updatedAt: string;
47
+ metadata: {
48
+ [x: string]: import("hono/utils/types").JSONValue;
49
+ } | null;
50
+ id: string;
51
+ status: "active" | "inactive" | "archived";
52
+ lastSyncedAt: string | null;
53
+ entityType: string;
54
+ entityId: string;
55
+ sourceSystem: string;
56
+ objectType: string;
57
+ namespace: string;
58
+ externalId: string;
59
+ externalParentId: string | null;
60
+ isPrimary: boolean;
61
+ } | null;
62
+ };
63
+ outputFormat: "json";
64
+ status: 201;
65
+ };
66
+ };
67
+ } & {
68
+ "/refs/:id": {
69
+ $get: {
70
+ input: {
71
+ param: {
72
+ id: string;
73
+ };
74
+ };
75
+ output: {
76
+ error: string;
77
+ };
78
+ outputFormat: "json";
79
+ status: 404;
80
+ } | {
81
+ input: {
82
+ param: {
83
+ id: string;
84
+ };
85
+ };
86
+ output: {
87
+ data: {
88
+ id: string;
89
+ entityType: string;
90
+ entityId: string;
91
+ sourceSystem: string;
92
+ objectType: string;
93
+ namespace: string;
94
+ externalId: string;
95
+ externalParentId: string | null;
96
+ isPrimary: boolean;
97
+ status: "active" | "inactive" | "archived";
98
+ lastSyncedAt: string | null;
99
+ metadata: {
100
+ [x: string]: import("hono/utils/types").JSONValue;
101
+ } | null;
102
+ createdAt: string;
103
+ updatedAt: string;
104
+ };
105
+ };
106
+ outputFormat: "json";
107
+ status: import("hono/utils/http-status").ContentfulStatusCode;
108
+ };
109
+ };
110
+ } & {
111
+ "/refs/:id": {
112
+ $patch: {
113
+ input: {
114
+ param: {
115
+ id: string;
116
+ };
117
+ };
118
+ output: {
119
+ error: string;
120
+ };
121
+ outputFormat: "json";
122
+ status: 404;
123
+ } | {
124
+ input: {
125
+ param: {
126
+ id: string;
127
+ };
128
+ };
129
+ output: {
130
+ data: {
131
+ id: string;
132
+ entityType: string;
133
+ entityId: string;
134
+ sourceSystem: string;
135
+ objectType: string;
136
+ namespace: string;
137
+ externalId: string;
138
+ externalParentId: string | null;
139
+ isPrimary: boolean;
140
+ status: "active" | "inactive" | "archived";
141
+ lastSyncedAt: string | null;
142
+ metadata: {
143
+ [x: string]: import("hono/utils/types").JSONValue;
144
+ } | null;
145
+ createdAt: string;
146
+ updatedAt: string;
147
+ };
148
+ };
149
+ outputFormat: "json";
150
+ status: import("hono/utils/http-status").ContentfulStatusCode;
151
+ };
152
+ };
153
+ } & {
154
+ "/refs/:id": {
155
+ $delete: {
156
+ input: {
157
+ param: {
158
+ id: string;
159
+ };
160
+ };
161
+ output: {
162
+ error: string;
163
+ };
164
+ outputFormat: "json";
165
+ status: 404;
166
+ } | {
167
+ input: {
168
+ param: {
169
+ id: string;
170
+ };
171
+ };
172
+ output: {
173
+ success: true;
174
+ };
175
+ outputFormat: "json";
176
+ status: import("hono/utils/http-status").ContentfulStatusCode;
177
+ };
178
+ };
179
+ } & {
180
+ "/entities/:entityType/:entityId/refs": {
181
+ $get: {
182
+ input: {
183
+ param: {
184
+ entityType: string;
185
+ } & {
186
+ entityId: string;
187
+ };
188
+ };
189
+ output: {
190
+ data: {
191
+ id: string;
192
+ entityType: string;
193
+ entityId: string;
194
+ sourceSystem: string;
195
+ objectType: string;
196
+ namespace: string;
197
+ externalId: string;
198
+ externalParentId: string | null;
199
+ isPrimary: boolean;
200
+ status: "active" | "inactive" | "archived";
201
+ lastSyncedAt: string | null;
202
+ metadata: {
203
+ [x: string]: import("hono/utils/types").JSONValue;
204
+ } | null;
205
+ createdAt: string;
206
+ updatedAt: string;
207
+ }[];
208
+ total: number;
209
+ limit: number;
210
+ offset: number;
211
+ };
212
+ outputFormat: "json";
213
+ status: import("hono/utils/http-status").ContentfulStatusCode;
214
+ };
215
+ };
216
+ } & {
217
+ "/entities/:entityType/:entityId/refs": {
218
+ $post: {
219
+ input: {
220
+ param: {
221
+ entityType: string;
222
+ } & {
223
+ entityId: string;
224
+ };
225
+ };
226
+ output: {
227
+ data: {
228
+ createdAt: string;
229
+ updatedAt: string;
230
+ metadata: {
231
+ [x: string]: import("hono/utils/types").JSONValue;
232
+ } | null;
233
+ id: string;
234
+ status: "active" | "inactive" | "archived";
235
+ lastSyncedAt: string | null;
236
+ entityType: string;
237
+ entityId: string;
238
+ sourceSystem: string;
239
+ objectType: string;
240
+ namespace: string;
241
+ externalId: string;
242
+ externalParentId: string | null;
243
+ isPrimary: boolean;
244
+ } | null;
245
+ };
246
+ outputFormat: "json";
247
+ status: 201;
248
+ };
249
+ };
250
+ }, "/", "/entities/:entityType/:entityId/refs">;
251
+ export type ExternalRefsRoutes = typeof externalRefsRoutes;
252
+ export {};
253
+ //# sourceMappingURL=routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/external-refs/routes.ts"],"names":[],"mappings":"AACA,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,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+CAyD3B,CAAA;AAEJ,MAAM,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,CAAA"}
@@ -0,0 +1,52 @@
1
+ import { parseJsonBody, parseQuery } from "@voyant-travel/hono";
2
+ import { Hono } from "hono";
3
+ import { externalRefsService } from "./service.js";
4
+ import { externalRefListQuerySchema, insertExternalRefForEntitySchema, insertExternalRefSchema, updateExternalRefSchema, } from "./validation.js";
5
+ export const externalRefsRoutes = new Hono()
6
+ .get("/refs", async (c) => {
7
+ const query = await parseQuery(c, externalRefListQuerySchema);
8
+ return c.json(await externalRefsService.listExternalRefs(c.get("db"), query));
9
+ })
10
+ .post("/refs", async (c) => {
11
+ return c.json({
12
+ data: await externalRefsService.createExternalRef(c.get("db"), await parseJsonBody(c, insertExternalRefSchema)),
13
+ }, 201);
14
+ })
15
+ .get("/refs/:id", async (c) => {
16
+ const row = await externalRefsService.getExternalRefById(c.get("db"), c.req.param("id"));
17
+ if (!row)
18
+ return c.json({ error: "External reference not found" }, 404);
19
+ return c.json({ data: row });
20
+ })
21
+ .patch("/refs/:id", async (c) => {
22
+ const row = await externalRefsService.updateExternalRef(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateExternalRefSchema));
23
+ if (!row)
24
+ return c.json({ error: "External reference not found" }, 404);
25
+ return c.json({ data: row });
26
+ })
27
+ .delete("/refs/:id", async (c) => {
28
+ const row = await externalRefsService.deleteExternalRef(c.get("db"), c.req.param("id"));
29
+ if (!row)
30
+ return c.json({ error: "External reference not found" }, 404);
31
+ return c.json({ success: true });
32
+ })
33
+ .get("/entities/:entityType/:entityId/refs", async (c) => {
34
+ const params = c.req.param();
35
+ const query = externalRefListQuerySchema.parse({
36
+ ...(await parseQuery(c, externalRefListQuerySchema.partial())),
37
+ entityType: params.entityType,
38
+ entityId: params.entityId,
39
+ });
40
+ return c.json(await externalRefsService.listExternalRefs(c.get("db"), query));
41
+ })
42
+ .post("/entities/:entityType/:entityId/refs", async (c) => {
43
+ const params = c.req.param();
44
+ const body = await parseJsonBody(c, insertExternalRefForEntitySchema);
45
+ return c.json({
46
+ data: await externalRefsService.createExternalRef(c.get("db"), {
47
+ ...body,
48
+ entityType: params.entityType,
49
+ entityId: params.entityId,
50
+ }),
51
+ }, 201);
52
+ });
@@ -0,0 +1,251 @@
1
+ export declare const externalRefStatusEnum: import("drizzle-orm/pg-core").PgEnum<["active", "inactive", "archived"]>;
2
+ export declare const externalRefs: import("drizzle-orm/pg-core").PgTableWithColumns<{
3
+ name: "external_refs";
4
+ schema: undefined;
5
+ columns: {
6
+ id: import("drizzle-orm/pg-core").PgColumn<{
7
+ name: string;
8
+ tableName: "external_refs";
9
+ dataType: "string";
10
+ columnType: "PgText";
11
+ data: string;
12
+ driverParam: string;
13
+ notNull: true;
14
+ hasDefault: true;
15
+ isPrimaryKey: true;
16
+ isAutoincrement: false;
17
+ hasRuntimeDefault: true;
18
+ enumValues: [string, ...string[]];
19
+ baseColumn: never;
20
+ identity: undefined;
21
+ generated: undefined;
22
+ }, {}, {}>;
23
+ entityType: import("drizzle-orm/pg-core").PgColumn<{
24
+ name: "entity_type";
25
+ tableName: "external_refs";
26
+ dataType: "string";
27
+ columnType: "PgText";
28
+ data: string;
29
+ driverParam: string;
30
+ notNull: true;
31
+ hasDefault: false;
32
+ isPrimaryKey: false;
33
+ isAutoincrement: false;
34
+ hasRuntimeDefault: false;
35
+ enumValues: [string, ...string[]];
36
+ baseColumn: never;
37
+ identity: undefined;
38
+ generated: undefined;
39
+ }, {}, {}>;
40
+ entityId: import("drizzle-orm/pg-core").PgColumn<{
41
+ name: "entity_id";
42
+ tableName: "external_refs";
43
+ dataType: "string";
44
+ columnType: "PgText";
45
+ data: string;
46
+ driverParam: string;
47
+ notNull: true;
48
+ hasDefault: false;
49
+ isPrimaryKey: false;
50
+ isAutoincrement: false;
51
+ hasRuntimeDefault: false;
52
+ enumValues: [string, ...string[]];
53
+ baseColumn: never;
54
+ identity: undefined;
55
+ generated: undefined;
56
+ }, {}, {}>;
57
+ sourceSystem: import("drizzle-orm/pg-core").PgColumn<{
58
+ name: "source_system";
59
+ tableName: "external_refs";
60
+ dataType: "string";
61
+ columnType: "PgText";
62
+ data: string;
63
+ driverParam: string;
64
+ notNull: true;
65
+ hasDefault: false;
66
+ isPrimaryKey: false;
67
+ isAutoincrement: false;
68
+ hasRuntimeDefault: false;
69
+ enumValues: [string, ...string[]];
70
+ baseColumn: never;
71
+ identity: undefined;
72
+ generated: undefined;
73
+ }, {}, {}>;
74
+ objectType: import("drizzle-orm/pg-core").PgColumn<{
75
+ name: "object_type";
76
+ tableName: "external_refs";
77
+ dataType: "string";
78
+ columnType: "PgText";
79
+ data: string;
80
+ driverParam: string;
81
+ notNull: true;
82
+ hasDefault: false;
83
+ isPrimaryKey: false;
84
+ isAutoincrement: false;
85
+ hasRuntimeDefault: false;
86
+ enumValues: [string, ...string[]];
87
+ baseColumn: never;
88
+ identity: undefined;
89
+ generated: undefined;
90
+ }, {}, {}>;
91
+ namespace: import("drizzle-orm/pg-core").PgColumn<{
92
+ name: "namespace";
93
+ tableName: "external_refs";
94
+ dataType: "string";
95
+ columnType: "PgText";
96
+ data: string;
97
+ driverParam: string;
98
+ notNull: true;
99
+ hasDefault: true;
100
+ isPrimaryKey: false;
101
+ isAutoincrement: false;
102
+ hasRuntimeDefault: false;
103
+ enumValues: [string, ...string[]];
104
+ baseColumn: never;
105
+ identity: undefined;
106
+ generated: undefined;
107
+ }, {}, {}>;
108
+ externalId: import("drizzle-orm/pg-core").PgColumn<{
109
+ name: "external_id";
110
+ tableName: "external_refs";
111
+ dataType: "string";
112
+ columnType: "PgText";
113
+ data: string;
114
+ driverParam: string;
115
+ notNull: true;
116
+ hasDefault: false;
117
+ isPrimaryKey: false;
118
+ isAutoincrement: false;
119
+ hasRuntimeDefault: false;
120
+ enumValues: [string, ...string[]];
121
+ baseColumn: never;
122
+ identity: undefined;
123
+ generated: undefined;
124
+ }, {}, {}>;
125
+ externalParentId: import("drizzle-orm/pg-core").PgColumn<{
126
+ name: "external_parent_id";
127
+ tableName: "external_refs";
128
+ dataType: "string";
129
+ columnType: "PgText";
130
+ data: string;
131
+ driverParam: string;
132
+ notNull: false;
133
+ hasDefault: false;
134
+ isPrimaryKey: false;
135
+ isAutoincrement: false;
136
+ hasRuntimeDefault: false;
137
+ enumValues: [string, ...string[]];
138
+ baseColumn: never;
139
+ identity: undefined;
140
+ generated: undefined;
141
+ }, {}, {}>;
142
+ isPrimary: import("drizzle-orm/pg-core").PgColumn<{
143
+ name: "is_primary";
144
+ tableName: "external_refs";
145
+ dataType: "boolean";
146
+ columnType: "PgBoolean";
147
+ data: boolean;
148
+ driverParam: boolean;
149
+ notNull: true;
150
+ hasDefault: true;
151
+ isPrimaryKey: false;
152
+ isAutoincrement: false;
153
+ hasRuntimeDefault: false;
154
+ enumValues: undefined;
155
+ baseColumn: never;
156
+ identity: undefined;
157
+ generated: undefined;
158
+ }, {}, {}>;
159
+ status: import("drizzle-orm/pg-core").PgColumn<{
160
+ name: "status";
161
+ tableName: "external_refs";
162
+ dataType: "string";
163
+ columnType: "PgEnumColumn";
164
+ data: "active" | "inactive" | "archived";
165
+ driverParam: string;
166
+ notNull: true;
167
+ hasDefault: true;
168
+ isPrimaryKey: false;
169
+ isAutoincrement: false;
170
+ hasRuntimeDefault: false;
171
+ enumValues: ["active", "inactive", "archived"];
172
+ baseColumn: never;
173
+ identity: undefined;
174
+ generated: undefined;
175
+ }, {}, {}>;
176
+ lastSyncedAt: import("drizzle-orm/pg-core").PgColumn<{
177
+ name: "last_synced_at";
178
+ tableName: "external_refs";
179
+ dataType: "date";
180
+ columnType: "PgTimestamp";
181
+ data: Date;
182
+ driverParam: string;
183
+ notNull: false;
184
+ hasDefault: false;
185
+ isPrimaryKey: false;
186
+ isAutoincrement: false;
187
+ hasRuntimeDefault: false;
188
+ enumValues: undefined;
189
+ baseColumn: never;
190
+ identity: undefined;
191
+ generated: undefined;
192
+ }, {}, {}>;
193
+ metadata: import("drizzle-orm/pg-core").PgColumn<{
194
+ name: "metadata";
195
+ tableName: "external_refs";
196
+ dataType: "json";
197
+ columnType: "PgJsonb";
198
+ data: Record<string, unknown>;
199
+ driverParam: unknown;
200
+ notNull: false;
201
+ hasDefault: false;
202
+ isPrimaryKey: false;
203
+ isAutoincrement: false;
204
+ hasRuntimeDefault: false;
205
+ enumValues: undefined;
206
+ baseColumn: never;
207
+ identity: undefined;
208
+ generated: undefined;
209
+ }, {}, {
210
+ $type: Record<string, unknown>;
211
+ }>;
212
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
213
+ name: "created_at";
214
+ tableName: "external_refs";
215
+ dataType: "date";
216
+ columnType: "PgTimestamp";
217
+ data: Date;
218
+ driverParam: string;
219
+ notNull: true;
220
+ hasDefault: true;
221
+ isPrimaryKey: false;
222
+ isAutoincrement: false;
223
+ hasRuntimeDefault: false;
224
+ enumValues: undefined;
225
+ baseColumn: never;
226
+ identity: undefined;
227
+ generated: undefined;
228
+ }, {}, {}>;
229
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
230
+ name: "updated_at";
231
+ tableName: "external_refs";
232
+ dataType: "date";
233
+ columnType: "PgTimestamp";
234
+ data: Date;
235
+ driverParam: string;
236
+ notNull: true;
237
+ hasDefault: true;
238
+ isPrimaryKey: false;
239
+ isAutoincrement: false;
240
+ hasRuntimeDefault: false;
241
+ enumValues: undefined;
242
+ baseColumn: never;
243
+ identity: undefined;
244
+ generated: undefined;
245
+ }, {}, {}>;
246
+ };
247
+ dialect: "pg";
248
+ }>;
249
+ export type ExternalRef = typeof externalRefs.$inferSelect;
250
+ export type NewExternalRef = typeof externalRefs.$inferInsert;
251
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/external-refs/schema.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,qBAAqB,0EAIhC,CAAA;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2CxB,CAAA;AAED,MAAM,MAAM,WAAW,GAAG,OAAO,YAAY,CAAC,YAAY,CAAA;AAC1D,MAAM,MAAM,cAAc,GAAG,OAAO,YAAY,CAAC,YAAY,CAAA"}
@@ -0,0 +1,32 @@
1
+ import { typeId } from "@voyant-travel/db/lib/typeid-column";
2
+ import { boolean, index, jsonb, pgEnum, pgTable, text, timestamp, uniqueIndex, } from "drizzle-orm/pg-core";
3
+ export const externalRefStatusEnum = pgEnum("external_ref_status", [
4
+ "active",
5
+ "inactive",
6
+ "archived",
7
+ ]);
8
+ export const externalRefs = pgTable("external_refs", {
9
+ id: typeId("external_refs"),
10
+ entityType: text("entity_type").notNull(),
11
+ entityId: text("entity_id").notNull(),
12
+ sourceSystem: text("source_system").notNull(),
13
+ objectType: text("object_type").notNull(),
14
+ namespace: text("namespace").notNull().default("default"),
15
+ externalId: text("external_id").notNull(),
16
+ externalParentId: text("external_parent_id"),
17
+ isPrimary: boolean("is_primary").notNull().default(false),
18
+ status: externalRefStatusEnum("status").notNull().default("active"),
19
+ lastSyncedAt: timestamp("last_synced_at", { withTimezone: true }),
20
+ metadata: jsonb("metadata").$type(),
21
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
22
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
23
+ }, (table) => [
24
+ index("idx_external_refs_updated").on(table.updatedAt),
25
+ index("idx_external_refs_entity_updated").on(table.entityType, table.entityId, table.updatedAt),
26
+ index("idx_external_refs_source_updated").on(table.sourceSystem, table.objectType, table.updatedAt),
27
+ index("idx_external_refs_namespace_updated").on(table.namespace, table.updatedAt),
28
+ index("idx_external_refs_external_id").on(table.externalId),
29
+ index("idx_external_refs_status_updated").on(table.status, table.updatedAt),
30
+ uniqueIndex("uidx_external_refs_entity_source_external").on(table.entityType, table.entityId, table.sourceSystem, table.namespace, table.externalId),
31
+ uniqueIndex("uidx_external_refs_source_object_external").on(table.sourceSystem, table.objectType, table.namespace, table.externalId),
32
+ ]);