@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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"surfaces.d.ts","sourceRoot":"","sources":["../../src/sqlite/surfaces.ts"],"names":[],"mappings":"AAUA,6FAA6F;AAE7F,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBlB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAcvB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EActB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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uniqueIndex, } from "drizzle-orm/sqlite-core";
2
+ import { sites } from "./schema.js";
3
+ /** Phase 9 — AI visibility, local, off-page, verticals. Dual-dialect with pg/surfaces.ts. */
4
+ export const aiRuns = sqliteTable("ai_runs", {
5
+ id: text("id").primaryKey(),
6
+ siteId: text("site_id")
7
+ .notNull()
8
+ .references(() => sites.id, { onDelete: "cascade" }),
9
+ engine: text("engine").notNull(),
10
+ promptCount: integer("prompt_count").notNull().default(0),
11
+ citationShare: real("citation_share").notNull().default(0),
12
+ shareOfVoice: real("share_of_voice").notNull().default(0),
13
+ estimatedUsd: real("estimated_usd").notNull().default(0),
14
+ ranAt: text("ran_at").notNull(),
15
+ }, (t) => [
16
+ index("ai_runs_site_idx").on(t.siteId),
17
+ index("ai_runs_ran_idx").on(t.siteId, t.ranAt),
18
+ ]);
19
+ export const aiCitations = sqliteTable("ai_citations", {
20
+ id: text("id").primaryKey(),
21
+ runId: text("run_id")
22
+ .notNull()
23
+ .references(() => aiRuns.id, { onDelete: "cascade" }),
24
+ engine: text("engine").notNull(),
25
+ prompt: text("prompt").notNull(),
26
+ citedUrl: text("cited_url"),
27
+ citedDomain: text("cited_domain"),
28
+ isOurs: integer("is_ours").notNull().default(0),
29
+ }, (t) => [index("ai_citations_run_idx").on(t.runId)]);
30
+ export const bingAiRows = sqliteTable("bing_ai_rows", {
31
+ id: text("id").primaryKey(),
32
+ siteId: text("site_id")
33
+ .notNull()
34
+ .references(() => sites.id, { onDelete: "cascade" }),
35
+ date: text("date").notNull(),
36
+ groundingQuery: text("grounding_query").notNull(),
37
+ citations: integer("citations").notNull().default(0),
38
+ citationShare: real("citation_share").notNull().default(0),
39
+ source: text("source").notNull().default("csv"),
40
+ }, (t) => [index("bing_ai_rows_site_idx").on(t.siteId)]);
41
+ export const gbpLocations = sqliteTable("gbp_locations", {
42
+ id: text("id").primaryKey(),
43
+ siteId: text("site_id")
44
+ .notNull()
45
+ .references(() => sites.id, { onDelete: "cascade" }),
46
+ locationName: text("location_name").notNull(),
47
+ title: text("title"),
48
+ primaryCategory: text("primary_category"),
49
+ placeId: text("place_id"),
50
+ approvalStatus: text("approval_status").notNull().default("none"),
51
+ verifiedAt: text("verified_at"),
52
+ }, (t) => [index("gbp_locations_site_idx").on(t.siteId)]);
53
+ export const gbpEdits = sqliteTable("gbp_edits", {
54
+ id: text("id").primaryKey(),
55
+ siteId: text("site_id")
56
+ .notNull()
57
+ .references(() => sites.id, { onDelete: "cascade" }),
58
+ locationId: text("location_id").notNull(),
59
+ kind: text("kind").notNull(),
60
+ payload: text("payload").notNull().default("{}"),
61
+ appliedAt: text("applied_at").notNull(),
62
+ }, (t) => [index("gbp_edits_loc_idx").on(t.locationId, t.appliedAt)]);
63
+ export const mentions = sqliteTable("mentions", {
64
+ id: text("id").primaryKey(),
65
+ siteId: text("site_id")
66
+ .notNull()
67
+ .references(() => sites.id, { onDelete: "cascade" }),
68
+ url: text("url").notNull(),
69
+ snippet: text("snippet").notNull(),
70
+ linked: integer("linked").notNull().default(0),
71
+ score: real("score").notNull().default(0),
72
+ kind: text("kind").notNull(),
73
+ createdAt: text("created_at").notNull(),
74
+ }, (t) => [
75
+ index("mentions_site_idx").on(t.siteId),
76
+ uniqueIndex("mentions_uidx").on(t.siteId, t.url, t.kind),
77
+ ]);
78
+ export const inbound404s = sqliteTable("inbound_404s", {
79
+ id: text("id").primaryKey(),
80
+ siteId: text("site_id")
81
+ .notNull()
82
+ .references(() => sites.id, { onDelete: "cascade" }),
83
+ sourceUrl: text("source_url").notNull(),
84
+ targetUrl: text("target_url").notNull(),
85
+ status: integer("status"),
86
+ createdAt: text("created_at").notNull(),
87
+ }, (t) => [index("inbound_404s_site_idx").on(t.siteId)]);
88
+ export const outreachDrafts = sqliteTable("outreach_drafts", {
89
+ id: text("id").primaryKey(),
90
+ siteId: text("site_id")
91
+ .notNull()
92
+ .references(() => sites.id, { onDelete: "cascade" }),
93
+ mentionId: text("mention_id"),
94
+ toEmail: text("to_email"),
95
+ subject: text("subject").notNull(),
96
+ body: text("body").notNull(),
97
+ state: text("state").notNull().default("draft"),
98
+ createdAt: text("created_at").notNull(),
99
+ }, (t) => [index("outreach_drafts_site_idx").on(t.siteId, t.state)]);
100
+ export const verticalProfiles = sqliteTable("vertical_profiles", {
101
+ id: text("id").primaryKey(),
102
+ siteId: text("site_id")
103
+ .notNull()
104
+ .references(() => sites.id, { onDelete: "cascade" }),
105
+ preset: text("preset").notNull(),
106
+ confidence: real("confidence").notNull().default(0),
107
+ signalsJson: text("signals_json").notNull().default("[]"),
108
+ answersJson: text("answers_json").notNull().default("{}"),
109
+ suppressedChecks: integer("suppressed_checks").notNull().default(0),
110
+ updatedAt: text("updated_at").notNull(),
111
+ }, (t) => [uniqueIndex("vertical_profiles_site_uidx").on(t.siteId)]);
112
+ //# sourceMappingURL=surfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"surfaces.js","sourceRoot":"","sources":["../../src/sqlite/surfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,WAAW,GACZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,6FAA6F;AAE7F,MAAM,CAAC,MAAM,MAAM,GAAG,WAAW,CAC/B,SAAS,EACT;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,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE;IAChC,WAAW,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACzD,aAAa,EAAE,IAAI,CAAC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C;IACtD,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE;IAChC,UAAU,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACnD,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IACzD,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IACzD,gBAAgB,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACnE,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE;CACxC,EACD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,6BAA6B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CACjE,CAAC"}
@@ -0,0 +1,30 @@
1
+ /** Phase 0 core tables. Adding a table means adding it to both dialects. */
2
+ export declare const CORE_TABLES: readonly ["sites", "crawls", "pages", "page_snapshots", "findings", "actions", "changes", "change_snapshots", "credentials", "cost_ledger", "jobs", "settings", "audit_log"];
3
+ /** Phase 2 Google connection + first-party data tables. */
4
+ export declare const GOOGLE_TABLES: readonly ["gsc_connections", "ga4_connections", "gsc_daily", "gsc_page_daily", "gsc_query_daily", "gsc_url_inspections", "ga4_daily", "ga4_landing_daily", "crux_records", "psi_audits", "google_incidents", "google_changepoints", "gsc_ga4_reconciliation", "site_verifications", "quota_usage"];
5
+ /** Phase 3 Action-system tables. */
6
+ export declare const ACTION_TABLES: readonly ["adapter_connections", "url_allowlist", "entity_sightings", "two_key_approvals"];
7
+ /** Phase 4 dashboard snapshots. FTS5 is SQLite-only and lives outside drizzle. */
8
+ export declare const DASHBOARD_TABLES: readonly ["reports"];
9
+ /** Phase 5 content engine. */
10
+ export declare const CONTENT_TABLES: readonly ["style_profiles", "content_briefs", "content_drafts", "publish_gate_results"];
11
+ /** Phase 6 keywords, ranks, provider quotes. */
12
+ export declare const KEYWORD_TABLES: readonly ["keywords", "keyword_clusters", "rank_snapshots", "serp_cache", "provider_quotes", "embedding_cache"];
13
+ /** Phase 7 experiments, claims, GA4↔GSC waterfall. */
14
+ export declare const MEASURE_TABLES: readonly ["experiments", "cohorts", "cohort_members", "experiment_results", "data_anomalies", "claims", "reconciliation_waterfall"];
15
+ /** Phase 10 hosted tenants, billing, isolation. */
16
+ export declare const HOSTED_TABLES: readonly ["tenants", "tenant_seats", "tenant_sites", "subscriptions", "stripe_events", "metered_usage", "envelope_keys", "quota_windows", "erasure_requests", "connector_pairings"];
17
+ /** Phase 9 AI visibility, local, off-page, verticals. */
18
+ export declare const SURFACE_TABLES: readonly ["ai_runs", "ai_citations", "bing_ai_rows", "gbp_locations", "gbp_edits", "mentions", "inbound_404s", "outreach_drafts", "vertical_profiles"];
19
+ export declare const ALL_TABLES: readonly ["sites", "crawls", "pages", "page_snapshots", "findings", "actions", "changes", "change_snapshots", "credentials", "cost_ledger", "jobs", "settings", "audit_log", "gsc_connections", "ga4_connections", "gsc_daily", "gsc_page_daily", "gsc_query_daily", "gsc_url_inspections", "ga4_daily", "ga4_landing_daily", "crux_records", "psi_audits", "google_incidents", "google_changepoints", "gsc_ga4_reconciliation", "site_verifications", "quota_usage", "adapter_connections", "url_allowlist", "entity_sightings", "two_key_approvals", "reports", "style_profiles", "content_briefs", "content_drafts", "publish_gate_results", "keywords", "keyword_clusters", "rank_snapshots", "serp_cache", "provider_quotes", "embedding_cache", "experiments", "cohorts", "cohort_members", "experiment_results", "data_anomalies", "claims", "reconciliation_waterfall", "ai_runs", "ai_citations", "bing_ai_rows", "gbp_locations", "gbp_edits", "mentions", "inbound_404s", "outreach_drafts", "vertical_profiles", "tenants", "tenant_seats", "tenant_sites", "subscriptions", "stripe_events", "metered_usage", "envelope_keys", "quota_windows", "erasure_requests", "connector_pairings"];
20
+ export type CoreTable = (typeof CORE_TABLES)[number];
21
+ export type GoogleTable = (typeof GOOGLE_TABLES)[number];
22
+ export type ActionTable = (typeof ACTION_TABLES)[number];
23
+ export type DashboardTable = (typeof DASHBOARD_TABLES)[number];
24
+ export type ContentTable = (typeof CONTENT_TABLES)[number];
25
+ export type KeywordTable = (typeof KEYWORD_TABLES)[number];
26
+ export type MeasureTable = (typeof MEASURE_TABLES)[number];
27
+ export type SurfaceTable = (typeof SURFACE_TABLES)[number];
28
+ export type HostedTable = (typeof HOSTED_TABLES)[number];
29
+ export type AppTable = (typeof ALL_TABLES)[number];
30
+ //# sourceMappingURL=tables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../src/tables.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,eAAO,MAAM,WAAW,8KAcd,CAAC;AAEX,2DAA2D;AAC3D,eAAO,MAAM,aAAa,oSAgBhB,CAAC;AAEX,oCAAoC;AACpC,eAAO,MAAM,aAAa,4FAKhB,CAAC;AAEX,kFAAkF;AAClF,eAAO,MAAM,gBAAgB,sBAAuB,CAAC;AAErD,8BAA8B;AAC9B,eAAO,MAAM,cAAc,yFAKjB,CAAC;AAEX,gDAAgD;AAChD,eAAO,MAAM,cAAc,iHAOjB,CAAC;AAEX,sDAAsD;AACtD,eAAO,MAAM,cAAc,qIAQjB,CAAC;AAEX,mDAAmD;AACnD,eAAO,MAAM,aAAa,qLAWhB,CAAC;AAEX,yDAAyD;AACzD,eAAO,MAAM,cAAc,wJAUjB,CAAC;AAEX,eAAO,MAAM,UAAU,woCAUb,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AACrD,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AACzD,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AACzD,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAC/D,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAC3D,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAC3D,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAC3D,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAC3D,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AACzD,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC"}
package/dist/tables.js ADDED
@@ -0,0 +1,106 @@
1
+ /** Phase 0 core tables. Adding a table means adding it to both dialects. */
2
+ export const CORE_TABLES = [
3
+ "sites",
4
+ "crawls",
5
+ "pages",
6
+ "page_snapshots",
7
+ "findings",
8
+ "actions",
9
+ "changes",
10
+ "change_snapshots",
11
+ "credentials",
12
+ "cost_ledger",
13
+ "jobs",
14
+ "settings",
15
+ "audit_log",
16
+ ];
17
+ /** Phase 2 Google connection + first-party data tables. */
18
+ export const GOOGLE_TABLES = [
19
+ "gsc_connections",
20
+ "ga4_connections",
21
+ "gsc_daily",
22
+ "gsc_page_daily",
23
+ "gsc_query_daily",
24
+ "gsc_url_inspections",
25
+ "ga4_daily",
26
+ "ga4_landing_daily",
27
+ "crux_records",
28
+ "psi_audits",
29
+ "google_incidents",
30
+ "google_changepoints",
31
+ "gsc_ga4_reconciliation",
32
+ "site_verifications",
33
+ "quota_usage",
34
+ ];
35
+ /** Phase 3 Action-system tables. */
36
+ export const ACTION_TABLES = [
37
+ "adapter_connections",
38
+ "url_allowlist",
39
+ "entity_sightings",
40
+ "two_key_approvals",
41
+ ];
42
+ /** Phase 4 dashboard snapshots. FTS5 is SQLite-only and lives outside drizzle. */
43
+ export const DASHBOARD_TABLES = ["reports"];
44
+ /** Phase 5 content engine. */
45
+ export const CONTENT_TABLES = [
46
+ "style_profiles",
47
+ "content_briefs",
48
+ "content_drafts",
49
+ "publish_gate_results",
50
+ ];
51
+ /** Phase 6 keywords, ranks, provider quotes. */
52
+ export const KEYWORD_TABLES = [
53
+ "keywords",
54
+ "keyword_clusters",
55
+ "rank_snapshots",
56
+ "serp_cache",
57
+ "provider_quotes",
58
+ "embedding_cache",
59
+ ];
60
+ /** Phase 7 experiments, claims, GA4↔GSC waterfall. */
61
+ export const MEASURE_TABLES = [
62
+ "experiments",
63
+ "cohorts",
64
+ "cohort_members",
65
+ "experiment_results",
66
+ "data_anomalies",
67
+ "claims",
68
+ "reconciliation_waterfall",
69
+ ];
70
+ /** Phase 10 hosted tenants, billing, isolation. */
71
+ export const HOSTED_TABLES = [
72
+ "tenants",
73
+ "tenant_seats",
74
+ "tenant_sites",
75
+ "subscriptions",
76
+ "stripe_events",
77
+ "metered_usage",
78
+ "envelope_keys",
79
+ "quota_windows",
80
+ "erasure_requests",
81
+ "connector_pairings",
82
+ ];
83
+ /** Phase 9 AI visibility, local, off-page, verticals. */
84
+ export const SURFACE_TABLES = [
85
+ "ai_runs",
86
+ "ai_citations",
87
+ "bing_ai_rows",
88
+ "gbp_locations",
89
+ "gbp_edits",
90
+ "mentions",
91
+ "inbound_404s",
92
+ "outreach_drafts",
93
+ "vertical_profiles",
94
+ ];
95
+ export const ALL_TABLES = [
96
+ ...CORE_TABLES,
97
+ ...GOOGLE_TABLES,
98
+ ...ACTION_TABLES,
99
+ ...DASHBOARD_TABLES,
100
+ ...CONTENT_TABLES,
101
+ ...KEYWORD_TABLES,
102
+ ...MEASURE_TABLES,
103
+ ...SURFACE_TABLES,
104
+ ...HOSTED_TABLES,
105
+ ];
106
+ //# sourceMappingURL=tables.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tables.js","sourceRoot":"","sources":["../src/tables.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,OAAO;IACP,QAAQ;IACR,OAAO;IACP,gBAAgB;IAChB,UAAU;IACV,SAAS;IACT,SAAS;IACT,kBAAkB;IAClB,aAAa;IACb,aAAa;IACb,MAAM;IACN,UAAU;IACV,WAAW;CACH,CAAC;AAEX,2DAA2D;AAC3D,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,iBAAiB;IACjB,iBAAiB;IACjB,WAAW;IACX,gBAAgB;IAChB,iBAAiB;IACjB,qBAAqB;IACrB,WAAW;IACX,mBAAmB;IACnB,cAAc;IACd,YAAY;IACZ,kBAAkB;IAClB,qBAAqB;IACrB,wBAAwB;IACxB,oBAAoB;IACpB,aAAa;CACL,CAAC;AAEX,oCAAoC;AACpC,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,qBAAqB;IACrB,eAAe;IACf,kBAAkB;IAClB,mBAAmB;CACX,CAAC;AAEX,kFAAkF;AAClF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,SAAS,CAAU,CAAC;AAErD,8BAA8B;AAC9B,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,sBAAsB;CACd,CAAC;AAEX,gDAAgD;AAChD,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,UAAU;IACV,kBAAkB;IAClB,gBAAgB;IAChB,YAAY;IACZ,iBAAiB;IACjB,iBAAiB;CACT,CAAC;AAEX,sDAAsD;AACtD,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,aAAa;IACb,SAAS;IACT,gBAAgB;IAChB,oBAAoB;IACpB,gBAAgB;IAChB,QAAQ;IACR,0BAA0B;CAClB,CAAC;AAEX,mDAAmD;AACnD,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,SAAS;IACT,cAAc;IACd,cAAc;IACd,eAAe;IACf,eAAe;IACf,eAAe;IACf,eAAe;IACf,eAAe;IACf,kBAAkB;IAClB,oBAAoB;CACZ,CAAC;AAEX,yDAAyD;AACzD,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,SAAS;IACT,cAAc;IACd,cAAc;IACd,eAAe;IACf,WAAW;IACX,UAAU;IACV,cAAc;IACd,iBAAiB;IACjB,mBAAmB;CACX,CAAC;AAEX,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,GAAG,WAAW;IACd,GAAG,aAAa;IAChB,GAAG,aAAa;IAChB,GAAG,gBAAgB;IACnB,GAAG,cAAc;IACjB,GAAG,cAAc;IACjB,GAAG,cAAc;IACjB,GAAG,cAAc;IACjB,GAAG,aAAa;CACR,CAAC"}
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@agentsean/db",
3
+ "version": "1.0.0",
4
+ "license": "AGPL-3.0-only",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./dist/index.js"
10
+ }
11
+ },
12
+ "files": [
13
+ "dist"
14
+ ],
15
+ "engines": {
16
+ "node": ">=22.19.0"
17
+ },
18
+ "dependencies": {
19
+ "better-sqlite3": "13.0.3",
20
+ "drizzle-orm": "0.45.2"
21
+ },
22
+ "devDependencies": {
23
+ "@types/better-sqlite3": "^9.6.0",
24
+ "typescript": "~5.9.3",
25
+ "vitest": "^4.1.11"
26
+ },
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "git+https://github.com/seziro-team/agentsean.git",
33
+ "directory": "packages/db"
34
+ },
35
+ "homepage": "https://github.com/seziro-team/agentsean#readme",
36
+ "bugs": {
37
+ "url": "https://github.com/seziro-team/agentsean/issues"
38
+ },
39
+ "author": "Seziro (https://seziro.com)",
40
+ "description": "Agent Sean — db module",
41
+ "keywords": [
42
+ "seo",
43
+ "agent",
44
+ "agentsean",
45
+ "seo-automation"
46
+ ],
47
+ "scripts": {
48
+ "build": "tsc -p tsconfig.json",
49
+ "typecheck": "tsc -p tsconfig.json --noEmit",
50
+ "test": "vitest run --config ../../vitest.config.ts"
51
+ }
52
+ }