@voyantjs/transactions 0.4.5 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/booking-extension.d.ts +2 -2
- package/dist/booking-extension.d.ts.map +1 -1
- package/dist/booking-extension.js +2 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -4
- package/dist/route-runtime.d.ts +8 -0
- package/dist/route-runtime.d.ts.map +1 -0
- package/dist/route-runtime.js +17 -0
- package/dist/routes-offers.d.ts +21 -140
- package/dist/routes-offers.d.ts.map +1 -1
- package/dist/routes-offers.js +14 -13
- package/dist/routes-orders.d.ts +26 -145
- package/dist/routes-orders.d.ts.map +1 -1
- package/dist/routes-orders.js +17 -16
- package/dist/routes-shared.d.ts +23 -46
- package/dist/routes-shared.d.ts.map +1 -1
- package/dist/routes-shared.js +20 -12
- package/dist/schema-audit.d.ts +1 -1
- package/dist/schema-offers.d.ts +1 -1
- package/dist/schema-orders.d.ts +1 -1
- package/dist/service-offers.d.ts +21 -21
- package/dist/service-orders.d.ts +17 -17
- package/dist/validation.d.ts +5 -5
- package/package.json +5 -5
|
@@ -108,11 +108,11 @@ export declare const bookingTransactionExtensionService: {
|
|
|
108
108
|
updatedAt: Date;
|
|
109
109
|
} | null>;
|
|
110
110
|
upsert(db: PostgresJsDatabase, bookingId: string, data: z.infer<typeof bookingTransactionDetailSchema>): Promise<{
|
|
111
|
+
createdAt: Date;
|
|
112
|
+
updatedAt: Date;
|
|
111
113
|
bookingId: string;
|
|
112
114
|
offerId: string | null;
|
|
113
115
|
orderId: string | null;
|
|
114
|
-
createdAt: Date;
|
|
115
|
-
updatedAt: Date;
|
|
116
116
|
} | null>;
|
|
117
117
|
remove(db: PostgresJsDatabase, bookingId: string): Promise<{
|
|
118
118
|
bookingId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"booking-extension.d.ts","sourceRoot":"","sources":["../src/booking-extension.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"booking-extension.d.ts","sourceRoot":"","sources":["../src/booking-extension.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAG1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAEjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUrC,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG,OAAO,yBAAyB,CAAC,YAAY,CAAA;AACpF,MAAM,MAAM,2BAA2B,GAAG,OAAO,yBAAyB,CAAC,YAAY,CAAA;AAIvF,QAAA,MAAM,8BAA8B;;;iBAGlC,CAAA;AAIF,eAAO,MAAM,kCAAkC;YAC/B,kBAAkB,aAAa,MAAM;;;;;;;eAU7C,kBAAkB,aACX,MAAM,QACX,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC;;;;;;;eAqBrC,kBAAkB,aAAa,MAAM;;;CAOvD,CAAA;AAiDD,eAAO,MAAM,4BAA4B,EAAE,aAG1C,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { parseJsonBody } from "@voyantjs/hono";
|
|
1
2
|
import { eq } from "drizzle-orm";
|
|
2
3
|
import { index, pgTable, text, timestamp } from "drizzle-orm/pg-core";
|
|
3
4
|
import { Hono } from "hono";
|
|
@@ -61,7 +62,7 @@ const bookingTransactionExtensionRoutes = new Hono()
|
|
|
61
62
|
return c.json({ data: row });
|
|
62
63
|
})
|
|
63
64
|
.put("/:bookingId/transaction-details", async (c) => {
|
|
64
|
-
const data =
|
|
65
|
+
const data = await parseJsonBody(c, bookingTransactionDetailSchema);
|
|
65
66
|
const row = await bookingTransactionExtensionService.upsert(c.get("db"), c.req.param("bookingId"), data);
|
|
66
67
|
return c.json({ data: row });
|
|
67
68
|
})
|
package/dist/index.d.ts
CHANGED
|
@@ -10,8 +10,11 @@ export declare const transactionsLinkable: {
|
|
|
10
10
|
offer: LinkableDefinition;
|
|
11
11
|
};
|
|
12
12
|
export declare const transactionsModule: Module;
|
|
13
|
+
export declare function createTransactionsHonoModule(): HonoModule;
|
|
13
14
|
export declare const transactionsHonoModule: HonoModule;
|
|
14
15
|
export { transactionsBookingExtension } from "./booking-extension.js";
|
|
16
|
+
export type { TransactionsRouteRuntime } from "./route-runtime.js";
|
|
17
|
+
export { buildTransactionsRouteRuntime, TRANSACTIONS_ROUTE_RUNTIME_CONTAINER_KEY, } from "./route-runtime.js";
|
|
15
18
|
export type { DecryptedTransactionParticipantIdentity, TransactionParticipantIdentity, TransactionParticipantIdentityEnvelope, } from "./schema/participant-identity.js";
|
|
16
19
|
export { decryptedTransactionParticipantIdentitySchema, transactionParticipantIdentityEnvelopeSchema, transactionParticipantIdentitySchema, } from "./schema/participant-identity.js";
|
|
17
20
|
export type { NewOffer, NewOfferItem, NewOfferItemParticipant, NewOfferParticipant, NewOrder, NewOrderItem, NewOrderItemParticipant, NewOrderParticipant, NewOrderTerm, Offer, OfferItem, OfferItemParticipant, OfferParticipant, Order, OrderItem, OrderItemParticipant, OrderParticipant, OrderTerm, } from "./schema.js";
|
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,UAAU,CAAA;
|
|
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,UAAU,CAAA;AAOjB,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAElD,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAErD,eAAO,MAAM,aAAa,EAAE,kBAK3B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,kBAK3B,CAAA;AAED,eAAO,MAAM,oBAAoB;;;CAGhC,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,MAGhC,CAAA;AAED,wBAAgB,4BAA4B,IAAI,UAAU,CAezD;AAED,eAAO,MAAM,sBAAsB,EAAE,UAA2C,CAAA;AAEhF,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAA;AACrE,YAAY,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAA;AAClE,OAAO,EACL,6BAA6B,EAC7B,wCAAwC,GACzC,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EACV,uCAAuC,EACvC,8BAA8B,EAC9B,sCAAsC,GACvC,MAAM,kCAAkC,CAAA;AACzC,OAAO,EACL,6CAA6C,EAC7C,4CAA4C,EAC5C,oCAAoC,GACrC,MAAM,kCAAkC,CAAA;AACzC,YAAY,EACV,QAAQ,EACR,YAAY,EACZ,uBAAuB,EACvB,mBAAmB,EACnB,QAAQ,EACR,YAAY,EACZ,uBAAuB,EACvB,mBAAmB,EACnB,YAAY,EACZ,KAAK,EACL,SAAS,EACT,oBAAoB,EACpB,gBAAgB,EAChB,KAAK,EACL,SAAS,EACT,oBAAoB,EACpB,gBAAgB,EAChB,SAAS,GACV,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,qBAAqB,EACrB,UAAU,EACV,iBAAiB,EACjB,eAAe,EACf,MAAM,EACN,qBAAqB,EACrB,UAAU,EACV,iBAAiB,EACjB,eAAe,EACf,MAAM,EACN,6BAA6B,EAC7B,UAAU,EACV,iBAAiB,EACjB,kCAAkC,EAClC,yBAAyB,EACzB,uBAAuB,EACvB,8BAA8B,EAC9B,8BAA8B,EAC9B,uBAAuB,EACvB,+BAA+B,EAC/B,+BAA+B,GAChC,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,yCAAyC,EACzC,mCAAmC,EACnC,+BAA+B,EAC/B,6BAA6B,EAC7B,gCAAgC,GACjC,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACL,gCAAgC,EAChC,qBAAqB,EACrB,4BAA4B,EAC5B,iBAAiB,EACjB,gCAAgC,EAChC,qBAAqB,EACrB,4BAA4B,EAC5B,iBAAiB,EACjB,qBAAqB,EACrB,wBAAwB,EACxB,mCAAmC,EACnC,oBAAoB,EACpB,mBAAmB,EACnB,+BAA+B,EAC/B,iBAAiB,EACjB,wBAAwB,EACxB,mCAAmC,EACnC,oBAAoB,EACpB,+BAA+B,EAC/B,iBAAiB,EACjB,+BAA+B,EAC/B,wBAAwB,EACxB,mBAAmB,EACnB,iCAAiC,EACjC,6BAA6B,EAC7B,oCAAoC,EACpC,2BAA2B,EAC3B,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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { createTransactionPiiService, } from "./pii.js";
|
|
2
|
+
import { buildTransactionsRouteRuntime, TRANSACTIONS_ROUTE_RUNTIME_CONTAINER_KEY, } from "./route-runtime.js";
|
|
2
3
|
import { transactionsRoutes } from "./routes.js";
|
|
3
4
|
import { transactionsService } from "./service.js";
|
|
4
5
|
export const orderLinkable = {
|
|
@@ -21,11 +22,21 @@ export const transactionsModule = {
|
|
|
21
22
|
name: "transactions",
|
|
22
23
|
linkable: transactionsLinkable,
|
|
23
24
|
};
|
|
24
|
-
export
|
|
25
|
-
module
|
|
26
|
-
|
|
27
|
-
}
|
|
25
|
+
export function createTransactionsHonoModule() {
|
|
26
|
+
const module = {
|
|
27
|
+
...transactionsModule,
|
|
28
|
+
bootstrap: ({ bindings, container }) => {
|
|
29
|
+
container.register(TRANSACTIONS_ROUTE_RUNTIME_CONTAINER_KEY, buildTransactionsRouteRuntime(bindings));
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
return {
|
|
33
|
+
module,
|
|
34
|
+
routes: transactionsRoutes,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export const transactionsHonoModule = createTransactionsHonoModule();
|
|
28
38
|
export { transactionsBookingExtension } from "./booking-extension.js";
|
|
39
|
+
export { buildTransactionsRouteRuntime, TRANSACTIONS_ROUTE_RUNTIME_CONTAINER_KEY, } from "./route-runtime.js";
|
|
29
40
|
export { decryptedTransactionParticipantIdentitySchema, transactionParticipantIdentityEnvelopeSchema, transactionParticipantIdentitySchema, } from "./schema/participant-identity.js";
|
|
30
41
|
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
42
|
export { createStorefrontPromotionalOffersResolver, getStorefrontPromotionalOfferBySlug, listStorefrontPromotionalOffers, storefrontOfferEnvelopeSchema, storefrontPromotionalOfferSchema, } from "./storefront-offers.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type KmsProvider } from "@voyantjs/utils";
|
|
2
|
+
import type { KmsBindings } from "./routes-shared.js";
|
|
3
|
+
export declare const TRANSACTIONS_ROUTE_RUNTIME_CONTAINER_KEY = "runtime.transactions.routes";
|
|
4
|
+
export interface TransactionsRouteRuntime {
|
|
5
|
+
getKmsProvider(): KmsProvider;
|
|
6
|
+
}
|
|
7
|
+
export declare function buildTransactionsRouteRuntime(bindings: KmsBindings): TransactionsRouteRuntime;
|
|
8
|
+
//# sourceMappingURL=route-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-runtime.d.ts","sourceRoot":"","sources":["../src/route-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAErD,eAAO,MAAM,wCAAwC,gCAAgC,CAAA;AAErF,MAAM,WAAW,wBAAwB;IACvC,cAAc,IAAI,WAAW,CAAA;CAC9B;AAgBD,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,WAAW,GAAG,wBAAwB,CAQ7F"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createKmsProviderFromEnv } from "@voyantjs/utils";
|
|
2
|
+
export const TRANSACTIONS_ROUTE_RUNTIME_CONTAINER_KEY = "runtime.transactions.routes";
|
|
3
|
+
function buildRuntimeEnv(bindings) {
|
|
4
|
+
const processEnv = globalThis.process?.env ?? {};
|
|
5
|
+
return {
|
|
6
|
+
...processEnv,
|
|
7
|
+
...(bindings ?? {}),
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export function buildTransactionsRouteRuntime(bindings) {
|
|
11
|
+
const runtimeEnv = buildRuntimeEnv(bindings);
|
|
12
|
+
return {
|
|
13
|
+
getKmsProvider() {
|
|
14
|
+
return createKmsProviderFromEnv(runtimeEnv);
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
}
|
package/dist/routes-offers.d.ts
CHANGED
|
@@ -47,16 +47,16 @@ export declare const transactionOfferRoutes: import("hono/hono-base").HonoBase<E
|
|
|
47
47
|
input: {};
|
|
48
48
|
output: {
|
|
49
49
|
data: {
|
|
50
|
+
metadata: import("hono/utils/types").JSONValue;
|
|
51
|
+
id: string;
|
|
50
52
|
createdAt: string;
|
|
51
53
|
updatedAt: string;
|
|
52
|
-
id: string;
|
|
53
|
-
metadata: import("hono/utils/types").JSONValue;
|
|
54
54
|
organizationId: string | null;
|
|
55
55
|
status: "draft" | "published" | "sent" | "accepted" | "expired" | "withdrawn" | "converted";
|
|
56
56
|
currency: string;
|
|
57
57
|
notes: string | null;
|
|
58
|
-
offerNumber: string;
|
|
59
58
|
title: string;
|
|
59
|
+
offerNumber: string;
|
|
60
60
|
personId: string | null;
|
|
61
61
|
opportunityId: string | null;
|
|
62
62
|
quoteId: string | null;
|
|
@@ -363,51 +363,9 @@ export declare const transactionOfferRoutes: import("hono/hono-base").HonoBase<E
|
|
|
363
363
|
id: string;
|
|
364
364
|
};
|
|
365
365
|
};
|
|
366
|
-
output: {
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
outputFormat: "json";
|
|
370
|
-
status: 404;
|
|
371
|
-
} | {
|
|
372
|
-
input: {
|
|
373
|
-
param: {
|
|
374
|
-
id: string;
|
|
375
|
-
};
|
|
376
|
-
};
|
|
377
|
-
output: {
|
|
378
|
-
error: string;
|
|
379
|
-
};
|
|
380
|
-
outputFormat: "json";
|
|
381
|
-
status: 401;
|
|
382
|
-
} | {
|
|
383
|
-
input: {
|
|
384
|
-
param: {
|
|
385
|
-
id: string;
|
|
386
|
-
};
|
|
387
|
-
};
|
|
388
|
-
output: {
|
|
389
|
-
error: string;
|
|
390
|
-
};
|
|
391
|
-
outputFormat: "json";
|
|
392
|
-
status: 403;
|
|
393
|
-
} | {
|
|
394
|
-
input: {
|
|
395
|
-
param: {
|
|
396
|
-
id: string;
|
|
397
|
-
};
|
|
398
|
-
};
|
|
399
|
-
output: {
|
|
400
|
-
data: {
|
|
401
|
-
participantId: string;
|
|
402
|
-
participantKind: "offer" | "order";
|
|
403
|
-
dateOfBirth: string | null;
|
|
404
|
-
nationality: string | null;
|
|
405
|
-
createdAt: string;
|
|
406
|
-
updatedAt: string;
|
|
407
|
-
};
|
|
408
|
-
};
|
|
409
|
-
outputFormat: "json";
|
|
410
|
-
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
366
|
+
output: {};
|
|
367
|
+
outputFormat: string;
|
|
368
|
+
status: import("hono/utils/http-status").StatusCode;
|
|
411
369
|
};
|
|
412
370
|
};
|
|
413
371
|
} & {
|
|
@@ -418,51 +376,9 @@ export declare const transactionOfferRoutes: import("hono/hono-base").HonoBase<E
|
|
|
418
376
|
id: string;
|
|
419
377
|
};
|
|
420
378
|
};
|
|
421
|
-
output: {
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
outputFormat: "json";
|
|
425
|
-
status: 404;
|
|
426
|
-
} | {
|
|
427
|
-
input: {
|
|
428
|
-
param: {
|
|
429
|
-
id: string;
|
|
430
|
-
};
|
|
431
|
-
};
|
|
432
|
-
output: {
|
|
433
|
-
error: string;
|
|
434
|
-
};
|
|
435
|
-
outputFormat: "json";
|
|
436
|
-
status: 401;
|
|
437
|
-
} | {
|
|
438
|
-
input: {
|
|
439
|
-
param: {
|
|
440
|
-
id: string;
|
|
441
|
-
};
|
|
442
|
-
};
|
|
443
|
-
output: {
|
|
444
|
-
error: string;
|
|
445
|
-
};
|
|
446
|
-
outputFormat: "json";
|
|
447
|
-
status: 403;
|
|
448
|
-
} | {
|
|
449
|
-
input: {
|
|
450
|
-
param: {
|
|
451
|
-
id: string;
|
|
452
|
-
};
|
|
453
|
-
};
|
|
454
|
-
output: {
|
|
455
|
-
data: {
|
|
456
|
-
participantId: string;
|
|
457
|
-
participantKind: "offer" | "order";
|
|
458
|
-
dateOfBirth: string | null;
|
|
459
|
-
nationality: string | null;
|
|
460
|
-
createdAt: string;
|
|
461
|
-
updatedAt: string;
|
|
462
|
-
};
|
|
463
|
-
};
|
|
464
|
-
outputFormat: "json";
|
|
465
|
-
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
379
|
+
output: {};
|
|
380
|
+
outputFormat: string;
|
|
381
|
+
status: import("hono/utils/http-status").StatusCode;
|
|
466
382
|
};
|
|
467
383
|
};
|
|
468
384
|
} & {
|
|
@@ -473,44 +389,9 @@ export declare const transactionOfferRoutes: import("hono/hono-base").HonoBase<E
|
|
|
473
389
|
id: string;
|
|
474
390
|
};
|
|
475
391
|
};
|
|
476
|
-
output: {
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
outputFormat: "json";
|
|
480
|
-
status: 404;
|
|
481
|
-
} | {
|
|
482
|
-
input: {
|
|
483
|
-
param: {
|
|
484
|
-
id: string;
|
|
485
|
-
};
|
|
486
|
-
};
|
|
487
|
-
output: {
|
|
488
|
-
error: string;
|
|
489
|
-
};
|
|
490
|
-
outputFormat: "json";
|
|
491
|
-
status: 401;
|
|
492
|
-
} | {
|
|
493
|
-
input: {
|
|
494
|
-
param: {
|
|
495
|
-
id: string;
|
|
496
|
-
};
|
|
497
|
-
};
|
|
498
|
-
output: {
|
|
499
|
-
error: string;
|
|
500
|
-
};
|
|
501
|
-
outputFormat: "json";
|
|
502
|
-
status: 403;
|
|
503
|
-
} | {
|
|
504
|
-
input: {
|
|
505
|
-
param: {
|
|
506
|
-
id: string;
|
|
507
|
-
};
|
|
508
|
-
};
|
|
509
|
-
output: {
|
|
510
|
-
success: true;
|
|
511
|
-
};
|
|
512
|
-
outputFormat: "json";
|
|
513
|
-
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
392
|
+
output: {};
|
|
393
|
+
outputFormat: string;
|
|
394
|
+
status: import("hono/utils/http-status").StatusCode;
|
|
514
395
|
};
|
|
515
396
|
};
|
|
516
397
|
} & {
|
|
@@ -553,7 +434,7 @@ export declare const transactionOfferRoutes: import("hono/hono-base").HonoBase<E
|
|
|
553
434
|
slotId: string | null;
|
|
554
435
|
title: string;
|
|
555
436
|
description: string | null;
|
|
556
|
-
itemType: "
|
|
437
|
+
itemType: "service" | "other" | "unit" | "extra" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
|
|
557
438
|
status: "draft" | "confirmed" | "fulfilled" | "cancelled" | "priced";
|
|
558
439
|
serviceDate: string | null;
|
|
559
440
|
startsAt: string | null;
|
|
@@ -586,14 +467,14 @@ export declare const transactionOfferRoutes: import("hono/hono-base").HonoBase<E
|
|
|
586
467
|
input: {};
|
|
587
468
|
output: {
|
|
588
469
|
data: {
|
|
589
|
-
|
|
470
|
+
metadata: import("hono/utils/types").JSONValue;
|
|
471
|
+
id: string;
|
|
590
472
|
createdAt: string;
|
|
591
473
|
updatedAt: string;
|
|
592
|
-
description: string | null;
|
|
593
|
-
id: string;
|
|
594
|
-
metadata: import("hono/utils/types").JSONValue;
|
|
595
474
|
status: "draft" | "confirmed" | "fulfilled" | "cancelled" | "priced";
|
|
596
475
|
notes: string | null;
|
|
476
|
+
description: string | null;
|
|
477
|
+
offerId: string;
|
|
597
478
|
title: string;
|
|
598
479
|
taxAmountCents: number | null;
|
|
599
480
|
feeAmountCents: number | null;
|
|
@@ -601,7 +482,7 @@ export declare const transactionOfferRoutes: import("hono/hono-base").HonoBase<E
|
|
|
601
482
|
optionId: string | null;
|
|
602
483
|
unitId: string | null;
|
|
603
484
|
slotId: string | null;
|
|
604
|
-
itemType: "
|
|
485
|
+
itemType: "service" | "other" | "unit" | "extra" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
|
|
605
486
|
serviceDate: string | null;
|
|
606
487
|
startsAt: string | null;
|
|
607
488
|
endsAt: string | null;
|
|
@@ -647,7 +528,7 @@ export declare const transactionOfferRoutes: import("hono/hono-base").HonoBase<E
|
|
|
647
528
|
slotId: string | null;
|
|
648
529
|
title: string;
|
|
649
530
|
description: string | null;
|
|
650
|
-
itemType: "
|
|
531
|
+
itemType: "service" | "other" | "unit" | "extra" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
|
|
651
532
|
status: "draft" | "confirmed" | "fulfilled" | "cancelled" | "priced";
|
|
652
533
|
serviceDate: string | null;
|
|
653
534
|
startsAt: string | null;
|
|
@@ -700,7 +581,7 @@ export declare const transactionOfferRoutes: import("hono/hono-base").HonoBase<E
|
|
|
700
581
|
slotId: string | null;
|
|
701
582
|
title: string;
|
|
702
583
|
description: string | null;
|
|
703
|
-
itemType: "
|
|
584
|
+
itemType: "service" | "other" | "unit" | "extra" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
|
|
704
585
|
status: "draft" | "confirmed" | "fulfilled" | "cancelled" | "priced";
|
|
705
586
|
serviceDate: string | null;
|
|
706
587
|
startsAt: string | null;
|
|
@@ -777,8 +658,8 @@ export declare const transactionOfferRoutes: import("hono/hono-base").HonoBase<E
|
|
|
777
658
|
input: {};
|
|
778
659
|
output: {
|
|
779
660
|
data: {
|
|
780
|
-
createdAt: string;
|
|
781
661
|
id: string;
|
|
662
|
+
createdAt: string;
|
|
782
663
|
role: "other" | "traveler" | "occupant" | "primary_contact" | "beneficiary" | "service_assignee";
|
|
783
664
|
participantId: string;
|
|
784
665
|
isPrimary: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes-offers.d.ts","sourceRoot":"","sources":["../src/routes-offers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"routes-offers.d.ts","sourceRoot":"","sources":["../src/routes-offers.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,GAAG,EAIT,MAAM,oBAAoB,CAAA;AAiB3B,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uCA2N/B,CAAA"}
|
package/dist/routes-offers.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
+
import { parseJsonBody, parseQuery } from "@voyantjs/hono";
|
|
1
2
|
import { Hono } from "hono";
|
|
2
3
|
import { authorizeTransactionPiiAccess, createPiiService, hasParticipantIdentityInput, logTransactionPiiAccess, notFound, } from "./routes-shared.js";
|
|
3
4
|
import { transactionsService } from "./service.js";
|
|
4
5
|
import { insertOfferItemParticipantSchema, insertOfferItemSchema, insertOfferParticipantSchema, insertOfferSchema, offerItemListQuerySchema, offerItemParticipantListQuerySchema, offerListQuerySchema, offerParticipantListQuerySchema, updateOfferItemParticipantSchema, updateOfferItemSchema, updateOfferParticipantSchema, updateOfferSchema, } from "./validation.js";
|
|
5
6
|
export const transactionOfferRoutes = new Hono()
|
|
6
7
|
.get("/offers", async (c) => {
|
|
7
|
-
const query =
|
|
8
|
+
const query = parseQuery(c, offerListQuerySchema);
|
|
8
9
|
return c.json(await transactionsService.listOffers(c.get("db"), query));
|
|
9
10
|
})
|
|
10
11
|
.post("/offers", async (c) => c.json({
|
|
11
|
-
data: await transactionsService.createOffer(c.get("db"),
|
|
12
|
+
data: await transactionsService.createOffer(c.get("db"), await parseJsonBody(c, insertOfferSchema)),
|
|
12
13
|
}, 201))
|
|
13
14
|
.get("/offers/:id", async (c) => {
|
|
14
15
|
const row = await transactionsService.getOfferById(c.get("db"), c.req.param("id"));
|
|
15
16
|
return row ? c.json({ data: row }) : notFound(c, "Offer not found");
|
|
16
17
|
})
|
|
17
18
|
.patch("/offers/:id", async (c) => {
|
|
18
|
-
const row = await transactionsService.updateOffer(c.get("db"), c.req.param("id"),
|
|
19
|
+
const row = await transactionsService.updateOffer(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateOfferSchema));
|
|
19
20
|
return row ? c.json({ data: row }) : notFound(c, "Offer not found");
|
|
20
21
|
})
|
|
21
22
|
.delete("/offers/:id", async (c) => {
|
|
@@ -23,11 +24,11 @@ export const transactionOfferRoutes = new Hono()
|
|
|
23
24
|
return row ? c.json({ success: true }) : notFound(c, "Offer not found");
|
|
24
25
|
})
|
|
25
26
|
.get("/offer-participants", async (c) => {
|
|
26
|
-
const query =
|
|
27
|
+
const query = parseQuery(c, offerParticipantListQuerySchema);
|
|
27
28
|
return c.json(await transactionsService.listOfferParticipants(c.get("db"), query));
|
|
28
29
|
})
|
|
29
30
|
.post("/offer-participants", async (c) => {
|
|
30
|
-
const payload =
|
|
31
|
+
const payload = await parseJsonBody(c, insertOfferParticipantSchema);
|
|
31
32
|
const row = await transactionsService.createOfferParticipant(c.get("db"), payload);
|
|
32
33
|
if (!row)
|
|
33
34
|
return c.json({ data: row }, 201);
|
|
@@ -43,7 +44,7 @@ export const transactionOfferRoutes = new Hono()
|
|
|
43
44
|
return row ? c.json({ data: row }) : notFound(c, "Offer participant not found");
|
|
44
45
|
})
|
|
45
46
|
.patch("/offer-participants/:id", async (c) => {
|
|
46
|
-
const payload =
|
|
47
|
+
const payload = await parseJsonBody(c, updateOfferParticipantSchema);
|
|
47
48
|
const row = await transactionsService.updateOfferParticipant(c.get("db"), c.req.param("id"), payload);
|
|
48
49
|
if (!row)
|
|
49
50
|
return notFound(c, "Offer participant not found");
|
|
@@ -96,7 +97,7 @@ export const transactionOfferRoutes = new Hono()
|
|
|
96
97
|
if (!auth.allowed)
|
|
97
98
|
return auth.response;
|
|
98
99
|
const pii = createPiiService(c, "offer", participant.offerId);
|
|
99
|
-
const row = await pii.upsertParticipantIdentity(c.get("db"), "offer", participant.id,
|
|
100
|
+
const row = await pii.upsertParticipantIdentity(c.get("db"), "offer", participant.id, await parseJsonBody(c, updateOfferParticipantSchema), c.get("userId"));
|
|
100
101
|
return row ? c.json({ data: row }) : notFound(c, "Offer participant not found");
|
|
101
102
|
})
|
|
102
103
|
.delete("/offer-participants/:id/travel-details", async (c) => {
|
|
@@ -122,18 +123,18 @@ export const transactionOfferRoutes = new Hono()
|
|
|
122
123
|
return row ? c.json({ success: true }) : notFound(c, "Offer participant not found");
|
|
123
124
|
})
|
|
124
125
|
.get("/offer-items", async (c) => {
|
|
125
|
-
const query =
|
|
126
|
+
const query = parseQuery(c, offerItemListQuerySchema);
|
|
126
127
|
return c.json(await transactionsService.listOfferItems(c.get("db"), query));
|
|
127
128
|
})
|
|
128
129
|
.post("/offer-items", async (c) => c.json({
|
|
129
|
-
data: await transactionsService.createOfferItem(c.get("db"),
|
|
130
|
+
data: await transactionsService.createOfferItem(c.get("db"), await parseJsonBody(c, insertOfferItemSchema)),
|
|
130
131
|
}, 201))
|
|
131
132
|
.get("/offer-items/:id", async (c) => {
|
|
132
133
|
const row = await transactionsService.getOfferItemById(c.get("db"), c.req.param("id"));
|
|
133
134
|
return row ? c.json({ data: row }) : notFound(c, "Offer item not found");
|
|
134
135
|
})
|
|
135
136
|
.patch("/offer-items/:id", async (c) => {
|
|
136
|
-
const row = await transactionsService.updateOfferItem(c.get("db"), c.req.param("id"),
|
|
137
|
+
const row = await transactionsService.updateOfferItem(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateOfferItemSchema));
|
|
137
138
|
return row ? c.json({ data: row }) : notFound(c, "Offer item not found");
|
|
138
139
|
})
|
|
139
140
|
.delete("/offer-items/:id", async (c) => {
|
|
@@ -141,18 +142,18 @@ export const transactionOfferRoutes = new Hono()
|
|
|
141
142
|
return row ? c.json({ success: true }) : notFound(c, "Offer item not found");
|
|
142
143
|
})
|
|
143
144
|
.get("/offer-item-participants", async (c) => {
|
|
144
|
-
const query =
|
|
145
|
+
const query = parseQuery(c, offerItemParticipantListQuerySchema);
|
|
145
146
|
return c.json(await transactionsService.listOfferItemParticipants(c.get("db"), query));
|
|
146
147
|
})
|
|
147
148
|
.post("/offer-item-participants", async (c) => c.json({
|
|
148
|
-
data: await transactionsService.createOfferItemParticipant(c.get("db"),
|
|
149
|
+
data: await transactionsService.createOfferItemParticipant(c.get("db"), await parseJsonBody(c, insertOfferItemParticipantSchema)),
|
|
149
150
|
}, 201))
|
|
150
151
|
.get("/offer-item-participants/:id", async (c) => {
|
|
151
152
|
const row = await transactionsService.getOfferItemParticipantById(c.get("db"), c.req.param("id"));
|
|
152
153
|
return row ? c.json({ data: row }) : notFound(c, "Offer item participant not found");
|
|
153
154
|
})
|
|
154
155
|
.patch("/offer-item-participants/:id", async (c) => {
|
|
155
|
-
const row = await transactionsService.updateOfferItemParticipant(c.get("db"), c.req.param("id"),
|
|
156
|
+
const row = await transactionsService.updateOfferItemParticipant(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateOfferItemParticipantSchema));
|
|
156
157
|
return row ? c.json({ data: row }) : notFound(c, "Offer item participant not found");
|
|
157
158
|
})
|
|
158
159
|
.delete("/offer-item-participants/:id", async (c) => {
|