@fayz-ai/db 0.12.0 → 0.14.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 (84) hide show
  1. package/canonical-schema.json +132 -0
  2. package/dist/index.cjs +4 -4
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.ts +1 -1
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +4 -4
  7. package/dist/index.js.map +1 -1
  8. package/dist/schema/spine.d.ts +42 -37
  9. package/dist/schema/spine.d.ts.map +1 -1
  10. package/migrations/000_baseline.sql +29667 -0
  11. package/migrations/001_the_tenant_has_apps.sql +314 -0
  12. package/migrations/002_the_spine_drops_the_vendor_and_the_dead.sql +129 -0
  13. package/migrations/003_the_role_rpcs_finish_and_the_mirrors_go.sql +135 -0
  14. package/migrations/004_the_projections_get_a_successor.sql +312 -0
  15. package/migrations/005_the_archetypes_anchor_to_the_unit.sql +90 -0
  16. package/migrations/006_the_helpers_read_the_source.sql +153 -0
  17. package/migrations/007_the_compat_machinery_leaves_with_the_tables.sql +77 -0
  18. package/migrations/008_the_switchers_see_across_accounts.sql +150 -0
  19. package/migrations/009_the_compat_aliases_nobody_adopted.sql +57 -0
  20. package/migrations/010_the_new_tenant_is_born_with_its_trade.sql +201 -0
  21. package/migrations/011_leadcontrol_joins_the_family.sql +116 -0
  22. package/migrations/012_chefcontrol_wears_its_own_mark.sql +28 -0
  23. package/migrations/013_the_workspace_switch_reaches_the_other_half.sql +156 -0
  24. package/migrations/014_the_chooser_can_read_what_it_offers.sql +91 -0
  25. package/migrations/015_the_unit_bindings_belong_to_one_workspace.sql +86 -0
  26. package/migrations/016_the_rule_stops_asking_every_row.sql +543 -0
  27. package/migrations/017_the_pin_is_checked_against_the_right_workspace.sql +139 -0
  28. package/migrations/018_the_bootstrap_says_what_you_reach.sql +114 -0
  29. package/migrations/019_distributing_one_row_stops_costing_the_table.sql +245 -0
  30. package/migrations/020_the_agenda_asks_where_someone_works.sql +81 -0
  31. package/migrations/022_the_line_says_which_document_it_belongs_to.sql +109 -0
  32. package/package.json +3 -2
  33. package/migrations/0000_legacy_quarantine.sql +0 -86
  34. package/migrations/0000b_straggler_sweep.sql +0 -37
  35. package/migrations/000_core_v1_convert.sql +0 -343
  36. package/migrations/001_core.sql +0 -372
  37. package/migrations/002_rls_user_tenant_ids.sql +0 -64
  38. package/migrations/003_invitations.sql +0 -17
  39. package/migrations/004_archetypes.sql +0 -343
  40. package/migrations/005_locations_archetype.sql +0 -18
  41. package/migrations/006_archetype_rls.sql +0 -74
  42. package/migrations/007_archetype_grants.sql +0 -4
  43. package/migrations/008_grants.sql +0 -5
  44. package/migrations/009_anon_hardening.sql +0 -19
  45. package/migrations/010_migration_ledger.sql +0 -36
  46. package/migrations/011_anon_write_revoke.sql +0 -12
  47. package/migrations/012_rename_migration_ledger.sql +0 -61
  48. package/migrations/013_sequences_rls.sql +0 -22
  49. package/migrations/014_plan_entitlements.sql +0 -28
  50. package/migrations/015_agent_guard.sql +0 -108
  51. package/migrations/016_agent_guard_actor.sql +0 -102
  52. package/migrations/017_core_addresses.sql +0 -115
  53. package/migrations/018_global_search.sql +0 -482
  54. package/migrations/019_tenant_members_person_id.sql +0 -20
  55. package/migrations/020_fayz_projects.sql +0 -63
  56. package/migrations/021_tenant_roles.sql +0 -74
  57. package/migrations/022_invite_acceptance.sql +0 -91
  58. package/migrations/023_team_visibility.sql +0 -75
  59. package/migrations/024_analytics_engine.sql +0 -317
  60. package/migrations/025_created_by.sql +0 -75
  61. package/migrations/026_audit_trail.sql +0 -73
  62. package/migrations/027_domain_events.sql +0 -266
  63. package/migrations/028_tenant_scoped_token.sql +0 -127
  64. package/migrations/029_connections.sql +0 -186
  65. package/migrations/030_effect_idempotency.sql +0 -159
  66. package/migrations/031_sync_run_message.sql +0 -39
  67. package/migrations/032_connection_secrets.sql +0 -227
  68. package/migrations/033_sync_schedule.sql +0 -651
  69. package/migrations/034_custom_fields.sql +0 -55
  70. package/migrations/035_field_registry.sql +0 -148
  71. package/migrations/036_analytics_run_batch.sql +0 -84
  72. package/migrations/037_sync_tick_one_at_a_time.sql +0 -256
  73. package/migrations/038_onboarding_responses.sql +0 -103
  74. package/migrations/039_unit_tree.sql +0 -270
  75. package/migrations/040_resource_grants.sql +0 -474
  76. package/migrations/041_scoped_columns.sql +0 -192
  77. package/migrations/042_unit_scope_policies.sql +0 -145
  78. package/migrations/043_view_invoker.sql +0 -81
  79. package/migrations/044_unit_member_facts.sql +0 -47
  80. package/migrations/045_unit_entry.sql +0 -236
  81. package/migrations/046_membership_visible_to_members.sql +0 -85
  82. package/migrations/047_tasks.sql +0 -266
  83. package/migrations/048_every_login_is_a_person.sql +0 -190
  84. package/migrations/049_bookable_people.sql +0 -126
@@ -0,0 +1,132 @@
1
+ {
2
+ "$comment": "The canonical schema (#279, ADR 0022). ONE schema on every cluster: the spine plus every plugin that has passed the capability gate. The pool profiles in cli/pool-profiles/ stop deciding what a cluster HAS and become activation defaults — what a new tenant of that industry gets turned on, which is configuration and lives in the database (ADR 0023, migration 150). What varies per cluster is data, never DDL. A plugin joins `plugins` below when its gate is green; until then it is in `pending`, with the reason, and it exists in no cluster at all.",
3
+ "version": 1,
4
+ "plugins": [
5
+ {
6
+ "id": "financial",
7
+ "dir": "plugins/plugin-financial/src/migrations",
8
+ "gate": "capability",
9
+ "$note": "core-A. In three of the four live pools already."
10
+ },
11
+ {
12
+ "id": "inventory",
13
+ "dir": "plugins/plugin-inventory/src/migrations",
14
+ "gate": "capability",
15
+ "$note": "core-A. Sole writer of the stock archetype since #276."
16
+ },
17
+ {
18
+ "id": "tasks",
19
+ "dir": "plugins/plugin-tasks/src/migrations",
20
+ "gate": "enforced",
21
+ "$note": "The only plugin at ENFORCED — the reference implementation."
22
+ },
23
+ {
24
+ "id": "notifications",
25
+ "dir": "plugins/plugin-notifications/src/migrations",
26
+ "gate": "chain",
27
+ "$note": "Phase 2 / PRD 03. The engine dunning, appointment confirmation and every campaign share — it has to exist on every cluster for those flows to exist at all."
28
+ },
29
+ {
30
+ "id": "agenda",
31
+ "dir": "plugins/plugin-agenda/src/migrations",
32
+ "gate": "chain",
33
+ "$note": "Phase 2 / PRD 06. Booking → Venda → Título is one transaction now; the Google Calendar addon question (#285) is tracked separately and no longer blocks the schema."
34
+ },
35
+ {
36
+ "id": "crm",
37
+ "dir": "plugins/plugin-crm/src/migrations",
38
+ "gate": "chain",
39
+ "$note": "Phase 2 / PRD 07. The deal has its own table; the quote is public.quotes."
40
+ },
41
+ {
42
+ "id": "marketing",
43
+ "dir": "plugins/plugin-marketing/src/migrations",
44
+ "gate": "chain",
45
+ "$note": "Phase 2 / PRD 09. The campaign enqueues through the notification engine."
46
+ },
47
+ {
48
+ "id": "reports",
49
+ "dir": "plugins/plugin-reports/src/migrations",
50
+ "gate": "chain",
51
+ "$note": "Phase 2 / PRD 08. The engine that reads, authorizes and exports the read models the other plugins publish."
52
+ }
53
+ ],
54
+ "pending": [
55
+ {
56
+ "id": "forms",
57
+ "reason": "Creates public.documents, which the base owns since 152 — the guarded CREATE has to go (#282)."
58
+ },
59
+ {
60
+ "id": "menu",
61
+ "reason": "Nine tables of its own and no capability suite yet."
62
+ },
63
+ {
64
+ "id": "shop",
65
+ "reason": "Its data lives in packages/shop, not in the plugin, and it still keeps a second stock book (#276's remaining half)."
66
+ },
67
+ {
68
+ "id": "courses",
69
+ "reason": "Its data lives in packages/courses, not in the plugin (#285)."
70
+ },
71
+ {
72
+ "id": "conversations",
73
+ "reason": "Capability gate not green."
74
+ },
75
+ {
76
+ "id": "automations",
77
+ "reason": "Creates public.event_log, which the base owns; the copy is a guarded no-op that should go."
78
+ },
79
+ {
80
+ "id": "blog",
81
+ "reason": "Capability gate not green."
82
+ },
83
+ {
84
+ "id": "reputation",
85
+ "reason": "Capability gate not green."
86
+ },
87
+ {
88
+ "id": "scribe",
89
+ "reason": "Capability gate not green."
90
+ },
91
+ {
92
+ "id": "banking-br",
93
+ "reason": "Addon of financial; capability gate not green."
94
+ },
95
+ {
96
+ "id": "admin",
97
+ "reason": "No data of its own — the base absorbed what it was for (#274 rule 1)."
98
+ },
99
+ {
100
+ "id": "auth",
101
+ "reason": "No data of its own — same."
102
+ },
103
+ {
104
+ "id": "orders",
105
+ "reason": "The Venda is a base archetype; nothing is left for a plugin to own."
106
+ },
107
+ {
108
+ "id": "dashboard",
109
+ "reason": "A mechanism other plugins feed; no capability suite yet."
110
+ },
111
+ {
112
+ "id": "payments",
113
+ "reason": "Never built."
114
+ },
115
+ {
116
+ "id": "sites",
117
+ "reason": "Never built."
118
+ },
119
+ {
120
+ "id": "linkinbio",
121
+ "reason": "Never built."
122
+ },
123
+ {
124
+ "id": "tables",
125
+ "reason": "Never built; will own the restaurant floor when it is."
126
+ },
127
+ {
128
+ "id": "agent-runtime",
129
+ "reason": "A library, not a plugin — it is base (rodada 3 Q1)."
130
+ }
131
+ ]
132
+ }
package/dist/index.cjs CHANGED
@@ -18,10 +18,10 @@ var appointments = pgCore.pgTable("appointments", {
18
18
  var products = pgCore.pgTable("products", {
19
19
  id: pgCore.uuid("id").primaryKey()
20
20
  });
21
- var orderItems = pgCore.pgTable("order_items", {
21
+ var items = pgCore.pgTable("items", {
22
22
  id: pgCore.uuid("id").primaryKey()
23
23
  });
24
- var plgConnections = pgCore.pgTable("plg_connections", {
24
+ var plgConnections = pgCore.pgTable("connections", {
25
25
  id: pgCore.uuid("id").primaryKey(),
26
26
  tenantId: pgCore.uuid("tenant_id").notNull(),
27
27
  connectorId: pgCore.text("connector_id").notNull(),
@@ -37,7 +37,7 @@ var plgConnections = pgCore.pgTable("plg_connections", {
37
37
  createdAt: pgCore.timestamp("created_at", { withTimezone: true }).notNull(),
38
38
  updatedAt: pgCore.timestamp("updated_at", { withTimezone: true }).notNull()
39
39
  });
40
- var plgSyncRuns = pgCore.pgTable("plg_sync_runs", {
40
+ var plgSyncRuns = pgCore.pgTable("sync_runs", {
41
41
  id: pgCore.uuid("id").primaryKey(),
42
42
  tenantId: pgCore.uuid("tenant_id").notNull(),
43
43
  connectionId: pgCore.uuid("connection_id").notNull().references(() => plgConnections.id, { onDelete: "cascade" }),
@@ -69,7 +69,7 @@ var createdAt = {
69
69
 
70
70
  exports.appointments = appointments;
71
71
  exports.createdAt = createdAt;
72
- exports.orderItems = orderItems;
72
+ exports.items = items;
73
73
  exports.orders = orders;
74
74
  exports.people = people;
75
75
  exports.plgConnections = plgConnections;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/schema/spine.ts","../src/lib/helpers.ts"],"names":["pgTable","uuid","text","boolean","jsonb","timestamp","integer"],"mappings":";;;;;AAYO,IAAM,OAAA,GAAUA,eAAQ,SAAA,EAAW;AAAA,EACxC,EAAA,EAAIC,WAAA,CAAK,IAAI,CAAA,CAAE,UAAA;AACjB,CAAC;AAEM,IAAM,MAAA,GAASD,eAAQ,QAAA,EAAU;AAAA,EACtC,EAAA,EAAIC,WAAA,CAAK,IAAI,CAAA,CAAE,UAAA;AACjB,CAAC;AAEM,IAAM,MAAA,GAASD,eAAQ,QAAA,EAAU;AAAA,EACtC,EAAA,EAAIC,WAAA,CAAK,IAAI,CAAA,CAAE,UAAA;AACjB,CAAC;AAEM,IAAM,YAAA,GAAeD,eAAQ,cAAA,EAAgB;AAAA,EAClD,EAAA,EAAIC,WAAA,CAAK,IAAI,CAAA,CAAE,UAAA;AACjB,CAAC;AAEM,IAAM,QAAA,GAAWD,eAAQ,UAAA,EAAY;AAAA,EAC1C,EAAA,EAAIC,WAAA,CAAK,IAAI,CAAA,CAAE,UAAA;AACjB,CAAC;AAEM,IAAM,UAAA,GAAaD,eAAQ,aAAA,EAAe;AAAA,EAC/C,EAAA,EAAIC,WAAA,CAAK,IAAI,CAAA,CAAE,UAAA;AACjB,CAAC;AAcM,IAAM,cAAA,GAAiBD,eAAQ,iBAAA,EAAmB;AAAA,EACvD,EAAA,EAAIC,WAAA,CAAK,IAAI,CAAA,CAAE,UAAA,EAAW;AAAA,EAC1B,QAAA,EAAUA,W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AAE,UAAA;AACvE;AAGO,IAAM,SAAA,GAAY;AAAA,EACvB,SAAA,EAAWA,gBAAAA,CAAU,YAAA,EAAc,EAAE,YAAA,EAAc,MAAM,CAAA,CAAE,OAAA,EAAQ,CAAE,UAAA;AACvE","file":"index.cjs","sourcesContent":["import { boolean, integer, jsonb, pgTable, text, timestamp, uuid } from 'drizzle-orm/pg-core'\n\n/**\n * Ring 0 — the core spine, declared as Drizzle *references* only.\n *\n * These tables are owned by the platform (@fayz-ai/admin core) and already exist\n * in every provisioned pool, directly in the `public` schema (industry-pool\n * model — no saas_core schema). We declare a minimal shape here purely so plugin\n * tables can express real foreign keys in TypeScript. They land in the Drizzle\n * *baseline* snapshot (never re-created), so only the `id` FK target is needed —\n * the live columns are authoritative.\n */\nexport const tenants = pgTable('tenants', {\n id: uuid('id').primaryKey(),\n})\n\nexport const people = pgTable('people', {\n id: uuid('id').primaryKey(),\n})\n\nexport const orders = pgTable('orders', {\n id: uuid('id').primaryKey(),\n})\n\nexport const appointments = pgTable('appointments', {\n id: uuid('id').primaryKey(),\n})\n\nexport const products = pgTable('products', {\n id: uuid('id').primaryKey(),\n})\n\nexport const orderItems = pgTable('order_items', {\n id: uuid('id').primaryKey(),\n})\n\n/**\n * The connector spine — `plg_connections` / `plg_sync_runs` (migration 029).\n *\n * Declared in full rather than as a bare `id`, because unlike the Ring 0 tables\n * above these two are OURS: 029 is the authority, and a plugin that wants a real\n * FK to a connection (Google Calendar's channel table is the first) has nothing\n * to point at without this. The columns are therefore kept in agreement with\n * 029 by hand — the migration ships the table, this declares its shape.\n *\n * Deliberately NOT in the migration-generating schema set: 029 already creates\n * these, with RLS, grants and a partial index Drizzle would not reproduce.\n */\nexport const plgConnections = pgTable('plg_connections', {\n id: uuid('id').primaryKey(),\n tenantId: uuid('tenant_id').notNull(),\n connectorId: text('connector_id').notNull(),\n instanceKey: text('instance_key').notNull(),\n displayName: text('display_name'),\n active: boolean('active').notNull(),\n status: text('status').notNull(),\n statusDetail: text('status_detail'),\n settings: jsonb('settings').notNull(),\n providerAccountKey: text('provider_account_key'),\n cursors: jsonb('cursors').notNull(),\n lastSyncAt: timestamp('last_sync_at', { withTimezone: true }),\n createdAt: timestamp('created_at', { withTimezone: true }).notNull(),\n updatedAt: timestamp('updated_at', { withTimezone: true }).notNull(),\n})\n\nexport const plgSyncRuns = pgTable('plg_sync_runs', {\n id: uuid('id').primaryKey(),\n tenantId: uuid('tenant_id').notNull(),\n connectionId: uuid('connection_id')\n .notNull()\n .references(() => plgConnections.id, { onDelete: 'cascade' }),\n connectorId: text('connector_id').notNull(),\n direction: text('direction').notNull(),\n // `trigger_kind`, never `trigger`: the reserved word already cost one migration.\n triggerKind: text('trigger_kind').notNull(),\n status: text('status').notNull(),\n stream: text('stream'),\n fetched: integer('fetched').notNull(),\n written: integer('written').notNull(),\n stats: jsonb('stats').notNull(),\n cursor: text('cursor'),\n correlationId: uuid('correlation_id'),\n // What the run has to say when it did NOT fail (031).\n message: text('message'),\n error: text('error'),\n startedAt: timestamp('started_at', { withTimezone: true }).notNull(),\n finishedAt: timestamp('finished_at', { withTimezone: true }),\n})\n","import { uuid, timestamp } from 'drizzle-orm/pg-core'\nimport { tenants } from '../schema/spine'\n\n/**\n * Canonical tenant-scoping column: `tenant_id uuid NOT NULL REFERENCES\n * public.tenants(id) ON DELETE CASCADE`. Every Ring-1 plugin table uses this\n * so tenancy is identical everywhere (and RLS can assume the column exists).\n */\nexport const tenantId = () =>\n uuid('tenant_id')\n .notNull()\n .references(() => tenants.id, { onDelete: 'cascade' })\n\n/** Standard `created_at` / `updated_at` timestamptz pair with `now()` defaults. */\nexport const timestamps = {\n createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),\n updatedAt: timestamp('updated_at', { withTimezone: true }).notNull().defaultNow(),\n}\n\n/** Just `created_at` (for append-only / event-style tables). */\nexport const createdAt = {\n createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),\n}\n"]}
1
+ {"version":3,"sources":["../src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ASI,cAAA,CAAQ,SAAS,CAAA,CAAE,OAAA,EAAQ;AAAA,EACpC,OAAA,EAASA,cAAA,CAAQ,SAAS,CAAA,CAAE,OAAA,EAAQ;AAAA,EACpC,KAAA,EAAOF,YAAA,CAAM,OAAO,CAAA,CAAE,OAAA,EAAQ;AAAA,EAC9B,MAAA,EAAQF,YAAK,QAAQ,CAAA;AAAA,EACrB,aAAA,EAAeD,YAAK,gBAAgB,CAAA;AAAA;AAAA,EAEpC,OAAA,EAASC,YAAK,SAAS,CAAA;AAAA,EACvB,KAAA,EAAOA,YAAK,OAAO,CAAA;AAAA,EACnB,SAAA,EAAWG,iBAAU,YAAA,EAAc,EAAE,cAAc,IAAA,EAAM,EAAE,OAAA,EAAQ;AAAA,EACnE,YAAYA,gBAAA,CAAU,aAAA,EAAe,EAAE,YAAA,EAAc,MAAM;AAC7D,CAAC;ACpFM,IAAM,QAAA,GAAW,MACtBJ,WAAAA,CAAK,WAAW,EACb,OAAA,EAAQ,CACR,UAAA,CAAW,MAAM,OAAA,CAAQ,EAAA,EAAI,EAAE,QAAA,EAAU,WAAW;AAGlD,IAAM,UAAA,GAAa;AAAA,EACxB,SAAA,EAAWI,gBAAAA,CAAU,YAAA,EAAc,EAAE,YAAA,EAAc,MAAM,CAAA,CAAE,OAAA,EAAQ,CAAE,UAAA,EAAW;AAAA,EAChF,SAAA,EAAWA,gBAAAA,CAAU,YAAA,EAAc,EAAE,YAAA,EAAc,MAAM,CAAA,CAAE,OAAA,EAAQ,CAAE,UAAA;AACvE;AAGO,IAAM,SAAA,GAAY;AAAA,EACvB,SAAA,EAAWA,gBAAAA,CAAU,YAAA,EAAc,EAAE,YAAA,EAAc,MAAM,CAAA,CAAE,OAAA,EAAQ,CAAE,UAAA;AACvE","file":"index.cjs","sourcesContent":["import { boolean, integer, jsonb, pgTable, text, timestamp, uuid } from 'drizzle-orm/pg-core'\n\n/**\n * Ring 0 — the core spine, declared as Drizzle *references* only.\n *\n * These tables are owned by the platform (@fayz-ai/admin core) and already exist\n * in every provisioned pool, directly in the `public` schema (industry-pool\n * model — no saas_core schema). We declare a minimal shape here purely so plugin\n * tables can express real foreign keys in TypeScript. They land in the Drizzle\n * *baseline* snapshot (never re-created), so only the `id` FK target is needed —\n * the live columns are authoritative.\n */\nexport const tenants = pgTable('tenants', {\n id: uuid('id').primaryKey(),\n})\n\nexport const people = pgTable('people', {\n id: uuid('id').primaryKey(),\n})\n\nexport const orders = pgTable('orders', {\n id: uuid('id').primaryKey(),\n})\n\nexport const appointments = pgTable('appointments', {\n id: uuid('id').primaryKey(),\n})\n\nexport const products = pgTable('products', {\n id: uuid('id').primaryKey(),\n})\n\n/**\n * The commercial line (spine 187). ONE table for every document that has lines —\n * the order, the invoice, the delivery, the quote. `order_items` was the order's\n * own second table until 187 folded it in.\n */\nexport const items = pgTable('items', {\n id: uuid('id').primaryKey(),\n})\n\n/**\n * The connector spine — `connections` / `sync_runs` (migration 029).\n *\n * Declared in full rather than as a bare `id`, because unlike the Ring 0 tables\n * above these two are OURS: 029 is the authority, and a plugin that wants a real\n * FK to a connection (Google Calendar's channel table is the first) has nothing\n * to point at without this. The columns are therefore kept in agreement with\n * 029 by hand — the migration ships the table, this declares its shape.\n *\n * Deliberately NOT in the migration-generating schema set: 029 already creates\n * these, with RLS, grants and a partial index Drizzle would not reproduce.\n */\nexport const plgConnections = pgTable('connections', {\n id: uuid('id').primaryKey(),\n tenantId: uuid('tenant_id').notNull(),\n connectorId: text('connector_id').notNull(),\n instanceKey: text('instance_key').notNull(),\n displayName: text('display_name'),\n active: boolean('active').notNull(),\n status: text('status').notNull(),\n statusDetail: text('status_detail'),\n settings: jsonb('settings').notNull(),\n providerAccountKey: text('provider_account_key'),\n cursors: jsonb('cursors').notNull(),\n lastSyncAt: timestamp('last_sync_at', { withTimezone: true }),\n createdAt: timestamp('created_at', { withTimezone: true }).notNull(),\n updatedAt: timestamp('updated_at', { withTimezone: true }).notNull(),\n})\n\nexport const plgSyncRuns = pgTable('sync_runs', {\n id: uuid('id').primaryKey(),\n tenantId: uuid('tenant_id').notNull(),\n connectionId: uuid('connection_id')\n .notNull()\n .references(() => plgConnections.id, { onDelete: 'cascade' }),\n connectorId: text('connector_id').notNull(),\n direction: text('direction').notNull(),\n // `trigger_kind`, never `trigger`: the reserved word already cost one migration.\n triggerKind: text('trigger_kind').notNull(),\n status: text('status').notNull(),\n stream: text('stream'),\n fetched: integer('fetched').notNull(),\n written: integer('written').notNull(),\n stats: jsonb('stats').notNull(),\n cursor: text('cursor'),\n correlationId: uuid('correlation_id'),\n // What the run has to say when it did NOT fail (031).\n message: text('message'),\n error: text('error'),\n startedAt: timestamp('started_at', { withTimezone: true }).notNull(),\n finishedAt: timestamp('finished_at', { withTimezone: true }),\n})\n","import { uuid, timestamp } from 'drizzle-orm/pg-core'\nimport { tenants } from '../schema/spine'\n\n/**\n * Canonical tenant-scoping column: `tenant_id uuid NOT NULL REFERENCES\n * public.tenants(id) ON DELETE CASCADE`. Every Ring-1 plugin table uses this\n * so tenancy is identical everywhere (and RLS can assume the column exists).\n */\nexport const tenantId = () =>\n uuid('tenant_id')\n .notNull()\n .references(() => tenants.id, { onDelete: 'cascade' })\n\n/** Standard `created_at` / `updated_at` timestamptz pair with `now()` defaults. */\nexport const timestamps = {\n createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),\n updatedAt: timestamp('updated_at', { withTimezone: true }).notNull().defaultNow(),\n}\n\n/** Just `created_at` (for append-only / event-style tables). */\nexport const createdAt = {\n createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export * from 'drizzle-orm/pg-core';
2
- export { tenants, people, orders, appointments, products, orderItems, plgConnections, plgSyncRuns } from './schema/spine';
2
+ export { tenants, people, orders, appointments, products, items, plgConnections, plgSyncRuns } from './schema/spine';
3
3
  export { tenantId, timestamps, createdAt } from './lib/helpers';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,cAAc,qBAAqB,CAAA;AAEnC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACzH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,cAAc,qBAAqB,CAAA;AAEnC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACpH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA"}
package/dist/index.js CHANGED
@@ -17,10 +17,10 @@ var appointments = pgTable("appointments", {
17
17
  var products = pgTable("products", {
18
18
  id: uuid("id").primaryKey()
19
19
  });
20
- var orderItems = pgTable("order_items", {
20
+ var items = pgTable("items", {
21
21
  id: uuid("id").primaryKey()
22
22
  });
23
- var plgConnections = pgTable("plg_connections", {
23
+ var plgConnections = pgTable("connections", {
24
24
  id: uuid("id").primaryKey(),
25
25
  tenantId: uuid("tenant_id").notNull(),
26
26
  connectorId: text("connector_id").notNull(),
@@ -36,7 +36,7 @@ var plgConnections = pgTable("plg_connections", {
36
36
  createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
37
37
  updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
38
38
  });
39
- var plgSyncRuns = pgTable("plg_sync_runs", {
39
+ var plgSyncRuns = pgTable("sync_runs", {
40
40
  id: uuid("id").primaryKey(),
41
41
  tenantId: uuid("tenant_id").notNull(),
42
42
  connectionId: uuid("connection_id").notNull().references(() => plgConnections.id, { onDelete: "cascade" }),
@@ -66,6 +66,6 @@ var createdAt = {
66
66
  createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow()
67
67
  };
68
68
 
69
- export { appointments, createdAt, orderItems, orders, people, plgConnections, plgSyncRuns, products, tenantId, tenants, timestamps };
69
+ export { appointments, createdAt, items, orders, people, plgConnections, plgSyncRuns, products, tenantId, tenants, timestamps };
70
70
  //# sourceMappingURL=index.js.map
71
71
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/schema/spine.ts","../src/lib/helpers.ts"],"names":["uuid","timestamp"],"mappings":";;;;AAYO,IAAM,OAAA,GAAU,QAAQ,SAAA,EAAW;AAAA,EACxC,EAAA,EAAI,IAAA,CAAK,IAAI,CAAA,CAAE,UAAA;AACjB,CAAC;AAEM,IAAM,MAAA,GAAS,QAAQ,QAAA,EAAU;AAAA,EACtC,EAAA,EAAI,IAAA,CAAK,IAAI,CAAA,CAAE,UAAA;AACjB,CAAC;AAEM,IAAM,MAAA,GAAS,QAAQ,QAAA,EAAU;AAAA,EACtC,EAAA,EAAI,IAAA,CAAK,IAAI,CAAA,CAAE,UAAA;AACjB,CAAC;AAEM,IAAM,YAAA,GAAe,QAAQ,cAAA,EAAgB;AAAA,EAClD,EAAA,EAAI,IAAA,CAAK,IAAI,CAAA,CAAE,UAAA;AACjB,CAAC;AAEM,IAAM,QAAA,GAAW,QAAQ,UAAA,EAAY;AAAA,EAC1C,EAAA,EAAI,IAAA,CAAK,IAAI,CAAA,CAAE,UAAA;AACjB,CAAC;AAEM,IAAM,UAAA,GAAa,QAAQ,aAAA,EAAe;AAAA,EAC/C,EAAA,EAAI,IAAA,CAAK,IAAI,CAAA,CAAE,UAAA;AACjB,CAAC;AAcM,IAAM,cAAA,GAAiB,QAAQ,iBAAA,EAAmB;AAAA,EACvD,EAAA,EAAI,IAAA,CAAK,IAAI,CAAA,CAAE,UAAA,EAAW;AA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AACvE;AAGO,IAAM,SAAA,GAAY;AAAA,EACvB,SAAA,EAAWA,SAAAA,CAAU,YAAA,EAAc,EAAE,YAAA,EAAc,MAAM,CAAA,CAAE,OAAA,EAAQ,CAAE,UAAA;AACvE","file":"index.js","sourcesContent":["import { boolean, integer, jsonb, pgTable, text, timestamp, uuid } from 'drizzle-orm/pg-core'\n\n/**\n * Ring 0 — the core spine, declared as Drizzle *references* only.\n *\n * These tables are owned by the platform (@fayz-ai/admin core) and already exist\n * in every provisioned pool, directly in the `public` schema (industry-pool\n * model — no saas_core schema). We declare a minimal shape here purely so plugin\n * tables can express real foreign keys in TypeScript. They land in the Drizzle\n * *baseline* snapshot (never re-created), so only the `id` FK target is needed —\n * the live columns are authoritative.\n */\nexport const tenants = pgTable('tenants', {\n id: uuid('id').primaryKey(),\n})\n\nexport const people = pgTable('people', {\n id: uuid('id').primaryKey(),\n})\n\nexport const orders = pgTable('orders', {\n id: uuid('id').primaryKey(),\n})\n\nexport const appointments = pgTable('appointments', {\n id: uuid('id').primaryKey(),\n})\n\nexport const products = pgTable('products', {\n id: uuid('id').primaryKey(),\n})\n\nexport const orderItems = pgTable('order_items', {\n id: uuid('id').primaryKey(),\n})\n\n/**\n * The connector spine — `plg_connections` / `plg_sync_runs` (migration 029).\n *\n * Declared in full rather than as a bare `id`, because unlike the Ring 0 tables\n * above these two are OURS: 029 is the authority, and a plugin that wants a real\n * FK to a connection (Google Calendar's channel table is the first) has nothing\n * to point at without this. The columns are therefore kept in agreement with\n * 029 by hand — the migration ships the table, this declares its shape.\n *\n * Deliberately NOT in the migration-generating schema set: 029 already creates\n * these, with RLS, grants and a partial index Drizzle would not reproduce.\n */\nexport const plgConnections = pgTable('plg_connections', {\n id: uuid('id').primaryKey(),\n tenantId: uuid('tenant_id').notNull(),\n connectorId: text('connector_id').notNull(),\n instanceKey: text('instance_key').notNull(),\n displayName: text('display_name'),\n active: boolean('active').notNull(),\n status: text('status').notNull(),\n statusDetail: text('status_detail'),\n settings: jsonb('settings').notNull(),\n providerAccountKey: text('provider_account_key'),\n cursors: jsonb('cursors').notNull(),\n lastSyncAt: timestamp('last_sync_at', { withTimezone: true }),\n createdAt: timestamp('created_at', { withTimezone: true }).notNull(),\n updatedAt: timestamp('updated_at', { withTimezone: true }).notNull(),\n})\n\nexport const plgSyncRuns = pgTable('plg_sync_runs', {\n id: uuid('id').primaryKey(),\n tenantId: uuid('tenant_id').notNull(),\n connectionId: uuid('connection_id')\n .notNull()\n .references(() => plgConnections.id, { onDelete: 'cascade' }),\n connectorId: text('connector_id').notNull(),\n direction: text('direction').notNull(),\n // `trigger_kind`, never `trigger`: the reserved word already cost one migration.\n triggerKind: text('trigger_kind').notNull(),\n status: text('status').notNull(),\n stream: text('stream'),\n fetched: integer('fetched').notNull(),\n written: integer('written').notNull(),\n stats: jsonb('stats').notNull(),\n cursor: text('cursor'),\n correlationId: uuid('correlation_id'),\n // What the run has to say when it did NOT fail (031).\n message: text('message'),\n error: text('error'),\n startedAt: timestamp('started_at', { withTimezone: true }).notNull(),\n finishedAt: timestamp('finished_at', { withTimezone: true }),\n})\n","import { uuid, timestamp } from 'drizzle-orm/pg-core'\nimport { tenants } from '../schema/spine'\n\n/**\n * Canonical tenant-scoping column: `tenant_id uuid NOT NULL REFERENCES\n * public.tenants(id) ON DELETE CASCADE`. Every Ring-1 plugin table uses this\n * so tenancy is identical everywhere (and RLS can assume the column exists).\n */\nexport const tenantId = () =>\n uuid('tenant_id')\n .notNull()\n .references(() => tenants.id, { onDelete: 'cascade' })\n\n/** Standard `created_at` / `updated_at` timestamptz pair with `now()` defaults. */\nexport const timestamps = {\n createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),\n updatedAt: timestamp('updated_at', { withTimezone: true }).notNull().defaultNow(),\n}\n\n/** Just `created_at` (for append-only / event-style tables). */\nexport const createdAt = {\n createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),\n}\n"]}
1
+ {"version":3,"sources":["../src/schema/spine.ts","../src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A,CAAQ,SAAS,CAAA,CAAE,OAAA,EAAQ;AAAA,EACpC,KAAA,EAAO,KAAA,CAAM,OAAO,CAAA,CAAE,OAAA,EAAQ;AAAA,EAC9B,MAAA,EAAQ,KAAK,QAAQ,CAAA;AAAA,EACrB,aAAA,EAAe,KAAK,gBAAgB,CAAA;AAAA;AAAA,EAEpC,OAAA,EAAS,KAAK,SAAS,CAAA;AAAA,EACvB,KAAA,EAAO,KAAK,OAAO,CAAA;AAAA,EACnB,SAAA,EAAW,UAAU,YAAA,EAAc,EAAE,cAAc,IAAA,EAAM,EAAE,OAAA,EAAQ;AAAA,EACnE,YAAY,SAAA,CAAU,aAAA,EAAe,EAAE,YAAA,EAAc,MAAM;AAC7D,CAAC;ACpFM,IAAM,QAAA,GAAW,MACtBA,IAAAA,CAAK,WAAW,EACb,OAAA,EAAQ,CACR,UAAA,CAAW,MAAM,OAAA,CAAQ,EAAA,EAAI,EAAE,QAAA,EAAU,WAAW;AAGlD,IAAM,UAAA,GAAa;AAAA,EACxB,SAAA,EAAWC,SAAAA,CAAU,YAAA,EAAc,EAAE,YAAA,EAAc,MAAM,CAAA,CAAE,OAAA,EAAQ,CAAE,UAAA,EAAW;AAAA,EAChF,SAAA,EAAWA,SAAAA,CAAU,YAAA,EAAc,EAAE,YAAA,EAAc,MAAM,CAAA,CAAE,OAAA,EAAQ,CAAE,UAAA;AACvE;AAGO,IAAM,SAAA,GAAY;AAAA,EACvB,SAAA,EAAWA,SAAAA,CAAU,YAAA,EAAc,EAAE,YAAA,EAAc,MAAM,CAAA,CAAE,OAAA,EAAQ,CAAE,UAAA;AACvE","file":"index.js","sourcesContent":["import { boolean, integer, jsonb, pgTable, text, timestamp, uuid } from 'drizzle-orm/pg-core'\n\n/**\n * Ring 0 — the core spine, declared as Drizzle *references* only.\n *\n * These tables are owned by the platform (@fayz-ai/admin core) and already exist\n * in every provisioned pool, directly in the `public` schema (industry-pool\n * model — no saas_core schema). We declare a minimal shape here purely so plugin\n * tables can express real foreign keys in TypeScript. They land in the Drizzle\n * *baseline* snapshot (never re-created), so only the `id` FK target is needed —\n * the live columns are authoritative.\n */\nexport const tenants = pgTable('tenants', {\n id: uuid('id').primaryKey(),\n})\n\nexport const people = pgTable('people', {\n id: uuid('id').primaryKey(),\n})\n\nexport const orders = pgTable('orders', {\n id: uuid('id').primaryKey(),\n})\n\nexport const appointments = pgTable('appointments', {\n id: uuid('id').primaryKey(),\n})\n\nexport const products = pgTable('products', {\n id: uuid('id').primaryKey(),\n})\n\n/**\n * The commercial line (spine 187). ONE table for every document that has lines —\n * the order, the invoice, the delivery, the quote. `order_items` was the order's\n * own second table until 187 folded it in.\n */\nexport const items = pgTable('items', {\n id: uuid('id').primaryKey(),\n})\n\n/**\n * The connector spine — `connections` / `sync_runs` (migration 029).\n *\n * Declared in full rather than as a bare `id`, because unlike the Ring 0 tables\n * above these two are OURS: 029 is the authority, and a plugin that wants a real\n * FK to a connection (Google Calendar's channel table is the first) has nothing\n * to point at without this. The columns are therefore kept in agreement with\n * 029 by hand — the migration ships the table, this declares its shape.\n *\n * Deliberately NOT in the migration-generating schema set: 029 already creates\n * these, with RLS, grants and a partial index Drizzle would not reproduce.\n */\nexport const plgConnections = pgTable('connections', {\n id: uuid('id').primaryKey(),\n tenantId: uuid('tenant_id').notNull(),\n connectorId: text('connector_id').notNull(),\n instanceKey: text('instance_key').notNull(),\n displayName: text('display_name'),\n active: boolean('active').notNull(),\n status: text('status').notNull(),\n statusDetail: text('status_detail'),\n settings: jsonb('settings').notNull(),\n providerAccountKey: text('provider_account_key'),\n cursors: jsonb('cursors').notNull(),\n lastSyncAt: timestamp('last_sync_at', { withTimezone: true }),\n createdAt: timestamp('created_at', { withTimezone: true }).notNull(),\n updatedAt: timestamp('updated_at', { withTimezone: true }).notNull(),\n})\n\nexport const plgSyncRuns = pgTable('sync_runs', {\n id: uuid('id').primaryKey(),\n tenantId: uuid('tenant_id').notNull(),\n connectionId: uuid('connection_id')\n .notNull()\n .references(() => plgConnections.id, { onDelete: 'cascade' }),\n connectorId: text('connector_id').notNull(),\n direction: text('direction').notNull(),\n // `trigger_kind`, never `trigger`: the reserved word already cost one migration.\n triggerKind: text('trigger_kind').notNull(),\n status: text('status').notNull(),\n stream: text('stream'),\n fetched: integer('fetched').notNull(),\n written: integer('written').notNull(),\n stats: jsonb('stats').notNull(),\n cursor: text('cursor'),\n correlationId: uuid('correlation_id'),\n // What the run has to say when it did NOT fail (031).\n message: text('message'),\n error: text('error'),\n startedAt: timestamp('started_at', { withTimezone: true }).notNull(),\n finishedAt: timestamp('finished_at', { withTimezone: true }),\n})\n","import { uuid, timestamp } from 'drizzle-orm/pg-core'\nimport { tenants } from '../schema/spine'\n\n/**\n * Canonical tenant-scoping column: `tenant_id uuid NOT NULL REFERENCES\n * public.tenants(id) ON DELETE CASCADE`. Every Ring-1 plugin table uses this\n * so tenancy is identical everywhere (and RLS can assume the column exists).\n */\nexport const tenantId = () =>\n uuid('tenant_id')\n .notNull()\n .references(() => tenants.id, { onDelete: 'cascade' })\n\n/** Standard `created_at` / `updated_at` timestamptz pair with `now()` defaults. */\nexport const timestamps = {\n createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),\n updatedAt: timestamp('updated_at', { withTimezone: true }).notNull().defaultNow(),\n}\n\n/** Just `created_at` (for append-only / event-style tables). */\nexport const createdAt = {\n createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),\n}\n"]}
@@ -128,13 +128,18 @@ export declare const products: import("drizzle-orm/pg-core").PgTableWithColumns<
128
128
  };
129
129
  dialect: "pg";
130
130
  }>;
131
- export declare const orderItems: import("drizzle-orm/pg-core").PgTableWithColumns<{
132
- name: "order_items";
131
+ /**
132
+ * The commercial line (spine 187). ONE table for every document that has lines —
133
+ * the order, the invoice, the delivery, the quote. `order_items` was the order's
134
+ * own second table until 187 folded it in.
135
+ */
136
+ export declare const items: import("drizzle-orm/pg-core").PgTableWithColumns<{
137
+ name: "items";
133
138
  schema: undefined;
134
139
  columns: {
135
140
  id: import("drizzle-orm/pg-core").PgColumn<{
136
141
  name: "id";
137
- tableName: "order_items";
142
+ tableName: "items";
138
143
  dataType: "string";
139
144
  columnType: "PgUUID";
140
145
  data: string;
@@ -153,7 +158,7 @@ export declare const orderItems: import("drizzle-orm/pg-core").PgTableWithColumn
153
158
  dialect: "pg";
154
159
  }>;
155
160
  /**
156
- * The connector spine — `plg_connections` / `plg_sync_runs` (migration 029).
161
+ * The connector spine — `connections` / `sync_runs` (migration 029).
157
162
  *
158
163
  * Declared in full rather than as a bare `id`, because unlike the Ring 0 tables
159
164
  * above these two are OURS: 029 is the authority, and a plugin that wants a real
@@ -165,12 +170,12 @@ export declare const orderItems: import("drizzle-orm/pg-core").PgTableWithColumn
165
170
  * these, with RLS, grants and a partial index Drizzle would not reproduce.
166
171
  */
167
172
  export declare const plgConnections: import("drizzle-orm/pg-core").PgTableWithColumns<{
168
- name: "plg_connections";
173
+ name: "connections";
169
174
  schema: undefined;
170
175
  columns: {
171
176
  id: import("drizzle-orm/pg-core").PgColumn<{
172
177
  name: "id";
173
- tableName: "plg_connections";
178
+ tableName: "connections";
174
179
  dataType: "string";
175
180
  columnType: "PgUUID";
176
181
  data: string;
@@ -187,7 +192,7 @@ export declare const plgConnections: import("drizzle-orm/pg-core").PgTableWithCo
187
192
  }, {}, {}>;
188
193
  tenantId: import("drizzle-orm/pg-core").PgColumn<{
189
194
  name: "tenant_id";
190
- tableName: "plg_connections";
195
+ tableName: "connections";
191
196
  dataType: "string";
192
197
  columnType: "PgUUID";
193
198
  data: string;
@@ -204,7 +209,7 @@ export declare const plgConnections: import("drizzle-orm/pg-core").PgTableWithCo
204
209
  }, {}, {}>;
205
210
  connectorId: import("drizzle-orm/pg-core").PgColumn<{
206
211
  name: "connector_id";
207
- tableName: "plg_connections";
212
+ tableName: "connections";
208
213
  dataType: "string";
209
214
  columnType: "PgText";
210
215
  data: string;
@@ -221,7 +226,7 @@ export declare const plgConnections: import("drizzle-orm/pg-core").PgTableWithCo
221
226
  }, {}, {}>;
222
227
  instanceKey: import("drizzle-orm/pg-core").PgColumn<{
223
228
  name: "instance_key";
224
- tableName: "plg_connections";
229
+ tableName: "connections";
225
230
  dataType: "string";
226
231
  columnType: "PgText";
227
232
  data: string;
@@ -238,7 +243,7 @@ export declare const plgConnections: import("drizzle-orm/pg-core").PgTableWithCo
238
243
  }, {}, {}>;
239
244
  displayName: import("drizzle-orm/pg-core").PgColumn<{
240
245
  name: "display_name";
241
- tableName: "plg_connections";
246
+ tableName: "connections";
242
247
  dataType: "string";
243
248
  columnType: "PgText";
244
249
  data: string;
@@ -255,7 +260,7 @@ export declare const plgConnections: import("drizzle-orm/pg-core").PgTableWithCo
255
260
  }, {}, {}>;
256
261
  active: import("drizzle-orm/pg-core").PgColumn<{
257
262
  name: "active";
258
- tableName: "plg_connections";
263
+ tableName: "connections";
259
264
  dataType: "boolean";
260
265
  columnType: "PgBoolean";
261
266
  data: boolean;
@@ -272,7 +277,7 @@ export declare const plgConnections: import("drizzle-orm/pg-core").PgTableWithCo
272
277
  }, {}, {}>;
273
278
  status: import("drizzle-orm/pg-core").PgColumn<{
274
279
  name: "status";
275
- tableName: "plg_connections";
280
+ tableName: "connections";
276
281
  dataType: "string";
277
282
  columnType: "PgText";
278
283
  data: string;
@@ -289,7 +294,7 @@ export declare const plgConnections: import("drizzle-orm/pg-core").PgTableWithCo
289
294
  }, {}, {}>;
290
295
  statusDetail: import("drizzle-orm/pg-core").PgColumn<{
291
296
  name: "status_detail";
292
- tableName: "plg_connections";
297
+ tableName: "connections";
293
298
  dataType: "string";
294
299
  columnType: "PgText";
295
300
  data: string;
@@ -306,7 +311,7 @@ export declare const plgConnections: import("drizzle-orm/pg-core").PgTableWithCo
306
311
  }, {}, {}>;
307
312
  settings: import("drizzle-orm/pg-core").PgColumn<{
308
313
  name: "settings";
309
- tableName: "plg_connections";
314
+ tableName: "connections";
310
315
  dataType: "json";
311
316
  columnType: "PgJsonb";
312
317
  data: unknown;
@@ -323,7 +328,7 @@ export declare const plgConnections: import("drizzle-orm/pg-core").PgTableWithCo
323
328
  }, {}, {}>;
324
329
  providerAccountKey: import("drizzle-orm/pg-core").PgColumn<{
325
330
  name: "provider_account_key";
326
- tableName: "plg_connections";
331
+ tableName: "connections";
327
332
  dataType: "string";
328
333
  columnType: "PgText";
329
334
  data: string;
@@ -340,7 +345,7 @@ export declare const plgConnections: import("drizzle-orm/pg-core").PgTableWithCo
340
345
  }, {}, {}>;
341
346
  cursors: import("drizzle-orm/pg-core").PgColumn<{
342
347
  name: "cursors";
343
- tableName: "plg_connections";
348
+ tableName: "connections";
344
349
  dataType: "json";
345
350
  columnType: "PgJsonb";
346
351
  data: unknown;
@@ -357,7 +362,7 @@ export declare const plgConnections: import("drizzle-orm/pg-core").PgTableWithCo
357
362
  }, {}, {}>;
358
363
  lastSyncAt: import("drizzle-orm/pg-core").PgColumn<{
359
364
  name: "last_sync_at";
360
- tableName: "plg_connections";
365
+ tableName: "connections";
361
366
  dataType: "date";
362
367
  columnType: "PgTimestamp";
363
368
  data: Date;
@@ -374,7 +379,7 @@ export declare const plgConnections: import("drizzle-orm/pg-core").PgTableWithCo
374
379
  }, {}, {}>;
375
380
  createdAt: import("drizzle-orm/pg-core").PgColumn<{
376
381
  name: "created_at";
377
- tableName: "plg_connections";
382
+ tableName: "connections";
378
383
  dataType: "date";
379
384
  columnType: "PgTimestamp";
380
385
  data: Date;
@@ -391,7 +396,7 @@ export declare const plgConnections: import("drizzle-orm/pg-core").PgTableWithCo
391
396
  }, {}, {}>;
392
397
  updatedAt: import("drizzle-orm/pg-core").PgColumn<{
393
398
  name: "updated_at";
394
- tableName: "plg_connections";
399
+ tableName: "connections";
395
400
  dataType: "date";
396
401
  columnType: "PgTimestamp";
397
402
  data: Date;
@@ -410,12 +415,12 @@ export declare const plgConnections: import("drizzle-orm/pg-core").PgTableWithCo
410
415
  dialect: "pg";
411
416
  }>;
412
417
  export declare const plgSyncRuns: import("drizzle-orm/pg-core").PgTableWithColumns<{
413
- name: "plg_sync_runs";
418
+ name: "sync_runs";
414
419
  schema: undefined;
415
420
  columns: {
416
421
  id: import("drizzle-orm/pg-core").PgColumn<{
417
422
  name: "id";
418
- tableName: "plg_sync_runs";
423
+ tableName: "sync_runs";
419
424
  dataType: "string";
420
425
  columnType: "PgUUID";
421
426
  data: string;
@@ -432,7 +437,7 @@ export declare const plgSyncRuns: import("drizzle-orm/pg-core").PgTableWithColum
432
437
  }, {}, {}>;
433
438
  tenantId: import("drizzle-orm/pg-core").PgColumn<{
434
439
  name: "tenant_id";
435
- tableName: "plg_sync_runs";
440
+ tableName: "sync_runs";
436
441
  dataType: "string";
437
442
  columnType: "PgUUID";
438
443
  data: string;
@@ -449,7 +454,7 @@ export declare const plgSyncRuns: import("drizzle-orm/pg-core").PgTableWithColum
449
454
  }, {}, {}>;
450
455
  connectionId: import("drizzle-orm/pg-core").PgColumn<{
451
456
  name: "connection_id";
452
- tableName: "plg_sync_runs";
457
+ tableName: "sync_runs";
453
458
  dataType: "string";
454
459
  columnType: "PgUUID";
455
460
  data: string;
@@ -466,7 +471,7 @@ export declare const plgSyncRuns: import("drizzle-orm/pg-core").PgTableWithColum
466
471
  }, {}, {}>;
467
472
  connectorId: import("drizzle-orm/pg-core").PgColumn<{
468
473
  name: "connector_id";
469
- tableName: "plg_sync_runs";
474
+ tableName: "sync_runs";
470
475
  dataType: "string";
471
476
  columnType: "PgText";
472
477
  data: string;
@@ -483,7 +488,7 @@ export declare const plgSyncRuns: import("drizzle-orm/pg-core").PgTableWithColum
483
488
  }, {}, {}>;
484
489
  direction: import("drizzle-orm/pg-core").PgColumn<{
485
490
  name: "direction";
486
- tableName: "plg_sync_runs";
491
+ tableName: "sync_runs";
487
492
  dataType: "string";
488
493
  columnType: "PgText";
489
494
  data: string;
@@ -500,7 +505,7 @@ export declare const plgSyncRuns: import("drizzle-orm/pg-core").PgTableWithColum
500
505
  }, {}, {}>;
501
506
  triggerKind: import("drizzle-orm/pg-core").PgColumn<{
502
507
  name: "trigger_kind";
503
- tableName: "plg_sync_runs";
508
+ tableName: "sync_runs";
504
509
  dataType: "string";
505
510
  columnType: "PgText";
506
511
  data: string;
@@ -517,7 +522,7 @@ export declare const plgSyncRuns: import("drizzle-orm/pg-core").PgTableWithColum
517
522
  }, {}, {}>;
518
523
  status: import("drizzle-orm/pg-core").PgColumn<{
519
524
  name: "status";
520
- tableName: "plg_sync_runs";
525
+ tableName: "sync_runs";
521
526
  dataType: "string";
522
527
  columnType: "PgText";
523
528
  data: string;
@@ -534,7 +539,7 @@ export declare const plgSyncRuns: import("drizzle-orm/pg-core").PgTableWithColum
534
539
  }, {}, {}>;
535
540
  stream: import("drizzle-orm/pg-core").PgColumn<{
536
541
  name: "stream";
537
- tableName: "plg_sync_runs";
542
+ tableName: "sync_runs";
538
543
  dataType: "string";
539
544
  columnType: "PgText";
540
545
  data: string;
@@ -551,7 +556,7 @@ export declare const plgSyncRuns: import("drizzle-orm/pg-core").PgTableWithColum
551
556
  }, {}, {}>;
552
557
  fetched: import("drizzle-orm/pg-core").PgColumn<{
553
558
  name: "fetched";
554
- tableName: "plg_sync_runs";
559
+ tableName: "sync_runs";
555
560
  dataType: "number";
556
561
  columnType: "PgInteger";
557
562
  data: number;
@@ -568,7 +573,7 @@ export declare const plgSyncRuns: import("drizzle-orm/pg-core").PgTableWithColum
568
573
  }, {}, {}>;
569
574
  written: import("drizzle-orm/pg-core").PgColumn<{
570
575
  name: "written";
571
- tableName: "plg_sync_runs";
576
+ tableName: "sync_runs";
572
577
  dataType: "number";
573
578
  columnType: "PgInteger";
574
579
  data: number;
@@ -585,7 +590,7 @@ export declare const plgSyncRuns: import("drizzle-orm/pg-core").PgTableWithColum
585
590
  }, {}, {}>;
586
591
  stats: import("drizzle-orm/pg-core").PgColumn<{
587
592
  name: "stats";
588
- tableName: "plg_sync_runs";
593
+ tableName: "sync_runs";
589
594
  dataType: "json";
590
595
  columnType: "PgJsonb";
591
596
  data: unknown;
@@ -602,7 +607,7 @@ export declare const plgSyncRuns: import("drizzle-orm/pg-core").PgTableWithColum
602
607
  }, {}, {}>;
603
608
  cursor: import("drizzle-orm/pg-core").PgColumn<{
604
609
  name: "cursor";
605
- tableName: "plg_sync_runs";
610
+ tableName: "sync_runs";
606
611
  dataType: "string";
607
612
  columnType: "PgText";
608
613
  data: string;
@@ -619,7 +624,7 @@ export declare const plgSyncRuns: import("drizzle-orm/pg-core").PgTableWithColum
619
624
  }, {}, {}>;
620
625
  correlationId: import("drizzle-orm/pg-core").PgColumn<{
621
626
  name: "correlation_id";
622
- tableName: "plg_sync_runs";
627
+ tableName: "sync_runs";
623
628
  dataType: "string";
624
629
  columnType: "PgUUID";
625
630
  data: string;
@@ -636,7 +641,7 @@ export declare const plgSyncRuns: import("drizzle-orm/pg-core").PgTableWithColum
636
641
  }, {}, {}>;
637
642
  message: import("drizzle-orm/pg-core").PgColumn<{
638
643
  name: "message";
639
- tableName: "plg_sync_runs";
644
+ tableName: "sync_runs";
640
645
  dataType: "string";
641
646
  columnType: "PgText";
642
647
  data: string;
@@ -653,7 +658,7 @@ export declare const plgSyncRuns: import("drizzle-orm/pg-core").PgTableWithColum
653
658
  }, {}, {}>;
654
659
  error: import("drizzle-orm/pg-core").PgColumn<{
655
660
  name: "error";
656
- tableName: "plg_sync_runs";
661
+ tableName: "sync_runs";
657
662
  dataType: "string";
658
663
  columnType: "PgText";
659
664
  data: string;
@@ -670,7 +675,7 @@ export declare const plgSyncRuns: import("drizzle-orm/pg-core").PgTableWithColum
670
675
  }, {}, {}>;
671
676
  startedAt: import("drizzle-orm/pg-core").PgColumn<{
672
677
  name: "started_at";
673
- tableName: "plg_sync_runs";
678
+ tableName: "sync_runs";
674
679
  dataType: "date";
675
680
  columnType: "PgTimestamp";
676
681
  data: Date;
@@ -687,7 +692,7 @@ export declare const plgSyncRuns: import("drizzle-orm/pg-core").PgTableWithColum
687
692
  }, {}, {}>;
688
693
  finishedAt: import("drizzle-orm/pg-core").PgColumn<{
689
694
  name: "finished_at";
690
- tableName: "plg_sync_runs";
695
+ tableName: "sync_runs";
691
696
  dataType: "date";
692
697
  columnType: "PgTimestamp";
693
698
  data: Date;
@@ -1 +1 @@
1
- {"version":3,"file":"spine.d.ts","sourceRoot":"","sources":["../../src/schema/spine.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;EAElB,CAAA;AAEF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;EAEjB,CAAA;AAEF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;EAEjB,CAAA;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;EAEvB,CAAA;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;EAEnB,CAAA;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;EAErB,CAAA;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAezB,CAAA;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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