@voyantjs/bookings 0.81.12 → 0.81.14
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/pricing-ref.d.ts +143 -0
- package/dist/pricing-ref.d.ts.map +1 -1
- package/dist/pricing-ref.js +10 -0
- package/dist/routes.d.ts +1 -1
- package/dist/service-public.d.ts +2 -1
- package/dist/service-public.d.ts.map +1 -1
- package/dist/service-public.js +36 -19
- package/package.json +7 -7
package/dist/pricing-ref.d.ts
CHANGED
|
@@ -689,4 +689,147 @@ export declare const optionUnitTiersRef: import("drizzle-orm/pg-core").PgTableWi
|
|
|
689
689
|
};
|
|
690
690
|
dialect: "pg";
|
|
691
691
|
}>;
|
|
692
|
+
export declare const departurePriceOverridesRef: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
693
|
+
name: "departure_price_overrides";
|
|
694
|
+
schema: undefined;
|
|
695
|
+
columns: {
|
|
696
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
697
|
+
name: string;
|
|
698
|
+
tableName: "departure_price_overrides";
|
|
699
|
+
dataType: "string";
|
|
700
|
+
columnType: "PgText";
|
|
701
|
+
data: string;
|
|
702
|
+
driverParam: string;
|
|
703
|
+
notNull: true;
|
|
704
|
+
hasDefault: true;
|
|
705
|
+
isPrimaryKey: true;
|
|
706
|
+
isAutoincrement: false;
|
|
707
|
+
hasRuntimeDefault: true;
|
|
708
|
+
enumValues: [string, ...string[]];
|
|
709
|
+
baseColumn: never;
|
|
710
|
+
identity: undefined;
|
|
711
|
+
generated: undefined;
|
|
712
|
+
}, {}, {}>;
|
|
713
|
+
departureId: import("drizzle-orm/pg-core").PgColumn<{
|
|
714
|
+
name: "departure_id";
|
|
715
|
+
tableName: "departure_price_overrides";
|
|
716
|
+
dataType: "string";
|
|
717
|
+
columnType: "PgText";
|
|
718
|
+
data: string;
|
|
719
|
+
driverParam: string;
|
|
720
|
+
notNull: true;
|
|
721
|
+
hasDefault: false;
|
|
722
|
+
isPrimaryKey: false;
|
|
723
|
+
isAutoincrement: false;
|
|
724
|
+
hasRuntimeDefault: false;
|
|
725
|
+
enumValues: [string, ...string[]];
|
|
726
|
+
baseColumn: never;
|
|
727
|
+
identity: undefined;
|
|
728
|
+
generated: undefined;
|
|
729
|
+
}, {}, {}>;
|
|
730
|
+
optionId: import("drizzle-orm/pg-core").PgColumn<{
|
|
731
|
+
name: "option_id";
|
|
732
|
+
tableName: "departure_price_overrides";
|
|
733
|
+
dataType: "string";
|
|
734
|
+
columnType: "PgText";
|
|
735
|
+
data: string;
|
|
736
|
+
driverParam: string;
|
|
737
|
+
notNull: true;
|
|
738
|
+
hasDefault: false;
|
|
739
|
+
isPrimaryKey: false;
|
|
740
|
+
isAutoincrement: false;
|
|
741
|
+
hasRuntimeDefault: false;
|
|
742
|
+
enumValues: [string, ...string[]];
|
|
743
|
+
baseColumn: never;
|
|
744
|
+
identity: undefined;
|
|
745
|
+
generated: undefined;
|
|
746
|
+
}, {}, {}>;
|
|
747
|
+
optionUnitId: import("drizzle-orm/pg-core").PgColumn<{
|
|
748
|
+
name: "option_unit_id";
|
|
749
|
+
tableName: "departure_price_overrides";
|
|
750
|
+
dataType: "string";
|
|
751
|
+
columnType: "PgText";
|
|
752
|
+
data: string;
|
|
753
|
+
driverParam: string;
|
|
754
|
+
notNull: true;
|
|
755
|
+
hasDefault: false;
|
|
756
|
+
isPrimaryKey: false;
|
|
757
|
+
isAutoincrement: false;
|
|
758
|
+
hasRuntimeDefault: false;
|
|
759
|
+
enumValues: [string, ...string[]];
|
|
760
|
+
baseColumn: never;
|
|
761
|
+
identity: undefined;
|
|
762
|
+
generated: undefined;
|
|
763
|
+
}, {}, {}>;
|
|
764
|
+
priceCatalogId: import("drizzle-orm/pg-core").PgColumn<{
|
|
765
|
+
name: string;
|
|
766
|
+
tableName: "departure_price_overrides";
|
|
767
|
+
dataType: "string";
|
|
768
|
+
columnType: "PgText";
|
|
769
|
+
data: string;
|
|
770
|
+
driverParam: string;
|
|
771
|
+
notNull: true;
|
|
772
|
+
hasDefault: false;
|
|
773
|
+
isPrimaryKey: false;
|
|
774
|
+
isAutoincrement: false;
|
|
775
|
+
hasRuntimeDefault: false;
|
|
776
|
+
enumValues: [string, ...string[]];
|
|
777
|
+
baseColumn: never;
|
|
778
|
+
identity: undefined;
|
|
779
|
+
generated: undefined;
|
|
780
|
+
}, {}, {}>;
|
|
781
|
+
sellAmountCents: import("drizzle-orm/pg-core").PgColumn<{
|
|
782
|
+
name: "sell_amount_cents";
|
|
783
|
+
tableName: "departure_price_overrides";
|
|
784
|
+
dataType: "number";
|
|
785
|
+
columnType: "PgInteger";
|
|
786
|
+
data: number;
|
|
787
|
+
driverParam: string | number;
|
|
788
|
+
notNull: true;
|
|
789
|
+
hasDefault: false;
|
|
790
|
+
isPrimaryKey: false;
|
|
791
|
+
isAutoincrement: false;
|
|
792
|
+
hasRuntimeDefault: false;
|
|
793
|
+
enumValues: undefined;
|
|
794
|
+
baseColumn: never;
|
|
795
|
+
identity: undefined;
|
|
796
|
+
generated: undefined;
|
|
797
|
+
}, {}, {}>;
|
|
798
|
+
costAmountCents: import("drizzle-orm/pg-core").PgColumn<{
|
|
799
|
+
name: "cost_amount_cents";
|
|
800
|
+
tableName: "departure_price_overrides";
|
|
801
|
+
dataType: "number";
|
|
802
|
+
columnType: "PgInteger";
|
|
803
|
+
data: number;
|
|
804
|
+
driverParam: string | number;
|
|
805
|
+
notNull: false;
|
|
806
|
+
hasDefault: false;
|
|
807
|
+
isPrimaryKey: false;
|
|
808
|
+
isAutoincrement: false;
|
|
809
|
+
hasRuntimeDefault: false;
|
|
810
|
+
enumValues: undefined;
|
|
811
|
+
baseColumn: never;
|
|
812
|
+
identity: undefined;
|
|
813
|
+
generated: undefined;
|
|
814
|
+
}, {}, {}>;
|
|
815
|
+
active: import("drizzle-orm/pg-core").PgColumn<{
|
|
816
|
+
name: "active";
|
|
817
|
+
tableName: "departure_price_overrides";
|
|
818
|
+
dataType: "boolean";
|
|
819
|
+
columnType: "PgBoolean";
|
|
820
|
+
data: boolean;
|
|
821
|
+
driverParam: boolean;
|
|
822
|
+
notNull: true;
|
|
823
|
+
hasDefault: true;
|
|
824
|
+
isPrimaryKey: false;
|
|
825
|
+
isAutoincrement: false;
|
|
826
|
+
hasRuntimeDefault: false;
|
|
827
|
+
enumValues: undefined;
|
|
828
|
+
baseColumn: never;
|
|
829
|
+
identity: undefined;
|
|
830
|
+
generated: undefined;
|
|
831
|
+
}, {}, {}>;
|
|
832
|
+
};
|
|
833
|
+
dialect: "pg";
|
|
834
|
+
}>;
|
|
692
835
|
//# sourceMappingURL=pricing-ref.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pricing-ref.d.ts","sourceRoot":"","sources":["../src/pricing-ref.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQ3B,CAAA;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAc9B,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQ7B,CAAA;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASrC,CAAA"}
|
package/dist/pricing-ref.js
CHANGED
|
@@ -47,3 +47,13 @@ export const optionUnitTiersRef = pgTable("option_unit_tiers", {
|
|
|
47
47
|
active: boolean("active").notNull().default(true),
|
|
48
48
|
sortOrder: integer("sort_order").notNull().default(0),
|
|
49
49
|
});
|
|
50
|
+
export const departurePriceOverridesRef = pgTable("departure_price_overrides", {
|
|
51
|
+
id: typeId("departure_price_overrides").primaryKey(),
|
|
52
|
+
departureId: text("departure_id").notNull(),
|
|
53
|
+
optionId: text("option_id").notNull(),
|
|
54
|
+
optionUnitId: text("option_unit_id").notNull(),
|
|
55
|
+
priceCatalogId: typeIdRef("price_catalog_id").notNull(),
|
|
56
|
+
sellAmountCents: integer("sell_amount_cents").notNull(),
|
|
57
|
+
costAmountCents: integer("cost_amount_cents"),
|
|
58
|
+
active: boolean("active").notNull().default(true),
|
|
59
|
+
});
|
package/dist/routes.d.ts
CHANGED
|
@@ -182,6 +182,7 @@ export declare const bookingRoutes: import("hono/hono-base").HonoBase<Env, ({
|
|
|
182
182
|
isDefault: boolean;
|
|
183
183
|
}[];
|
|
184
184
|
unitPrices: {
|
|
185
|
+
sellAmountCents: number | null;
|
|
185
186
|
tiers: {
|
|
186
187
|
id: string;
|
|
187
188
|
optionUnitPriceRuleId: string;
|
|
@@ -197,7 +198,6 @@ export declare const bookingRoutes: import("hono/hono-base").HonoBase<Env, ({
|
|
|
197
198
|
unitType: string | null;
|
|
198
199
|
pricingCategoryId: string | null;
|
|
199
200
|
pricingMode: string;
|
|
200
|
-
sellAmountCents: number | null;
|
|
201
201
|
minQuantity: number | null;
|
|
202
202
|
maxQuantity: number | null;
|
|
203
203
|
}[];
|
package/dist/service-public.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export interface PublicBookingsServiceResolvers {
|
|
|
27
27
|
*/
|
|
28
28
|
export declare function resolveSessionPricingSnapshot(db: PostgresJsDatabase, productId: string, input: {
|
|
29
29
|
catalogId?: string | undefined;
|
|
30
|
+
departureId?: string | undefined;
|
|
30
31
|
optionId?: string | undefined;
|
|
31
32
|
/** Public/session flows require storefront-visible products. Admin previews can price active internal products. */
|
|
32
33
|
requirePublicProduct?: boolean | undefined;
|
|
@@ -48,6 +49,7 @@ export declare function resolveSessionPricingSnapshot(db: PostgresJsDatabase, pr
|
|
|
48
49
|
isDefault: boolean;
|
|
49
50
|
}[];
|
|
50
51
|
unitPrices: {
|
|
52
|
+
sellAmountCents: number | null;
|
|
51
53
|
tiers: {
|
|
52
54
|
id: string;
|
|
53
55
|
optionUnitPriceRuleId: string;
|
|
@@ -63,7 +65,6 @@ export declare function resolveSessionPricingSnapshot(db: PostgresJsDatabase, pr
|
|
|
63
65
|
unitType: string | null;
|
|
64
66
|
pricingCategoryId: string | null;
|
|
65
67
|
pricingMode: string;
|
|
66
|
-
sellAmountCents: number | null;
|
|
67
68
|
minQuantity: number | null;
|
|
68
69
|
maxQuantity: number | null;
|
|
69
70
|
}[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-public.d.ts","sourceRoot":"","sources":["../src/service-public.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"service-public.d.ts","sourceRoot":"","sources":["../src/service-public.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAUjE,OAAO,KAAK,EAEV,2BAA2B,EAC3B,4BAA4B,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAzkCzE,MAAM;4BACE,MAAM;sBACZ,MAAM;2BACD,OAAO;;;;;;;;;;;;;;;;;;;;iCA0kCa,kBAAkB,SAAS,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBA7kCtF,MAAM;4BACE,MAAM;sBACZ,MAAM;2BACD,OAAO;;;;;;;;;;;;;;;;;;;;4BA8kCQ,kBAAkB,SAAS,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAjlCnF,MAAM;4BACE,MAAM;sBACZ,MAAM;2BACD,OAAO;;;;;;;;;;;;;;;;;;;;CAilCvB,CAAA"}
|
package/dist/service-public.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { and, asc, desc, eq, inArray, or } from "drizzle-orm";
|
|
2
|
-
import { optionPriceRulesRef, optionUnitPriceRulesRef, optionUnitTiersRef, priceCatalogsRef, } from "./pricing-ref.js";
|
|
2
|
+
import { departurePriceOverridesRef, optionPriceRulesRef, optionUnitPriceRulesRef, optionUnitTiersRef, priceCatalogsRef, } from "./pricing-ref.js";
|
|
3
3
|
import { optionUnitsRef, productOptionsRef, productsRef } from "./products-ref.js";
|
|
4
4
|
import { bookingAllocations, bookingDocuments, bookingFulfillments, bookingItems, bookingItemTravelers, bookingSessionStates, bookings, bookingTravelers, } from "./schema.js";
|
|
5
5
|
import { bookingsService } from "./service.js";
|
|
@@ -545,34 +545,50 @@ export async function resolveSessionPricingSnapshot(db, productId, input) {
|
|
|
545
545
|
.where(and(inArray(optionUnitPriceRulesRef.optionId, optionIds), eq(optionUnitPriceRulesRef.active, true)))
|
|
546
546
|
.orderBy(asc(optionUnitPriceRulesRef.sortOrder), asc(optionUnitPriceRulesRef.createdAt)),
|
|
547
547
|
]);
|
|
548
|
-
const tiers =
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
548
|
+
const [tiers, departureOverrides] = await Promise.all([
|
|
549
|
+
unitPrices.length > 0
|
|
550
|
+
? db
|
|
551
|
+
.select({
|
|
552
|
+
id: optionUnitTiersRef.id,
|
|
553
|
+
optionUnitPriceRuleId: optionUnitTiersRef.optionUnitPriceRuleId,
|
|
554
|
+
minQuantity: optionUnitTiersRef.minQuantity,
|
|
555
|
+
maxQuantity: optionUnitTiersRef.maxQuantity,
|
|
556
|
+
sellAmountCents: optionUnitTiersRef.sellAmountCents,
|
|
557
|
+
sortOrder: optionUnitTiersRef.sortOrder,
|
|
558
|
+
})
|
|
559
|
+
.from(optionUnitTiersRef)
|
|
560
|
+
.where(and(inArray(optionUnitTiersRef.optionUnitPriceRuleId, unitPrices.map((row) => row.id)), eq(optionUnitTiersRef.active, true)))
|
|
561
|
+
.orderBy(asc(optionUnitTiersRef.sortOrder), asc(optionUnitTiersRef.minQuantity))
|
|
562
|
+
: Promise.resolve([]),
|
|
563
|
+
input.departureId
|
|
564
|
+
? db
|
|
565
|
+
.select({
|
|
566
|
+
optionUnitId: departurePriceOverridesRef.optionUnitId,
|
|
567
|
+
sellAmountCents: departurePriceOverridesRef.sellAmountCents,
|
|
568
|
+
})
|
|
569
|
+
.from(departurePriceOverridesRef)
|
|
570
|
+
.where(and(eq(departurePriceOverridesRef.departureId, input.departureId), eq(departurePriceOverridesRef.priceCatalogId, catalog.id), eq(departurePriceOverridesRef.active, true)))
|
|
571
|
+
: Promise.resolve([]),
|
|
572
|
+
]);
|
|
562
573
|
const tiersByUnitPriceId = new Map();
|
|
563
574
|
for (const tier of tiers) {
|
|
564
575
|
const existing = tiersByUnitPriceId.get(tier.optionUnitPriceRuleId) ?? [];
|
|
565
576
|
existing.push(tier);
|
|
566
577
|
tiersByUnitPriceId.set(tier.optionUnitPriceRuleId, existing);
|
|
567
578
|
}
|
|
579
|
+
const departureOverrideByUnitId = new Map(departureOverrides.map((row) => [row.optionUnitId, row]));
|
|
568
580
|
return {
|
|
569
581
|
catalog: catalog,
|
|
570
582
|
options: options,
|
|
571
583
|
rules: rules,
|
|
572
|
-
unitPrices: unitPrices.map((row) =>
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
584
|
+
unitPrices: unitPrices.map((row) => {
|
|
585
|
+
const override = departureOverrideByUnitId.get(row.unitId);
|
|
586
|
+
return {
|
|
587
|
+
...row,
|
|
588
|
+
sellAmountCents: override?.sellAmountCents ?? row.sellAmountCents,
|
|
589
|
+
tiers: override ? [] : (tiersByUnitPriceId.get(row.id) ?? []),
|
|
590
|
+
};
|
|
591
|
+
}),
|
|
576
592
|
};
|
|
577
593
|
}
|
|
578
594
|
async function buildSessionSnapshot(db, bookingId) {
|
|
@@ -950,6 +966,7 @@ export const publicBookingsService = {
|
|
|
950
966
|
: (selection.optionUnitId ?? null);
|
|
951
967
|
const snapshot = await resolveSessionPricingSnapshot(db, item.productId, {
|
|
952
968
|
catalogId: input.catalogId,
|
|
969
|
+
departureId: item.availabilitySlotId ?? undefined,
|
|
953
970
|
optionId,
|
|
954
971
|
});
|
|
955
972
|
if (!snapshot) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyantjs/bookings",
|
|
3
|
-
"version": "0.81.
|
|
3
|
+
"version": "0.81.14",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -84,15 +84,15 @@
|
|
|
84
84
|
"drizzle-orm": "^0.45.2",
|
|
85
85
|
"hono": "^4.12.10",
|
|
86
86
|
"zod": "^4.3.6",
|
|
87
|
-
"@voyantjs/action-ledger": "0.81.
|
|
88
|
-
"@voyantjs/core": "0.81.
|
|
89
|
-
"@voyantjs/db": "0.81.
|
|
90
|
-
"@voyantjs/hono": "0.81.
|
|
91
|
-
"@voyantjs/utils": "0.81.
|
|
87
|
+
"@voyantjs/action-ledger": "0.81.14",
|
|
88
|
+
"@voyantjs/core": "0.81.14",
|
|
89
|
+
"@voyantjs/db": "0.81.14",
|
|
90
|
+
"@voyantjs/hono": "0.81.14",
|
|
91
|
+
"@voyantjs/utils": "0.81.14"
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
94
|
"typescript": "^6.0.2",
|
|
95
|
-
"@voyantjs/products": "0.81.
|
|
95
|
+
"@voyantjs/products": "0.81.14",
|
|
96
96
|
"@voyantjs/voyant-typescript-config": "0.1.0"
|
|
97
97
|
},
|
|
98
98
|
"files": [
|