sqlew 5.0.8 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (458) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +2 -2
  3. package/dist/adapters/auth/auth-factory.d.ts +2 -81
  4. package/dist/adapters/auth/auth-factory.d.ts.map +1 -1
  5. package/dist/adapters/auth/auth-factory.js +2 -82
  6. package/dist/adapters/auth/auth-factory.js.map +1 -1
  7. package/dist/adapters/auth/base-auth-provider.d.ts +18 -303
  8. package/dist/adapters/auth/base-auth-provider.d.ts.map +1 -1
  9. package/dist/adapters/auth/base-auth-provider.js +2 -104
  10. package/dist/adapters/auth/base-auth-provider.js.map +1 -1
  11. package/dist/adapters/auth/direct-auth-provider.d.ts +4 -348
  12. package/dist/adapters/auth/direct-auth-provider.d.ts.map +1 -1
  13. package/dist/adapters/auth/direct-auth-provider.js +6 -356
  14. package/dist/adapters/auth/direct-auth-provider.js.map +1 -1
  15. package/dist/adapters/base-adapter.d.ts +31 -598
  16. package/dist/adapters/base-adapter.d.ts.map +1 -1
  17. package/dist/adapters/base-adapter.js +10 -458
  18. package/dist/adapters/base-adapter.js.map +1 -1
  19. package/dist/adapters/index.d.ts +1 -11
  20. package/dist/adapters/index.d.ts.map +1 -1
  21. package/dist/adapters/index.js +1 -11
  22. package/dist/adapters/index.js.map +1 -1
  23. package/dist/adapters/mysql-adapter.d.ts +15 -541
  24. package/dist/adapters/mysql-adapter.d.ts.map +1 -1
  25. package/dist/adapters/mysql-adapter.js +24 -561
  26. package/dist/adapters/mysql-adapter.js.map +1 -1
  27. package/dist/adapters/postgresql-adapter.d.ts +15 -203
  28. package/dist/adapters/postgresql-adapter.d.ts.map +1 -1
  29. package/dist/adapters/postgresql-adapter.js +24 -223
  30. package/dist/adapters/postgresql-adapter.js.map +1 -1
  31. package/dist/adapters/sqlite-adapter.d.ts +4 -28
  32. package/dist/adapters/sqlite-adapter.d.ts.map +1 -1
  33. package/dist/adapters/sqlite-adapter.js +4 -32
  34. package/dist/adapters/sqlite-adapter.js.map +1 -1
  35. package/dist/adapters/types.d.ts +1 -4
  36. package/dist/adapters/types.d.ts.map +1 -1
  37. package/dist/backend/backend-factory.d.ts +3 -3
  38. package/dist/backend/backend-factory.js +3 -3
  39. package/dist/backend/local-backend.d.ts.map +1 -1
  40. package/dist/backend/local-backend.js +0 -5
  41. package/dist/backend/local-backend.js.map +1 -1
  42. package/dist/cli/db-export.d.ts.map +1 -1
  43. package/dist/cli/db-export.js +54 -32
  44. package/dist/cli/db-export.js.map +1 -1
  45. package/dist/cli/db-import.d.ts.map +1 -1
  46. package/dist/cli/db-import.js +32 -31
  47. package/dist/cli/db-import.js.map +1 -1
  48. package/dist/cli.d.ts.map +1 -1
  49. package/dist/cli.js +1 -12
  50. package/dist/cli.js.map +1 -1
  51. package/dist/config/cloud-config-loader.d.ts +8 -8
  52. package/dist/config/cloud-config-loader.d.ts.map +1 -1
  53. package/dist/config/cloud-config-loader.js +12 -12
  54. package/dist/config/cloud-config-loader.js.map +1 -1
  55. package/dist/config/global-config.d.ts +17 -45
  56. package/dist/config/global-config.d.ts.map +1 -1
  57. package/dist/config/global-config.js +169 -30
  58. package/dist/config/global-config.js.map +1 -1
  59. package/dist/config/loader.d.ts +1 -18
  60. package/dist/config/loader.d.ts.map +1 -1
  61. package/dist/config/loader.js +1 -89
  62. package/dist/config/loader.js.map +1 -1
  63. package/dist/config/types.d.ts +2 -64
  64. package/dist/config/types.d.ts.map +1 -1
  65. package/dist/config/types.js +0 -18
  66. package/dist/config/types.js.map +1 -1
  67. package/dist/database/index.d.ts +1 -2
  68. package/dist/database/index.d.ts.map +1 -1
  69. package/dist/database/index.js +1 -3
  70. package/dist/database/index.js.map +1 -1
  71. package/dist/database/operations/queries.d.ts +0 -4
  72. package/dist/database/operations/queries.d.ts.map +1 -1
  73. package/dist/database/operations/queries.js +0 -8
  74. package/dist/database/operations/queries.js.map +1 -1
  75. package/dist/index.d.ts +1 -1
  76. package/dist/index.js +2 -2
  77. package/dist/index.js.map +1 -1
  78. package/dist/init-rules.d.ts.map +1 -1
  79. package/dist/init-rules.js +0 -1
  80. package/dist/init-rules.js.map +1 -1
  81. package/dist/knexfile.d.ts.map +1 -1
  82. package/dist/knexfile.js +2 -1
  83. package/dist/knexfile.js.map +1 -1
  84. package/dist/migration/local-to-global.d.ts +19 -0
  85. package/dist/migration/local-to-global.d.ts.map +1 -0
  86. package/dist/migration/local-to-global.js +133 -0
  87. package/dist/migration/local-to-global.js.map +1 -0
  88. package/dist/saas-connector/client/types.d.ts +1 -1
  89. package/dist/saas-connector/client/types.d.ts.map +1 -1
  90. package/dist/schema.js +1 -1
  91. package/dist/server/setup.d.ts.map +1 -1
  92. package/dist/server/setup.js +15 -7
  93. package/dist/server/setup.js.map +1 -1
  94. package/dist/tests/backend/backend-factory.test.js +2 -2
  95. package/dist/tests/backend/backend-factory.test.js.map +1 -1
  96. package/dist/tests/docker/native/constraint-operations.test.d.ts +2 -17
  97. package/dist/tests/docker/native/constraint-operations.test.d.ts.map +1 -1
  98. package/dist/tests/docker/native/constraint-operations.test.js +3 -82
  99. package/dist/tests/docker/native/constraint-operations.test.js.map +1 -1
  100. package/dist/tests/docker/native/db-init.d.ts +3 -34
  101. package/dist/tests/docker/native/db-init.d.ts.map +1 -1
  102. package/dist/tests/docker/native/db-init.js +15 -77
  103. package/dist/tests/docker/native/db-init.js.map +1 -1
  104. package/dist/tests/docker/native/decision-operations.test.d.ts +2 -10
  105. package/dist/tests/docker/native/decision-operations.test.d.ts.map +1 -1
  106. package/dist/tests/docker/native/decision-operations.test.js +2 -84
  107. package/dist/tests/docker/native/decision-operations.test.js.map +1 -1
  108. package/dist/tests/docker/native/help-system.test.d.ts +2 -5
  109. package/dist/tests/docker/native/help-system.test.d.ts.map +1 -1
  110. package/dist/tests/docker/native/help-system.test.js +2 -47
  111. package/dist/tests/docker/native/help-system.test.js.map +1 -1
  112. package/dist/tests/docker/native/suggest-tool.test.d.ts +3 -11
  113. package/dist/tests/docker/native/suggest-tool.test.d.ts.map +1 -1
  114. package/dist/tests/docker/native/suggest-tool.test.js +3 -60
  115. package/dist/tests/docker/native/suggest-tool.test.js.map +1 -1
  116. package/dist/tests/docker/native/test-harness.d.ts +2 -23
  117. package/dist/tests/docker/native/test-harness.d.ts.map +1 -1
  118. package/dist/tests/docker/native/test-harness.js +5 -59
  119. package/dist/tests/docker/native/test-harness.js.map +1 -1
  120. package/dist/tests/feature/decision/analytics.test.js +2 -1
  121. package/dist/tests/feature/decision/analytics.test.js.map +1 -1
  122. package/dist/tests/feature/decision/batch-validation-comprehensive.test.js +2 -7
  123. package/dist/tests/feature/decision/batch-validation-comprehensive.test.js.map +1 -1
  124. package/dist/tests/feature/decision/batch-validation.test.js +2 -1
  125. package/dist/tests/feature/decision/batch-validation.test.js.map +1 -1
  126. package/dist/tests/integration/auto-trigger-suggestions.test.js +4 -37
  127. package/dist/tests/integration/auto-trigger-suggestions.test.js.map +1 -1
  128. package/dist/tests/integration/hybrid-similarity-detection.test.js +2 -1
  129. package/dist/tests/integration/hybrid-similarity-detection.test.js.map +1 -1
  130. package/dist/tests/integration/json-export-import.test.d.ts.map +1 -0
  131. package/dist/tests/integration/json-export-import.test.js.map +1 -0
  132. package/dist/tests/unit/case-insensitive-validator.test.d.ts +0 -7
  133. package/dist/tests/unit/case-insensitive-validator.test.d.ts.map +1 -1
  134. package/dist/tests/unit/case-insensitive-validator.test.js +0 -22
  135. package/dist/tests/unit/case-insensitive-validator.test.js.map +1 -1
  136. package/dist/tests/unit/config/cloud-config-loader.test.js +4 -2
  137. package/dist/tests/unit/config/cloud-config-loader.test.js.map +1 -1
  138. package/dist/tests/unit/config/global-db-migration.test.d.ts +12 -0
  139. package/dist/tests/unit/config/global-db-migration.test.d.ts.map +1 -0
  140. package/dist/tests/unit/config/global-db-migration.test.js +117 -0
  141. package/dist/tests/unit/config/global-db-migration.test.js.map +1 -0
  142. package/dist/tests/unit/constraint-scorer.test.d.ts +2 -7
  143. package/dist/tests/unit/constraint-scorer.test.d.ts.map +1 -1
  144. package/dist/tests/unit/constraint-scorer.test.js +2 -28
  145. package/dist/tests/unit/constraint-scorer.test.js.map +1 -1
  146. package/dist/tests/unit/universal-knex.test.js +9 -0
  147. package/dist/tests/unit/universal-knex.test.js.map +1 -1
  148. package/dist/tests/unit/validation/parameter-validation.test.js +0 -24
  149. package/dist/tests/unit/validation/parameter-validation.test.js.map +1 -1
  150. package/dist/tests/utils/db-config.d.ts.map +1 -1
  151. package/dist/tests/utils/db-config.js +0 -9
  152. package/dist/tests/utils/db-config.js.map +1 -1
  153. package/dist/tests/utils/db-import.d.ts.map +1 -1
  154. package/dist/tests/utils/db-import.js +0 -3
  155. package/dist/tests/utils/db-import.js.map +1 -1
  156. package/dist/tests/utils/db-schema.d.ts.map +1 -1
  157. package/dist/tests/utils/db-schema.js +48 -51
  158. package/dist/tests/utils/db-schema.js.map +1 -1
  159. package/dist/tests/utils/db-seeding.d.ts.map +1 -1
  160. package/dist/tests/utils/db-seeding.js +0 -3
  161. package/dist/tests/utils/db-seeding.js.map +1 -1
  162. package/dist/tests/utils/index.d.ts +0 -1
  163. package/dist/tests/utils/index.d.ts.map +1 -1
  164. package/dist/tests/utils/index.js +0 -2
  165. package/dist/tests/utils/index.js.map +1 -1
  166. package/dist/tests/utils/test-helpers.d.ts +6 -76
  167. package/dist/tests/utils/test-helpers.d.ts.map +1 -1
  168. package/dist/tests/utils/test-helpers.js +56 -162
  169. package/dist/tests/utils/test-helpers.js.map +1 -1
  170. package/dist/tests/utils/test-lifecycle.d.ts +2 -28
  171. package/dist/tests/utils/test-lifecycle.d.ts.map +1 -1
  172. package/dist/tests/utils/test-lifecycle.js +2 -31
  173. package/dist/tests/utils/test-lifecycle.js.map +1 -1
  174. package/dist/tools/context/index.d.ts +0 -1
  175. package/dist/tools/context/index.d.ts.map +1 -1
  176. package/dist/tools/context/index.js +0 -2
  177. package/dist/tools/context/index.js.map +1 -1
  178. package/dist/tools/context/types.d.ts +1 -1
  179. package/dist/tools/context/types.d.ts.map +1 -1
  180. package/dist/types/actions.d.ts +6 -29
  181. package/dist/types/actions.d.ts.map +1 -1
  182. package/dist/types/actions.js +1 -2
  183. package/dist/types/actions.js.map +1 -1
  184. package/dist/types/constraint/params.d.ts +24 -1
  185. package/dist/types/constraint/params.d.ts.map +1 -1
  186. package/dist/types/constraint/params.js +3 -0
  187. package/dist/types/constraint/params.js.map +1 -1
  188. package/dist/types/constraint/responses.d.ts +18 -1
  189. package/dist/types/constraint/responses.d.ts.map +1 -1
  190. package/dist/types/constraint/responses.js +3 -0
  191. package/dist/types/constraint/responses.js.map +1 -1
  192. package/dist/types/decision/batch.d.ts +2 -5
  193. package/dist/types/decision/batch.d.ts.map +1 -1
  194. package/dist/types/decision/batch.js +3 -3
  195. package/dist/types/decision/batch.js.map +1 -1
  196. package/dist/types/decision/params.d.ts +7 -4
  197. package/dist/types/decision/params.d.ts.map +1 -1
  198. package/dist/types/decision/responses.d.ts +49 -35
  199. package/dist/types/decision/responses.d.ts.map +1 -1
  200. package/dist/types/decision/templates.d.ts +2 -18
  201. package/dist/types/decision/templates.d.ts.map +1 -1
  202. package/dist/types/decision/templates.js +3 -3
  203. package/dist/types/decision/templates.js.map +1 -1
  204. package/dist/types/enums.d.ts +11 -13
  205. package/dist/types/enums.d.ts.map +1 -1
  206. package/dist/types/enums.js +5 -13
  207. package/dist/types/enums.js.map +1 -1
  208. package/dist/types/import-export.d.ts +7 -30
  209. package/dist/types/import-export.d.ts.map +1 -1
  210. package/dist/types/import-export.js +1 -2
  211. package/dist/types/import-export.js.map +1 -1
  212. package/dist/types/index.d.ts +18 -22
  213. package/dist/types/index.d.ts.map +1 -1
  214. package/dist/types/index.js +4 -32
  215. package/dist/types/index.js.map +1 -1
  216. package/dist/types/master-entities.d.ts +1 -10
  217. package/dist/types/master-entities.d.ts.map +1 -1
  218. package/dist/types/master-entities.js +1 -2
  219. package/dist/types/master-entities.js.map +1 -1
  220. package/dist/types/transaction-entities.d.ts +2 -21
  221. package/dist/types/transaction-entities.d.ts.map +1 -1
  222. package/dist/types/transaction-entities.js +1 -1
  223. package/dist/types/validation.d.ts +1 -16
  224. package/dist/types/validation.d.ts.map +1 -1
  225. package/dist/types/validation.js +1 -2
  226. package/dist/types/validation.js.map +1 -1
  227. package/dist/types/view-entities.d.ts +3 -12
  228. package/dist/types/view-entities.d.ts.map +1 -1
  229. package/dist/types/view-entities.js +1 -1
  230. package/dist/types.d.ts +4 -718
  231. package/dist/types.d.ts.map +1 -1
  232. package/dist/types.js +5 -39
  233. package/dist/types.js.map +1 -1
  234. package/dist/utils/parameter-validator.d.ts +2 -2
  235. package/dist/utils/parameter-validator.d.ts.map +1 -1
  236. package/dist/utils/parameter-validator.js.map +1 -1
  237. package/docs/CLI_USAGE.md +27 -107
  238. package/docs/CONFIGURATION.md +10 -5
  239. package/docs/DATABASE_AUTH.md +3 -3
  240. package/docs/MIGRATION_TO_SAAS.md +2 -2
  241. package/docs/SHARED_DATABASE.md +108 -0
  242. package/package.json +4 -3
  243. package/dist/adapters/auth/auth-types.d.ts +0 -30
  244. package/dist/adapters/auth/auth-types.d.ts.map +0 -1
  245. package/dist/adapters/auth/auth-types.js +0 -30
  246. package/dist/adapters/auth/auth-types.js.map +0 -1
  247. package/dist/cli/db-dump.d.ts +0 -36
  248. package/dist/cli/db-dump.d.ts.map +0 -1
  249. package/dist/cli/db-dump.js +0 -384
  250. package/dist/cli/db-dump.js.map +0 -1
  251. package/dist/database/config/config-ops.d.ts +0 -42
  252. package/dist/database/config/config-ops.d.ts.map +0 -1
  253. package/dist/database/config/config-ops.js +0 -102
  254. package/dist/database/config/config-ops.js.map +0 -1
  255. package/dist/formatters/adr-formatter.d.ts +0 -22
  256. package/dist/formatters/adr-formatter.d.ts.map +0 -1
  257. package/dist/formatters/adr-formatter.js +0 -127
  258. package/dist/formatters/adr-formatter.js.map +0 -1
  259. package/dist/formatters/confluence-formatter.d.ts +0 -26
  260. package/dist/formatters/confluence-formatter.d.ts.map +0 -1
  261. package/dist/formatters/confluence-formatter.js +0 -129
  262. package/dist/formatters/confluence-formatter.js.map +0 -1
  263. package/dist/formatters/index.d.ts +0 -34
  264. package/dist/formatters/index.d.ts.map +0 -1
  265. package/dist/formatters/index.js +0 -57
  266. package/dist/formatters/index.js.map +0 -1
  267. package/dist/formatters/markdown-formatter.d.ts +0 -16
  268. package/dist/formatters/markdown-formatter.d.ts.map +0 -1
  269. package/dist/formatters/markdown-formatter.js +0 -110
  270. package/dist/formatters/markdown-formatter.js.map +0 -1
  271. package/dist/formatters/notion-formatter.d.ts +0 -29
  272. package/dist/formatters/notion-formatter.d.ts.map +0 -1
  273. package/dist/formatters/notion-formatter.js +0 -177
  274. package/dist/formatters/notion-formatter.js.map +0 -1
  275. package/dist/formatters/types.d.ts +0 -31
  276. package/dist/formatters/types.d.ts.map +0 -1
  277. package/dist/formatters/types.js +0 -6
  278. package/dist/formatters/types.js.map +0 -1
  279. package/dist/tests/database/sql-dump/converters.test.d.ts +0 -7
  280. package/dist/tests/database/sql-dump/converters.test.d.ts.map +0 -1
  281. package/dist/tests/database/sql-dump/converters.test.js +0 -314
  282. package/dist/tests/database/sql-dump/converters.test.js.map +0 -1
  283. package/dist/tests/database/sql-dump/default-conversions.test.d.ts +0 -8
  284. package/dist/tests/database/sql-dump/default-conversions.test.d.ts.map +0 -1
  285. package/dist/tests/database/sql-dump/default-conversions.test.js +0 -141
  286. package/dist/tests/database/sql-dump/default-conversions.test.js.map +0 -1
  287. package/dist/tests/database/sql-dump/table-ordering.test.d.ts +0 -27
  288. package/dist/tests/database/sql-dump/table-ordering.test.d.ts.map +0 -1
  289. package/dist/tests/database/sql-dump/table-ordering.test.js +0 -284
  290. package/dist/tests/database/sql-dump/table-ordering.test.js.map +0 -1
  291. package/dist/tests/database/sql-dump/type-conversion.test.d.ts +0 -8
  292. package/dist/tests/database/sql-dump/type-conversion.test.d.ts.map +0 -1
  293. package/dist/tests/database/sql-dump/type-conversion.test.js +0 -361
  294. package/dist/tests/database/sql-dump/type-conversion.test.js.map +0 -1
  295. package/dist/tests/docker/cross-database.test.d.ts +0 -21
  296. package/dist/tests/docker/cross-database.test.d.ts.map +0 -1
  297. package/dist/tests/docker/cross-database.test.js +0 -308
  298. package/dist/tests/docker/cross-database.test.js.map +0 -1
  299. package/dist/tests/docker/dump-import.test.d.ts +0 -15
  300. package/dist/tests/docker/dump-import.test.d.ts.map +0 -1
  301. package/dist/tests/docker/dump-import.test.js +0 -424
  302. package/dist/tests/docker/dump-import.test.js.map +0 -1
  303. package/dist/tests/docker/fk-constraints.test.d.ts +0 -13
  304. package/dist/tests/docker/fk-constraints.test.d.ts.map +0 -1
  305. package/dist/tests/docker/fk-constraints.test.js +0 -381
  306. package/dist/tests/docker/fk-constraints.test.js.map +0 -1
  307. package/dist/tests/docker/indexes.test.d.ts +0 -12
  308. package/dist/tests/docker/indexes.test.d.ts.map +0 -1
  309. package/dist/tests/docker/indexes.test.js +0 -250
  310. package/dist/tests/docker/indexes.test.js.map +0 -1
  311. package/dist/tests/docker/integration.test.d.ts +0 -16
  312. package/dist/tests/docker/integration.test.d.ts.map +0 -1
  313. package/dist/tests/docker/integration.test.js +0 -323
  314. package/dist/tests/docker/integration.test.js.map +0 -1
  315. package/dist/tests/docker/multi-project-migration.test.d.ts +0 -17
  316. package/dist/tests/docker/multi-project-migration.test.d.ts.map +0 -1
  317. package/dist/tests/docker/multi-project-migration.test.js +0 -394
  318. package/dist/tests/docker/multi-project-migration.test.js.map +0 -1
  319. package/dist/tests/docker/schema-migration.test.d.ts +0 -8
  320. package/dist/tests/docker/schema-migration.test.d.ts.map +0 -1
  321. package/dist/tests/docker/schema-migration.test.js +0 -98
  322. package/dist/tests/docker/schema-migration.test.js.map +0 -1
  323. package/dist/tests/integration/e2e-workflow1-debug.test.d.ts +0 -5
  324. package/dist/tests/integration/e2e-workflow1-debug.test.d.ts.map +0 -1
  325. package/dist/tests/integration/e2e-workflow1-debug.test.js +0 -85
  326. package/dist/tests/integration/e2e-workflow1-debug.test.js.map +0 -1
  327. package/dist/tests/integration/suggest-simple.test.d.ts +0 -5
  328. package/dist/tests/integration/suggest-simple.test.d.ts.map +0 -1
  329. package/dist/tests/integration/suggest-simple.test.js +0 -90
  330. package/dist/tests/integration/suggest-simple.test.js.map +0 -1
  331. package/dist/tests/migrations/test-all-versions-real.d.ts +0 -8
  332. package/dist/tests/migrations/test-all-versions-real.d.ts.map +0 -1
  333. package/dist/tests/migrations/test-all-versions-real.js +0 -236
  334. package/dist/tests/migrations/test-all-versions-real.js.map +0 -1
  335. package/dist/tests/migrations/test-all-versions.d.ts +0 -14
  336. package/dist/tests/migrations/test-all-versions.d.ts.map +0 -1
  337. package/dist/tests/migrations/test-all-versions.js +0 -519
  338. package/dist/tests/migrations/test-all-versions.js.map +0 -1
  339. package/dist/tests/migrations/v4/v4-fresh-install.test.d.ts +0 -7
  340. package/dist/tests/migrations/v4/v4-fresh-install.test.d.ts.map +0 -1
  341. package/dist/tests/migrations/v4/v4-fresh-install.test.js +0 -168
  342. package/dist/tests/migrations/v4/v4-fresh-install.test.js.map +0 -1
  343. package/dist/tests/migrations/v4/v4-migrate-data.test.d.ts +0 -13
  344. package/dist/tests/migrations/v4/v4-migrate-data.test.d.ts.map +0 -1
  345. package/dist/tests/migrations/v4/v4-migrate-data.test.js +0 -264
  346. package/dist/tests/migrations/v4/v4-migrate-data.test.js.map +0 -1
  347. package/dist/tests/unit/utils/case-insensitive-validator.test.d.ts +0 -2
  348. package/dist/tests/unit/utils/case-insensitive-validator.test.d.ts.map +0 -1
  349. package/dist/tests/unit/utils/case-insensitive-validator.test.js +0 -97
  350. package/dist/tests/unit/utils/case-insensitive-validator.test.js.map +0 -1
  351. package/dist/tests/utils/json-export-import.test.d.ts.map +0 -1
  352. package/dist/tests/utils/json-export-import.test.js.map +0 -1
  353. package/dist/tests/utils/task-helpers.d.ts +0 -67
  354. package/dist/tests/utils/task-helpers.d.ts.map +0 -1
  355. package/dist/tests/utils/task-helpers.js +0 -134
  356. package/dist/tests/utils/task-helpers.js.map +0 -1
  357. package/dist/tools/context/actions/export.d.ts +0 -35
  358. package/dist/tools/context/actions/export.d.ts.map +0 -1
  359. package/dist/tools/context/actions/export.js +0 -93
  360. package/dist/tools/context/actions/export.js.map +0 -1
  361. package/dist/types/file/params.d.ts +0 -40
  362. package/dist/types/file/params.d.ts.map +0 -1
  363. package/dist/types/file/params.js +0 -6
  364. package/dist/types/file/params.js.map +0 -1
  365. package/dist/types/file/responses.d.ts +0 -2
  366. package/dist/types/file/responses.d.ts.map +0 -1
  367. package/dist/types/file/responses.js +0 -2
  368. package/dist/types/file/responses.js.map +0 -1
  369. package/dist/types/task/params.d.ts +0 -173
  370. package/dist/types/task/params.d.ts.map +0 -1
  371. package/dist/types/task/params.js +0 -8
  372. package/dist/types/task/params.js.map +0 -1
  373. package/dist/types/task/responses.d.ts +0 -334
  374. package/dist/types/task/responses.d.ts.map +0 -1
  375. package/dist/types/task/responses.js +0 -8
  376. package/dist/types/task/responses.js.map +0 -1
  377. package/dist/utils/sql-dump/core/dependency-sort.d.ts +0 -16
  378. package/dist/utils/sql-dump/core/dependency-sort.d.ts.map +0 -1
  379. package/dist/utils/sql-dump/core/dependency-sort.js +0 -105
  380. package/dist/utils/sql-dump/core/dependency-sort.js.map +0 -1
  381. package/dist/utils/sql-dump/core/generate-dump.d.ts +0 -13
  382. package/dist/utils/sql-dump/core/generate-dump.d.ts.map +0 -1
  383. package/dist/utils/sql-dump/core/generate-dump.js +0 -201
  384. package/dist/utils/sql-dump/core/generate-dump.js.map +0 -1
  385. package/dist/utils/sql-dump/core/index-export.d.ts +0 -10
  386. package/dist/utils/sql-dump/core/index-export.d.ts.map +0 -1
  387. package/dist/utils/sql-dump/core/index-export.js +0 -173
  388. package/dist/utils/sql-dump/core/index-export.js.map +0 -1
  389. package/dist/utils/sql-dump/core/sequence-reset.d.ts +0 -6
  390. package/dist/utils/sql-dump/core/sequence-reset.d.ts.map +0 -1
  391. package/dist/utils/sql-dump/core/sequence-reset.js +0 -28
  392. package/dist/utils/sql-dump/core/sequence-reset.js.map +0 -1
  393. package/dist/utils/sql-dump/core/table-export.d.ts +0 -2
  394. package/dist/utils/sql-dump/core/table-export.d.ts.map +0 -1
  395. package/dist/utils/sql-dump/core/table-export.js +0 -4
  396. package/dist/utils/sql-dump/core/table-export.js.map +0 -1
  397. package/dist/utils/sql-dump/core/view-export.d.ts +0 -2
  398. package/dist/utils/sql-dump/core/view-export.d.ts.map +0 -1
  399. package/dist/utils/sql-dump/core/view-export.js +0 -4
  400. package/dist/utils/sql-dump/core/view-export.js.map +0 -1
  401. package/dist/utils/sql-dump/formatters/bulk-insert.d.ts +0 -14
  402. package/dist/utils/sql-dump/formatters/bulk-insert.d.ts.map +0 -1
  403. package/dist/utils/sql-dump/formatters/bulk-insert.js +0 -177
  404. package/dist/utils/sql-dump/formatters/bulk-insert.js.map +0 -1
  405. package/dist/utils/sql-dump/formatters/identifiers.d.ts +0 -6
  406. package/dist/utils/sql-dump/formatters/identifiers.d.ts.map +0 -1
  407. package/dist/utils/sql-dump/formatters/identifiers.js +0 -16
  408. package/dist/utils/sql-dump/formatters/identifiers.js.map +0 -1
  409. package/dist/utils/sql-dump/formatters/value-formatter.d.ts +0 -14
  410. package/dist/utils/sql-dump/formatters/value-formatter.d.ts.map +0 -1
  411. package/dist/utils/sql-dump/formatters/value-formatter.js +0 -281
  412. package/dist/utils/sql-dump/formatters/value-formatter.js.map +0 -1
  413. package/dist/utils/sql-dump/generators/controls.d.ts +0 -10
  414. package/dist/utils/sql-dump/generators/controls.d.ts.map +0 -1
  415. package/dist/utils/sql-dump/generators/controls.js +0 -36
  416. package/dist/utils/sql-dump/generators/controls.js.map +0 -1
  417. package/dist/utils/sql-dump/generators/headers.d.ts +0 -6
  418. package/dist/utils/sql-dump/generators/headers.d.ts.map +0 -1
  419. package/dist/utils/sql-dump/generators/headers.js +0 -19
  420. package/dist/utils/sql-dump/generators/headers.js.map +0 -1
  421. package/dist/utils/sql-dump/index.d.ts +0 -14
  422. package/dist/utils/sql-dump/index.d.ts.map +0 -1
  423. package/dist/utils/sql-dump/index.js +0 -16
  424. package/dist/utils/sql-dump/index.js.map +0 -1
  425. package/dist/utils/sql-dump/schema/indexes.d.ts +0 -20
  426. package/dist/utils/sql-dump/schema/indexes.d.ts.map +0 -1
  427. package/dist/utils/sql-dump/schema/indexes.js +0 -108
  428. package/dist/utils/sql-dump/schema/indexes.js.map +0 -1
  429. package/dist/utils/sql-dump/schema/primary-keys.d.ts +0 -6
  430. package/dist/utils/sql-dump/schema/primary-keys.d.ts.map +0 -1
  431. package/dist/utils/sql-dump/schema/primary-keys.js +0 -41
  432. package/dist/utils/sql-dump/schema/primary-keys.js.map +0 -1
  433. package/dist/utils/sql-dump/schema/tables.d.ts +0 -15
  434. package/dist/utils/sql-dump/schema/tables.d.ts.map +0 -1
  435. package/dist/utils/sql-dump/schema/tables.js +0 -518
  436. package/dist/utils/sql-dump/schema/tables.js.map +0 -1
  437. package/dist/utils/sql-dump/schema/views.d.ts +0 -11
  438. package/dist/utils/sql-dump/schema/views.d.ts.map +0 -1
  439. package/dist/utils/sql-dump/schema/views.js +0 -116
  440. package/dist/utils/sql-dump/schema/views.js.map +0 -1
  441. package/dist/utils/sql-dump/types.d.ts +0 -10
  442. package/dist/utils/sql-dump/types.d.ts.map +0 -1
  443. package/dist/utils/sql-dump/types.js +0 -3
  444. package/dist/utils/sql-dump/types.js.map +0 -1
  445. package/dist/utils/sql-dump-converters.d.ts +0 -188
  446. package/dist/utils/sql-dump-converters.d.ts.map +0 -1
  447. package/dist/utils/sql-dump-converters.js +0 -315
  448. package/dist/utils/sql-dump-converters.js.map +0 -1
  449. package/dist/watcher/gitignore-parser.d.ts +0 -70
  450. package/dist/watcher/gitignore-parser.d.ts.map +0 -1
  451. package/dist/watcher/gitignore-parser.js +0 -195
  452. package/dist/watcher/gitignore-parser.js.map +0 -1
  453. package/dist/watcher/index.d.ts +0 -9
  454. package/dist/watcher/index.d.ts.map +0 -1
  455. package/dist/watcher/index.js +0 -8
  456. package/dist/watcher/index.js.map +0 -1
  457. /package/dist/tests/{utils → integration}/json-export-import.test.d.ts +0 -0
  458. /package/dist/tests/{utils → integration}/json-export-import.test.js +0 -0
package/CHANGELOG.md CHANGED
@@ -7,6 +7,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ---
9
9
 
10
+ ## [5.1.0] - 2026-03-07
11
+
12
+ ### Changed
13
+
14
+ **📁 `.sqlew.env` relocated to `~/.config/sqlew/.sqlew.env`**
15
+
16
+ The cloud API key file (`~/.sqlew.env`) has been moved to `~/.config/sqlew/.sqlew.env` to align with the v5.1 unified global config path. Automatic migration copies the old file and deletes it (API key security: no stale copies). `saveCachedProjectId()` now calls `ensureGlobalConfigDir()` for directory safety.
17
+
18
+ **🔒 db:export Project Scope Auto-Detection (Security)**
19
+
20
+ `db:export` no longer exports all projects by default. With the global shared database (v5.1.0), the default "export everything" behavior risked leaking other projects' decision data.
21
+
22
+ - **Auto-detect**: Project name resolved from `.sqlew/config.toml` `[project].name` when no `project=` option is given
23
+ - **Explicit all**: `project=all` required to export all projects (escape hatch)
24
+ - **Error on ambiguity**: If no project name is found (no CLI arg, no config.toml), the command exits with an actionable error message
25
+ - **Breaking change**: Previously, omitting `project=` exported all projects silently
26
+
27
+ ### Resolution Priority
28
+
29
+ ```
30
+ 1. CLI argument: project=<name> (highest)
31
+ 2. config.toml: [project].name
32
+ 3. Error exit (lowest)
33
+ ```
34
+
35
+ ---
36
+
10
37
  ## [5.0.6] - 2026-02-14
11
38
 
12
39
  ### Changed
package/README.md CHANGED
@@ -72,7 +72,7 @@ Add to `.mcp.json` in your project root:
72
72
  }
73
73
  ```
74
74
 
75
- The database (`.sqlew/sqlew.db`) and config (`.sqlew/config.toml`) are auto-created on first run.
75
+ The database (`~/.config/sqlew/sqlew-shared.db`) and config are auto-created on first run. See [Shared Database](docs/SHARED_DATABASE.md) for details.
76
76
 
77
77
  ### 3. Just use Plan Mode!
78
78
 
@@ -99,7 +99,7 @@ Connect to [sqlew.io](https://sqlew.io) for team-shared decisions:
99
99
  Visit [sqlew.io](https://sqlew.io) and save your API key:
100
100
 
101
101
  ```bash
102
- # ~/.sqlew.env (shared across all projects)
102
+ # ~/.config/sqlew/.sqlew.env (shared across all projects)
103
103
  SQLEW_API_KEY=your-api-key
104
104
  ```
105
105
 
@@ -1,86 +1,7 @@
1
- /**
2
- * @fileoverview Authentication Provider Factory
3
- *
4
- * Factory module for creating appropriate authentication providers based on database configuration.
5
- * Supports direct connections and future IAM-based authentication.
6
- *
7
- * **Note:** SSH tunneling is not supported. Users must set up SSH tunnels manually.
8
- *
9
- * @module adapters/auth/auth-factory
10
- */
11
1
  import { BaseAuthProvider } from './base-auth-provider.js';
12
2
  import type { DatabaseConfig } from '../../config/types.js';
13
- /**
14
- * Create an authentication provider based on database configuration.
15
- *
16
- * Provider selection logic:
17
- * - SQLite: Returns null (no authentication needed for file-based database)
18
- * - MySQL/PostgreSQL: Returns DirectAuthProvider
19
- *
20
- * @param config - Database configuration
21
- * @returns Authentication provider instance or null for SQLite
22
- * @throws Error if database type is invalid
23
- *
24
- * @example
25
- * // Direct connection
26
- * const config: DatabaseConfig = {
27
- * type: 'mysql',
28
- * connection: {
29
- * host: 'localhost',
30
- * port: 3306,
31
- * database: 'mydb'
32
- * },
33
- * auth: {
34
- * type: 'direct',
35
- * user: 'dbuser',
36
- * password: 'dbpass'
37
- * }
38
- * };
39
- * const provider = createAuthProvider(config);
40
- * // Returns DirectAuthProvider instance
41
- *
42
- * @example
43
- * // Connection via manual SSH tunnel
44
- * // Step 1: Set up tunnel manually:
45
- * // ssh -L 3307:db.internal.company.com:3306 user@bastion.example.com
46
- * // Step 2: Configure to use localhost:
47
- * const config: DatabaseConfig = {
48
- * type: 'mysql',
49
- * connection: {
50
- * host: 'localhost', // Tunnel endpoint
51
- * port: 3307, // Forwarded port
52
- * database: 'mydb'
53
- * },
54
- * auth: {
55
- * type: 'direct',
56
- * user: 'dbuser',
57
- * password: 'dbpass'
58
- * }
59
- * };
60
- * const provider = createAuthProvider(config);
61
- * // Returns DirectAuthProvider for localhost connection
62
- *
63
- * @example
64
- * // SQLite (no authentication)
65
- * const sqliteConfig: DatabaseConfig = {
66
- * type: 'sqlite',
67
- * path: './data.db'
68
- * };
69
- * const provider = createAuthProvider(sqliteConfig);
70
- * // Returns null
71
- */
3
+ /** Create an authentication provider based on database configuration. */
72
4
  export declare function createAuthProvider(config: DatabaseConfig): BaseAuthProvider | null;
73
- /**
74
- * Check if database type requires authentication.
75
- *
76
- * @param config - Database configuration
77
- * @returns True if authentication is required (MySQL/PostgreSQL)
78
- *
79
- * @example
80
- * if (requiresAuthentication(config)) {
81
- * const provider = createAuthProvider(config);
82
- * await provider!.authenticate();
83
- * }
84
- */
5
+ /** Check if database type requires authentication. */
85
6
  export declare function requiresAuthentication(config: DatabaseConfig): boolean;
86
7
  //# sourceMappingURL=auth-factory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth-factory.d.ts","sourceRoot":"","sources":["../../../src/adapters/auth/auth-factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,cAAc,GAAG,gBAAgB,GAAG,IAAI,CAmBlF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAEtE"}
1
+ {"version":3,"file":"auth-factory.d.ts","sourceRoot":"","sources":["../../../src/adapters/auth/auth-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,yEAAyE;AACzE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,cAAc,GAAG,gBAAgB,GAAG,IAAI,CAkBlF;AAED,sDAAsD;AACtD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAEtE"}
@@ -1,73 +1,5 @@
1
- /**
2
- * @fileoverview Authentication Provider Factory
3
- *
4
- * Factory module for creating appropriate authentication providers based on database configuration.
5
- * Supports direct connections and future IAM-based authentication.
6
- *
7
- * **Note:** SSH tunneling is not supported. Users must set up SSH tunnels manually.
8
- *
9
- * @module adapters/auth/auth-factory
10
- */
11
1
  import { DirectAuthProvider } from './direct-auth-provider.js';
12
- /**
13
- * Create an authentication provider based on database configuration.
14
- *
15
- * Provider selection logic:
16
- * - SQLite: Returns null (no authentication needed for file-based database)
17
- * - MySQL/PostgreSQL: Returns DirectAuthProvider
18
- *
19
- * @param config - Database configuration
20
- * @returns Authentication provider instance or null for SQLite
21
- * @throws Error if database type is invalid
22
- *
23
- * @example
24
- * // Direct connection
25
- * const config: DatabaseConfig = {
26
- * type: 'mysql',
27
- * connection: {
28
- * host: 'localhost',
29
- * port: 3306,
30
- * database: 'mydb'
31
- * },
32
- * auth: {
33
- * type: 'direct',
34
- * user: 'dbuser',
35
- * password: 'dbpass'
36
- * }
37
- * };
38
- * const provider = createAuthProvider(config);
39
- * // Returns DirectAuthProvider instance
40
- *
41
- * @example
42
- * // Connection via manual SSH tunnel
43
- * // Step 1: Set up tunnel manually:
44
- * // ssh -L 3307:db.internal.company.com:3306 user@bastion.example.com
45
- * // Step 2: Configure to use localhost:
46
- * const config: DatabaseConfig = {
47
- * type: 'mysql',
48
- * connection: {
49
- * host: 'localhost', // Tunnel endpoint
50
- * port: 3307, // Forwarded port
51
- * database: 'mydb'
52
- * },
53
- * auth: {
54
- * type: 'direct',
55
- * user: 'dbuser',
56
- * password: 'dbpass'
57
- * }
58
- * };
59
- * const provider = createAuthProvider(config);
60
- * // Returns DirectAuthProvider for localhost connection
61
- *
62
- * @example
63
- * // SQLite (no authentication)
64
- * const sqliteConfig: DatabaseConfig = {
65
- * type: 'sqlite',
66
- * path: './data.db'
67
- * };
68
- * const provider = createAuthProvider(sqliteConfig);
69
- * // Returns null
70
- */
2
+ /** Create an authentication provider based on database configuration. */
71
3
  export function createAuthProvider(config) {
72
4
  // Validate database type
73
5
  if (!config.type) {
@@ -82,21 +14,9 @@ export function createAuthProvider(config) {
82
14
  return null;
83
15
  }
84
16
  // MySQL/PostgreSQL use direct authentication
85
- // (Users must set up SSH tunnels manually if needed)
86
17
  return new DirectAuthProvider(config);
87
18
  }
88
- /**
89
- * Check if database type requires authentication.
90
- *
91
- * @param config - Database configuration
92
- * @returns True if authentication is required (MySQL/PostgreSQL)
93
- *
94
- * @example
95
- * if (requiresAuthentication(config)) {
96
- * const provider = createAuthProvider(config);
97
- * await provider!.authenticate();
98
- * }
99
- */
19
+ /** Check if database type requires authentication. */
100
20
  export function requiresAuthentication(config) {
101
21
  return config.type !== 'sqlite';
102
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"auth-factory.js","sourceRoot":"","sources":["../../../src/adapters/auth/auth-factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAG/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAsB;IACvD,yBAAyB;IACzB,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;IAED,MAAM,UAAU,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IACnD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,0BAA0B,MAAM,CAAC,IAAI,qBAAqB,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACrG,CAAC;IAED,kDAAkD;IAClD,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,6CAA6C;IAC7C,qDAAqD;IACrD,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAsB;IAC3D,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC;AAClC,CAAC"}
1
+ {"version":3,"file":"auth-factory.js","sourceRoot":"","sources":["../../../src/adapters/auth/auth-factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAG/D,yEAAyE;AACzE,MAAM,UAAU,kBAAkB,CAAC,MAAsB;IACvD,yBAAyB;IACzB,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;IAED,MAAM,UAAU,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IACnD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,0BAA0B,MAAM,CAAC,IAAI,qBAAqB,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACrG,CAAC;IAED,kDAAkD;IAClD,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,6CAA6C;IAC7C,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;AACxC,CAAC;AAED,sDAAsD;AACtD,MAAM,UAAU,sBAAsB,CAAC,MAAsB;IAC3D,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC;AAClC,CAAC"}
@@ -1,327 +1,42 @@
1
- /**
2
- * @fileoverview Base authentication provider for sqlew's multi-RDBMS authentication system.
3
- *
4
- * This module provides the foundation for all authentication providers, enabling support for:
5
- * - SSH tunneling (v3.7.0)
6
- * - Direct connections (v3.7.0)
7
- * - AWS IAM authentication (v3.8.0+)
8
- * - GCP IAM authentication (v3.8.0+)
9
- *
10
- * @module adapters/auth/base-auth-provider
11
- * @since v3.7.0
12
- */
13
1
  import type { DatabaseConfig } from '../../config/types.js';
14
- /**
15
- * Connection parameters used to establish database connections.
16
- *
17
- * These parameters are returned by authentication providers after processing
18
- * credentials, setting up tunnels, or obtaining temporary tokens.
19
- *
20
- * @interface ConnectionParams
21
- * @example
22
- * // Direct connection
23
- * {
24
- * host: 'postgres.example.com',
25
- * port: 5432,
26
- * database: 'mydb',
27
- * user: 'admin',
28
- * password: 'secret123'
29
- * }
30
- *
31
- * @example
32
- * // SSH tunnel connection
33
- * {
34
- * host: '127.0.0.1',
35
- * port: 54321, // Local tunnel port
36
- * database: 'mydb',
37
- * user: 'admin',
38
- * password: 'secret123'
39
- * }
40
- *
41
- * @example
42
- * // AWS IAM authentication
43
- * {
44
- * host: 'db.region.rds.amazonaws.com',
45
- * port: 5432,
46
- * database: 'mydb',
47
- * user: 'iam_user',
48
- * password: 'temporary_token_generated_by_aws',
49
- * ssl: {
50
- * ca: '/path/to/rds-ca-bundle.pem',
51
- * rejectUnauthorized: true
52
- * }
53
- * }
54
- */
2
+ /** Connection parameters returned by authentication providers. */
55
3
  export interface ConnectionParams {
56
- /**
57
- * Database host address.
58
- * For direct connections: remote host address.
59
- * For SSH tunnels: '127.0.0.1' (localhost).
60
- * For cloud IAM: cloud provider's database endpoint.
61
- */
4
+ /** Database host address. */
62
5
  host: string;
63
- /**
64
- * Database port number.
65
- * For direct connections: remote database port.
66
- * For SSH tunnels: local tunnel port.
67
- * For cloud IAM: cloud provider's database port.
68
- */
6
+ /** Database port number. */
69
7
  port: number;
70
- /**
71
- * Target database name.
72
- */
8
+ /** Target database name. */
73
9
  database: string;
74
- /**
75
- * Database user/username.
76
- * For IAM authentication: IAM role or user identifier.
77
- */
10
+ /** Database user/username. */
78
11
  user: string;
79
- /**
80
- * Database password or authentication token.
81
- * Optional for IAM-based authentication where tokens are generated dynamically.
82
- * For AWS/GCP IAM: temporary authentication token.
83
- */
12
+ /** Database password or authentication token. */
84
13
  password?: string;
85
- /**
86
- * SSL/TLS configuration for encrypted connections.
87
- * Required for most cloud providers (AWS RDS, GCP Cloud SQL).
88
- */
14
+ /** SSL/TLS configuration for encrypted connections. */
89
15
  ssl?: {
90
- /**
91
- * Certificate Authority (CA) certificate.
92
- * Path to PEM file or certificate content.
93
- */
16
+ /** Certificate Authority (CA) certificate. */
94
17
  ca?: string;
95
- /**
96
- * Client certificate for mutual TLS.
97
- * Path to PEM file or certificate content.
98
- */
18
+ /** Client certificate for mutual TLS. */
99
19
  cert?: string;
100
- /**
101
- * Client private key for mutual TLS.
102
- * Path to PEM file or key content.
103
- */
20
+ /** Client private key for mutual TLS. */
104
21
  key?: string;
105
- /**
106
- * Whether to reject unauthorized certificates.
107
- * Set to false for self-signed certificates (not recommended for production).
108
- */
22
+ /** Whether to reject unauthorized certificates. */
109
23
  rejectUnauthorized?: boolean;
110
24
  };
111
- /**
112
- * Database-specific connection parameters.
113
- *
114
- * Examples:
115
- * - PostgreSQL: { statement_timeout: 30000, application_name: 'mcp-sqlew' }
116
- * - MySQL: { connectTimeout: 10000, multipleStatements: false }
117
- * - SQL Server: { requestTimeout: 30000, encrypt: true }
118
- */
25
+ /** Database-specific additional connection parameters. */
119
26
  additionalParams?: Record<string, any>;
120
27
  }
121
- /**
122
- * Abstract base class for all authentication providers.
123
- *
124
- * This class establishes the contract that all authentication providers must implement,
125
- * ensuring consistent behavior across different authentication methods.
126
- *
127
- * **Supported Authentication Methods:**
128
- * - `DirectAuthProvider`: Standard username/password authentication
129
- * - `SshAuthProvider`: SSH tunneling with key-based or password authentication
130
- * - `AwsIamAuthProvider`: AWS RDS IAM database authentication
131
- * - `GcpIamAuthProvider`: GCP Cloud SQL IAM authentication
132
- *
133
- * **Authentication Flow:**
134
- * 1. Provider instantiation with DatabaseConfig
135
- * 2. `validate()` - Verify configuration is valid
136
- * 3. `authenticate()` - Process credentials and return ConnectionParams
137
- * 4. Database connection using returned params
138
- * 5. `cleanup()` - Release resources when connection closes
139
- *
140
- * @abstract
141
- * @class BaseAuthProvider
142
- *
143
- * @example
144
- * // Implementing a custom authentication provider
145
- * class CustomAuthProvider extends BaseAuthProvider {
146
- * async authenticate(): Promise<ConnectionParams> {
147
- * // Implement custom authentication logic
148
- * return {
149
- * host: this.config.connection.host,
150
- * port: this.config.connection.port,
151
- * database: this.config.connection.database,
152
- * user: this.config.auth.user,
153
- * password: await this.getCustomPassword()
154
- * };
155
- * }
156
- *
157
- * getAuthMethod(): string {
158
- * return 'Custom Authentication';
159
- * }
160
- *
161
- * async cleanup(): Promise<void> {
162
- * // Clean up any resources
163
- * }
164
- *
165
- * validate(): void {
166
- * if (!this.config.auth.user) {
167
- * throw new Error('User is required for custom authentication');
168
- * }
169
- * }
170
- * }
171
- *
172
- * @example
173
- * // Using an authentication provider
174
- * const provider = new DirectAuthProvider(config);
175
- * provider.validate();
176
- * const connParams = await provider.authenticate();
177
- * const connection = await createConnection(connParams);
178
- * // ... use connection ...
179
- * await connection.close();
180
- * await provider.cleanup();
181
- */
28
+ /** Abstract base class for all authentication providers. */
182
29
  export declare abstract class BaseAuthProvider {
183
- /**
184
- * Database configuration containing connection and authentication settings.
185
- * Accessible to child classes for implementing authentication logic.
186
- *
187
- * @protected
188
- * @readonly
189
- */
30
+ /** @protected */
190
31
  protected readonly config: DatabaseConfig;
191
- /**
192
- * Creates a new authentication provider instance.
193
- *
194
- * @param {DatabaseConfig} config - Database configuration object
195
- *
196
- * @example
197
- * const provider = new SshAuthProvider({
198
- * type: 'postgres',
199
- * connection: {
200
- * host: 'db.internal',
201
- * port: 5432,
202
- * database: 'production'
203
- * },
204
- * auth: {
205
- * type: 'ssh',
206
- * ssh: {
207
- * host: 'bastion.example.com',
208
- * port: 22,
209
- * user: 'deploy',
210
- * privateKey: '/path/to/key.pem'
211
- * }
212
- * }
213
- * });
214
- */
215
32
  constructor(config: DatabaseConfig);
216
- /**
217
- * Authenticates and returns connection parameters for database connection.
218
- *
219
- * This method handles the authentication process specific to each provider:
220
- * - **Direct**: Returns credentials as-is
221
- * - **SSH**: Establishes tunnel, returns localhost connection params
222
- * - **AWS IAM**: Generates temporary token, returns params with SSL config
223
- * - **GCP IAM**: Obtains OAuth token, returns params with cloud SQL proxy
224
- *
225
- * @abstract
226
- * @returns {Promise<ConnectionParams>} Connection parameters for database client
227
- *
228
- * @throws {Error} When authentication fails or credentials are invalid
229
- *
230
- * @example
231
- * // Direct authentication
232
- * const params = await directProvider.authenticate();
233
- * // Returns: { host: 'db.example.com', port: 5432, user: 'admin', password: 'secret' }
234
- *
235
- * @example
236
- * // SSH tunnel authentication
237
- * const params = await sshProvider.authenticate();
238
- * // Returns: { host: '127.0.0.1', port: 54321, user: 'admin', password: 'secret' }
239
- * // Note: Tunnel is active until cleanup() is called
240
- *
241
- * @example
242
- * // AWS IAM authentication
243
- * const params = await awsProvider.authenticate();
244
- * // Returns: { host: 'db.region.rds.amazonaws.com', user: 'iam_user',
245
- * // password: 'temp_token_xyz', ssl: { ca: '...' } }
246
- */
33
+ /** Authenticates and returns connection parameters. @abstract */
247
34
  abstract authenticate(): Promise<ConnectionParams>;
248
- /**
249
- * Returns a human-readable name for this authentication method.
250
- *
251
- * Used for logging, error messages, and telemetry.
252
- *
253
- * @abstract
254
- * @returns {string} Authentication method name
255
- *
256
- * @example
257
- * directProvider.getAuthMethod(); // Returns: "Direct"
258
- * sshProvider.getAuthMethod(); // Returns: "SSH Tunnel"
259
- * awsProvider.getAuthMethod(); // Returns: "AWS IAM"
260
- * gcpProvider.getAuthMethod(); // Returns: "GCP IAM"
261
- */
35
+ /** Returns a human-readable name for this authentication method. @abstract */
262
36
  abstract getAuthMethod(): string;
263
- /**
264
- * Releases resources allocated during authentication.
265
- *
266
- * This method MUST be called when the database connection is closed to prevent
267
- * resource leaks. Different providers handle cleanup differently:
268
- *
269
- * - **Direct**: No-op (no resources to clean)
270
- * - **SSH**: Closes SSH tunnel and releases local port
271
- * - **AWS IAM**: Invalidates cached tokens (if applicable)
272
- * - **GCP IAM**: Closes Cloud SQL proxy connection
273
- *
274
- * @abstract
275
- * @returns {Promise<void>}
276
- *
277
- * @throws {Error} If cleanup fails (should be caught and logged, not propagated)
278
- *
279
- * @example
280
- * try {
281
- * await provider.cleanup();
282
- * } catch (error) {
283
- * console.error('Cleanup failed:', error);
284
- * // Connection is closed, log error but don't throw
285
- * }
286
- */
37
+ /** Releases resources allocated during authentication. @abstract */
287
38
  abstract cleanup(): Promise<void>;
288
- /**
289
- * Validates the authentication configuration.
290
- *
291
- * This method checks that all required configuration parameters are present
292
- * and valid BEFORE attempting authentication. It should be called immediately
293
- * after provider instantiation to fail fast on configuration errors.
294
- *
295
- * **Validation Examples:**
296
- * - **Direct**: Verify host, port, user, password are present
297
- * - **SSH**: Verify SSH host, SSH user, privateKey/password, target credentials
298
- * - **AWS IAM**: Verify region, IAM role/user, AWS credentials available
299
- * - **GCP IAM**: Verify project ID, service account, GCP credentials available
300
- *
301
- * @abstract
302
- * @returns {void}
303
- *
304
- * @throws {Error} If configuration is invalid or incomplete
305
- *
306
- * @example
307
- * try {
308
- * provider.validate();
309
- * } catch (error) {
310
- * console.error('Invalid configuration:', error.message);
311
- * // Fix configuration before proceeding
312
- * }
313
- *
314
- * @example
315
- * // Validation in SSH provider
316
- * validate(): void {
317
- * if (!this.config.auth.ssh?.host) {
318
- * throw new Error('SSH host is required for SSH authentication');
319
- * }
320
- * if (!this.config.auth.ssh.privateKey && !this.config.auth.ssh.password) {
321
- * throw new Error('SSH privateKey or password is required');
322
- * }
323
- * }
324
- */
39
+ /** Validates the authentication configuration. @abstract */
325
40
  abstract validate(): void;
326
41
  }
327
42
  //# sourceMappingURL=base-auth-provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"base-auth-provider.d.ts","sourceRoot":"","sources":["../../../src/adapters/auth/base-auth-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,GAAG,CAAC,EAAE;QACJ;;;WAGG;QACH,EAAE,CAAC,EAAE,MAAM,CAAC;QAEZ;;;WAGG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;QAEd;;;WAGG;QACH,GAAG,CAAC,EAAE,MAAM,CAAC;QAEb;;;WAGG;QACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;KAC9B,CAAC;IAEF;;;;;;;OAOG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACxC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,8BAAsB,gBAAgB;IACpC;;;;;;OAMG;IACH,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAE1C;;;;;;;;;;;;;;;;;;;;;;;OAuBG;gBACS,MAAM,EAAE,cAAc;IAIlC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,QAAQ,CAAC,YAAY,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAElD;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,aAAa,IAAI,MAAM;IAEhC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,QAAQ,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAEjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;IACH,QAAQ,CAAC,QAAQ,IAAI,IAAI;CAC1B"}
1
+ {"version":3,"file":"base-auth-provider.d.ts","sourceRoot":"","sources":["../../../src/adapters/auth/base-auth-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,kEAAkE;AAClE,MAAM,WAAW,gBAAgB;IAC/B,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC;IAEb,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC;IAEb,4BAA4B;IAC5B,QAAQ,EAAE,MAAM,CAAC;IAEjB,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IAEb,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,uDAAuD;IACvD,GAAG,CAAC,EAAE;QACJ,8CAA8C;QAC9C,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,yCAAyC;QACzC,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,yCAAyC;QACzC,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,mDAAmD;QACnD,kBAAkB,CAAC,EAAE,OAAO,CAAC;KAC9B,CAAC;IAEF,0DAA0D;IAC1D,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACxC;AAED,4DAA4D;AAC5D,8BAAsB,gBAAgB;IACpC,iBAAiB;IACjB,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;gBAE9B,MAAM,EAAE,cAAc;IAIlC,iEAAiE;IACjE,QAAQ,CAAC,YAAY,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAElD,8EAA8E;IAC9E,QAAQ,CAAC,aAAa,IAAI,MAAM;IAEhC,oEAAoE;IACpE,QAAQ,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAEjC,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,IAAI,IAAI;CAC1B"}