@voyantjs/pricing 0.2.0 → 0.3.1
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/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/routes-core.d.ts +981 -0
- package/dist/routes-core.d.ts.map +1 -0
- package/dist/routes-core.js +101 -0
- package/dist/routes-public.d.ts +136 -0
- package/dist/routes-public.d.ts.map +1 -0
- package/dist/routes-public.js +13 -0
- package/dist/routes-rules.d.ts +1176 -0
- package/dist/routes-rules.d.ts.map +1 -0
- package/dist/routes-rules.js +117 -0
- package/dist/routes-shared.d.ts +12 -0
- package/dist/routes-shared.d.ts.map +1 -0
- package/dist/routes-shared.js +3 -0
- package/dist/routes.d.ts +5 -2160
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +5 -354
- package/dist/schema-catalogs.d.ts +467 -0
- package/dist/schema-catalogs.d.ts.map +1 -0
- package/dist/schema-catalogs.js +44 -0
- package/dist/schema-categories.d.ts +497 -0
- package/dist/schema-categories.d.ts.map +1 -0
- package/dist/schema-categories.js +50 -0
- package/dist/schema-option-rules.d.ts +1770 -0
- package/dist/schema-option-rules.d.ts.map +1 -0
- package/dist/schema-option-rules.js +174 -0
- package/dist/schema-policies.d.ts +395 -0
- package/dist/schema-policies.d.ts.map +1 -0
- package/dist/schema-policies.js +38 -0
- package/dist/schema-relations.d.ts +55 -0
- package/dist/schema-relations.d.ts.map +1 -0
- package/dist/schema-relations.js +103 -0
- package/dist/schema-shared.d.ts +11 -0
- package/dist/schema-shared.d.ts.map +1 -0
- package/dist/schema-shared.js +67 -0
- package/dist/schema.d.ts +6 -3189
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +6 -458
- package/dist/service-catalogs.d.ts +139 -0
- package/dist/service-catalogs.d.ts.map +1 -0
- package/dist/service-catalogs.js +89 -0
- package/dist/service-categories.d.ts +147 -0
- package/dist/service-categories.d.ts.map +1 -0
- package/dist/service-categories.js +105 -0
- package/dist/service-option-rules.d.ts +307 -0
- package/dist/service-option-rules.d.ts.map +1 -0
- package/dist/service-option-rules.js +188 -0
- package/dist/service-policies.d.ts +123 -0
- package/dist/service-policies.d.ts.map +1 -0
- package/dist/service-policies.js +95 -0
- package/dist/service-public.d.ts +89 -0
- package/dist/service-public.d.ts.map +1 -0
- package/dist/service-public.js +355 -0
- package/dist/service-shared.d.ts +50 -0
- package/dist/service-shared.d.ts.map +1 -0
- package/dist/service-shared.js +4 -0
- package/dist/service-transfer-rules.d.ts +211 -0
- package/dist/service-transfer-rules.d.ts.map +1 -0
- package/dist/service-transfer-rules.js +139 -0
- package/dist/service.d.ts +70 -955
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +70 -595
- package/dist/validation-public.d.ts +410 -0
- package/dist/validation-public.d.ts.map +1 -0
- package/dist/validation-public.js +109 -0
- package/dist/validation-shared.d.ts +71 -0
- package/dist/validation-shared.d.ts.map +1 -0
- package/dist/validation-shared.js +63 -0
- package/dist/validation.d.ts +4 -69
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +5 -62
- package/package.json +16 -8
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import { availabilitySlots, availabilityStartTimes } from "@voyantjs/availability/schema";
|
|
2
|
+
import { optionUnits, productOptions, products } from "@voyantjs/products/schema";
|
|
3
|
+
import { and, asc, desc, eq, gte, inArray, lte, ne, or, sql } from "drizzle-orm";
|
|
4
|
+
import { optionPriceRules, optionStartTimeRules, optionUnitPriceRules, optionUnitTiers, priceCatalogs, } from "./schema.js";
|
|
5
|
+
function normalizeDate(value) {
|
|
6
|
+
if (!value) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
return value instanceof Date ? value.toISOString() : value;
|
|
10
|
+
}
|
|
11
|
+
async function ensurePublicProduct(db, productId) {
|
|
12
|
+
const [product] = await db
|
|
13
|
+
.select({
|
|
14
|
+
id: products.id,
|
|
15
|
+
bookingMode: products.bookingMode,
|
|
16
|
+
capacityMode: products.capacityMode,
|
|
17
|
+
})
|
|
18
|
+
.from(products)
|
|
19
|
+
.where(and(eq(products.id, productId), eq(products.status, "active"), eq(products.activated, true), eq(products.visibility, "public")))
|
|
20
|
+
.limit(1);
|
|
21
|
+
return product ?? null;
|
|
22
|
+
}
|
|
23
|
+
async function resolvePublicCatalog(db, input) {
|
|
24
|
+
if (input.catalogId) {
|
|
25
|
+
const [catalog] = await db
|
|
26
|
+
.select({
|
|
27
|
+
id: priceCatalogs.id,
|
|
28
|
+
code: priceCatalogs.code,
|
|
29
|
+
name: priceCatalogs.name,
|
|
30
|
+
currencyCode: priceCatalogs.currencyCode,
|
|
31
|
+
})
|
|
32
|
+
.from(priceCatalogs)
|
|
33
|
+
.where(and(eq(priceCatalogs.id, input.catalogId), eq(priceCatalogs.catalogType, "public"), eq(priceCatalogs.active, true)))
|
|
34
|
+
.limit(1);
|
|
35
|
+
return catalog ?? null;
|
|
36
|
+
}
|
|
37
|
+
const [catalog] = await db
|
|
38
|
+
.select({
|
|
39
|
+
id: priceCatalogs.id,
|
|
40
|
+
code: priceCatalogs.code,
|
|
41
|
+
name: priceCatalogs.name,
|
|
42
|
+
currencyCode: priceCatalogs.currencyCode,
|
|
43
|
+
})
|
|
44
|
+
.from(priceCatalogs)
|
|
45
|
+
.where(and(eq(priceCatalogs.catalogType, "public"), eq(priceCatalogs.active, true)))
|
|
46
|
+
.orderBy(desc(priceCatalogs.isDefault), asc(priceCatalogs.name))
|
|
47
|
+
.limit(1);
|
|
48
|
+
return catalog ?? null;
|
|
49
|
+
}
|
|
50
|
+
export const publicPricingService = {
|
|
51
|
+
async getProductPricingSnapshot(db, productId, query) {
|
|
52
|
+
const product = await ensurePublicProduct(db, productId);
|
|
53
|
+
if (!product) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
const catalog = await resolvePublicCatalog(db, query);
|
|
57
|
+
if (!catalog) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
const optionConditions = [
|
|
61
|
+
eq(productOptions.productId, productId),
|
|
62
|
+
eq(productOptions.status, "active"),
|
|
63
|
+
];
|
|
64
|
+
if (query.optionId) {
|
|
65
|
+
optionConditions.push(eq(productOptions.id, query.optionId));
|
|
66
|
+
}
|
|
67
|
+
const options = await db
|
|
68
|
+
.select({
|
|
69
|
+
id: productOptions.id,
|
|
70
|
+
name: productOptions.name,
|
|
71
|
+
description: productOptions.description,
|
|
72
|
+
status: productOptions.status,
|
|
73
|
+
isDefault: productOptions.isDefault,
|
|
74
|
+
})
|
|
75
|
+
.from(productOptions)
|
|
76
|
+
.where(and(...optionConditions))
|
|
77
|
+
.orderBy(desc(productOptions.isDefault), asc(productOptions.sortOrder), asc(productOptions.name));
|
|
78
|
+
if (options.length === 0) {
|
|
79
|
+
return {
|
|
80
|
+
productId,
|
|
81
|
+
catalog: {
|
|
82
|
+
...catalog,
|
|
83
|
+
currencyCode: catalog.currencyCode ?? null,
|
|
84
|
+
},
|
|
85
|
+
options: [],
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
const optionIds = options.map((option) => option.id);
|
|
89
|
+
const [units, rules] = await Promise.all([
|
|
90
|
+
db
|
|
91
|
+
.select({
|
|
92
|
+
id: optionUnits.id,
|
|
93
|
+
optionId: optionUnits.optionId,
|
|
94
|
+
name: optionUnits.name,
|
|
95
|
+
unitType: optionUnits.unitType,
|
|
96
|
+
isHidden: optionUnits.isHidden,
|
|
97
|
+
sortOrder: optionUnits.sortOrder,
|
|
98
|
+
})
|
|
99
|
+
.from(optionUnits)
|
|
100
|
+
.where(and(inArray(optionUnits.optionId, optionIds), eq(optionUnits.isHidden, false)))
|
|
101
|
+
.orderBy(asc(optionUnits.sortOrder), asc(optionUnits.name)),
|
|
102
|
+
db
|
|
103
|
+
.select({
|
|
104
|
+
id: optionPriceRules.id,
|
|
105
|
+
optionId: optionPriceRules.optionId,
|
|
106
|
+
name: optionPriceRules.name,
|
|
107
|
+
description: optionPriceRules.description,
|
|
108
|
+
pricingMode: optionPriceRules.pricingMode,
|
|
109
|
+
baseSellAmountCents: optionPriceRules.baseSellAmountCents,
|
|
110
|
+
minPerBooking: optionPriceRules.minPerBooking,
|
|
111
|
+
maxPerBooking: optionPriceRules.maxPerBooking,
|
|
112
|
+
isDefault: optionPriceRules.isDefault,
|
|
113
|
+
cancellationPolicyId: optionPriceRules.cancellationPolicyId,
|
|
114
|
+
})
|
|
115
|
+
.from(optionPriceRules)
|
|
116
|
+
.where(and(eq(optionPriceRules.productId, productId), inArray(optionPriceRules.optionId, optionIds), eq(optionPriceRules.priceCatalogId, catalog.id), eq(optionPriceRules.active, true)))
|
|
117
|
+
.orderBy(desc(optionPriceRules.isDefault), asc(optionPriceRules.name)),
|
|
118
|
+
]);
|
|
119
|
+
const ruleIds = rules.map((rule) => rule.id);
|
|
120
|
+
const [unitPrices, startTimeAdjustments] = await Promise.all([
|
|
121
|
+
ruleIds.length > 0
|
|
122
|
+
? db
|
|
123
|
+
.select({
|
|
124
|
+
id: optionUnitPriceRules.id,
|
|
125
|
+
optionPriceRuleId: optionUnitPriceRules.optionPriceRuleId,
|
|
126
|
+
unitId: optionUnitPriceRules.unitId,
|
|
127
|
+
pricingMode: optionUnitPriceRules.pricingMode,
|
|
128
|
+
sellAmountCents: optionUnitPriceRules.sellAmountCents,
|
|
129
|
+
minQuantity: optionUnitPriceRules.minQuantity,
|
|
130
|
+
maxQuantity: optionUnitPriceRules.maxQuantity,
|
|
131
|
+
pricingCategoryId: optionUnitPriceRules.pricingCategoryId,
|
|
132
|
+
sortOrder: optionUnitPriceRules.sortOrder,
|
|
133
|
+
})
|
|
134
|
+
.from(optionUnitPriceRules)
|
|
135
|
+
.where(and(inArray(optionUnitPriceRules.optionPriceRuleId, ruleIds), eq(optionUnitPriceRules.active, true)))
|
|
136
|
+
.orderBy(asc(optionUnitPriceRules.sortOrder), asc(optionUnitPriceRules.createdAt))
|
|
137
|
+
: Promise.resolve([]),
|
|
138
|
+
ruleIds.length > 0
|
|
139
|
+
? db
|
|
140
|
+
.select({
|
|
141
|
+
id: optionStartTimeRules.id,
|
|
142
|
+
optionPriceRuleId: optionStartTimeRules.optionPriceRuleId,
|
|
143
|
+
startTimeId: optionStartTimeRules.startTimeId,
|
|
144
|
+
label: availabilityStartTimes.label,
|
|
145
|
+
startTimeLocal: availabilityStartTimes.startTimeLocal,
|
|
146
|
+
durationMinutes: availabilityStartTimes.durationMinutes,
|
|
147
|
+
ruleMode: optionStartTimeRules.ruleMode,
|
|
148
|
+
adjustmentType: optionStartTimeRules.adjustmentType,
|
|
149
|
+
sellAdjustmentCents: optionStartTimeRules.sellAdjustmentCents,
|
|
150
|
+
adjustmentBasisPoints: optionStartTimeRules.adjustmentBasisPoints,
|
|
151
|
+
})
|
|
152
|
+
.from(optionStartTimeRules)
|
|
153
|
+
.innerJoin(availabilityStartTimes, eq(availabilityStartTimes.id, optionStartTimeRules.startTimeId))
|
|
154
|
+
.where(and(inArray(optionStartTimeRules.optionPriceRuleId, ruleIds), eq(optionStartTimeRules.active, true), eq(availabilityStartTimes.active, true)))
|
|
155
|
+
.orderBy(asc(availabilityStartTimes.sortOrder), asc(availabilityStartTimes.startTimeLocal))
|
|
156
|
+
: Promise.resolve([]),
|
|
157
|
+
]);
|
|
158
|
+
const unitPriceIds = unitPrices.map((unitPrice) => unitPrice.id);
|
|
159
|
+
const tiers = unitPriceIds.length > 0
|
|
160
|
+
? await db
|
|
161
|
+
.select({
|
|
162
|
+
id: optionUnitTiers.id,
|
|
163
|
+
optionUnitPriceRuleId: optionUnitTiers.optionUnitPriceRuleId,
|
|
164
|
+
minQuantity: optionUnitTiers.minQuantity,
|
|
165
|
+
maxQuantity: optionUnitTiers.maxQuantity,
|
|
166
|
+
sellAmountCents: optionUnitTiers.sellAmountCents,
|
|
167
|
+
sortOrder: optionUnitTiers.sortOrder,
|
|
168
|
+
})
|
|
169
|
+
.from(optionUnitTiers)
|
|
170
|
+
.where(and(inArray(optionUnitTiers.optionUnitPriceRuleId, unitPriceIds), eq(optionUnitTiers.active, true)))
|
|
171
|
+
.orderBy(asc(optionUnitTiers.sortOrder), asc(optionUnitTiers.minQuantity))
|
|
172
|
+
: [];
|
|
173
|
+
const unitById = new Map(units.map((unit) => [
|
|
174
|
+
unit.id,
|
|
175
|
+
{
|
|
176
|
+
id: unit.id,
|
|
177
|
+
unitId: unit.id,
|
|
178
|
+
unitName: unit.name,
|
|
179
|
+
unitType: unit.unitType,
|
|
180
|
+
sortOrder: unit.sortOrder,
|
|
181
|
+
},
|
|
182
|
+
]));
|
|
183
|
+
const tiersByUnitPriceRule = new Map();
|
|
184
|
+
for (const tier of tiers) {
|
|
185
|
+
const existing = tiersByUnitPriceRule.get(tier.optionUnitPriceRuleId) ?? [];
|
|
186
|
+
existing.push(tier);
|
|
187
|
+
tiersByUnitPriceRule.set(tier.optionUnitPriceRuleId, existing);
|
|
188
|
+
}
|
|
189
|
+
const unitPricesByRule = new Map();
|
|
190
|
+
for (const unitPrice of unitPrices) {
|
|
191
|
+
const existing = unitPricesByRule.get(unitPrice.optionPriceRuleId) ?? [];
|
|
192
|
+
existing.push(unitPrice);
|
|
193
|
+
unitPricesByRule.set(unitPrice.optionPriceRuleId, existing);
|
|
194
|
+
}
|
|
195
|
+
const startTimeAdjustmentsByRule = new Map();
|
|
196
|
+
for (const adjustment of startTimeAdjustments) {
|
|
197
|
+
const existing = startTimeAdjustmentsByRule.get(adjustment.optionPriceRuleId) ?? [];
|
|
198
|
+
existing.push(adjustment);
|
|
199
|
+
startTimeAdjustmentsByRule.set(adjustment.optionPriceRuleId, existing);
|
|
200
|
+
}
|
|
201
|
+
const rulesByOption = new Map();
|
|
202
|
+
for (const rule of rules) {
|
|
203
|
+
const existing = rulesByOption.get(rule.optionId) ?? [];
|
|
204
|
+
existing.push(rule);
|
|
205
|
+
rulesByOption.set(rule.optionId, existing);
|
|
206
|
+
}
|
|
207
|
+
return {
|
|
208
|
+
productId,
|
|
209
|
+
catalog: {
|
|
210
|
+
...catalog,
|
|
211
|
+
currencyCode: catalog.currencyCode ?? null,
|
|
212
|
+
},
|
|
213
|
+
options: options.map((option) => ({
|
|
214
|
+
id: option.id,
|
|
215
|
+
name: option.name,
|
|
216
|
+
description: option.description ?? null,
|
|
217
|
+
status: option.status,
|
|
218
|
+
isDefault: option.isDefault,
|
|
219
|
+
bookingMode: product.bookingMode,
|
|
220
|
+
capacityMode: product.capacityMode,
|
|
221
|
+
pricingRules: (rulesByOption.get(option.id) ?? []).map((rule) => ({
|
|
222
|
+
id: rule.id,
|
|
223
|
+
name: rule.name,
|
|
224
|
+
description: rule.description ?? null,
|
|
225
|
+
pricingMode: rule.pricingMode,
|
|
226
|
+
baseSellAmountCents: rule.baseSellAmountCents ?? null,
|
|
227
|
+
minPerBooking: rule.minPerBooking ?? null,
|
|
228
|
+
maxPerBooking: rule.maxPerBooking ?? null,
|
|
229
|
+
isDefault: rule.isDefault,
|
|
230
|
+
cancellationPolicyId: rule.cancellationPolicyId ?? null,
|
|
231
|
+
unitPrices: (unitPricesByRule.get(rule.id) ?? [])
|
|
232
|
+
.map((unitPrice) => {
|
|
233
|
+
const unit = unitById.get(unitPrice.unitId);
|
|
234
|
+
if (!unit) {
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
237
|
+
return {
|
|
238
|
+
id: unitPrice.id,
|
|
239
|
+
unitId: unit.unitId,
|
|
240
|
+
unitName: unit.unitName,
|
|
241
|
+
unitType: unit.unitType,
|
|
242
|
+
pricingMode: unitPrice.pricingMode,
|
|
243
|
+
sellAmountCents: unitPrice.sellAmountCents ?? null,
|
|
244
|
+
minQuantity: unitPrice.minQuantity ?? null,
|
|
245
|
+
maxQuantity: unitPrice.maxQuantity ?? null,
|
|
246
|
+
pricingCategoryId: unitPrice.pricingCategoryId ?? null,
|
|
247
|
+
sortOrder: unitPrice.sortOrder,
|
|
248
|
+
tiers: (tiersByUnitPriceRule.get(unitPrice.id) ?? []).map((tier) => ({
|
|
249
|
+
id: tier.id,
|
|
250
|
+
minQuantity: tier.minQuantity,
|
|
251
|
+
maxQuantity: tier.maxQuantity ?? null,
|
|
252
|
+
sellAmountCents: tier.sellAmountCents ?? null,
|
|
253
|
+
sortOrder: tier.sortOrder,
|
|
254
|
+
})),
|
|
255
|
+
};
|
|
256
|
+
})
|
|
257
|
+
.filter((value) => value !== null),
|
|
258
|
+
startTimeAdjustments: (startTimeAdjustmentsByRule.get(rule.id) ?? []).map((adjustment) => ({
|
|
259
|
+
id: adjustment.id,
|
|
260
|
+
startTimeId: adjustment.startTimeId,
|
|
261
|
+
label: adjustment.label ?? null,
|
|
262
|
+
startTimeLocal: adjustment.startTimeLocal,
|
|
263
|
+
ruleMode: adjustment.ruleMode,
|
|
264
|
+
adjustmentType: adjustment.adjustmentType ?? null,
|
|
265
|
+
sellAdjustmentCents: adjustment.sellAdjustmentCents ?? null,
|
|
266
|
+
adjustmentBasisPoints: adjustment.adjustmentBasisPoints ?? null,
|
|
267
|
+
})),
|
|
268
|
+
})),
|
|
269
|
+
})),
|
|
270
|
+
};
|
|
271
|
+
},
|
|
272
|
+
async getAvailabilitySnapshot(db, productId, query) {
|
|
273
|
+
const product = await ensurePublicProduct(db, productId);
|
|
274
|
+
if (!product) {
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
const conditions = [
|
|
278
|
+
eq(availabilitySlots.productId, productId),
|
|
279
|
+
ne(availabilitySlots.status, "cancelled"),
|
|
280
|
+
];
|
|
281
|
+
if (query.optionId) {
|
|
282
|
+
conditions.push(eq(availabilitySlots.optionId, query.optionId));
|
|
283
|
+
}
|
|
284
|
+
if (query.dateFrom) {
|
|
285
|
+
conditions.push(gte(availabilitySlots.dateLocal, query.dateFrom));
|
|
286
|
+
}
|
|
287
|
+
if (query.dateTo) {
|
|
288
|
+
conditions.push(lte(availabilitySlots.dateLocal, query.dateTo));
|
|
289
|
+
}
|
|
290
|
+
if (query.status) {
|
|
291
|
+
conditions.push(eq(availabilitySlots.status, query.status));
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
conditions.push(or(eq(availabilitySlots.status, "open"), eq(availabilitySlots.status, "sold_out")) ??
|
|
295
|
+
sql `1 = 1`);
|
|
296
|
+
}
|
|
297
|
+
const where = and(...conditions);
|
|
298
|
+
const [rows, countResult] = await Promise.all([
|
|
299
|
+
db
|
|
300
|
+
.select({
|
|
301
|
+
id: availabilitySlots.id,
|
|
302
|
+
optionId: availabilitySlots.optionId,
|
|
303
|
+
dateLocal: availabilitySlots.dateLocal,
|
|
304
|
+
startsAt: availabilitySlots.startsAt,
|
|
305
|
+
endsAt: availabilitySlots.endsAt,
|
|
306
|
+
timezone: availabilitySlots.timezone,
|
|
307
|
+
status: availabilitySlots.status,
|
|
308
|
+
unlimited: availabilitySlots.unlimited,
|
|
309
|
+
remainingPax: availabilitySlots.remainingPax,
|
|
310
|
+
remainingResources: availabilitySlots.remainingResources,
|
|
311
|
+
pastCutoff: availabilitySlots.pastCutoff,
|
|
312
|
+
tooEarly: availabilitySlots.tooEarly,
|
|
313
|
+
startTimeId: availabilityStartTimes.id,
|
|
314
|
+
startTimeLabel: availabilityStartTimes.label,
|
|
315
|
+
startTimeLocal: availabilityStartTimes.startTimeLocal,
|
|
316
|
+
durationMinutes: availabilityStartTimes.durationMinutes,
|
|
317
|
+
})
|
|
318
|
+
.from(availabilitySlots)
|
|
319
|
+
.leftJoin(availabilityStartTimes, eq(availabilityStartTimes.id, availabilitySlots.startTimeId))
|
|
320
|
+
.where(where)
|
|
321
|
+
.orderBy(asc(availabilitySlots.startsAt))
|
|
322
|
+
.limit(query.limit)
|
|
323
|
+
.offset(query.offset),
|
|
324
|
+
db.select({ count: sql `count(*)::int` }).from(availabilitySlots).where(where),
|
|
325
|
+
]);
|
|
326
|
+
return {
|
|
327
|
+
productId,
|
|
328
|
+
slots: rows.map((row) => ({
|
|
329
|
+
id: row.id,
|
|
330
|
+
optionId: row.optionId ?? null,
|
|
331
|
+
dateLocal: normalizeDate(row.dateLocal),
|
|
332
|
+
startsAt: normalizeDate(row.startsAt),
|
|
333
|
+
endsAt: normalizeDate(row.endsAt),
|
|
334
|
+
timezone: row.timezone,
|
|
335
|
+
status: row.status,
|
|
336
|
+
unlimited: row.unlimited,
|
|
337
|
+
remainingPax: row.remainingPax ?? null,
|
|
338
|
+
remainingResources: row.remainingResources ?? null,
|
|
339
|
+
pastCutoff: row.pastCutoff,
|
|
340
|
+
tooEarly: row.tooEarly,
|
|
341
|
+
startTime: row.startTimeId
|
|
342
|
+
? {
|
|
343
|
+
id: row.startTimeId,
|
|
344
|
+
label: row.startTimeLabel ?? null,
|
|
345
|
+
startTimeLocal: row.startTimeLocal ?? "",
|
|
346
|
+
durationMinutes: row.durationMinutes ?? null,
|
|
347
|
+
}
|
|
348
|
+
: null,
|
|
349
|
+
})),
|
|
350
|
+
total: countResult[0]?.count ?? 0,
|
|
351
|
+
limit: query.limit,
|
|
352
|
+
offset: query.offset,
|
|
353
|
+
};
|
|
354
|
+
},
|
|
355
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import type { cancellationPolicyListQuerySchema, cancellationPolicyRuleListQuerySchema, dropoffPriceRuleListQuerySchema, extraPriceRuleListQuerySchema, insertCancellationPolicyRuleSchema, insertCancellationPolicySchema, insertDropoffPriceRuleSchema, insertExtraPriceRuleSchema, insertOptionPriceRuleSchema, insertOptionStartTimeRuleSchema, insertOptionUnitPriceRuleSchema, insertOptionUnitTierSchema, insertPickupPriceRuleSchema, insertPriceCatalogSchema, insertPriceScheduleSchema, insertPricingCategoryDependencySchema, insertPricingCategorySchema, optionPriceRuleListQuerySchema, optionStartTimeRuleListQuerySchema, optionUnitPriceRuleListQuerySchema, optionUnitTierListQuerySchema, pickupPriceRuleListQuerySchema, priceCatalogListQuerySchema, priceScheduleListQuerySchema, pricingCategoryDependencyListQuerySchema, pricingCategoryListQuerySchema, updateCancellationPolicyRuleSchema, updateCancellationPolicySchema, updateDropoffPriceRuleSchema, updateExtraPriceRuleSchema, updateOptionPriceRuleSchema, updateOptionStartTimeRuleSchema, updateOptionUnitPriceRuleSchema, updateOptionUnitTierSchema, updatePickupPriceRuleSchema, updatePriceCatalogSchema, updatePriceScheduleSchema, updatePricingCategoryDependencySchema, updatePricingCategorySchema } from "./validation.js";
|
|
3
|
+
export type PricingCategoryListQuery = z.infer<typeof pricingCategoryListQuerySchema>;
|
|
4
|
+
export type PricingCategoryDependencyListQuery = z.infer<typeof pricingCategoryDependencyListQuerySchema>;
|
|
5
|
+
export type CancellationPolicyListQuery = z.infer<typeof cancellationPolicyListQuerySchema>;
|
|
6
|
+
export type CancellationPolicyRuleListQuery = z.infer<typeof cancellationPolicyRuleListQuerySchema>;
|
|
7
|
+
export type PriceCatalogListQuery = z.infer<typeof priceCatalogListQuerySchema>;
|
|
8
|
+
export type PriceScheduleListQuery = z.infer<typeof priceScheduleListQuerySchema>;
|
|
9
|
+
export type OptionPriceRuleListQuery = z.infer<typeof optionPriceRuleListQuerySchema>;
|
|
10
|
+
export type OptionUnitPriceRuleListQuery = z.infer<typeof optionUnitPriceRuleListQuerySchema>;
|
|
11
|
+
export type OptionStartTimeRuleListQuery = z.infer<typeof optionStartTimeRuleListQuerySchema>;
|
|
12
|
+
export type OptionUnitTierListQuery = z.infer<typeof optionUnitTierListQuerySchema>;
|
|
13
|
+
export type PickupPriceRuleListQuery = z.infer<typeof pickupPriceRuleListQuerySchema>;
|
|
14
|
+
export type DropoffPriceRuleListQuery = z.infer<typeof dropoffPriceRuleListQuerySchema>;
|
|
15
|
+
export type ExtraPriceRuleListQuery = z.infer<typeof extraPriceRuleListQuerySchema>;
|
|
16
|
+
export type CreatePricingCategoryInput = z.infer<typeof insertPricingCategorySchema>;
|
|
17
|
+
export type UpdatePricingCategoryInput = z.infer<typeof updatePricingCategorySchema>;
|
|
18
|
+
export type CreatePricingCategoryDependencyInput = z.infer<typeof insertPricingCategoryDependencySchema>;
|
|
19
|
+
export type UpdatePricingCategoryDependencyInput = z.infer<typeof updatePricingCategoryDependencySchema>;
|
|
20
|
+
export type CreateCancellationPolicyInput = z.infer<typeof insertCancellationPolicySchema>;
|
|
21
|
+
export type UpdateCancellationPolicyInput = z.infer<typeof updateCancellationPolicySchema>;
|
|
22
|
+
export type CreateCancellationPolicyRuleInput = z.infer<typeof insertCancellationPolicyRuleSchema>;
|
|
23
|
+
export type UpdateCancellationPolicyRuleInput = z.infer<typeof updateCancellationPolicyRuleSchema>;
|
|
24
|
+
export type CreatePriceCatalogInput = z.infer<typeof insertPriceCatalogSchema>;
|
|
25
|
+
export type UpdatePriceCatalogInput = z.infer<typeof updatePriceCatalogSchema>;
|
|
26
|
+
export type CreatePriceScheduleInput = z.infer<typeof insertPriceScheduleSchema>;
|
|
27
|
+
export type UpdatePriceScheduleInput = z.infer<typeof updatePriceScheduleSchema>;
|
|
28
|
+
export type CreateOptionPriceRuleInput = z.infer<typeof insertOptionPriceRuleSchema>;
|
|
29
|
+
export type UpdateOptionPriceRuleInput = z.infer<typeof updateOptionPriceRuleSchema>;
|
|
30
|
+
export type CreateOptionUnitPriceRuleInput = z.infer<typeof insertOptionUnitPriceRuleSchema>;
|
|
31
|
+
export type UpdateOptionUnitPriceRuleInput = z.infer<typeof updateOptionUnitPriceRuleSchema>;
|
|
32
|
+
export type CreateOptionStartTimeRuleInput = z.infer<typeof insertOptionStartTimeRuleSchema>;
|
|
33
|
+
export type UpdateOptionStartTimeRuleInput = z.infer<typeof updateOptionStartTimeRuleSchema>;
|
|
34
|
+
export type CreateOptionUnitTierInput = z.infer<typeof insertOptionUnitTierSchema>;
|
|
35
|
+
export type UpdateOptionUnitTierInput = z.infer<typeof updateOptionUnitTierSchema>;
|
|
36
|
+
export type CreatePickupPriceRuleInput = z.infer<typeof insertPickupPriceRuleSchema>;
|
|
37
|
+
export type UpdatePickupPriceRuleInput = z.infer<typeof updatePickupPriceRuleSchema>;
|
|
38
|
+
export type CreateDropoffPriceRuleInput = z.infer<typeof insertDropoffPriceRuleSchema>;
|
|
39
|
+
export type UpdateDropoffPriceRuleInput = z.infer<typeof updateDropoffPriceRuleSchema>;
|
|
40
|
+
export type CreateExtraPriceRuleInput = z.infer<typeof insertExtraPriceRuleSchema>;
|
|
41
|
+
export type UpdateExtraPriceRuleInput = z.infer<typeof updateExtraPriceRuleSchema>;
|
|
42
|
+
export declare function paginate<T extends object>(rowsQuery: Promise<T[]>, countQuery: Promise<Array<{
|
|
43
|
+
count: number;
|
|
44
|
+
}>>, limit: number, offset: number): Promise<{
|
|
45
|
+
data: T[];
|
|
46
|
+
total: number;
|
|
47
|
+
limit: number;
|
|
48
|
+
offset: number;
|
|
49
|
+
}>;
|
|
50
|
+
//# sourceMappingURL=service-shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-shared.d.ts","sourceRoot":"","sources":["../src/service-shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B,OAAO,KAAK,EACV,iCAAiC,EACjC,qCAAqC,EACrC,+BAA+B,EAC/B,6BAA6B,EAC7B,kCAAkC,EAClC,8BAA8B,EAC9B,4BAA4B,EAC5B,0BAA0B,EAC1B,2BAA2B,EAC3B,+BAA+B,EAC/B,+BAA+B,EAC/B,0BAA0B,EAC1B,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,EACzB,qCAAqC,EACrC,2BAA2B,EAC3B,8BAA8B,EAC9B,kCAAkC,EAClC,kCAAkC,EAClC,6BAA6B,EAC7B,8BAA8B,EAC9B,2BAA2B,EAC3B,4BAA4B,EAC5B,wCAAwC,EACxC,8BAA8B,EAC9B,kCAAkC,EAClC,8BAA8B,EAC9B,4BAA4B,EAC5B,0BAA0B,EAC1B,2BAA2B,EAC3B,+BAA+B,EAC/B,+BAA+B,EAC/B,0BAA0B,EAC1B,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,EACzB,qCAAqC,EACrC,2BAA2B,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,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAA;AAC5F,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAA;AAC5F,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAClF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAClF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAA;AACpF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAA;AACpF,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAA;AACtF,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAA;AACtF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAClF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAElF,wBAAsB,QAAQ,CAAC,CAAC,SAAS,MAAM,EAC7C,SAAS,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,EACvB,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,EAC7C,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM;;;;;GAIf"}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
|
|
2
|
+
import type { CreateDropoffPriceRuleInput, CreateExtraPriceRuleInput, CreatePickupPriceRuleInput, DropoffPriceRuleListQuery, ExtraPriceRuleListQuery, PickupPriceRuleListQuery, UpdateDropoffPriceRuleInput, UpdateExtraPriceRuleInput, UpdatePickupPriceRuleInput } from "./service-shared.js";
|
|
3
|
+
export declare function listPickupPriceRules(db: PostgresJsDatabase, query: PickupPriceRuleListQuery): Promise<{
|
|
4
|
+
data: {
|
|
5
|
+
id: string;
|
|
6
|
+
optionPriceRuleId: string;
|
|
7
|
+
optionId: string;
|
|
8
|
+
pickupPointId: string;
|
|
9
|
+
pricingMode: "per_person" | "per_booking" | "on_request" | "included" | "unavailable";
|
|
10
|
+
sellAmountCents: number | null;
|
|
11
|
+
costAmountCents: number | null;
|
|
12
|
+
active: boolean;
|
|
13
|
+
sortOrder: number;
|
|
14
|
+
notes: string | null;
|
|
15
|
+
createdAt: Date;
|
|
16
|
+
updatedAt: Date;
|
|
17
|
+
}[];
|
|
18
|
+
total: number;
|
|
19
|
+
limit: number;
|
|
20
|
+
offset: number;
|
|
21
|
+
}>;
|
|
22
|
+
export declare function getPickupPriceRuleById(db: PostgresJsDatabase, id: string): Promise<{
|
|
23
|
+
id: string;
|
|
24
|
+
optionPriceRuleId: string;
|
|
25
|
+
optionId: string;
|
|
26
|
+
pickupPointId: string;
|
|
27
|
+
pricingMode: "per_person" | "per_booking" | "on_request" | "included" | "unavailable";
|
|
28
|
+
sellAmountCents: number | null;
|
|
29
|
+
costAmountCents: number | null;
|
|
30
|
+
active: boolean;
|
|
31
|
+
sortOrder: number;
|
|
32
|
+
notes: string | null;
|
|
33
|
+
createdAt: Date;
|
|
34
|
+
updatedAt: Date;
|
|
35
|
+
} | null>;
|
|
36
|
+
export declare function createPickupPriceRule(db: PostgresJsDatabase, data: CreatePickupPriceRuleInput): Promise<{
|
|
37
|
+
id: string;
|
|
38
|
+
active: boolean;
|
|
39
|
+
notes: string | null;
|
|
40
|
+
createdAt: Date;
|
|
41
|
+
updatedAt: Date;
|
|
42
|
+
optionId: string;
|
|
43
|
+
sortOrder: number;
|
|
44
|
+
pricingMode: "per_person" | "per_booking" | "on_request" | "included" | "unavailable";
|
|
45
|
+
optionPriceRuleId: string;
|
|
46
|
+
sellAmountCents: number | null;
|
|
47
|
+
costAmountCents: number | null;
|
|
48
|
+
pickupPointId: string;
|
|
49
|
+
} | null>;
|
|
50
|
+
export declare function updatePickupPriceRule(db: PostgresJsDatabase, id: string, data: UpdatePickupPriceRuleInput): Promise<{
|
|
51
|
+
id: string;
|
|
52
|
+
optionPriceRuleId: string;
|
|
53
|
+
optionId: string;
|
|
54
|
+
pickupPointId: string;
|
|
55
|
+
pricingMode: "per_person" | "per_booking" | "on_request" | "included" | "unavailable";
|
|
56
|
+
sellAmountCents: number | null;
|
|
57
|
+
costAmountCents: number | null;
|
|
58
|
+
active: boolean;
|
|
59
|
+
sortOrder: number;
|
|
60
|
+
notes: string | null;
|
|
61
|
+
createdAt: Date;
|
|
62
|
+
updatedAt: Date;
|
|
63
|
+
} | null>;
|
|
64
|
+
export declare function deletePickupPriceRule(db: PostgresJsDatabase, id: string): Promise<{
|
|
65
|
+
id: string;
|
|
66
|
+
} | null>;
|
|
67
|
+
export declare function listDropoffPriceRules(db: PostgresJsDatabase, query: DropoffPriceRuleListQuery): Promise<{
|
|
68
|
+
data: {
|
|
69
|
+
id: string;
|
|
70
|
+
optionPriceRuleId: string;
|
|
71
|
+
optionId: string;
|
|
72
|
+
facilityId: string | null;
|
|
73
|
+
dropoffCode: string | null;
|
|
74
|
+
dropoffName: string;
|
|
75
|
+
pricingMode: "per_person" | "per_booking" | "on_request" | "included" | "unavailable";
|
|
76
|
+
sellAmountCents: number | null;
|
|
77
|
+
costAmountCents: number | null;
|
|
78
|
+
active: boolean;
|
|
79
|
+
sortOrder: number;
|
|
80
|
+
notes: string | null;
|
|
81
|
+
createdAt: Date;
|
|
82
|
+
updatedAt: Date;
|
|
83
|
+
}[];
|
|
84
|
+
total: number;
|
|
85
|
+
limit: number;
|
|
86
|
+
offset: number;
|
|
87
|
+
}>;
|
|
88
|
+
export declare function getDropoffPriceRuleById(db: PostgresJsDatabase, id: string): Promise<{
|
|
89
|
+
id: string;
|
|
90
|
+
optionPriceRuleId: string;
|
|
91
|
+
optionId: string;
|
|
92
|
+
facilityId: string | null;
|
|
93
|
+
dropoffCode: string | null;
|
|
94
|
+
dropoffName: string;
|
|
95
|
+
pricingMode: "per_person" | "per_booking" | "on_request" | "included" | "unavailable";
|
|
96
|
+
sellAmountCents: number | null;
|
|
97
|
+
costAmountCents: number | null;
|
|
98
|
+
active: boolean;
|
|
99
|
+
sortOrder: number;
|
|
100
|
+
notes: string | null;
|
|
101
|
+
createdAt: Date;
|
|
102
|
+
updatedAt: Date;
|
|
103
|
+
} | null>;
|
|
104
|
+
export declare function createDropoffPriceRule(db: PostgresJsDatabase, data: CreateDropoffPriceRuleInput): Promise<{
|
|
105
|
+
id: string;
|
|
106
|
+
active: boolean;
|
|
107
|
+
notes: string | null;
|
|
108
|
+
createdAt: Date;
|
|
109
|
+
updatedAt: Date;
|
|
110
|
+
optionId: string;
|
|
111
|
+
sortOrder: number;
|
|
112
|
+
pricingMode: "per_person" | "per_booking" | "on_request" | "included" | "unavailable";
|
|
113
|
+
optionPriceRuleId: string;
|
|
114
|
+
sellAmountCents: number | null;
|
|
115
|
+
costAmountCents: number | null;
|
|
116
|
+
facilityId: string | null;
|
|
117
|
+
dropoffCode: string | null;
|
|
118
|
+
dropoffName: string;
|
|
119
|
+
} | null>;
|
|
120
|
+
export declare function updateDropoffPriceRule(db: PostgresJsDatabase, id: string, data: UpdateDropoffPriceRuleInput): Promise<{
|
|
121
|
+
id: string;
|
|
122
|
+
optionPriceRuleId: string;
|
|
123
|
+
optionId: string;
|
|
124
|
+
facilityId: string | null;
|
|
125
|
+
dropoffCode: string | null;
|
|
126
|
+
dropoffName: string;
|
|
127
|
+
pricingMode: "per_person" | "per_booking" | "on_request" | "included" | "unavailable";
|
|
128
|
+
sellAmountCents: number | null;
|
|
129
|
+
costAmountCents: number | null;
|
|
130
|
+
active: boolean;
|
|
131
|
+
sortOrder: number;
|
|
132
|
+
notes: string | null;
|
|
133
|
+
createdAt: Date;
|
|
134
|
+
updatedAt: Date;
|
|
135
|
+
} | null>;
|
|
136
|
+
export declare function deleteDropoffPriceRule(db: PostgresJsDatabase, id: string): Promise<{
|
|
137
|
+
id: string;
|
|
138
|
+
} | null>;
|
|
139
|
+
export declare function listExtraPriceRules(db: PostgresJsDatabase, query: ExtraPriceRuleListQuery): Promise<{
|
|
140
|
+
data: {
|
|
141
|
+
id: string;
|
|
142
|
+
optionPriceRuleId: string;
|
|
143
|
+
optionId: string;
|
|
144
|
+
productExtraId: string | null;
|
|
145
|
+
optionExtraConfigId: string | null;
|
|
146
|
+
pricingMode: "per_person" | "per_booking" | "on_request" | "included" | "unavailable";
|
|
147
|
+
sellAmountCents: number | null;
|
|
148
|
+
costAmountCents: number | null;
|
|
149
|
+
active: boolean;
|
|
150
|
+
sortOrder: number;
|
|
151
|
+
notes: string | null;
|
|
152
|
+
metadata: Record<string, unknown> | null;
|
|
153
|
+
createdAt: Date;
|
|
154
|
+
updatedAt: Date;
|
|
155
|
+
}[];
|
|
156
|
+
total: number;
|
|
157
|
+
limit: number;
|
|
158
|
+
offset: number;
|
|
159
|
+
}>;
|
|
160
|
+
export declare function getExtraPriceRuleById(db: PostgresJsDatabase, id: string): Promise<{
|
|
161
|
+
id: string;
|
|
162
|
+
optionPriceRuleId: string;
|
|
163
|
+
optionId: string;
|
|
164
|
+
productExtraId: string | null;
|
|
165
|
+
optionExtraConfigId: string | null;
|
|
166
|
+
pricingMode: "per_person" | "per_booking" | "on_request" | "included" | "unavailable";
|
|
167
|
+
sellAmountCents: number | null;
|
|
168
|
+
costAmountCents: number | null;
|
|
169
|
+
active: boolean;
|
|
170
|
+
sortOrder: number;
|
|
171
|
+
notes: string | null;
|
|
172
|
+
metadata: Record<string, unknown> | null;
|
|
173
|
+
createdAt: Date;
|
|
174
|
+
updatedAt: Date;
|
|
175
|
+
} | null>;
|
|
176
|
+
export declare function createExtraPriceRule(db: PostgresJsDatabase, data: CreateExtraPriceRuleInput): Promise<{
|
|
177
|
+
id: string;
|
|
178
|
+
active: boolean;
|
|
179
|
+
notes: string | null;
|
|
180
|
+
metadata: Record<string, unknown> | null;
|
|
181
|
+
createdAt: Date;
|
|
182
|
+
updatedAt: Date;
|
|
183
|
+
optionId: string;
|
|
184
|
+
sortOrder: number;
|
|
185
|
+
pricingMode: "per_person" | "per_booking" | "on_request" | "included" | "unavailable";
|
|
186
|
+
optionPriceRuleId: string;
|
|
187
|
+
sellAmountCents: number | null;
|
|
188
|
+
costAmountCents: number | null;
|
|
189
|
+
productExtraId: string | null;
|
|
190
|
+
optionExtraConfigId: string | null;
|
|
191
|
+
} | null>;
|
|
192
|
+
export declare function updateExtraPriceRule(db: PostgresJsDatabase, id: string, data: UpdateExtraPriceRuleInput): Promise<{
|
|
193
|
+
id: string;
|
|
194
|
+
optionPriceRuleId: string;
|
|
195
|
+
optionId: string;
|
|
196
|
+
productExtraId: string | null;
|
|
197
|
+
optionExtraConfigId: string | null;
|
|
198
|
+
pricingMode: "per_person" | "per_booking" | "on_request" | "included" | "unavailable";
|
|
199
|
+
sellAmountCents: number | null;
|
|
200
|
+
costAmountCents: number | null;
|
|
201
|
+
active: boolean;
|
|
202
|
+
sortOrder: number;
|
|
203
|
+
notes: string | null;
|
|
204
|
+
metadata: Record<string, unknown> | null;
|
|
205
|
+
createdAt: Date;
|
|
206
|
+
updatedAt: Date;
|
|
207
|
+
} | null>;
|
|
208
|
+
export declare function deleteExtraPriceRule(db: PostgresJsDatabase, id: string): Promise<{
|
|
209
|
+
id: string;
|
|
210
|
+
} | null>;
|
|
211
|
+
//# sourceMappingURL=service-transfer-rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-transfer-rules.d.ts","sourceRoot":"","sources":["../src/service-transfer-rules.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAGjE,OAAO,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