@hogsend/db 0.13.1 → 0.14.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.
@@ -162,6 +162,13 @@
162
162
  "when": 1781101598164,
163
163
  "tag": "0022_ftux_journey_states_updated_at_idx",
164
164
  "breakpoints": true
165
+ },
166
+ {
167
+ "idx": 23,
168
+ "version": "7",
169
+ "when": 1781164526837,
170
+ "tag": "0023_semantic_tracked_links",
171
+ "breakpoints": true
165
172
  }
166
173
  ]
167
174
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hogsend/db",
3
- "version": "0.13.1",
3
+ "version": "0.14.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,4 +1,12 @@
1
- import { index, integer, pgTable, text, uuid } from "drizzle-orm/pg-core";
1
+ import {
2
+ index,
3
+ integer,
4
+ jsonb,
5
+ pgTable,
6
+ text,
7
+ timestamp,
8
+ uuid,
9
+ } from "drizzle-orm/pg-core";
2
10
  import { timestamps } from "./_shared.js";
3
11
  import { emailSends } from "./email-sends.js";
4
12
 
@@ -11,6 +19,17 @@ export const trackedLinks = pgTable(
11
19
  .references(() => emailSends.id, { onDelete: "cascade" }),
12
20
  originalUrl: text("original_url").notNull(),
13
21
  clickCount: integer("click_count").notNull().default(0),
22
+ // Semantic link metadata, lifted from the template's data-hs-* attributes
23
+ // at send time. NULL for plain tracked links. `event` is the consumer event
24
+ // name emitted at click time; `eventProperties` its scalar payload.
25
+ event: text("event"),
26
+ eventProperties: jsonb("event_properties").$type<Record<string, unknown>>(),
27
+ // Set exactly once by the click route when the semantic event is emitted —
28
+ // the per-link emit-once gate today, and the provisional-then-confirm
29
+ // anchor later (a confirm flow can re-emit without a migration).
30
+ semanticEmittedAt: timestamp("semantic_emitted_at", {
31
+ withTimezone: true,
32
+ }),
14
33
  ...timestamps,
15
34
  },
16
35
  (table) => [index("tracked_links_email_send_id_idx").on(table.emailSendId)],