@ainyc/canonry 1.40.1 → 1.44.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/assets/index.html CHANGED
@@ -12,8 +12,8 @@
12
12
  <link rel="icon" type="image/png" sizes="32x32" href="./favicon-32.png" />
13
13
  <link rel="apple-touch-icon" href="./apple-touch-icon.png" />
14
14
  <title>Canonry</title>
15
- <script type="module" crossorigin src="./assets/index-DU7KOHur.js"></script>
16
- <link rel="stylesheet" crossorigin href="./assets/index-Djm1st6N.css">
15
+ <script type="module" crossorigin src="./assets/index-BAzKj_9S.js"></script>
16
+ <link rel="stylesheet" crossorigin href="./assets/index--ev1Bjls.css">
17
17
  </head>
18
18
  <body>
19
19
  <div id="root"></div>
@@ -24,6 +24,7 @@ __export(schema_exports, {
24
24
  competitors: () => competitors,
25
25
  gaAiReferrals: () => gaAiReferrals,
26
26
  gaConnections: () => gaConnections,
27
+ gaSocialReferrals: () => gaSocialReferrals,
27
28
  gaTrafficSnapshots: () => gaTrafficSnapshots,
28
29
  gaTrafficSummaries: () => gaTrafficSummaries,
29
30
  googleConnections: () => googleConnections,
@@ -110,7 +111,10 @@ var querySnapshots = sqliteTable("query_snapshots", {
110
111
  createdAt: text("created_at").notNull()
111
112
  }, (table) => [
112
113
  index("idx_snapshots_run").on(table.runId),
113
- index("idx_snapshots_keyword").on(table.keywordId)
114
+ index("idx_snapshots_keyword").on(table.keywordId),
115
+ index("idx_snapshots_citation_state").on(table.citationState),
116
+ index("idx_snapshots_provider_model").on(table.provider, table.model),
117
+ index("idx_snapshots_location").on(table.location)
114
118
  ]);
115
119
  var auditLog = sqliteTable("audit_log", {
116
120
  id: text("id").primaryKey(),
@@ -315,6 +319,22 @@ var gaAiReferrals = sqliteTable("ga_ai_referrals", {
315
319
  index("idx_ga_ai_ref_source").on(table.source),
316
320
  uniqueIndex("idx_ga_ai_ref_unique_v2").on(table.projectId, table.date, table.source, table.medium, table.sourceDimension)
317
321
  ]);
322
+ var gaSocialReferrals = sqliteTable("ga_social_referrals", {
323
+ id: text("id").primaryKey(),
324
+ projectId: text("project_id").notNull().references(() => projects.id, { onDelete: "cascade" }),
325
+ date: text("date").notNull(),
326
+ source: text("source").notNull(),
327
+ medium: text("medium").notNull(),
328
+ /** GA4 default channel group (e.g. 'Organic Social', 'Paid Social') */
329
+ channelGroup: text("channel_group").notNull().default("Organic Social"),
330
+ sessions: integer("sessions").notNull().default(0),
331
+ users: integer("users").notNull().default(0),
332
+ syncedAt: text("synced_at").notNull()
333
+ }, (table) => [
334
+ index("idx_ga_social_ref_project_date").on(table.projectId, table.date),
335
+ index("idx_ga_social_ref_source").on(table.source),
336
+ uniqueIndex("idx_ga_social_ref_unique").on(table.projectId, table.date, table.source, table.medium, table.channelGroup)
337
+ ]);
318
338
  var gaTrafficSummaries = sqliteTable("ga_traffic_summaries", {
319
339
  id: text("id").primaryKey(),
320
340
  projectId: text("project_id").notNull().references(() => projects.id, { onDelete: "cascade" }),
@@ -759,7 +779,23 @@ var MIGRATIONS = [
759
779
  `ALTER TABLE insights ADD COLUMN run_id TEXT REFERENCES runs(id) ON DELETE CASCADE`,
760
780
  `CREATE INDEX IF NOT EXISTS idx_insights_run ON insights(run_id)`,
761
781
  `ALTER TABLE health_snapshots ADD COLUMN run_id TEXT REFERENCES runs(id) ON DELETE CASCADE`,
762
- `CREATE INDEX IF NOT EXISTS idx_health_snapshots_run ON health_snapshots(run_id)`
782
+ `CREATE INDEX IF NOT EXISTS idx_health_snapshots_run ON health_snapshots(run_id)`,
783
+ // v25: Social media referral tracking — ga_social_referrals table
784
+ // Uses GA4's native sessionDefaultChannelGroup for social classification
785
+ `CREATE TABLE IF NOT EXISTS ga_social_referrals (
786
+ id TEXT PRIMARY KEY,
787
+ project_id TEXT NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
788
+ date TEXT NOT NULL,
789
+ source TEXT NOT NULL,
790
+ medium TEXT NOT NULL,
791
+ channel_group TEXT NOT NULL DEFAULT 'Organic Social',
792
+ sessions INTEGER NOT NULL DEFAULT 0,
793
+ users INTEGER NOT NULL DEFAULT 0,
794
+ synced_at TEXT NOT NULL
795
+ )`,
796
+ `CREATE INDEX IF NOT EXISTS idx_ga_social_ref_project_date ON ga_social_referrals(project_id, date)`,
797
+ `CREATE INDEX IF NOT EXISTS idx_ga_social_ref_source ON ga_social_referrals(source)`,
798
+ `CREATE UNIQUE INDEX IF NOT EXISTS idx_ga_social_ref_unique ON ga_social_referrals(project_id, date, source, medium, channel_group)`
763
799
  ];
764
800
  function isDuplicateColumnError(err) {
765
801
  if (!(err instanceof Error)) return false;
@@ -1206,6 +1242,7 @@ export {
1206
1242
  bingUrlInspections,
1207
1243
  gaTrafficSnapshots,
1208
1244
  gaAiReferrals,
1245
+ gaSocialReferrals,
1209
1246
  gaTrafficSummaries,
1210
1247
  usageCounters,
1211
1248
  insights,