@voyantjs/finance 0.76.0 → 0.77.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/document-download.d.ts +2 -21
- package/dist/document-download.d.ts.map +1 -1
- package/dist/document-download.js +1 -48
- package/dist/routes.d.ts +2 -0
- package/dist/routes.d.ts.map +1 -1
- package/dist/service-booking-create.d.ts +8 -0
- package/dist/service-booking-create.d.ts.map +1 -1
- package/dist/service-booking-create.js +10 -0
- package/dist/service-bookings-dual-create.d.ts +2 -0
- package/dist/service-bookings-dual-create.d.ts.map +1 -1
- package/package.json +9 -9
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
expiresAt: string | null;
|
|
4
|
-
}
|
|
5
|
-
export type DocumentDownloadResolution = {
|
|
6
|
-
status: "ready";
|
|
7
|
-
download: DocumentDownloadEnvelope;
|
|
8
|
-
} | {
|
|
9
|
-
status: "resolver_not_configured";
|
|
10
|
-
} | {
|
|
11
|
-
status: "not_available";
|
|
12
|
-
};
|
|
13
|
-
export type DocumentDownloadResolver = (bindings: unknown, storageKey: string) => Promise<string | null> | string | null;
|
|
14
|
-
export interface StoredDocumentReference {
|
|
15
|
-
storageKey?: string | null;
|
|
16
|
-
metadata?: unknown;
|
|
17
|
-
}
|
|
18
|
-
export declare function resolveStoredDocumentDownload(reference: StoredDocumentReference, options: {
|
|
19
|
-
bindings: unknown;
|
|
20
|
-
resolveDocumentDownloadUrl?: DocumentDownloadResolver;
|
|
21
|
-
}): Promise<DocumentDownloadResolution>;
|
|
1
|
+
export type { DocumentDownloadEnvelope, DocumentDownloadResolution, DocumentDownloadResolver, DocumentDownloadResolverResult, StoredDocumentReference, } from "@voyantjs/hono/document-download";
|
|
2
|
+
export { resolveStoredDocumentDownload } from "@voyantjs/hono/document-download";
|
|
22
3
|
//# sourceMappingURL=document-download.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-download.d.ts","sourceRoot":"","sources":["../src/document-download.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"document-download.d.ts","sourceRoot":"","sources":["../src/document-download.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EACxB,8BAA8B,EAC9B,uBAAuB,GACxB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAA"}
|
|
@@ -1,48 +1 @@
|
|
|
1
|
-
|
|
2
|
-
if (!metadata || typeof metadata !== "object" || Array.isArray(metadata)) {
|
|
3
|
-
return null;
|
|
4
|
-
}
|
|
5
|
-
return metadata;
|
|
6
|
-
}
|
|
7
|
-
function maybeUrl(value) {
|
|
8
|
-
return typeof value === "string" && /^https?:\/\//i.test(value) ? value : null;
|
|
9
|
-
}
|
|
10
|
-
function maybeIsoString(value) {
|
|
11
|
-
return typeof value === "string" && value.length > 0 ? value : null;
|
|
12
|
-
}
|
|
13
|
-
function getFallbackDownload(metadata) {
|
|
14
|
-
const record = getMetadataRecord(metadata);
|
|
15
|
-
if (!record) {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
const url = maybeUrl(record.url) ?? maybeUrl(record.downloadUrl);
|
|
19
|
-
if (!url) {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
return {
|
|
23
|
-
url,
|
|
24
|
-
expiresAt: maybeIsoString(record.expiresAt) ?? maybeIsoString(record.expires_at),
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
export async function resolveStoredDocumentDownload(reference, options) {
|
|
28
|
-
let needsResolver = false;
|
|
29
|
-
if (reference.storageKey) {
|
|
30
|
-
if (!options.resolveDocumentDownloadUrl) {
|
|
31
|
-
needsResolver = true;
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
const url = await options.resolveDocumentDownloadUrl(options.bindings, reference.storageKey);
|
|
35
|
-
if (url) {
|
|
36
|
-
return { status: "ready", download: { url, expiresAt: null } };
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
const fallback = getFallbackDownload(reference.metadata);
|
|
41
|
-
if (fallback) {
|
|
42
|
-
return { status: "ready", download: fallback };
|
|
43
|
-
}
|
|
44
|
-
if (needsResolver) {
|
|
45
|
-
return { status: "resolver_not_configured" };
|
|
46
|
-
}
|
|
47
|
-
return { status: "not_available" };
|
|
48
|
-
}
|
|
1
|
+
export { resolveStoredDocumentDownload } from "@voyantjs/hono/document-download";
|
package/dist/routes.d.ts
CHANGED
|
@@ -2557,6 +2557,7 @@ export declare const financeRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
2557
2557
|
download: {
|
|
2558
2558
|
url: string;
|
|
2559
2559
|
expiresAt: string | null;
|
|
2560
|
+
filename: string | null;
|
|
2560
2561
|
};
|
|
2561
2562
|
invoice: {
|
|
2562
2563
|
id: string;
|
|
@@ -4609,6 +4610,7 @@ export declare const financeRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
4609
4610
|
download: {
|
|
4610
4611
|
url: string;
|
|
4611
4612
|
expiresAt: string | null;
|
|
4613
|
+
filename: string | null;
|
|
4612
4614
|
};
|
|
4613
4615
|
rendition: {
|
|
4614
4616
|
format: "json" | "html" | "pdf" | "xml";
|
package/dist/routes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAC7D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAA;AAuJ7C,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAC7D,O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,GAAG,OAAO,aAAa,CAAA;AAChD,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAA"}
|
|
@@ -35,6 +35,7 @@ export declare const bookingCreateSchema: z.ZodObject<{
|
|
|
35
35
|
bookingNumber: z.ZodString;
|
|
36
36
|
personId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
37
37
|
organizationId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
38
|
+
pax: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
38
39
|
internalNotes: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
39
40
|
sellAmountCentsOverride: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
40
41
|
catalogSellAmountCents: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
@@ -157,6 +158,7 @@ export declare const bookingCreateSubSchema: z.ZodObject<{
|
|
|
157
158
|
personId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
158
159
|
productId: z.ZodString;
|
|
159
160
|
optionId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
161
|
+
pax: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
160
162
|
bookingNumber: z.ZodString;
|
|
161
163
|
contactFirstName: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
162
164
|
contactLastName: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
@@ -332,6 +334,12 @@ export type BookingCreateOutcome = {
|
|
|
332
334
|
status: "booking_already_in_group";
|
|
333
335
|
currentGroupId: string;
|
|
334
336
|
};
|
|
337
|
+
export declare function deriveBookingCreatePax(input: {
|
|
338
|
+
pax?: number | null;
|
|
339
|
+
travelers?: readonly {
|
|
340
|
+
participantType?: string | null;
|
|
341
|
+
}[] | null;
|
|
342
|
+
}): number | null;
|
|
335
343
|
export declare function createBooking(db: PostgresJsDatabase, rawInput: BookingCreateInput, options?: {
|
|
336
344
|
userId?: string;
|
|
337
345
|
runtime?: BookingCreateRuntime;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-booking-create.d.ts","sourceRoot":"","sources":["../src/service-booking-create.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAG7F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,KAAK,EACV,sBAAsB,EACtB,OAAO,EACP,OAAO,EACP,OAAO,EACP,iBAAiB,EAClB,MAAM,aAAa,CAAA;AAGpB,OAAO,EAA2B,KAAK,wBAAwB,EAAE,MAAM,wBAAwB,CAAA;AAU/F,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;iBAoBvB,CAAA;
|
|
1
|
+
{"version":3,"file":"service-booking-create.d.ts","sourceRoot":"","sources":["../src/service-booking-create.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAG7F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,KAAK,EACV,sBAAsB,EACtB,OAAO,EACP,OAAO,EACP,OAAO,EACP,iBAAiB,EAClB,MAAM,aAAa,CAAA;AAGpB,OAAO,EAA2B,KAAK,wBAAwB,EAAE,MAAM,wBAAwB,CAAA;AAU/F,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;iBAoBvB,CAAA;AAyPF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAI,CAAA;CAClE,iBAWA;AAED,wBAAsB,aAAa,CACjC,EAAE,EAAE,kBAAkB,EACtB,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,GAAE;IACP,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,oBAAoB,CAAA;CAC1B,GACL,OAAO,CAAC,oBAAoB,CAAC,CAuX/B"}
|
|
@@ -184,6 +184,7 @@ const bookingCreateBaseSchema = z.object({
|
|
|
184
184
|
bookingNumber: z.string().min(1),
|
|
185
185
|
personId: z.string().optional().nullable(),
|
|
186
186
|
organizationId: z.string().optional().nullable(),
|
|
187
|
+
pax: z.number().int().positive().optional().nullable(),
|
|
187
188
|
internalNotes: z.string().optional().nullable(),
|
|
188
189
|
/**
|
|
189
190
|
* Override the seed `sellAmountCents` on the new booking + line item.
|
|
@@ -309,6 +310,13 @@ function generateInvoiceNumber(bookingNumber) {
|
|
|
309
310
|
function todayIsoDate() {
|
|
310
311
|
return new Date().toISOString().slice(0, 10);
|
|
311
312
|
}
|
|
313
|
+
export function deriveBookingCreatePax(input) {
|
|
314
|
+
if (Object.hasOwn(input, "pax")) {
|
|
315
|
+
return input.pax ?? null;
|
|
316
|
+
}
|
|
317
|
+
const pax = input.travelers?.filter((traveler) => [undefined, null, "traveler", "occupant"].includes(traveler.participantType)).length ?? 0;
|
|
318
|
+
return pax > 0 ? pax : null;
|
|
319
|
+
}
|
|
312
320
|
export async function createBooking(db, rawInput, options = {}) {
|
|
313
321
|
const { userId, runtime } = options;
|
|
314
322
|
// Parse through the schema so defaults (makeBookingPrimary, role,
|
|
@@ -319,6 +327,7 @@ export async function createBooking(db, rawInput, options = {}) {
|
|
|
319
327
|
contractDocument: false,
|
|
320
328
|
invoiceDocument: false,
|
|
321
329
|
};
|
|
330
|
+
const pax = deriveBookingCreatePax(input);
|
|
322
331
|
// Validate voucher up-front so we can short-circuit before the tx starts.
|
|
323
332
|
// This is a cheap read — the authoritative balance check still happens
|
|
324
333
|
// inside the redeem savepoint so two concurrent redemptions can't double-
|
|
@@ -354,6 +363,7 @@ export async function createBooking(db, rawInput, options = {}) {
|
|
|
354
363
|
bookingNumber: input.bookingNumber,
|
|
355
364
|
personId: input.personId ?? null,
|
|
356
365
|
organizationId: input.organizationId ?? null,
|
|
366
|
+
pax,
|
|
357
367
|
internalNotes: input.internalNotes ?? null,
|
|
358
368
|
sellAmountCentsOverride: input.sellAmountCentsOverride ?? null,
|
|
359
369
|
catalogSellAmountCents: input.catalogSellAmountCents ?? null,
|
|
@@ -9,6 +9,7 @@ export declare const dualCreateBookingSchema: z.ZodObject<{
|
|
|
9
9
|
personId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
10
10
|
productId: z.ZodString;
|
|
11
11
|
optionId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
12
|
+
pax: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
12
13
|
bookingNumber: z.ZodString;
|
|
13
14
|
contactFirstName: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
14
15
|
contactLastName: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
@@ -116,6 +117,7 @@ export declare const dualCreateBookingSchema: z.ZodObject<{
|
|
|
116
117
|
personId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
117
118
|
productId: z.ZodString;
|
|
118
119
|
optionId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
120
|
+
pax: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
119
121
|
bookingNumber: z.ZodString;
|
|
120
122
|
contactFirstName: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
121
123
|
contactLastName: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-bookings-dual-create.d.ts","sourceRoot":"","sources":["../src/service-bookings-dual-create.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAA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BAAgB,EAAE,MAAM,CAAA;IACxB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,SAAS,EAAE,MAAM,CAAA;IACjB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,UAAU,EAAE,IAAI,CAAA;CACjB;AAID,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,mBAAmB,CAAA;IAC5B,SAAS,EAAE,mBAAmB,CAAA;IAC9B,KAAK,EAAE,YAAY,CAAA;IACnB,aAAa,EAAE,kBAAkB,CAAA;IACjC,eAAe,EAAE,kBAAkB,CAAA;CACpC;AAED,MAAM,MAAM,wBAAwB,GAChC;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,uBAAuB,CAAA;CAAE,GACjD;IACE,MAAM,EAAE,gBAAgB,GAAG,kBAAkB,CAAA;IAC7C,MAAM,EAAE,OAAO,CAAC,oBAAoB,EAAE;QAAE,MAAM,EAAE,IAAI,CAAA;KAAE,CAAC,CAAA;CACxD,CAAA;AAqBL;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,iBAAiB,CACrC,EAAE,EAAE,kBAAkB,EACtB,QAAQ,EAAE,sBAAsB,EAChC,OAAO,GAAE;IACP,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,wBAAwB,CAAA;CAC9B,GACL,OAAO,CAAC,wBAAwB,CAAC,CAkFnC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyantjs/finance",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.77.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -59,14 +59,14 @@
|
|
|
59
59
|
"drizzle-orm": "^0.45.2",
|
|
60
60
|
"hono": "^4.12.10",
|
|
61
61
|
"zod": "^4.3.6",
|
|
62
|
-
"@voyantjs/action-ledger": "0.
|
|
63
|
-
"@voyantjs/bookings": "0.
|
|
64
|
-
"@voyantjs/core": "0.
|
|
65
|
-
"@voyantjs/db": "0.
|
|
66
|
-
"@voyantjs/hono": "0.
|
|
67
|
-
"@voyantjs/products": "0.
|
|
68
|
-
"@voyantjs/utils": "0.
|
|
69
|
-
"@voyantjs/storage": "0.
|
|
62
|
+
"@voyantjs/action-ledger": "0.77.1",
|
|
63
|
+
"@voyantjs/bookings": "0.77.1",
|
|
64
|
+
"@voyantjs/core": "0.77.1",
|
|
65
|
+
"@voyantjs/db": "0.77.1",
|
|
66
|
+
"@voyantjs/hono": "0.77.1",
|
|
67
|
+
"@voyantjs/products": "0.77.1",
|
|
68
|
+
"@voyantjs/utils": "0.77.1",
|
|
69
|
+
"@voyantjs/storage": "0.77.1"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"typescript": "^6.0.2",
|