@elevasis/core 0.7.1 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (476) hide show
  1. package/dist/test-utils/index.d.ts +3122 -0
  2. package/dist/test-utils/index.js +386 -0
  3. package/package.json +6 -1
  4. package/src/README.md +39 -36
  5. package/src/__tests__/publish.test.ts +18 -13
  6. package/src/__tests__/{template-foundations-compatibility.test.ts → template-core-compatibility.test.ts} +99 -99
  7. package/src/_gen/__tests__/__snapshots__/contracts.md.snap +1135 -1131
  8. package/src/_gen/__tests__/scaffold-contracts.test.ts +47 -36
  9. package/src/_gen/scaffold-contracts.ts +45 -45
  10. package/src/auth/multi-tenancy/credentials/README.md +38 -38
  11. package/src/auth/multi-tenancy/credentials/index.ts +6 -6
  12. package/src/auth/multi-tenancy/credentials/server/encryption.ts +39 -39
  13. package/src/auth/multi-tenancy/credentials/server/service.ts +60 -60
  14. package/src/auth/multi-tenancy/index.ts +17 -17
  15. package/src/auth/multi-tenancy/invitations/api-schemas.ts +107 -107
  16. package/src/auth/multi-tenancy/invitations/index.ts +37 -37
  17. package/src/auth/multi-tenancy/invitations/invitation.ts +86 -86
  18. package/src/auth/multi-tenancy/invitations/server/index.ts +25 -25
  19. package/src/auth/multi-tenancy/invitations/server/transforms.ts +24 -24
  20. package/src/auth/multi-tenancy/invitations/server/workos.ts +24 -24
  21. package/src/auth/multi-tenancy/invitations/supabase.ts +50 -50
  22. package/src/auth/multi-tenancy/memberships/api-schemas.ts +126 -126
  23. package/src/auth/multi-tenancy/memberships/index.ts +21 -21
  24. package/src/auth/multi-tenancy/memberships/membership.ts +138 -138
  25. package/src/auth/multi-tenancy/memberships/server/index.ts +15 -15
  26. package/src/auth/multi-tenancy/memberships/server/transforms.ts +32 -32
  27. package/src/auth/multi-tenancy/memberships/server/workos.ts +21 -21
  28. package/src/auth/multi-tenancy/memberships/supabase.ts +46 -46
  29. package/src/auth/multi-tenancy/organizations/api-schemas.ts +128 -128
  30. package/src/auth/multi-tenancy/organizations/index.ts +23 -23
  31. package/src/auth/multi-tenancy/organizations/organization.ts +24 -24
  32. package/src/auth/multi-tenancy/organizations/server/index.ts +10 -10
  33. package/src/auth/multi-tenancy/organizations/server/transforms.ts +35 -35
  34. package/src/auth/multi-tenancy/organizations/server/workos.ts +20 -20
  35. package/src/auth/multi-tenancy/types.ts +83 -83
  36. package/src/auth/multi-tenancy/users/api-schemas.ts +194 -194
  37. package/src/auth/multi-tenancy/users/index.ts +27 -27
  38. package/src/auth/multi-tenancy/users/server/index.ts +19 -19
  39. package/src/auth/multi-tenancy/users/server/transforms.ts +21 -21
  40. package/src/auth/multi-tenancy/users/server/workos.ts +16 -16
  41. package/src/auth/multi-tenancy/users/user.ts +65 -65
  42. package/src/business/README.md +52 -52
  43. package/src/business/__tests__/entities-published.test.ts +33 -33
  44. package/src/business/acquisition/api-schemas.ts +759 -759
  45. package/src/business/acquisition/index.ts +109 -109
  46. package/src/business/acquisition/types.ts +402 -402
  47. package/src/business/base-entities.test.ts +481 -481
  48. package/src/business/base-entities.ts +241 -241
  49. package/src/business/entities-published.ts +24 -24
  50. package/src/business/index.ts +15 -15
  51. package/src/business/pdf/browser/pdfmake-browser.ts +229 -229
  52. package/src/business/pdf/index.ts +10 -10
  53. package/src/business/pdf/server/index.ts +21 -21
  54. package/src/business/pdf/server/themes/default.ts +8 -8
  55. package/src/business/pdf/server/themes/index.ts +9 -9
  56. package/src/business/pdf/server/themes/types.ts +8 -8
  57. package/src/business/pdf/types.ts +272 -272
  58. package/src/business/projects/index.ts +2 -2
  59. package/src/business/projects/sse-events.ts +21 -21
  60. package/src/business/projects/types.ts +89 -89
  61. package/src/business/sales/api-schemas.ts +75 -75
  62. package/src/business/seo/__tests__/linking.test.ts +549 -549
  63. package/src/business/seo/__tests__/types.test.ts +404 -404
  64. package/src/business/seo/index.ts +2 -2
  65. package/src/business/seo/linking.ts +281 -281
  66. package/src/business/seo/types.ts +199 -199
  67. package/src/commands/queue/index.ts +3 -3
  68. package/src/commands/queue/schemas.test.ts +593 -593
  69. package/src/commands/queue/schemas.ts +125 -125
  70. package/src/commands/queue/sse-events.ts +61 -61
  71. package/src/commands/queue/types/action.ts +52 -52
  72. package/src/commands/queue/types/checkpoint.ts +44 -44
  73. package/src/commands/queue/types/index.ts +7 -7
  74. package/src/commands/queue/types/task.ts +116 -116
  75. package/src/commands/queue/types.ts +14 -14
  76. package/src/content/distribution-metadata.ts +61 -61
  77. package/src/content/index.ts +10 -10
  78. package/src/deployments/index.ts +22 -22
  79. package/src/execution/core/__tests__/archived-logs.test.ts +72 -72
  80. package/src/execution/core/index.ts +11 -11
  81. package/src/execution/core/runner-types.ts +80 -80
  82. package/src/execution/core/server/environment.ts +31 -31
  83. package/src/execution/core/sse-executions.ts +119 -119
  84. package/src/execution/core/types.ts +29 -29
  85. package/src/execution/engine/__tests__/fixtures/test-agents.ts +4 -4
  86. package/src/execution/engine/__tests__/timeout.test.ts +565 -565
  87. package/src/execution/engine/agent/__tests__/errors.test.ts +508 -508
  88. package/src/execution/engine/agent/actions/__tests__/processor.test.ts +531 -531
  89. package/src/execution/engine/agent/actions/executor.ts +205 -205
  90. package/src/execution/engine/agent/actions/navigate-knowledge-executor.ts +230 -230
  91. package/src/execution/engine/agent/actions/processor.ts +116 -116
  92. package/src/execution/engine/agent/actions/types.ts +70 -70
  93. package/src/execution/engine/agent/core/agent.ts +810 -810
  94. package/src/execution/engine/agent/core/types.ts +155 -155
  95. package/src/execution/engine/agent/errors.ts +251 -251
  96. package/src/execution/engine/agent/index.ts +78 -78
  97. package/src/execution/engine/agent/knowledge-map/types.ts +106 -106
  98. package/src/execution/engine/agent/knowledge-map/utils.ts +101 -101
  99. package/src/execution/engine/agent/memory/__tests__/manager.test.ts +754 -754
  100. package/src/execution/engine/agent/memory/domains.ts +99 -99
  101. package/src/execution/engine/agent/memory/manager.ts +365 -365
  102. package/src/execution/engine/agent/memory/processor.ts +66 -66
  103. package/src/execution/engine/agent/memory/types.ts +90 -90
  104. package/src/execution/engine/agent/memory/utils.ts +134 -134
  105. package/src/execution/engine/agent/observability/logging.ts +467 -467
  106. package/src/execution/engine/agent/observability/types.ts +64 -64
  107. package/src/execution/engine/agent/reasoning/adapters/agent-adapter-helpers.ts +349 -349
  108. package/src/execution/engine/agent/reasoning/processor.ts +92 -92
  109. package/src/execution/engine/agent/reasoning/prompt-sections/base-actions.ts +134 -134
  110. package/src/execution/engine/agent/reasoning/prompt-sections/completion.ts +49 -49
  111. package/src/execution/engine/agent/reasoning/prompt-sections/knowledge-map.ts +93 -93
  112. package/src/execution/engine/agent/reasoning/prompt-sections/memory.ts +65 -65
  113. package/src/execution/engine/agent/reasoning/prompt-sections/tools.ts +44 -44
  114. package/src/execution/engine/agent/reasoning/request-builder.ts +169 -169
  115. package/src/execution/engine/agent/reasoning/types.ts +18 -18
  116. package/src/execution/engine/base/errors.ts +118 -118
  117. package/src/execution/engine/base/index.ts +2 -2
  118. package/src/execution/engine/base/logging.ts +31 -31
  119. package/src/execution/engine/base/serialization.ts +324 -324
  120. package/src/execution/engine/base/types.ts +126 -126
  121. package/src/execution/engine/base/utils.ts +41 -41
  122. package/src/execution/engine/index.ts +434 -434
  123. package/src/execution/engine/interface/index.ts +1 -1
  124. package/src/execution/engine/interface/types.ts +62 -62
  125. package/src/execution/engine/llm/__tests__/model-info.test.ts +50 -50
  126. package/src/execution/engine/llm/__tests__/model-validation.test.ts +321 -321
  127. package/src/execution/engine/llm/__tests__/response-schema-validator.test.ts +115 -115
  128. package/src/execution/engine/llm/adapters/__tests__/adapter-factory.test.ts +375 -375
  129. package/src/execution/engine/llm/adapters/__tests__/anthropic-adapter.test.ts +463 -463
  130. package/src/execution/engine/llm/adapters/__tests__/anthropic.integration.test.ts +177 -177
  131. package/src/execution/engine/llm/adapters/__tests__/google-adapter.test.ts +722 -722
  132. package/src/execution/engine/llm/adapters/__tests__/google.integration.test.ts +376 -376
  133. package/src/execution/engine/llm/adapters/__tests__/openai-adapter.test.ts +551 -551
  134. package/src/execution/engine/llm/adapters/__tests__/openrouter-adapter.test.ts +563 -563
  135. package/src/execution/engine/llm/adapters/__tests__/openrouter.integration.test.ts +105 -105
  136. package/src/execution/engine/llm/adapters/__tests__/universal-adapter.test.ts +537 -537
  137. package/src/execution/engine/llm/adapters/circuit-breaker.ts +147 -147
  138. package/src/execution/engine/llm/adapters/index.ts +17 -17
  139. package/src/execution/engine/llm/adapters/mock-adapter.ts +116 -116
  140. package/src/execution/engine/llm/adapters/server/adapter-factory.ts +130 -130
  141. package/src/execution/engine/llm/adapters/server/anthropic.ts +137 -137
  142. package/src/execution/engine/llm/adapters/server/google.ts +283 -283
  143. package/src/execution/engine/llm/adapters/server/index.ts +12 -12
  144. package/src/execution/engine/llm/adapters/server/openai.ts +206 -206
  145. package/src/execution/engine/llm/adapters/server/openrouter.ts +235 -235
  146. package/src/execution/engine/llm/adapters/universal-adapter.ts +230 -230
  147. package/src/execution/engine/llm/errors.ts +186 -186
  148. package/src/execution/engine/llm/model-info.ts +332 -332
  149. package/src/execution/engine/llm/response-schema-validator.ts +113 -113
  150. package/src/execution/engine/llm/types.ts +86 -86
  151. package/src/execution/engine/test-utils/index.ts +6 -6
  152. package/src/execution/engine/test-utils/mocks.ts +56 -56
  153. package/src/execution/engine/tools/integration/base-integration-adapter.ts +50 -50
  154. package/src/execution/engine/tools/integration/index.ts +53 -53
  155. package/src/execution/engine/tools/integration/server/adapters/anymailfinder/anymailfinder-adapter.ts +73 -73
  156. package/src/execution/engine/tools/integration/server/adapters/anymailfinder/anymailfinder-tools.ts +209 -209
  157. package/src/execution/engine/tools/integration/server/adapters/anymailfinder/fetch/find-company-email/index.ts +82 -82
  158. package/src/execution/engine/tools/integration/server/adapters/anymailfinder/fetch/find-decision-maker-email/index.ts +122 -122
  159. package/src/execution/engine/tools/integration/server/adapters/anymailfinder/fetch/find-person-email/index.ts +89 -89
  160. package/src/execution/engine/tools/integration/server/adapters/anymailfinder/fetch/verify-email/index.ts +84 -84
  161. package/src/execution/engine/tools/integration/server/adapters/anymailfinder/index.ts +16 -16
  162. package/src/execution/engine/tools/integration/server/adapters/apify/__tests__/apify-run-actor.integration.test.ts +293 -293
  163. package/src/execution/engine/tools/integration/server/adapters/apify/apify-adapter.ts +100 -100
  164. package/src/execution/engine/tools/integration/server/adapters/apify/apify-tools.ts +217 -217
  165. package/src/execution/engine/tools/integration/server/adapters/apify/fetch/get-dataset-items/index.ts +92 -92
  166. package/src/execution/engine/tools/integration/server/adapters/apify/fetch/run-actor/index.ts +218 -218
  167. package/src/execution/engine/tools/integration/server/adapters/apify/fetch/start-actor/index.ts +87 -87
  168. package/src/execution/engine/tools/integration/server/adapters/apify/index.ts +11 -11
  169. package/src/execution/engine/tools/integration/server/adapters/attio/__tests__/attio-crud.integration.test.ts +361 -361
  170. package/src/execution/engine/tools/integration/server/adapters/attio/attio-adapter.ts +162 -162
  171. package/src/execution/engine/tools/integration/server/adapters/attio/attio-tools.ts +594 -594
  172. package/src/execution/engine/tools/integration/server/adapters/attio/fetch/create-attribute/index.ts +214 -214
  173. package/src/execution/engine/tools/integration/server/adapters/attio/fetch/create-note/index.ts +152 -152
  174. package/src/execution/engine/tools/integration/server/adapters/attio/fetch/create-record/index.ts +141 -141
  175. package/src/execution/engine/tools/integration/server/adapters/attio/fetch/delete-note/index.ts +86 -86
  176. package/src/execution/engine/tools/integration/server/adapters/attio/fetch/delete-record/index.ts +105 -105
  177. package/src/execution/engine/tools/integration/server/adapters/attio/fetch/get-record/index.ts +118 -118
  178. package/src/execution/engine/tools/integration/server/adapters/attio/fetch/list-attributes/index.ts +165 -165
  179. package/src/execution/engine/tools/integration/server/adapters/attio/fetch/list-notes/index.ts +96 -96
  180. package/src/execution/engine/tools/integration/server/adapters/attio/fetch/list-objects/index.ts +104 -104
  181. package/src/execution/engine/tools/integration/server/adapters/attio/fetch/list-records/index.ts +156 -156
  182. package/src/execution/engine/tools/integration/server/adapters/attio/fetch/update-attribute/index.ts +220 -220
  183. package/src/execution/engine/tools/integration/server/adapters/attio/fetch/update-record/index.ts +140 -140
  184. package/src/execution/engine/tools/integration/server/adapters/attio/fetch/utils/types.ts +146 -146
  185. package/src/execution/engine/tools/integration/server/adapters/attio/index.ts +31 -31
  186. package/src/execution/engine/tools/integration/server/adapters/gmail/gmail-adapter.ts +210 -210
  187. package/src/execution/engine/tools/integration/server/adapters/gmail/gmail-tools.ts +104 -104
  188. package/src/execution/engine/tools/integration/server/adapters/google-sheets/__tests__/google-sheets.integration.test.ts +261 -261
  189. package/src/execution/engine/tools/integration/server/adapters/google-sheets/google-sheets-adapter.ts +1189 -1189
  190. package/src/execution/engine/tools/integration/server/adapters/google-sheets/google-sheets-tools.ts +641 -641
  191. package/src/execution/engine/tools/integration/server/adapters/google-sheets/index.ts +18 -18
  192. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/activate-campaign/index.ts +86 -86
  193. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/add-to-campaign/__tests__/index.test.ts +289 -289
  194. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/add-to-campaign/index.ts +154 -154
  195. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/bulk-add-leads/__tests__/index.test.ts +325 -325
  196. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/bulk-add-leads/index.ts +153 -153
  197. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/bulk-delete-leads/index.ts +84 -84
  198. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/create-campaign/index.ts +125 -125
  199. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/create-inbox-test/index.ts +107 -107
  200. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/delete-campaign/index.ts +85 -85
  201. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/get-account-health/index.ts +91 -91
  202. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/get-campaign/index.ts +92 -92
  203. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/get-campaign-analytics/__tests__/index.test.ts +195 -195
  204. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/get-campaign-analytics/index.ts +113 -113
  205. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/get-daily-campaign-analytics/index.ts +104 -104
  206. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/get-emails/index.ts +155 -155
  207. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/get-step-analytics/__tests__/index.test.ts +196 -196
  208. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/get-step-analytics/index.ts +102 -102
  209. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/list-campaigns/__tests__/index.test.ts +189 -189
  210. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/list-campaigns/index.ts +87 -87
  211. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/list-leads/index.ts +112 -112
  212. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/patch-lead/index.ts +76 -76
  213. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/pause-campaign/index.ts +86 -86
  214. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/remove-from-subsequence/index.ts +98 -98
  215. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/send-reply/index.ts +126 -126
  216. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/update-campaign/__tests__/index.test.ts +193 -193
  217. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/update-campaign/index.ts +99 -99
  218. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/update-interest-status/__tests__/index.test.ts +621 -621
  219. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/update-interest-status/index.ts +125 -125
  220. package/src/execution/engine/tools/integration/server/adapters/instantly/index.ts +29 -29
  221. package/src/execution/engine/tools/integration/server/adapters/instantly/instantly-adapter.ts +178 -178
  222. package/src/execution/engine/tools/integration/server/adapters/instantly/instantly-tools.ts +1473 -1473
  223. package/src/execution/engine/tools/integration/server/adapters/millionverifier/fetch/check-credits/index.ts +59 -59
  224. package/src/execution/engine/tools/integration/server/adapters/millionverifier/fetch/verify-email/index.ts +102 -102
  225. package/src/execution/engine/tools/integration/server/adapters/millionverifier/index.ts +17 -17
  226. package/src/execution/engine/tools/integration/server/adapters/millionverifier/millionverifier-adapter.ts +80 -80
  227. package/src/execution/engine/tools/integration/server/adapters/millionverifier/millionverifier-tools.ts +102 -102
  228. package/src/execution/engine/tools/integration/server/adapters/resend/fetch/get-email/index.ts +102 -102
  229. package/src/execution/engine/tools/integration/server/adapters/resend/fetch/send-email/index.ts +134 -134
  230. package/src/execution/engine/tools/integration/server/adapters/resend/fetch/utils/types.ts +75 -75
  231. package/src/execution/engine/tools/integration/server/adapters/resend/index.ts +27 -27
  232. package/src/execution/engine/tools/integration/server/adapters/resend/resend-adapter.ts +108 -108
  233. package/src/execution/engine/tools/integration/server/adapters/resend/resend-tools.ts +132 -132
  234. package/src/execution/engine/tools/integration/server/adapters/signature-api/fetch/create-envelope/index.ts +274 -274
  235. package/src/execution/engine/tools/integration/server/adapters/signature-api/fetch/download-document/index.ts +230 -230
  236. package/src/execution/engine/tools/integration/server/adapters/signature-api/fetch/get-envelope/index.ts +133 -133
  237. package/src/execution/engine/tools/integration/server/adapters/signature-api/fetch/void-envelope/index.ts +90 -90
  238. package/src/execution/engine/tools/integration/server/adapters/stripe/fetch/utils/types.ts +210 -210
  239. package/src/execution/engine/tools/integration/server/adapters/stripe/stripe-adapter.ts +517 -517
  240. package/src/execution/engine/tools/integration/server/adapters/stripe/stripe-tools.ts +309 -309
  241. package/src/execution/engine/tools/integration/server/adapters/tomba/fetch/domain-search/index.ts +133 -133
  242. package/src/execution/engine/tools/integration/server/adapters/tomba/fetch/email-finder/index.ts +122 -122
  243. package/src/execution/engine/tools/integration/server/adapters/tomba/fetch/email-verifier/index.ts +111 -111
  244. package/src/execution/engine/tools/integration/server/adapters/tomba/index.ts +11 -11
  245. package/src/execution/engine/tools/integration/server/adapters/tomba/tomba-adapter.ts +78 -78
  246. package/src/execution/engine/tools/integration/server/adapters/tomba/tomba-tools.ts +222 -222
  247. package/src/execution/engine/tools/integration/server/index.ts +61 -61
  248. package/src/execution/engine/tools/integration/service.ts +161 -161
  249. package/src/execution/engine/tools/integration/tool.ts +253 -253
  250. package/src/execution/engine/tools/integration/types/anymailfinder.ts +74 -74
  251. package/src/execution/engine/tools/integration/types/apify.ts +92 -92
  252. package/src/execution/engine/tools/integration/types/index.ts +19 -19
  253. package/src/execution/engine/tools/integration/types/instantly.ts +557 -557
  254. package/src/execution/engine/tools/integration/types/millionverifier.ts +56 -56
  255. package/src/execution/engine/tools/integration/types/stripe.ts +162 -162
  256. package/src/execution/engine/tools/integration/types/tomba.ts +94 -94
  257. package/src/execution/engine/tools/lead-service-types.ts +884 -884
  258. package/src/execution/engine/tools/llm/index.ts +11 -11
  259. package/src/execution/engine/tools/llm/server/index.ts +8 -8
  260. package/src/execution/engine/tools/llm/server/llm-call-tool.ts +118 -118
  261. package/src/execution/engine/tools/platform/__tests__/pdf.test.ts +441 -441
  262. package/src/execution/engine/tools/platform/acquisition/company-tools.ts +248 -248
  263. package/src/execution/engine/tools/platform/acquisition/contact-tools.ts +319 -319
  264. package/src/execution/engine/tools/platform/acquisition/index.ts +43 -43
  265. package/src/execution/engine/tools/platform/acquisition/list-tools.ts +148 -148
  266. package/src/execution/engine/tools/platform/acquisition/types.ts +260 -260
  267. package/src/execution/engine/tools/platform/email/index.ts +122 -122
  268. package/src/execution/engine/tools/platform/email/types.ts +96 -96
  269. package/src/execution/engine/tools/platform/index.ts +157 -157
  270. package/src/execution/engine/tools/platform/notification.ts +81 -81
  271. package/src/execution/engine/tools/platform/pdf/index.ts +110 -110
  272. package/src/execution/engine/tools/platform/pdf/types.ts +77 -77
  273. package/src/execution/engine/tools/platform/scheduler.ts +87 -87
  274. package/src/execution/engine/tools/platform/storage/index.ts +370 -370
  275. package/src/execution/engine/tools/platform/types.ts +148 -148
  276. package/src/execution/engine/tools/registry.ts +700 -700
  277. package/src/execution/engine/tools/tool-maps.ts +786 -786
  278. package/src/execution/engine/tools/types.ts +233 -233
  279. package/src/execution/engine/workflow/__tests__/errors.test.ts +139 -139
  280. package/src/execution/engine/workflow/errors.ts +63 -63
  281. package/src/execution/engine/workflow/helpers/index.ts +11 -11
  282. package/src/execution/engine/workflow/helpers/server/index.ts +8 -8
  283. package/src/execution/engine/workflow/helpers/server/llm-call.ts +93 -93
  284. package/src/execution/engine/workflow/index.ts +19 -19
  285. package/src/execution/engine/workflow/log-truncate.ts +26 -26
  286. package/src/execution/engine/workflow/logging.ts +191 -191
  287. package/src/execution/engine/workflow/types.ts +182 -182
  288. package/src/execution/engine/workflow/utils.ts +280 -280
  289. package/src/execution/engine/workflow/workflow.ts +168 -168
  290. package/src/execution/index.ts +3 -3
  291. package/src/execution/scheduler/__tests__/api-schemas.test.ts +733 -733
  292. package/src/execution/scheduler/__tests__/utils.test.ts +1009 -1009
  293. package/src/execution/scheduler/api-schemas.ts +296 -296
  294. package/src/execution/scheduler/index.ts +50 -50
  295. package/src/execution/scheduler/schemas.ts +264 -264
  296. package/src/execution/scheduler/types.ts +111 -111
  297. package/src/execution/scheduler/utils.ts +364 -364
  298. package/src/forms/index.ts +7 -7
  299. package/src/forms/schemas.ts +69 -69
  300. package/src/forms/types.ts +70 -70
  301. package/src/index.ts +71 -60
  302. package/src/integrations/credentials/__tests__/schemas.test.ts +82 -82
  303. package/src/integrations/credentials/__tests__/utils.test.ts +144 -144
  304. package/src/integrations/credentials/api-schemas.ts +143 -143
  305. package/src/integrations/credentials/index.ts +32 -32
  306. package/src/integrations/credentials/schemas.ts +164 -164
  307. package/src/integrations/credentials/utils.ts +59 -59
  308. package/src/integrations/oauth/__tests__/provider-registry.test.ts +59 -59
  309. package/src/integrations/oauth/api-schemas.ts +92 -92
  310. package/src/integrations/oauth/index.ts +19 -19
  311. package/src/integrations/oauth/provider-registry.ts +61 -61
  312. package/src/integrations/oauth/server/__tests__/refresh-concurrent.test.ts +183 -183
  313. package/src/integrations/oauth/server/__tests__/refresh.test.ts +577 -577
  314. package/src/integrations/oauth/server/credentials.ts +39 -39
  315. package/src/integrations/oauth/server/refresh.ts +214 -214
  316. package/src/integrations/oauth/types.ts +34 -34
  317. package/src/integrations/webhook-endpoints/__tests__/api-schemas.test.ts +318 -318
  318. package/src/integrations/webhook-endpoints/api-schemas.ts +102 -102
  319. package/src/integrations/webhook-endpoints/index.ts +28 -28
  320. package/src/integrations/webhook-endpoints/types.ts +51 -51
  321. package/src/operations/activities/api-schemas.ts +79 -79
  322. package/src/operations/activities/index.ts +9 -9
  323. package/src/operations/activities/sse-events.ts +30 -30
  324. package/src/operations/activities/types.ts +63 -63
  325. package/src/operations/debug-logs/client.ts +60 -60
  326. package/src/operations/debug-logs/debug-logger.ts +83 -83
  327. package/src/operations/debug-logs/index.ts +8 -8
  328. package/src/operations/debug-logs/server.ts +19 -19
  329. package/src/operations/debug-logs/types.ts +33 -33
  330. package/src/operations/index.ts +50 -50
  331. package/src/operations/notifications/api-schemas.ts +91 -91
  332. package/src/operations/notifications/index.ts +3 -3
  333. package/src/operations/notifications/sse-events.ts +21 -21
  334. package/src/operations/notifications/types.ts +47 -47
  335. package/src/operations/observability/__tests__/openrouter-cost-flow.test.ts +297 -297
  336. package/src/operations/observability/__tests__/utils.test.ts +54 -54
  337. package/src/operations/observability/ai-usage-collector.ts +64 -64
  338. package/src/operations/observability/index.ts +13 -13
  339. package/src/operations/observability/metrics-collector.ts +49 -49
  340. package/src/operations/observability/schemas.ts +39 -39
  341. package/src/operations/observability/types.ts +463 -463
  342. package/src/operations/observability/utils.ts +77 -77
  343. package/src/operations/sessions/__tests__/manager.test.ts +821 -821
  344. package/src/operations/sessions/index.ts +26 -26
  345. package/src/operations/sessions/server/manager.ts +90 -90
  346. package/src/operations/sessions/server/session.ts +180 -180
  347. package/src/operations/sessions/types.ts +98 -98
  348. package/src/operations/triggers/index.ts +12 -12
  349. package/src/operations/triggers/webhook/definitions/instantly-account-error.ts +44 -44
  350. package/src/operations/triggers/webhook/definitions/instantly-auto-reply-received.ts +51 -51
  351. package/src/operations/triggers/webhook/definitions/instantly-campaign-completed.ts +45 -45
  352. package/src/operations/triggers/webhook/definitions/instantly-email-bounced.ts +49 -49
  353. package/src/operations/triggers/webhook/definitions/instantly-lead-unsubscribed.ts +45 -45
  354. package/src/operations/triggers/webhook/definitions/instantly-reply-received.ts +54 -54
  355. package/src/operations/triggers/webhook/index.ts +35 -35
  356. package/src/operations/triggers/webhook/types.ts +74 -74
  357. package/src/organization-model/README.md +97 -97
  358. package/src/organization-model/__tests__/defaults.test.ts +175 -175
  359. package/src/organization-model/__tests__/domains/customers.test.ts +295 -295
  360. package/src/organization-model/__tests__/domains/goals.test.ts +479 -479
  361. package/src/organization-model/__tests__/domains/identity.test.ts +279 -279
  362. package/src/organization-model/__tests__/domains/navigation.test.ts +212 -212
  363. package/src/organization-model/__tests__/domains/offerings.test.ts +419 -419
  364. package/src/organization-model/__tests__/domains/operations.test.ts +203 -203
  365. package/src/organization-model/__tests__/domains/resource-mappings.test.ts +362 -362
  366. package/src/organization-model/__tests__/domains/roles.test.ts +347 -347
  367. package/src/organization-model/__tests__/domains/statuses.test.ts +243 -243
  368. package/src/organization-model/__tests__/foundation.test.ts +105 -105
  369. package/src/organization-model/__tests__/graph.test.ts +894 -894
  370. package/src/organization-model/__tests__/resolve.test.ts +690 -690
  371. package/src/organization-model/__tests__/schema.test.ts +407 -407
  372. package/src/organization-model/contracts.ts +14 -14
  373. package/src/organization-model/defaults.ts +148 -148
  374. package/src/organization-model/domains/branding.ts +22 -22
  375. package/src/organization-model/domains/customers.ts +75 -75
  376. package/src/organization-model/domains/features.ts +22 -22
  377. package/src/organization-model/domains/goals.ts +80 -80
  378. package/src/organization-model/domains/identity.ts +94 -94
  379. package/src/organization-model/domains/navigation.ts +391 -391
  380. package/src/organization-model/domains/offerings.ts +66 -66
  381. package/src/organization-model/domains/operations.ts +85 -85
  382. package/src/organization-model/domains/projects.ts +48 -48
  383. package/src/organization-model/domains/prospecting.ts +33 -33
  384. package/src/organization-model/domains/roles.ts +55 -55
  385. package/src/organization-model/domains/sales.ts +94 -94
  386. package/src/organization-model/domains/shared.ts +62 -62
  387. package/src/organization-model/domains/statuses.ts +130 -130
  388. package/src/organization-model/foundation.ts +97 -97
  389. package/src/organization-model/graph/build.ts +399 -399
  390. package/src/organization-model/graph/index.ts +4 -4
  391. package/src/organization-model/graph/schema.ts +48 -48
  392. package/src/organization-model/graph/types.ts +40 -40
  393. package/src/organization-model/index.ts +13 -13
  394. package/src/organization-model/organization-graph.mdx +272 -272
  395. package/src/organization-model/organization-model.mdx +320 -320
  396. package/src/organization-model/published.ts +85 -85
  397. package/src/organization-model/resolve.ts +66 -66
  398. package/src/organization-model/schema.ts +287 -287
  399. package/src/organization-model/types.ts +46 -46
  400. package/src/platform/api/index.ts +1 -1
  401. package/src/platform/api/types.ts +35 -35
  402. package/src/platform/constants/http.ts +37 -37
  403. package/src/platform/constants/index.ts +5 -5
  404. package/src/platform/constants/limits.ts +32 -32
  405. package/src/platform/constants/resilience.ts +51 -51
  406. package/src/platform/constants/timeouts.ts +20 -20
  407. package/src/platform/constants/versions.ts +3 -3
  408. package/src/platform/registry/__tests__/resource-registry-static.test.ts +347 -347
  409. package/src/platform/registry/__tests__/resource-registry.integration.test.ts +1028 -1028
  410. package/src/platform/registry/__tests__/resource-registry.list-executable.test.ts +393 -393
  411. package/src/platform/registry/__tests__/resource-registry.test.ts +2005 -2005
  412. package/src/platform/registry/__tests__/serialization.test.ts +1127 -1127
  413. package/src/platform/registry/command-view.ts +180 -180
  414. package/src/platform/registry/domains.ts +165 -165
  415. package/src/platform/registry/index.ts +93 -93
  416. package/src/platform/registry/reserved.ts +24 -24
  417. package/src/platform/registry/resource-metadata.ts +59 -59
  418. package/src/platform/registry/resource-registry.command-queue-groups.test.ts +129 -129
  419. package/src/platform/registry/resource-registry.ts +876 -876
  420. package/src/platform/registry/serialization.ts +273 -273
  421. package/src/platform/registry/serialized-types.ts +231 -231
  422. package/src/platform/registry/stats-types.ts +66 -66
  423. package/src/platform/registry/types.ts +404 -404
  424. package/src/platform/registry/validation.ts +513 -513
  425. package/src/platform/resilience/__tests__/rate-limiter.test.ts +471 -471
  426. package/src/platform/resilience/circuit-breaker.ts +164 -164
  427. package/src/platform/resilience/errors.ts +68 -68
  428. package/src/platform/resilience/http-error-mapper.ts +129 -129
  429. package/src/platform/resilience/index.ts +93 -93
  430. package/src/platform/resilience/rate-limiter-types.ts +46 -46
  431. package/src/platform/resilience/rate-limiter.ts +140 -140
  432. package/src/platform/resilience/retry.ts +89 -89
  433. package/src/platform/resilience/timeout.ts +63 -63
  434. package/src/platform/sse/events.ts +37 -37
  435. package/src/platform/sse/index.ts +7 -7
  436. package/src/platform/utils/__tests__/validation.test.ts +1083 -1083
  437. package/src/platform/utils/currency.ts +96 -96
  438. package/src/platform/utils/debounce.ts +52 -52
  439. package/src/platform/utils/error.ts +41 -41
  440. package/src/platform/utils/hmac.test.ts +97 -97
  441. package/src/platform/utils/index.ts +32 -32
  442. package/src/platform/utils/server/betterstack-logger.ts +210 -210
  443. package/src/platform/utils/server/hmac.ts +44 -44
  444. package/src/platform/utils/server/unsubscribe.ts +111 -111
  445. package/src/platform/utils/token-counter.ts +96 -96
  446. package/src/platform/utils/validation.ts +425 -425
  447. package/src/projects/api-schemas.ts +268 -268
  448. package/src/published.ts +1 -1
  449. package/src/reference/_generated/contracts.md +607 -607
  450. package/src/reference/glossary.md +105 -105
  451. package/src/requests/__tests__/api-schemas.test.ts +277 -277
  452. package/src/requests/api-schemas.ts +83 -83
  453. package/src/requests/index.ts +1 -1
  454. package/src/scaffold-registry/__tests__/index.test.ts +17 -0
  455. package/src/scaffold-registry/__tests__/schema.test.ts +329 -230
  456. package/src/scaffold-registry/index.ts +205 -189
  457. package/src/scaffold-registry/schema.ts +196 -128
  458. package/src/server.ts +272 -272
  459. package/src/supabase/database.types.ts +2719 -2719
  460. package/src/supabase/helpers.ts +20 -20
  461. package/src/supabase/index.ts +52 -52
  462. package/src/supabase/server/client.ts +58 -58
  463. package/src/test-utils/README.md +30 -138
  464. package/src/test-utils/browser-mocks.ts +54 -54
  465. package/src/test-utils/fixtures/api-keys.ts +52 -52
  466. package/src/test-utils/fixtures/index.ts +4 -4
  467. package/src/test-utils/fixtures/memberships.ts +80 -80
  468. package/src/test-utils/fixtures/organizations.ts +69 -69
  469. package/src/test-utils/fixtures/users.ts +79 -79
  470. package/src/test-utils/index.ts +7 -8
  471. package/src/test-utils/mocks/index.ts +2 -2
  472. package/src/test-utils/mocks/supabase.ts +142 -142
  473. package/src/test-utils/mocks/workos.ts +108 -108
  474. package/src/test-utils/published.ts +4 -0
  475. package/src/test-utils/rls/RLSTestContext.ts +554 -554
  476. package/src/test-utils/rls/index.ts +1 -1
@@ -0,0 +1,3122 @@
1
+ import { FunctionsClient } from '@supabase/functions-js';
2
+ import { PostgrestClient, PostgrestQueryBuilder, PostgrestFilterBuilder } from '@supabase/postgrest-js';
3
+ import { RealtimeClientOptions, RealtimeClient, RealtimeChannelOptions, RealtimeChannel } from '@supabase/realtime-js';
4
+ import { StorageClientOptions, StorageClient } from '@supabase/storage-js';
5
+ import { GoTrueClientOptions, AuthClient } from '@supabase/auth-js';
6
+
7
+ type GenericRelationship = {
8
+ foreignKeyName: string;
9
+ columns: string[];
10
+ isOneToOne?: boolean;
11
+ referencedRelation: string;
12
+ referencedColumns: string[];
13
+ };
14
+ type GenericTable = {
15
+ Row: Record<string, unknown>;
16
+ Insert: Record<string, unknown>;
17
+ Update: Record<string, unknown>;
18
+ Relationships: GenericRelationship[];
19
+ };
20
+ type GenericUpdatableView = {
21
+ Row: Record<string, unknown>;
22
+ Insert: Record<string, unknown>;
23
+ Update: Record<string, unknown>;
24
+ Relationships: GenericRelationship[];
25
+ };
26
+ type GenericNonUpdatableView = {
27
+ Row: Record<string, unknown>;
28
+ Relationships: GenericRelationship[];
29
+ };
30
+ type GenericView = GenericUpdatableView | GenericNonUpdatableView;
31
+ type GenericSetofOption = {
32
+ isSetofReturn?: boolean | undefined;
33
+ isOneToOne?: boolean | undefined;
34
+ isNotNullable?: boolean | undefined;
35
+ to: string;
36
+ from: string;
37
+ };
38
+ type GenericFunction = {
39
+ Args: Record<string, unknown> | never;
40
+ Returns: unknown;
41
+ SetofOptions?: GenericSetofOption;
42
+ };
43
+ type GenericSchema = {
44
+ Tables: Record<string, GenericTable>;
45
+ Views: Record<string, GenericView>;
46
+ Functions: Record<string, GenericFunction>;
47
+ };
48
+
49
+ interface SupabaseAuthClientOptions extends GoTrueClientOptions {
50
+ }
51
+ type Fetch = typeof fetch;
52
+ type SupabaseClientOptions<SchemaName> = {
53
+ /**
54
+ * The Postgres schema which your tables belong to. Must be on the list of exposed schemas in Supabase. Defaults to `public`.
55
+ */
56
+ db?: {
57
+ schema?: SchemaName;
58
+ };
59
+ auth?: {
60
+ /**
61
+ * Automatically refreshes the token for logged-in users. Defaults to true.
62
+ */
63
+ autoRefreshToken?: boolean;
64
+ /**
65
+ * Optional key name used for storing tokens in local storage.
66
+ */
67
+ storageKey?: string;
68
+ /**
69
+ * Whether to persist a logged-in session to storage. Defaults to true.
70
+ */
71
+ persistSession?: boolean;
72
+ /**
73
+ * Detect a session from the URL. Used for OAuth login callbacks. Defaults to true.
74
+ */
75
+ detectSessionInUrl?: boolean;
76
+ /**
77
+ * A storage provider. Used to store the logged-in session.
78
+ */
79
+ storage?: SupabaseAuthClientOptions['storage'];
80
+ /**
81
+ * A storage provider to store the user profile separately from the session.
82
+ * Useful when you need to store the session information in cookies,
83
+ * without bloating the data with the redundant user object.
84
+ *
85
+ * @experimental
86
+ */
87
+ userStorage?: SupabaseAuthClientOptions['userStorage'];
88
+ /**
89
+ * OAuth flow to use - defaults to implicit flow. PKCE is recommended for mobile and server-side applications.
90
+ */
91
+ flowType?: SupabaseAuthClientOptions['flowType'];
92
+ /**
93
+ * If debug messages for authentication client are emitted. Can be used to inspect the behavior of the library.
94
+ */
95
+ debug?: SupabaseAuthClientOptions['debug'];
96
+ /**
97
+ * Provide your own locking mechanism based on the environment. By default no locking is done at this time.
98
+ *
99
+ * @experimental
100
+ */
101
+ lock?: SupabaseAuthClientOptions['lock'];
102
+ /**
103
+ * If there is an error with the query, throwOnError will reject the promise by
104
+ * throwing the error instead of returning it as part of a successful response.
105
+ */
106
+ throwOnError?: SupabaseAuthClientOptions['throwOnError'];
107
+ };
108
+ /**
109
+ * Options passed to the realtime-js instance
110
+ */
111
+ realtime?: RealtimeClientOptions;
112
+ storage?: StorageClientOptions;
113
+ global?: {
114
+ /**
115
+ * A custom `fetch` implementation.
116
+ */
117
+ fetch?: Fetch;
118
+ /**
119
+ * Optional headers for initializing the client.
120
+ */
121
+ headers?: Record<string, string>;
122
+ };
123
+ /**
124
+ * Optional function for using a third-party authentication system with
125
+ * Supabase. The function should return an access token or ID token (JWT) by
126
+ * obtaining it from the third-party auth SDK. Note that this
127
+ * function may be called concurrently and many times. Use memoization and
128
+ * locking techniques if this is not supported by the SDKs.
129
+ *
130
+ * When set, the `auth` namespace of the Supabase client cannot be used.
131
+ * Create another client if you wish to use Supabase Auth and third-party
132
+ * authentications concurrently in the same application.
133
+ */
134
+ accessToken?: () => Promise<string | null>;
135
+ };
136
+
137
+ declare class SupabaseAuthClient extends AuthClient {
138
+ constructor(options: SupabaseAuthClientOptions);
139
+ }
140
+
141
+ /**
142
+ * AUTO-GENERATED FILE - DO NOT EDIT
143
+ *
144
+ * This file is automatically synchronized from @supabase/postgrest-js
145
+ * Source: packages/core/postgrest-js/src/types/common/
146
+ *
147
+ * To update this file, modify the source in postgrest-js and run:
148
+ * npm run codegen
149
+ */
150
+
151
+ type IsMatchingArgs<FnArgs extends GenericFunction['Args'], PassedArgs extends GenericFunction['Args']> = [FnArgs] extends [Record<PropertyKey, never>] ? PassedArgs extends Record<PropertyKey, never> ? true : false : keyof PassedArgs extends keyof FnArgs ? PassedArgs extends FnArgs ? true : false : false;
152
+ type MatchingFunctionArgs<Fn extends GenericFunction, Args extends GenericFunction['Args']> = Fn extends {
153
+ Args: infer A extends GenericFunction['Args'];
154
+ } ? IsMatchingArgs<A, Args> extends true ? Fn : never : false;
155
+ type FindMatchingFunctionByArgs<FnUnion, Args extends GenericFunction['Args']> = FnUnion extends infer Fn extends GenericFunction ? MatchingFunctionArgs<Fn, Args> : false;
156
+ type TablesAndViews<Schema extends GenericSchema> = Schema['Tables'] & Exclude<Schema['Views'], ''>;
157
+ type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
158
+ type LastOf<T> = UnionToIntersection<T extends any ? () => T : never> extends () => infer R ? R : never;
159
+ type IsAny<T> = 0 extends 1 & T ? true : false;
160
+ type ExactMatch<T, S> = [T] extends [S] ? ([S] extends [T] ? true : false) : false;
161
+ type ExtractExactFunction<Fns, Args> = Fns extends infer F ? F extends GenericFunction ? ExactMatch<F['Args'], Args> extends true ? F : never : never : never;
162
+ type IsNever<T> = [T] extends [never] ? true : false;
163
+ type RpcFunctionNotFound<FnName> = {
164
+ Row: any;
165
+ Result: {
166
+ error: true;
167
+ } & "Couldn't infer function definition matching provided arguments";
168
+ RelationName: FnName;
169
+ Relationships: null;
170
+ };
171
+ type GetRpcFunctionFilterBuilderByArgs<Schema extends GenericSchema, FnName extends string & keyof Schema['Functions'], Args> = {
172
+ 0: Schema['Functions'][FnName];
173
+ 1: IsAny<Schema> extends true ? any : IsNever<Args> extends true ? IsNever<ExtractExactFunction<Schema['Functions'][FnName], Args>> extends true ? LastOf<Schema['Functions'][FnName]> : ExtractExactFunction<Schema['Functions'][FnName], Args> : Args extends Record<PropertyKey, never> ? LastOf<Schema['Functions'][FnName]> : Args extends GenericFunction['Args'] ? IsNever<LastOf<FindMatchingFunctionByArgs<Schema['Functions'][FnName], Args>>> extends true ? LastOf<Schema['Functions'][FnName]> : LastOf<FindMatchingFunctionByArgs<Schema['Functions'][FnName], Args>> : ExtractExactFunction<Schema['Functions'][FnName], Args> extends GenericFunction ? ExtractExactFunction<Schema['Functions'][FnName], Args> : any;
174
+ }[1] extends infer Fn ? IsAny<Fn> extends true ? {
175
+ Row: any;
176
+ Result: any;
177
+ RelationName: FnName;
178
+ Relationships: null;
179
+ } : Fn extends GenericFunction ? {
180
+ Row: Fn['SetofOptions'] extends GenericSetofOption ? Fn['SetofOptions']['isSetofReturn'] extends true ? TablesAndViews<Schema>[Fn['SetofOptions']['to']]['Row'] : TablesAndViews<Schema>[Fn['SetofOptions']['to']]['Row'] : Fn['Returns'] extends any[] ? Fn['Returns'][number] extends Record<string, unknown> ? Fn['Returns'][number] : never : Fn['Returns'] extends Record<string, unknown> ? Fn['Returns'] : never;
181
+ Result: Fn['SetofOptions'] extends GenericSetofOption ? Fn['SetofOptions']['isSetofReturn'] extends true ? Fn['SetofOptions']['isOneToOne'] extends true ? Fn['Returns'][] : Fn['Returns'] : Fn['Returns'] : Fn['Returns'];
182
+ RelationName: Fn['SetofOptions'] extends GenericSetofOption ? Fn['SetofOptions']['to'] : FnName;
183
+ Relationships: Fn['SetofOptions'] extends GenericSetofOption ? Fn['SetofOptions']['to'] extends keyof Schema['Tables'] ? Schema['Tables'][Fn['SetofOptions']['to']]['Relationships'] : Schema['Views'][Fn['SetofOptions']['to']]['Relationships'] : null;
184
+ } : Fn extends false ? RpcFunctionNotFound<FnName> : RpcFunctionNotFound<FnName> : RpcFunctionNotFound<FnName>;
185
+
186
+ /**
187
+ * Supabase Client.
188
+ *
189
+ * An isomorphic Javascript client for interacting with Postgres.
190
+ */
191
+ declare class SupabaseClient<Database = any, SchemaNameOrClientOptions extends (string & keyof Omit<Database, '__InternalSupabase'>) | {
192
+ PostgrestVersion: string;
193
+ } = 'public' extends keyof Omit<Database, '__InternalSupabase'> ? 'public' : string & keyof Omit<Database, '__InternalSupabase'>, SchemaName extends string & keyof Omit<Database, '__InternalSupabase'> = SchemaNameOrClientOptions extends string & keyof Omit<Database, '__InternalSupabase'> ? SchemaNameOrClientOptions : 'public' extends keyof Omit<Database, '__InternalSupabase'> ? 'public' : string & keyof Omit<Omit<Database, '__InternalSupabase'>, '__InternalSupabase'>, Schema extends Omit<Database, '__InternalSupabase'>[SchemaName] extends GenericSchema ? Omit<Database, '__InternalSupabase'>[SchemaName] : never = Omit<Database, '__InternalSupabase'>[SchemaName] extends GenericSchema ? Omit<Database, '__InternalSupabase'>[SchemaName] : never, ClientOptions extends {
194
+ PostgrestVersion: string;
195
+ } = SchemaNameOrClientOptions extends string & keyof Omit<Database, '__InternalSupabase'> ? Database extends {
196
+ __InternalSupabase: {
197
+ PostgrestVersion: string;
198
+ };
199
+ } ? Database['__InternalSupabase'] : {
200
+ PostgrestVersion: '12';
201
+ } : SchemaNameOrClientOptions extends {
202
+ PostgrestVersion: string;
203
+ } ? SchemaNameOrClientOptions : never> {
204
+ protected supabaseUrl: string;
205
+ protected supabaseKey: string;
206
+ /**
207
+ * Supabase Auth allows you to create and manage user sessions for access to data that is secured by access policies.
208
+ */
209
+ auth: SupabaseAuthClient;
210
+ realtime: RealtimeClient;
211
+ /**
212
+ * Supabase Storage allows you to manage user-generated content, such as photos or videos.
213
+ */
214
+ storage: StorageClient;
215
+ protected realtimeUrl: URL;
216
+ protected authUrl: URL;
217
+ protected storageUrl: URL;
218
+ protected functionsUrl: URL;
219
+ protected rest: PostgrestClient<Database, ClientOptions, SchemaName>;
220
+ protected storageKey: string;
221
+ protected fetch?: Fetch;
222
+ protected changedAccessToken?: string;
223
+ protected accessToken?: () => Promise<string | null>;
224
+ protected headers: Record<string, string>;
225
+ /**
226
+ * Create a new client for use in the browser.
227
+ * @param supabaseUrl The unique Supabase URL which is supplied when you create a new project in your project dashboard.
228
+ * @param supabaseKey The unique Supabase Key which is supplied when you create a new project in your project dashboard.
229
+ * @param options.db.schema You can switch in between schemas. The schema needs to be on the list of exposed schemas inside Supabase.
230
+ * @param options.auth.autoRefreshToken Set to "true" if you want to automatically refresh the token before expiring.
231
+ * @param options.auth.persistSession Set to "true" if you want to automatically save the user session into local storage.
232
+ * @param options.auth.detectSessionInUrl Set to "true" if you want to automatically detects OAuth grants in the URL and signs in the user.
233
+ * @param options.realtime Options passed along to realtime-js constructor.
234
+ * @param options.storage Options passed along to the storage-js constructor.
235
+ * @param options.global.fetch A custom fetch implementation.
236
+ * @param options.global.headers Any additional headers to send with each network request.
237
+ */
238
+ constructor(supabaseUrl: string, supabaseKey: string, options?: SupabaseClientOptions<SchemaName>);
239
+ /**
240
+ * Supabase Functions allows you to deploy and invoke edge functions.
241
+ */
242
+ get functions(): FunctionsClient;
243
+ from<TableName extends string & keyof Schema['Tables'], Table extends Schema['Tables'][TableName]>(relation: TableName): PostgrestQueryBuilder<ClientOptions, Schema, Table, TableName>;
244
+ from<ViewName extends string & keyof Schema['Views'], View extends Schema['Views'][ViewName]>(relation: ViewName): PostgrestQueryBuilder<ClientOptions, Schema, View, ViewName>;
245
+ /**
246
+ * Select a schema to query or perform an function (rpc) call.
247
+ *
248
+ * The schema needs to be on the list of exposed schemas inside Supabase.
249
+ *
250
+ * @param schema - The schema to query
251
+ */
252
+ schema<DynamicSchema extends string & keyof Omit<Database, '__InternalSupabase'>>(schema: DynamicSchema): PostgrestClient<Database, ClientOptions, DynamicSchema, Database[DynamicSchema] extends GenericSchema ? Database[DynamicSchema] : any>;
253
+ /**
254
+ * Perform a function call.
255
+ *
256
+ * @param fn - The function name to call
257
+ * @param args - The arguments to pass to the function call
258
+ * @param options - Named parameters
259
+ * @param options.head - When set to `true`, `data` will not be returned.
260
+ * Useful if you only need the count.
261
+ * @param options.get - When set to `true`, the function will be called with
262
+ * read-only access mode.
263
+ * @param options.count - Count algorithm to use to count rows returned by the
264
+ * function. Only applicable for [set-returning
265
+ * functions](https://www.postgresql.org/docs/current/functions-srf.html).
266
+ *
267
+ * `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
268
+ * hood.
269
+ *
270
+ * `"planned"`: Approximated but fast count algorithm. Uses the Postgres
271
+ * statistics under the hood.
272
+ *
273
+ * `"estimated"`: Uses exact count for low numbers and planned count for high
274
+ * numbers.
275
+ */
276
+ rpc<FnName extends string & keyof Schema['Functions'], Args extends Schema['Functions'][FnName]['Args'] = never, FilterBuilder extends GetRpcFunctionFilterBuilderByArgs<Schema, FnName, Args> = GetRpcFunctionFilterBuilderByArgs<Schema, FnName, Args>>(fn: FnName, args?: Args, options?: {
277
+ head?: boolean;
278
+ get?: boolean;
279
+ count?: 'exact' | 'planned' | 'estimated';
280
+ }): PostgrestFilterBuilder<ClientOptions, Schema, FilterBuilder['Row'], FilterBuilder['Result'], FilterBuilder['RelationName'], FilterBuilder['Relationships'], 'RPC'>;
281
+ /**
282
+ * Creates a Realtime channel with Broadcast, Presence, and Postgres Changes.
283
+ *
284
+ * @param {string} name - The name of the Realtime channel.
285
+ * @param {Object} opts - The options to pass to the Realtime channel.
286
+ *
287
+ */
288
+ channel(name: string, opts?: RealtimeChannelOptions): RealtimeChannel;
289
+ /**
290
+ * Returns all Realtime channels.
291
+ */
292
+ getChannels(): RealtimeChannel[];
293
+ /**
294
+ * Unsubscribes and removes Realtime channel from Realtime client.
295
+ *
296
+ * @param {RealtimeChannel} channel - The name of the Realtime channel.
297
+ *
298
+ */
299
+ removeChannel(channel: RealtimeChannel): Promise<'ok' | 'timed out' | 'error'>;
300
+ /**
301
+ * Unsubscribes and removes all Realtime channels from Realtime client.
302
+ */
303
+ removeAllChannels(): Promise<('ok' | 'timed out' | 'error')[]>;
304
+ private _getAccessToken;
305
+ private _initSupabaseAuthClient;
306
+ private _initRealtimeClient;
307
+ private _listenForAuthEvents;
308
+ private _handleTokenChanged;
309
+ }
310
+
311
+ type Json = string | number | boolean | null | {
312
+ [key: string]: Json | undefined;
313
+ } | Json[];
314
+ type Database = {
315
+ __InternalSupabase: {
316
+ PostgrestVersion: "12.2.3 (519615d)";
317
+ };
318
+ public: {
319
+ Tables: {
320
+ acq_companies: {
321
+ Row: {
322
+ batch_id: string | null;
323
+ category: string | null;
324
+ category_pain: string | null;
325
+ created_at: string;
326
+ domain: string | null;
327
+ enrichment_data: Json | null;
328
+ filter_reason: string | null;
329
+ founded_year: number | null;
330
+ id: string;
331
+ linkedin_url: string | null;
332
+ location_city: string | null;
333
+ location_state: string | null;
334
+ name: string;
335
+ num_employees: number | null;
336
+ organization_id: string;
337
+ pipeline_status: Json;
338
+ segment: string | null;
339
+ source: string | null;
340
+ status: string;
341
+ updated_at: string;
342
+ website: string | null;
343
+ };
344
+ Insert: {
345
+ batch_id?: string | null;
346
+ category?: string | null;
347
+ category_pain?: string | null;
348
+ created_at?: string;
349
+ domain?: string | null;
350
+ enrichment_data?: Json | null;
351
+ filter_reason?: string | null;
352
+ founded_year?: number | null;
353
+ id?: string;
354
+ linkedin_url?: string | null;
355
+ location_city?: string | null;
356
+ location_state?: string | null;
357
+ name: string;
358
+ num_employees?: number | null;
359
+ organization_id: string;
360
+ pipeline_status?: Json;
361
+ segment?: string | null;
362
+ source?: string | null;
363
+ status?: string;
364
+ updated_at?: string;
365
+ website?: string | null;
366
+ };
367
+ Update: {
368
+ batch_id?: string | null;
369
+ category?: string | null;
370
+ category_pain?: string | null;
371
+ created_at?: string;
372
+ domain?: string | null;
373
+ enrichment_data?: Json | null;
374
+ filter_reason?: string | null;
375
+ founded_year?: number | null;
376
+ id?: string;
377
+ linkedin_url?: string | null;
378
+ location_city?: string | null;
379
+ location_state?: string | null;
380
+ name?: string;
381
+ num_employees?: number | null;
382
+ organization_id?: string;
383
+ pipeline_status?: Json;
384
+ segment?: string | null;
385
+ source?: string | null;
386
+ status?: string;
387
+ updated_at?: string;
388
+ website?: string | null;
389
+ };
390
+ Relationships: [
391
+ {
392
+ foreignKeyName: "acq_companies_organization_id_fkey";
393
+ columns: ["organization_id"];
394
+ isOneToOne: false;
395
+ referencedRelation: "organizations";
396
+ referencedColumns: ["id"];
397
+ }
398
+ ];
399
+ };
400
+ acq_contacts: {
401
+ Row: {
402
+ batch_id: string | null;
403
+ brochure_first_viewed_at: string | null;
404
+ brochure_view_count: number;
405
+ company_id: string | null;
406
+ created_at: string;
407
+ email: string;
408
+ email_valid: string | null;
409
+ enrichment_data: Json;
410
+ filter_reason: string | null;
411
+ first_name: string | null;
412
+ headline: string | null;
413
+ id: string;
414
+ last_name: string | null;
415
+ linkedin_url: string | null;
416
+ nurture: boolean;
417
+ opening_line: string | null;
418
+ organization_id: string;
419
+ pipeline_status: Json;
420
+ source: string | null;
421
+ source_id: string | null;
422
+ status: string;
423
+ title: string | null;
424
+ updated_at: string;
425
+ };
426
+ Insert: {
427
+ batch_id?: string | null;
428
+ brochure_first_viewed_at?: string | null;
429
+ brochure_view_count?: number;
430
+ company_id?: string | null;
431
+ created_at?: string;
432
+ email: string;
433
+ email_valid?: string | null;
434
+ enrichment_data?: Json;
435
+ filter_reason?: string | null;
436
+ first_name?: string | null;
437
+ headline?: string | null;
438
+ id?: string;
439
+ last_name?: string | null;
440
+ linkedin_url?: string | null;
441
+ nurture?: boolean;
442
+ opening_line?: string | null;
443
+ organization_id: string;
444
+ pipeline_status?: Json;
445
+ source?: string | null;
446
+ source_id?: string | null;
447
+ status?: string;
448
+ title?: string | null;
449
+ updated_at?: string;
450
+ };
451
+ Update: {
452
+ batch_id?: string | null;
453
+ brochure_first_viewed_at?: string | null;
454
+ brochure_view_count?: number;
455
+ company_id?: string | null;
456
+ created_at?: string;
457
+ email?: string;
458
+ email_valid?: string | null;
459
+ enrichment_data?: Json;
460
+ filter_reason?: string | null;
461
+ first_name?: string | null;
462
+ headline?: string | null;
463
+ id?: string;
464
+ last_name?: string | null;
465
+ linkedin_url?: string | null;
466
+ nurture?: boolean;
467
+ opening_line?: string | null;
468
+ organization_id?: string;
469
+ pipeline_status?: Json;
470
+ source?: string | null;
471
+ source_id?: string | null;
472
+ status?: string;
473
+ title?: string | null;
474
+ updated_at?: string;
475
+ };
476
+ Relationships: [
477
+ {
478
+ foreignKeyName: "acq_contacts_company_id_fkey";
479
+ columns: ["company_id"];
480
+ isOneToOne: false;
481
+ referencedRelation: "acq_companies";
482
+ referencedColumns: ["id"];
483
+ },
484
+ {
485
+ foreignKeyName: "acq_contacts_organization_id_fkey";
486
+ columns: ["organization_id"];
487
+ isOneToOne: false;
488
+ referencedRelation: "organizations";
489
+ referencedColumns: ["id"];
490
+ }
491
+ ];
492
+ };
493
+ acq_content: {
494
+ Row: {
495
+ body: string | null;
496
+ created_at: string;
497
+ id: string;
498
+ organization_id: string;
499
+ pillar: string;
500
+ status: string;
501
+ title: string;
502
+ updated_at: string;
503
+ };
504
+ Insert: {
505
+ body?: string | null;
506
+ created_at?: string;
507
+ id?: string;
508
+ organization_id: string;
509
+ pillar: string;
510
+ status?: string;
511
+ title: string;
512
+ updated_at?: string;
513
+ };
514
+ Update: {
515
+ body?: string | null;
516
+ created_at?: string;
517
+ id?: string;
518
+ organization_id?: string;
519
+ pillar?: string;
520
+ status?: string;
521
+ title?: string;
522
+ updated_at?: string;
523
+ };
524
+ Relationships: [
525
+ {
526
+ foreignKeyName: "acq_content_organization_id_fkey";
527
+ columns: ["organization_id"];
528
+ isOneToOne: false;
529
+ referencedRelation: "organizations";
530
+ referencedColumns: ["id"];
531
+ }
532
+ ];
533
+ };
534
+ acq_content_distributions: {
535
+ Row: {
536
+ adapted_body: string | null;
537
+ checklist: Json | null;
538
+ content_id: string;
539
+ created_at: string;
540
+ format: string;
541
+ id: string;
542
+ media_urls: Json;
543
+ metrics: Json;
544
+ metrics_updated_at: string | null;
545
+ organization_id: string;
546
+ platform: string;
547
+ platform_content: Json | null;
548
+ platform_post_id: string | null;
549
+ platform_url: string | null;
550
+ published_at: string | null;
551
+ status: string;
552
+ updated_at: string;
553
+ };
554
+ Insert: {
555
+ adapted_body?: string | null;
556
+ checklist?: Json | null;
557
+ content_id: string;
558
+ created_at?: string;
559
+ format: string;
560
+ id?: string;
561
+ media_urls?: Json;
562
+ metrics?: Json;
563
+ metrics_updated_at?: string | null;
564
+ organization_id: string;
565
+ platform: string;
566
+ platform_content?: Json | null;
567
+ platform_post_id?: string | null;
568
+ platform_url?: string | null;
569
+ published_at?: string | null;
570
+ status?: string;
571
+ updated_at?: string;
572
+ };
573
+ Update: {
574
+ adapted_body?: string | null;
575
+ checklist?: Json | null;
576
+ content_id?: string;
577
+ created_at?: string;
578
+ format?: string;
579
+ id?: string;
580
+ media_urls?: Json;
581
+ metrics?: Json;
582
+ metrics_updated_at?: string | null;
583
+ organization_id?: string;
584
+ platform?: string;
585
+ platform_content?: Json | null;
586
+ platform_post_id?: string | null;
587
+ platform_url?: string | null;
588
+ published_at?: string | null;
589
+ status?: string;
590
+ updated_at?: string;
591
+ };
592
+ Relationships: [
593
+ {
594
+ foreignKeyName: "acq_content_distributions_content_id_fkey";
595
+ columns: ["content_id"];
596
+ isOneToOne: false;
597
+ referencedRelation: "acq_content";
598
+ referencedColumns: ["id"];
599
+ },
600
+ {
601
+ foreignKeyName: "acq_content_distributions_organization_id_fkey";
602
+ columns: ["organization_id"];
603
+ isOneToOne: false;
604
+ referencedRelation: "organizations";
605
+ referencedColumns: ["id"];
606
+ }
607
+ ];
608
+ };
609
+ acq_deal_notes: {
610
+ Row: {
611
+ author_user_id: string | null;
612
+ body: string;
613
+ created_at: string;
614
+ deal_id: string;
615
+ id: string;
616
+ organization_id: string;
617
+ updated_at: string;
618
+ };
619
+ Insert: {
620
+ author_user_id?: string | null;
621
+ body: string;
622
+ created_at?: string;
623
+ deal_id: string;
624
+ id?: string;
625
+ organization_id: string;
626
+ updated_at?: string;
627
+ };
628
+ Update: {
629
+ author_user_id?: string | null;
630
+ body?: string;
631
+ created_at?: string;
632
+ deal_id?: string;
633
+ id?: string;
634
+ organization_id?: string;
635
+ updated_at?: string;
636
+ };
637
+ Relationships: [
638
+ {
639
+ foreignKeyName: "acq_deal_notes_deal_id_fkey";
640
+ columns: ["deal_id"];
641
+ isOneToOne: false;
642
+ referencedRelation: "acq_deals";
643
+ referencedColumns: ["id"];
644
+ },
645
+ {
646
+ foreignKeyName: "acq_deal_notes_organization_id_fkey";
647
+ columns: ["organization_id"];
648
+ isOneToOne: false;
649
+ referencedRelation: "organizations";
650
+ referencedColumns: ["id"];
651
+ }
652
+ ];
653
+ };
654
+ acq_deal_tasks: {
655
+ Row: {
656
+ assignee_user_id: string | null;
657
+ completed_at: string | null;
658
+ completed_by_user_id: string | null;
659
+ created_at: string;
660
+ created_by_user_id: string | null;
661
+ deal_id: string;
662
+ description: string | null;
663
+ due_at: string | null;
664
+ id: string;
665
+ kind: string;
666
+ organization_id: string;
667
+ title: string;
668
+ updated_at: string;
669
+ };
670
+ Insert: {
671
+ assignee_user_id?: string | null;
672
+ completed_at?: string | null;
673
+ completed_by_user_id?: string | null;
674
+ created_at?: string;
675
+ created_by_user_id?: string | null;
676
+ deal_id: string;
677
+ description?: string | null;
678
+ due_at?: string | null;
679
+ id?: string;
680
+ kind?: string;
681
+ organization_id: string;
682
+ title: string;
683
+ updated_at?: string;
684
+ };
685
+ Update: {
686
+ assignee_user_id?: string | null;
687
+ completed_at?: string | null;
688
+ completed_by_user_id?: string | null;
689
+ created_at?: string;
690
+ created_by_user_id?: string | null;
691
+ deal_id?: string;
692
+ description?: string | null;
693
+ due_at?: string | null;
694
+ id?: string;
695
+ kind?: string;
696
+ organization_id?: string;
697
+ title?: string;
698
+ updated_at?: string;
699
+ };
700
+ Relationships: [
701
+ {
702
+ foreignKeyName: "acq_deal_tasks_deal_id_fkey";
703
+ columns: ["deal_id"];
704
+ isOneToOne: false;
705
+ referencedRelation: "acq_deals";
706
+ referencedColumns: ["id"];
707
+ },
708
+ {
709
+ foreignKeyName: "acq_deal_tasks_organization_id_fkey";
710
+ columns: ["organization_id"];
711
+ isOneToOne: false;
712
+ referencedRelation: "organizations";
713
+ referencedColumns: ["id"];
714
+ }
715
+ ];
716
+ };
717
+ acq_deals: {
718
+ Row: {
719
+ activity_log: Json;
720
+ cached_stage: string | null;
721
+ closed_lost_at: string | null;
722
+ closed_lost_reason: string | null;
723
+ contact_email: string;
724
+ contact_id: string | null;
725
+ created_at: string;
726
+ discovery_data: Json | null;
727
+ discovery_submitted_at: string | null;
728
+ discovery_submitted_by: string | null;
729
+ id: string;
730
+ initial_fee: number | null;
731
+ monthly_fee: number | null;
732
+ organization_id: string;
733
+ payment_link_sent_at: string | null;
734
+ payment_received_at: string | null;
735
+ proposal_data: Json | null;
736
+ proposal_generated_at: string | null;
737
+ proposal_pdf_url: string | null;
738
+ proposal_reviewed_at: string | null;
739
+ proposal_reviewed_by: string | null;
740
+ proposal_sent_at: string | null;
741
+ proposal_signed_at: string | null;
742
+ proposal_status: string | null;
743
+ signature_envelope_id: string | null;
744
+ source_list_id: string | null;
745
+ source_type: string | null;
746
+ stripe_payment_id: string | null;
747
+ stripe_payment_link: string | null;
748
+ stripe_payment_link_id: string | null;
749
+ stripe_subscription_id: string | null;
750
+ updated_at: string;
751
+ };
752
+ Insert: {
753
+ activity_log?: Json;
754
+ cached_stage?: string | null;
755
+ closed_lost_at?: string | null;
756
+ closed_lost_reason?: string | null;
757
+ contact_email: string;
758
+ contact_id?: string | null;
759
+ created_at?: string;
760
+ discovery_data?: Json | null;
761
+ discovery_submitted_at?: string | null;
762
+ discovery_submitted_by?: string | null;
763
+ id?: string;
764
+ initial_fee?: number | null;
765
+ monthly_fee?: number | null;
766
+ organization_id: string;
767
+ payment_link_sent_at?: string | null;
768
+ payment_received_at?: string | null;
769
+ proposal_data?: Json | null;
770
+ proposal_generated_at?: string | null;
771
+ proposal_pdf_url?: string | null;
772
+ proposal_reviewed_at?: string | null;
773
+ proposal_reviewed_by?: string | null;
774
+ proposal_sent_at?: string | null;
775
+ proposal_signed_at?: string | null;
776
+ proposal_status?: string | null;
777
+ signature_envelope_id?: string | null;
778
+ source_list_id?: string | null;
779
+ source_type?: string | null;
780
+ stripe_payment_id?: string | null;
781
+ stripe_payment_link?: string | null;
782
+ stripe_payment_link_id?: string | null;
783
+ stripe_subscription_id?: string | null;
784
+ updated_at?: string;
785
+ };
786
+ Update: {
787
+ activity_log?: Json;
788
+ cached_stage?: string | null;
789
+ closed_lost_at?: string | null;
790
+ closed_lost_reason?: string | null;
791
+ contact_email?: string;
792
+ contact_id?: string | null;
793
+ created_at?: string;
794
+ discovery_data?: Json | null;
795
+ discovery_submitted_at?: string | null;
796
+ discovery_submitted_by?: string | null;
797
+ id?: string;
798
+ initial_fee?: number | null;
799
+ monthly_fee?: number | null;
800
+ organization_id?: string;
801
+ payment_link_sent_at?: string | null;
802
+ payment_received_at?: string | null;
803
+ proposal_data?: Json | null;
804
+ proposal_generated_at?: string | null;
805
+ proposal_pdf_url?: string | null;
806
+ proposal_reviewed_at?: string | null;
807
+ proposal_reviewed_by?: string | null;
808
+ proposal_sent_at?: string | null;
809
+ proposal_signed_at?: string | null;
810
+ proposal_status?: string | null;
811
+ signature_envelope_id?: string | null;
812
+ source_list_id?: string | null;
813
+ source_type?: string | null;
814
+ stripe_payment_id?: string | null;
815
+ stripe_payment_link?: string | null;
816
+ stripe_payment_link_id?: string | null;
817
+ stripe_subscription_id?: string | null;
818
+ updated_at?: string;
819
+ };
820
+ Relationships: [
821
+ {
822
+ foreignKeyName: "acq_deals_contact_id_fkey";
823
+ columns: ["contact_id"];
824
+ isOneToOne: false;
825
+ referencedRelation: "acq_contacts";
826
+ referencedColumns: ["id"];
827
+ },
828
+ {
829
+ foreignKeyName: "acq_deals_organization_id_fkey";
830
+ columns: ["organization_id"];
831
+ isOneToOne: false;
832
+ referencedRelation: "organizations";
833
+ referencedColumns: ["id"];
834
+ },
835
+ {
836
+ foreignKeyName: "acq_deals_source_list_id_fkey";
837
+ columns: ["source_list_id"];
838
+ isOneToOne: false;
839
+ referencedRelation: "acq_lists";
840
+ referencedColumns: ["id"];
841
+ }
842
+ ];
843
+ };
844
+ acq_list_companies: {
845
+ Row: {
846
+ added_at: string;
847
+ added_by: string | null;
848
+ company_id: string;
849
+ id: string;
850
+ list_id: string;
851
+ source_execution_id: string | null;
852
+ source_input_hash: string | null;
853
+ source_resource_id: string | null;
854
+ stage: string | null;
855
+ stage_updated_at: string | null;
856
+ };
857
+ Insert: {
858
+ added_at?: string;
859
+ added_by?: string | null;
860
+ company_id: string;
861
+ id?: string;
862
+ list_id: string;
863
+ source_execution_id?: string | null;
864
+ source_input_hash?: string | null;
865
+ source_resource_id?: string | null;
866
+ stage?: string | null;
867
+ stage_updated_at?: string | null;
868
+ };
869
+ Update: {
870
+ added_at?: string;
871
+ added_by?: string | null;
872
+ company_id?: string;
873
+ id?: string;
874
+ list_id?: string;
875
+ source_execution_id?: string | null;
876
+ source_input_hash?: string | null;
877
+ source_resource_id?: string | null;
878
+ stage?: string | null;
879
+ stage_updated_at?: string | null;
880
+ };
881
+ Relationships: [
882
+ {
883
+ foreignKeyName: "acq_list_companies_company_id_fkey";
884
+ columns: ["company_id"];
885
+ isOneToOne: false;
886
+ referencedRelation: "acq_companies";
887
+ referencedColumns: ["id"];
888
+ },
889
+ {
890
+ foreignKeyName: "acq_list_companies_list_id_fkey";
891
+ columns: ["list_id"];
892
+ isOneToOne: false;
893
+ referencedRelation: "acq_lists";
894
+ referencedColumns: ["id"];
895
+ },
896
+ {
897
+ foreignKeyName: "acq_list_companies_source_execution_id_fkey";
898
+ columns: ["source_execution_id"];
899
+ isOneToOne: false;
900
+ referencedRelation: "execution_logs";
901
+ referencedColumns: ["execution_id"];
902
+ }
903
+ ];
904
+ };
905
+ acq_list_executions: {
906
+ Row: {
907
+ created_at: string;
908
+ execution_id: string;
909
+ id: string;
910
+ list_id: string;
911
+ payload: Json;
912
+ };
913
+ Insert: {
914
+ created_at?: string;
915
+ execution_id: string;
916
+ id?: string;
917
+ list_id: string;
918
+ payload?: Json;
919
+ };
920
+ Update: {
921
+ created_at?: string;
922
+ execution_id?: string;
923
+ id?: string;
924
+ list_id?: string;
925
+ payload?: Json;
926
+ };
927
+ Relationships: [
928
+ {
929
+ foreignKeyName: "acq_list_executions_execution_id_fkey";
930
+ columns: ["execution_id"];
931
+ isOneToOne: false;
932
+ referencedRelation: "execution_logs";
933
+ referencedColumns: ["execution_id"];
934
+ },
935
+ {
936
+ foreignKeyName: "acq_list_executions_list_id_fkey";
937
+ columns: ["list_id"];
938
+ isOneToOne: false;
939
+ referencedRelation: "acq_lists";
940
+ referencedColumns: ["id"];
941
+ }
942
+ ];
943
+ };
944
+ acq_list_members: {
945
+ Row: {
946
+ added_at: string;
947
+ added_by: string | null;
948
+ contact_id: string;
949
+ id: string;
950
+ list_id: string;
951
+ source_execution_id: string | null;
952
+ source_input_hash: string | null;
953
+ source_resource_id: string | null;
954
+ stage: string | null;
955
+ stage_updated_at: string | null;
956
+ };
957
+ Insert: {
958
+ added_at?: string;
959
+ added_by?: string | null;
960
+ contact_id: string;
961
+ id?: string;
962
+ list_id: string;
963
+ source_execution_id?: string | null;
964
+ source_input_hash?: string | null;
965
+ source_resource_id?: string | null;
966
+ stage?: string | null;
967
+ stage_updated_at?: string | null;
968
+ };
969
+ Update: {
970
+ added_at?: string;
971
+ added_by?: string | null;
972
+ contact_id?: string;
973
+ id?: string;
974
+ list_id?: string;
975
+ source_execution_id?: string | null;
976
+ source_input_hash?: string | null;
977
+ source_resource_id?: string | null;
978
+ stage?: string | null;
979
+ stage_updated_at?: string | null;
980
+ };
981
+ Relationships: [
982
+ {
983
+ foreignKeyName: "acq_list_members_contact_id_fkey";
984
+ columns: ["contact_id"];
985
+ isOneToOne: false;
986
+ referencedRelation: "acq_contacts";
987
+ referencedColumns: ["id"];
988
+ },
989
+ {
990
+ foreignKeyName: "acq_list_members_list_id_fkey";
991
+ columns: ["list_id"];
992
+ isOneToOne: false;
993
+ referencedRelation: "acq_lists";
994
+ referencedColumns: ["id"];
995
+ },
996
+ {
997
+ foreignKeyName: "acq_list_members_source_execution_id_fkey";
998
+ columns: ["source_execution_id"];
999
+ isOneToOne: false;
1000
+ referencedRelation: "execution_logs";
1001
+ referencedColumns: ["execution_id"];
1002
+ }
1003
+ ];
1004
+ };
1005
+ acq_lists: {
1006
+ Row: {
1007
+ batch_ids: string[];
1008
+ completed_at: string | null;
1009
+ config: Json;
1010
+ created_at: string;
1011
+ description: string | null;
1012
+ id: string;
1013
+ instantly_campaign_id: string | null;
1014
+ launched_at: string | null;
1015
+ metadata: Json;
1016
+ name: string;
1017
+ organization_id: string;
1018
+ status: string;
1019
+ type: string;
1020
+ };
1021
+ Insert: {
1022
+ batch_ids?: string[];
1023
+ completed_at?: string | null;
1024
+ config?: Json;
1025
+ created_at?: string;
1026
+ description?: string | null;
1027
+ id?: string;
1028
+ instantly_campaign_id?: string | null;
1029
+ launched_at?: string | null;
1030
+ metadata?: Json;
1031
+ name: string;
1032
+ organization_id: string;
1033
+ status?: string;
1034
+ type?: string;
1035
+ };
1036
+ Update: {
1037
+ batch_ids?: string[];
1038
+ completed_at?: string | null;
1039
+ config?: Json;
1040
+ created_at?: string;
1041
+ description?: string | null;
1042
+ id?: string;
1043
+ instantly_campaign_id?: string | null;
1044
+ launched_at?: string | null;
1045
+ metadata?: Json;
1046
+ name?: string;
1047
+ organization_id?: string;
1048
+ status?: string;
1049
+ type?: string;
1050
+ };
1051
+ Relationships: [
1052
+ {
1053
+ foreignKeyName: "acq_lists_organization_id_fkey";
1054
+ columns: ["organization_id"];
1055
+ isOneToOne: false;
1056
+ referencedRelation: "organizations";
1057
+ referencedColumns: ["id"];
1058
+ }
1059
+ ];
1060
+ };
1061
+ acq_seo_metrics: {
1062
+ Row: {
1063
+ ai_citations: Json | null;
1064
+ avg_position: number | null;
1065
+ clicks: number | null;
1066
+ created_at: string;
1067
+ cta_clicks: number | null;
1068
+ ctr: number | null;
1069
+ data_point_count: number | null;
1070
+ faq_count: number | null;
1071
+ form_submissions: number | null;
1072
+ id: string;
1073
+ impressions: number | null;
1074
+ organization_id: string;
1075
+ period: string;
1076
+ quality_score: number | null;
1077
+ readability: number | null;
1078
+ scroll_100: number | null;
1079
+ scroll_25: number | null;
1080
+ scroll_50: number | null;
1081
+ scroll_75: number | null;
1082
+ seo_page_id: string;
1083
+ word_count: number | null;
1084
+ };
1085
+ Insert: {
1086
+ ai_citations?: Json | null;
1087
+ avg_position?: number | null;
1088
+ clicks?: number | null;
1089
+ created_at?: string;
1090
+ cta_clicks?: number | null;
1091
+ ctr?: number | null;
1092
+ data_point_count?: number | null;
1093
+ faq_count?: number | null;
1094
+ form_submissions?: number | null;
1095
+ id?: string;
1096
+ impressions?: number | null;
1097
+ organization_id: string;
1098
+ period: string;
1099
+ quality_score?: number | null;
1100
+ readability?: number | null;
1101
+ scroll_100?: number | null;
1102
+ scroll_25?: number | null;
1103
+ scroll_50?: number | null;
1104
+ scroll_75?: number | null;
1105
+ seo_page_id: string;
1106
+ word_count?: number | null;
1107
+ };
1108
+ Update: {
1109
+ ai_citations?: Json | null;
1110
+ avg_position?: number | null;
1111
+ clicks?: number | null;
1112
+ created_at?: string;
1113
+ cta_clicks?: number | null;
1114
+ ctr?: number | null;
1115
+ data_point_count?: number | null;
1116
+ faq_count?: number | null;
1117
+ form_submissions?: number | null;
1118
+ id?: string;
1119
+ impressions?: number | null;
1120
+ organization_id?: string;
1121
+ period?: string;
1122
+ quality_score?: number | null;
1123
+ readability?: number | null;
1124
+ scroll_100?: number | null;
1125
+ scroll_25?: number | null;
1126
+ scroll_50?: number | null;
1127
+ scroll_75?: number | null;
1128
+ seo_page_id?: string;
1129
+ word_count?: number | null;
1130
+ };
1131
+ Relationships: [
1132
+ {
1133
+ foreignKeyName: "acq_seo_metrics_organization_id_fkey";
1134
+ columns: ["organization_id"];
1135
+ isOneToOne: false;
1136
+ referencedRelation: "organizations";
1137
+ referencedColumns: ["id"];
1138
+ },
1139
+ {
1140
+ foreignKeyName: "acq_seo_metrics_seo_page_id_fkey";
1141
+ columns: ["seo_page_id"];
1142
+ isOneToOne: false;
1143
+ referencedRelation: "acq_seo_pages";
1144
+ referencedColumns: ["id"];
1145
+ }
1146
+ ];
1147
+ };
1148
+ acq_seo_pages: {
1149
+ Row: {
1150
+ city: string | null;
1151
+ content: Json | null;
1152
+ created_at: string;
1153
+ faq_items: Json | null;
1154
+ hero_image_url: string | null;
1155
+ id: string;
1156
+ internal_links: Json | null;
1157
+ local_data: Json | null;
1158
+ meta_description: string | null;
1159
+ organization_id: string;
1160
+ page_type: string;
1161
+ published_at: string | null;
1162
+ refreshed_at: string | null;
1163
+ schema_markup: Json | null;
1164
+ slug: string;
1165
+ state: string | null;
1166
+ status: string;
1167
+ title: string;
1168
+ updated_at: string;
1169
+ use_case: string | null;
1170
+ vertical: string;
1171
+ };
1172
+ Insert: {
1173
+ city?: string | null;
1174
+ content?: Json | null;
1175
+ created_at?: string;
1176
+ faq_items?: Json | null;
1177
+ hero_image_url?: string | null;
1178
+ id?: string;
1179
+ internal_links?: Json | null;
1180
+ local_data?: Json | null;
1181
+ meta_description?: string | null;
1182
+ organization_id: string;
1183
+ page_type: string;
1184
+ published_at?: string | null;
1185
+ refreshed_at?: string | null;
1186
+ schema_markup?: Json | null;
1187
+ slug: string;
1188
+ state?: string | null;
1189
+ status?: string;
1190
+ title: string;
1191
+ updated_at?: string;
1192
+ use_case?: string | null;
1193
+ vertical: string;
1194
+ };
1195
+ Update: {
1196
+ city?: string | null;
1197
+ content?: Json | null;
1198
+ created_at?: string;
1199
+ faq_items?: Json | null;
1200
+ hero_image_url?: string | null;
1201
+ id?: string;
1202
+ internal_links?: Json | null;
1203
+ local_data?: Json | null;
1204
+ meta_description?: string | null;
1205
+ organization_id?: string;
1206
+ page_type?: string;
1207
+ published_at?: string | null;
1208
+ refreshed_at?: string | null;
1209
+ schema_markup?: Json | null;
1210
+ slug?: string;
1211
+ state?: string | null;
1212
+ status?: string;
1213
+ title?: string;
1214
+ updated_at?: string;
1215
+ use_case?: string | null;
1216
+ vertical?: string;
1217
+ };
1218
+ Relationships: [
1219
+ {
1220
+ foreignKeyName: "acq_seo_pages_organization_id_fkey";
1221
+ columns: ["organization_id"];
1222
+ isOneToOne: false;
1223
+ referencedRelation: "organizations";
1224
+ referencedColumns: ["id"];
1225
+ }
1226
+ ];
1227
+ };
1228
+ acq_social_posts: {
1229
+ Row: {
1230
+ author_name: string;
1231
+ author_url: string | null;
1232
+ comments_count: number;
1233
+ created_at: string;
1234
+ discovered_at: string;
1235
+ engagement_count: number;
1236
+ feedback: string | null;
1237
+ final_response: string | null;
1238
+ fully_reviewed: boolean;
1239
+ id: string;
1240
+ initial_draft: string | null;
1241
+ matched_keywords: string[];
1242
+ matched_query: string | null;
1243
+ metadata: Json;
1244
+ organization_id: string;
1245
+ platform: string;
1246
+ platform_post_id: string;
1247
+ post_text: string;
1248
+ post_title: string;
1249
+ post_url: string;
1250
+ posted_at: string;
1251
+ relevance_score: number;
1252
+ responded_at: string | null;
1253
+ reviewed_at: string | null;
1254
+ skip_reason: string | null;
1255
+ source_category: string | null;
1256
+ status: string;
1257
+ updated_at: string;
1258
+ };
1259
+ Insert: {
1260
+ author_name: string;
1261
+ author_url?: string | null;
1262
+ comments_count?: number;
1263
+ created_at?: string;
1264
+ discovered_at?: string;
1265
+ engagement_count?: number;
1266
+ feedback?: string | null;
1267
+ final_response?: string | null;
1268
+ fully_reviewed?: boolean;
1269
+ id?: string;
1270
+ initial_draft?: string | null;
1271
+ matched_keywords?: string[];
1272
+ matched_query?: string | null;
1273
+ metadata?: Json;
1274
+ organization_id: string;
1275
+ platform: string;
1276
+ platform_post_id: string;
1277
+ post_text: string;
1278
+ post_title: string;
1279
+ post_url: string;
1280
+ posted_at: string;
1281
+ relevance_score?: number;
1282
+ responded_at?: string | null;
1283
+ reviewed_at?: string | null;
1284
+ skip_reason?: string | null;
1285
+ source_category?: string | null;
1286
+ status?: string;
1287
+ updated_at?: string;
1288
+ };
1289
+ Update: {
1290
+ author_name?: string;
1291
+ author_url?: string | null;
1292
+ comments_count?: number;
1293
+ created_at?: string;
1294
+ discovered_at?: string;
1295
+ engagement_count?: number;
1296
+ feedback?: string | null;
1297
+ final_response?: string | null;
1298
+ fully_reviewed?: boolean;
1299
+ id?: string;
1300
+ initial_draft?: string | null;
1301
+ matched_keywords?: string[];
1302
+ matched_query?: string | null;
1303
+ metadata?: Json;
1304
+ organization_id?: string;
1305
+ platform?: string;
1306
+ platform_post_id?: string;
1307
+ post_text?: string;
1308
+ post_title?: string;
1309
+ post_url?: string;
1310
+ posted_at?: string;
1311
+ relevance_score?: number;
1312
+ responded_at?: string | null;
1313
+ reviewed_at?: string | null;
1314
+ skip_reason?: string | null;
1315
+ source_category?: string | null;
1316
+ status?: string;
1317
+ updated_at?: string;
1318
+ };
1319
+ Relationships: [
1320
+ {
1321
+ foreignKeyName: "acq_social_posts_organization_id_fkey";
1322
+ columns: ["organization_id"];
1323
+ isOneToOne: false;
1324
+ referencedRelation: "organizations";
1325
+ referencedColumns: ["id"];
1326
+ }
1327
+ ];
1328
+ };
1329
+ activities: {
1330
+ Row: {
1331
+ activity_type: string;
1332
+ actor_id: string | null;
1333
+ actor_type: string | null;
1334
+ created_at: string;
1335
+ description: string | null;
1336
+ entity_id: string;
1337
+ entity_name: string | null;
1338
+ entity_type: string;
1339
+ id: string;
1340
+ metadata: Json | null;
1341
+ occurred_at: string;
1342
+ organization_id: string;
1343
+ status: string;
1344
+ title: string;
1345
+ };
1346
+ Insert: {
1347
+ activity_type: string;
1348
+ actor_id?: string | null;
1349
+ actor_type?: string | null;
1350
+ created_at?: string;
1351
+ description?: string | null;
1352
+ entity_id: string;
1353
+ entity_name?: string | null;
1354
+ entity_type: string;
1355
+ id?: string;
1356
+ metadata?: Json | null;
1357
+ occurred_at?: string;
1358
+ organization_id: string;
1359
+ status: string;
1360
+ title: string;
1361
+ };
1362
+ Update: {
1363
+ activity_type?: string;
1364
+ actor_id?: string | null;
1365
+ actor_type?: string | null;
1366
+ created_at?: string;
1367
+ description?: string | null;
1368
+ entity_id?: string;
1369
+ entity_name?: string | null;
1370
+ entity_type?: string;
1371
+ id?: string;
1372
+ metadata?: Json | null;
1373
+ occurred_at?: string;
1374
+ organization_id?: string;
1375
+ status?: string;
1376
+ title?: string;
1377
+ };
1378
+ Relationships: [
1379
+ {
1380
+ foreignKeyName: "activities_organization_id_fkey";
1381
+ columns: ["organization_id"];
1382
+ isOneToOne: false;
1383
+ referencedRelation: "organizations";
1384
+ referencedColumns: ["id"];
1385
+ }
1386
+ ];
1387
+ };
1388
+ api_keys: {
1389
+ Row: {
1390
+ created_at: string | null;
1391
+ id: string;
1392
+ key_hash: string;
1393
+ last_used_at: string | null;
1394
+ name: string;
1395
+ organization_id: string;
1396
+ };
1397
+ Insert: {
1398
+ created_at?: string | null;
1399
+ id?: string;
1400
+ key_hash: string;
1401
+ last_used_at?: string | null;
1402
+ name: string;
1403
+ organization_id: string;
1404
+ };
1405
+ Update: {
1406
+ created_at?: string | null;
1407
+ id?: string;
1408
+ key_hash?: string;
1409
+ last_used_at?: string | null;
1410
+ name?: string;
1411
+ organization_id?: string;
1412
+ };
1413
+ Relationships: [
1414
+ {
1415
+ foreignKeyName: "api_keys_organization_id_fkey";
1416
+ columns: ["organization_id"];
1417
+ isOneToOne: false;
1418
+ referencedRelation: "organizations";
1419
+ referencedColumns: ["id"];
1420
+ }
1421
+ ];
1422
+ };
1423
+ command_queue: {
1424
+ Row: {
1425
+ action_payload: Json | null;
1426
+ actions: Json;
1427
+ completed_at: string | null;
1428
+ completed_by: string | null;
1429
+ context: Json;
1430
+ created_at: string;
1431
+ description: string | null;
1432
+ expires_at: string | null;
1433
+ human_checkpoint: string | null;
1434
+ id: string;
1435
+ idempotency_key: string | null;
1436
+ metadata: Json | null;
1437
+ organization_id: string;
1438
+ origin_execution_id: string;
1439
+ origin_resource_id: string;
1440
+ origin_resource_type: string;
1441
+ priority: number;
1442
+ selected_action: string | null;
1443
+ status: string;
1444
+ target_execution_id: string | null;
1445
+ target_resource_id: string | null;
1446
+ target_resource_type: string | null;
1447
+ };
1448
+ Insert: {
1449
+ action_payload?: Json | null;
1450
+ actions: Json;
1451
+ completed_at?: string | null;
1452
+ completed_by?: string | null;
1453
+ context: Json;
1454
+ created_at?: string;
1455
+ description?: string | null;
1456
+ expires_at?: string | null;
1457
+ human_checkpoint?: string | null;
1458
+ id?: string;
1459
+ idempotency_key?: string | null;
1460
+ metadata?: Json | null;
1461
+ organization_id: string;
1462
+ origin_execution_id: string;
1463
+ origin_resource_id: string;
1464
+ origin_resource_type: string;
1465
+ priority?: number;
1466
+ selected_action?: string | null;
1467
+ status?: string;
1468
+ target_execution_id?: string | null;
1469
+ target_resource_id?: string | null;
1470
+ target_resource_type?: string | null;
1471
+ };
1472
+ Update: {
1473
+ action_payload?: Json | null;
1474
+ actions?: Json;
1475
+ completed_at?: string | null;
1476
+ completed_by?: string | null;
1477
+ context?: Json;
1478
+ created_at?: string;
1479
+ description?: string | null;
1480
+ expires_at?: string | null;
1481
+ human_checkpoint?: string | null;
1482
+ id?: string;
1483
+ idempotency_key?: string | null;
1484
+ metadata?: Json | null;
1485
+ organization_id?: string;
1486
+ origin_execution_id?: string;
1487
+ origin_resource_id?: string;
1488
+ origin_resource_type?: string;
1489
+ priority?: number;
1490
+ selected_action?: string | null;
1491
+ status?: string;
1492
+ target_execution_id?: string | null;
1493
+ target_resource_id?: string | null;
1494
+ target_resource_type?: string | null;
1495
+ };
1496
+ Relationships: [
1497
+ {
1498
+ foreignKeyName: "command_queue_completed_by_fkey";
1499
+ columns: ["completed_by"];
1500
+ isOneToOne: false;
1501
+ referencedRelation: "users";
1502
+ referencedColumns: ["id"];
1503
+ },
1504
+ {
1505
+ foreignKeyName: "command_queue_organization_id_fkey";
1506
+ columns: ["organization_id"];
1507
+ isOneToOne: false;
1508
+ referencedRelation: "organizations";
1509
+ referencedColumns: ["id"];
1510
+ },
1511
+ {
1512
+ foreignKeyName: "command_queue_target_execution_id_fkey";
1513
+ columns: ["target_execution_id"];
1514
+ isOneToOne: false;
1515
+ referencedRelation: "execution_logs";
1516
+ referencedColumns: ["execution_id"];
1517
+ }
1518
+ ];
1519
+ };
1520
+ credentials: {
1521
+ Row: {
1522
+ created_at: string;
1523
+ created_by: string | null;
1524
+ encrypted_value: string;
1525
+ id: string;
1526
+ name: string;
1527
+ organization_id: string;
1528
+ provider: string | null;
1529
+ type: string;
1530
+ updated_at: string;
1531
+ };
1532
+ Insert: {
1533
+ created_at?: string;
1534
+ created_by?: string | null;
1535
+ encrypted_value: string;
1536
+ id?: string;
1537
+ name: string;
1538
+ organization_id: string;
1539
+ provider?: string | null;
1540
+ type?: string;
1541
+ updated_at?: string;
1542
+ };
1543
+ Update: {
1544
+ created_at?: string;
1545
+ created_by?: string | null;
1546
+ encrypted_value?: string;
1547
+ id?: string;
1548
+ name?: string;
1549
+ organization_id?: string;
1550
+ provider?: string | null;
1551
+ type?: string;
1552
+ updated_at?: string;
1553
+ };
1554
+ Relationships: [
1555
+ {
1556
+ foreignKeyName: "credentials_created_by_fkey";
1557
+ columns: ["created_by"];
1558
+ isOneToOne: false;
1559
+ referencedRelation: "users";
1560
+ referencedColumns: ["id"];
1561
+ },
1562
+ {
1563
+ foreignKeyName: "credentials_organization_id_fkey";
1564
+ columns: ["organization_id"];
1565
+ isOneToOne: false;
1566
+ referencedRelation: "organizations";
1567
+ referencedColumns: ["id"];
1568
+ }
1569
+ ];
1570
+ };
1571
+ deployments: {
1572
+ Row: {
1573
+ created_at: string;
1574
+ deployment_version: string | null;
1575
+ error_message: string | null;
1576
+ id: string;
1577
+ organization_id: string;
1578
+ pid: number | null;
1579
+ port: number | null;
1580
+ sdk_version: string;
1581
+ status: string;
1582
+ tarball_path: string | null;
1583
+ updated_at: string;
1584
+ };
1585
+ Insert: {
1586
+ created_at?: string;
1587
+ deployment_version?: string | null;
1588
+ error_message?: string | null;
1589
+ id?: string;
1590
+ organization_id: string;
1591
+ pid?: number | null;
1592
+ port?: number | null;
1593
+ sdk_version: string;
1594
+ status?: string;
1595
+ tarball_path?: string | null;
1596
+ updated_at?: string;
1597
+ };
1598
+ Update: {
1599
+ created_at?: string;
1600
+ deployment_version?: string | null;
1601
+ error_message?: string | null;
1602
+ id?: string;
1603
+ organization_id?: string;
1604
+ pid?: number | null;
1605
+ port?: number | null;
1606
+ sdk_version?: string;
1607
+ status?: string;
1608
+ tarball_path?: string | null;
1609
+ updated_at?: string;
1610
+ };
1611
+ Relationships: [
1612
+ {
1613
+ foreignKeyName: "deployments_organization_id_fkey";
1614
+ columns: ["organization_id"];
1615
+ isOneToOne: false;
1616
+ referencedRelation: "organizations";
1617
+ referencedColumns: ["id"];
1618
+ }
1619
+ ];
1620
+ };
1621
+ execution_errors: {
1622
+ Row: {
1623
+ created_at: string | null;
1624
+ error_category: string;
1625
+ error_message: string;
1626
+ error_severity: string;
1627
+ error_stack_trace: string | null;
1628
+ error_type: string;
1629
+ execution_id: string;
1630
+ id: string;
1631
+ metadata: Json | null;
1632
+ occurred_at: string;
1633
+ organization_id: string;
1634
+ resolved: boolean;
1635
+ resolved_at: string | null;
1636
+ resolved_by: string | null;
1637
+ };
1638
+ Insert: {
1639
+ created_at?: string | null;
1640
+ error_category: string;
1641
+ error_message: string;
1642
+ error_severity: string;
1643
+ error_stack_trace?: string | null;
1644
+ error_type: string;
1645
+ execution_id: string;
1646
+ id?: string;
1647
+ metadata?: Json | null;
1648
+ occurred_at?: string;
1649
+ organization_id: string;
1650
+ resolved?: boolean;
1651
+ resolved_at?: string | null;
1652
+ resolved_by?: string | null;
1653
+ };
1654
+ Update: {
1655
+ created_at?: string | null;
1656
+ error_category?: string;
1657
+ error_message?: string;
1658
+ error_severity?: string;
1659
+ error_stack_trace?: string | null;
1660
+ error_type?: string;
1661
+ execution_id?: string;
1662
+ id?: string;
1663
+ metadata?: Json | null;
1664
+ occurred_at?: string;
1665
+ organization_id?: string;
1666
+ resolved?: boolean;
1667
+ resolved_at?: string | null;
1668
+ resolved_by?: string | null;
1669
+ };
1670
+ Relationships: [
1671
+ {
1672
+ foreignKeyName: "execution_errors_execution_id_fkey";
1673
+ columns: ["execution_id"];
1674
+ isOneToOne: false;
1675
+ referencedRelation: "execution_logs";
1676
+ referencedColumns: ["execution_id"];
1677
+ },
1678
+ {
1679
+ foreignKeyName: "execution_errors_organization_id_fkey";
1680
+ columns: ["organization_id"];
1681
+ isOneToOne: false;
1682
+ referencedRelation: "organizations";
1683
+ referencedColumns: ["id"];
1684
+ },
1685
+ {
1686
+ foreignKeyName: "execution_errors_resolved_by_fkey";
1687
+ columns: ["resolved_by"];
1688
+ isOneToOne: false;
1689
+ referencedRelation: "users";
1690
+ referencedColumns: ["id"];
1691
+ }
1692
+ ];
1693
+ };
1694
+ execution_logs: {
1695
+ Row: {
1696
+ api_version: string | null;
1697
+ completed_at: string | null;
1698
+ created_at: string | null;
1699
+ error: string | null;
1700
+ execution_id: string;
1701
+ input: Json | null;
1702
+ last_heartbeat_at: string | null;
1703
+ logs: Json | null;
1704
+ organization_id: string;
1705
+ origin_execution_id: string | null;
1706
+ output: Json | null;
1707
+ resource_id: string;
1708
+ resource_status: string;
1709
+ resource_type: string;
1710
+ resource_version: string | null;
1711
+ sdk_version: string | null;
1712
+ session_id: string | null;
1713
+ session_turn_number: number | null;
1714
+ started_at: string;
1715
+ status: string;
1716
+ trigger_type: string | null;
1717
+ updated_at: string | null;
1718
+ user_id: string | null;
1719
+ };
1720
+ Insert: {
1721
+ api_version?: string | null;
1722
+ completed_at?: string | null;
1723
+ created_at?: string | null;
1724
+ error?: string | null;
1725
+ execution_id?: string;
1726
+ input?: Json | null;
1727
+ last_heartbeat_at?: string | null;
1728
+ logs?: Json | null;
1729
+ organization_id: string;
1730
+ origin_execution_id?: string | null;
1731
+ output?: Json | null;
1732
+ resource_id: string;
1733
+ resource_status?: string;
1734
+ resource_type?: string;
1735
+ resource_version?: string | null;
1736
+ sdk_version?: string | null;
1737
+ session_id?: string | null;
1738
+ session_turn_number?: number | null;
1739
+ started_at?: string;
1740
+ status: string;
1741
+ trigger_type?: string | null;
1742
+ updated_at?: string | null;
1743
+ user_id?: string | null;
1744
+ };
1745
+ Update: {
1746
+ api_version?: string | null;
1747
+ completed_at?: string | null;
1748
+ created_at?: string | null;
1749
+ error?: string | null;
1750
+ execution_id?: string;
1751
+ input?: Json | null;
1752
+ last_heartbeat_at?: string | null;
1753
+ logs?: Json | null;
1754
+ organization_id?: string;
1755
+ origin_execution_id?: string | null;
1756
+ output?: Json | null;
1757
+ resource_id?: string;
1758
+ resource_status?: string;
1759
+ resource_type?: string;
1760
+ resource_version?: string | null;
1761
+ sdk_version?: string | null;
1762
+ session_id?: string | null;
1763
+ session_turn_number?: number | null;
1764
+ started_at?: string;
1765
+ status?: string;
1766
+ trigger_type?: string | null;
1767
+ updated_at?: string | null;
1768
+ user_id?: string | null;
1769
+ };
1770
+ Relationships: [
1771
+ {
1772
+ foreignKeyName: "execution_history_organization_id_fkey";
1773
+ columns: ["organization_id"];
1774
+ isOneToOne: false;
1775
+ referencedRelation: "organizations";
1776
+ referencedColumns: ["id"];
1777
+ },
1778
+ {
1779
+ foreignKeyName: "execution_logs_origin_execution_id_fkey";
1780
+ columns: ["origin_execution_id"];
1781
+ isOneToOne: false;
1782
+ referencedRelation: "execution_logs";
1783
+ referencedColumns: ["execution_id"];
1784
+ },
1785
+ {
1786
+ foreignKeyName: "execution_logs_session_id_fkey";
1787
+ columns: ["session_id"];
1788
+ isOneToOne: false;
1789
+ referencedRelation: "sessions";
1790
+ referencedColumns: ["session_id"];
1791
+ },
1792
+ {
1793
+ foreignKeyName: "execution_logs_user_id_fkey";
1794
+ columns: ["user_id"];
1795
+ isOneToOne: false;
1796
+ referencedRelation: "users";
1797
+ referencedColumns: ["id"];
1798
+ }
1799
+ ];
1800
+ };
1801
+ execution_metrics: {
1802
+ Row: {
1803
+ ai_call_count: number;
1804
+ ai_calls: Json | null;
1805
+ automation_savings_usd: number | null;
1806
+ created_at: string | null;
1807
+ duration_ms: number | null;
1808
+ execution_id: string;
1809
+ organization_id: string;
1810
+ resource_id: string;
1811
+ total_cost_usd: number;
1812
+ total_input_tokens: number;
1813
+ total_output_tokens: number;
1814
+ };
1815
+ Insert: {
1816
+ ai_call_count: number;
1817
+ ai_calls?: Json | null;
1818
+ automation_savings_usd?: number | null;
1819
+ created_at?: string | null;
1820
+ duration_ms?: number | null;
1821
+ execution_id: string;
1822
+ organization_id: string;
1823
+ resource_id: string;
1824
+ total_cost_usd: number;
1825
+ total_input_tokens: number;
1826
+ total_output_tokens: number;
1827
+ };
1828
+ Update: {
1829
+ ai_call_count?: number;
1830
+ ai_calls?: Json | null;
1831
+ automation_savings_usd?: number | null;
1832
+ created_at?: string | null;
1833
+ duration_ms?: number | null;
1834
+ execution_id?: string;
1835
+ organization_id?: string;
1836
+ resource_id?: string;
1837
+ total_cost_usd?: number;
1838
+ total_input_tokens?: number;
1839
+ total_output_tokens?: number;
1840
+ };
1841
+ Relationships: [
1842
+ {
1843
+ foreignKeyName: "execution_metrics_execution_id_fkey";
1844
+ columns: ["execution_id"];
1845
+ isOneToOne: true;
1846
+ referencedRelation: "execution_logs";
1847
+ referencedColumns: ["execution_id"];
1848
+ },
1849
+ {
1850
+ foreignKeyName: "execution_metrics_organization_id_fkey";
1851
+ columns: ["organization_id"];
1852
+ isOneToOne: false;
1853
+ referencedRelation: "organizations";
1854
+ referencedColumns: ["id"];
1855
+ }
1856
+ ];
1857
+ };
1858
+ notifications: {
1859
+ Row: {
1860
+ action_url: string | null;
1861
+ category: string;
1862
+ created_at: string | null;
1863
+ id: string;
1864
+ message: string;
1865
+ organization_id: string;
1866
+ read: boolean | null;
1867
+ read_at: string | null;
1868
+ title: string;
1869
+ user_id: string;
1870
+ };
1871
+ Insert: {
1872
+ action_url?: string | null;
1873
+ category: string;
1874
+ created_at?: string | null;
1875
+ id?: string;
1876
+ message: string;
1877
+ organization_id: string;
1878
+ read?: boolean | null;
1879
+ read_at?: string | null;
1880
+ title: string;
1881
+ user_id: string;
1882
+ };
1883
+ Update: {
1884
+ action_url?: string | null;
1885
+ category?: string;
1886
+ created_at?: string | null;
1887
+ id?: string;
1888
+ message?: string;
1889
+ organization_id?: string;
1890
+ read?: boolean | null;
1891
+ read_at?: string | null;
1892
+ title?: string;
1893
+ user_id?: string;
1894
+ };
1895
+ Relationships: [
1896
+ {
1897
+ foreignKeyName: "notifications_organization_id_fkey";
1898
+ columns: ["organization_id"];
1899
+ isOneToOne: false;
1900
+ referencedRelation: "organizations";
1901
+ referencedColumns: ["id"];
1902
+ },
1903
+ {
1904
+ foreignKeyName: "notifications_user_id_fkey";
1905
+ columns: ["user_id"];
1906
+ isOneToOne: false;
1907
+ referencedRelation: "users";
1908
+ referencedColumns: ["id"];
1909
+ }
1910
+ ];
1911
+ };
1912
+ org_invitations: {
1913
+ Row: {
1914
+ accept_invitation_url: string | null;
1915
+ accepted_at: string | null;
1916
+ created_at: string | null;
1917
+ email: string;
1918
+ expires_at: string;
1919
+ id: string;
1920
+ invitation_state: string | null;
1921
+ invitation_token: string | null;
1922
+ inviter_user_id: string | null;
1923
+ organization_id: string | null;
1924
+ revoked_at: string | null;
1925
+ role_slug: string | null;
1926
+ updated_at: string | null;
1927
+ workos_invitation_id: string;
1928
+ };
1929
+ Insert: {
1930
+ accept_invitation_url?: string | null;
1931
+ accepted_at?: string | null;
1932
+ created_at?: string | null;
1933
+ email: string;
1934
+ expires_at: string;
1935
+ id?: string;
1936
+ invitation_state?: string | null;
1937
+ invitation_token?: string | null;
1938
+ inviter_user_id?: string | null;
1939
+ organization_id?: string | null;
1940
+ revoked_at?: string | null;
1941
+ role_slug?: string | null;
1942
+ updated_at?: string | null;
1943
+ workos_invitation_id: string;
1944
+ };
1945
+ Update: {
1946
+ accept_invitation_url?: string | null;
1947
+ accepted_at?: string | null;
1948
+ created_at?: string | null;
1949
+ email?: string;
1950
+ expires_at?: string;
1951
+ id?: string;
1952
+ invitation_state?: string | null;
1953
+ invitation_token?: string | null;
1954
+ inviter_user_id?: string | null;
1955
+ organization_id?: string | null;
1956
+ revoked_at?: string | null;
1957
+ role_slug?: string | null;
1958
+ updated_at?: string | null;
1959
+ workos_invitation_id?: string;
1960
+ };
1961
+ Relationships: [
1962
+ {
1963
+ foreignKeyName: "org_invitations_inviter_user_id_fkey";
1964
+ columns: ["inviter_user_id"];
1965
+ isOneToOne: false;
1966
+ referencedRelation: "users";
1967
+ referencedColumns: ["id"];
1968
+ },
1969
+ {
1970
+ foreignKeyName: "org_invitations_organization_id_fkey";
1971
+ columns: ["organization_id"];
1972
+ isOneToOne: false;
1973
+ referencedRelation: "organizations";
1974
+ referencedColumns: ["id"];
1975
+ }
1976
+ ];
1977
+ };
1978
+ org_memberships: {
1979
+ Row: {
1980
+ config: Json;
1981
+ created_at: string | null;
1982
+ id: string;
1983
+ membership_status: string | null;
1984
+ organization_id: string;
1985
+ role_slug: string | null;
1986
+ updated_at: string | null;
1987
+ user_id: string;
1988
+ workos_membership_id: string | null;
1989
+ };
1990
+ Insert: {
1991
+ config?: Json;
1992
+ created_at?: string | null;
1993
+ id?: string;
1994
+ membership_status?: string | null;
1995
+ organization_id: string;
1996
+ role_slug?: string | null;
1997
+ updated_at?: string | null;
1998
+ user_id: string;
1999
+ workos_membership_id?: string | null;
2000
+ };
2001
+ Update: {
2002
+ config?: Json;
2003
+ created_at?: string | null;
2004
+ id?: string;
2005
+ membership_status?: string | null;
2006
+ organization_id?: string;
2007
+ role_slug?: string | null;
2008
+ updated_at?: string | null;
2009
+ user_id?: string;
2010
+ workos_membership_id?: string | null;
2011
+ };
2012
+ Relationships: [
2013
+ {
2014
+ foreignKeyName: "org_memberships_organization_id_fkey";
2015
+ columns: ["organization_id"];
2016
+ isOneToOne: false;
2017
+ referencedRelation: "organizations";
2018
+ referencedColumns: ["id"];
2019
+ },
2020
+ {
2021
+ foreignKeyName: "org_memberships_user_id_fkey";
2022
+ columns: ["user_id"];
2023
+ isOneToOne: false;
2024
+ referencedRelation: "users";
2025
+ referencedColumns: ["id"];
2026
+ }
2027
+ ];
2028
+ };
2029
+ organizations: {
2030
+ Row: {
2031
+ config: Json;
2032
+ created_at: string;
2033
+ id: string;
2034
+ is_test: boolean;
2035
+ metadata: Json;
2036
+ name: string;
2037
+ status: string;
2038
+ updated_at: string;
2039
+ workos_org_id: string;
2040
+ };
2041
+ Insert: {
2042
+ config?: Json;
2043
+ created_at?: string;
2044
+ id?: string;
2045
+ is_test?: boolean;
2046
+ metadata?: Json;
2047
+ name: string;
2048
+ status?: string;
2049
+ updated_at?: string;
2050
+ workos_org_id: string;
2051
+ };
2052
+ Update: {
2053
+ config?: Json;
2054
+ created_at?: string;
2055
+ id?: string;
2056
+ is_test?: boolean;
2057
+ metadata?: Json;
2058
+ name?: string;
2059
+ status?: string;
2060
+ updated_at?: string;
2061
+ workos_org_id?: string;
2062
+ };
2063
+ Relationships: [];
2064
+ };
2065
+ prj_milestones: {
2066
+ Row: {
2067
+ checklist: Json | null;
2068
+ completed_at: string | null;
2069
+ created_at: string;
2070
+ description: string | null;
2071
+ due_date: string | null;
2072
+ id: string;
2073
+ metadata: Json | null;
2074
+ name: string;
2075
+ organization_id: string;
2076
+ project_id: string;
2077
+ sequence: number;
2078
+ status: string;
2079
+ updated_at: string;
2080
+ };
2081
+ Insert: {
2082
+ checklist?: Json | null;
2083
+ completed_at?: string | null;
2084
+ created_at?: string;
2085
+ description?: string | null;
2086
+ due_date?: string | null;
2087
+ id?: string;
2088
+ metadata?: Json | null;
2089
+ name: string;
2090
+ organization_id: string;
2091
+ project_id: string;
2092
+ sequence?: number;
2093
+ status?: string;
2094
+ updated_at?: string;
2095
+ };
2096
+ Update: {
2097
+ checklist?: Json | null;
2098
+ completed_at?: string | null;
2099
+ created_at?: string;
2100
+ description?: string | null;
2101
+ due_date?: string | null;
2102
+ id?: string;
2103
+ metadata?: Json | null;
2104
+ name?: string;
2105
+ organization_id?: string;
2106
+ project_id?: string;
2107
+ sequence?: number;
2108
+ status?: string;
2109
+ updated_at?: string;
2110
+ };
2111
+ Relationships: [
2112
+ {
2113
+ foreignKeyName: "fk_milestones_project";
2114
+ columns: ["project_id"];
2115
+ isOneToOne: false;
2116
+ referencedRelation: "prj_projects";
2117
+ referencedColumns: ["id"];
2118
+ },
2119
+ {
2120
+ foreignKeyName: "prj_milestones_organization_id_fkey";
2121
+ columns: ["organization_id"];
2122
+ isOneToOne: false;
2123
+ referencedRelation: "organizations";
2124
+ referencedColumns: ["id"];
2125
+ },
2126
+ {
2127
+ foreignKeyName: "prj_milestones_project_id_fkey";
2128
+ columns: ["project_id"];
2129
+ isOneToOne: false;
2130
+ referencedRelation: "prj_projects";
2131
+ referencedColumns: ["id"];
2132
+ }
2133
+ ];
2134
+ };
2135
+ prj_notes: {
2136
+ Row: {
2137
+ content: string;
2138
+ created_at: string;
2139
+ created_by: string | null;
2140
+ id: string;
2141
+ metadata: Json | null;
2142
+ milestone_id: string | null;
2143
+ occurred_at: string;
2144
+ organization_id: string;
2145
+ project_id: string;
2146
+ summary: string | null;
2147
+ task_id: string | null;
2148
+ type: string;
2149
+ };
2150
+ Insert: {
2151
+ content: string;
2152
+ created_at?: string;
2153
+ created_by?: string | null;
2154
+ id?: string;
2155
+ metadata?: Json | null;
2156
+ milestone_id?: string | null;
2157
+ occurred_at?: string;
2158
+ organization_id: string;
2159
+ project_id: string;
2160
+ summary?: string | null;
2161
+ task_id?: string | null;
2162
+ type?: string;
2163
+ };
2164
+ Update: {
2165
+ content?: string;
2166
+ created_at?: string;
2167
+ created_by?: string | null;
2168
+ id?: string;
2169
+ metadata?: Json | null;
2170
+ milestone_id?: string | null;
2171
+ occurred_at?: string;
2172
+ organization_id?: string;
2173
+ project_id?: string;
2174
+ summary?: string | null;
2175
+ task_id?: string | null;
2176
+ type?: string;
2177
+ };
2178
+ Relationships: [
2179
+ {
2180
+ foreignKeyName: "fk_notes_created_by";
2181
+ columns: ["created_by"];
2182
+ isOneToOne: false;
2183
+ referencedRelation: "users";
2184
+ referencedColumns: ["id"];
2185
+ },
2186
+ {
2187
+ foreignKeyName: "fk_notes_milestone";
2188
+ columns: ["milestone_id"];
2189
+ isOneToOne: false;
2190
+ referencedRelation: "prj_milestones";
2191
+ referencedColumns: ["id"];
2192
+ },
2193
+ {
2194
+ foreignKeyName: "fk_notes_project";
2195
+ columns: ["project_id"];
2196
+ isOneToOne: false;
2197
+ referencedRelation: "prj_projects";
2198
+ referencedColumns: ["id"];
2199
+ },
2200
+ {
2201
+ foreignKeyName: "fk_notes_task";
2202
+ columns: ["task_id"];
2203
+ isOneToOne: false;
2204
+ referencedRelation: "prj_tasks";
2205
+ referencedColumns: ["id"];
2206
+ },
2207
+ {
2208
+ foreignKeyName: "prj_notes_created_by_fkey";
2209
+ columns: ["created_by"];
2210
+ isOneToOne: false;
2211
+ referencedRelation: "users";
2212
+ referencedColumns: ["id"];
2213
+ },
2214
+ {
2215
+ foreignKeyName: "prj_notes_milestone_id_fkey";
2216
+ columns: ["milestone_id"];
2217
+ isOneToOne: false;
2218
+ referencedRelation: "prj_milestones";
2219
+ referencedColumns: ["id"];
2220
+ },
2221
+ {
2222
+ foreignKeyName: "prj_notes_organization_id_fkey";
2223
+ columns: ["organization_id"];
2224
+ isOneToOne: false;
2225
+ referencedRelation: "organizations";
2226
+ referencedColumns: ["id"];
2227
+ },
2228
+ {
2229
+ foreignKeyName: "prj_notes_project_id_fkey";
2230
+ columns: ["project_id"];
2231
+ isOneToOne: false;
2232
+ referencedRelation: "prj_projects";
2233
+ referencedColumns: ["id"];
2234
+ },
2235
+ {
2236
+ foreignKeyName: "prj_notes_task_id_fkey";
2237
+ columns: ["task_id"];
2238
+ isOneToOne: false;
2239
+ referencedRelation: "prj_tasks";
2240
+ referencedColumns: ["id"];
2241
+ }
2242
+ ];
2243
+ };
2244
+ prj_projects: {
2245
+ Row: {
2246
+ actual_end_date: string | null;
2247
+ client_company_id: string | null;
2248
+ contract_value: number | null;
2249
+ created_at: string;
2250
+ deal_id: string | null;
2251
+ description: string | null;
2252
+ id: string;
2253
+ kind: string;
2254
+ metadata: Json | null;
2255
+ name: string;
2256
+ organization_id: string;
2257
+ start_date: string | null;
2258
+ status: string;
2259
+ target_end_date: string | null;
2260
+ updated_at: string;
2261
+ };
2262
+ Insert: {
2263
+ actual_end_date?: string | null;
2264
+ client_company_id?: string | null;
2265
+ contract_value?: number | null;
2266
+ created_at?: string;
2267
+ deal_id?: string | null;
2268
+ description?: string | null;
2269
+ id?: string;
2270
+ kind?: string;
2271
+ metadata?: Json | null;
2272
+ name: string;
2273
+ organization_id: string;
2274
+ start_date?: string | null;
2275
+ status?: string;
2276
+ target_end_date?: string | null;
2277
+ updated_at?: string;
2278
+ };
2279
+ Update: {
2280
+ actual_end_date?: string | null;
2281
+ client_company_id?: string | null;
2282
+ contract_value?: number | null;
2283
+ created_at?: string;
2284
+ deal_id?: string | null;
2285
+ description?: string | null;
2286
+ id?: string;
2287
+ kind?: string;
2288
+ metadata?: Json | null;
2289
+ name?: string;
2290
+ organization_id?: string;
2291
+ start_date?: string | null;
2292
+ status?: string;
2293
+ target_end_date?: string | null;
2294
+ updated_at?: string;
2295
+ };
2296
+ Relationships: [
2297
+ {
2298
+ foreignKeyName: "fk_projects_company";
2299
+ columns: ["client_company_id"];
2300
+ isOneToOne: false;
2301
+ referencedRelation: "acq_companies";
2302
+ referencedColumns: ["id"];
2303
+ },
2304
+ {
2305
+ foreignKeyName: "fk_projects_deal";
2306
+ columns: ["deal_id"];
2307
+ isOneToOne: false;
2308
+ referencedRelation: "acq_deals";
2309
+ referencedColumns: ["id"];
2310
+ },
2311
+ {
2312
+ foreignKeyName: "prj_projects_client_company_id_fkey";
2313
+ columns: ["client_company_id"];
2314
+ isOneToOne: false;
2315
+ referencedRelation: "acq_companies";
2316
+ referencedColumns: ["id"];
2317
+ },
2318
+ {
2319
+ foreignKeyName: "prj_projects_deal_id_fkey";
2320
+ columns: ["deal_id"];
2321
+ isOneToOne: false;
2322
+ referencedRelation: "acq_deals";
2323
+ referencedColumns: ["id"];
2324
+ },
2325
+ {
2326
+ foreignKeyName: "prj_projects_organization_id_fkey";
2327
+ columns: ["organization_id"];
2328
+ isOneToOne: false;
2329
+ referencedRelation: "organizations";
2330
+ referencedColumns: ["id"];
2331
+ }
2332
+ ];
2333
+ };
2334
+ prj_tasks: {
2335
+ Row: {
2336
+ checklist: Json;
2337
+ completed_at: string | null;
2338
+ created_at: string;
2339
+ description: string | null;
2340
+ due_date: string | null;
2341
+ file_url: string | null;
2342
+ id: string;
2343
+ metadata: Json | null;
2344
+ milestone_id: string | null;
2345
+ name: string;
2346
+ organization_id: string;
2347
+ parent_task_id: string | null;
2348
+ project_id: string;
2349
+ resume_context: Json | null;
2350
+ status: string;
2351
+ type: string;
2352
+ updated_at: string;
2353
+ };
2354
+ Insert: {
2355
+ checklist?: Json;
2356
+ completed_at?: string | null;
2357
+ created_at?: string;
2358
+ description?: string | null;
2359
+ due_date?: string | null;
2360
+ file_url?: string | null;
2361
+ id?: string;
2362
+ metadata?: Json | null;
2363
+ milestone_id?: string | null;
2364
+ name: string;
2365
+ organization_id: string;
2366
+ parent_task_id?: string | null;
2367
+ project_id: string;
2368
+ resume_context?: Json | null;
2369
+ status?: string;
2370
+ type?: string;
2371
+ updated_at?: string;
2372
+ };
2373
+ Update: {
2374
+ checklist?: Json;
2375
+ completed_at?: string | null;
2376
+ created_at?: string;
2377
+ description?: string | null;
2378
+ due_date?: string | null;
2379
+ file_url?: string | null;
2380
+ id?: string;
2381
+ metadata?: Json | null;
2382
+ milestone_id?: string | null;
2383
+ name?: string;
2384
+ organization_id?: string;
2385
+ parent_task_id?: string | null;
2386
+ project_id?: string;
2387
+ resume_context?: Json | null;
2388
+ status?: string;
2389
+ type?: string;
2390
+ updated_at?: string;
2391
+ };
2392
+ Relationships: [
2393
+ {
2394
+ foreignKeyName: "fk_tasks_milestone";
2395
+ columns: ["milestone_id"];
2396
+ isOneToOne: false;
2397
+ referencedRelation: "prj_milestones";
2398
+ referencedColumns: ["id"];
2399
+ },
2400
+ {
2401
+ foreignKeyName: "fk_tasks_parent";
2402
+ columns: ["parent_task_id"];
2403
+ isOneToOne: false;
2404
+ referencedRelation: "prj_tasks";
2405
+ referencedColumns: ["id"];
2406
+ },
2407
+ {
2408
+ foreignKeyName: "fk_tasks_project";
2409
+ columns: ["project_id"];
2410
+ isOneToOne: false;
2411
+ referencedRelation: "prj_projects";
2412
+ referencedColumns: ["id"];
2413
+ },
2414
+ {
2415
+ foreignKeyName: "prj_tasks_milestone_id_fkey";
2416
+ columns: ["milestone_id"];
2417
+ isOneToOne: false;
2418
+ referencedRelation: "prj_milestones";
2419
+ referencedColumns: ["id"];
2420
+ },
2421
+ {
2422
+ foreignKeyName: "prj_tasks_organization_id_fkey";
2423
+ columns: ["organization_id"];
2424
+ isOneToOne: false;
2425
+ referencedRelation: "organizations";
2426
+ referencedColumns: ["id"];
2427
+ },
2428
+ {
2429
+ foreignKeyName: "prj_tasks_parent_task_id_fkey";
2430
+ columns: ["parent_task_id"];
2431
+ isOneToOne: false;
2432
+ referencedRelation: "prj_tasks";
2433
+ referencedColumns: ["id"];
2434
+ },
2435
+ {
2436
+ foreignKeyName: "prj_tasks_project_id_fkey";
2437
+ columns: ["project_id"];
2438
+ isOneToOne: false;
2439
+ referencedRelation: "prj_projects";
2440
+ referencedColumns: ["id"];
2441
+ }
2442
+ ];
2443
+ };
2444
+ reported_requests: {
2445
+ Row: {
2446
+ affected_page: string | null;
2447
+ category: string;
2448
+ context: Json | null;
2449
+ created_at: string;
2450
+ description: string;
2451
+ evidence: Json | null;
2452
+ id: string;
2453
+ organization_id: string;
2454
+ project_id: string | null;
2455
+ reported_at: string;
2456
+ reporter_id: string | null;
2457
+ resolved_at: string | null;
2458
+ severity: string;
2459
+ source: string;
2460
+ status: string;
2461
+ task_id: string | null;
2462
+ title: string;
2463
+ type: string;
2464
+ updated_at: string;
2465
+ };
2466
+ Insert: {
2467
+ affected_page?: string | null;
2468
+ category: string;
2469
+ context?: Json | null;
2470
+ created_at?: string;
2471
+ description: string;
2472
+ evidence?: Json | null;
2473
+ id?: string;
2474
+ organization_id: string;
2475
+ project_id?: string | null;
2476
+ reported_at?: string;
2477
+ reporter_id?: string | null;
2478
+ resolved_at?: string | null;
2479
+ severity: string;
2480
+ source: string;
2481
+ status?: string;
2482
+ task_id?: string | null;
2483
+ title: string;
2484
+ type: string;
2485
+ updated_at?: string;
2486
+ };
2487
+ Update: {
2488
+ affected_page?: string | null;
2489
+ category?: string;
2490
+ context?: Json | null;
2491
+ created_at?: string;
2492
+ description?: string;
2493
+ evidence?: Json | null;
2494
+ id?: string;
2495
+ organization_id?: string;
2496
+ project_id?: string | null;
2497
+ reported_at?: string;
2498
+ reporter_id?: string | null;
2499
+ resolved_at?: string | null;
2500
+ severity?: string;
2501
+ source?: string;
2502
+ status?: string;
2503
+ task_id?: string | null;
2504
+ title?: string;
2505
+ type?: string;
2506
+ updated_at?: string;
2507
+ };
2508
+ Relationships: [
2509
+ {
2510
+ foreignKeyName: "reported_requests_organization_id_fkey";
2511
+ columns: ["organization_id"];
2512
+ isOneToOne: false;
2513
+ referencedRelation: "organizations";
2514
+ referencedColumns: ["id"];
2515
+ },
2516
+ {
2517
+ foreignKeyName: "reported_requests_project_id_fkey";
2518
+ columns: ["project_id"];
2519
+ isOneToOne: false;
2520
+ referencedRelation: "prj_projects";
2521
+ referencedColumns: ["id"];
2522
+ },
2523
+ {
2524
+ foreignKeyName: "reported_requests_task_id_fkey";
2525
+ columns: ["task_id"];
2526
+ isOneToOne: false;
2527
+ referencedRelation: "prj_tasks";
2528
+ referencedColumns: ["id"];
2529
+ }
2530
+ ];
2531
+ };
2532
+ session_messages: {
2533
+ Row: {
2534
+ created_at: string | null;
2535
+ id: string;
2536
+ message: string;
2537
+ message_index: number | null;
2538
+ message_type: string | null;
2539
+ metadata: Json | null;
2540
+ role: string;
2541
+ session_id: string;
2542
+ session_turn_number: number;
2543
+ };
2544
+ Insert: {
2545
+ created_at?: string | null;
2546
+ id: string;
2547
+ message: string;
2548
+ message_index?: number | null;
2549
+ message_type?: string | null;
2550
+ metadata?: Json | null;
2551
+ role: string;
2552
+ session_id: string;
2553
+ session_turn_number: number;
2554
+ };
2555
+ Update: {
2556
+ created_at?: string | null;
2557
+ id?: string;
2558
+ message?: string;
2559
+ message_index?: number | null;
2560
+ message_type?: string | null;
2561
+ metadata?: Json | null;
2562
+ role?: string;
2563
+ session_id?: string;
2564
+ session_turn_number?: number;
2565
+ };
2566
+ Relationships: [
2567
+ {
2568
+ foreignKeyName: "session_messages_session_id_fkey";
2569
+ columns: ["session_id"];
2570
+ isOneToOne: false;
2571
+ referencedRelation: "sessions";
2572
+ referencedColumns: ["session_id"];
2573
+ }
2574
+ ];
2575
+ };
2576
+ sessions: {
2577
+ Row: {
2578
+ context_window_size: number;
2579
+ created_at: string | null;
2580
+ cumulative_input_tokens: number;
2581
+ cumulative_output_tokens: number;
2582
+ deleted_at: string | null;
2583
+ ended_at: string | null;
2584
+ memory_snapshot: Json;
2585
+ metadata: Json | null;
2586
+ organization_id: string;
2587
+ resource_id: string;
2588
+ session_id: string;
2589
+ session_total_turns: number | null;
2590
+ updated_at: string | null;
2591
+ user_id: string | null;
2592
+ };
2593
+ Insert: {
2594
+ context_window_size?: number;
2595
+ created_at?: string | null;
2596
+ cumulative_input_tokens?: number;
2597
+ cumulative_output_tokens?: number;
2598
+ deleted_at?: string | null;
2599
+ ended_at?: string | null;
2600
+ memory_snapshot: Json;
2601
+ metadata?: Json | null;
2602
+ organization_id: string;
2603
+ resource_id: string;
2604
+ session_id?: string;
2605
+ session_total_turns?: number | null;
2606
+ updated_at?: string | null;
2607
+ user_id?: string | null;
2608
+ };
2609
+ Update: {
2610
+ context_window_size?: number;
2611
+ created_at?: string | null;
2612
+ cumulative_input_tokens?: number;
2613
+ cumulative_output_tokens?: number;
2614
+ deleted_at?: string | null;
2615
+ ended_at?: string | null;
2616
+ memory_snapshot?: Json;
2617
+ metadata?: Json | null;
2618
+ organization_id?: string;
2619
+ resource_id?: string;
2620
+ session_id?: string;
2621
+ session_total_turns?: number | null;
2622
+ updated_at?: string | null;
2623
+ user_id?: string | null;
2624
+ };
2625
+ Relationships: [
2626
+ {
2627
+ foreignKeyName: "fk_organization";
2628
+ columns: ["organization_id"];
2629
+ isOneToOne: false;
2630
+ referencedRelation: "organizations";
2631
+ referencedColumns: ["id"];
2632
+ },
2633
+ {
2634
+ foreignKeyName: "fk_user";
2635
+ columns: ["user_id"];
2636
+ isOneToOne: false;
2637
+ referencedRelation: "users";
2638
+ referencedColumns: ["id"];
2639
+ }
2640
+ ];
2641
+ };
2642
+ task_schedules: {
2643
+ Row: {
2644
+ created_at: string;
2645
+ current_step: number;
2646
+ description: string | null;
2647
+ id: string;
2648
+ idempotency_key: string | null;
2649
+ last_execution_id: string | null;
2650
+ last_run_at: string | null;
2651
+ max_retries: number;
2652
+ metadata: Json | null;
2653
+ name: string;
2654
+ next_run_at: string | null;
2655
+ organization_id: string;
2656
+ origin_execution_id: string | null;
2657
+ origin_resource_id: string | null;
2658
+ origin_resource_type: string | null;
2659
+ retry_count: number;
2660
+ schedule_config: Json;
2661
+ status: string;
2662
+ target_resource_id: string;
2663
+ target_resource_type: string;
2664
+ updated_at: string;
2665
+ };
2666
+ Insert: {
2667
+ created_at?: string;
2668
+ current_step?: number;
2669
+ description?: string | null;
2670
+ id?: string;
2671
+ idempotency_key?: string | null;
2672
+ last_execution_id?: string | null;
2673
+ last_run_at?: string | null;
2674
+ max_retries?: number;
2675
+ metadata?: Json | null;
2676
+ name: string;
2677
+ next_run_at?: string | null;
2678
+ organization_id: string;
2679
+ origin_execution_id?: string | null;
2680
+ origin_resource_id?: string | null;
2681
+ origin_resource_type?: string | null;
2682
+ retry_count?: number;
2683
+ schedule_config: Json;
2684
+ status?: string;
2685
+ target_resource_id: string;
2686
+ target_resource_type: string;
2687
+ updated_at?: string;
2688
+ };
2689
+ Update: {
2690
+ created_at?: string;
2691
+ current_step?: number;
2692
+ description?: string | null;
2693
+ id?: string;
2694
+ idempotency_key?: string | null;
2695
+ last_execution_id?: string | null;
2696
+ last_run_at?: string | null;
2697
+ max_retries?: number;
2698
+ metadata?: Json | null;
2699
+ name?: string;
2700
+ next_run_at?: string | null;
2701
+ organization_id?: string;
2702
+ origin_execution_id?: string | null;
2703
+ origin_resource_id?: string | null;
2704
+ origin_resource_type?: string | null;
2705
+ retry_count?: number;
2706
+ schedule_config?: Json;
2707
+ status?: string;
2708
+ target_resource_id?: string;
2709
+ target_resource_type?: string;
2710
+ updated_at?: string;
2711
+ };
2712
+ Relationships: [
2713
+ {
2714
+ foreignKeyName: "task_schedules_organization_id_fkey";
2715
+ columns: ["organization_id"];
2716
+ isOneToOne: false;
2717
+ referencedRelation: "organizations";
2718
+ referencedColumns: ["id"];
2719
+ }
2720
+ ];
2721
+ };
2722
+ users: {
2723
+ Row: {
2724
+ config: Json;
2725
+ created_at: string;
2726
+ display_name: string | null;
2727
+ email: string;
2728
+ first_name: string | null;
2729
+ id: string;
2730
+ is_active: boolean;
2731
+ is_platform_admin: boolean | null;
2732
+ last_login_at: string | null;
2733
+ last_name: string | null;
2734
+ last_visited_org: string | null;
2735
+ profile_picture_url: string | null;
2736
+ updated_at: string;
2737
+ workos_user_id: string | null;
2738
+ };
2739
+ Insert: {
2740
+ config?: Json;
2741
+ created_at?: string;
2742
+ display_name?: string | null;
2743
+ email: string;
2744
+ first_name?: string | null;
2745
+ id?: string;
2746
+ is_active?: boolean;
2747
+ is_platform_admin?: boolean | null;
2748
+ last_login_at?: string | null;
2749
+ last_name?: string | null;
2750
+ last_visited_org?: string | null;
2751
+ profile_picture_url?: string | null;
2752
+ updated_at?: string;
2753
+ workos_user_id?: string | null;
2754
+ };
2755
+ Update: {
2756
+ config?: Json;
2757
+ created_at?: string;
2758
+ display_name?: string | null;
2759
+ email?: string;
2760
+ first_name?: string | null;
2761
+ id?: string;
2762
+ is_active?: boolean;
2763
+ is_platform_admin?: boolean | null;
2764
+ last_login_at?: string | null;
2765
+ last_name?: string | null;
2766
+ last_visited_org?: string | null;
2767
+ profile_picture_url?: string | null;
2768
+ updated_at?: string;
2769
+ workos_user_id?: string | null;
2770
+ };
2771
+ Relationships: [
2772
+ {
2773
+ foreignKeyName: "user_profiles_last_visited_org_fkey";
2774
+ columns: ["last_visited_org"];
2775
+ isOneToOne: false;
2776
+ referencedRelation: "organizations";
2777
+ referencedColumns: ["id"];
2778
+ }
2779
+ ];
2780
+ };
2781
+ webhook_endpoints: {
2782
+ Row: {
2783
+ created_at: string;
2784
+ description: string | null;
2785
+ id: string;
2786
+ key: string;
2787
+ last_triggered_at: string | null;
2788
+ name: string;
2789
+ organization_id: string;
2790
+ request_count: number;
2791
+ resource_id: string | null;
2792
+ status: string;
2793
+ updated_at: string;
2794
+ };
2795
+ Insert: {
2796
+ created_at?: string;
2797
+ description?: string | null;
2798
+ id?: string;
2799
+ key: string;
2800
+ last_triggered_at?: string | null;
2801
+ name: string;
2802
+ organization_id: string;
2803
+ request_count?: number;
2804
+ resource_id?: string | null;
2805
+ status?: string;
2806
+ updated_at?: string;
2807
+ };
2808
+ Update: {
2809
+ created_at?: string;
2810
+ description?: string | null;
2811
+ id?: string;
2812
+ key?: string;
2813
+ last_triggered_at?: string | null;
2814
+ name?: string;
2815
+ organization_id?: string;
2816
+ request_count?: number;
2817
+ resource_id?: string | null;
2818
+ status?: string;
2819
+ updated_at?: string;
2820
+ };
2821
+ Relationships: [
2822
+ {
2823
+ foreignKeyName: "webhook_endpoints_organization_id_fkey";
2824
+ columns: ["organization_id"];
2825
+ isOneToOne: false;
2826
+ referencedRelation: "organizations";
2827
+ referencedColumns: ["id"];
2828
+ }
2829
+ ];
2830
+ };
2831
+ };
2832
+ Views: {
2833
+ [_ in never]: never;
2834
+ };
2835
+ Functions: {
2836
+ acq_default_checklist: {
2837
+ Args: {
2838
+ p_platform: string;
2839
+ };
2840
+ Returns: Json;
2841
+ };
2842
+ append_deal_activity: {
2843
+ Args: {
2844
+ p_activity: Json;
2845
+ p_deal_id: string;
2846
+ p_organization_id: string;
2847
+ };
2848
+ Returns: undefined;
2849
+ };
2850
+ auth_jwt_claims: {
2851
+ Args: never;
2852
+ Returns: Json;
2853
+ };
2854
+ auth_uid_safe: {
2855
+ Args: never;
2856
+ Returns: string;
2857
+ };
2858
+ current_user_is_platform_admin: {
2859
+ Args: never;
2860
+ Returns: boolean;
2861
+ };
2862
+ current_user_supabase_id: {
2863
+ Args: never;
2864
+ Returns: string;
2865
+ };
2866
+ detect_stalled_executions: {
2867
+ Args: never;
2868
+ Returns: undefined;
2869
+ };
2870
+ execute_session_turn: {
2871
+ Args: {
2872
+ p_session_id: string;
2873
+ };
2874
+ Returns: {
2875
+ created_at: string;
2876
+ ended_at: string;
2877
+ memory_snapshot: Json;
2878
+ metadata: Json;
2879
+ organization_id: string;
2880
+ resource_id: string;
2881
+ session_id: string;
2882
+ session_total_turns: number;
2883
+ updated_at: string;
2884
+ user_id: string;
2885
+ }[];
2886
+ };
2887
+ get_storage_org_id: {
2888
+ Args: {
2889
+ file_path: string;
2890
+ };
2891
+ Returns: string;
2892
+ };
2893
+ get_workos_user_id: {
2894
+ Args: never;
2895
+ Returns: string;
2896
+ };
2897
+ is_org_admin: {
2898
+ Args: {
2899
+ org_id: string;
2900
+ };
2901
+ Returns: boolean;
2902
+ };
2903
+ is_org_member: {
2904
+ Args: {
2905
+ org_id: string;
2906
+ };
2907
+ Returns: boolean;
2908
+ };
2909
+ link_workos_membership_on_accept: {
2910
+ Args: {
2911
+ p_email: string;
2912
+ p_organization_id: string;
2913
+ p_workos_membership_id: string;
2914
+ };
2915
+ Returns: boolean;
2916
+ };
2917
+ pre_provision_invited_user: {
2918
+ Args: {
2919
+ p_email: string;
2920
+ p_organization_id: string;
2921
+ p_role_slug?: string;
2922
+ };
2923
+ Returns: Json;
2924
+ };
2925
+ process_due_schedules: {
2926
+ Args: never;
2927
+ Returns: Json;
2928
+ };
2929
+ upsert_user_profile: {
2930
+ Args: never;
2931
+ Returns: {
2932
+ profile_display_name: string;
2933
+ profile_email: string;
2934
+ profile_id: string;
2935
+ profile_workos_user_id: string;
2936
+ }[];
2937
+ };
2938
+ };
2939
+ Enums: {
2940
+ [_ in never]: never;
2941
+ };
2942
+ CompositeTypes: {
2943
+ [_ in never]: never;
2944
+ };
2945
+ };
2946
+ };
2947
+
2948
+ /**
2949
+ * RLS Test Context Manager
2950
+ * Manages isolated test data and user context switching for RLS integration tests
2951
+ *
2952
+ * Usage:
2953
+ * ```typescript
2954
+ * describe('RLS Policies - API Keys', () => {
2955
+ * let ctx: RLSTestContext
2956
+ *
2957
+ * beforeAll(async () => {
2958
+ * ctx = new RLSTestContext()
2959
+ * // Create test data
2960
+ * })
2961
+ *
2962
+ * afterAll(async () => {
2963
+ * await ctx.cleanup()
2964
+ * })
2965
+ * })
2966
+ * ```
2967
+ */
2968
+
2969
+ type Role = 'admin' | 'member';
2970
+ interface UserWithWorkosId {
2971
+ id: string;
2972
+ workos_user_id: string;
2973
+ email: string;
2974
+ is_platform_admin: boolean;
2975
+ }
2976
+ interface PreProvisionedUser {
2977
+ id: string;
2978
+ email: string;
2979
+ is_platform_admin: boolean;
2980
+ }
2981
+ interface Organization {
2982
+ id: string;
2983
+ name: string;
2984
+ }
2985
+ interface Membership {
2986
+ id: string;
2987
+ user_id: string;
2988
+ organization_id: string;
2989
+ role_slug: Role;
2990
+ }
2991
+ declare class RLSTestContext {
2992
+ adminClient: SupabaseClient<Database>;
2993
+ testPrefix: string;
2994
+ createdIds: {
2995
+ users: string[];
2996
+ organizations: string[];
2997
+ memberships: string[];
2998
+ apiKeys: string[];
2999
+ invitations: string[];
3000
+ taskSchedules: string[];
3001
+ commandQueue: string[];
3002
+ sessions: string[];
3003
+ sessionMessages: string[];
3004
+ executionLogs: string[];
3005
+ executionMetrics: string[];
3006
+ notifications: string[];
3007
+ credentials: string[];
3008
+ activities: string[];
3009
+ };
3010
+ constructor();
3011
+ /**
3012
+ * Create a test organization
3013
+ */
3014
+ createOrganization(name: string): Promise<Organization>;
3015
+ /**
3016
+ * Create a test user with a WorkOS user ID
3017
+ */
3018
+ createUser(email: string, isPlatformAdmin?: boolean): Promise<UserWithWorkosId>;
3019
+ /**
3020
+ * Create a pre-provisioned test user (without WorkOS user ID)
3021
+ * Used for testing invitation flows where users are created before they sign up
3022
+ */
3023
+ createPreProvisionedUser(email: string, isPlatformAdmin?: boolean): Promise<PreProvisionedUser>;
3024
+ /**
3025
+ * Create an organization membership
3026
+ */
3027
+ createMembership(userId: string, organizationId: string, role: Role): Promise<Membership>;
3028
+ /**
3029
+ * Create a pre-provisioned organization membership (without WorkOS membership ID)
3030
+ * Used for testing invitation flows where memberships are created before user accepts
3031
+ */
3032
+ createPreProvisionedMembership(userId: string, organizationId: string, role: Role): Promise<Membership>;
3033
+ /**
3034
+ * Generate a JWT token for a test user
3035
+ * Uses Supabase JWT secret so auth.jwt() in RLS policies can decode it
3036
+ */
3037
+ generateJWT(workosUserId: string, email?: string): string;
3038
+ /**
3039
+ * Create a Supabase client for a specific user (respects RLS)
3040
+ * This client will have the user's JWT token, so RLS policies will apply
3041
+ */
3042
+ createUserClient(workosUserId: string): SupabaseClient<Database>;
3043
+ /**
3044
+ * Create a Supabase client for a pre-provisioned user (respects RLS)
3045
+ * Uses a dummy workos_user_id but includes the email claim for RLS matching
3046
+ * The email claim is what matters for pre-provisioned user RLS policies
3047
+ */
3048
+ createPreProvisionedUserClient(email: string): SupabaseClient<Database>;
3049
+ /** Create an organization with an admin user and authenticated client. */
3050
+ createOrgWithAdmin(name: string, email: string): Promise<{
3051
+ org: Organization;
3052
+ user: UserWithWorkosId;
3053
+ membership: Membership;
3054
+ client: SupabaseClient<Database>;
3055
+ }>;
3056
+ /** Create two isolated organizations with admin users for cross-org isolation tests. */
3057
+ createCrossOrgFixture(nameA?: string, nameB?: string): Promise<{
3058
+ orgA: Organization;
3059
+ orgB: Organization;
3060
+ userA: UserWithWorkosId;
3061
+ userB: UserWithWorkosId;
3062
+ membershipA: Membership;
3063
+ membershipB: Membership;
3064
+ clientA: SupabaseClient<Database>;
3065
+ clientB: SupabaseClient<Database>;
3066
+ }>;
3067
+ /**
3068
+ * Clean up all test data created during the test run
3069
+ * Called in afterAll() to prevent test pollution
3070
+ *
3071
+ * Cleanup order respects foreign key dependencies (child tables before parent tables):
3072
+ *
3073
+ * Level 1 (Deepest dependencies):
3074
+ * - execution_metrics (FK: execution_logs)
3075
+ * - session_messages (FK: sessions)
3076
+ *
3077
+ * Level 2 (Mid-level dependencies):
3078
+ * - execution_logs (FK: sessions, users)
3079
+ * - task_schedules (FK: organizations)
3080
+ * - command_queue (FK: organizations, users)
3081
+ * - notifications (FK: organizations, users)
3082
+ * - credentials (FK: organizations, users)
3083
+ * - sessions (FK: organizations, users)
3084
+ * - activities (FK: organizations)
3085
+ *
3086
+ * Level 3 (Organization/User dependencies):
3087
+ * - invitations (FK: organizations, users)
3088
+ * - api_keys (FK: organizations)
3089
+ * - memberships (FK: organizations, users)
3090
+ *
3091
+ * Level 4 (Base tables):
3092
+ * - users
3093
+ * - organizations
3094
+ */
3095
+ cleanup(): Promise<void>;
3096
+ }
3097
+
3098
+ /**
3099
+ * Browser Mocks for Testing
3100
+ *
3101
+ * Centralized browser API mocks for testing React components in jsdom environment.
3102
+ * These mocks are required for Mantine components and other UI libraries.
3103
+ *
3104
+ * @note This file is only used in test environments with jsdom.
3105
+ */
3106
+ /**
3107
+ * Mock window.matchMedia for testing
3108
+ * Required for Mantine components that use media queries
3109
+ */
3110
+ declare function setupMatchMedia(): void;
3111
+ /**
3112
+ * Mock ResizeObserver for testing
3113
+ * Required for Mantine components that observe element size changes
3114
+ */
3115
+ declare function setupResizeObserver(): void;
3116
+ /**
3117
+ * Setup all browser mocks at once
3118
+ * Convenience function for test setup files
3119
+ */
3120
+ declare function setupBrowserMocks(): void;
3121
+
3122
+ export { RLSTestContext, setupBrowserMocks, setupMatchMedia, setupResizeObserver };