@c9up/atlas 0.2.0 → 0.2.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 (234) hide show
  1. package/README.md +8 -0
  2. package/db.darwin-arm64.node +0 -0
  3. package/db.darwin-x64.node +0 -0
  4. package/db.linux-arm64-gnu.node +0 -0
  5. package/db.linux-x64-gnu.node +0 -0
  6. package/db.win32-x64-msvc.node +0 -0
  7. package/dist/AtlasProvider.d.ts +60 -7
  8. package/dist/AtlasProvider.d.ts.map +1 -1
  9. package/dist/AtlasProvider.js +204 -38
  10. package/dist/AtlasProvider.js.map +1 -1
  11. package/dist/BaseEntity.d.ts +17 -0
  12. package/dist/BaseEntity.d.ts.map +1 -1
  13. package/dist/BaseEntity.js.map +1 -1
  14. package/dist/BaseModel.d.ts +63 -27
  15. package/dist/BaseModel.d.ts.map +1 -1
  16. package/dist/BaseModel.js +108 -51
  17. package/dist/BaseModel.js.map +1 -1
  18. package/dist/BaseRepository.d.ts +11 -1
  19. package/dist/BaseRepository.d.ts.map +1 -1
  20. package/dist/BaseRepository.js +95 -20
  21. package/dist/BaseRepository.js.map +1 -1
  22. package/dist/ConnectionManager.d.ts +106 -0
  23. package/dist/ConnectionManager.d.ts.map +1 -0
  24. package/dist/ConnectionManager.js +228 -0
  25. package/dist/ConnectionManager.js.map +1 -0
  26. package/dist/ModelQuery.d.ts +256 -43
  27. package/dist/ModelQuery.d.ts.map +1 -1
  28. package/dist/ModelQuery.js +899 -231
  29. package/dist/ModelQuery.js.map +1 -1
  30. package/dist/Transaction.d.ts +54 -1
  31. package/dist/Transaction.d.ts.map +1 -1
  32. package/dist/Transaction.js +121 -59
  33. package/dist/Transaction.js.map +1 -1
  34. package/dist/adapters/NapiDbAdapter.d.ts +11 -0
  35. package/dist/adapters/NapiDbAdapter.d.ts.map +1 -1
  36. package/dist/adapters/NapiDbAdapter.js +35 -7
  37. package/dist/adapters/NapiDbAdapter.js.map +1 -1
  38. package/dist/console/contract.d.ts +62 -0
  39. package/dist/console/contract.d.ts.map +1 -0
  40. package/dist/console/contract.js +38 -0
  41. package/dist/console/contract.js.map +1 -0
  42. package/dist/console/factoryCommands.d.ts +23 -0
  43. package/dist/console/factoryCommands.d.ts.map +1 -0
  44. package/dist/console/factoryCommands.js +62 -0
  45. package/dist/console/factoryCommands.js.map +1 -0
  46. package/dist/console/migrationCommands.d.ts +38 -8
  47. package/dist/console/migrationCommands.d.ts.map +1 -1
  48. package/dist/console/migrationCommands.js +157 -50
  49. package/dist/console/migrationCommands.js.map +1 -1
  50. package/dist/console/schemaCheckCommand.d.ts +11 -17
  51. package/dist/console/schemaCheckCommand.d.ts.map +1 -1
  52. package/dist/console/schemaCheckCommand.js +21 -15
  53. package/dist/console/schemaCheckCommand.js.map +1 -1
  54. package/dist/console/schemaDumpCommand.d.ts +30 -0
  55. package/dist/console/schemaDumpCommand.d.ts.map +1 -0
  56. package/dist/console/schemaDumpCommand.js +69 -0
  57. package/dist/console/schemaDumpCommand.js.map +1 -0
  58. package/dist/console/schemaGenerateCommand.d.ts +100 -0
  59. package/dist/console/schemaGenerateCommand.d.ts.map +1 -0
  60. package/dist/console/schemaGenerateCommand.js +246 -0
  61. package/dist/console/schemaGenerateCommand.js.map +1 -0
  62. package/dist/console/seederCommands.d.ts +46 -0
  63. package/dist/console/seederCommands.d.ts.map +1 -0
  64. package/dist/console/seederCommands.js +136 -0
  65. package/dist/console/seederCommands.js.map +1 -0
  66. package/dist/decorators/entity.d.ts +13 -2
  67. package/dist/decorators/entity.d.ts.map +1 -1
  68. package/dist/decorators/entity.js +10 -0
  69. package/dist/decorators/entity.js.map +1 -1
  70. package/dist/decorators/hooks.d.ts +3 -3
  71. package/dist/decorators/hooks.d.ts.map +1 -1
  72. package/dist/decorators/hooks.js.map +1 -1
  73. package/dist/events.d.ts +5 -0
  74. package/dist/events.d.ts.map +1 -1
  75. package/dist/events.js.map +1 -1
  76. package/dist/factories.d.ts +8 -0
  77. package/dist/factories.d.ts.map +1 -0
  78. package/dist/factories.js +8 -0
  79. package/dist/factories.js.map +1 -0
  80. package/dist/index.d.ts +11 -5
  81. package/dist/index.d.ts.map +1 -1
  82. package/dist/index.js +12 -4
  83. package/dist/index.js.map +1 -1
  84. package/dist/lucid-schema.d.ts +15 -0
  85. package/dist/lucid-schema.d.ts.map +1 -0
  86. package/dist/lucid-schema.js +16 -0
  87. package/dist/lucid-schema.js.map +1 -0
  88. package/dist/orm.d.ts +14 -0
  89. package/dist/orm.d.ts.map +1 -0
  90. package/dist/orm.js +14 -0
  91. package/dist/orm.js.map +1 -0
  92. package/dist/query/DatabaseQueryBuilder.d.ts +557 -0
  93. package/dist/query/DatabaseQueryBuilder.d.ts.map +1 -0
  94. package/dist/query/DatabaseQueryBuilder.js +1798 -0
  95. package/dist/query/DatabaseQueryBuilder.js.map +1 -0
  96. package/dist/query/DmlBuilder.d.ts +62 -0
  97. package/dist/query/DmlBuilder.d.ts.map +1 -0
  98. package/dist/query/DmlBuilder.js +84 -0
  99. package/dist/query/DmlBuilder.js.map +1 -0
  100. package/dist/query/QueryBuilder.d.ts +5 -0
  101. package/dist/query/QueryBuilder.d.ts.map +1 -1
  102. package/dist/query/QueryBuilder.js +7 -0
  103. package/dist/query/QueryBuilder.js.map +1 -1
  104. package/dist/query/RawQueryBuilder.d.ts +47 -0
  105. package/dist/query/RawQueryBuilder.d.ts.map +1 -0
  106. package/dist/query/RawQueryBuilder.js +138 -0
  107. package/dist/query/RawQueryBuilder.js.map +1 -0
  108. package/dist/query/interpolate.d.ts +45 -0
  109. package/dist/query/interpolate.d.ts.map +1 -0
  110. package/dist/query/interpolate.js +51 -0
  111. package/dist/query/interpolate.js.map +1 -0
  112. package/dist/query/native.d.ts +8 -0
  113. package/dist/query/native.d.ts.map +1 -1
  114. package/dist/query/native.js +14 -0
  115. package/dist/query/native.js.map +1 -1
  116. package/dist/query/operators.d.ts +4 -0
  117. package/dist/query/operators.d.ts.map +1 -0
  118. package/dist/query/operators.js +27 -0
  119. package/dist/query/operators.js.map +1 -0
  120. package/dist/schema/Migration.d.ts +31 -7
  121. package/dist/schema/Migration.d.ts.map +1 -1
  122. package/dist/schema/Migration.js +34 -7
  123. package/dist/schema/Migration.js.map +1 -1
  124. package/dist/schema/MigrationRunner.d.ts +56 -6
  125. package/dist/schema/MigrationRunner.d.ts.map +1 -1
  126. package/dist/schema/MigrationRunner.js +382 -112
  127. package/dist/schema/MigrationRunner.js.map +1 -1
  128. package/dist/schema/Schema.d.ts +59 -2
  129. package/dist/schema/Schema.d.ts.map +1 -1
  130. package/dist/schema/Schema.js +143 -9
  131. package/dist/schema/Schema.js.map +1 -1
  132. package/dist/schema/SchemaDumper.d.ts +121 -0
  133. package/dist/schema/SchemaDumper.d.ts.map +1 -0
  134. package/dist/schema/SchemaDumper.js +365 -0
  135. package/dist/schema/SchemaDumper.js.map +1 -0
  136. package/dist/schema/Seeder.d.ts +13 -0
  137. package/dist/schema/Seeder.d.ts.map +1 -1
  138. package/dist/schema/Seeder.js +28 -5
  139. package/dist/schema/Seeder.js.map +1 -1
  140. package/dist/schema/TableBuilder.d.ts +27 -8
  141. package/dist/schema/TableBuilder.d.ts.map +1 -1
  142. package/dist/schema/TableBuilder.js +50 -12
  143. package/dist/schema/TableBuilder.js.map +1 -1
  144. package/dist/schema/catalog.d.ts +25 -1
  145. package/dist/schema/catalog.d.ts.map +1 -1
  146. package/dist/schema/catalog.js +69 -22
  147. package/dist/schema/catalog.js.map +1 -1
  148. package/dist/schema/introspect.d.ts +1 -1
  149. package/dist/schema/introspect.d.ts.map +1 -1
  150. package/dist/schema/introspect.js +26 -11
  151. package/dist/schema/introspect.js.map +1 -1
  152. package/dist/seeders.d.ts +7 -0
  153. package/dist/seeders.d.ts.map +1 -0
  154. package/dist/seeders.js +7 -0
  155. package/dist/seeders.js.map +1 -0
  156. package/dist/services/db.d.ts +120 -9
  157. package/dist/services/db.d.ts.map +1 -1
  158. package/dist/services/db.js +182 -26
  159. package/dist/services/db.js.map +1 -1
  160. package/dist/testing/DatabaseCleanup.d.ts +29 -6
  161. package/dist/testing/DatabaseCleanup.d.ts.map +1 -1
  162. package/dist/testing/DatabaseCleanup.js +44 -17
  163. package/dist/testing/DatabaseCleanup.js.map +1 -1
  164. package/dist/testing/DbAssertions.d.ts +54 -0
  165. package/dist/testing/DbAssertions.d.ts.map +1 -0
  166. package/dist/testing/DbAssertions.js +156 -0
  167. package/dist/testing/DbAssertions.js.map +1 -0
  168. package/dist/testing/Factory.d.ts +111 -25
  169. package/dist/testing/Factory.d.ts.map +1 -1
  170. package/dist/testing/Factory.js +331 -56
  171. package/dist/testing/Factory.js.map +1 -1
  172. package/dist/testing/TestUtils.d.ts +49 -0
  173. package/dist/testing/TestUtils.d.ts.map +1 -0
  174. package/dist/testing/TestUtils.js +79 -0
  175. package/dist/testing/TestUtils.js.map +1 -0
  176. package/dist/testing/index.d.ts +3 -1
  177. package/dist/testing/index.d.ts.map +1 -1
  178. package/dist/testing/index.js +3 -1
  179. package/dist/testing/index.js.map +1 -1
  180. package/dist/types/relations.d.ts +31 -0
  181. package/dist/types/relations.d.ts.map +1 -0
  182. package/dist/types/relations.js +20 -0
  183. package/dist/types/relations.js.map +1 -0
  184. package/index.darwin-arm64.node +0 -0
  185. package/index.darwin-x64.node +0 -0
  186. package/index.linux-arm64-gnu.node +0 -0
  187. package/index.linux-x64-gnu.node +0 -0
  188. package/index.win32-x64-msvc.node +0 -0
  189. package/package.json +30 -2
  190. package/src/AtlasProvider.ts +297 -51
  191. package/src/BaseEntity.ts +29 -0
  192. package/src/BaseModel.ts +174 -37
  193. package/src/BaseRepository.ts +136 -17
  194. package/src/ConnectionManager.ts +298 -0
  195. package/src/ModelQuery.ts +1309 -260
  196. package/src/Transaction.ts +194 -60
  197. package/src/adapters/NapiDbAdapter.ts +72 -14
  198. package/src/console/contract.ts +96 -0
  199. package/src/console/factoryCommands.ts +73 -0
  200. package/src/console/migrationCommands.ts +253 -63
  201. package/src/console/schemaCheckCommand.ts +26 -22
  202. package/src/console/schemaDumpCommand.ts +96 -0
  203. package/src/console/schemaGenerateCommand.ts +380 -0
  204. package/src/console/seederCommands.ts +174 -0
  205. package/src/decorators/entity.ts +18 -2
  206. package/src/decorators/hooks.ts +5 -3
  207. package/src/events.ts +5 -0
  208. package/src/factories.ts +10 -0
  209. package/src/index.ts +50 -3
  210. package/src/lucid-schema.ts +22 -0
  211. package/src/orm.ts +13 -0
  212. package/src/query/DatabaseQueryBuilder.ts +2724 -0
  213. package/src/query/DmlBuilder.ts +131 -0
  214. package/src/query/QueryBuilder.ts +8 -0
  215. package/src/query/RawQueryBuilder.ts +173 -0
  216. package/src/query/interpolate.ts +73 -0
  217. package/src/query/native.ts +29 -0
  218. package/src/query/operators.ts +27 -0
  219. package/src/schema/Migration.ts +36 -7
  220. package/src/schema/MigrationRunner.ts +483 -119
  221. package/src/schema/Schema.ts +168 -19
  222. package/src/schema/SchemaDumper.ts +518 -0
  223. package/src/schema/Seeder.ts +47 -10
  224. package/src/schema/TableBuilder.ts +48 -11
  225. package/src/schema/catalog.ts +94 -24
  226. package/src/schema/introspect.ts +26 -9
  227. package/src/seeders.ts +16 -0
  228. package/src/services/db.ts +343 -31
  229. package/src/testing/DatabaseCleanup.ts +73 -21
  230. package/src/testing/DbAssertions.ts +220 -0
  231. package/src/testing/Factory.ts +559 -79
  232. package/src/testing/TestUtils.ts +123 -0
  233. package/src/testing/index.ts +12 -1
  234. package/src/types/relations.ts +43 -0
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Connection manager — the AdonisJS Lucid `db.manager` surface. Owns a map of
3
+ * named {@link ConnectionNode}s (config + live connection + lifecycle state) and
4
+ * emits `connect`/`disconnect` events. `AtlasProvider` registers the connections
5
+ * it opens at boot; user code can also `add` + `connect` (or `patch`/`release`)
6
+ * connections at runtime.
7
+ */
8
+ import type { ConnectionConfig } from "./AtlasProvider.js";
9
+ import { type AsyncDatabaseConnection } from "./adapters/NapiDbAdapter.js";
10
+ /** Lifecycle state of a {@link ConnectionNode} (Lucid parity). */
11
+ export type ConnectionState = "registered" | "open" | "migrating" | "closing" | "closed";
12
+ /** A managed connection: its config, the live handle (once open), and its state. */
13
+ export interface ConnectionNode {
14
+ readonly name: string;
15
+ config: ConnectionConfig;
16
+ connection?: AsyncDatabaseConnection;
17
+ state: ConnectionState;
18
+ }
19
+ /** Opens a live connection from a config (Lucid's dialect client — here, napi). */
20
+ export type ConnectionFactory = (name: string, config: ConnectionConfig) => Promise<AsyncDatabaseConnection>;
21
+ /** Default factory — opens via the Rust/NAPI driver from a {@link ConnectionConfig}. */
22
+ export declare function openFromConfig(name: string, config: ConnectionConfig): Promise<AsyncDatabaseConnection>;
23
+ /** The Lucid `db.manager` connection manager. */
24
+ export declare class ConnectionManager {
25
+ #private;
26
+ constructor(factory?: ConnectionFactory);
27
+ /** The node map, keyed by connection name (Lucid `manager.connections`). */
28
+ get connections(): ReadonlyMap<string, ConnectionNode>;
29
+ /**
30
+ * Register a connection config WITHOUT opening it (Lucid `manager.add`).
31
+ * No-op if the name is ALREADY registered (any state) — use {@link patch} to
32
+ * replace an existing connection's config (Lucid semantics).
33
+ */
34
+ add(name: string, config: ConnectionConfig): this;
35
+ /**
36
+ * Replace a connection's config (Lucid `manager.patch`). If it is currently
37
+ * open, the live pool is disconnected in the BACKGROUND (in-flight queries
38
+ * drain) and the node returns to `registered`, so the next `connect` opens a
39
+ * fresh pool with the new config.
40
+ */
41
+ patch(name: string, config: ConnectionConfig): this;
42
+ /**
43
+ * Open a connection (Lucid `manager.connect`). Idempotent — returns the live
44
+ * handle if already open. The connection must have been {@link add}ed first,
45
+ * or pass its config here.
46
+ */
47
+ connect(name: string, config?: ConnectionConfig): Promise<AsyncDatabaseConnection>;
48
+ /**
49
+ * @internal Register an ALREADY-OPEN connection (used by `AtlasProvider`, which
50
+ * opens connections itself with its retry/rollback logic). Node state = open.
51
+ */
52
+ register(name: string, config: ConnectionConfig, connection: AsyncDatabaseConnection): void;
53
+ /**
54
+ * @internal Emit a connect `error` for a node (AtlasProvider opens the boot
55
+ * pools itself with its parallel/rollback logic, so its failures are surfaced
56
+ * through the manager here → `db:connection:error`). Guarded like {@link connect}.
57
+ */
58
+ reportConnectError(name: string, error: unknown): void;
59
+ /** Whether a connection is registered (Lucid `manager.has`). */
60
+ has(name: string): boolean;
61
+ /** The connection node, or `undefined` (Lucid `manager.get`). */
62
+ get(name: string): ConnectionNode | undefined;
63
+ /** Whether the pool is active — `open` or `migrating` (Lucid `manager.isConnected`). */
64
+ isConnected(name: string): boolean;
65
+ /** The live connection handle for `name`, or `undefined` if the pool isn't active. */
66
+ connection(name: string): AsyncDatabaseConnection | undefined;
67
+ /**
68
+ * Close the connection's pool (Lucid `manager.close`). Keeps the node (state →
69
+ * `closed`) so it can be reopened; pass `release: true` to also remove the node
70
+ * entirely (equivalent to {@link release}).
71
+ */
72
+ close(name: string, release?: boolean): Promise<void>;
73
+ /**
74
+ * Close every connection's pool (Lucid `manager.closeAll`). Pass `release: true`
75
+ * to also remove every node from the manager.
76
+ */
77
+ closeAll(release?: boolean): Promise<void>;
78
+ /** Close and REMOVE a connection node entirely (Lucid `manager.release`). */
79
+ release(name: string): Promise<void>;
80
+ /**
81
+ * @internal Remove a node WITHOUT closing it — the caller already closed the
82
+ * connection (e.g. `AtlasProvider.shutdown`). Ownership-guarded: only removes
83
+ * when the node still points at `connection`, so a re-registered node from a
84
+ * newer provider isn't dropped by an older one's teardown.
85
+ */
86
+ deregister(name: string, connection?: AsyncDatabaseConnection): void;
87
+ /**
88
+ * Move an open connection into the `migrating` state (Lucid parity) — the pool
89
+ * stays active (`isConnected`/`connection` still resolve). Call {@link endMigrating}
90
+ * (or it's restored by the migration runner) when done.
91
+ */
92
+ markMigrating(name: string): void;
93
+ /** Restore a `migrating` connection to `open`. */
94
+ endMigrating(name: string): void;
95
+ /**
96
+ * Subscribe to lifecycle events (Node EventEmitter). `connect`/`disconnect`
97
+ * call the listener with the {@link ConnectionNode}; `error` calls it with
98
+ * `(node, error)`.
99
+ */
100
+ on(event: "connect" | "disconnect" | "error", listener: (node: ConnectionNode, error?: unknown) => void): this;
101
+ /** One-shot {@link on}. */
102
+ once(event: "connect" | "disconnect" | "error", listener: (node: ConnectionNode, error?: unknown) => void): this;
103
+ /** Remove a lifecycle listener. */
104
+ off(event: "connect" | "disconnect" | "error", listener: (node: ConnectionNode, error?: unknown) => void): this;
105
+ }
106
+ //# sourceMappingURL=ConnectionManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConnectionManager.d.ts","sourceRoot":"","sources":["../src/ConnectionManager.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EACN,KAAK,uBAAuB,EAE5B,MAAM,6BAA6B,CAAC;AAErC,kEAAkE;AAClE,MAAM,MAAM,eAAe,GACxB,YAAY,GACZ,MAAM,GACN,WAAW,GACX,SAAS,GACT,QAAQ,CAAC;AAEZ,oFAAoF;AACpF,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,gBAAgB,CAAC;IACzB,UAAU,CAAC,EAAE,uBAAuB,CAAC;IACrC,KAAK,EAAE,eAAe,CAAC;CACvB;AAED,mFAAmF;AACnF,MAAM,MAAM,iBAAiB,GAAG,CAC/B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,gBAAgB,KACpB,OAAO,CAAC,uBAAuB,CAAC,CAAC;AAEtC,wFAAwF;AACxF,wBAAsB,cAAc,CACnC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,gBAAgB,GACtB,OAAO,CAAC,uBAAuB,CAAC,CAmBlC;AAED,iDAAiD;AACjD,qBAAa,iBAAiB;;gBAKjB,OAAO,GAAE,iBAAkC;IAIvD,4EAA4E;IAC5E,IAAI,WAAW,IAAI,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,CAErD;IAED;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AC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKhC;;;;OAIG;IACH,EAAE,CACD,KAAK,EAAE,SAAS,GAAG,YAAY,GAAG,OAAO,EACzC,QAAQ,EAAE,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,OAAO,KAAK,IAAI,GACvD,IAAI;IAIP,2BAA2B;IAC3B,IAAI,CACH,KAAK,EAAE,SAAS,GAAG,YAAY,GAAG,OAAO,EACzC,QAAQ,EAAE,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,OAAO,KAAK,IAAI,GACvD,IAAI;IAIP,mCAAmC;IACnC,GAAG,CACF,KAAK,EAAE,SAAS,GAAG,YAAY,GAAG,OAAO,EACzC,QAAQ,EAAE,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,OAAO,KAAK,IAAI,GACvD,IAAI;CAIP"}
@@ -0,0 +1,228 @@
1
+ /**
2
+ * Connection manager — the AdonisJS Lucid `db.manager` surface. Owns a map of
3
+ * named {@link ConnectionNode}s (config + live connection + lifecycle state) and
4
+ * emits `connect`/`disconnect` events. `AtlasProvider` registers the connections
5
+ * it opens at boot; user code can also `add` + `connect` (or `patch`/`release`)
6
+ * connections at runtime.
7
+ */
8
+ import { EventEmitter } from "node:events";
9
+ import { createNapiConnection, } from "./adapters/NapiDbAdapter.js";
10
+ /** Default factory — opens via the Rust/NAPI driver from a {@link ConnectionConfig}. */
11
+ export async function openFromConfig(name, config) {
12
+ const url = config.url ?? config.connection;
13
+ if (!url) {
14
+ throw new Error(`[atlas] connection '${name}' has no URL — set 'url' (or Lucid's 'connection').`);
15
+ }
16
+ return createNapiConnection(url, config.pool?.min ?? config.poolMin ?? 1, config.pool?.max ?? config.poolMax ?? 10, config.pragmas, {
17
+ retries: config.connectRetries,
18
+ backoffMs: config.connectBackoffMs,
19
+ timeoutMs: config.connectTimeoutMs,
20
+ }, { debug: config.debug ?? false, connectionName: name });
21
+ }
22
+ /** The Lucid `db.manager` connection manager. */
23
+ export class ConnectionManager {
24
+ #nodes = new Map();
25
+ #events = new EventEmitter();
26
+ #factory;
27
+ constructor(factory = openFromConfig) {
28
+ this.#factory = factory;
29
+ }
30
+ /** The node map, keyed by connection name (Lucid `manager.connections`). */
31
+ get connections() {
32
+ return this.#nodes;
33
+ }
34
+ /**
35
+ * Register a connection config WITHOUT opening it (Lucid `manager.add`).
36
+ * No-op if the name is ALREADY registered (any state) — use {@link patch} to
37
+ * replace an existing connection's config (Lucid semantics).
38
+ */
39
+ add(name, config) {
40
+ if (this.#nodes.has(name))
41
+ return this;
42
+ this.#nodes.set(name, { name, config, state: "registered" });
43
+ return this;
44
+ }
45
+ /**
46
+ * Replace a connection's config (Lucid `manager.patch`). If it is currently
47
+ * open, the live pool is disconnected in the BACKGROUND (in-flight queries
48
+ * drain) and the node returns to `registered`, so the next `connect` opens a
49
+ * fresh pool with the new config.
50
+ */
51
+ patch(name, config) {
52
+ const node = this.#nodes.get(name);
53
+ if (!node) {
54
+ this.#nodes.set(name, { name, config, state: "registered" });
55
+ return this;
56
+ }
57
+ const stale = node.connection;
58
+ node.config = config;
59
+ node.connection = undefined;
60
+ node.state = "registered";
61
+ if (stale) {
62
+ // Background disconnect — don't block patch; swallow late errors.
63
+ void stale.close().catch(() => { });
64
+ this.#events.emit("disconnect", node);
65
+ }
66
+ return this;
67
+ }
68
+ /**
69
+ * Open a connection (Lucid `manager.connect`). Idempotent — returns the live
70
+ * handle if already open. The connection must have been {@link add}ed first,
71
+ * or pass its config here.
72
+ */
73
+ async connect(name, config) {
74
+ let node = this.#nodes.get(name);
75
+ if (!node) {
76
+ if (!config) {
77
+ throw new Error(`[atlas] no connection '${name}' registered — call manager.add(name, config) first.`);
78
+ }
79
+ node = { name, config, state: "registered" };
80
+ this.#nodes.set(name, node);
81
+ }
82
+ if (node.state === "open" && node.connection)
83
+ return node.connection;
84
+ let connection;
85
+ try {
86
+ connection = await this.#factory(name, config ?? node.config);
87
+ }
88
+ catch (err) {
89
+ // Local `error` event as `(node, error)` — the AtlasProvider bridge
90
+ // re-emits it on the app emitter as Lucid's `db:connection:error`
91
+ // (`[error, node]`). Guard the emit: Node's EventEmitter throws on an
92
+ // `error` event with no listeners, which would mask the real error.
93
+ if (this.#events.listenerCount("error") > 0) {
94
+ this.#events.emit("error", node, err);
95
+ }
96
+ throw err;
97
+ }
98
+ node.connection = connection;
99
+ node.state = "open";
100
+ this.#events.emit("connect", node);
101
+ return connection;
102
+ }
103
+ /**
104
+ * @internal Register an ALREADY-OPEN connection (used by `AtlasProvider`, which
105
+ * opens connections itself with its retry/rollback logic). Node state = open.
106
+ */
107
+ register(name, config, connection) {
108
+ this.#nodes.set(name, { name, config, connection, state: "open" });
109
+ this.#events.emit("connect", this.#nodes.get(name));
110
+ }
111
+ /**
112
+ * @internal Emit a connect `error` for a node (AtlasProvider opens the boot
113
+ * pools itself with its parallel/rollback logic, so its failures are surfaced
114
+ * through the manager here → `db:connection:error`). Guarded like {@link connect}.
115
+ */
116
+ reportConnectError(name, error) {
117
+ const node = this.#nodes.get(name) ?? {
118
+ name,
119
+ config: {},
120
+ state: "closed",
121
+ };
122
+ if (this.#events.listenerCount("error") > 0) {
123
+ this.#events.emit("error", node, error);
124
+ }
125
+ }
126
+ /** Whether a connection is registered (Lucid `manager.has`). */
127
+ has(name) {
128
+ return this.#nodes.has(name);
129
+ }
130
+ /** The connection node, or `undefined` (Lucid `manager.get`). */
131
+ get(name) {
132
+ return this.#nodes.get(name);
133
+ }
134
+ /** Whether the pool is active — `open` or `migrating` (Lucid `manager.isConnected`). */
135
+ isConnected(name) {
136
+ const state = this.#nodes.get(name)?.state;
137
+ return state === "open" || state === "migrating";
138
+ }
139
+ /** The live connection handle for `name`, or `undefined` if the pool isn't active. */
140
+ connection(name) {
141
+ const node = this.#nodes.get(name);
142
+ return node && (node.state === "open" || node.state === "migrating")
143
+ ? node.connection
144
+ : undefined;
145
+ }
146
+ /**
147
+ * Close the connection's pool (Lucid `manager.close`). Keeps the node (state →
148
+ * `closed`) so it can be reopened; pass `release: true` to also remove the node
149
+ * entirely (equivalent to {@link release}).
150
+ */
151
+ async close(name, release = false) {
152
+ const node = this.#nodes.get(name);
153
+ if (node?.connection &&
154
+ (node.state === "open" || node.state === "migrating")) {
155
+ const conn = node.connection;
156
+ node.state = "closing";
157
+ node.connection = undefined;
158
+ await conn.close();
159
+ node.state = "closed";
160
+ this.#events.emit("disconnect", node);
161
+ }
162
+ if (release)
163
+ this.#nodes.delete(name);
164
+ }
165
+ /**
166
+ * Close every connection's pool (Lucid `manager.closeAll`). Pass `release: true`
167
+ * to also remove every node from the manager.
168
+ */
169
+ async closeAll(release = false) {
170
+ for (const name of [...this.#nodes.keys()]) {
171
+ await this.close(name, release);
172
+ }
173
+ }
174
+ /** Close and REMOVE a connection node entirely (Lucid `manager.release`). */
175
+ async release(name) {
176
+ await this.close(name, true);
177
+ }
178
+ /**
179
+ * @internal Remove a node WITHOUT closing it — the caller already closed the
180
+ * connection (e.g. `AtlasProvider.shutdown`). Ownership-guarded: only removes
181
+ * when the node still points at `connection`, so a re-registered node from a
182
+ * newer provider isn't dropped by an older one's teardown.
183
+ */
184
+ deregister(name, connection) {
185
+ const node = this.#nodes.get(name);
186
+ if (!node)
187
+ return;
188
+ if (connection && node.connection !== connection)
189
+ return;
190
+ this.#nodes.delete(name);
191
+ }
192
+ /**
193
+ * Move an open connection into the `migrating` state (Lucid parity) — the pool
194
+ * stays active (`isConnected`/`connection` still resolve). Call {@link endMigrating}
195
+ * (or it's restored by the migration runner) when done.
196
+ */
197
+ markMigrating(name) {
198
+ const node = this.#nodes.get(name);
199
+ if (node?.state === "open")
200
+ node.state = "migrating";
201
+ }
202
+ /** Restore a `migrating` connection to `open`. */
203
+ endMigrating(name) {
204
+ const node = this.#nodes.get(name);
205
+ if (node?.state === "migrating")
206
+ node.state = "open";
207
+ }
208
+ /**
209
+ * Subscribe to lifecycle events (Node EventEmitter). `connect`/`disconnect`
210
+ * call the listener with the {@link ConnectionNode}; `error` calls it with
211
+ * `(node, error)`.
212
+ */
213
+ on(event, listener) {
214
+ this.#events.on(event, listener);
215
+ return this;
216
+ }
217
+ /** One-shot {@link on}. */
218
+ once(event, listener) {
219
+ this.#events.once(event, listener);
220
+ return this;
221
+ }
222
+ /** Remove a lifecycle listener. */
223
+ off(event, listener) {
224
+ this.#events.off(event, listener);
225
+ return this;
226
+ }
227
+ }
228
+ //# sourceMappingURL=ConnectionManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConnectionManager.js","sourceRoot":"","sources":["../src/ConnectionManager.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAEN,oBAAoB,GACpB,MAAM,6BAA6B,CAAC;AAwBrC,wFAAwF;AACxF,MAAM,CAAC,KAAK,UAAU,cAAc,CACnC,IAAY,EACZ,MAAwB;IAExB,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,UAAU,CAAC;IAC5C,IAAI,CAAC,GAAG,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CACd,uBAAuB,IAAI,qDAAqD,CAChF,CAAC;IACH,CAAC;IACD,OAAO,oBAAoB,CAC1B,GAAG,EACH,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,MAAM,CAAC,OAAO,IAAI,CAAC,EACvC,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,MAAM,CAAC,OAAO,IAAI,EAAE,EACxC,MAAM,CAAC,OAAO,EACd;QACC,OAAO,EAAE,MAAM,CAAC,cAAc;QAC9B,SAAS,EAAE,MAAM,CAAC,gBAAgB;QAClC,SAAS,EAAE,MAAM,CAAC,gBAAgB;KAClC,EACD,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,CACtD,CAAC;AACH,CAAC;AAED,iDAAiD;AACjD,MAAM,OAAO,iBAAiB;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