@voyantjs/transactions 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/routes-offers.d.ts +885 -0
  2. package/dist/routes-offers.d.ts.map +1 -0
  3. package/dist/routes-offers.js +161 -0
  4. package/dist/routes-orders.d.ts +1056 -0
  5. package/dist/routes-orders.d.ts.map +1 -0
  6. package/dist/routes-orders.js +180 -0
  7. package/dist/routes-shared.d.ts +103 -0
  8. package/dist/routes-shared.d.ts.map +1 -0
  9. package/dist/routes-shared.js +97 -0
  10. package/dist/routes.d.ts +3 -1979
  11. package/dist/routes.d.ts.map +1 -1
  12. package/dist/routes.js +5 -604
  13. package/dist/schema-audit.d.ts +216 -0
  14. package/dist/schema-audit.d.ts.map +1 -0
  15. package/dist/schema-audit.js +22 -0
  16. package/dist/schema-offers.d.ts +1301 -0
  17. package/dist/schema-offers.d.ts.map +1 -0
  18. package/dist/schema-offers.js +120 -0
  19. package/dist/schema-orders.d.ts +1582 -0
  20. package/dist/schema-orders.d.ts.map +1 -0
  21. package/dist/schema-orders.js +149 -0
  22. package/dist/schema-relations.d.ts +42 -0
  23. package/dist/schema-relations.d.ts.map +1 -0
  24. package/dist/schema-relations.js +56 -0
  25. package/dist/schema-shared.d.ts +12 -0
  26. package/dist/schema-shared.d.ts.map +1 -0
  27. package/dist/schema-shared.js +84 -0
  28. package/dist/schema.d.ts +5 -3148
  29. package/dist/schema.d.ts.map +1 -1
  30. package/dist/schema.js +5 -420
  31. package/dist/service-offers.d.ts +447 -0
  32. package/dist/service-offers.d.ts.map +1 -0
  33. package/dist/service-offers.js +262 -0
  34. package/dist/service-orders.d.ts +443 -0
  35. package/dist/service-orders.d.ts.map +1 -0
  36. package/dist/service-orders.js +278 -0
  37. package/dist/service-shared.d.ts +86 -0
  38. package/dist/service-shared.d.ts.map +1 -0
  39. package/dist/service-shared.js +49 -0
  40. package/dist/service.d.ts +48 -927
  41. package/dist/service.d.ts.map +1 -1
  42. package/dist/service.js +48 -595
  43. package/package.json +5 -5
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-offers.d.ts","sourceRoot":"","sources":["../src/schema-offers.ts"],"names":[],"mappings":"AAuBA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0ClB,CAAA;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4B7B,CAAA;AAED,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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timestamp, uniqueIndex, } from "drizzle-orm/pg-core";
3
+ import { offerStatusEnum, transactionItemParticipantRoleEnum, transactionItemStatusEnum, transactionItemTypeEnum, transactionParticipantTypeEnum, transactionTravelerCategoryEnum, } from "./schema-shared";
4
+ export const offers = pgTable("offers", {
5
+ id: typeId("offers"),
6
+ offerNumber: text("offer_number").notNull().unique(),
7
+ title: text("title").notNull(),
8
+ status: offerStatusEnum("status").notNull().default("draft"),
9
+ personId: text("person_id"),
10
+ organizationId: text("organization_id"),
11
+ opportunityId: text("opportunity_id"),
12
+ quoteId: text("quote_id"),
13
+ marketId: text("market_id"),
14
+ sourceChannelId: text("source_channel_id"),
15
+ currency: text("currency").notNull(),
16
+ baseCurrency: text("base_currency"),
17
+ fxRateSetId: text("fx_rate_set_id"),
18
+ subtotalAmountCents: integer("subtotal_amount_cents").notNull().default(0),
19
+ taxAmountCents: integer("tax_amount_cents").notNull().default(0),
20
+ feeAmountCents: integer("fee_amount_cents").notNull().default(0),
21
+ totalAmountCents: integer("total_amount_cents").notNull().default(0),
22
+ costAmountCents: integer("cost_amount_cents").notNull().default(0),
23
+ validFrom: date("valid_from"),
24
+ validUntil: date("valid_until"),
25
+ sentAt: timestamp("sent_at", { withTimezone: true }),
26
+ acceptedAt: timestamp("accepted_at", { withTimezone: true }),
27
+ convertedAt: timestamp("converted_at", { withTimezone: true }),
28
+ notes: text("notes"),
29
+ metadata: jsonb("metadata"),
30
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
31
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
32
+ }, (table) => [
33
+ index("idx_offers_status").on(table.status),
34
+ index("idx_offers_person").on(table.personId),
35
+ index("idx_offers_organization").on(table.organizationId),
36
+ index("idx_offers_opportunity").on(table.opportunityId),
37
+ index("idx_offers_quote").on(table.quoteId),
38
+ index("idx_offers_market").on(table.marketId),
39
+ index("idx_offers_channel").on(table.sourceChannelId),
40
+ index("idx_offers_fx_rate_set").on(table.fxRateSetId),
41
+ index("idx_offers_valid_until").on(table.validUntil),
42
+ ]);
43
+ export const offerParticipants = pgTable("offer_participants", {
44
+ id: typeId("offer_participants"),
45
+ offerId: typeIdRef("offer_id")
46
+ .notNull()
47
+ .references(() => offers.id, { onDelete: "cascade" }),
48
+ personId: text("person_id"),
49
+ participantType: transactionParticipantTypeEnum("participant_type")
50
+ .notNull()
51
+ .default("traveler"),
52
+ travelerCategory: transactionTravelerCategoryEnum("traveler_category"),
53
+ firstName: text("first_name").notNull(),
54
+ lastName: text("last_name").notNull(),
55
+ email: text("email"),
56
+ phone: text("phone"),
57
+ preferredLanguage: text("preferred_language"),
58
+ identityEncrypted: jsonb("identity_encrypted").$type(),
59
+ isPrimary: boolean("is_primary").notNull().default(false),
60
+ notes: text("notes"),
61
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
62
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
63
+ }, (table) => [
64
+ index("idx_offer_participants_offer").on(table.offerId),
65
+ index("idx_offer_participants_person").on(table.personId),
66
+ index("idx_offer_participants_type").on(table.participantType),
67
+ ]);
68
+ export const offerItems = pgTable("offer_items", {
69
+ id: typeId("offer_items"),
70
+ offerId: typeIdRef("offer_id")
71
+ .notNull()
72
+ .references(() => offers.id, { onDelete: "cascade" }),
73
+ productId: text("product_id"),
74
+ optionId: text("option_id"),
75
+ unitId: text("unit_id"),
76
+ slotId: text("slot_id"),
77
+ title: text("title").notNull(),
78
+ description: text("description"),
79
+ itemType: transactionItemTypeEnum("item_type").notNull().default("unit"),
80
+ status: transactionItemStatusEnum("status").notNull().default("draft"),
81
+ serviceDate: date("service_date"),
82
+ startsAt: timestamp("starts_at", { withTimezone: true }),
83
+ endsAt: timestamp("ends_at", { withTimezone: true }),
84
+ quantity: integer("quantity").notNull().default(1),
85
+ sellCurrency: text("sell_currency").notNull(),
86
+ unitSellAmountCents: integer("unit_sell_amount_cents"),
87
+ totalSellAmountCents: integer("total_sell_amount_cents"),
88
+ taxAmountCents: integer("tax_amount_cents"),
89
+ feeAmountCents: integer("fee_amount_cents"),
90
+ costCurrency: text("cost_currency"),
91
+ unitCostAmountCents: integer("unit_cost_amount_cents"),
92
+ totalCostAmountCents: integer("total_cost_amount_cents"),
93
+ notes: text("notes"),
94
+ metadata: jsonb("metadata"),
95
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
96
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
97
+ }, (table) => [
98
+ index("idx_offer_items_offer").on(table.offerId),
99
+ index("idx_offer_items_product").on(table.productId),
100
+ index("idx_offer_items_option").on(table.optionId),
101
+ index("idx_offer_items_unit").on(table.unitId),
102
+ index("idx_offer_items_slot").on(table.slotId),
103
+ index("idx_offer_items_status").on(table.status),
104
+ ]);
105
+ export const offerItemParticipants = pgTable("offer_item_participants", {
106
+ id: typeId("offer_item_participants"),
107
+ offerItemId: typeIdRef("offer_item_id")
108
+ .notNull()
109
+ .references(() => offerItems.id, { onDelete: "cascade" }),
110
+ participantId: typeIdRef("participant_id")
111
+ .notNull()
112
+ .references(() => offerParticipants.id, { onDelete: "cascade" }),
113
+ role: transactionItemParticipantRoleEnum("role").notNull().default("traveler"),
114
+ isPrimary: boolean("is_primary").notNull().default(false),
115
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
116
+ }, (table) => [
117
+ index("idx_offer_item_participants_item").on(table.offerItemId),
118
+ index("idx_offer_item_participants_participant").on(table.participantId),
119
+ uniqueIndex("uidx_offer_item_participants").on(table.offerItemId, table.participantId),
120
+ ]);