@ainyc/canonry 1.45.0 → 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>
@@ -175,10 +175,6 @@ var googleConnections = sqliteTable("google_connections", {
175
175
  connectionType: text("connection_type").notNull(),
176
176
  propertyId: text("property_id"),
177
177
  sitemapUrl: text("sitemap_url"),
178
- // WARNING: Authentication material should be stored in config.yaml per CLAUDE.md
179
- accessToken: text("access_token"),
180
- refreshToken: text("refresh_token"),
181
- tokenExpiresAt: text("token_expires_at"),
182
178
  scopes: text("scopes").notNull().default("[]"),
183
179
  createdAt: text("created_at").notNull(),
184
180
  updatedAt: text("updated_at").notNull()
@@ -242,13 +238,15 @@ var gscCoverageSnapshots = sqliteTable("gsc_coverage_snapshots", {
242
238
  var bingCoverageSnapshots = sqliteTable("bing_coverage_snapshots", {
243
239
  id: text("id").primaryKey(),
244
240
  projectId: text("project_id").notNull().references(() => projects.id, { onDelete: "cascade" }),
241
+ syncRunId: text("sync_run_id").references(() => runs.id, { onDelete: "cascade" }),
245
242
  date: text("date").notNull(),
246
243
  indexed: integer("indexed").notNull().default(0),
247
244
  notIndexed: integer("not_indexed").notNull().default(0),
248
245
  unknown: integer("unknown").notNull().default(0),
249
246
  createdAt: text("created_at").notNull()
250
247
  }, (table) => [
251
- 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)
252
250
  ]);
253
251
  var bingConnections = sqliteTable("bing_connections", {
254
252
  id: text("id").primaryKey(),
@@ -268,13 +266,15 @@ var bingUrlInspections = sqliteTable("bing_url_inspections", {
268
266
  lastCrawledDate: text("last_crawled_date"),
269
267
  inIndexDate: text("in_index_date"),
270
268
  inspectedAt: text("inspected_at").notNull(),
269
+ syncRunId: text("sync_run_id").references(() => runs.id, { onDelete: "cascade" }),
271
270
  createdAt: text("created_at").notNull(),
272
271
  documentSize: integer("document_size"),
273
272
  anchorCount: integer("anchor_count"),
274
273
  discoveryDate: text("discovery_date")
275
274
  }, (table) => [
276
275
  index("idx_bing_inspect_project_url").on(table.projectId, table.url),
277
- 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)
278
278
  ]);
279
279
  var bingKeywordStats = sqliteTable("bing_keyword_stats", {
280
280
  id: text("id").primaryKey(),
@@ -295,8 +295,6 @@ var gaConnections = sqliteTable("ga_connections", {
295
295
  projectId: text("project_id").notNull().references(() => projects.id, { onDelete: "cascade" }),
296
296
  propertyId: text("property_id").notNull(),
297
297
  clientEmail: text("client_email").notNull(),
298
- // WARNING: Authentication material should be stored in config.yaml per CLAUDE.md
299
- privateKey: text("private_key").notNull(),
300
298
  createdAt: text("created_at").notNull(),
301
299
  updatedAt: text("updated_at").notNull()
302
300
  }, (table) => [
@@ -310,10 +308,12 @@ var gaTrafficSnapshots = sqliteTable("ga_traffic_snapshots", {
310
308
  sessions: integer("sessions").notNull().default(0),
311
309
  organicSessions: integer("organic_sessions").notNull().default(0),
312
310
  users: integer("users").notNull().default(0),
313
- syncedAt: text("synced_at").notNull()
311
+ syncedAt: text("synced_at").notNull(),
312
+ syncRunId: text("sync_run_id").references(() => runs.id, { onDelete: "cascade" })
314
313
  }, (table) => [
315
314
  index("idx_ga_traffic_project_date").on(table.projectId, table.date),
316
- 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)
317
317
  ]);
318
318
  var gaAiReferrals = sqliteTable("ga_ai_referrals", {
319
319
  id: text("id").primaryKey(),
@@ -325,11 +325,13 @@ var gaAiReferrals = sqliteTable("ga_ai_referrals", {
325
325
  sourceDimension: text("source_dimension").notNull().default("session"),
326
326
  sessions: integer("sessions").notNull().default(0),
327
327
  users: integer("users").notNull().default(0),
328
- syncedAt: text("synced_at").notNull()
328
+ syncedAt: text("synced_at").notNull(),
329
+ syncRunId: text("sync_run_id").references(() => runs.id, { onDelete: "cascade" })
329
330
  }, (table) => [
330
331
  index("idx_ga_ai_ref_project_date").on(table.projectId, table.date),
331
332
  index("idx_ga_ai_ref_source").on(table.source),
332
- 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)
333
335
  ]);
334
336
  var gaSocialReferrals = sqliteTable("ga_social_referrals", {
335
337
  id: text("id").primaryKey(),
@@ -341,11 +343,13 @@ var gaSocialReferrals = sqliteTable("ga_social_referrals", {
341
343
  channelGroup: text("channel_group").notNull().default("Organic Social"),
342
344
  sessions: integer("sessions").notNull().default(0),
343
345
  users: integer("users").notNull().default(0),
344
- syncedAt: text("synced_at").notNull()
346
+ syncedAt: text("synced_at").notNull(),
347
+ syncRunId: text("sync_run_id").references(() => runs.id, { onDelete: "cascade" })
345
348
  }, (table) => [
346
349
  index("idx_ga_social_ref_project_date").on(table.projectId, table.date),
347
350
  index("idx_ga_social_ref_source").on(table.source),
348
- 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)
349
353
  ]);
350
354
  var gaTrafficSummaries = sqliteTable("ga_traffic_summaries", {
351
355
  id: text("id").primaryKey(),
@@ -355,9 +359,11 @@ var gaTrafficSummaries = sqliteTable("ga_traffic_summaries", {
355
359
  totalSessions: integer("total_sessions").notNull().default(0),
356
360
  totalOrganicSessions: integer("total_organic_sessions").notNull().default(0),
357
361
  totalUsers: integer("total_users").notNull().default(0),
358
- syncedAt: text("synced_at").notNull()
362
+ syncedAt: text("synced_at").notNull(),
363
+ syncRunId: text("sync_run_id").references(() => runs.id, { onDelete: "cascade" })
359
364
  }, (table) => [
360
- 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)
361
367
  ]);
362
368
  var usageCounters = sqliteTable("usage_counters", {
363
369
  id: text("id").primaryKey(),
@@ -818,7 +824,31 @@ var MIGRATIONS = [
818
824
  unknown INTEGER NOT NULL DEFAULT 0,
819
825
  created_at TEXT NOT NULL
820
826
  )`,
821
- `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)`,
828
+ // v27: Credential columns removed from Drizzle schema — credentials now live in config.yaml.
829
+ // Physical columns (access_token, refresh_token, token_expires_at on google_connections;
830
+ // private_key on ga_connections) intentionally retained in DB for one-time migration in server.ts.
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)`
822
852
  ];
823
853
  function isDuplicateColumnError(err) {
824
854
  if (!(err instanceof Error)) return false;