@foundrynorth/compass-schema 1.0.16 → 1.0.18

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/schema.js CHANGED
@@ -5232,6 +5232,10 @@ export const contracts = pgTable("contracts", {
5232
5232
  signingStatus: varchar("signing_status"), // draft | pending_internal | pending_client | active
5233
5233
  sentForSigningAt: timestamp("sent_for_signing_at"),
5234
5234
  sentForSigningBy: varchar("sent_for_signing_by"),
5235
+ // Flux sync cache fields (populated by fn-flux contract events)
5236
+ fluxAgreementId: text("flux_agreement_id"), // canonical reference to fn-flux agreement
5237
+ lastSyncedAt: timestamp("last_synced_at"), // when last event was received from fn-flux
5238
+ syncSource: varchar("sync_source").default("legacy"), // 'legacy' | 'flux'
5235
5239
  // Audit
5236
5240
  notes: text("notes"),
5237
5241
  createdByUserId: varchar("created_by_user_id"),
@@ -5243,6 +5247,7 @@ export const contracts = pgTable("contracts", {
5243
5247
  index("contracts_partner_id_idx").on(table.partnerId),
5244
5248
  index("contracts_status_idx").on(table.status),
5245
5249
  index("contracts_date_range_idx").on(table.startDate, table.endDate),
5250
+ index("contracts_flux_agreement_id_idx").on(table.fluxAgreementId),
5246
5251
  ]);
5247
5252
  export const insertContractSchema = createInsertSchema(contracts).omit({
5248
5253
  id: true,
@@ -5255,6 +5260,9 @@ export const insertContractSchema = createInsertSchema(contracts).omit({
5255
5260
  actualMarginDollars: true,
5256
5261
  orderCount: true,
5257
5262
  lastRecalculatedAt: true,
5263
+ fluxAgreementId: true,
5264
+ lastSyncedAt: true,
5265
+ syncSource: true,
5258
5266
  });
5259
5267
  export const updateContractSchema = insertContractSchema.partial();
5260
5268
  // ─── Signing Surface ────────────────────────────────────────────────────────
@@ -5263,20 +5271,8 @@ export const signerRoleEnum = pgEnum("signer_role", [
5263
5271
  "client_signer",
5264
5272
  "counter_signer",
5265
5273
  ]);
5266
- export const contractSigners = pgTable("contract_signers", {
5267
- id: uuid("id").primaryKey().defaultRandom(),
5268
- contractId: uuid("contract_id")
5269
- .notNull()
5270
- .references(() => contracts.id, { onDelete: "cascade" }),
5271
- role: signerRoleEnum("role").notNull().default("client_signer"),
5272
- displayOrder: integer("display_order").notNull().default(1),
5273
- hubspotContactId: text("hubspot_contact_id"),
5274
- name: text("name").notNull(),
5275
- email: text("email").notNull(),
5276
- createdAt: timestamp("created_at").notNull().defaultNow(),
5277
- }, (table) => [
5278
- index("contract_signers_contract_id_idx").on(table.contractId),
5279
- ]);
5274
+ // contractSigners table removed — signing is managed in fn-flux.
5275
+ // signerRoleEnum is retained because orderSigners still uses it.
5280
5276
  export const orderSigners = pgTable("order_signers", {
5281
5277
  id: uuid("id").primaryKey().defaultRandom(),
5282
5278
  orderId: varchar("order_id")