@agentsean/db 1.0.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.
Files changed (98) hide show
  1. package/LICENSE +661 -0
  2. package/dist/client.d.ts +13 -0
  3. package/dist/client.d.ts.map +1 -0
  4. package/dist/client.js +48 -0
  5. package/dist/client.js.map +1 -0
  6. package/dist/fts.d.ts +31 -0
  7. package/dist/fts.d.ts.map +1 -0
  8. package/dist/fts.js +69 -0
  9. package/dist/fts.js.map +1 -0
  10. package/dist/index.d.ts +7 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +7 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/pg/actions.d.ts +404 -0
  15. package/dist/pg/actions.d.ts.map +1 -0
  16. package/dist/pg/actions.js +54 -0
  17. package/dist/pg/actions.js.map +1 -0
  18. package/dist/pg/content.d.ts +642 -0
  19. package/dist/pg/content.d.ts.map +1 -0
  20. package/dist/pg/content.js +65 -0
  21. package/dist/pg/content.js.map +1 -0
  22. package/dist/pg/google.d.ts +2657 -0
  23. package/dist/pg/google.d.ts.map +1 -0
  24. package/dist/pg/google.js +250 -0
  25. package/dist/pg/google.js.map +1 -0
  26. package/dist/pg/hosted.d.ts +1075 -0
  27. package/dist/pg/hosted.d.ts.map +1 -0
  28. package/dist/pg/hosted.js +106 -0
  29. package/dist/pg/hosted.js.map +1 -0
  30. package/dist/pg/keywords.d.ts +962 -0
  31. package/dist/pg/keywords.d.ts.map +1 -0
  32. package/dist/pg/keywords.js +89 -0
  33. package/dist/pg/keywords.js.map +1 -0
  34. package/dist/pg/measure.d.ts +1343 -0
  35. package/dist/pg/measure.d.ts.map +1 -0
  36. package/dist/pg/measure.js +128 -0
  37. package/dist/pg/measure.js.map +1 -0
  38. package/dist/pg/schema.d.ts +2589 -0
  39. package/dist/pg/schema.d.ts.map +1 -0
  40. package/dist/pg/schema.js +243 -0
  41. package/dist/pg/schema.js.map +1 -0
  42. package/dist/pg/surfaces.d.ts +1187 -0
  43. package/dist/pg/surfaces.d.ts.map +1 -0
  44. package/dist/pg/surfaces.js +112 -0
  45. package/dist/pg/surfaces.js.map +1 -0
  46. package/dist/pg/vector.d.ts +4 -0
  47. package/dist/pg/vector.d.ts.map +1 -0
  48. package/dist/pg/vector.js +12 -0
  49. package/dist/pg/vector.js.map +1 -0
  50. package/dist/provider.d.ts +3 -0
  51. package/dist/provider.d.ts.map +1 -0
  52. package/dist/provider.js +7 -0
  53. package/dist/provider.js.map +1 -0
  54. package/dist/schema.d.ts +11770 -0
  55. package/dist/schema.d.ts.map +1 -0
  56. package/dist/schema.js +9 -0
  57. package/dist/schema.js.map +1 -0
  58. package/dist/sqlite/actions.d.ts +448 -0
  59. package/dist/sqlite/actions.d.ts.map +1 -0
  60. package/dist/sqlite/actions.js +54 -0
  61. package/dist/sqlite/actions.js.map +1 -0
  62. package/dist/sqlite/content.d.ts +708 -0
  63. package/dist/sqlite/content.d.ts.map +1 -0
  64. package/dist/sqlite/content.js +65 -0
  65. package/dist/sqlite/content.js.map +1 -0
  66. package/dist/sqlite/google.d.ts +2885 -0
  67. package/dist/sqlite/google.d.ts.map +1 -0
  68. package/dist/sqlite/google.js +250 -0
  69. package/dist/sqlite/google.js.map +1 -0
  70. package/dist/sqlite/hosted.d.ts +1183 -0
  71. package/dist/sqlite/hosted.d.ts.map +1 -0
  72. package/dist/sqlite/hosted.js +106 -0
  73. package/dist/sqlite/hosted.js.map +1 -0
  74. package/dist/sqlite/init-sql.d.ts +3 -0
  75. package/dist/sqlite/init-sql.d.ts.map +1 -0
  76. package/dist/sqlite/init-sql.js +963 -0
  77. package/dist/sqlite/init-sql.js.map +1 -0
  78. package/dist/sqlite/keywords.d.ts +1038 -0
  79. package/dist/sqlite/keywords.d.ts.map +1 -0
  80. package/dist/sqlite/keywords.js +89 -0
  81. package/dist/sqlite/keywords.js.map +1 -0
  82. package/dist/sqlite/measure.d.ts +1451 -0
  83. package/dist/sqlite/measure.d.ts.map +1 -0
  84. package/dist/sqlite/measure.js +128 -0
  85. package/dist/sqlite/measure.js.map +1 -0
  86. package/dist/sqlite/schema.d.ts +2849 -0
  87. package/dist/sqlite/schema.d.ts.map +1 -0
  88. package/dist/sqlite/schema.js +243 -0
  89. package/dist/sqlite/schema.js.map +1 -0
  90. package/dist/sqlite/surfaces.d.ts +1295 -0
  91. package/dist/sqlite/surfaces.d.ts.map +1 -0
  92. package/dist/sqlite/surfaces.js +112 -0
  93. package/dist/sqlite/surfaces.js.map +1 -0
  94. package/dist/tables.d.ts +30 -0
  95. package/dist/tables.d.ts.map +1 -0
  96. package/dist/tables.js +106 -0
  97. package/dist/tables.js.map +1 -0
  98. package/package.json +52 -0
package/dist/client.js ADDED
@@ -0,0 +1,48 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import Database from "better-sqlite3";
4
+ import { drizzle } from "drizzle-orm/better-sqlite3";
5
+ import * as sqliteSchema from "./sqlite/schema.js";
6
+ import { SQLITE_INIT_SQL } from "./sqlite/init-sql.js";
7
+ import { backfillFindingsFts } from "./fts.js";
8
+ export function applySqliteSchema(sqlite) {
9
+ sqlite.exec(SQLITE_INIT_SQL);
10
+ try {
11
+ backfillFindingsFts(sqlite);
12
+ }
13
+ catch {
14
+ // FTS5 is optional on exotic builds; search falls back to LIKE.
15
+ }
16
+ }
17
+ export function openSqlite(filePath, options) {
18
+ if (filePath !== ":memory:") {
19
+ fs.mkdirSync(path.dirname(filePath), { recursive: true, mode: 0o700 });
20
+ }
21
+ const sqlite = new Database(filePath, {
22
+ readonly: options?.readonly ?? false,
23
+ fileMustExist: false,
24
+ });
25
+ if (filePath !== ":memory:") {
26
+ try {
27
+ fs.chmodSync(filePath, 0o600);
28
+ }
29
+ catch {
30
+ // chmod can fail on Windows; the 0600 check is Linux/macOS.
31
+ }
32
+ }
33
+ sqlite.pragma("journal_mode = WAL");
34
+ sqlite.pragma("foreign_keys = ON");
35
+ sqlite.pragma("busy_timeout = 5000");
36
+ applySqliteSchema(sqlite);
37
+ const db = drizzle(sqlite, { schema: sqliteSchema });
38
+ return { sqlite, db };
39
+ }
40
+ export function assertDbNotWorldReadable(filePath) {
41
+ if (filePath === ":memory:" || process.platform === "win32")
42
+ return;
43
+ const mode = fs.statSync(filePath).mode & 0o777;
44
+ if (mode & 0o077) {
45
+ throw new Error(`Refusing to use ${filePath}: mode ${mode.toString(8)} is group/world-readable. Expected 0600.`);
46
+ }
47
+ }
48
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAI/C,MAAM,UAAU,iBAAiB,CAAC,MAAyB;IACzD,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC7B,IAAI,CAAC;QACH,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACP,gEAAgE;IAClE,CAAC;AACH,CAAC;AAED,MAAM,UAAU,UAAU,CACxB,QAAgB,EAChB,OAA4C;IAK5C,IAAI,QAAQ,KAAK,UAAU,EAAE,CAAC;QAC5B,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACzE,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,QAAQ,EAAE;QACpC,QAAQ,EAAE,OAAO,EAAE,QAAQ,IAAI,KAAK;QACpC,aAAa,EAAE,KAAK;KACrB,CAAC,CAAC;IACH,IAAI,QAAQ,KAAK,UAAU,EAAE,CAAC;QAC5B,IAAI,CAAC;YACH,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAChC,CAAC;QAAC,MAAM,CAAC;YACP,4DAA4D;QAC9D,CAAC;IACH,CAAC;IACD,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;IACpC,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;IACnC,MAAM,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;IACrC,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC1B,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC;IACrD,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,QAAgB;IACvD,IAAI,QAAQ,KAAK,UAAU,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO;QAAE,OAAO;IACpE,MAAM,IAAI,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC;IAChD,IAAI,IAAI,GAAG,KAAK,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CACb,mBAAmB,QAAQ,UAAU,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,0CAA0C,CAChG,CAAC;IACJ,CAAC;AACH,CAAC"}
package/dist/fts.d.ts ADDED
@@ -0,0 +1,31 @@
1
+ import type Database from "better-sqlite3";
2
+ export type FindingSearchQuery = {
3
+ siteId?: string | undefined;
4
+ q: string;
5
+ severity?: string | undefined;
6
+ autonomyTier?: string | undefined;
7
+ status?: string | undefined;
8
+ limit: number;
9
+ /** Keyset: first_detected_at,id from the previous page. */
10
+ cursor?: {
11
+ detectedAt: string;
12
+ id: string;
13
+ } | undefined;
14
+ };
15
+ export type FindingSearchHit = {
16
+ id: string;
17
+ siteId: string;
18
+ pageId: string | null;
19
+ ruleId: string;
20
+ severity: string;
21
+ autonomyTier: string;
22
+ title: string;
23
+ explanation: string | null;
24
+ status: string;
25
+ firstDetectedAt: string;
26
+ };
27
+ /** FTS5 MATCH query: alphanumeric tokens, AND, prefix. Empty if nothing searchable. */
28
+ export declare function ftsMatchQuery(raw: string): string | null;
29
+ export declare function searchFindingsFts(sqlite: Database.Database, query: FindingSearchQuery): FindingSearchHit[];
30
+ export declare function backfillFindingsFts(sqlite: Database.Database): void;
31
+ //# sourceMappingURL=fts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fts.d.ts","sourceRoot":"","sources":["../src/fts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAE3C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,MAAM,CAAC,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;CACzD,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,uFAAuF;AACvF,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CASxD;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,QAAQ,CAAC,QAAQ,EACzB,KAAK,EAAE,kBAAkB,GACxB,gBAAgB,EAAE,CAiDpB;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAOnE"}
package/dist/fts.js ADDED
@@ -0,0 +1,69 @@
1
+ /** FTS5 MATCH query: alphanumeric tokens, AND, prefix. Empty if nothing searchable. */
2
+ export function ftsMatchQuery(raw) {
3
+ const tokens = raw
4
+ .trim()
5
+ .split(/\s+/)
6
+ .map((t) => t.replace(/[^\p{L}\p{N}_-]+/gu, ""))
7
+ .filter((t) => t.length > 0)
8
+ .slice(0, 12);
9
+ if (tokens.length === 0)
10
+ return null;
11
+ return tokens.map((t) => `${t}*`).join(" AND ");
12
+ }
13
+ export function searchFindingsFts(sqlite, query) {
14
+ const match = ftsMatchQuery(query.q);
15
+ const limit = Math.min(Math.max(1, query.limit), 200);
16
+ const params = [];
17
+ const where = [];
18
+ if (match) {
19
+ where.push("findings_fts MATCH ?");
20
+ params.push(match);
21
+ }
22
+ if (query.siteId) {
23
+ where.push("f.site_id = ?");
24
+ params.push(query.siteId);
25
+ }
26
+ if (query.severity) {
27
+ where.push("f.severity = ?");
28
+ params.push(query.severity);
29
+ }
30
+ if (query.autonomyTier) {
31
+ where.push("f.autonomy_tier = ?");
32
+ params.push(query.autonomyTier);
33
+ }
34
+ if (query.status) {
35
+ where.push("f.status = ?");
36
+ params.push(query.status);
37
+ }
38
+ if (query.cursor) {
39
+ where.push("(f.first_detected_at < ? OR (f.first_detected_at = ? AND f.id < ?))");
40
+ params.push(query.cursor.detectedAt, query.cursor.detectedAt, query.cursor.id);
41
+ }
42
+ const sql = match
43
+ ? `SELECT f.id, f.site_id AS siteId, f.page_id AS pageId, f.rule_id AS ruleId,
44
+ f.severity, f.autonomy_tier AS autonomyTier, f.title, f.explanation,
45
+ f.status, f.first_detected_at AS firstDetectedAt
46
+ FROM findings_fts
47
+ JOIN findings f ON f.id = findings_fts.id
48
+ ${where.length ? `WHERE ${where.join(" AND ")}` : ""}
49
+ ORDER BY f.first_detected_at DESC, f.id DESC
50
+ LIMIT ?`
51
+ : `SELECT f.id, f.site_id AS siteId, f.page_id AS pageId, f.rule_id AS ruleId,
52
+ f.severity, f.autonomy_tier AS autonomyTier, f.title, f.explanation,
53
+ f.status, f.first_detected_at AS firstDetectedAt
54
+ FROM findings f
55
+ ${where.length ? `WHERE ${where.join(" AND ")}` : ""}
56
+ ORDER BY f.first_detected_at DESC, f.id DESC
57
+ LIMIT ?`;
58
+ params.push(limit);
59
+ return sqlite.prepare(sql).all(...params);
60
+ }
61
+ export function backfillFindingsFts(sqlite) {
62
+ sqlite.exec(`
63
+ INSERT INTO findings_fts(id, title, explanation, rule_id)
64
+ SELECT f.id, f.title, f.explanation, f.rule_id
65
+ FROM findings f
66
+ WHERE NOT EXISTS (SELECT 1 FROM findings_fts x WHERE x.id = f.id);
67
+ `);
68
+ }
69
+ //# sourceMappingURL=fts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fts.js","sourceRoot":"","sources":["../src/fts.ts"],"names":[],"mappings":"AA0BA,uFAAuF;AACvF,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,MAAM,MAAM,GAAG,GAAG;SACf,IAAI,EAAE;SACN,KAAK,CAAC,KAAK,CAAC;SACZ,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC;SAC/C,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAA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AI,KAAK,CAAC,MAAM,EAAE,CAAC;QACjB,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC3B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IACD,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QACjB,KAAK,CAAC,IAAI,CAAC,qEAAqE,CAAC,CAAC;QAClF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACjF,CAAC;IAED,MAAM,GAAG,GAAG,KAAK;QACf,CAAC,CAAC;;;;;SAKG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;;eAE5C;QACX,CAAC,CAAC;;;;SAIG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;;eAE5C,CAAC;IACd,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnB,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,MAAM,CAAuB,CAAC;AAClE,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,MAAyB;IAC3D,MAAM,CAAC,IAAI,CAAC;;;;;GAKX,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { getDatabaseProvider, type DatabaseProvider } from "./provider.js";
2
+ export { CORE_TABLES, GOOGLE_TABLES, ACTION_TABLES, DASHBOARD_TABLES, CONTENT_TABLES, KEYWORD_TABLES, MEASURE_TABLES, SURFACE_TABLES, HOSTED_TABLES, ALL_TABLES, type CoreTable, type GoogleTable, type ActionTable, type DashboardTable, type ContentTable, type KeywordTable, type MeasureTable, type SurfaceTable, type HostedTable, type AppTable, } from "./tables.js";
3
+ export { sites, crawls, pages, pageSnapshots, findings, actions, changes, changeSnapshots, credentials, costLedger, jobs, settings, auditLog, gscConnections, ga4Connections, gscDaily, gscPageDaily, gscQueryDaily, gscUrlInspections, ga4Daily, ga4LandingDaily, cruxRecords, psiAudits, googleIncidents, googleChangepoints, gscGa4Reconciliation, siteVerifications, quotaUsage, adapterConnections, urlAllowlist, entitySightings, twoKeyApprovals, reports, styleProfiles, contentBriefs, contentDrafts, publishGateResults, keywords, keywordClusters, rankSnapshots, serpCache, providerQuotes, embeddingCache, experiments, cohorts, cohortMembers, experimentResults, dataAnomalies, claims, reconciliationWaterfall, aiRuns, aiCitations, bingAiRows, gbpLocations, gbpEdits, mentions, inbound404s, outreachDrafts, verticalProfiles, tenants, tenantSeats, tenantSites, subscriptions, stripeEvents, meteredUsage, envelopeKeys, quotaWindows, erasureRequests, connectorPairings, sqliteSchema, pgSchema, } from "./schema.js";
4
+ export { openSqlite, applySqliteSchema, assertDbNotWorldReadable, type SqliteDatabase, } from "./client.js";
5
+ export { searchFindingsFts, type FindingSearchHit, type FindingSearchQuery, } from "./fts.js";
6
+ export { PGVECTOR_EXTENSION_SQL, pgvectorIndexSql } from "./pg/vector.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EACL,WAAW,EACX,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,aAAa,EACb,UAAU,EACV,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB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atabaseProvider } from "./provider.js";
2
+ export { CORE_TABLES, GOOGLE_TABLES, ACTION_TABLES, DASHBOARD_TABLES, CONTENT_TABLES, KEYWORD_TABLES, MEASURE_TABLES, SURFACE_TABLES, HOSTED_TABLES, ALL_TABLES, } from "./tables.js";
3
+ export { sites, crawls, pages, pageSnapshots, findings, actions, changes, changeSnapshots, credentials, costLedger, jobs, settings, auditLog, gscConnections, ga4Connections, gscDaily, gscPageDaily, gscQueryDaily, gscUrlInspections, ga4Daily, ga4LandingDaily, cruxRecords, psiAudits, googleIncidents, googleChangepoints, gscGa4Reconciliation, siteVerifications, quotaUsage, adapterConnections, urlAllowlist, entitySightings, twoKeyApprovals, reports, styleProfiles, contentBriefs, contentDrafts, publishGateResults, keywords, keywordClusters, rankSnapshots, serpCache, providerQuotes, embeddingCache, experiments, cohorts, cohortMembers, experimentResults, dataAnomalies, claims, reconciliationWaterfall, aiRuns, aiCitations, bingAiRows, gbpLocations, gbpEdits, mentions, inbound404s, outreachDrafts, verticalProfiles, tenants, tenantSeats, tenantSites, subscriptions, stripeEvents, meteredUsage, envelopeKeys, quotaWindows, erasureRequests, connectorPairings, sqliteSchema, pgSchema, } from "./schema.js";
4
+ export { openSqlite, applySqliteSchema, assertDbNotWorldReadable, } from "./client.js";
5
+ export { searchFindingsFts, } from "./fts.js";
6
+ export { PGVECTOR_EXTENSION_SQL, pgvectorIndexSql } from "./pg/vector.js";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAyB,MAAM,eAAe,CAAC;AAC3E,OAAO,EACL,WAAW,EACX,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,aAAa,EACb,UAAU,GAWX,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,EACL,MAAM,EACN,KAAK,EACL,aAAa,EACb,QAAQ,EACR,OAAO,EACP,OAAO,EACP,eAAe,EACf,WAAW,EACX,UAAU,EACV,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,QAAQ,EACR,eAAe,EACf,WAAW,EACX,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,UAAU,EACV,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,eAAe,EACf,OAAO,EACP,aAAa,EACb,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,QAAQ,EACR,eAAe,EACf,aAAa,EACb,SAAS,EACT,cAAc,EACd,cAAc,EACd,WAAW,EACX,OAAO,EACP,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,MAAM,EACN,uBAAuB,EACvB,MAAM,EACN,WAAW,EACX,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,OAAO,EACP,WAAW,EACX,WAAW,EACX,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,QAAQ,GACT,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,wBAAwB,GAEzB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,iBAAiB,GAGlB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,404 @@
1
+ /** Phase 3 — Action system support tables. Dual-dialect with sqlite/actions.ts. */
2
+ export declare const adapterConnections: import("drizzle-orm/pg-core").PgTableWithColumns<{
3
+ name: "adapter_connections";
4
+ schema: undefined;
5
+ columns: {
6
+ id: import("drizzle-orm/pg-core").PgColumn<{
7
+ name: "id";
8
+ tableName: "adapter_connections";
9
+ dataType: "string";
10
+ columnType: "PgText";
11
+ data: string;
12
+ driverParam: string;
13
+ notNull: true;
14
+ hasDefault: false;
15
+ isPrimaryKey: true;
16
+ isAutoincrement: false;
17
+ hasRuntimeDefault: false;
18
+ enumValues: [string, ...string[]];
19
+ baseColumn: never;
20
+ identity: undefined;
21
+ generated: undefined;
22
+ }, {}, {}>;
23
+ siteId: import("drizzle-orm/pg-core").PgColumn<{
24
+ name: "site_id";
25
+ tableName: "adapter_connections";
26
+ dataType: "string";
27
+ columnType: "PgText";
28
+ data: string;
29
+ driverParam: string;
30
+ notNull: true;
31
+ hasDefault: false;
32
+ isPrimaryKey: false;
33
+ isAutoincrement: false;
34
+ hasRuntimeDefault: false;
35
+ enumValues: [string, ...string[]];
36
+ baseColumn: never;
37
+ identity: undefined;
38
+ generated: undefined;
39
+ }, {}, {}>;
40
+ kind: import("drizzle-orm/pg-core").PgColumn<{
41
+ name: "kind";
42
+ tableName: "adapter_connections";
43
+ dataType: "string";
44
+ columnType: "PgText";
45
+ data: string;
46
+ driverParam: string;
47
+ notNull: true;
48
+ hasDefault: false;
49
+ isPrimaryKey: false;
50
+ isAutoincrement: false;
51
+ hasRuntimeDefault: false;
52
+ enumValues: [string, ...string[]];
53
+ baseColumn: never;
54
+ identity: undefined;
55
+ generated: undefined;
56
+ }, {}, {}>;
57
+ config: import("drizzle-orm/pg-core").PgColumn<{
58
+ name: "config";
59
+ tableName: "adapter_connections";
60
+ dataType: "string";
61
+ columnType: "PgText";
62
+ data: string;
63
+ driverParam: string;
64
+ notNull: true;
65
+ hasDefault: false;
66
+ isPrimaryKey: false;
67
+ isAutoincrement: false;
68
+ hasRuntimeDefault: false;
69
+ enumValues: [string, ...string[]];
70
+ baseColumn: never;
71
+ identity: undefined;
72
+ generated: undefined;
73
+ }, {}, {}>;
74
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
75
+ name: "created_at";
76
+ tableName: "adapter_connections";
77
+ dataType: "string";
78
+ columnType: "PgText";
79
+ data: string;
80
+ driverParam: string;
81
+ notNull: true;
82
+ hasDefault: false;
83
+ isPrimaryKey: false;
84
+ isAutoincrement: false;
85
+ hasRuntimeDefault: false;
86
+ enumValues: [string, ...string[]];
87
+ baseColumn: never;
88
+ identity: undefined;
89
+ generated: undefined;
90
+ }, {}, {}>;
91
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
92
+ name: "updated_at";
93
+ tableName: "adapter_connections";
94
+ dataType: "string";
95
+ columnType: "PgText";
96
+ data: string;
97
+ driverParam: string;
98
+ notNull: true;
99
+ hasDefault: false;
100
+ isPrimaryKey: false;
101
+ isAutoincrement: false;
102
+ hasRuntimeDefault: false;
103
+ enumValues: [string, ...string[]];
104
+ baseColumn: never;
105
+ identity: undefined;
106
+ generated: undefined;
107
+ }, {}, {}>;
108
+ };
109
+ dialect: "pg";
110
+ }>;
111
+ export declare const urlAllowlist: import("drizzle-orm/pg-core").PgTableWithColumns<{
112
+ name: "url_allowlist";
113
+ schema: undefined;
114
+ columns: {
115
+ id: import("drizzle-orm/pg-core").PgColumn<{
116
+ name: "id";
117
+ tableName: "url_allowlist";
118
+ dataType: "string";
119
+ columnType: "PgText";
120
+ data: string;
121
+ driverParam: string;
122
+ notNull: true;
123
+ hasDefault: false;
124
+ isPrimaryKey: true;
125
+ isAutoincrement: false;
126
+ hasRuntimeDefault: false;
127
+ enumValues: [string, ...string[]];
128
+ baseColumn: never;
129
+ identity: undefined;
130
+ generated: undefined;
131
+ }, {}, {}>;
132
+ siteId: import("drizzle-orm/pg-core").PgColumn<{
133
+ name: "site_id";
134
+ tableName: "url_allowlist";
135
+ dataType: "string";
136
+ columnType: "PgText";
137
+ data: string;
138
+ driverParam: string;
139
+ notNull: true;
140
+ hasDefault: false;
141
+ isPrimaryKey: false;
142
+ isAutoincrement: false;
143
+ hasRuntimeDefault: false;
144
+ enumValues: [string, ...string[]];
145
+ baseColumn: never;
146
+ identity: undefined;
147
+ generated: undefined;
148
+ }, {}, {}>;
149
+ url: import("drizzle-orm/pg-core").PgColumn<{
150
+ name: "url";
151
+ tableName: "url_allowlist";
152
+ dataType: "string";
153
+ columnType: "PgText";
154
+ data: string;
155
+ driverParam: string;
156
+ notNull: true;
157
+ hasDefault: false;
158
+ isPrimaryKey: false;
159
+ isAutoincrement: false;
160
+ hasRuntimeDefault: false;
161
+ enumValues: [string, ...string[]];
162
+ baseColumn: never;
163
+ identity: undefined;
164
+ generated: undefined;
165
+ }, {}, {}>;
166
+ addedBy: import("drizzle-orm/pg-core").PgColumn<{
167
+ name: "added_by";
168
+ tableName: "url_allowlist";
169
+ dataType: "string";
170
+ columnType: "PgText";
171
+ data: string;
172
+ driverParam: string;
173
+ notNull: true;
174
+ hasDefault: false;
175
+ isPrimaryKey: false;
176
+ isAutoincrement: false;
177
+ hasRuntimeDefault: false;
178
+ enumValues: [string, ...string[]];
179
+ baseColumn: never;
180
+ identity: undefined;
181
+ generated: undefined;
182
+ }, {}, {}>;
183
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
184
+ name: "created_at";
185
+ tableName: "url_allowlist";
186
+ dataType: "string";
187
+ columnType: "PgText";
188
+ data: string;
189
+ driverParam: string;
190
+ notNull: true;
191
+ hasDefault: false;
192
+ isPrimaryKey: false;
193
+ isAutoincrement: false;
194
+ hasRuntimeDefault: false;
195
+ enumValues: [string, ...string[]];
196
+ baseColumn: never;
197
+ identity: undefined;
198
+ generated: undefined;
199
+ }, {}, {}>;
200
+ };
201
+ dialect: "pg";
202
+ }>;
203
+ export declare const entitySightings: import("drizzle-orm/pg-core").PgTableWithColumns<{
204
+ name: "entity_sightings";
205
+ schema: undefined;
206
+ columns: {
207
+ id: import("drizzle-orm/pg-core").PgColumn<{
208
+ name: "id";
209
+ tableName: "entity_sightings";
210
+ dataType: "string";
211
+ columnType: "PgText";
212
+ data: string;
213
+ driverParam: string;
214
+ notNull: true;
215
+ hasDefault: false;
216
+ isPrimaryKey: true;
217
+ isAutoincrement: false;
218
+ hasRuntimeDefault: false;
219
+ enumValues: [string, ...string[]];
220
+ baseColumn: never;
221
+ identity: undefined;
222
+ generated: undefined;
223
+ }, {}, {}>;
224
+ siteId: import("drizzle-orm/pg-core").PgColumn<{
225
+ name: "site_id";
226
+ tableName: "entity_sightings";
227
+ dataType: "string";
228
+ columnType: "PgText";
229
+ data: string;
230
+ driverParam: string;
231
+ notNull: true;
232
+ hasDefault: false;
233
+ isPrimaryKey: false;
234
+ isAutoincrement: false;
235
+ hasRuntimeDefault: false;
236
+ enumValues: [string, ...string[]];
237
+ baseColumn: never;
238
+ identity: undefined;
239
+ generated: undefined;
240
+ }, {}, {}>;
241
+ entity: import("drizzle-orm/pg-core").PgColumn<{
242
+ name: "entity";
243
+ tableName: "entity_sightings";
244
+ dataType: "string";
245
+ columnType: "PgText";
246
+ data: string;
247
+ driverParam: string;
248
+ notNull: true;
249
+ hasDefault: false;
250
+ isPrimaryKey: false;
251
+ isAutoincrement: false;
252
+ hasRuntimeDefault: false;
253
+ enumValues: [string, ...string[]];
254
+ baseColumn: never;
255
+ identity: undefined;
256
+ generated: undefined;
257
+ }, {}, {}>;
258
+ entityKind: import("drizzle-orm/pg-core").PgColumn<{
259
+ name: "entity_kind";
260
+ tableName: "entity_sightings";
261
+ dataType: "string";
262
+ columnType: "PgText";
263
+ data: string;
264
+ driverParam: string;
265
+ notNull: true;
266
+ hasDefault: false;
267
+ isPrimaryKey: false;
268
+ isAutoincrement: false;
269
+ hasRuntimeDefault: false;
270
+ enumValues: [string, ...string[]];
271
+ baseColumn: never;
272
+ identity: undefined;
273
+ generated: undefined;
274
+ }, {}, {}>;
275
+ source: import("drizzle-orm/pg-core").PgColumn<{
276
+ name: "source";
277
+ tableName: "entity_sightings";
278
+ dataType: "string";
279
+ columnType: "PgText";
280
+ data: string;
281
+ driverParam: string;
282
+ notNull: true;
283
+ hasDefault: false;
284
+ isPrimaryKey: false;
285
+ isAutoincrement: false;
286
+ hasRuntimeDefault: false;
287
+ enumValues: [string, ...string[]];
288
+ baseColumn: never;
289
+ identity: undefined;
290
+ generated: undefined;
291
+ }, {}, {}>;
292
+ firstSeenAt: import("drizzle-orm/pg-core").PgColumn<{
293
+ name: "first_seen_at";
294
+ tableName: "entity_sightings";
295
+ dataType: "string";
296
+ columnType: "PgText";
297
+ data: string;
298
+ driverParam: string;
299
+ notNull: true;
300
+ hasDefault: false;
301
+ isPrimaryKey: false;
302
+ isAutoincrement: false;
303
+ hasRuntimeDefault: false;
304
+ enumValues: [string, ...string[]];
305
+ baseColumn: never;
306
+ identity: undefined;
307
+ generated: undefined;
308
+ }, {}, {}>;
309
+ };
310
+ dialect: "pg";
311
+ }>;
312
+ export declare const twoKeyApprovals: import("drizzle-orm/pg-core").PgTableWithColumns<{
313
+ name: "two_key_approvals";
314
+ schema: undefined;
315
+ columns: {
316
+ id: import("drizzle-orm/pg-core").PgColumn<{
317
+ name: "id";
318
+ tableName: "two_key_approvals";
319
+ dataType: "string";
320
+ columnType: "PgText";
321
+ data: string;
322
+ driverParam: string;
323
+ notNull: true;
324
+ hasDefault: false;
325
+ isPrimaryKey: true;
326
+ isAutoincrement: false;
327
+ hasRuntimeDefault: false;
328
+ enumValues: [string, ...string[]];
329
+ baseColumn: never;
330
+ identity: undefined;
331
+ generated: undefined;
332
+ }, {}, {}>;
333
+ actionId: import("drizzle-orm/pg-core").PgColumn<{
334
+ name: "action_id";
335
+ tableName: "two_key_approvals";
336
+ dataType: "string";
337
+ columnType: "PgText";
338
+ data: string;
339
+ driverParam: string;
340
+ notNull: true;
341
+ hasDefault: false;
342
+ isPrimaryKey: false;
343
+ isAutoincrement: false;
344
+ hasRuntimeDefault: false;
345
+ enumValues: [string, ...string[]];
346
+ baseColumn: never;
347
+ identity: undefined;
348
+ generated: undefined;
349
+ }, {}, {}>;
350
+ actor: import("drizzle-orm/pg-core").PgColumn<{
351
+ name: "actor";
352
+ tableName: "two_key_approvals";
353
+ dataType: "string";
354
+ columnType: "PgText";
355
+ data: string;
356
+ driverParam: string;
357
+ notNull: true;
358
+ hasDefault: false;
359
+ isPrimaryKey: false;
360
+ isAutoincrement: false;
361
+ hasRuntimeDefault: false;
362
+ enumValues: [string, ...string[]];
363
+ baseColumn: never;
364
+ identity: undefined;
365
+ generated: undefined;
366
+ }, {}, {}>;
367
+ hmac: import("drizzle-orm/pg-core").PgColumn<{
368
+ name: "hmac";
369
+ tableName: "two_key_approvals";
370
+ dataType: "string";
371
+ columnType: "PgText";
372
+ data: string;
373
+ driverParam: string;
374
+ notNull: true;
375
+ hasDefault: false;
376
+ isPrimaryKey: false;
377
+ isAutoincrement: false;
378
+ hasRuntimeDefault: false;
379
+ enumValues: [string, ...string[]];
380
+ baseColumn: never;
381
+ identity: undefined;
382
+ generated: undefined;
383
+ }, {}, {}>;
384
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
385
+ name: "created_at";
386
+ tableName: "two_key_approvals";
387
+ dataType: "string";
388
+ columnType: "PgText";
389
+ data: string;
390
+ driverParam: string;
391
+ notNull: true;
392
+ hasDefault: false;
393
+ isPrimaryKey: false;
394
+ isAutoincrement: false;
395
+ hasRuntimeDefault: false;
396
+ enumValues: [string, ...string[]];
397
+ baseColumn: never;
398
+ identity: undefined;
399
+ generated: undefined;
400
+ }, {}, {}>;
401
+ };
402
+ dialect: "pg";
403
+ }>;
404
+ //# sourceMappingURL=actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/pg/actions.ts"],"names":[],"mappings":"AAGA,mFAAmF;AAEnF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgB9B,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAexB,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgB3B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAe3B,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { index, pgTable, text, uniqueIndex } from "drizzle-orm/pg-core";
2
+ import { actions, sites } from "./schema.js";
3
+ /** Phase 3 — Action system support tables. Dual-dialect with sqlite/actions.ts. */
4
+ export const adapterConnections = pgTable("adapter_connections", {
5
+ id: text("id").primaryKey(),
6
+ siteId: text("site_id")
7
+ .notNull()
8
+ .references(() => sites.id, { onDelete: "cascade" }),
9
+ kind: text("kind").notNull(),
10
+ config: text("config").notNull(),
11
+ createdAt: text("created_at").notNull(),
12
+ updatedAt: text("updated_at").notNull(),
13
+ }, (t) => [
14
+ uniqueIndex("adapter_connections_site_kind_uidx").on(t.siteId, t.kind),
15
+ index("adapter_connections_site_idx").on(t.siteId),
16
+ ]);
17
+ export const urlAllowlist = pgTable("url_allowlist", {
18
+ id: text("id").primaryKey(),
19
+ siteId: text("site_id")
20
+ .notNull()
21
+ .references(() => sites.id, { onDelete: "cascade" }),
22
+ url: text("url").notNull(),
23
+ addedBy: text("added_by").notNull(),
24
+ createdAt: text("created_at").notNull(),
25
+ }, (t) => [
26
+ uniqueIndex("url_allowlist_site_url_uidx").on(t.siteId, t.url),
27
+ index("url_allowlist_site_idx").on(t.siteId),
28
+ ]);
29
+ export const entitySightings = pgTable("entity_sightings", {
30
+ id: text("id").primaryKey(),
31
+ siteId: text("site_id")
32
+ .notNull()
33
+ .references(() => sites.id, { onDelete: "cascade" }),
34
+ entity: text("entity").notNull(),
35
+ entityKind: text("entity_kind").notNull(),
36
+ source: text("source").notNull(),
37
+ firstSeenAt: text("first_seen_at").notNull(),
38
+ }, (t) => [
39
+ uniqueIndex("entity_sightings_site_entity_uidx").on(t.siteId, t.entity),
40
+ index("entity_sightings_site_source_idx").on(t.siteId, t.source),
41
+ ]);
42
+ export const twoKeyApprovals = pgTable("two_key_approvals", {
43
+ id: text("id").primaryKey(),
44
+ actionId: text("action_id")
45
+ .notNull()
46
+ .references(() => actions.id, { onDelete: "cascade" }),
47
+ actor: text("actor").notNull(),
48
+ hmac: text("hmac").notNull(),
49
+ createdAt: text("created_at").notNull(),
50
+ }, (t) => [
51
+ uniqueIndex("two_key_approvals_action_actor_uidx").on(t.actionId, t.actor),
52
+ index("two_key_approvals_action_idx").on(t.actionId),
53
+ ]);
54
+ //# sourceMappingURL=actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions.js","sourceRoot":"","sources":["../../src/pg/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAE7C,mFAAmF;AAEnF,MAAM,CAAC,MAAM,kBAAkB,GAAG,OAAO,CACvC,qBAAqB,EACrB;IACE,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE;IAC3B,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC;SACpB,OAAO,EAAE;SACT,UAAU,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IACtD,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE;IAC5B,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE;IAChC,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE;IACvC,S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