@voyantjs/transactions 0.1.1 → 0.3.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.
Files changed (43) hide show
  1. package/dist/routes-offers.d.ts +885 -0
  2. package/dist/routes-offers.d.ts.map +1 -0
  3. package/dist/routes-offers.js +161 -0
  4. package/dist/routes-orders.d.ts +1056 -0
  5. package/dist/routes-orders.d.ts.map +1 -0
  6. package/dist/routes-orders.js +180 -0
  7. package/dist/routes-shared.d.ts +103 -0
  8. package/dist/routes-shared.d.ts.map +1 -0
  9. package/dist/routes-shared.js +97 -0
  10. package/dist/routes.d.ts +3 -1979
  11. package/dist/routes.d.ts.map +1 -1
  12. package/dist/routes.js +5 -604
  13. package/dist/schema-audit.d.ts +216 -0
  14. package/dist/schema-audit.d.ts.map +1 -0
  15. package/dist/schema-audit.js +22 -0
  16. package/dist/schema-offers.d.ts +1301 -0
  17. package/dist/schema-offers.d.ts.map +1 -0
  18. package/dist/schema-offers.js +120 -0
  19. package/dist/schema-orders.d.ts +1582 -0
  20. package/dist/schema-orders.d.ts.map +1 -0
  21. package/dist/schema-orders.js +149 -0
  22. package/dist/schema-relations.d.ts +42 -0
  23. package/dist/schema-relations.d.ts.map +1 -0
  24. package/dist/schema-relations.js +56 -0
  25. package/dist/schema-shared.d.ts +12 -0
  26. package/dist/schema-shared.d.ts.map +1 -0
  27. package/dist/schema-shared.js +84 -0
  28. package/dist/schema.d.ts +5 -3148
  29. package/dist/schema.d.ts.map +1 -1
  30. package/dist/schema.js +5 -420
  31. package/dist/service-offers.d.ts +447 -0
  32. package/dist/service-offers.d.ts.map +1 -0
  33. package/dist/service-offers.js +262 -0
  34. package/dist/service-orders.d.ts +443 -0
  35. package/dist/service-orders.d.ts.map +1 -0
  36. package/dist/service-orders.js +278 -0
  37. package/dist/service-shared.d.ts +86 -0
  38. package/dist/service-shared.d.ts.map +1 -0
  39. package/dist/service-shared.js +49 -0
  40. package/dist/service.d.ts +48 -927
  41. package/dist/service.d.ts.map +1 -1
  42. package/dist/service.js +48 -595
  43. package/package.json +5 -5
@@ -0,0 +1,262 @@
1
+ import { and, asc, desc, eq, ilike, or, sql } from "drizzle-orm";
2
+ import { offerItemParticipants, offerItems, offerParticipants, offers } from "./schema.js";
3
+ import { normalizeTimestamp, paginate, toOfferParticipantResponse } from "./service-shared.js";
4
+ export async function listOffers(db, query) {
5
+ const conditions = [];
6
+ if (query.status)
7
+ conditions.push(eq(offers.status, query.status));
8
+ if (query.opportunityId)
9
+ conditions.push(eq(offers.opportunityId, query.opportunityId));
10
+ if (query.quoteId)
11
+ conditions.push(eq(offers.quoteId, query.quoteId));
12
+ if (query.personId)
13
+ conditions.push(eq(offers.personId, query.personId));
14
+ if (query.organizationId)
15
+ conditions.push(eq(offers.organizationId, query.organizationId));
16
+ if (query.marketId)
17
+ conditions.push(eq(offers.marketId, query.marketId));
18
+ if (query.search) {
19
+ const term = `%${query.search}%`;
20
+ conditions.push(or(ilike(offers.offerNumber, term), ilike(offers.title, term)));
21
+ }
22
+ const where = conditions.length ? and(...conditions) : undefined;
23
+ return paginate(db
24
+ .select()
25
+ .from(offers)
26
+ .where(where)
27
+ .limit(query.limit)
28
+ .offset(query.offset)
29
+ .orderBy(desc(offers.createdAt)), db.select({ count: sql `count(*)::int` }).from(offers).where(where), query.limit, query.offset);
30
+ }
31
+ export async function getOfferById(db, id) {
32
+ const [row] = await db.select().from(offers).where(eq(offers.id, id)).limit(1);
33
+ return row ?? null;
34
+ }
35
+ export async function createOffer(db, data) {
36
+ const { sentAt, acceptedAt, convertedAt, ...rest } = data;
37
+ const [row] = await db
38
+ .insert(offers)
39
+ .values({
40
+ ...rest,
41
+ sentAt: normalizeTimestamp(sentAt),
42
+ acceptedAt: normalizeTimestamp(acceptedAt),
43
+ convertedAt: normalizeTimestamp(convertedAt),
44
+ })
45
+ .returning();
46
+ return row ?? null;
47
+ }
48
+ export async function createOfferBundle(db, input) {
49
+ return db.transaction(async (tx) => {
50
+ const offer = await createOffer(tx, input.offer);
51
+ if (!offer)
52
+ return null;
53
+ const participants = [];
54
+ for (const participant of input.participants ?? []) {
55
+ const created = await createOfferParticipant(tx, {
56
+ ...participant,
57
+ offerId: offer.id,
58
+ });
59
+ if (!created)
60
+ throw new Error("Failed to create offer participant");
61
+ participants.push(created);
62
+ }
63
+ const items = [];
64
+ for (const item of input.items) {
65
+ const created = await createOfferItem(tx, {
66
+ ...item,
67
+ offerId: offer.id,
68
+ });
69
+ if (!created)
70
+ throw new Error("Failed to create offer item");
71
+ items.push(created);
72
+ }
73
+ const itemParticipants = [];
74
+ for (const link of input.itemParticipants ?? []) {
75
+ const item = items[link.itemIndex];
76
+ const participant = participants[link.participantIndex];
77
+ if (!item || !participant)
78
+ throw new Error("Invalid offer item participant link");
79
+ const created = await createOfferItemParticipant(tx, {
80
+ offerItemId: item.id,
81
+ participantId: participant.id,
82
+ role: link.role,
83
+ isPrimary: link.isPrimary,
84
+ });
85
+ if (!created)
86
+ throw new Error("Failed to create offer item participant");
87
+ itemParticipants.push(created);
88
+ }
89
+ return { offer, participants, items, itemParticipants };
90
+ });
91
+ }
92
+ export async function updateOffer(db, id, data) {
93
+ const { sentAt, acceptedAt, convertedAt, ...rest } = data;
94
+ const [row] = await db
95
+ .update(offers)
96
+ .set({
97
+ ...rest,
98
+ sentAt: normalizeTimestamp(sentAt),
99
+ acceptedAt: normalizeTimestamp(acceptedAt),
100
+ convertedAt: normalizeTimestamp(convertedAt),
101
+ updatedAt: new Date(),
102
+ })
103
+ .where(eq(offers.id, id))
104
+ .returning();
105
+ return row ?? null;
106
+ }
107
+ export async function deleteOffer(db, id) {
108
+ const [row] = await db.delete(offers).where(eq(offers.id, id)).returning({ id: offers.id });
109
+ return row ?? null;
110
+ }
111
+ export async function listOfferParticipants(db, query) {
112
+ const conditions = [];
113
+ if (query.offerId)
114
+ conditions.push(eq(offerParticipants.offerId, query.offerId));
115
+ if (query.personId)
116
+ conditions.push(eq(offerParticipants.personId, query.personId));
117
+ const where = conditions.length ? and(...conditions) : undefined;
118
+ const rows = db
119
+ .select()
120
+ .from(offerParticipants)
121
+ .where(where)
122
+ .limit(query.limit)
123
+ .offset(query.offset)
124
+ .orderBy(asc(offerParticipants.createdAt))
125
+ .then((items) => items.map(toOfferParticipantResponse));
126
+ return paginate(rows, db.select({ count: sql `count(*)::int` }).from(offerParticipants).where(where), query.limit, query.offset);
127
+ }
128
+ export async function getOfferParticipantById(db, id) {
129
+ const [row] = await db
130
+ .select()
131
+ .from(offerParticipants)
132
+ .where(eq(offerParticipants.id, id))
133
+ .limit(1);
134
+ return row ? toOfferParticipantResponse(row) : null;
135
+ }
136
+ export async function createOfferParticipant(db, data) {
137
+ const { dateOfBirth, nationality, ...rest } = data;
138
+ void dateOfBirth;
139
+ void nationality;
140
+ const [row] = await db.insert(offerParticipants).values(rest).returning();
141
+ return row ? toOfferParticipantResponse(row) : null;
142
+ }
143
+ export async function updateOfferParticipant(db, id, data) {
144
+ const { dateOfBirth, nationality, ...rest } = data;
145
+ void dateOfBirth;
146
+ void nationality;
147
+ const [row] = await db
148
+ .update(offerParticipants)
149
+ .set({ ...rest, updatedAt: new Date() })
150
+ .where(eq(offerParticipants.id, id))
151
+ .returning();
152
+ return row ? toOfferParticipantResponse(row) : null;
153
+ }
154
+ export async function deleteOfferParticipant(db, id) {
155
+ const [row] = await db
156
+ .delete(offerParticipants)
157
+ .where(eq(offerParticipants.id, id))
158
+ .returning({ id: offerParticipants.id });
159
+ return row ?? null;
160
+ }
161
+ export async function listOfferItems(db, query) {
162
+ const conditions = [];
163
+ if (query.offerId)
164
+ conditions.push(eq(offerItems.offerId, query.offerId));
165
+ if (query.productId)
166
+ conditions.push(eq(offerItems.productId, query.productId));
167
+ if (query.optionId)
168
+ conditions.push(eq(offerItems.optionId, query.optionId));
169
+ if (query.unitId)
170
+ conditions.push(eq(offerItems.unitId, query.unitId));
171
+ if (query.slotId)
172
+ conditions.push(eq(offerItems.slotId, query.slotId));
173
+ if (query.status)
174
+ conditions.push(eq(offerItems.status, query.status));
175
+ const where = conditions.length ? and(...conditions) : undefined;
176
+ return paginate(db
177
+ .select()
178
+ .from(offerItems)
179
+ .where(where)
180
+ .limit(query.limit)
181
+ .offset(query.offset)
182
+ .orderBy(asc(offerItems.createdAt)), db.select({ count: sql `count(*)::int` }).from(offerItems).where(where), query.limit, query.offset);
183
+ }
184
+ export async function getOfferItemById(db, id) {
185
+ const [row] = await db.select().from(offerItems).where(eq(offerItems.id, id)).limit(1);
186
+ return row ?? null;
187
+ }
188
+ export async function createOfferItem(db, data) {
189
+ const { startsAt, endsAt, ...rest } = data;
190
+ const [row] = await db
191
+ .insert(offerItems)
192
+ .values({
193
+ ...rest,
194
+ startsAt: normalizeTimestamp(startsAt),
195
+ endsAt: normalizeTimestamp(endsAt),
196
+ })
197
+ .returning();
198
+ return row ?? null;
199
+ }
200
+ export async function updateOfferItem(db, id, data) {
201
+ const { startsAt, endsAt, ...rest } = data;
202
+ const [row] = await db
203
+ .update(offerItems)
204
+ .set({
205
+ ...rest,
206
+ startsAt: normalizeTimestamp(startsAt),
207
+ endsAt: normalizeTimestamp(endsAt),
208
+ updatedAt: new Date(),
209
+ })
210
+ .where(eq(offerItems.id, id))
211
+ .returning();
212
+ return row ?? null;
213
+ }
214
+ export async function deleteOfferItem(db, id) {
215
+ const [row] = await db
216
+ .delete(offerItems)
217
+ .where(eq(offerItems.id, id))
218
+ .returning({ id: offerItems.id });
219
+ return row ?? null;
220
+ }
221
+ export async function listOfferItemParticipants(db, query) {
222
+ const conditions = [];
223
+ if (query.offerItemId)
224
+ conditions.push(eq(offerItemParticipants.offerItemId, query.offerItemId));
225
+ if (query.participantId)
226
+ conditions.push(eq(offerItemParticipants.participantId, query.participantId));
227
+ const where = conditions.length ? and(...conditions) : undefined;
228
+ return paginate(db
229
+ .select()
230
+ .from(offerItemParticipants)
231
+ .where(where)
232
+ .limit(query.limit)
233
+ .offset(query.offset)
234
+ .orderBy(asc(offerItemParticipants.createdAt)), db.select({ count: sql `count(*)::int` }).from(offerItemParticipants).where(where), query.limit, query.offset);
235
+ }
236
+ export async function getOfferItemParticipantById(db, id) {
237
+ const [row] = await db
238
+ .select()
239
+ .from(offerItemParticipants)
240
+ .where(eq(offerItemParticipants.id, id))
241
+ .limit(1);
242
+ return row ?? null;
243
+ }
244
+ export async function createOfferItemParticipant(db, data) {
245
+ const [row] = await db.insert(offerItemParticipants).values(data).returning();
246
+ return row ?? null;
247
+ }
248
+ export async function updateOfferItemParticipant(db, id, data) {
249
+ const [row] = await db
250
+ .update(offerItemParticipants)
251
+ .set(data)
252
+ .where(eq(offerItemParticipants.id, id))
253
+ .returning();
254
+ return row ?? null;
255
+ }
256
+ export async function deleteOfferItemParticipant(db, id) {
257
+ const [row] = await db
258
+ .delete(offerItemParticipants)
259
+ .where(eq(offerItemParticipants.id, id))
260
+ .returning({ id: offerItemParticipants.id });
261
+ return row ?? null;
262
+ }
@@ -0,0 +1,443 @@
1
+ import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
2
+ import type { CreateOrderInput, CreateOrderItemInput, CreateOrderItemParticipantInput, CreateOrderParticipantInput, CreateOrderTermInput, OrderItemListQuery, OrderItemParticipantListQuery, OrderListQuery, OrderParticipantListQuery, OrderTermListQuery, UpdateOrderInput, UpdateOrderItemInput, UpdateOrderItemParticipantInput, UpdateOrderParticipantInput, UpdateOrderTermInput } from "./service-shared.js";
3
+ export declare function listOrders(db: PostgresJsDatabase, query: OrderListQuery): Promise<{
4
+ data: {
5
+ id: string;
6
+ orderNumber: string;
7
+ offerId: string | null;
8
+ title: string;
9
+ status: "draft" | "expired" | "pending" | "confirmed" | "fulfilled" | "cancelled";
10
+ personId: string | null;
11
+ organizationId: string | null;
12
+ opportunityId: string | null;
13
+ quoteId: string | null;
14
+ marketId: string | null;
15
+ sourceChannelId: string | null;
16
+ currency: string;
17
+ baseCurrency: string | null;
18
+ fxRateSetId: string | null;
19
+ subtotalAmountCents: number;
20
+ taxAmountCents: number;
21
+ feeAmountCents: number;
22
+ totalAmountCents: number;
23
+ costAmountCents: number;
24
+ orderedAt: Date | null;
25
+ confirmedAt: Date | null;
26
+ cancelledAt: Date | null;
27
+ expiresAt: Date | null;
28
+ notes: string | null;
29
+ metadata: unknown;
30
+ createdAt: Date;
31
+ updatedAt: Date;
32
+ }[];
33
+ total: number;
34
+ limit: number;
35
+ offset: number;
36
+ }>;
37
+ export declare function getOrderById(db: PostgresJsDatabase, id: string): Promise<{
38
+ id: string;
39
+ orderNumber: string;
40
+ offerId: string | null;
41
+ title: string;
42
+ status: "draft" | "expired" | "pending" | "confirmed" | "fulfilled" | "cancelled";
43
+ personId: string | null;
44
+ organizationId: string | null;
45
+ opportunityId: string | null;
46
+ quoteId: string | null;
47
+ marketId: string | null;
48
+ sourceChannelId: string | null;
49
+ currency: string;
50
+ baseCurrency: string | null;
51
+ fxRateSetId: string | null;
52
+ subtotalAmountCents: number;
53
+ taxAmountCents: number;
54
+ feeAmountCents: number;
55
+ totalAmountCents: number;
56
+ costAmountCents: number;
57
+ orderedAt: Date | null;
58
+ confirmedAt: Date | null;
59
+ cancelledAt: Date | null;
60
+ expiresAt: Date | null;
61
+ notes: string | null;
62
+ metadata: unknown;
63
+ createdAt: Date;
64
+ updatedAt: Date;
65
+ } | null>;
66
+ export declare function createOrder(db: PostgresJsDatabase, data: CreateOrderInput): Promise<{
67
+ offerId: string | null;
68
+ createdAt: Date;
69
+ updatedAt: Date;
70
+ currency: string;
71
+ notes: string | null;
72
+ id: string;
73
+ metadata: unknown;
74
+ title: string;
75
+ status: "draft" | "expired" | "pending" | "confirmed" | "fulfilled" | "cancelled";
76
+ personId: string | null;
77
+ organizationId: string | null;
78
+ opportunityId: string | null;
79
+ quoteId: string | null;
80
+ marketId: string | null;
81
+ sourceChannelId: string | null;
82
+ baseCurrency: string | null;
83
+ fxRateSetId: string | null;
84
+ subtotalAmountCents: number;
85
+ taxAmountCents: number;
86
+ feeAmountCents: number;
87
+ totalAmountCents: number;
88
+ costAmountCents: number;
89
+ orderNumber: string;
90
+ orderedAt: Date | null;
91
+ confirmedAt: Date | null;
92
+ cancelledAt: Date | null;
93
+ expiresAt: Date | null;
94
+ } | null>;
95
+ export declare function updateOrder(db: PostgresJsDatabase, id: string, data: UpdateOrderInput): Promise<{
96
+ id: string;
97
+ orderNumber: string;
98
+ offerId: string | null;
99
+ title: string;
100
+ status: "draft" | "expired" | "pending" | "confirmed" | "fulfilled" | "cancelled";
101
+ personId: string | null;
102
+ organizationId: string | null;
103
+ opportunityId: string | null;
104
+ quoteId: string | null;
105
+ marketId: string | null;
106
+ sourceChannelId: string | null;
107
+ currency: string;
108
+ baseCurrency: string | null;
109
+ fxRateSetId: string | null;
110
+ subtotalAmountCents: number;
111
+ taxAmountCents: number;
112
+ feeAmountCents: number;
113
+ totalAmountCents: number;
114
+ costAmountCents: number;
115
+ orderedAt: Date | null;
116
+ confirmedAt: Date | null;
117
+ cancelledAt: Date | null;
118
+ expiresAt: Date | null;
119
+ notes: string | null;
120
+ metadata: unknown;
121
+ createdAt: Date;
122
+ updatedAt: Date;
123
+ } | null>;
124
+ export declare function deleteOrder(db: PostgresJsDatabase, id: string): Promise<{
125
+ id: string;
126
+ } | null>;
127
+ export declare function listOrderParticipants(db: PostgresJsDatabase, query: OrderParticipantListQuery): Promise<{
128
+ data: {
129
+ id: string;
130
+ orderId: string;
131
+ personId: string | null;
132
+ participantType: "staff" | "other" | "traveler" | "booker" | "contact" | "occupant";
133
+ travelerCategory: "other" | "adult" | "child" | "infant" | "senior" | null;
134
+ firstName: string;
135
+ lastName: string;
136
+ email: string | null;
137
+ phone: string | null;
138
+ preferredLanguage: string | null;
139
+ isPrimary: boolean;
140
+ notes: string | null;
141
+ hasTravelIdentity: boolean;
142
+ createdAt: Date;
143
+ updatedAt: Date;
144
+ }[];
145
+ total: number;
146
+ limit: number;
147
+ offset: number;
148
+ }>;
149
+ export declare function getOrderParticipantById(db: PostgresJsDatabase, id: string): Promise<{
150
+ id: string;
151
+ orderId: string;
152
+ personId: string | null;
153
+ participantType: "staff" | "other" | "traveler" | "booker" | "contact" | "occupant";
154
+ travelerCategory: "other" | "adult" | "child" | "infant" | "senior" | null;
155
+ firstName: string;
156
+ lastName: string;
157
+ email: string | null;
158
+ phone: string | null;
159
+ preferredLanguage: string | null;
160
+ isPrimary: boolean;
161
+ notes: string | null;
162
+ hasTravelIdentity: boolean;
163
+ createdAt: Date;
164
+ updatedAt: Date;
165
+ } | null>;
166
+ export declare function createOrderParticipant(db: PostgresJsDatabase, data: CreateOrderParticipantInput): Promise<{
167
+ id: string;
168
+ orderId: string;
169
+ personId: string | null;
170
+ participantType: "staff" | "other" | "traveler" | "booker" | "contact" | "occupant";
171
+ travelerCategory: "other" | "adult" | "child" | "infant" | "senior" | null;
172
+ firstName: string;
173
+ lastName: string;
174
+ email: string | null;
175
+ phone: string | null;
176
+ preferredLanguage: string | null;
177
+ isPrimary: boolean;
178
+ notes: string | null;
179
+ hasTravelIdentity: boolean;
180
+ createdAt: Date;
181
+ updatedAt: Date;
182
+ } | null>;
183
+ export declare function updateOrderParticipant(db: PostgresJsDatabase, id: string, data: UpdateOrderParticipantInput): Promise<{
184
+ id: string;
185
+ orderId: string;
186
+ personId: string | null;
187
+ participantType: "staff" | "other" | "traveler" | "booker" | "contact" | "occupant";
188
+ travelerCategory: "other" | "adult" | "child" | "infant" | "senior" | null;
189
+ firstName: string;
190
+ lastName: string;
191
+ email: string | null;
192
+ phone: string | null;
193
+ preferredLanguage: string | null;
194
+ isPrimary: boolean;
195
+ notes: string | null;
196
+ hasTravelIdentity: boolean;
197
+ createdAt: Date;
198
+ updatedAt: Date;
199
+ } | null>;
200
+ export declare function deleteOrderParticipant(db: PostgresJsDatabase, id: string): Promise<{
201
+ id: string;
202
+ } | null>;
203
+ export declare function listOrderItems(db: PostgresJsDatabase, query: OrderItemListQuery): Promise<{
204
+ data: {
205
+ id: string;
206
+ orderId: string;
207
+ offerItemId: string | null;
208
+ productId: string | null;
209
+ optionId: string | null;
210
+ unitId: string | null;
211
+ slotId: string | null;
212
+ title: string;
213
+ description: string | null;
214
+ itemType: "other" | "unit" | "service" | "extra" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
215
+ status: "draft" | "confirmed" | "fulfilled" | "cancelled" | "priced";
216
+ serviceDate: string | null;
217
+ startsAt: Date | null;
218
+ endsAt: Date | null;
219
+ quantity: number;
220
+ sellCurrency: string;
221
+ unitSellAmountCents: number | null;
222
+ totalSellAmountCents: number | null;
223
+ taxAmountCents: number | null;
224
+ feeAmountCents: number | null;
225
+ costCurrency: string | null;
226
+ unitCostAmountCents: number | null;
227
+ totalCostAmountCents: number | null;
228
+ notes: string | null;
229
+ metadata: unknown;
230
+ createdAt: Date;
231
+ updatedAt: Date;
232
+ }[];
233
+ total: number;
234
+ limit: number;
235
+ offset: number;
236
+ }>;
237
+ export declare function getOrderItemById(db: PostgresJsDatabase, id: string): Promise<{
238
+ id: string;
239
+ orderId: string;
240
+ offerItemId: string | null;
241
+ productId: string | null;
242
+ optionId: string | null;
243
+ unitId: string | null;
244
+ slotId: string | null;
245
+ title: string;
246
+ description: string | null;
247
+ itemType: "other" | "unit" | "service" | "extra" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
248
+ status: "draft" | "confirmed" | "fulfilled" | "cancelled" | "priced";
249
+ serviceDate: string | null;
250
+ startsAt: Date | null;
251
+ endsAt: Date | null;
252
+ quantity: number;
253
+ sellCurrency: string;
254
+ unitSellAmountCents: number | null;
255
+ totalSellAmountCents: number | null;
256
+ taxAmountCents: number | null;
257
+ feeAmountCents: number | null;
258
+ costCurrency: string | null;
259
+ unitCostAmountCents: number | null;
260
+ totalCostAmountCents: number | null;
261
+ notes: string | null;
262
+ metadata: unknown;
263
+ createdAt: Date;
264
+ updatedAt: Date;
265
+ } | null>;
266
+ export declare function createOrderItem(db: PostgresJsDatabase, data: CreateOrderItemInput): Promise<{
267
+ orderId: string;
268
+ createdAt: Date;
269
+ updatedAt: Date;
270
+ description: string | null;
271
+ notes: string | null;
272
+ id: string;
273
+ metadata: unknown;
274
+ title: string;
275
+ status: "draft" | "confirmed" | "fulfilled" | "cancelled" | "priced";
276
+ taxAmountCents: number | null;
277
+ feeAmountCents: number | null;
278
+ productId: string | null;
279
+ optionId: string | null;
280
+ unitId: string | null;
281
+ slotId: string | null;
282
+ itemType: "other" | "unit" | "service" | "extra" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
283
+ serviceDate: string | null;
284
+ startsAt: Date | null;
285
+ endsAt: Date | null;
286
+ quantity: number;
287
+ sellCurrency: string;
288
+ unitSellAmountCents: number | null;
289
+ totalSellAmountCents: number | null;
290
+ costCurrency: string | null;
291
+ unitCostAmountCents: number | null;
292
+ totalCostAmountCents: number | null;
293
+ offerItemId: string | null;
294
+ } | null>;
295
+ export declare function updateOrderItem(db: PostgresJsDatabase, id: string, data: UpdateOrderItemInput): Promise<{
296
+ id: string;
297
+ orderId: string;
298
+ offerItemId: string | null;
299
+ productId: string | null;
300
+ optionId: string | null;
301
+ unitId: string | null;
302
+ slotId: string | null;
303
+ title: string;
304
+ description: string | null;
305
+ itemType: "other" | "unit" | "service" | "extra" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
306
+ status: "draft" | "confirmed" | "fulfilled" | "cancelled" | "priced";
307
+ serviceDate: string | null;
308
+ startsAt: Date | null;
309
+ endsAt: Date | null;
310
+ quantity: number;
311
+ sellCurrency: string;
312
+ unitSellAmountCents: number | null;
313
+ totalSellAmountCents: number | null;
314
+ taxAmountCents: number | null;
315
+ feeAmountCents: number | null;
316
+ costCurrency: string | null;
317
+ unitCostAmountCents: number | null;
318
+ totalCostAmountCents: number | null;
319
+ notes: string | null;
320
+ metadata: unknown;
321
+ createdAt: Date;
322
+ updatedAt: Date;
323
+ } | null>;
324
+ export declare function deleteOrderItem(db: PostgresJsDatabase, id: string): Promise<{
325
+ id: string;
326
+ } | null>;
327
+ export declare function listOrderItemParticipants(db: PostgresJsDatabase, query: OrderItemParticipantListQuery): Promise<{
328
+ data: {
329
+ id: string;
330
+ orderItemId: string;
331
+ participantId: string;
332
+ role: "other" | "traveler" | "occupant" | "primary_contact" | "beneficiary" | "service_assignee";
333
+ isPrimary: boolean;
334
+ createdAt: Date;
335
+ }[];
336
+ total: number;
337
+ limit: number;
338
+ offset: number;
339
+ }>;
340
+ export declare function getOrderItemParticipantById(db: PostgresJsDatabase, id: string): Promise<{
341
+ id: string;
342
+ orderItemId: string;
343
+ participantId: string;
344
+ role: "other" | "traveler" | "occupant" | "primary_contact" | "beneficiary" | "service_assignee";
345
+ isPrimary: boolean;
346
+ createdAt: Date;
347
+ } | null>;
348
+ export declare function createOrderItemParticipant(db: PostgresJsDatabase, data: CreateOrderItemParticipantInput): Promise<{
349
+ createdAt: Date;
350
+ participantId: string;
351
+ id: string;
352
+ isPrimary: boolean;
353
+ role: "other" | "traveler" | "occupant" | "primary_contact" | "beneficiary" | "service_assignee";
354
+ orderItemId: string;
355
+ } | null>;
356
+ export declare function updateOrderItemParticipant(db: PostgresJsDatabase, id: string, data: UpdateOrderItemParticipantInput): Promise<{
357
+ id: string;
358
+ orderItemId: string;
359
+ participantId: string;
360
+ role: "other" | "traveler" | "occupant" | "primary_contact" | "beneficiary" | "service_assignee";
361
+ isPrimary: boolean;
362
+ createdAt: Date;
363
+ } | null>;
364
+ export declare function deleteOrderItemParticipant(db: PostgresJsDatabase, id: string): Promise<{
365
+ id: string;
366
+ } | null>;
367
+ export declare function listOrderTerms(db: PostgresJsDatabase, query: OrderTermListQuery): Promise<{
368
+ data: {
369
+ id: string;
370
+ offerId: string | null;
371
+ orderId: string | null;
372
+ termType: "other" | "terms_and_conditions" | "cancellation" | "guarantee" | "payment" | "pricing" | "commission";
373
+ title: string;
374
+ body: string;
375
+ language: string | null;
376
+ required: boolean;
377
+ sortOrder: number;
378
+ acceptanceStatus: "accepted" | "pending" | "not_required" | "declined";
379
+ acceptedAt: Date | null;
380
+ acceptedBy: string | null;
381
+ metadata: unknown;
382
+ createdAt: Date;
383
+ updatedAt: Date;
384
+ }[];
385
+ total: number;
386
+ limit: number;
387
+ offset: number;
388
+ }>;
389
+ export declare function getOrderTermById(db: PostgresJsDatabase, id: string): Promise<{
390
+ id: string;
391
+ offerId: string | null;
392
+ orderId: string | null;
393
+ termType: "other" | "terms_and_conditions" | "cancellation" | "guarantee" | "payment" | "pricing" | "commission";
394
+ title: string;
395
+ body: string;
396
+ language: string | null;
397
+ required: boolean;
398
+ sortOrder: number;
399
+ acceptanceStatus: "accepted" | "pending" | "not_required" | "declined";
400
+ acceptedAt: Date | null;
401
+ acceptedBy: string | null;
402
+ metadata: unknown;
403
+ createdAt: Date;
404
+ updatedAt: Date;
405
+ } | null>;
406
+ export declare function createOrderTerm(db: PostgresJsDatabase, data: CreateOrderTermInput): Promise<{
407
+ offerId: string | null;
408
+ orderId: string | null;
409
+ createdAt: Date;
410
+ updatedAt: Date;
411
+ body: string;
412
+ id: string;
413
+ metadata: unknown;
414
+ title: string;
415
+ acceptedAt: Date | null;
416
+ termType: "other" | "terms_and_conditions" | "cancellation" | "guarantee" | "payment" | "pricing" | "commission";
417
+ language: string | null;
418
+ required: boolean;
419
+ sortOrder: number;
420
+ acceptanceStatus: "accepted" | "pending" | "not_required" | "declined";
421
+ acceptedBy: string | null;
422
+ } | null>;
423
+ export declare function updateOrderTerm(db: PostgresJsDatabase, id: string, data: UpdateOrderTermInput): Promise<{
424
+ id: string;
425
+ offerId: string | null;
426
+ orderId: string | null;
427
+ termType: "other" | "terms_and_conditions" | "cancellation" | "guarantee" | "payment" | "pricing" | "commission";
428
+ title: string;
429
+ body: string;
430
+ language: string | null;
431
+ required: boolean;
432
+ sortOrder: number;
433
+ acceptanceStatus: "accepted" | "pending" | "not_required" | "declined";
434
+ acceptedAt: Date | null;
435
+ acceptedBy: string | null;
436
+ metadata: unknown;
437
+ createdAt: Date;
438
+ updatedAt: Date;
439
+ } | null>;
440
+ export declare function deleteOrderTerm(db: PostgresJsDatabase, id: string): Promise<{
441
+ id: string;
442
+ } | null>;
443
+ //# sourceMappingURL=service-orders.d.ts.map