@hogsend/cli 0.26.0 → 0.27.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/bin.js CHANGED
@@ -14466,6 +14466,7 @@ __export(schema_exports, {
14466
14466
  journeyStatusEnum: () => journeyStatusEnum,
14467
14467
  linkClicks: () => linkClicks,
14468
14468
  linkClicksRelations: () => linkClicksRelations,
14469
+ links: () => links,
14469
14470
  member: () => member,
14470
14471
  memberRelations: () => memberRelations,
14471
14472
  organization: () => organization,
@@ -15188,6 +15189,40 @@ var journeyLogs = pgTable(
15188
15189
  ]
15189
15190
  );
15190
15191
 
15192
+ // ../db/src/schema/links.ts
15193
+ var links = pgTable(
15194
+ "links",
15195
+ {
15196
+ id: uuid("id").defaultRandom().primaryKey(),
15197
+ originalUrl: text2("original_url").notNull(),
15198
+ // "personal" = single-recipient, identity-bearing (carries `distinctId`, may
15199
+ // mint a SINGLE-USE `hs_t`); "public" = shareable, NEVER carries a person
15200
+ // token (campaign/UTM attribution only). Default "public" — the safe default.
15201
+ type: text2("type").notNull().default("public"),
15202
+ // Operator-facing name (Studio list).
15203
+ label: text2("label"),
15204
+ // UTM-style campaign grouping for public links.
15205
+ campaign: text2("campaign"),
15206
+ // Originating channel: "studio" | "discord" | "sms" | … (open string).
15207
+ source: text2("source").notNull(),
15208
+ // The canonical contact key a click should stitch the visitor's anon session
15209
+ // into — set ONLY for personal links; NULL for public/broadcast (a shareable
15210
+ // link must never carry a person).
15211
+ distinctId: text2("distinct_id"),
15212
+ // The admin actor who minted it (mirrors api_keys.createdBy).
15213
+ createdBy: text2("created_by"),
15214
+ // Soft-delete: archive (not hard-delete) so historical `link_clicks` survive
15215
+ // (the `tracked_links.link_id` FK is ON DELETE set null as a backstop).
15216
+ archivedAt: timestamp("archived_at", { withTimezone: true }),
15217
+ ...timestamps
15218
+ },
15219
+ (table) => [
15220
+ index("links_source_idx").on(table.source),
15221
+ index("links_campaign_idx").on(table.campaign),
15222
+ index("links_created_at_idx").on(table.createdAt)
15223
+ ]
15224
+ );
15225
+
15191
15226
  // ../db/src/schema/tracked-links.ts
15192
15227
  var trackedLinks = pgTable(
15193
15228
  "tracked_links",
@@ -15200,6 +15235,13 @@ var trackedLinks = pgTable(
15200
15235
  emailSendId: uuid("email_send_id").references(() => emailSends.id, {
15201
15236
  onDelete: "cascade"
15202
15237
  }),
15238
+ // The managed `links` row this click-counter belongs to, when the link was
15239
+ // minted via `mintLink` (Studio / Discord / share links). NULL for email's
15240
+ // per-send rewritten links (they resolve identity from `email_sends`). ON
15241
+ // DELETE set null so archiving/removing a `links` row keeps the click spine.
15242
+ linkId: uuid("link_id").references(() => links.id, {
15243
+ onDelete: "set null"
15244
+ }),
15203
15245
  // Subject of a stitch-bearing NON-email link: the canonical contact key the
15204
15246
  // click should fold the visitor's anon session into. NULL for broadcast
15205
15247
  // links (Discord/referral default) — broadcast links are tracked for click
@@ -15225,7 +15267,10 @@ var trackedLinks = pgTable(
15225
15267
  }),
15226
15268
  ...timestamps
15227
15269
  },
15228
- (table) => [index("tracked_links_email_send_id_idx").on(table.emailSendId)]
15270
+ (table) => [
15271
+ index("tracked_links_email_send_id_idx").on(table.emailSendId),
15272
+ index("tracked_links_link_id_idx").on(table.linkId)
15273
+ ]
15229
15274
  );
15230
15275
 
15231
15276
  // ../db/src/schema/link-clicks.ts