@voyantjs/transactions 0.3.1 → 0.4.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 +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/routes-offers.d.ts +8 -8
- package/dist/routes-orders.d.ts +16 -16
- package/dist/schema/participant-identity.d.ts +1 -1
- package/dist/schema/participant-identity.d.ts.map +1 -1
- package/dist/schema/participant-identity.js +1 -1
- package/dist/schema-orders.d.ts +2 -2
- package/dist/service-offers.d.ts +16 -16
- package/dist/service-orders.d.ts +16 -16
- package/dist/service.d.ts +3 -0
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +3 -0
- package/dist/storefront-offers.d.ts +108 -0
- package/dist/storefront-offers.d.ts.map +1 -0
- package/dist/storefront-offers.js +216 -0
- package/dist/validation.d.ts +98 -10
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +26 -2
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export type { DecryptedTransactionParticipantIdentity, TransactionParticipantIde
|
|
|
16
16
|
export { decryptedTransactionParticipantIdentitySchema, transactionParticipantIdentityEnvelopeSchema, transactionParticipantIdentitySchema, } from "./schema/participant-identity.js";
|
|
17
17
|
export type { NewOffer, NewOfferItem, NewOfferItemParticipant, NewOfferParticipant, NewOrder, NewOrderItem, NewOrderItemParticipant, NewOrderParticipant, NewOrderTerm, Offer, OfferItem, OfferItemParticipant, OfferParticipant, Order, OrderItem, OrderItemParticipant, OrderParticipant, OrderTerm, } from "./schema.js";
|
|
18
18
|
export { offerItemParticipants, offerItems, offerParticipants, offerStatusEnum, offers, orderItemParticipants, orderItems, orderParticipants, orderStatusEnum, orders, orderTermAcceptanceStatusEnum, orderTerms, orderTermTypeEnum, transactionItemParticipantRoleEnum, transactionItemStatusEnum, transactionItemTypeEnum, transactionParticipantTypeEnum, transactionPiiAccessActionEnum, transactionPiiAccessLog, transactionPiiAccessOutcomeEnum, transactionTravelerCategoryEnum, } from "./schema.js";
|
|
19
|
-
export {
|
|
19
|
+
export { createStorefrontPromotionalOffersResolver, getStorefrontPromotionalOfferBySlug, listStorefrontPromotionalOffers, storefrontOfferEnvelopeSchema, storefrontPromotionalOfferSchema, } from "./storefront-offers.js";
|
|
20
|
+
export { insertOfferItemParticipantSchema, insertOfferItemSchema, insertOfferParticipantSchema, insertOfferSchema, insertOrderItemParticipantSchema, insertOrderItemSchema, insertOrderParticipantSchema, insertOrderSchema, insertOrderTermSchema, offerItemListQuerySchema, offerItemParticipantListQuerySchema, offerListQuerySchema, offerMetadataSchema, offerParticipantListQuerySchema, offerStatusSchema, orderItemListQuerySchema, orderItemParticipantListQuerySchema, orderListQuerySchema, orderParticipantListQuerySchema, orderStatusSchema, orderTermAcceptanceStatusSchema, orderTermListQuerySchema, orderTermTypeSchema, storefrontOfferDiscountTypeSchema, storefrontOfferMetadataSchema, transactionItemParticipantRoleSchema, transactionItemStatusSchema, transactionItemTypeSchema, transactionParticipantTypeSchema, transactionTravelerCategorySchema, updateOfferItemParticipantSchema, updateOfferItemSchema, updateOfferParticipantSchema, updateOfferSchema, updateOrderItemParticipantSchema, updateOrderItemSchema, updateOrderParticipantSchema, updateOrderSchema, updateOrderTermSchema, } from "./validation.js";
|
|
20
21
|
export { transactionsService };
|
|
21
22
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAEvD,OAAO,EACL,2BAA2B,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,EACjC,KAAK,yCAAyC,GAC/C,MAAM,UA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B,yBAAyB,EACzB,gCAAgC,EAChC,iCAAiC,EACjC,gCAAgC,EAChC,qBAAqB,EACrB,4BAA4B,EAC5B,iBAAiB,EACjB,gCAAgC,EAChC,qBAAqB,EACrB,4BAA4B,EAC5B,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -28,5 +28,6 @@ export const transactionsHonoModule = {
|
|
|
28
28
|
export { transactionsBookingExtension } from "./booking-extension.js";
|
|
29
29
|
export { decryptedTransactionParticipantIdentitySchema, transactionParticipantIdentityEnvelopeSchema, transactionParticipantIdentitySchema, } from "./schema/participant-identity.js";
|
|
30
30
|
export { offerItemParticipants, offerItems, offerParticipants, offerStatusEnum, offers, orderItemParticipants, orderItems, orderParticipants, orderStatusEnum, orders, orderTermAcceptanceStatusEnum, orderTerms, orderTermTypeEnum, transactionItemParticipantRoleEnum, transactionItemStatusEnum, transactionItemTypeEnum, transactionParticipantTypeEnum, transactionPiiAccessActionEnum, transactionPiiAccessLog, transactionPiiAccessOutcomeEnum, transactionTravelerCategoryEnum, } from "./schema.js";
|
|
31
|
-
export {
|
|
31
|
+
export { createStorefrontPromotionalOffersResolver, getStorefrontPromotionalOfferBySlug, listStorefrontPromotionalOffers, storefrontOfferEnvelopeSchema, storefrontPromotionalOfferSchema, } from "./storefront-offers.js";
|
|
32
|
+
export { insertOfferItemParticipantSchema, insertOfferItemSchema, insertOfferParticipantSchema, insertOfferSchema, insertOrderItemParticipantSchema, insertOrderItemSchema, insertOrderParticipantSchema, insertOrderSchema, insertOrderTermSchema, offerItemListQuerySchema, offerItemParticipantListQuerySchema, offerListQuerySchema, offerMetadataSchema, offerParticipantListQuerySchema, offerStatusSchema, orderItemListQuerySchema, orderItemParticipantListQuerySchema, orderListQuerySchema, orderParticipantListQuerySchema, orderStatusSchema, orderTermAcceptanceStatusSchema, orderTermListQuerySchema, orderTermTypeSchema, storefrontOfferDiscountTypeSchema, storefrontOfferMetadataSchema, transactionItemParticipantRoleSchema, transactionItemStatusSchema, transactionItemTypeSchema, transactionParticipantTypeSchema, transactionTravelerCategorySchema, updateOfferItemParticipantSchema, updateOfferItemSchema, updateOfferParticipantSchema, updateOfferSchema, updateOrderItemParticipantSchema, updateOrderItemSchema, updateOrderParticipantSchema, updateOrderSchema, updateOrderTermSchema, } from "./validation.js";
|
|
32
33
|
export { transactionsService };
|
package/dist/routes-offers.d.ts
CHANGED
|
@@ -49,15 +49,15 @@ export declare const transactionOfferRoutes: import("hono/hono-base").HonoBase<E
|
|
|
49
49
|
data: {
|
|
50
50
|
createdAt: string;
|
|
51
51
|
updatedAt: string;
|
|
52
|
-
currency: string;
|
|
53
|
-
notes: string | null;
|
|
54
52
|
id: string;
|
|
55
53
|
metadata: import("hono/utils/types").JSONValue;
|
|
54
|
+
organizationId: string | null;
|
|
55
|
+
status: "draft" | "published" | "sent" | "accepted" | "expired" | "withdrawn" | "converted";
|
|
56
|
+
currency: string;
|
|
57
|
+
notes: string | null;
|
|
56
58
|
offerNumber: string;
|
|
57
59
|
title: string;
|
|
58
|
-
status: "draft" | "published" | "sent" | "accepted" | "expired" | "withdrawn" | "converted";
|
|
59
60
|
personId: string | null;
|
|
60
|
-
organizationId: string | null;
|
|
61
61
|
opportunityId: string | null;
|
|
62
62
|
quoteId: string | null;
|
|
63
63
|
marketId: string | null;
|
|
@@ -590,11 +590,11 @@ export declare const transactionOfferRoutes: import("hono/hono-base").HonoBase<E
|
|
|
590
590
|
createdAt: string;
|
|
591
591
|
updatedAt: string;
|
|
592
592
|
description: string | null;
|
|
593
|
-
notes: string | null;
|
|
594
593
|
id: string;
|
|
595
594
|
metadata: import("hono/utils/types").JSONValue;
|
|
596
|
-
title: string;
|
|
597
595
|
status: "draft" | "confirmed" | "fulfilled" | "cancelled" | "priced";
|
|
596
|
+
notes: string | null;
|
|
597
|
+
title: string;
|
|
598
598
|
taxAmountCents: number | null;
|
|
599
599
|
feeAmountCents: number | null;
|
|
600
600
|
productId: string | null;
|
|
@@ -778,11 +778,11 @@ export declare const transactionOfferRoutes: import("hono/hono-base").HonoBase<E
|
|
|
778
778
|
output: {
|
|
779
779
|
data: {
|
|
780
780
|
createdAt: string;
|
|
781
|
-
participantId: string;
|
|
782
781
|
id: string;
|
|
782
|
+
role: "other" | "traveler" | "occupant" | "primary_contact" | "beneficiary" | "service_assignee";
|
|
783
|
+
participantId: string;
|
|
783
784
|
isPrimary: boolean;
|
|
784
785
|
offerItemId: string;
|
|
785
|
-
role: "other" | "traveler" | "occupant" | "primary_contact" | "beneficiary" | "service_assignee";
|
|
786
786
|
} | null;
|
|
787
787
|
};
|
|
788
788
|
outputFormat: "json";
|
package/dist/routes-orders.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare const transactionOrderRoutes: import("hono/hono-base").HonoBase<E
|
|
|
9
9
|
orderNumber: string;
|
|
10
10
|
offerId: string | null;
|
|
11
11
|
title: string;
|
|
12
|
-
status: "
|
|
12
|
+
status: "pending" | "draft" | "expired" | "confirmed" | "fulfilled" | "cancelled";
|
|
13
13
|
personId: string | null;
|
|
14
14
|
organizationId: string | null;
|
|
15
15
|
opportunityId: string | null;
|
|
@@ -50,14 +50,15 @@ export declare const transactionOrderRoutes: import("hono/hono-base").HonoBase<E
|
|
|
50
50
|
offerId: string | null;
|
|
51
51
|
createdAt: string;
|
|
52
52
|
updatedAt: string;
|
|
53
|
-
currency: string;
|
|
54
|
-
notes: string | null;
|
|
55
53
|
id: string;
|
|
54
|
+
expiresAt: string | null;
|
|
56
55
|
metadata: import("hono/utils/types").JSONValue;
|
|
56
|
+
organizationId: string | null;
|
|
57
|
+
status: "pending" | "draft" | "expired" | "confirmed" | "fulfilled" | "cancelled";
|
|
58
|
+
currency: string;
|
|
59
|
+
notes: string | null;
|
|
57
60
|
title: string;
|
|
58
|
-
status: "draft" | "expired" | "pending" | "confirmed" | "fulfilled" | "cancelled";
|
|
59
61
|
personId: string | null;
|
|
60
|
-
organizationId: string | null;
|
|
61
62
|
opportunityId: string | null;
|
|
62
63
|
quoteId: string | null;
|
|
63
64
|
marketId: string | null;
|
|
@@ -73,7 +74,6 @@ export declare const transactionOrderRoutes: import("hono/hono-base").HonoBase<E
|
|
|
73
74
|
orderedAt: string | null;
|
|
74
75
|
confirmedAt: string | null;
|
|
75
76
|
cancelledAt: string | null;
|
|
76
|
-
expiresAt: string | null;
|
|
77
77
|
} | null;
|
|
78
78
|
};
|
|
79
79
|
outputFormat: "json";
|
|
@@ -105,7 +105,7 @@ export declare const transactionOrderRoutes: import("hono/hono-base").HonoBase<E
|
|
|
105
105
|
orderNumber: string;
|
|
106
106
|
offerId: string | null;
|
|
107
107
|
title: string;
|
|
108
|
-
status: "
|
|
108
|
+
status: "pending" | "draft" | "expired" | "confirmed" | "fulfilled" | "cancelled";
|
|
109
109
|
personId: string | null;
|
|
110
110
|
organizationId: string | null;
|
|
111
111
|
opportunityId: string | null;
|
|
@@ -159,7 +159,7 @@ export declare const transactionOrderRoutes: import("hono/hono-base").HonoBase<E
|
|
|
159
159
|
orderNumber: string;
|
|
160
160
|
offerId: string | null;
|
|
161
161
|
title: string;
|
|
162
|
-
status: "
|
|
162
|
+
status: "pending" | "draft" | "expired" | "confirmed" | "fulfilled" | "cancelled";
|
|
163
163
|
personId: string | null;
|
|
164
164
|
organizationId: string | null;
|
|
165
165
|
opportunityId: string | null;
|
|
@@ -591,11 +591,11 @@ export declare const transactionOrderRoutes: import("hono/hono-base").HonoBase<E
|
|
|
591
591
|
createdAt: string;
|
|
592
592
|
updatedAt: string;
|
|
593
593
|
description: string | null;
|
|
594
|
-
notes: string | null;
|
|
595
594
|
id: string;
|
|
596
595
|
metadata: import("hono/utils/types").JSONValue;
|
|
597
|
-
title: string;
|
|
598
596
|
status: "draft" | "confirmed" | "fulfilled" | "cancelled" | "priced";
|
|
597
|
+
notes: string | null;
|
|
598
|
+
title: string;
|
|
599
599
|
taxAmountCents: number | null;
|
|
600
600
|
feeAmountCents: number | null;
|
|
601
601
|
productId: string | null;
|
|
@@ -782,10 +782,10 @@ export declare const transactionOrderRoutes: import("hono/hono-base").HonoBase<E
|
|
|
782
782
|
output: {
|
|
783
783
|
data: {
|
|
784
784
|
createdAt: string;
|
|
785
|
-
participantId: string;
|
|
786
785
|
id: string;
|
|
787
|
-
isPrimary: boolean;
|
|
788
786
|
role: "other" | "traveler" | "occupant" | "primary_contact" | "beneficiary" | "service_assignee";
|
|
787
|
+
participantId: string;
|
|
788
|
+
isPrimary: boolean;
|
|
789
789
|
orderItemId: string;
|
|
790
790
|
} | null;
|
|
791
791
|
};
|
|
@@ -900,7 +900,7 @@ export declare const transactionOrderRoutes: import("hono/hono-base").HonoBase<E
|
|
|
900
900
|
language: string | null;
|
|
901
901
|
required: boolean;
|
|
902
902
|
sortOrder: number;
|
|
903
|
-
acceptanceStatus: "
|
|
903
|
+
acceptanceStatus: "pending" | "accepted" | "not_required" | "declined";
|
|
904
904
|
acceptedAt: string | null;
|
|
905
905
|
acceptedBy: string | null;
|
|
906
906
|
metadata: import("hono/utils/types").JSONValue;
|
|
@@ -934,7 +934,7 @@ export declare const transactionOrderRoutes: import("hono/hono-base").HonoBase<E
|
|
|
934
934
|
language: string | null;
|
|
935
935
|
required: boolean;
|
|
936
936
|
sortOrder: number;
|
|
937
|
-
acceptanceStatus: "
|
|
937
|
+
acceptanceStatus: "pending" | "accepted" | "not_required" | "declined";
|
|
938
938
|
acceptedBy: string | null;
|
|
939
939
|
} | null;
|
|
940
940
|
};
|
|
@@ -972,7 +972,7 @@ export declare const transactionOrderRoutes: import("hono/hono-base").HonoBase<E
|
|
|
972
972
|
language: string | null;
|
|
973
973
|
required: boolean;
|
|
974
974
|
sortOrder: number;
|
|
975
|
-
acceptanceStatus: "
|
|
975
|
+
acceptanceStatus: "pending" | "accepted" | "not_required" | "declined";
|
|
976
976
|
acceptedAt: string | null;
|
|
977
977
|
acceptedBy: string | null;
|
|
978
978
|
metadata: import("hono/utils/types").JSONValue;
|
|
@@ -1014,7 +1014,7 @@ export declare const transactionOrderRoutes: import("hono/hono-base").HonoBase<E
|
|
|
1014
1014
|
language: string | null;
|
|
1015
1015
|
required: boolean;
|
|
1016
1016
|
sortOrder: number;
|
|
1017
|
-
acceptanceStatus: "
|
|
1017
|
+
acceptanceStatus: "pending" | "accepted" | "not_required" | "declined";
|
|
1018
1018
|
acceptedAt: string | null;
|
|
1019
1019
|
acceptedBy: string | null;
|
|
1020
1020
|
metadata: import("hono/utils/types").JSONValue;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type KmsEnvelope } from "@voyantjs/db/schema/iam";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
export declare const transactionParticipantIdentitySchema: z.ZodObject<{
|
|
4
4
|
dateOfBirth: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"participant-identity.d.ts","sourceRoot":"","sources":["../../src/schema/participant-identity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"participant-identity.d.ts","sourceRoot":"","sources":["../../src/schema/participant-identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAqB,MAAM,yBAAyB,CAAA;AAC7E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,oCAAoC;;;iBAG/C,CAAA;AAEF,eAAO,MAAM,6CAA6C;;;;;;;;;;iBAOxD,CAAA;AAEF,eAAO,MAAM,4CAA4C;;;;iBAEvD,CAAA;AAEF,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAA;AACjG,MAAM,MAAM,sCAAsC,GAAG;IACnD,iBAAiB,CAAC,EAAE,WAAW,GAAG,IAAI,CAAA;CACvC,CAAA;AACD,MAAM,MAAM,uCAAuC,GAAG,CAAC,CAAC,KAAK,CAC3D,OAAO,6CAA6C,CACrD,CAAA"}
|
package/dist/schema-orders.d.ts
CHANGED
|
@@ -75,7 +75,7 @@ export declare const orders: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
75
75
|
tableName: "orders";
|
|
76
76
|
dataType: "string";
|
|
77
77
|
columnType: "PgEnumColumn";
|
|
78
|
-
data: "
|
|
78
|
+
data: "pending" | "draft" | "expired" | "confirmed" | "fulfilled" | "cancelled";
|
|
79
79
|
driverParam: string;
|
|
80
80
|
notNull: true;
|
|
81
81
|
hasDefault: true;
|
|
@@ -1469,7 +1469,7 @@ export declare const orderTerms: import("drizzle-orm/pg-core").PgTableWithColumn
|
|
|
1469
1469
|
tableName: "order_terms";
|
|
1470
1470
|
dataType: "string";
|
|
1471
1471
|
columnType: "PgEnumColumn";
|
|
1472
|
-
data: "
|
|
1472
|
+
data: "pending" | "accepted" | "not_required" | "declined";
|
|
1473
1473
|
driverParam: string;
|
|
1474
1474
|
notNull: true;
|
|
1475
1475
|
hasDefault: true;
|
package/dist/service-offers.d.ts
CHANGED
|
@@ -66,15 +66,15 @@ export declare function getOfferById(db: PostgresJsDatabase, id: string): Promis
|
|
|
66
66
|
export declare function createOffer(db: PostgresJsDatabase, data: CreateOfferInput): Promise<{
|
|
67
67
|
createdAt: Date;
|
|
68
68
|
updatedAt: Date;
|
|
69
|
-
currency: string;
|
|
70
|
-
notes: string | null;
|
|
71
69
|
id: string;
|
|
72
70
|
metadata: unknown;
|
|
71
|
+
organizationId: string | null;
|
|
72
|
+
status: "draft" | "published" | "sent" | "accepted" | "expired" | "withdrawn" | "converted";
|
|
73
|
+
currency: string;
|
|
74
|
+
notes: string | null;
|
|
73
75
|
offerNumber: string;
|
|
74
76
|
title: string;
|
|
75
|
-
status: "draft" | "published" | "sent" | "accepted" | "expired" | "withdrawn" | "converted";
|
|
76
77
|
personId: string | null;
|
|
77
|
-
organizationId: string | null;
|
|
78
78
|
opportunityId: string | null;
|
|
79
79
|
quoteId: string | null;
|
|
80
80
|
marketId: string | null;
|
|
@@ -96,15 +96,15 @@ export declare function createOfferBundle(db: PostgresJsDatabase, input: CreateO
|
|
|
96
96
|
offer: {
|
|
97
97
|
createdAt: Date;
|
|
98
98
|
updatedAt: Date;
|
|
99
|
-
currency: string;
|
|
100
|
-
notes: string | null;
|
|
101
99
|
id: string;
|
|
102
100
|
metadata: unknown;
|
|
101
|
+
organizationId: string | null;
|
|
102
|
+
status: "draft" | "published" | "sent" | "accepted" | "expired" | "withdrawn" | "converted";
|
|
103
|
+
currency: string;
|
|
104
|
+
notes: string | null;
|
|
103
105
|
offerNumber: string;
|
|
104
106
|
title: string;
|
|
105
|
-
status: "draft" | "published" | "sent" | "accepted" | "expired" | "withdrawn" | "converted";
|
|
106
107
|
personId: string | null;
|
|
107
|
-
organizationId: string | null;
|
|
108
108
|
opportunityId: string | null;
|
|
109
109
|
quoteId: string | null;
|
|
110
110
|
marketId: string | null;
|
|
@@ -144,11 +144,11 @@ export declare function createOfferBundle(db: PostgresJsDatabase, input: CreateO
|
|
|
144
144
|
createdAt: Date;
|
|
145
145
|
updatedAt: Date;
|
|
146
146
|
description: string | null;
|
|
147
|
-
notes: string | null;
|
|
148
147
|
id: string;
|
|
149
148
|
metadata: unknown;
|
|
150
|
-
title: string;
|
|
151
149
|
status: "draft" | "confirmed" | "fulfilled" | "cancelled" | "priced";
|
|
150
|
+
notes: string | null;
|
|
151
|
+
title: string;
|
|
152
152
|
taxAmountCents: number | null;
|
|
153
153
|
feeAmountCents: number | null;
|
|
154
154
|
productId: string | null;
|
|
@@ -169,11 +169,11 @@ export declare function createOfferBundle(db: PostgresJsDatabase, input: CreateO
|
|
|
169
169
|
}[];
|
|
170
170
|
itemParticipants: {
|
|
171
171
|
createdAt: Date;
|
|
172
|
-
participantId: string;
|
|
173
172
|
id: string;
|
|
173
|
+
role: "other" | "traveler" | "occupant" | "primary_contact" | "beneficiary" | "service_assignee";
|
|
174
|
+
participantId: string;
|
|
174
175
|
isPrimary: boolean;
|
|
175
176
|
offerItemId: string;
|
|
176
|
-
role: "other" | "traveler" | "occupant" | "primary_contact" | "beneficiary" | "service_assignee";
|
|
177
177
|
}[];
|
|
178
178
|
} | null>;
|
|
179
179
|
export declare function updateOffer(db: PostgresJsDatabase, id: string, data: UpdateOfferInput): Promise<{
|
|
@@ -350,11 +350,11 @@ export declare function createOfferItem(db: PostgresJsDatabase, data: CreateOffe
|
|
|
350
350
|
createdAt: Date;
|
|
351
351
|
updatedAt: Date;
|
|
352
352
|
description: string | null;
|
|
353
|
-
notes: string | null;
|
|
354
353
|
id: string;
|
|
355
354
|
metadata: unknown;
|
|
356
|
-
title: string;
|
|
357
355
|
status: "draft" | "confirmed" | "fulfilled" | "cancelled" | "priced";
|
|
356
|
+
notes: string | null;
|
|
357
|
+
title: string;
|
|
358
358
|
taxAmountCents: number | null;
|
|
359
359
|
feeAmountCents: number | null;
|
|
360
360
|
productId: string | null;
|
|
@@ -427,11 +427,11 @@ export declare function getOfferItemParticipantById(db: PostgresJsDatabase, id:
|
|
|
427
427
|
} | null>;
|
|
428
428
|
export declare function createOfferItemParticipant(db: PostgresJsDatabase, data: CreateOfferItemParticipantInput): Promise<{
|
|
429
429
|
createdAt: Date;
|
|
430
|
-
participantId: string;
|
|
431
430
|
id: string;
|
|
431
|
+
role: "other" | "traveler" | "occupant" | "primary_contact" | "beneficiary" | "service_assignee";
|
|
432
|
+
participantId: string;
|
|
432
433
|
isPrimary: boolean;
|
|
433
434
|
offerItemId: string;
|
|
434
|
-
role: "other" | "traveler" | "occupant" | "primary_contact" | "beneficiary" | "service_assignee";
|
|
435
435
|
} | null>;
|
|
436
436
|
export declare function updateOfferItemParticipant(db: PostgresJsDatabase, id: string, data: UpdateOfferItemParticipantInput): Promise<{
|
|
437
437
|
id: string;
|
package/dist/service-orders.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare function listOrders(db: PostgresJsDatabase, query: OrderListQuery
|
|
|
6
6
|
orderNumber: string;
|
|
7
7
|
offerId: string | null;
|
|
8
8
|
title: string;
|
|
9
|
-
status: "
|
|
9
|
+
status: "pending" | "draft" | "expired" | "confirmed" | "fulfilled" | "cancelled";
|
|
10
10
|
personId: string | null;
|
|
11
11
|
organizationId: string | null;
|
|
12
12
|
opportunityId: string | null;
|
|
@@ -39,7 +39,7 @@ export declare function getOrderById(db: PostgresJsDatabase, id: string): Promis
|
|
|
39
39
|
orderNumber: string;
|
|
40
40
|
offerId: string | null;
|
|
41
41
|
title: string;
|
|
42
|
-
status: "
|
|
42
|
+
status: "pending" | "draft" | "expired" | "confirmed" | "fulfilled" | "cancelled";
|
|
43
43
|
personId: string | null;
|
|
44
44
|
organizationId: string | null;
|
|
45
45
|
opportunityId: string | null;
|
|
@@ -67,14 +67,15 @@ export declare function createOrder(db: PostgresJsDatabase, data: CreateOrderInp
|
|
|
67
67
|
offerId: string | null;
|
|
68
68
|
createdAt: Date;
|
|
69
69
|
updatedAt: Date;
|
|
70
|
-
currency: string;
|
|
71
|
-
notes: string | null;
|
|
72
70
|
id: string;
|
|
71
|
+
expiresAt: Date | null;
|
|
73
72
|
metadata: unknown;
|
|
73
|
+
organizationId: string | null;
|
|
74
|
+
status: "pending" | "draft" | "expired" | "confirmed" | "fulfilled" | "cancelled";
|
|
75
|
+
currency: string;
|
|
76
|
+
notes: string | null;
|
|
74
77
|
title: string;
|
|
75
|
-
status: "draft" | "expired" | "pending" | "confirmed" | "fulfilled" | "cancelled";
|
|
76
78
|
personId: string | null;
|
|
77
|
-
organizationId: string | null;
|
|
78
79
|
opportunityId: string | null;
|
|
79
80
|
quoteId: string | null;
|
|
80
81
|
marketId: string | null;
|
|
@@ -90,14 +91,13 @@ export declare function createOrder(db: PostgresJsDatabase, data: CreateOrderInp
|
|
|
90
91
|
orderedAt: Date | null;
|
|
91
92
|
confirmedAt: Date | null;
|
|
92
93
|
cancelledAt: Date | null;
|
|
93
|
-
expiresAt: Date | null;
|
|
94
94
|
} | null>;
|
|
95
95
|
export declare function updateOrder(db: PostgresJsDatabase, id: string, data: UpdateOrderInput): Promise<{
|
|
96
96
|
id: string;
|
|
97
97
|
orderNumber: string;
|
|
98
98
|
offerId: string | null;
|
|
99
99
|
title: string;
|
|
100
|
-
status: "
|
|
100
|
+
status: "pending" | "draft" | "expired" | "confirmed" | "fulfilled" | "cancelled";
|
|
101
101
|
personId: string | null;
|
|
102
102
|
organizationId: string | null;
|
|
103
103
|
opportunityId: string | null;
|
|
@@ -268,11 +268,11 @@ export declare function createOrderItem(db: PostgresJsDatabase, data: CreateOrde
|
|
|
268
268
|
createdAt: Date;
|
|
269
269
|
updatedAt: Date;
|
|
270
270
|
description: string | null;
|
|
271
|
-
notes: string | null;
|
|
272
271
|
id: string;
|
|
273
272
|
metadata: unknown;
|
|
274
|
-
title: string;
|
|
275
273
|
status: "draft" | "confirmed" | "fulfilled" | "cancelled" | "priced";
|
|
274
|
+
notes: string | null;
|
|
275
|
+
title: string;
|
|
276
276
|
taxAmountCents: number | null;
|
|
277
277
|
feeAmountCents: number | null;
|
|
278
278
|
productId: string | null;
|
|
@@ -347,10 +347,10 @@ export declare function getOrderItemParticipantById(db: PostgresJsDatabase, id:
|
|
|
347
347
|
} | null>;
|
|
348
348
|
export declare function createOrderItemParticipant(db: PostgresJsDatabase, data: CreateOrderItemParticipantInput): Promise<{
|
|
349
349
|
createdAt: Date;
|
|
350
|
-
participantId: string;
|
|
351
350
|
id: string;
|
|
352
|
-
isPrimary: boolean;
|
|
353
351
|
role: "other" | "traveler" | "occupant" | "primary_contact" | "beneficiary" | "service_assignee";
|
|
352
|
+
participantId: string;
|
|
353
|
+
isPrimary: boolean;
|
|
354
354
|
orderItemId: string;
|
|
355
355
|
} | null>;
|
|
356
356
|
export declare function updateOrderItemParticipant(db: PostgresJsDatabase, id: string, data: UpdateOrderItemParticipantInput): Promise<{
|
|
@@ -375,7 +375,7 @@ export declare function listOrderTerms(db: PostgresJsDatabase, query: OrderTermL
|
|
|
375
375
|
language: string | null;
|
|
376
376
|
required: boolean;
|
|
377
377
|
sortOrder: number;
|
|
378
|
-
acceptanceStatus: "
|
|
378
|
+
acceptanceStatus: "pending" | "accepted" | "not_required" | "declined";
|
|
379
379
|
acceptedAt: Date | null;
|
|
380
380
|
acceptedBy: string | null;
|
|
381
381
|
metadata: unknown;
|
|
@@ -396,7 +396,7 @@ export declare function getOrderTermById(db: PostgresJsDatabase, id: string): Pr
|
|
|
396
396
|
language: string | null;
|
|
397
397
|
required: boolean;
|
|
398
398
|
sortOrder: number;
|
|
399
|
-
acceptanceStatus: "
|
|
399
|
+
acceptanceStatus: "pending" | "accepted" | "not_required" | "declined";
|
|
400
400
|
acceptedAt: Date | null;
|
|
401
401
|
acceptedBy: string | null;
|
|
402
402
|
metadata: unknown;
|
|
@@ -417,7 +417,7 @@ export declare function createOrderTerm(db: PostgresJsDatabase, data: CreateOrde
|
|
|
417
417
|
language: string | null;
|
|
418
418
|
required: boolean;
|
|
419
419
|
sortOrder: number;
|
|
420
|
-
acceptanceStatus: "
|
|
420
|
+
acceptanceStatus: "pending" | "accepted" | "not_required" | "declined";
|
|
421
421
|
acceptedBy: string | null;
|
|
422
422
|
} | null>;
|
|
423
423
|
export declare function updateOrderTerm(db: PostgresJsDatabase, id: string, data: UpdateOrderTermInput): Promise<{
|
|
@@ -430,7 +430,7 @@ export declare function updateOrderTerm(db: PostgresJsDatabase, id: string, data
|
|
|
430
430
|
language: string | null;
|
|
431
431
|
required: boolean;
|
|
432
432
|
sortOrder: number;
|
|
433
|
-
acceptanceStatus: "
|
|
433
|
+
acceptanceStatus: "pending" | "accepted" | "not_required" | "declined";
|
|
434
434
|
acceptedAt: Date | null;
|
|
435
435
|
acceptedBy: string | null;
|
|
436
436
|
metadata: unknown;
|
package/dist/service.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { createOffer, createOfferBundle, createOfferItem, createOfferItemParticipant, createOfferParticipant, deleteOffer, deleteOfferItem, deleteOfferItemParticipant, deleteOfferParticipant, getOfferById, getOfferItemById, getOfferItemParticipantById, getOfferParticipantById, listOfferItemParticipants, listOfferItems, listOfferParticipants, listOffers, updateOffer, updateOfferItem, updateOfferItemParticipant, updateOfferParticipant } from "./service-offers.js";
|
|
2
2
|
import { createOrder, createOrderItem, createOrderItemParticipant, createOrderParticipant, createOrderTerm, deleteOrder, deleteOrderItem, deleteOrderItemParticipant, deleteOrderParticipant, deleteOrderTerm, getOrderById, getOrderItemById, getOrderItemParticipantById, getOrderParticipantById, getOrderTermById, listOrderItemParticipants, listOrderItems, listOrderParticipants, listOrders, listOrderTerms, updateOrder, updateOrderItem, updateOrderItemParticipant, updateOrderParticipant, updateOrderTerm } from "./service-orders.js";
|
|
3
|
+
import { getStorefrontPromotionalOfferBySlug, listStorefrontPromotionalOffers } from "./storefront-offers.js";
|
|
3
4
|
export declare const transactionsService: {
|
|
4
5
|
listOffers: typeof listOffers;
|
|
6
|
+
listStorefrontPromotionalOffers: typeof listStorefrontPromotionalOffers;
|
|
7
|
+
getStorefrontPromotionalOfferBySlug: typeof getStorefrontPromotionalOfferBySlug;
|
|
5
8
|
getOfferById: typeof getOfferById;
|
|
6
9
|
createOffer: typeof createOffer;
|
|
7
10
|
createOfferBundle: typeof createOfferBundle;
|
package/dist/service.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,0BAA0B,EAC1B,sBAAsB,EACtB,WAAW,EACX,eAAe,EACf,0BAA0B,EAC1B,sBAAsB,EACtB,YAAY,EACZ,gBAAgB,EAChB,2BAA2B,EAC3B,uBAAuB,EACvB,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,UAAU,EACV,WAAW,EACX,eAAe,EACf,0BAA0B,EAC1B,sBAAsB,EACvB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,WAAW,EACX,eAAe,EACf,0BAA0B,EAC1B,sBAAsB,EACtB,eAAe,EACf,WAAW,EACX,eAAe,EACf,0BAA0B,EAC1B,sBAAsB,EACtB,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,2BAA2B,EAC3B,uBAAuB,EACvB,gBAAgB,EAChB,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,UAAU,EACV,cAAc,EACd,WAAW,EACX,eAAe,EACf,0BAA0B,EAC1B,sBAAsB,EACtB,eAAe,EAChB,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,0BAA0B,EAC1B,sBAAsB,EACtB,WAAW,EACX,eAAe,EACf,0BAA0B,EAC1B,sBAAsB,EACtB,YAAY,EACZ,gBAAgB,EAChB,2BAA2B,EAC3B,uBAAuB,EACvB,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,UAAU,EACV,WAAW,EACX,eAAe,EACf,0BAA0B,EAC1B,sBAAsB,EACvB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,WAAW,EACX,eAAe,EACf,0BAA0B,EAC1B,sBAAsB,EACtB,eAAe,EACf,WAAW,EACX,eAAe,EACf,0BAA0B,EAC1B,sBAAsB,EACtB,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,2BAA2B,EAC3B,uBAAuB,EACvB,gBAAgB,EAChB,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,UAAU,EACV,cAAc,EACd,WAAW,EACX,eAAe,EACf,0BAA0B,EAC1B,sBAAsB,EACtB,eAAe,EAChB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,mCAAmC,EACnC,+BAA+B,EAChC,MAAM,wBAAwB,CAAA;AAE/B,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiD/B,CAAA"}
|
package/dist/service.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { createOffer, createOfferBundle, createOfferItem, createOfferItemParticipant, createOfferParticipant, deleteOffer, deleteOfferItem, deleteOfferItemParticipant, deleteOfferParticipant, getOfferById, getOfferItemById, getOfferItemParticipantById, getOfferParticipantById, listOfferItemParticipants, listOfferItems, listOfferParticipants, listOffers, updateOffer, updateOfferItem, updateOfferItemParticipant, updateOfferParticipant, } from "./service-offers.js";
|
|
2
2
|
import { createOrder, createOrderItem, createOrderItemParticipant, createOrderParticipant, createOrderTerm, deleteOrder, deleteOrderItem, deleteOrderItemParticipant, deleteOrderParticipant, deleteOrderTerm, getOrderById, getOrderItemById, getOrderItemParticipantById, getOrderParticipantById, getOrderTermById, listOrderItemParticipants, listOrderItems, listOrderParticipants, listOrders, listOrderTerms, updateOrder, updateOrderItem, updateOrderItemParticipant, updateOrderParticipant, updateOrderTerm, } from "./service-orders.js";
|
|
3
|
+
import { getStorefrontPromotionalOfferBySlug, listStorefrontPromotionalOffers, } from "./storefront-offers.js";
|
|
3
4
|
export const transactionsService = {
|
|
4
5
|
listOffers,
|
|
6
|
+
listStorefrontPromotionalOffers,
|
|
7
|
+
getStorefrontPromotionalOfferBySlug,
|
|
5
8
|
getOfferById,
|
|
6
9
|
createOffer,
|
|
7
10
|
createOfferBundle,
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { storefrontOfferMetadataSchema } from "./validation.js";
|
|
4
|
+
export declare const storefrontOfferEnvelopeSchema: z.ZodObject<{
|
|
5
|
+
storefrontPromotionalOffer: z.ZodObject<{
|
|
6
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
7
|
+
locale: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
8
|
+
slug: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
9
|
+
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
10
|
+
discountType: z.ZodEnum<{
|
|
11
|
+
percentage: "percentage";
|
|
12
|
+
fixed_amount: "fixed_amount";
|
|
13
|
+
}>;
|
|
14
|
+
discountValue: z.ZodString;
|
|
15
|
+
currency: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
16
|
+
applicableProductIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
17
|
+
applicableDepartureIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
18
|
+
validFrom: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
19
|
+
validTo: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
20
|
+
minPassengers: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
21
|
+
imageMobileUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
22
|
+
imageDesktopUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
23
|
+
stackable: z.ZodDefault<z.ZodBoolean>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
export declare const storefrontPromotionalOfferSchema: z.ZodObject<{
|
|
27
|
+
id: z.ZodString;
|
|
28
|
+
name: z.ZodString;
|
|
29
|
+
slug: z.ZodNullable<z.ZodString>;
|
|
30
|
+
description: z.ZodNullable<z.ZodString>;
|
|
31
|
+
discountType: z.ZodEnum<{
|
|
32
|
+
percentage: "percentage";
|
|
33
|
+
fixed_amount: "fixed_amount";
|
|
34
|
+
}>;
|
|
35
|
+
discountValue: z.ZodString;
|
|
36
|
+
currency: z.ZodNullable<z.ZodString>;
|
|
37
|
+
applicableProductIds: z.ZodArray<z.ZodString>;
|
|
38
|
+
applicableDepartureIds: z.ZodArray<z.ZodString>;
|
|
39
|
+
validFrom: z.ZodNullable<z.ZodString>;
|
|
40
|
+
validTo: z.ZodNullable<z.ZodString>;
|
|
41
|
+
minPassengers: z.ZodNullable<z.ZodNumber>;
|
|
42
|
+
imageMobileUrl: z.ZodNullable<z.ZodString>;
|
|
43
|
+
imageDesktopUrl: z.ZodNullable<z.ZodString>;
|
|
44
|
+
stackable: z.ZodBoolean;
|
|
45
|
+
createdAt: z.ZodString;
|
|
46
|
+
updatedAt: z.ZodString;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
export type StorefrontOfferMetadata = z.infer<typeof storefrontOfferMetadataSchema>;
|
|
49
|
+
export type StorefrontPromotionalOffer = z.infer<typeof storefrontPromotionalOfferSchema>;
|
|
50
|
+
export declare function listStorefrontPromotionalOffers(db: PostgresJsDatabase, input: {
|
|
51
|
+
productId: string;
|
|
52
|
+
departureId?: string;
|
|
53
|
+
locale?: string;
|
|
54
|
+
now?: Date;
|
|
55
|
+
}): Promise<StorefrontPromotionalOffer[]>;
|
|
56
|
+
export declare function getStorefrontPromotionalOfferBySlug(db: PostgresJsDatabase, input: {
|
|
57
|
+
slug: string;
|
|
58
|
+
locale?: string;
|
|
59
|
+
now?: Date;
|
|
60
|
+
}): Promise<StorefrontPromotionalOffer | null>;
|
|
61
|
+
export declare function createStorefrontPromotionalOffersResolver(db: PostgresJsDatabase): {
|
|
62
|
+
listApplicableOffers(input: {
|
|
63
|
+
productId: string;
|
|
64
|
+
departureId?: string;
|
|
65
|
+
locale?: string;
|
|
66
|
+
}): Promise<{
|
|
67
|
+
id: string;
|
|
68
|
+
name: string;
|
|
69
|
+
slug: string | null;
|
|
70
|
+
description: string | null;
|
|
71
|
+
discountType: "percentage" | "fixed_amount";
|
|
72
|
+
discountValue: string;
|
|
73
|
+
currency: string | null;
|
|
74
|
+
applicableProductIds: string[];
|
|
75
|
+
applicableDepartureIds: string[];
|
|
76
|
+
validFrom: string | null;
|
|
77
|
+
validTo: string | null;
|
|
78
|
+
minPassengers: number | null;
|
|
79
|
+
imageMobileUrl: string | null;
|
|
80
|
+
imageDesktopUrl: string | null;
|
|
81
|
+
stackable: boolean;
|
|
82
|
+
createdAt: string;
|
|
83
|
+
updatedAt: string;
|
|
84
|
+
}[]>;
|
|
85
|
+
getOfferBySlug(input: {
|
|
86
|
+
slug: string;
|
|
87
|
+
locale?: string;
|
|
88
|
+
}): Promise<{
|
|
89
|
+
id: string;
|
|
90
|
+
name: string;
|
|
91
|
+
slug: string | null;
|
|
92
|
+
description: string | null;
|
|
93
|
+
discountType: "percentage" | "fixed_amount";
|
|
94
|
+
discountValue: string;
|
|
95
|
+
currency: string | null;
|
|
96
|
+
applicableProductIds: string[];
|
|
97
|
+
applicableDepartureIds: string[];
|
|
98
|
+
validFrom: string | null;
|
|
99
|
+
validTo: string | null;
|
|
100
|
+
minPassengers: number | null;
|
|
101
|
+
imageMobileUrl: string | null;
|
|
102
|
+
imageDesktopUrl: string | null;
|
|
103
|
+
stackable: boolean;
|
|
104
|
+
createdAt: string;
|
|
105
|
+
updatedAt: string;
|
|
106
|
+
} | null>;
|
|
107
|
+
};
|
|
108
|
+
//# sourceMappingURL=storefront-offers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storefront-offers.d.ts","sourceRoot":"","sources":["../src/storefront-offers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,EAAqC,6BAA6B,EAAE,MAAM,iBAAiB,CAAA;AAElG,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;iBAExC,CAAA;AAEF,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;iBAkB3C,CAAA;AAEF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAA;AACnF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAA;AAyFzF,wBAAsB,+BAA+B,CACnD,EAAE,EAAE,kBAAkB,EACtB,KAAK,EAAE;IACL,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,GAAG,CAAC,EAAE,IAAI,CAAA;CACX,GACA,OAAO,CAAC,0BAA0B,EAAE,CAAC,CAiFvC;AAED,wBAAsB,mCAAmC,CACvD,EAAE,EAAE,kBAAkB,EACtB,KAAK,EAAE;IACL,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,GAAG,CAAC,EAAE,IAAI,CAAA;CACX,GACA,OAAO,CAAC,0BAA0B,GAAG,IAAI,CAAC,CAuD5C;AAED,wBAAgB,yCAAyC,CAAC,EAAE,EAAE,kBAAkB;gCAEhD;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;;;;;;;;0BAGlE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;;;;;;;;EAI1D"}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { desc, eq, inArray } from "drizzle-orm";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { offerItems, offers } from "./schema.js";
|
|
4
|
+
import { storefrontOfferDiscountTypeSchema, storefrontOfferMetadataSchema } from "./validation.js";
|
|
5
|
+
export const storefrontOfferEnvelopeSchema = z.object({
|
|
6
|
+
storefrontPromotionalOffer: storefrontOfferMetadataSchema,
|
|
7
|
+
});
|
|
8
|
+
export const storefrontPromotionalOfferSchema = z.object({
|
|
9
|
+
id: z.string(),
|
|
10
|
+
name: z.string(),
|
|
11
|
+
slug: z.string().nullable(),
|
|
12
|
+
description: z.string().nullable(),
|
|
13
|
+
discountType: storefrontOfferDiscountTypeSchema,
|
|
14
|
+
discountValue: z.string(),
|
|
15
|
+
currency: z.string().nullable(),
|
|
16
|
+
applicableProductIds: z.array(z.string()),
|
|
17
|
+
applicableDepartureIds: z.array(z.string()),
|
|
18
|
+
validFrom: z.string().nullable(),
|
|
19
|
+
validTo: z.string().nullable(),
|
|
20
|
+
minPassengers: z.number().int().nullable(),
|
|
21
|
+
imageMobileUrl: z.string().nullable(),
|
|
22
|
+
imageDesktopUrl: z.string().nullable(),
|
|
23
|
+
stackable: z.boolean(),
|
|
24
|
+
createdAt: z.string(),
|
|
25
|
+
updatedAt: z.string(),
|
|
26
|
+
});
|
|
27
|
+
function parseStorefrontMetadata(metadata) {
|
|
28
|
+
if (!metadata) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
const nested = storefrontOfferEnvelopeSchema.safeParse(metadata);
|
|
32
|
+
if (nested.success) {
|
|
33
|
+
return nested.data.storefrontPromotionalOffer;
|
|
34
|
+
}
|
|
35
|
+
const direct = storefrontOfferMetadataSchema.safeParse(metadata);
|
|
36
|
+
if (direct.success) {
|
|
37
|
+
return direct.data;
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
function normalizeDateToIso(value, mode = "start") {
|
|
42
|
+
if (!value) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
if (value instanceof Date) {
|
|
46
|
+
return value.toISOString();
|
|
47
|
+
}
|
|
48
|
+
const trimmed = value.trim();
|
|
49
|
+
if (!trimmed) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(trimmed)) {
|
|
53
|
+
return new Date(`${trimmed}T${mode === "end" ? "23:59:59.999" : "00:00:00.000"}Z`).toISOString();
|
|
54
|
+
}
|
|
55
|
+
const parsed = new Date(trimmed);
|
|
56
|
+
return Number.isNaN(parsed.getTime()) ? null : parsed.toISOString();
|
|
57
|
+
}
|
|
58
|
+
function isOfferActive(now, validFrom, validTo) {
|
|
59
|
+
const from = validFrom ? new Date(validFrom) : null;
|
|
60
|
+
const to = validTo ? new Date(validTo) : null;
|
|
61
|
+
if (from && from > now) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
if (to && to < now) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
function matchesLocale(metadata, locale) {
|
|
70
|
+
if (!locale || !metadata.locale) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
return metadata.locale.toLowerCase() === locale.toLowerCase();
|
|
74
|
+
}
|
|
75
|
+
function matchesApplicability(input) {
|
|
76
|
+
if (!input.applicableProductIds.includes(input.productId)) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
if (!input.departureId) {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
if (input.applicableDepartureIds.length === 0) {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
return input.applicableDepartureIds.includes(input.departureId);
|
|
86
|
+
}
|
|
87
|
+
export async function listStorefrontPromotionalOffers(db, input) {
|
|
88
|
+
const now = input.now ?? new Date();
|
|
89
|
+
const rows = await db
|
|
90
|
+
.select()
|
|
91
|
+
.from(offers)
|
|
92
|
+
.where(eq(offers.status, "published"))
|
|
93
|
+
.orderBy(desc(offers.createdAt));
|
|
94
|
+
if (rows.length === 0) {
|
|
95
|
+
return [];
|
|
96
|
+
}
|
|
97
|
+
const offerIds = rows.map((row) => row.id);
|
|
98
|
+
const itemRows = await db
|
|
99
|
+
.select({ offerId: offerItems.offerId, productId: offerItems.productId })
|
|
100
|
+
.from(offerItems)
|
|
101
|
+
.where(inArray(offerItems.offerId, offerIds));
|
|
102
|
+
const productIdsByOffer = new Map();
|
|
103
|
+
for (const item of itemRows) {
|
|
104
|
+
if (!item.productId) {
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
let set = productIdsByOffer.get(item.offerId);
|
|
108
|
+
if (!set) {
|
|
109
|
+
set = new Set();
|
|
110
|
+
productIdsByOffer.set(item.offerId, set);
|
|
111
|
+
}
|
|
112
|
+
set.add(item.productId);
|
|
113
|
+
}
|
|
114
|
+
return rows
|
|
115
|
+
.map((row) => {
|
|
116
|
+
const metadata = parseStorefrontMetadata(row.metadata);
|
|
117
|
+
if (!metadata?.enabled || !matchesLocale(metadata, input.locale)) {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
const validFrom = normalizeDateToIso(metadata.validFrom ?? row.validFrom, "start");
|
|
121
|
+
const validTo = normalizeDateToIso(metadata.validTo ?? row.validUntil, "end");
|
|
122
|
+
if (!isOfferActive(now, validFrom, validTo)) {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
const applicableProductIds = metadata.applicableProductIds.length
|
|
126
|
+
? metadata.applicableProductIds
|
|
127
|
+
: Array.from(productIdsByOffer.get(row.id) ?? []);
|
|
128
|
+
if (!matchesApplicability({
|
|
129
|
+
productId: input.productId,
|
|
130
|
+
departureId: input.departureId,
|
|
131
|
+
applicableProductIds,
|
|
132
|
+
applicableDepartureIds: metadata.applicableDepartureIds,
|
|
133
|
+
})) {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
return storefrontPromotionalOfferSchema.parse({
|
|
137
|
+
id: row.id,
|
|
138
|
+
name: row.title,
|
|
139
|
+
slug: metadata.slug ?? null,
|
|
140
|
+
description: metadata.description ?? null,
|
|
141
|
+
discountType: metadata.discountType,
|
|
142
|
+
discountValue: metadata.discountValue,
|
|
143
|
+
currency: metadata.currency ?? row.currency ?? null,
|
|
144
|
+
applicableProductIds,
|
|
145
|
+
applicableDepartureIds: metadata.applicableDepartureIds,
|
|
146
|
+
validFrom,
|
|
147
|
+
validTo,
|
|
148
|
+
minPassengers: metadata.minPassengers ?? null,
|
|
149
|
+
imageMobileUrl: metadata.imageMobileUrl ?? null,
|
|
150
|
+
imageDesktopUrl: metadata.imageDesktopUrl ?? null,
|
|
151
|
+
stackable: metadata.stackable,
|
|
152
|
+
createdAt: row.createdAt.toISOString(),
|
|
153
|
+
updatedAt: row.updatedAt.toISOString(),
|
|
154
|
+
});
|
|
155
|
+
})
|
|
156
|
+
.filter((row) => row !== null);
|
|
157
|
+
}
|
|
158
|
+
export async function getStorefrontPromotionalOfferBySlug(db, input) {
|
|
159
|
+
const now = input.now ?? new Date();
|
|
160
|
+
const rows = await db
|
|
161
|
+
.select()
|
|
162
|
+
.from(offers)
|
|
163
|
+
.where(eq(offers.status, "published"))
|
|
164
|
+
.orderBy(desc(offers.createdAt));
|
|
165
|
+
for (const row of rows) {
|
|
166
|
+
const metadata = parseStorefrontMetadata(row.metadata);
|
|
167
|
+
if (!metadata?.enabled || !metadata.slug || !matchesLocale(metadata, input.locale)) {
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
if (metadata.slug !== input.slug) {
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
const validFrom = normalizeDateToIso(metadata.validFrom ?? row.validFrom, "start");
|
|
174
|
+
const validTo = normalizeDateToIso(metadata.validTo ?? row.validUntil, "end");
|
|
175
|
+
if (!isOfferActive(now, validFrom, validTo)) {
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
const productIds = await db
|
|
179
|
+
.select({ productId: offerItems.productId })
|
|
180
|
+
.from(offerItems)
|
|
181
|
+
.where(eq(offerItems.offerId, row.id));
|
|
182
|
+
const applicableProductIds = metadata.applicableProductIds.length
|
|
183
|
+
? metadata.applicableProductIds
|
|
184
|
+
: productIds.map((item) => item.productId).filter((item) => Boolean(item));
|
|
185
|
+
return storefrontPromotionalOfferSchema.parse({
|
|
186
|
+
id: row.id,
|
|
187
|
+
name: row.title,
|
|
188
|
+
slug: metadata.slug,
|
|
189
|
+
description: metadata.description ?? null,
|
|
190
|
+
discountType: metadata.discountType,
|
|
191
|
+
discountValue: metadata.discountValue,
|
|
192
|
+
currency: metadata.currency ?? row.currency ?? null,
|
|
193
|
+
applicableProductIds,
|
|
194
|
+
applicableDepartureIds: metadata.applicableDepartureIds,
|
|
195
|
+
validFrom,
|
|
196
|
+
validTo,
|
|
197
|
+
minPassengers: metadata.minPassengers ?? null,
|
|
198
|
+
imageMobileUrl: metadata.imageMobileUrl ?? null,
|
|
199
|
+
imageDesktopUrl: metadata.imageDesktopUrl ?? null,
|
|
200
|
+
stackable: metadata.stackable,
|
|
201
|
+
createdAt: row.createdAt.toISOString(),
|
|
202
|
+
updatedAt: row.updatedAt.toISOString(),
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
export function createStorefrontPromotionalOffersResolver(db) {
|
|
208
|
+
return {
|
|
209
|
+
listApplicableOffers(input) {
|
|
210
|
+
return listStorefrontPromotionalOffers(db, input);
|
|
211
|
+
},
|
|
212
|
+
getOfferBySlug(input) {
|
|
213
|
+
return getStorefrontPromotionalOfferBySlug(db, input);
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
}
|
package/dist/validation.d.ts
CHANGED
|
@@ -1,4 +1,50 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
export declare const storefrontOfferDiscountTypeSchema: z.ZodEnum<{
|
|
3
|
+
percentage: "percentage";
|
|
4
|
+
fixed_amount: "fixed_amount";
|
|
5
|
+
}>;
|
|
6
|
+
export declare const storefrontOfferMetadataSchema: z.ZodObject<{
|
|
7
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
8
|
+
locale: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
9
|
+
slug: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
10
|
+
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
11
|
+
discountType: z.ZodEnum<{
|
|
12
|
+
percentage: "percentage";
|
|
13
|
+
fixed_amount: "fixed_amount";
|
|
14
|
+
}>;
|
|
15
|
+
discountValue: z.ZodString;
|
|
16
|
+
currency: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
17
|
+
applicableProductIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
18
|
+
applicableDepartureIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
19
|
+
validFrom: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
20
|
+
validTo: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
21
|
+
minPassengers: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
22
|
+
imageMobileUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
23
|
+
imageDesktopUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
24
|
+
stackable: z.ZodDefault<z.ZodBoolean>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
export declare const offerMetadataSchema: z.ZodObject<{
|
|
27
|
+
storefrontPromotionalOffer: z.ZodOptional<z.ZodObject<{
|
|
28
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
29
|
+
locale: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
30
|
+
slug: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
31
|
+
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
32
|
+
discountType: z.ZodEnum<{
|
|
33
|
+
percentage: "percentage";
|
|
34
|
+
fixed_amount: "fixed_amount";
|
|
35
|
+
}>;
|
|
36
|
+
discountValue: z.ZodString;
|
|
37
|
+
currency: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
38
|
+
applicableProductIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
39
|
+
applicableDepartureIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
40
|
+
validFrom: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
41
|
+
validTo: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
42
|
+
minPassengers: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
43
|
+
imageMobileUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
44
|
+
imageDesktopUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
45
|
+
stackable: z.ZodDefault<z.ZodBoolean>;
|
|
46
|
+
}, z.core.$strip>>;
|
|
47
|
+
}, z.core.$catchall<z.ZodUnknown>>;
|
|
2
48
|
export declare const offerStatusSchema: z.ZodEnum<{
|
|
3
49
|
draft: "draft";
|
|
4
50
|
published: "published";
|
|
@@ -9,9 +55,9 @@ export declare const offerStatusSchema: z.ZodEnum<{
|
|
|
9
55
|
converted: "converted";
|
|
10
56
|
}>;
|
|
11
57
|
export declare const orderStatusSchema: z.ZodEnum<{
|
|
58
|
+
pending: "pending";
|
|
12
59
|
draft: "draft";
|
|
13
60
|
expired: "expired";
|
|
14
|
-
pending: "pending";
|
|
15
61
|
confirmed: "confirmed";
|
|
16
62
|
fulfilled: "fulfilled";
|
|
17
63
|
cancelled: "cancelled";
|
|
@@ -68,8 +114,8 @@ export declare const orderTermTypeSchema: z.ZodEnum<{
|
|
|
68
114
|
commission: "commission";
|
|
69
115
|
}>;
|
|
70
116
|
export declare const orderTermAcceptanceStatusSchema: z.ZodEnum<{
|
|
71
|
-
accepted: "accepted";
|
|
72
117
|
pending: "pending";
|
|
118
|
+
accepted: "accepted";
|
|
73
119
|
not_required: "not_required";
|
|
74
120
|
declined: "declined";
|
|
75
121
|
}>;
|
|
@@ -105,7 +151,28 @@ export declare const insertOfferSchema: z.ZodObject<{
|
|
|
105
151
|
acceptedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
106
152
|
convertedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
107
153
|
notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
108
|
-
metadata: z.ZodOptional<z.ZodNullable<z.
|
|
154
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
155
|
+
storefrontPromotionalOffer: z.ZodOptional<z.ZodObject<{
|
|
156
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
157
|
+
locale: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
158
|
+
slug: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
159
|
+
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
160
|
+
discountType: z.ZodEnum<{
|
|
161
|
+
percentage: "percentage";
|
|
162
|
+
fixed_amount: "fixed_amount";
|
|
163
|
+
}>;
|
|
164
|
+
discountValue: z.ZodString;
|
|
165
|
+
currency: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
166
|
+
applicableProductIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
167
|
+
applicableDepartureIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
168
|
+
validFrom: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
169
|
+
validTo: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
170
|
+
minPassengers: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
171
|
+
imageMobileUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
172
|
+
imageDesktopUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
173
|
+
stackable: z.ZodDefault<z.ZodBoolean>;
|
|
174
|
+
}, z.core.$strip>>;
|
|
175
|
+
}, z.core.$catchall<z.ZodUnknown>>>>;
|
|
109
176
|
}, z.core.$strip>;
|
|
110
177
|
export declare const updateOfferSchema: z.ZodObject<{
|
|
111
178
|
offerNumber: z.ZodOptional<z.ZodString>;
|
|
@@ -139,7 +206,28 @@ export declare const updateOfferSchema: z.ZodObject<{
|
|
|
139
206
|
acceptedAt: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
140
207
|
convertedAt: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
141
208
|
notes: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
142
|
-
metadata: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.
|
|
209
|
+
metadata: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
210
|
+
storefrontPromotionalOffer: z.ZodOptional<z.ZodObject<{
|
|
211
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
212
|
+
locale: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
213
|
+
slug: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
214
|
+
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
215
|
+
discountType: z.ZodEnum<{
|
|
216
|
+
percentage: "percentage";
|
|
217
|
+
fixed_amount: "fixed_amount";
|
|
218
|
+
}>;
|
|
219
|
+
discountValue: z.ZodString;
|
|
220
|
+
currency: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
221
|
+
applicableProductIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
222
|
+
applicableDepartureIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
223
|
+
validFrom: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
224
|
+
validTo: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
225
|
+
minPassengers: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
226
|
+
imageMobileUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
227
|
+
imageDesktopUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
228
|
+
stackable: z.ZodDefault<z.ZodBoolean>;
|
|
229
|
+
}, z.core.$strip>>;
|
|
230
|
+
}, z.core.$catchall<z.ZodUnknown>>>>>;
|
|
143
231
|
}, z.core.$strip>;
|
|
144
232
|
export declare const offerListQuerySchema: z.ZodObject<{
|
|
145
233
|
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
@@ -356,9 +444,9 @@ export declare const insertOrderSchema: z.ZodObject<{
|
|
|
356
444
|
offerId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
357
445
|
title: z.ZodString;
|
|
358
446
|
status: z.ZodDefault<z.ZodEnum<{
|
|
447
|
+
pending: "pending";
|
|
359
448
|
draft: "draft";
|
|
360
449
|
expired: "expired";
|
|
361
|
-
pending: "pending";
|
|
362
450
|
confirmed: "confirmed";
|
|
363
451
|
fulfilled: "fulfilled";
|
|
364
452
|
cancelled: "cancelled";
|
|
@@ -389,9 +477,9 @@ export declare const updateOrderSchema: z.ZodObject<{
|
|
|
389
477
|
offerId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
390
478
|
title: z.ZodOptional<z.ZodString>;
|
|
391
479
|
status: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
480
|
+
pending: "pending";
|
|
392
481
|
draft: "draft";
|
|
393
482
|
expired: "expired";
|
|
394
|
-
pending: "pending";
|
|
395
483
|
confirmed: "confirmed";
|
|
396
484
|
fulfilled: "fulfilled";
|
|
397
485
|
cancelled: "cancelled";
|
|
@@ -421,9 +509,9 @@ export declare const orderListQuerySchema: z.ZodObject<{
|
|
|
421
509
|
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
422
510
|
offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
423
511
|
status: z.ZodOptional<z.ZodEnum<{
|
|
512
|
+
pending: "pending";
|
|
424
513
|
draft: "draft";
|
|
425
514
|
expired: "expired";
|
|
426
|
-
pending: "pending";
|
|
427
515
|
confirmed: "confirmed";
|
|
428
516
|
fulfilled: "fulfilled";
|
|
429
517
|
cancelled: "cancelled";
|
|
@@ -648,8 +736,8 @@ export declare const insertOrderTermSchema: z.ZodObject<{
|
|
|
648
736
|
required: z.ZodDefault<z.ZodBoolean>;
|
|
649
737
|
sortOrder: z.ZodDefault<z.ZodNumber>;
|
|
650
738
|
acceptanceStatus: z.ZodDefault<z.ZodEnum<{
|
|
651
|
-
accepted: "accepted";
|
|
652
739
|
pending: "pending";
|
|
740
|
+
accepted: "accepted";
|
|
653
741
|
not_required: "not_required";
|
|
654
742
|
declined: "declined";
|
|
655
743
|
}>>;
|
|
@@ -675,8 +763,8 @@ export declare const updateOrderTermSchema: z.ZodObject<{
|
|
|
675
763
|
required: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
676
764
|
sortOrder: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
677
765
|
acceptanceStatus: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
678
|
-
accepted: "accepted";
|
|
679
766
|
pending: "pending";
|
|
767
|
+
accepted: "accepted";
|
|
680
768
|
not_required: "not_required";
|
|
681
769
|
declined: "declined";
|
|
682
770
|
}>>>;
|
|
@@ -699,8 +787,8 @@ export declare const orderTermListQuerySchema: z.ZodObject<{
|
|
|
699
787
|
commission: "commission";
|
|
700
788
|
}>>;
|
|
701
789
|
acceptanceStatus: z.ZodOptional<z.ZodEnum<{
|
|
702
|
-
accepted: "accepted";
|
|
703
790
|
pending: "pending";
|
|
791
|
+
accepted: "accepted";
|
|
704
792
|
not_required: "not_required";
|
|
705
793
|
declined: "declined";
|
|
706
794
|
}>>;
|
package/dist/validation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAUvB,eAAO,MAAM,iCAAiC;;;EAAyC,CAAA;AAEvF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;iBAgBxC,CAAA;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;kCAIR,CAAA;AAExB,eAAO,MAAM,iBAAiB;;;;;;;;EAQ5B,CAAA;AAEF,eAAO,MAAM,iBAAiB;;;;;;;EAO5B,CAAA;AAEF,eAAO,MAAM,gCAAgC;;;;;;;EAO3C,CAAA;AAEF,eAAO,MAAM,iCA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;;;;;;;;;;;;;;;;;;iBAA4B,CAAA;AAC1D,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;iBAS/B,CAAA;AAEF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAEvC,CAAA;AACF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAkC,CAAA;AAC3E,eAAO,MAAM,+BAA+B;;;;;iBAG1C,CAAA;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAEhC,CAAA;AACF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAgC,CAAA;AAClE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;iBAQnC,CAAA;AAEF,eAAO,MAAM,gCAAgC;;;;;;;;;;;;iBAE3C,CAAA;AACF,eAAO,MAAM,gCAAgC;;;;;;;;;;;iBAAsC,CAAA;AACnF,eAAO,MAAM,mCAAmC;;;;;iBAG9C,CAAA;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAgC,CAAA;AAClE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAgC,CAAA;AAClE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;iBAKnC,CAAA"}
|
package/dist/validation.js
CHANGED
|
@@ -4,6 +4,30 @@ const paginationSchema = z.object({
|
|
|
4
4
|
offset: z.coerce.number().int().min(0).default(0),
|
|
5
5
|
});
|
|
6
6
|
const moneySchema = z.number().int().nullable().optional();
|
|
7
|
+
const metadataRecordSchema = z.record(z.string(), z.unknown());
|
|
8
|
+
export const storefrontOfferDiscountTypeSchema = z.enum(["percentage", "fixed_amount"]);
|
|
9
|
+
export const storefrontOfferMetadataSchema = z.object({
|
|
10
|
+
enabled: z.boolean().default(true),
|
|
11
|
+
locale: z.string().trim().min(2).optional().nullable(),
|
|
12
|
+
slug: z.string().trim().min(1).optional().nullable(),
|
|
13
|
+
description: z.string().trim().min(1).optional().nullable(),
|
|
14
|
+
discountType: storefrontOfferDiscountTypeSchema,
|
|
15
|
+
discountValue: z.string().trim().min(1),
|
|
16
|
+
currency: z.string().trim().length(3).optional().nullable(),
|
|
17
|
+
applicableProductIds: z.array(z.string()).default([]),
|
|
18
|
+
applicableDepartureIds: z.array(z.string()).default([]),
|
|
19
|
+
validFrom: z.string().optional().nullable(),
|
|
20
|
+
validTo: z.string().optional().nullable(),
|
|
21
|
+
minPassengers: z.number().int().min(1).optional().nullable(),
|
|
22
|
+
imageMobileUrl: z.string().trim().min(1).optional().nullable(),
|
|
23
|
+
imageDesktopUrl: z.string().trim().min(1).optional().nullable(),
|
|
24
|
+
stackable: z.boolean().default(false),
|
|
25
|
+
});
|
|
26
|
+
export const offerMetadataSchema = z
|
|
27
|
+
.object({
|
|
28
|
+
storefrontPromotionalOffer: storefrontOfferMetadataSchema.optional(),
|
|
29
|
+
})
|
|
30
|
+
.catchall(z.unknown());
|
|
7
31
|
export const offerStatusSchema = z.enum([
|
|
8
32
|
"draft",
|
|
9
33
|
"published",
|
|
@@ -102,7 +126,7 @@ const offerCoreSchema = z.object({
|
|
|
102
126
|
acceptedAt: z.string().nullable().optional(),
|
|
103
127
|
convertedAt: z.string().nullable().optional(),
|
|
104
128
|
notes: z.string().nullable().optional(),
|
|
105
|
-
metadata:
|
|
129
|
+
metadata: offerMetadataSchema.nullable().optional(),
|
|
106
130
|
});
|
|
107
131
|
const participantCoreSchema = z.object({
|
|
108
132
|
personId: z.string().nullable().optional(),
|
|
@@ -188,7 +212,7 @@ const orderTermCoreSchema = z.object({
|
|
|
188
212
|
acceptanceStatus: orderTermAcceptanceStatusSchema.default("pending"),
|
|
189
213
|
acceptedAt: z.string().nullable().optional(),
|
|
190
214
|
acceptedBy: z.string().max(255).nullable().optional(),
|
|
191
|
-
metadata:
|
|
215
|
+
metadata: metadataRecordSchema.nullable().optional(),
|
|
192
216
|
});
|
|
193
217
|
const orderTermRequiredParentSchema = orderTermCoreSchema.refine((value) => Boolean(value.offerId || value.orderId), {
|
|
194
218
|
message: "offerId or orderId is required",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyantjs/transactions",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"license": "FSL-1.1-Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"drizzle-orm": "^0.45.2",
|
|
30
30
|
"hono": "^4.12.10",
|
|
31
31
|
"zod": "^4.3.6",
|
|
32
|
-
"@voyantjs/core": "0.
|
|
33
|
-
"@voyantjs/db": "0.
|
|
34
|
-
"@voyantjs/hono": "0.
|
|
35
|
-
"@voyantjs/utils": "0.
|
|
32
|
+
"@voyantjs/core": "0.4.1",
|
|
33
|
+
"@voyantjs/db": "0.4.1",
|
|
34
|
+
"@voyantjs/hono": "0.4.1",
|
|
35
|
+
"@voyantjs/utils": "0.4.1"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"typescript": "^6.0.2",
|