@effect/sql-mysql2 4.0.0-beta.70 → 4.0.0-beta.72
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.
- package/dist/MysqlClient.d.ts +35 -17
- package/dist/MysqlClient.d.ts.map +1 -1
- package/dist/MysqlClient.js +33 -15
- package/dist/MysqlClient.js.map +1 -1
- package/dist/MysqlMigrator.d.ts +27 -15
- package/dist/MysqlMigrator.d.ts.map +1 -1
- package/dist/MysqlMigrator.js.map +1 -1
- package/dist/index.d.ts +0 -35
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -35
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/MysqlClient.ts +33 -15
- package/src/MysqlMigrator.ts +26 -14
- package/src/index.ts +0 -35
package/dist/MysqlClient.d.ts
CHANGED
|
@@ -1,20 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* MySQL
|
|
3
|
-
*
|
|
4
|
-
* This module
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* classification for
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
2
|
+
* MySQL adapter for Effect SQL, backed by the `mysql2` driver.
|
|
3
|
+
*
|
|
4
|
+
* This module provides constructors and layers for a {@link MysqlClient} and
|
|
5
|
+
* the generic Effect SQL client service. Use it in server applications,
|
|
6
|
+
* background workers, migrations, and tests that need MySQL query compilation,
|
|
7
|
+
* scoped pool management, streaming queries, and consistent `SqlError`
|
|
8
|
+
* classification for mysql2 driver failures.
|
|
9
|
+
*
|
|
10
|
+
* **Mental model**
|
|
11
|
+
*
|
|
12
|
+
* {@link make} allocates a mysql2 pool inside the current scope, verifies it
|
|
13
|
+
* with `SELECT 1`, and closes it when the scope is released. Regular queries
|
|
14
|
+
* use the shared pool, transactions acquire a dedicated pooled connection for
|
|
15
|
+
* their lifetime, and streams stay tied to mysql2 stream resources until they
|
|
16
|
+
* are consumed or closed.
|
|
17
|
+
*
|
|
18
|
+
* **Common tasks**
|
|
19
|
+
*
|
|
20
|
+
* Use {@link layer} when configuration is already available, or
|
|
21
|
+
* {@link layerConfig} when it should be read through `Config`. Pass `url` for a
|
|
22
|
+
* connection URI, or pass `host`, `port`, `database`, `username`, and
|
|
23
|
+
* `password` for discrete connection settings. Use `poolConfig` for additional
|
|
24
|
+
* mysql2 pool options when configuring discrete fields.
|
|
25
|
+
*
|
|
26
|
+
* **Gotchas**
|
|
27
|
+
*
|
|
28
|
+
* When `url` is supplied it takes precedence over the discrete connection
|
|
29
|
+
* fields and does not merge in `poolConfig`. Long-running transactions and
|
|
30
|
+
* streams occupy pool capacity, so tune `maxConnections` and `connectionTTL`
|
|
31
|
+
* for those workloads.
|
|
18
32
|
*
|
|
19
33
|
* @since 4.0.0
|
|
20
34
|
*/
|
|
@@ -55,7 +69,11 @@ export interface MysqlClient extends Client.SqlClient {
|
|
|
55
69
|
readonly config: MysqlClientConfig;
|
|
56
70
|
}
|
|
57
71
|
/**
|
|
58
|
-
*
|
|
72
|
+
* Service tag for the mysql2 SQL client service.
|
|
73
|
+
*
|
|
74
|
+
* **When to use**
|
|
75
|
+
*
|
|
76
|
+
* Use to access or provide a mysql2 client through the Effect context.
|
|
59
77
|
*
|
|
60
78
|
* @category tags
|
|
61
79
|
* @since 4.0.0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MysqlClient.d.ts","sourceRoot":"","sources":["../src/MysqlClient.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"MysqlClient.d.ts","sourceRoot":"","sources":["../src/MysqlClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,OAAO,MAAM,gB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lClient.js
CHANGED
|
@@ -1,20 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* MySQL
|
|
2
|
+
* MySQL adapter for Effect SQL, backed by the `mysql2` driver.
|
|
3
3
|
*
|
|
4
|
-
* This module
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* classification for
|
|
4
|
+
* This module provides constructors and layers for a {@link MysqlClient} and
|
|
5
|
+
* the generic Effect SQL client service. Use it in server applications,
|
|
6
|
+
* background workers, migrations, and tests that need MySQL query compilation,
|
|
7
|
+
* scoped pool management, streaming queries, and consistent `SqlError`
|
|
8
|
+
* classification for mysql2 driver failures.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
10
|
+
* **Mental model**
|
|
11
|
+
*
|
|
12
|
+
* {@link make} allocates a mysql2 pool inside the current scope, verifies it
|
|
13
|
+
* with `SELECT 1`, and closes it when the scope is released. Regular queries
|
|
14
|
+
* use the shared pool, transactions acquire a dedicated pooled connection for
|
|
15
|
+
* their lifetime, and streams stay tied to mysql2 stream resources until they
|
|
16
|
+
* are consumed or closed.
|
|
17
|
+
*
|
|
18
|
+
* **Common tasks**
|
|
19
|
+
*
|
|
20
|
+
* Use {@link layer} when configuration is already available, or
|
|
21
|
+
* {@link layerConfig} when it should be read through `Config`. Pass `url` for a
|
|
22
|
+
* connection URI, or pass `host`, `port`, `database`, `username`, and
|
|
23
|
+
* `password` for discrete connection settings. Use `poolConfig` for additional
|
|
24
|
+
* mysql2 pool options when configuring discrete fields.
|
|
25
|
+
*
|
|
26
|
+
* **Gotchas**
|
|
27
|
+
*
|
|
28
|
+
* When `url` is supplied it takes precedence over the discrete connection
|
|
29
|
+
* fields and does not merge in `poolConfig`. Long-running transactions and
|
|
30
|
+
* streams occupy pool capacity, so tune `maxConnections` and `connectionTTL`
|
|
31
|
+
* for those workloads.
|
|
18
32
|
*
|
|
19
33
|
* @since 4.0.0
|
|
20
34
|
*/
|
|
@@ -127,7 +141,11 @@ const classifyError = (cause, message, operation) => {
|
|
|
127
141
|
*/
|
|
128
142
|
export const TypeId = "~@effect/sql-mysql2/MysqlClient";
|
|
129
143
|
/**
|
|
130
|
-
*
|
|
144
|
+
* Service tag for the mysql2 SQL client service.
|
|
145
|
+
*
|
|
146
|
+
* **When to use**
|
|
147
|
+
*
|
|
148
|
+
* Use to access or provide a mysql2 client through the Effect context.
|
|
131
149
|
*
|
|
132
150
|
* @category tags
|
|
133
151
|
* @since 4.0.0
|
package/dist/MysqlClient.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MysqlClient.js","names":["Config","Context","Duration","Effect","Layer","Redacted","Stream","Reactivity","Client","AuthenticationError","AuthorizationError","ConnectionError","ConstraintError","DeadlockError","LockTimeoutError","SqlError","SqlSyntaxError","StatementTimeoutError","UniqueViolation","UnknownError","asyncPauseResume","Statement","Mysql","ATTR_DB_SYSTEM_NAME","ATTR_DB_NAMESPACE","ATTR_SERVER_ADDRESS","ATTR_SERVER_PORT","mysqlErrnoFromCause","cause","undefined","errno","mysqlConnectionErrorCodes","Set","mysqlAuthorizationErrorCodes","mysqlSyntaxErrorCodes","mysqlConstraintErrorCodes","UNKNOWN_CONSTRAINT","normalizeConstraintIdentifier","identifier","trimmed","trim","length","mysqlCauseProperty","property","mysqlDuplicateEntryConstraintFromMessage","message","match","exec","mysqlDuplicateEntryConstraintFromCause","constraint","sqlMessageConstraint","classifyError","operation","props","has","TypeId","MysqlClient","Service","make","options","gen","compiler","makeCompiler","transformQueryNames","transformRows","transformResultNames","defaultTransforms","array","ConnectionImpl","conn","constructor","runRaw","sql","values","rowsAsArray","method","callback","resume","results","_fields","fail","reason","succeed","run","pipe","map","Array","isArray","execute","params","executeRaw","executeValues","executeUnprepared","executeStream","stream","queryStream","mapArray","_","pool","url","createPool","uri","value","multipleStatements","supportBigNumbers","connectionLimit","maxConnections","idleTimeout","connectionTTL","toMillis","fromInputUnsafe","poolConfig","host","port","database","user","username","password","acquireRelease","query","void","end","timeoutOrElse","duration","seconds","orElse","Error","poolConnection","acquireConn","getConnection","sync","release","transactionAcquirer","spanAttributes","Object","entries","push","assign","acquirer","config","layerConfig","effectContext","unwrap","flatMap","client","add","SqlClient","provide","layer","transform","dialect","placeholder","onIdentifier","withoutTransform","escape","onCustom","onRecordUpdate","defaultEscape","fnUntraced","emit","addFinalizer","destroy","buffer","taskPending","on","row","queueMicrotask","items","onPause","pause","onResume"],"sources":["../src/MysqlClient.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;AAoBA,OAAO,KAAKA,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAKC,QAAQ,MAAM,iBAAiB;AAC3C,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,QAAQ,MAAM,iBAAiB;AAE3C,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,UAAU,MAAM,uCAAuC;AACnE,OAAO,KAAKC,MAAM,MAAM,+BAA+B;AAEvD,SACEC,mBAAmB,EACnBC,kBAAkB,EAClBC,eAAe,EACfC,eAAe,EACfC,aAAa,EACbC,gBAAgB,EAChBC,QAAQ,EACRC,cAAc,EACdC,qBAAqB,EACrBC,eAAe,EACfC,YAAY,QACP,8BAA8B;AACrC,SAASC,gBAAgB,QAAQ,+BAA+B;AAChE,OAAO,KAAKC,SAAS,MAAM,+BAA+B;AAC1D,OAAO,KAAKC,KAAK,MAAM,QAAQ;AAE/B,MAAMC,mBAAmB,GAAG,gBAAgB;AAC5C,MAAMC,iBAAiB,GAAG,cAAc;AACxC,MAAMC,mBAAmB,GAAG,gBAAgB;AAC5C,MAAMC,gBAAgB,GAAG,aAAa;AAEtC,MAAM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AC1C,MAAM,EAAE;MAChB;KACD;EACH,CAAC,CAAC,CAAC;AACL","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"MysqlClient.js","names":["Config","Context","Duration","Effect","Layer","Redacted","Stream","Reactivity","Client","AuthenticationError","AuthorizationError","ConnectionError","ConstraintError","DeadlockError","LockTimeoutError","SqlError","SqlSyntaxError","StatementTimeoutError","UniqueViolation","UnknownError","asyncPauseResume","Statement","Mysql","ATTR_DB_SYSTEM_NAME","ATTR_DB_NAMESPACE","ATTR_SERVER_ADDRESS","ATTR_SERVER_PORT","mysqlErrnoFromCause","cause","undefined","errno","mysqlConnectionErrorCodes","Set","mysqlAuthorizationErrorCodes","mysqlSyntaxErrorCodes","mysqlConstraintErrorCodes","UNKNOWN_CONSTRAINT","normalizeConstraintIdentifier","identifier","trimmed","trim","length","mysqlCauseProperty","property","mysqlDuplicateEntryConstraintFromMessage","message","match","exec","mysqlDuplicateEntryConstraintFromCause","constraint","sqlMessageConstraint","classifyError","operation","props","has","TypeId","MysqlClient","Service","make","options","gen","compiler","makeCompiler","transformQueryNames","transformRows","transformResultNames","defaultTransforms","array","ConnectionImpl","conn","constructor","runRaw","sql","values","rowsAsArray","method","callback","resume","results","_fields","fail","reason","succeed","run","pipe","map","Array","isArray","execute","params","executeRaw","executeValues","executeUnprepared","executeStream","stream","queryStream","mapArray","_","pool","url","createPool","uri","value","multipleStatements","supportBigNumbers","connectionLimit","maxConnections","idleTimeout","connectionTTL","toMillis","fromInputUnsafe","poolConfig","host","port","database","user","username","password","acquireRelease","query","void","end","timeoutOrElse","duration","seconds","orElse","Error","poolConnection","acquireConn","getConnection","sync","release","transactionAcquirer","spanAttributes","Object","entries","push","assign","acquirer","config","layerConfig","effectContext","unwrap","flatMap","client","add","SqlClient","provide","layer","transform","dialect","placeholder","onIdentifier","withoutTransform","escape","onCustom","onRecordUpdate","defaultEscape","fnUntraced","emit","addFinalizer","destroy","buffer","taskPending","on","row","queueMicrotask","items","onPause","pause","onResume"],"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AE,CACN,OAAO,EACNxI,KAAc,IACbmI,IAAI,CAAC/E,IAAI,CAAC,IAAIjE,QAAQ,CAAC;MAAEkE,MAAM,EAAE9B,aAAa,CAACvB,KAAK,EAAE,4BAA4B,EAAE,QAAQ;IAAC,CAAE,CAAC,CAAC,CACpG;IACD2F,KAAK,CAAC6C,EAAE,CAAC,MAAM,EAAGC,GAAQ,IAAI;MAC5BH,MAAM,CAAC1B,IAAI,CAAC6B,GAAG,CAAC;MAChB,IAAI,CAACF,WAAW,EAAE;QAChBA,WAAW,GAAG,IAAI;QAClBG,cAAc,CAAC,MAAK;UAClB,MAAMC,KAAK,GAAGL,MAAM;UACpBA,MAAM,GAAG,EAAE;UACXH,IAAI,CAAC5F,KAAK,CAACoG,KAAK,CAAC;UACjBJ,WAAW,GAAG,KAAK;QACrB,CAAC,CAAC;MACJ;IACF,CAAC,CAAC;IACF5C,KAAK,CAAC6C,EAAE,CAAC,KAAK,EAAE,MAAK;MACnB,IAAIF,MAAM,CAACzH,MAAM,GAAG,CAAC,EAAE;QACrBsH,IAAI,CAAC5F,KAAK,CAAC+F,MAAM,CAAC;QAClBA,MAAM,GAAG,EAAE;MACb;MACAH,IAAI,CAACtC,GAAG,EAAE;IACZ,CAAC,CAAC;IAEF,OAAO;MACL+C,OAAOA,CAAA;QACLjD,KAAK,CAACkD,KAAK,EAAE;MACf,CAAC;MACDC,QAAQA,CAAA;QACNnD,KAAK,CAAC1C,MAAM,EAAE;MAChB;KACD;EACH,CAAC,CAAC,CAAC;AACL","ignoreList":[]}
|
package/dist/MysqlMigrator.d.ts
CHANGED
|
@@ -1,21 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* mysql2-backed `SqlClient`.
|
|
2
|
+
* MySQL adapter for the shared Effect SQL migration runner.
|
|
4
3
|
*
|
|
5
4
|
* This module re-exports the shared `Migrator` loaders and error types, then
|
|
6
|
-
* provides `run` and `layer` helpers
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* the shared `<id>_<name>`
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
5
|
+
* provides `run` and `layer` helpers that apply ordered migrations through the
|
|
6
|
+
* current mysql2-backed `SqlClient`. Use it during application startup,
|
|
7
|
+
* deployment, or integration tests when MySQL schema changes must be applied
|
|
8
|
+
* before dependent services start reading or writing data.
|
|
9
|
+
*
|
|
10
|
+
* **Mental model**
|
|
11
|
+
*
|
|
12
|
+
* Migrations are loaded with the shared `<id>_<name>` convention and recorded in
|
|
13
|
+
* `effect_sql_migrations` by default. The runner reads the latest recorded id
|
|
14
|
+
* and applies only migrations with larger ids, returning the ids and names that
|
|
15
|
+
* were applied in the current run.
|
|
16
|
+
*
|
|
17
|
+
* **Common tasks**
|
|
18
|
+
*
|
|
19
|
+
* - Call `run` when an effect should explicitly migrate a MySQL database.
|
|
20
|
+
* - Use `layer` when schema setup should happen while building a layer graph.
|
|
21
|
+
* - Reuse the shared `Migrator` loaders from this module for file-based or
|
|
22
|
+
* in-memory migration definitions.
|
|
23
|
+
*
|
|
24
|
+
* **Gotchas**
|
|
25
|
+
*
|
|
26
|
+
* MySQL DDL can cause implicit commits, and this adapter relies on migration
|
|
27
|
+
* table constraints to detect concurrent runners. Coordinate startup runners and
|
|
28
|
+
* write migrations to tolerate MySQL's transactional semantics. Schema dump
|
|
29
|
+
* support is not enabled in this adapter, so `schemaDirectory` does not emit a
|
|
30
|
+
* MySQL dump.
|
|
19
31
|
*
|
|
20
32
|
* @since 4.0.0
|
|
21
33
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MysqlMigrator.d.ts","sourceRoot":"","sources":["../src/MysqlMigrator.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"MysqlMigrator.d.ts","sourceRoot":"","sources":["../src/MysqlMigrator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,QAAQ,MAAM,8BAA8B,CAAA;AACxD,OAAO,KAAK,KAAK,MAAM,MAAM,+BAA+B,CAAA;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AAE5D;;GAEG;AACH,cAAc,8BAA8B,CAAA;AAE5C;;;;;GAKG;AACH,eAAO,MAAM,GAAG,EAAE,CAAC,EAAE,GAAG,KAAK,EAC3B,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,EAAE,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,KAC7D,MAAM,CAAC,MAAM,CAChB,aAAa,CAAC,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,EAClD,QAAQ,CAAC,cAAc,GAAG,QAAQ,EAClC,MAAM,CAAC,SAAS,GAAG,EAAE,CAsDrB,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,EACrB,SAAS,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,KACnC,KAAK,CAAC,KAAK,CACZ,KAAK,EACL,QAAQ,CAAC,cAAc,GAAG,QAAQ,EAClC,MAAM,CAAC,SAAS,GAAG,CAAC,CACgB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MysqlMigrator.js","names":["Layer","Migrator","run","make","layer","options","effectDiscard"],"sources":["../src/MysqlMigrator.ts"],"sourcesContent":[null],"mappings":"
|
|
1
|
+
{"version":3,"file":"MysqlMigrator.js","names":["Layer","Migrator","run","make","layer","options","effectDiscard"],"sources":["../src/MysqlMigrator.ts"],"sourcesContent":[null],"mappings":"AAkCA,OAAO,KAAKA,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,QAAQ,MAAM,8BAA8B;AAIxD;;;AAGA,cAAc,8BAA8B;AAE5C;;;;;;AAMA,OAAO,MAAMC,GAAG,gBAMZD,QAAQ,CAACE,IAAI,CAAC;EAChB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AAAA,CACD,CAAC;AAEF;;;;;;AAMA,OAAO,MAAMC,KAAK,GAChBC,OAAoC,IAKjCL,KAAK,CAACM,aAAa,CAACJ,GAAG,CAACG,OAAO,CAAC,CAAC","ignoreList":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,45 +2,10 @@
|
|
|
2
2
|
* @since 4.0.0
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
|
-
* MySQL client implementation for Effect SQL, backed by the `mysql2` driver.
|
|
6
|
-
*
|
|
7
|
-
* This module exposes constructors and layers for providing both the MySQL-specific
|
|
8
|
-
* `MysqlClient` service and the generic `SqlClient` service. It is intended for server
|
|
9
|
-
* applications, background workers, migrations, and tests that need Effect SQL query
|
|
10
|
-
* compilation, scoped resource management, streaming queries, and consistent `SqlError`
|
|
11
|
-
* classification for MySQL driver failures.
|
|
12
|
-
*
|
|
13
|
-
* Each client owns a scoped mysql2 pool, validates connectivity with `SELECT 1` during
|
|
14
|
-
* acquisition, and closes the pool when the surrounding scope is released. You can configure
|
|
15
|
-
* the pool from a connection URI or discrete connection fields; when `url` is supplied it
|
|
16
|
-
* takes precedence over the host, port, database, username, and password fields. Regular
|
|
17
|
-
* queries run through the shared pool, while transactions acquire a dedicated pooled
|
|
18
|
-
* connection for their lifetime, so long-running transactions and streams can occupy pool
|
|
19
|
-
* capacity. Size `maxConnections`, `connectionTTL`, and any mysql2 `poolConfig` with that in
|
|
20
|
-
* mind.
|
|
21
|
-
*
|
|
22
5
|
* @since 4.0.0
|
|
23
6
|
*/
|
|
24
7
|
export * as MysqlClient from "./MysqlClient.ts";
|
|
25
8
|
/**
|
|
26
|
-
* Utilities for applying Effect SQL migrations to MySQL databases through the
|
|
27
|
-
* mysql2-backed `SqlClient`.
|
|
28
|
-
*
|
|
29
|
-
* This module re-exports the shared `Migrator` loaders and error types, then
|
|
30
|
-
* provides `run` and `layer` helpers for applying ordered migrations using the
|
|
31
|
-
* currently configured MySQL `SqlClient`. It is commonly used during application
|
|
32
|
-
* startup, in integration tests that provision a temporary schema, or in layer
|
|
33
|
-
* graphs where dependent services should not start until the database schema is
|
|
34
|
-
* current.
|
|
35
|
-
*
|
|
36
|
-
* Applied migrations are stored in `effect_sql_migrations` by default and use
|
|
37
|
-
* the shared `<id>_<name>` loader convention. Only migrations with ids greater
|
|
38
|
-
* than the latest recorded id are run. MySQL DDL can cause implicit commits, and
|
|
39
|
-
* this adapter relies on migration table constraints to detect concurrent
|
|
40
|
-
* runners, so coordinate startup runners and write migrations to tolerate
|
|
41
|
-
* MySQL's transactional semantics. Schema dump support is not enabled in this
|
|
42
|
-
* adapter, so `schemaDirectory` does not emit a MySQL dump.
|
|
43
|
-
*
|
|
44
9
|
* @since 4.0.0
|
|
45
10
|
*/
|
|
46
11
|
export * as MysqlMigrator from "./MysqlMigrator.ts";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;GAEG;AACH,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAE/C;;GAEG;AACH,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -3,45 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
// @barrel: Auto-generated exports. Do not edit manually.
|
|
5
5
|
/**
|
|
6
|
-
* MySQL client implementation for Effect SQL, backed by the `mysql2` driver.
|
|
7
|
-
*
|
|
8
|
-
* This module exposes constructors and layers for providing both the MySQL-specific
|
|
9
|
-
* `MysqlClient` service and the generic `SqlClient` service. It is intended for server
|
|
10
|
-
* applications, background workers, migrations, and tests that need Effect SQL query
|
|
11
|
-
* compilation, scoped resource management, streaming queries, and consistent `SqlError`
|
|
12
|
-
* classification for MySQL driver failures.
|
|
13
|
-
*
|
|
14
|
-
* Each client owns a scoped mysql2 pool, validates connectivity with `SELECT 1` during
|
|
15
|
-
* acquisition, and closes the pool when the surrounding scope is released. You can configure
|
|
16
|
-
* the pool from a connection URI or discrete connection fields; when `url` is supplied it
|
|
17
|
-
* takes precedence over the host, port, database, username, and password fields. Regular
|
|
18
|
-
* queries run through the shared pool, while transactions acquire a dedicated pooled
|
|
19
|
-
* connection for their lifetime, so long-running transactions and streams can occupy pool
|
|
20
|
-
* capacity. Size `maxConnections`, `connectionTTL`, and any mysql2 `poolConfig` with that in
|
|
21
|
-
* mind.
|
|
22
|
-
*
|
|
23
6
|
* @since 4.0.0
|
|
24
7
|
*/
|
|
25
8
|
export * as MysqlClient from "./MysqlClient.js";
|
|
26
9
|
/**
|
|
27
|
-
* Utilities for applying Effect SQL migrations to MySQL databases through the
|
|
28
|
-
* mysql2-backed `SqlClient`.
|
|
29
|
-
*
|
|
30
|
-
* This module re-exports the shared `Migrator` loaders and error types, then
|
|
31
|
-
* provides `run` and `layer` helpers for applying ordered migrations using the
|
|
32
|
-
* currently configured MySQL `SqlClient`. It is commonly used during application
|
|
33
|
-
* startup, in integration tests that provision a temporary schema, or in layer
|
|
34
|
-
* graphs where dependent services should not start until the database schema is
|
|
35
|
-
* current.
|
|
36
|
-
*
|
|
37
|
-
* Applied migrations are stored in `effect_sql_migrations` by default and use
|
|
38
|
-
* the shared `<id>_<name>` loader convention. Only migrations with ids greater
|
|
39
|
-
* than the latest recorded id are run. MySQL DDL can cause implicit commits, and
|
|
40
|
-
* this adapter relies on migration table constraints to detect concurrent
|
|
41
|
-
* runners, so coordinate startup runners and write migrations to tolerate
|
|
42
|
-
* MySQL's transactional semantics. Schema dump support is not enabled in this
|
|
43
|
-
* adapter, so `schemaDirectory` does not emit a MySQL dump.
|
|
44
|
-
*
|
|
45
10
|
* @since 4.0.0
|
|
46
11
|
*/
|
|
47
12
|
export * as MysqlMigrator from "./MysqlMigrator.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["MysqlClient","MysqlMigrator"],"sources":["../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAIA;AAEA
|
|
1
|
+
{"version":3,"file":"index.js","names":["MysqlClient","MysqlMigrator"],"sources":["../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAIA;AAEA;;;AAGA,OAAO,KAAKA,WAAW,MAAM,kBAAkB;AAE/C;;;AAGA,OAAO,KAAKC,aAAa,MAAM,oBAAoB","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect/sql-mysql2",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.72",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "A MySQL toolkit for Effect",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@testcontainers/mysql": "^11.14.0",
|
|
47
|
-
"effect": "^4.0.0-beta.
|
|
47
|
+
"effect": "^4.0.0-beta.72"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"effect": "^4.0.0-beta.
|
|
50
|
+
"effect": "^4.0.0-beta.72"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"mysql2": "^3.22.3"
|
package/src/MysqlClient.ts
CHANGED
|
@@ -1,20 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* MySQL
|
|
2
|
+
* MySQL adapter for Effect SQL, backed by the `mysql2` driver.
|
|
3
3
|
*
|
|
4
|
-
* This module
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* classification for
|
|
4
|
+
* This module provides constructors and layers for a {@link MysqlClient} and
|
|
5
|
+
* the generic Effect SQL client service. Use it in server applications,
|
|
6
|
+
* background workers, migrations, and tests that need MySQL query compilation,
|
|
7
|
+
* scoped pool management, streaming queries, and consistent `SqlError`
|
|
8
|
+
* classification for mysql2 driver failures.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
10
|
+
* **Mental model**
|
|
11
|
+
*
|
|
12
|
+
* {@link make} allocates a mysql2 pool inside the current scope, verifies it
|
|
13
|
+
* with `SELECT 1`, and closes it when the scope is released. Regular queries
|
|
14
|
+
* use the shared pool, transactions acquire a dedicated pooled connection for
|
|
15
|
+
* their lifetime, and streams stay tied to mysql2 stream resources until they
|
|
16
|
+
* are consumed or closed.
|
|
17
|
+
*
|
|
18
|
+
* **Common tasks**
|
|
19
|
+
*
|
|
20
|
+
* Use {@link layer} when configuration is already available, or
|
|
21
|
+
* {@link layerConfig} when it should be read through `Config`. Pass `url` for a
|
|
22
|
+
* connection URI, or pass `host`, `port`, `database`, `username`, and
|
|
23
|
+
* `password` for discrete connection settings. Use `poolConfig` for additional
|
|
24
|
+
* mysql2 pool options when configuring discrete fields.
|
|
25
|
+
*
|
|
26
|
+
* **Gotchas**
|
|
27
|
+
*
|
|
28
|
+
* When `url` is supplied it takes precedence over the discrete connection
|
|
29
|
+
* fields and does not merge in `poolConfig`. Long-running transactions and
|
|
30
|
+
* streams occupy pool capacity, so tune `maxConnections` and `connectionTTL`
|
|
31
|
+
* for those workloads.
|
|
18
32
|
*
|
|
19
33
|
* @since 4.0.0
|
|
20
34
|
*/
|
|
@@ -170,7 +184,11 @@ export interface MysqlClient extends Client.SqlClient {
|
|
|
170
184
|
}
|
|
171
185
|
|
|
172
186
|
/**
|
|
173
|
-
*
|
|
187
|
+
* Service tag for the mysql2 SQL client service.
|
|
188
|
+
*
|
|
189
|
+
* **When to use**
|
|
190
|
+
*
|
|
191
|
+
* Use to access or provide a mysql2 client through the Effect context.
|
|
174
192
|
*
|
|
175
193
|
* @category tags
|
|
176
194
|
* @since 4.0.0
|
package/src/MysqlMigrator.ts
CHANGED
|
@@ -1,21 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* mysql2-backed `SqlClient`.
|
|
2
|
+
* MySQL adapter for the shared Effect SQL migration runner.
|
|
4
3
|
*
|
|
5
4
|
* This module re-exports the shared `Migrator` loaders and error types, then
|
|
6
|
-
* provides `run` and `layer` helpers
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* current.
|
|
5
|
+
* provides `run` and `layer` helpers that apply ordered migrations through the
|
|
6
|
+
* current mysql2-backed `SqlClient`. Use it during application startup,
|
|
7
|
+
* deployment, or integration tests when MySQL schema changes must be applied
|
|
8
|
+
* before dependent services start reading or writing data.
|
|
11
9
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
10
|
+
* **Mental model**
|
|
11
|
+
*
|
|
12
|
+
* Migrations are loaded with the shared `<id>_<name>` convention and recorded in
|
|
13
|
+
* `effect_sql_migrations` by default. The runner reads the latest recorded id
|
|
14
|
+
* and applies only migrations with larger ids, returning the ids and names that
|
|
15
|
+
* were applied in the current run.
|
|
16
|
+
*
|
|
17
|
+
* **Common tasks**
|
|
18
|
+
*
|
|
19
|
+
* - Call `run` when an effect should explicitly migrate a MySQL database.
|
|
20
|
+
* - Use `layer` when schema setup should happen while building a layer graph.
|
|
21
|
+
* - Reuse the shared `Migrator` loaders from this module for file-based or
|
|
22
|
+
* in-memory migration definitions.
|
|
23
|
+
*
|
|
24
|
+
* **Gotchas**
|
|
25
|
+
*
|
|
26
|
+
* MySQL DDL can cause implicit commits, and this adapter relies on migration
|
|
27
|
+
* table constraints to detect concurrent runners. Coordinate startup runners and
|
|
28
|
+
* write migrations to tolerate MySQL's transactional semantics. Schema dump
|
|
29
|
+
* support is not enabled in this adapter, so `schemaDirectory` does not emit a
|
|
30
|
+
* MySQL dump.
|
|
19
31
|
*
|
|
20
32
|
* @since 4.0.0
|
|
21
33
|
*/
|
package/src/index.ts
CHANGED
|
@@ -5,46 +5,11 @@
|
|
|
5
5
|
// @barrel: Auto-generated exports. Do not edit manually.
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* MySQL client implementation for Effect SQL, backed by the `mysql2` driver.
|
|
9
|
-
*
|
|
10
|
-
* This module exposes constructors and layers for providing both the MySQL-specific
|
|
11
|
-
* `MysqlClient` service and the generic `SqlClient` service. It is intended for server
|
|
12
|
-
* applications, background workers, migrations, and tests that need Effect SQL query
|
|
13
|
-
* compilation, scoped resource management, streaming queries, and consistent `SqlError`
|
|
14
|
-
* classification for MySQL driver failures.
|
|
15
|
-
*
|
|
16
|
-
* Each client owns a scoped mysql2 pool, validates connectivity with `SELECT 1` during
|
|
17
|
-
* acquisition, and closes the pool when the surrounding scope is released. You can configure
|
|
18
|
-
* the pool from a connection URI or discrete connection fields; when `url` is supplied it
|
|
19
|
-
* takes precedence over the host, port, database, username, and password fields. Regular
|
|
20
|
-
* queries run through the shared pool, while transactions acquire a dedicated pooled
|
|
21
|
-
* connection for their lifetime, so long-running transactions and streams can occupy pool
|
|
22
|
-
* capacity. Size `maxConnections`, `connectionTTL`, and any mysql2 `poolConfig` with that in
|
|
23
|
-
* mind.
|
|
24
|
-
*
|
|
25
8
|
* @since 4.0.0
|
|
26
9
|
*/
|
|
27
10
|
export * as MysqlClient from "./MysqlClient.ts"
|
|
28
11
|
|
|
29
12
|
/**
|
|
30
|
-
* Utilities for applying Effect SQL migrations to MySQL databases through the
|
|
31
|
-
* mysql2-backed `SqlClient`.
|
|
32
|
-
*
|
|
33
|
-
* This module re-exports the shared `Migrator` loaders and error types, then
|
|
34
|
-
* provides `run` and `layer` helpers for applying ordered migrations using the
|
|
35
|
-
* currently configured MySQL `SqlClient`. It is commonly used during application
|
|
36
|
-
* startup, in integration tests that provision a temporary schema, or in layer
|
|
37
|
-
* graphs where dependent services should not start until the database schema is
|
|
38
|
-
* current.
|
|
39
|
-
*
|
|
40
|
-
* Applied migrations are stored in `effect_sql_migrations` by default and use
|
|
41
|
-
* the shared `<id>_<name>` loader convention. Only migrations with ids greater
|
|
42
|
-
* than the latest recorded id are run. MySQL DDL can cause implicit commits, and
|
|
43
|
-
* this adapter relies on migration table constraints to detect concurrent
|
|
44
|
-
* runners, so coordinate startup runners and write migrations to tolerate
|
|
45
|
-
* MySQL's transactional semantics. Schema dump support is not enabled in this
|
|
46
|
-
* adapter, so `schemaDirectory` does not emit a MySQL dump.
|
|
47
|
-
*
|
|
48
13
|
* @since 4.0.0
|
|
49
14
|
*/
|
|
50
15
|
export * as MysqlMigrator from "./MysqlMigrator.ts"
|