@foundrynorth/flux-schema 1.19.9 → 1.20.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/schema.d.ts CHANGED
@@ -40,6 +40,24 @@ export declare const fluxSecretsStatusEnum: import("drizzle-orm/pg-core").PgEnum
40
40
  export declare const fluxSecretsPlatformEnum: import("drizzle-orm/pg-core").PgEnum<["railway", "vercel", "trigger", "local"]>;
41
41
  export declare const fluxSecretsSyncStatusEnum: import("drizzle-orm/pg-core").PgEnum<["synced", "pending", "failed", "unknown"]>;
42
42
  export declare const fluxSecretsAuditActionEnum: import("drizzle-orm/pg-core").PgEnum<["created", "rotated", "revoked", "synced", "sync_failed"]>;
43
+ /**
44
+ * Milestone events that can trigger a per-user Slack DM. Owners on a ticket
45
+ * (account manager, account executive, strategist, fulfillment owner) receive
46
+ * these by default; non-owner subscribers must opt in per event type via
47
+ * `flux_users.notificationPreferences.milestones.subscriberOptIn`.
48
+ */
49
+ export declare const MILESTONE_EVENT_TYPES: readonly ["ticket_created", "creative_needed", "creative_approved", "ready_to_traffic", "campaign_live", "campaign_completed", "campaign_paused", "campaign_cancelled", "change_required", "sem_live", "sem_failed"];
50
+ export type MilestoneEventType = (typeof MILESTONE_EVENT_TYPES)[number];
51
+ export interface MilestonePreferences {
52
+ /** Owner default behavior: "all" (every event), "lifecycle_only" (live/completed/paused/cancelled), or "none". Defaults to "all". */
53
+ ownerDefaults?: "all" | "lifecycle_only" | "none";
54
+ /** Event types a non-owner subscriber wants DMs for. Defaults to []. */
55
+ subscriberOptIn?: MilestoneEventType[];
56
+ /** Project IDs the user has muted. */
57
+ mutedProjectIds?: string[];
58
+ /** ISO timestamp until which all milestone DMs are suppressed. */
59
+ mutedUntil?: string;
60
+ }
43
61
  /**
44
62
  * Flux user profiles - extends Clerk user identity with Flux-specific data.
45
63
  *
@@ -315,6 +333,7 @@ export declare const fluxUsers: import("drizzle-orm/pg-core").PgTableWithColumns
315
333
  sentinelSeverityThreshold?: "all" | "notable" | "urgent" | "crisis";
316
334
  sentinelDigestFrequency?: "daily" | "weekly" | "none";
317
335
  sentinelSlackDMs?: boolean;
336
+ milestones?: MilestonePreferences;
318
337
  };
319
338
  driverParam: unknown;
320
339
  notNull: false;
@@ -333,6 +352,7 @@ export declare const fluxUsers: import("drizzle-orm/pg-core").PgTableWithColumns
333
352
  sentinelSeverityThreshold?: "all" | "notable" | "urgent" | "crisis";
334
353
  sentinelDigestFrequency?: "daily" | "weekly" | "none";
335
354
  sentinelSlackDMs?: boolean;
355
+ milestones?: MilestonePreferences;
336
356
  };
337
357
  }>;
338
358
  onboardingComplete: import("drizzle-orm/pg-core").PgColumn<{
@@ -2376,6 +2396,194 @@ export declare const fluxActivityItems: import("drizzle-orm/pg-core").PgTableWit
2376
2396
  };
2377
2397
  dialect: "pg";
2378
2398
  }>;
2399
+ /**
2400
+ * Idempotency ledger for milestone Slack DMs. The dispatcher inserts one row
2401
+ * per (user, source, event) before sending the DM; the unique index causes
2402
+ * `ON CONFLICT DO NOTHING` to no-op on retries / re-syncs / webhook replays.
2403
+ *
2404
+ * Source rows:
2405
+ * sourceType = "fulfillment_ticket" → sourceId = flux_fulfillment_tickets.id
2406
+ * sourceType = "sem_campaign" → sourceId = flux_sem_campaigns.id
2407
+ *
2408
+ * `slackTs` captures the Slack message timestamp so future code can thread
2409
+ * follow-up updates (e.g. edit the "campaign live" message when it completes).
2410
+ */
2411
+ export declare const fluxMilestoneNotifications: import("drizzle-orm/pg-core").PgTableWithColumns<{
2412
+ name: "flux_milestone_notifications";
2413
+ schema: undefined;
2414
+ columns: {
2415
+ id: import("drizzle-orm/pg-core").PgColumn<{
2416
+ name: "id";
2417
+ tableName: "flux_milestone_notifications";
2418
+ dataType: "string";
2419
+ columnType: "PgVarchar";
2420
+ data: string;
2421
+ driverParam: string;
2422
+ notNull: true;
2423
+ hasDefault: true;
2424
+ isPrimaryKey: true;
2425
+ isAutoincrement: false;
2426
+ hasRuntimeDefault: false;
2427
+ enumValues: [string, ...string[]];
2428
+ baseColumn: never;
2429
+ identity: undefined;
2430
+ generated: undefined;
2431
+ }, {}, {
2432
+ length: number | undefined;
2433
+ }>;
2434
+ userId: import("drizzle-orm/pg-core").PgColumn<{
2435
+ name: "user_id";
2436
+ tableName: "flux_milestone_notifications";
2437
+ dataType: "string";
2438
+ columnType: "PgVarchar";
2439
+ data: string;
2440
+ driverParam: string;
2441
+ notNull: true;
2442
+ hasDefault: false;
2443
+ isPrimaryKey: false;
2444
+ isAutoincrement: false;
2445
+ hasRuntimeDefault: false;
2446
+ enumValues: [string, ...string[]];
2447
+ baseColumn: never;
2448
+ identity: undefined;
2449
+ generated: undefined;
2450
+ }, {}, {
2451
+ length: number | undefined;
2452
+ }>;
2453
+ sourceType: import("drizzle-orm/pg-core").PgColumn<{
2454
+ name: "source_type";
2455
+ tableName: "flux_milestone_notifications";
2456
+ dataType: "string";
2457
+ columnType: "PgVarchar";
2458
+ data: string;
2459
+ driverParam: string;
2460
+ notNull: true;
2461
+ hasDefault: false;
2462
+ isPrimaryKey: false;
2463
+ isAutoincrement: false;
2464
+ hasRuntimeDefault: false;
2465
+ enumValues: [string, ...string[]];
2466
+ baseColumn: never;
2467
+ identity: undefined;
2468
+ generated: undefined;
2469
+ }, {}, {
2470
+ length: number | undefined;
2471
+ }>;
2472
+ sourceId: import("drizzle-orm/pg-core").PgColumn<{
2473
+ name: "source_id";
2474
+ tableName: "flux_milestone_notifications";
2475
+ dataType: "string";
2476
+ columnType: "PgVarchar";
2477
+ data: string;
2478
+ driverParam: string;
2479
+ notNull: true;
2480
+ hasDefault: false;
2481
+ isPrimaryKey: false;
2482
+ isAutoincrement: false;
2483
+ hasRuntimeDefault: false;
2484
+ enumValues: [string, ...string[]];
2485
+ baseColumn: never;
2486
+ identity: undefined;
2487
+ generated: undefined;
2488
+ }, {}, {
2489
+ length: number | undefined;
2490
+ }>;
2491
+ eventType: import("drizzle-orm/pg-core").PgColumn<{
2492
+ name: "event_type";
2493
+ tableName: "flux_milestone_notifications";
2494
+ dataType: "string";
2495
+ columnType: "PgVarchar";
2496
+ data: string;
2497
+ driverParam: string;
2498
+ notNull: true;
2499
+ hasDefault: false;
2500
+ isPrimaryKey: false;
2501
+ isAutoincrement: false;
2502
+ hasRuntimeDefault: false;
2503
+ enumValues: [string, ...string[]];
2504
+ baseColumn: never;
2505
+ identity: undefined;
2506
+ generated: undefined;
2507
+ }, {}, {
2508
+ length: number | undefined;
2509
+ }>;
2510
+ projectId: import("drizzle-orm/pg-core").PgColumn<{
2511
+ name: "project_id";
2512
+ tableName: "flux_milestone_notifications";
2513
+ dataType: "string";
2514
+ columnType: "PgVarchar";
2515
+ data: string;
2516
+ driverParam: string;
2517
+ notNull: false;
2518
+ hasDefault: false;
2519
+ isPrimaryKey: false;
2520
+ isAutoincrement: false;
2521
+ hasRuntimeDefault: false;
2522
+ enumValues: [string, ...string[]];
2523
+ baseColumn: never;
2524
+ identity: undefined;
2525
+ generated: undefined;
2526
+ }, {}, {
2527
+ length: number | undefined;
2528
+ }>;
2529
+ deliveredAt: import("drizzle-orm/pg-core").PgColumn<{
2530
+ name: "delivered_at";
2531
+ tableName: "flux_milestone_notifications";
2532
+ dataType: "date";
2533
+ columnType: "PgTimestamp";
2534
+ data: Date;
2535
+ driverParam: string;
2536
+ notNull: true;
2537
+ hasDefault: true;
2538
+ isPrimaryKey: false;
2539
+ isAutoincrement: false;
2540
+ hasRuntimeDefault: false;
2541
+ enumValues: undefined;
2542
+ baseColumn: never;
2543
+ identity: undefined;
2544
+ generated: undefined;
2545
+ }, {}, {}>;
2546
+ slackTs: import("drizzle-orm/pg-core").PgColumn<{
2547
+ name: "slack_ts";
2548
+ tableName: "flux_milestone_notifications";
2549
+ dataType: "string";
2550
+ columnType: "PgVarchar";
2551
+ data: string;
2552
+ driverParam: string;
2553
+ notNull: false;
2554
+ hasDefault: false;
2555
+ isPrimaryKey: false;
2556
+ isAutoincrement: false;
2557
+ hasRuntimeDefault: false;
2558
+ enumValues: [string, ...string[]];
2559
+ baseColumn: never;
2560
+ identity: undefined;
2561
+ generated: undefined;
2562
+ }, {}, {
2563
+ length: number | undefined;
2564
+ }>;
2565
+ metadata: import("drizzle-orm/pg-core").PgColumn<{
2566
+ name: "metadata";
2567
+ tableName: "flux_milestone_notifications";
2568
+ dataType: "json";
2569
+ columnType: "PgJsonb";
2570
+ data: Record<string, unknown>;
2571
+ driverParam: unknown;
2572
+ notNull: false;
2573
+ hasDefault: true;
2574
+ isPrimaryKey: false;
2575
+ isAutoincrement: false;
2576
+ hasRuntimeDefault: false;
2577
+ enumValues: undefined;
2578
+ baseColumn: never;
2579
+ identity: undefined;
2580
+ generated: undefined;
2581
+ }, {}, {
2582
+ $type: Record<string, unknown>;
2583
+ }>;
2584
+ };
2585
+ dialect: "pg";
2586
+ }>;
2379
2587
  export declare const fluxAlertRules: import("drizzle-orm/pg-core").PgTableWithColumns<{
2380
2588
  name: "flux_alert_rules";
2381
2589
  schema: undefined;
@@ -14402,7 +14610,7 @@ export declare const fluxFulfillmentTickets: import("drizzle-orm/pg-core").PgTab
14402
14610
  tableName: "flux_fulfillment_tickets";
14403
14611
  dataType: "string";
14404
14612
  columnType: "PgEnumColumn";
14405
- data: "paused" | "pending_form" | "submitted" | "pending_creative" | "pending_fulfillment" | "ready" | "running" | "completed" | "cancelled" | "change_required" | "billing_change_required";
14613
+ data: "paused" | "change_required" | "pending_form" | "submitted" | "pending_creative" | "pending_fulfillment" | "ready" | "running" | "completed" | "cancelled" | "billing_change_required";
14406
14614
  driverParam: string;
14407
14615
  notNull: true;
14408
14616
  hasDefault: true;
@@ -16514,7 +16722,7 @@ export declare const fluxFulfillmentTaskTemplates: import("drizzle-orm/pg-core")
16514
16722
  tableName: "flux_fulfillment_task_templates";
16515
16723
  dataType: "string";
16516
16724
  columnType: "PgEnumColumn";
16517
- data: "paused" | "pending_form" | "submitted" | "pending_creative" | "pending_fulfillment" | "ready" | "running" | "completed" | "cancelled" | "change_required" | "billing_change_required";
16725
+ data: "paused" | "change_required" | "pending_form" | "submitted" | "pending_creative" | "pending_fulfillment" | "ready" | "running" | "completed" | "cancelled" | "billing_change_required";
16518
16726
  driverParam: string;
16519
16727
  notNull: true;
16520
16728
  hasDefault: false;
@@ -18222,6 +18430,8 @@ export type FluxEmailThread = typeof fluxEmailThreads.$inferSelect;
18222
18430
  export type NewFluxEmailThread = typeof fluxEmailThreads.$inferInsert;
18223
18431
  export type FluxActivityItem = typeof fluxActivityItems.$inferSelect;
18224
18432
  export type NewFluxActivityItem = typeof fluxActivityItems.$inferInsert;
18433
+ export type FluxMilestoneNotification = typeof fluxMilestoneNotifications.$inferSelect;
18434
+ export type NewFluxMilestoneNotification = typeof fluxMilestoneNotifications.$inferInsert;
18225
18435
  export type FluxAlertRule = typeof fluxAlertRules.$inferSelect;
18226
18436
  export type NewFluxAlertRule = typeof fluxAlertRules.$inferInsert;
18227
18437
  export type FluxAlert = typeof fluxAlerts.$inferSelect;
@@ -41272,8 +41482,8 @@ export type NewFluxOnboardingFile = typeof fluxOnboardingFiles.$inferInsert;
41272
41482
  export type FluxOnboardingActivityRecord = typeof fluxOnboardingActivity.$inferSelect;
41273
41483
  export type NewFluxOnboardingActivityRecord = typeof fluxOnboardingActivity.$inferInsert;
41274
41484
  export declare const fluxClientApprovalRequestStatusEnum: import("drizzle-orm/pg-core").PgEnum<["pending", "approved", "changes_requested", "expired", "canceled"]>;
41275
- export declare const fluxClientApprovalDisciplineKindEnum: import("drizzle-orm/pg-core").PgEnum<["paid_search", "seo", "geo", "aeo", "reviews"]>;
41276
- export declare const fluxClientApprovalSubjectTypeEnum: import("drizzle-orm/pg-core").PgEnum<["plan", "change_pack", "deliverable", "keyword_list", "ad_copy"]>;
41485
+ export declare const fluxClientApprovalDisciplineKindEnum: import("drizzle-orm/pg-core").PgEnum<["paid_search", "seo", "geo", "aeo", "reviews", "media_order"]>;
41486
+ export declare const fluxClientApprovalSubjectTypeEnum: import("drizzle-orm/pg-core").PgEnum<["plan", "change_pack", "deliverable", "keyword_list", "ad_copy", "insertion_order"]>;
41277
41487
  export declare const fluxClientApprovalRequests: import("drizzle-orm/pg-core").PgTableWithColumns<{
41278
41488
  name: "flux_client_approval_requests";
41279
41489
  schema: undefined;
@@ -41317,14 +41527,14 @@ export declare const fluxClientApprovalRequests: import("drizzle-orm/pg-core").P
41317
41527
  tableName: "flux_client_approval_requests";
41318
41528
  dataType: "string";
41319
41529
  columnType: "PgEnumColumn";
41320
- data: "geo" | "paid_search" | "seo" | "aeo" | "reviews";
41530
+ data: "geo" | "paid_search" | "seo" | "aeo" | "reviews" | "media_order";
41321
41531
  driverParam: string;
41322
41532
  notNull: true;
41323
41533
  hasDefault: false;
41324
41534
  isPrimaryKey: false;
41325
41535
  isAutoincrement: false;
41326
41536
  hasRuntimeDefault: false;
41327
- enumValues: ["paid_search", "seo", "geo", "aeo", "reviews"];
41537
+ enumValues: ["paid_search", "seo", "geo", "aeo", "reviews", "media_order"];
41328
41538
  baseColumn: never;
41329
41539
  identity: undefined;
41330
41540
  generated: undefined;
@@ -41334,14 +41544,14 @@ export declare const fluxClientApprovalRequests: import("drizzle-orm/pg-core").P
41334
41544
  tableName: "flux_client_approval_requests";
41335
41545
  dataType: "string";
41336
41546
  columnType: "PgEnumColumn";
41337
- data: "plan" | "change_pack" | "deliverable" | "keyword_list" | "ad_copy";
41547
+ data: "plan" | "change_pack" | "deliverable" | "keyword_list" | "ad_copy" | "insertion_order";
41338
41548
  driverParam: string;
41339
41549
  notNull: true;
41340
41550
  hasDefault: false;
41341
41551
  isPrimaryKey: false;
41342
41552
  isAutoincrement: false;
41343
41553
  hasRuntimeDefault: false;
41344
- enumValues: ["plan", "change_pack", "deliverable", "keyword_list", "ad_copy"];
41554
+ enumValues: ["plan", "change_pack", "deliverable", "keyword_list", "ad_copy", "insertion_order"];
41345
41555
  baseColumn: never;
41346
41556
  identity: undefined;
41347
41557
  generated: undefined;