@ainyc/canonry 1.45.1 → 1.45.2

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,7 +12,7 @@
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-BsF7MVAu.js"></script>
15
+ <script type="module" crossorigin src="./assets/index-Dh9YyROK.js"></script>
16
16
  <link rel="stylesheet" crossorigin href="./assets/index--ev1Bjls.css">
17
17
  </head>
18
18
  <body>
@@ -238,13 +238,15 @@ var gscCoverageSnapshots = sqliteTable("gsc_coverage_snapshots", {
238
238
  var bingCoverageSnapshots = sqliteTable("bing_coverage_snapshots", {
239
239
  id: text("id").primaryKey(),
240
240
  projectId: text("project_id").notNull().references(() => projects.id, { onDelete: "cascade" }),
241
+ syncRunId: text("sync_run_id").references(() => runs.id, { onDelete: "cascade" }),
241
242
  date: text("date").notNull(),
242
243
  indexed: integer("indexed").notNull().default(0),
243
244
  notIndexed: integer("not_indexed").notNull().default(0),
244
245
  unknown: integer("unknown").notNull().default(0),
245
246
  createdAt: text("created_at").notNull()
246
247
  }, (table) => [
247
- uniqueIndex("idx_bing_coverage_snap_project_date").on(table.projectId, table.date)
248
+ uniqueIndex("idx_bing_coverage_snap_project_date_unique").on(table.projectId, table.date),
249
+ index("idx_bing_coverage_snap_run").on(table.syncRunId)
248
250
  ]);
249
251
  var bingConnections = sqliteTable("bing_connections", {
250
252
  id: text("id").primaryKey(),
@@ -264,13 +266,15 @@ var bingUrlInspections = sqliteTable("bing_url_inspections", {
264
266
  lastCrawledDate: text("last_crawled_date"),
265
267
  inIndexDate: text("in_index_date"),
266
268
  inspectedAt: text("inspected_at").notNull(),
269
+ syncRunId: text("sync_run_id").references(() => runs.id, { onDelete: "cascade" }),
267
270
  createdAt: text("created_at").notNull(),
268
271
  documentSize: integer("document_size"),
269
272
  anchorCount: integer("anchor_count"),
270
273
  discoveryDate: text("discovery_date")
271
274
  }, (table) => [
272
275
  index("idx_bing_inspect_project_url").on(table.projectId, table.url),
273
- index("idx_bing_inspect_url_time").on(table.url, table.inspectedAt)
276
+ index("idx_bing_inspect_url_time").on(table.url, table.inspectedAt),
277
+ index("idx_bing_inspect_run").on(table.syncRunId)
274
278
  ]);
275
279
  var bingKeywordStats = sqliteTable("bing_keyword_stats", {
276
280
  id: text("id").primaryKey(),
@@ -304,10 +308,12 @@ var gaTrafficSnapshots = sqliteTable("ga_traffic_snapshots", {
304
308
  sessions: integer("sessions").notNull().default(0),
305
309
  organicSessions: integer("organic_sessions").notNull().default(0),
306
310
  users: integer("users").notNull().default(0),
307
- syncedAt: text("synced_at").notNull()
311
+ syncedAt: text("synced_at").notNull(),
312
+ syncRunId: text("sync_run_id").references(() => runs.id, { onDelete: "cascade" })
308
313
  }, (table) => [
309
314
  index("idx_ga_traffic_project_date").on(table.projectId, table.date),
310
- index("idx_ga_traffic_page").on(table.landingPage)
315
+ index("idx_ga_traffic_page").on(table.landingPage),
316
+ index("idx_ga_traffic_run").on(table.syncRunId)
311
317
  ]);
312
318
  var gaAiReferrals = sqliteTable("ga_ai_referrals", {
313
319
  id: text("id").primaryKey(),
@@ -319,11 +325,13 @@ var gaAiReferrals = sqliteTable("ga_ai_referrals", {
319
325
  sourceDimension: text("source_dimension").notNull().default("session"),
320
326
  sessions: integer("sessions").notNull().default(0),
321
327
  users: integer("users").notNull().default(0),
322
- syncedAt: text("synced_at").notNull()
328
+ syncedAt: text("synced_at").notNull(),
329
+ syncRunId: text("sync_run_id").references(() => runs.id, { onDelete: "cascade" })
323
330
  }, (table) => [
324
331
  index("idx_ga_ai_ref_project_date").on(table.projectId, table.date),
325
332
  index("idx_ga_ai_ref_source").on(table.source),
326
- uniqueIndex("idx_ga_ai_ref_unique_v2").on(table.projectId, table.date, table.source, table.medium, table.sourceDimension)
333
+ uniqueIndex("idx_ga_ai_ref_unique_v2").on(table.projectId, table.date, table.source, table.medium, table.sourceDimension),
334
+ index("idx_ga_ai_ref_run").on(table.syncRunId)
327
335
  ]);
328
336
  var gaSocialReferrals = sqliteTable("ga_social_referrals", {
329
337
  id: text("id").primaryKey(),
@@ -335,11 +343,13 @@ var gaSocialReferrals = sqliteTable("ga_social_referrals", {
335
343
  channelGroup: text("channel_group").notNull().default("Organic Social"),
336
344
  sessions: integer("sessions").notNull().default(0),
337
345
  users: integer("users").notNull().default(0),
338
- syncedAt: text("synced_at").notNull()
346
+ syncedAt: text("synced_at").notNull(),
347
+ syncRunId: text("sync_run_id").references(() => runs.id, { onDelete: "cascade" })
339
348
  }, (table) => [
340
349
  index("idx_ga_social_ref_project_date").on(table.projectId, table.date),
341
350
  index("idx_ga_social_ref_source").on(table.source),
342
- uniqueIndex("idx_ga_social_ref_unique").on(table.projectId, table.date, table.source, table.medium, table.channelGroup)
351
+ uniqueIndex("idx_ga_social_ref_unique").on(table.projectId, table.date, table.source, table.medium, table.channelGroup),
352
+ index("idx_ga_social_ref_run").on(table.syncRunId)
343
353
  ]);
344
354
  var gaTrafficSummaries = sqliteTable("ga_traffic_summaries", {
345
355
  id: text("id").primaryKey(),
@@ -349,9 +359,11 @@ var gaTrafficSummaries = sqliteTable("ga_traffic_summaries", {
349
359
  totalSessions: integer("total_sessions").notNull().default(0),
350
360
  totalOrganicSessions: integer("total_organic_sessions").notNull().default(0),
351
361
  totalUsers: integer("total_users").notNull().default(0),
352
- syncedAt: text("synced_at").notNull()
362
+ syncedAt: text("synced_at").notNull(),
363
+ syncRunId: text("sync_run_id").references(() => runs.id, { onDelete: "cascade" })
353
364
  }, (table) => [
354
- index("idx_ga_summary_project").on(table.projectId)
365
+ index("idx_ga_summary_project").on(table.projectId),
366
+ index("idx_ga_summary_run").on(table.syncRunId)
355
367
  ]);
356
368
  var usageCounters = sqliteTable("usage_counters", {
357
369
  id: text("id").primaryKey(),
@@ -812,11 +824,31 @@ var MIGRATIONS = [
812
824
  unknown INTEGER NOT NULL DEFAULT 0,
813
825
  created_at TEXT NOT NULL
814
826
  )`,
815
- `CREATE UNIQUE INDEX IF NOT EXISTS idx_bing_coverage_snap_project_date ON bing_coverage_snapshots(project_id, date)`
827
+ `CREATE UNIQUE INDEX IF NOT EXISTS idx_bing_coverage_snap_project_date ON bing_coverage_snapshots(project_id, date)`,
816
828
  // v27: Credential columns removed from Drizzle schema — credentials now live in config.yaml.
817
829
  // Physical columns (access_token, refresh_token, token_expires_at on google_connections;
818
830
  // private_key on ga_connections) intentionally retained in DB for one-time migration in server.ts.
819
- // SQLite does not support DROP COLUMN; no SQL to execute.
831
+ // v28: Add sync_run_id to bing_url_inspections for tracking sync correlation
832
+ `ALTER TABLE bing_url_inspections ADD COLUMN sync_run_id TEXT REFERENCES runs(id) ON DELETE CASCADE`,
833
+ `CREATE INDEX IF NOT EXISTS idx_bing_inspect_run ON bing_url_inspections(sync_run_id)`,
834
+ // v29: Add sync_run_id to ga_traffic_snapshots for tracking sync correlation
835
+ `ALTER TABLE ga_traffic_snapshots ADD COLUMN sync_run_id TEXT REFERENCES runs(id) ON DELETE CASCADE`,
836
+ `CREATE INDEX IF NOT EXISTS idx_ga_traffic_run ON ga_traffic_snapshots(sync_run_id)`,
837
+ // v30: Add sync_run_id to ga_ai_referrals for tracking sync correlation
838
+ `ALTER TABLE ga_ai_referrals ADD COLUMN sync_run_id TEXT REFERENCES runs(id) ON DELETE CASCADE`,
839
+ `CREATE INDEX IF NOT EXISTS idx_ga_ai_ref_run ON ga_ai_referrals(sync_run_id)`,
840
+ // v31: Add sync_run_id to ga_social_referrals for tracking sync correlation
841
+ `ALTER TABLE ga_social_referrals ADD COLUMN sync_run_id TEXT REFERENCES runs(id) ON DELETE CASCADE`,
842
+ `CREATE INDEX IF NOT EXISTS idx_ga_social_ref_run ON ga_social_referrals(sync_run_id)`,
843
+ // v32: Add sync_run_id to ga_traffic_summaries for tracking sync correlation
844
+ `ALTER TABLE ga_traffic_summaries ADD COLUMN sync_run_id TEXT REFERENCES runs(id) ON DELETE CASCADE`,
845
+ `CREATE INDEX IF NOT EXISTS idx_ga_summary_run ON ga_traffic_summaries(sync_run_id)`,
846
+ // v33: Add sync_run_id to bing_coverage_snapshots for tracking sync correlation
847
+ `ALTER TABLE bing_coverage_snapshots ADD COLUMN sync_run_id TEXT REFERENCES runs(id) ON DELETE CASCADE`,
848
+ `CREATE INDEX IF NOT EXISTS idx_bing_coverage_snap_run ON bing_coverage_snapshots(sync_run_id)`,
849
+ // v34: Rename unique index for bing_coverage_snapshots to follow convention
850
+ `DROP INDEX IF EXISTS idx_bing_coverage_snap_project_date`,
851
+ `CREATE UNIQUE INDEX IF NOT EXISTS idx_bing_coverage_snap_project_date_unique ON bing_coverage_snapshots(project_id, date)`
820
852
  ];
821
853
  function isDuplicateColumnError(err) {
822
854
  if (!(err instanceof Error)) return false;