mysql-memory-server 1.7.0 → 1.7.1

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/README.md CHANGED
@@ -78,7 +78,7 @@ If using Jest, information about how to do this can be found here: https://jestj
78
78
  ```sh
79
79
  # Options are added by doing --{optionName} {optionValue}
80
80
  # See Options below for the options you can use with this package
81
- npx mysql-memory-server --version 8.4.x
81
+ npx mysql-memory-server@latest --version 8.4.x
82
82
  ```
83
83
 
84
84
  ## Documentation
@@ -214,7 +214,7 @@ Required: No
214
214
 
215
215
  Default: ""
216
216
 
217
- Description: A string with MySQL queries to run before the database starts to accept connections. This option can be used for things like initialising tables without having to first connect to the database to do that.The queries in the string get executed after ```mysql-memory-server```'s queries run. Uses the ```--init-file``` MySQL server option under the hood. Learn more at the [--init-file MySQL Documentation](https://dev.mysql.com/doc/refman/8.4/en/server-system-variables.html#sysvar_init_file)
217
+ Description: A string with MySQL queries to run before the database starts to accept connections. This option can be used for things like initialising tables without having to first connect to the database to do that. The queries in the string get executed after ```mysql-memory-server```'s queries run. Uses the ```--init-file``` MySQL server option under the hood. Learn more at the [--init-file MySQL Documentation](https://dev.mysql.com/doc/refman/8.4/en/server-system-variables.html#sysvar_init_file)
218
218
 
219
219
  The internal queries that are ran before the queries in ```initSQLString``` are renaming the user from ```root``` to the username specified in the ```username``` option if it's set, and creating a database with the name from the ```dbName``` option.
220
220
 
package/dist/src/cli.js CHANGED
@@ -6,7 +6,7 @@ const constants_1 = require("./constants");
6
6
  async function main() {
7
7
  const definedOptions = process.argv.filter((option) => option.startsWith('--'));
8
8
  const options = {
9
- _DO_NOT_USE_beforeSignalCleanupMessage: '\nShutting down the epehemeral MySQL database and cleaning all related files...',
9
+ _DO_NOT_USE_beforeSignalCleanupMessage: '\nShutting down the ephemeral MySQL database and cleaning all related files...',
10
10
  _DO_NOT_USE_afterSignalCleanupMessage: 'Shutdown and cleanup is complete.'
11
11
  };
12
12
  for (const opt of definedOptions) {
@@ -41,7 +41,7 @@ async function main() {
41
41
  }
42
42
  console.log('Creating ephemeral MySQL database...');
43
43
  const db = await (0, index_1.createDB)(options);
44
- console.log(`A MySQL databases has been successfully created with the following parameters:\n\nUsername: ${db.username} \nDatabase Name: ${db.dbName} \nPort: ${db.port} \nX Plugin Port: ${db.xPort} \nSocket: ${db.socket} \nX Plugin Socket: ${db.xSocket}\n`);
44
+ console.log(`A MySQL database has been successfully created with the following parameters:\n\nUsername: ${db.username} \nDatabase Name: ${db.dbName} \nPort: ${db.port} \nX Plugin Port: ${db.xPort} \nSocket: ${db.socket} \nX Plugin Socket: ${db.xSocket}\n`);
45
45
  if (process.platform === 'win32') {
46
46
  //The connection information logs will be different for Windows compared to other platforms.
47
47
  //Windows uses mysqlsh instead of mysql to invoke the client shell, needs a --sql flag to be put into SQL mode, and also does not have a protocol flag.
@@ -48,6 +48,7 @@ const Port_1 = require("./Port");
48
48
  const path_1 = require("path");
49
49
  const FileLock_1 = require("./FileLock");
50
50
  const signal_exit_1 = require("signal-exit");
51
+ const crypto_1 = require("crypto");
51
52
  class Executor {
52
53
  constructor(logger) {
53
54
  _Executor_instances.add(this);
@@ -229,8 +230,8 @@ _Executor_instances = new WeakSet(), _Executor_executeFile = function _Executor_
229
230
  const errorLogFile = `${datadir}/errorlog.err`;
230
231
  return new Promise(async (resolve, reject) => {
231
232
  await fsPromises.rm(logFile, { force: true });
232
- const socket = os.platform() === 'win32' ? `MySQL-${crypto.randomUUID()}` : `${dbPath}/m.sock`;
233
- const xSocket = os.platform() === 'win32' ? `MySQLX-${crypto.randomUUID()}` : `${dbPath}/x.sock`;
233
+ const socket = os.platform() === 'win32' ? `MySQL-${(0, crypto_1.randomUUID)()}` : `${dbPath}/m.sock`;
234
+ const xSocket = os.platform() === 'win32' ? `MySQLX-${(0, crypto_1.randomUUID)()}` : `${dbPath}/x.sock`;
234
235
  const process = (0, child_process_1.spawn)(binaryFilepath, ['--no-defaults', `--port=${port}`, `--datadir=${datadir}`, `--mysqlx-port=${mySQLXPort}`, `--mysqlx-socket=${xSocket}`, `--socket=${socket}`, `--general-log-file=${logFile}`, '--general-log=1', `--init-file=${dbPath}/init.sql`, '--bind-address=127.0.0.1', '--innodb-doublewrite=OFF', '--mysqlx=FORCE', `--log-error=${errorLogFile}`, `--user=${os.userInfo().username}`], { signal: this.DBDestroySignal.signal, killSignal: 'SIGKILL' });
235
236
  //resolveFunction is the function that will be called to resolve the promise that stops the database.
236
237
  //If resolveFunction is not undefined, the database has received a kill signal and data cleanup procedures should run.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mysql-memory-server",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "Spin up an ephemeral MySQL database from your JavaScript code",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",