mysql-memory-server 1.8.2 → 1.9.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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MySQL Memory Server
2
2
 
3
- This package allows you to create ephemeral MySQL databases from JavaScript and/or TypeScript code and also the CLI, great for testing, CI, and learning MySQL. When creating a new database, if the version selected is not installed on the system, the binary is downloaded from MySQL's CDN (cdn.mysql.com)
3
+ This package allows you to create ephemeral MySQL databases from JavaScript and/or TypeScript code and also the CLI, great for testing, CI, and learning MySQL. When creating a new database, if the version selected is not installed on the system, the binary is downloaded from MySQL's CDN (cdn.mysql.com). This package supports Linux, macOS, and Windows.
4
4
 
5
5
  You can run multiple MySQL databases with this package at the same time. Each database will use a random free port. The databases will automatically shutdown when the JS runtime process exits. A `stop()` method is also provided to stop each database instance.
6
6
 
@@ -11,24 +11,13 @@ Download with your package manager of choice. The package name is `mysql-memory-
11
11
  #### Requirements
12
12
 
13
13
  - Node.js >=16.6.0 or Bun >= 1.0.0
14
- - macOS 13+, Windows, or Linux (This package is only tested on Ubuntu 20.04, 22.04, 24.04, and Fedora 40. Other Linux distributions may or may not work at this time.)
15
-
16
- #### Requirements for downloaded MySQL versions
17
-
18
- The following requirements only apply if you intend to have `mysql-memory-server` download a version of MySQL to use instead of using an already installed version of MySQL on the system:
19
-
20
- Requirements for Windows:
21
- - `Microsoft Visual C++ 2019 Redistributable Package` needs to be installed
22
-
23
- Requirements for Linux:
24
- - The `libaio1` or `libaio1t64` package needs to be installed
25
- - If `libaio1` is not available but `libaio1t64` is, the `ldconfig` command needs to be available to run
26
- - The `tar` package needs to be installed
27
14
 
28
15
  #### Currently supported MySQL versions
29
16
 
30
- - If using the system installed MySQL server: 8.0.20 and newer
31
- - If not using the system installed MySQL server: 8.0.39, 8.0.40, 8.1.0, 8.2.0, 8.3.0, 8.4.2, 8.4.3, 9.0.1, 9.1.0
17
+ - ```mysql-memory-server``` can run MySQL versions 5.7.19 and newer (if the version is already installed on your system)
18
+ - ```mysql-memory-server``` can download and run MySQL versions 5.7.19 - 9.2.0 (if the version is not already installed on your system)
19
+
20
+ Extra system requirements apply when ```mysql-memory-server``` is downloading MySQL instead of running a version of MySQL that is already installed on the system. To see the requirements and learn more about the supported versions for download, [read the doc](https://github.com/Sebastian-Webster/mysql-memory-server-nodejs/blob/v1.9.0/docs/SUPPORTED_MYSQL_DOWNLOADS.md)
32
21
 
33
22
  ## Example Usage - Application Code
34
23
 
@@ -112,11 +101,11 @@ Default: undefined
112
101
  Description: Version of MySQL to use for the database. Uses semver for getting the version, so valid semver versions are allowed. For example, `8.x` is a valid version and will use the latest 8.x MySQL version.
113
102
 
114
103
  If left undefined:
115
- - If the system has MySQL installed, the system-installed version will be used. If the installed version is not supported by this package (currently <8.0.20), an error will be thrown unless `ignoreUnsupportedSystemVersion` is set to `true`.
104
+ - If the system has MySQL installed, the system-installed version will be used. If the installed version is not supported by this package (currently <5.7.19), an error will be thrown unless `ignoreUnsupportedSystemVersion` is set to `true`.
116
105
  - If the system does not have MySQL installed, the latest version of MySQL in the `versions.json` file in this package will be downloaded.
117
106
 
118
107
  If defined:
119
- - If the version is 8.0.19 or older, an error will be thrown as this package does not currently support those versions of MySQL.
108
+ - If the version is older than 5.7.19, an error will be thrown as this package does not currently support those versions of MySQL.
120
109
  - If the desired version of MySQL is installed on the system, the installed version will be used. Otherwise the selected version will be downloaded from the MySQL CDN as long as it can be found in the `versions.json` file. If it cannot be found in that file, an error will be thrown.
121
110
 
122
111
  - `dbName: string`
@@ -179,11 +168,11 @@ Description: The port that the MySQL X Plugin will listen on. If set to 0, a ran
179
168
 
180
169
  Default: false
181
170
 
182
- Description: This option only applies if the system-installed MySQL version is lower than the oldest supported MySQL version for this package (8.0.20) and the `version` option is not defined. If set to `true`, this package will use the latest version of MySQL instead of the system-installed version. If `false`, the package will throw an error.
171
+ Description: This option only applies if the system-installed MySQL version is lower than the oldest supported MySQL version for this package (5.7.19) and the `version` option is not defined. If set to `true`, this package will use the latest version of MySQL instead of the system-installed version. If `false`, the package will throw an error.
183
172
 
184
173
  - `downloadRetries: number`
185
174
 
186
- Default: 3
175
+ Default: 10
187
176
 
188
177
  Description: The number of times to try to download a MySQL binary before giving up and rejecting the `createDB()` promise.
189
178
 
@@ -1,6 +1,5 @@
1
1
  import { InternalServerOptions, OptionTypeChecks } from "../types";
2
- export declare const MIN_SUPPORTED_MYSQL = "8.0.20";
3
- export declare const DEFAULT_OPTIONS_GENERATOR: () => InternalServerOptions;
2
+ export declare const DEFAULT_OPTIONS: InternalServerOptions;
4
3
  export declare const DEFAULT_OPTIONS_KEYS: readonly string[];
5
4
  export declare const LOG_LEVELS: {
6
5
  readonly LOG: 0;
@@ -9,10 +8,81 @@ export declare const LOG_LEVELS: {
9
8
  };
10
9
  declare const internalOptions: {
11
10
  deleteDBAfterStopped: string;
12
- dbPath: string;
11
+ databaseDirectoryPath: string;
13
12
  binaryDirectoryPath: string;
14
13
  cli: string;
15
14
  };
16
15
  export declare function getInternalEnvVariable(envVar: keyof typeof internalOptions): string;
17
16
  export declare const OPTION_TYPE_CHECKS: OptionTypeChecks;
17
+ export declare const MIN_SUPPORTED_MYSQL = "5.7.19";
18
+ export declare const downloadsBaseURL = "https://cdn.mysql.com//Downloads/MySQL-";
19
+ export declare const archiveBaseURL = "https://cdn.mysql.com/archives/mysql-";
20
+ export declare const DOWNLOADABLE_MYSQL_VERSIONS: readonly ["5.7.19", "5.7.20", "5.7.21", "5.7.22", "5.7.23", "5.7.24", "5.7.25", "5.7.26", "5.7.27", "5.7.28", "5.7.29", "5.7.30", "5.7.31", "5.7.32", "5.7.33", "5.7.34", "5.7.35", "5.7.36", "5.7.37", "5.7.38", "5.7.39", "5.7.40", "5.7.41", "5.7.42", "5.7.43", "5.7.44", "8.0.0", "8.0.1", "8.0.2", "8.0.3", "8.0.4", "8.0.11", "8.0.12", "8.0.13", "8.0.14", "8.0.15", "8.0.16", "8.0.17", "8.0.18", "8.0.19", "8.0.20", "8.0.21", "8.0.22", "8.0.23", "8.0.24", "8.0.25", "8.0.26", "8.0.27", "8.0.28", "8.0.30", "8.0.31", "8.0.32", "8.0.33", "8.0.34", "8.0.35", "8.0.36", "8.0.37", "8.0.39", "8.0.40", "8.0.41", "8.1.0", "8.2.0", "8.3.0", "8.4.0", "8.4.2", "8.4.3", "8.4.4", "9.0.1", "9.1.0", "9.2.0"];
21
+ export declare const MYSQL_ARCH_SUPPORT: {
22
+ readonly darwin: {
23
+ readonly arm64: "8.0.26 - 9.2.0";
24
+ readonly x64: "5.7.19 - 9.2.0";
25
+ };
26
+ readonly linux: {
27
+ readonly arm64: "8.0.31 - 9.2.0";
28
+ readonly x64: "5.7.19 - 9.2.0";
29
+ };
30
+ readonly win32: {
31
+ readonly x64: "5.7.19 - 9.2.0";
32
+ };
33
+ };
34
+ export declare const MYSQL_MIN_OS_SUPPORT: {
35
+ readonly win32: {
36
+ readonly x: "0.0.0";
37
+ };
38
+ readonly linux: {
39
+ readonly x: "0.0.0";
40
+ };
41
+ readonly darwin: {
42
+ readonly '5.7.19 - 5.7.23 || 8.0.1 - 8.0.3 || 8.0.11 - 8.0.12': "16.0.0";
43
+ readonly '5.7.24 - 5.7.29 || 8.0.4 || 8.0.13 - 8.0.18': "17.0.0";
44
+ readonly '5.7.30 - 5.7.31 || 8.0.19 - 8.0.22': "18.0.0";
45
+ readonly '8.0.0': "13.0.0";
46
+ readonly '8.0.23 - 8.0.27': "19.0.0";
47
+ readonly '8.0.28 - 8.0.31': "20.0.0";
48
+ readonly '8.0.32 - 8.0.34': "21.0.0";
49
+ readonly '8.0.35 - 8.0.39 || 8.1.0 - 8.4.2 || 9.0.1': "22.0.0";
50
+ readonly '8.0.40 - 8.0.41 || 8.4.3 - 8.4.4 || 9.1.0 - 9.2.0': "23.0.0";
51
+ };
52
+ };
53
+ export declare const DMR_MYSQL_VERSIONS = "8.0.0 - 8.0.2";
54
+ export declare const RC_MYSQL_VERSIONS = "8.0.3 - 8.0.4";
55
+ export declare const MYSQL_MACOS_VERSIONS_IN_FILENAME: {
56
+ readonly '5.7.19 - 5.7.20 || 8.0.1 - 8.0.3': "macos10.12";
57
+ readonly '5.7.21 - 5.7.23 || 8.0.4 - 8.0.12': "macos10.13";
58
+ readonly '5.7.24 - 5.7.31 || 8.0.13 - 8.0.18': "macos10.14";
59
+ readonly '8.0.0': "osx10.11";
60
+ readonly '8.0.19 - 8.0.23': "macos10.15";
61
+ readonly '8.0.24 - 8.0.28': "macos11";
62
+ readonly '8.0.30 - 8.0.31': "macos12";
63
+ readonly '8.0.32 - 8.0.35 || 8.1.0 - 8.2.0': "macos13";
64
+ readonly '8.0.36 - 8.0.40 || 8.3.0 - 8.4.3 || 9.0.1 - 9.1.0': "macos14";
65
+ readonly '8.0.41 || 8.4.4 || 9.2.0': "macos15";
66
+ };
67
+ export declare const MYSQL_LINUX_GLIBC_VERSIONS: {
68
+ readonly '5.7.19 - 8.0.20': "2.12";
69
+ readonly '8.0.21 - 9.2.0': "2.17";
70
+ };
71
+ export declare const MYSQL_LINUX_MINIMAL_INSTALL_AVAILABLE: {
72
+ readonly '5.7.19 - 8.0.15': "no";
73
+ readonly '8.0.16 - 8.0.20': "no-glibc-tag";
74
+ readonly '8.0.21 - 9.2.0': "glibc-tag";
75
+ };
76
+ export declare const MYSQL_LINUX_MINIMAL_INSTALL_AVAILABLE_ARM64 = ">=8.0.33";
77
+ export declare const MYSQL_LINUX_FILE_EXTENSIONS: {
78
+ readonly x64: {
79
+ readonly '5.7.19 - 8.0.11': "gz";
80
+ readonly '8.0.12 - 9.2.0': "xz";
81
+ };
82
+ readonly arm64: {
83
+ readonly '8.0.31 - 8.0.32': "gz";
84
+ readonly '8.0.33 - 9.2.0': "xz";
85
+ };
86
+ };
87
+ export declare const MYSQL_LINUX_MINIMAL_REBUILD_VERSIONS = "8.0.26";
18
88
  export {};
@@ -1,20 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OPTION_TYPE_CHECKS = exports.LOG_LEVELS = exports.DEFAULT_OPTIONS_KEYS = exports.DEFAULT_OPTIONS_GENERATOR = exports.MIN_SUPPORTED_MYSQL = void 0;
3
+ exports.MYSQL_LINUX_MINIMAL_REBUILD_VERSIONS = exports.MYSQL_LINUX_FILE_EXTENSIONS = exports.MYSQL_LINUX_MINIMAL_INSTALL_AVAILABLE_ARM64 = exports.MYSQL_LINUX_MINIMAL_INSTALL_AVAILABLE = exports.MYSQL_LINUX_GLIBC_VERSIONS = exports.MYSQL_MACOS_VERSIONS_IN_FILENAME = exports.RC_MYSQL_VERSIONS = exports.DMR_MYSQL_VERSIONS = exports.MYSQL_MIN_OS_SUPPORT = exports.MYSQL_ARCH_SUPPORT = exports.DOWNLOADABLE_MYSQL_VERSIONS = exports.archiveBaseURL = exports.downloadsBaseURL = exports.MIN_SUPPORTED_MYSQL = exports.OPTION_TYPE_CHECKS = exports.LOG_LEVELS = exports.DEFAULT_OPTIONS_KEYS = exports.DEFAULT_OPTIONS = void 0;
4
4
  exports.getInternalEnvVariable = getInternalEnvVariable;
5
- const crypto_1 = require("crypto");
6
5
  const path_1 = require("path");
7
6
  const os_1 = require("os");
8
7
  const semver_1 = require("semver");
9
- exports.MIN_SUPPORTED_MYSQL = '8.0.20';
10
- const DEFAULT_OPTIONS_GENERATOR = () => ({
8
+ exports.DEFAULT_OPTIONS = {
11
9
  version: undefined,
12
10
  dbName: 'dbdata',
13
11
  logLevel: 'ERROR',
14
12
  portRetries: 10,
15
13
  downloadBinaryOnce: true,
16
- lockRetries: 1000,
17
- lockRetryWait: 1000,
14
+ lockRetries: 1_000,
15
+ lockRetryWait: 1_000,
18
16
  username: 'root',
19
17
  ignoreUnsupportedSystemVersion: false,
20
18
  port: 0,
@@ -22,9 +20,8 @@ const DEFAULT_OPTIONS_GENERATOR = () => ({
22
20
  downloadRetries: 10,
23
21
  initSQLString: '',
24
22
  arch: process.arch
25
- });
26
- exports.DEFAULT_OPTIONS_GENERATOR = DEFAULT_OPTIONS_GENERATOR;
27
- exports.DEFAULT_OPTIONS_KEYS = Object.freeze(Object.keys((0, exports.DEFAULT_OPTIONS_GENERATOR)()));
23
+ };
24
+ exports.DEFAULT_OPTIONS_KEYS = Object.freeze(Object.keys(exports.DEFAULT_OPTIONS));
28
25
  exports.LOG_LEVELS = {
29
26
  'LOG': 0,
30
27
  'WARN': 1,
@@ -33,14 +30,14 @@ exports.LOG_LEVELS = {
33
30
  const internalOptions = {
34
31
  deleteDBAfterStopped: 'true',
35
32
  //mysqlmsn = MySQL Memory Server Node.js
36
- dbPath: (0, path_1.normalize)(`${(0, os_1.tmpdir)()}/mysqlmsn/dbs/${(0, crypto_1.randomUUID)().replace(/-/g, '')}`),
33
+ databaseDirectoryPath: (0, path_1.normalize)(`${(0, os_1.tmpdir)()}/mysqlmsn/dbs`),
37
34
  binaryDirectoryPath: `${(0, os_1.tmpdir)()}/mysqlmsn/binaries`,
38
35
  cli: 'false'
39
36
  };
40
37
  function getInternalEnvVariable(envVar) {
41
38
  return process.env['mysqlmsn_internal_DO_NOT_USE_' + envVar] || internalOptions[envVar];
42
39
  }
43
- const allowedArches = ['x64', 'arm64', undefined];
40
+ const allowedArches = ['x64', 'arm64'];
44
41
  exports.OPTION_TYPE_CHECKS = {
45
42
  version: {
46
43
  check: (opt) => opt === undefined || typeof opt === 'string' && (0, semver_1.valid)((0, semver_1.coerce)(opt)) !== null,
@@ -108,8 +105,88 @@ exports.OPTION_TYPE_CHECKS = {
108
105
  definedType: 'string'
109
106
  },
110
107
  arch: {
111
- check: (opt) => allowedArches.includes(opt),
108
+ check: (opt) => opt === undefined || allowedArches.includes(opt),
112
109
  errorMessage: `Option arch must be either of the following: ${allowedArches.join(', ')}`,
113
110
  definedType: 'string'
114
111
  }
115
112
  };
113
+ exports.MIN_SUPPORTED_MYSQL = '5.7.19';
114
+ exports.downloadsBaseURL = 'https://cdn.mysql.com//Downloads/MySQL-';
115
+ exports.archiveBaseURL = 'https://cdn.mysql.com/archives/mysql-';
116
+ // Versions 8.0.29, 8.0.38, 8.4.1, and 9.0.0 have been purposefully left out of this list as MySQL has removed them from the CDN due to critical issues.
117
+ exports.DOWNLOADABLE_MYSQL_VERSIONS = [
118
+ '5.7.19', '5.7.20', '5.7.21', '5.7.22', '5.7.23', '5.7.24', '5.7.25', '5.7.26', '5.7.27', '5.7.28', '5.7.29', '5.7.30', '5.7.31', '5.7.32', '5.7.33', '5.7.34', '5.7.35', '5.7.36', '5.7.37', '5.7.38', '5.7.39', '5.7.40', '5.7.41', '5.7.42', '5.7.43', '5.7.44',
119
+ '8.0.0', '8.0.1', '8.0.2', '8.0.3', '8.0.4',
120
+ '8.0.11', '8.0.12', '8.0.13', '8.0.14', '8.0.15', '8.0.16', '8.0.17', '8.0.18', '8.0.19', '8.0.20', '8.0.21', '8.0.22', '8.0.23', '8.0.24', '8.0.25', '8.0.26', '8.0.27', '8.0.28', '8.0.30', '8.0.31', '8.0.32', '8.0.33', '8.0.34', '8.0.35', '8.0.36', '8.0.37', '8.0.39', '8.0.40', '8.0.41',
121
+ '8.1.0', '8.2.0', '8.3.0',
122
+ '8.4.0', '8.4.2', '8.4.3', '8.4.4',
123
+ '9.0.1', '9.1.0', '9.2.0'
124
+ ];
125
+ exports.MYSQL_ARCH_SUPPORT = {
126
+ darwin: {
127
+ arm64: '8.0.26 - 9.2.0',
128
+ x64: '5.7.19 - 9.2.0'
129
+ },
130
+ linux: {
131
+ arm64: '8.0.31 - 9.2.0',
132
+ x64: '5.7.19 - 9.2.0'
133
+ },
134
+ win32: {
135
+ x64: '5.7.19 - 9.2.0'
136
+ }
137
+ };
138
+ exports.MYSQL_MIN_OS_SUPPORT = {
139
+ win32: {
140
+ x: '0.0.0' // No minimum version is documented as far as I can tell, so allow any minimum version
141
+ },
142
+ linux: {
143
+ x: '0.0.0' // No minimum version is documented as far as I can tell, so allow any minimum version
144
+ },
145
+ darwin: {
146
+ '5.7.19 - 5.7.23 || 8.0.1 - 8.0.3 || 8.0.11 - 8.0.12': '16.0.0',
147
+ '5.7.24 - 5.7.29 || 8.0.4 || 8.0.13 - 8.0.18': '17.0.0',
148
+ '5.7.30 - 5.7.31 || 8.0.19 - 8.0.22': '18.0.0',
149
+ //5.7.32 - 5.7.44 is not supported for macOS by MySQL. Those versions are not appearing in this list
150
+ '8.0.0': '13.0.0',
151
+ '8.0.23 - 8.0.27': '19.0.0',
152
+ '8.0.28 - 8.0.31': '20.0.0',
153
+ '8.0.32 - 8.0.34': '21.0.0',
154
+ '8.0.35 - 8.0.39 || 8.1.0 - 8.4.2 || 9.0.1': '22.0.0',
155
+ '8.0.40 - 8.0.41 || 8.4.3 - 8.4.4 || 9.1.0 - 9.2.0': '23.0.0'
156
+ }
157
+ };
158
+ exports.DMR_MYSQL_VERSIONS = '8.0.0 - 8.0.2';
159
+ exports.RC_MYSQL_VERSIONS = '8.0.3 - 8.0.4';
160
+ exports.MYSQL_MACOS_VERSIONS_IN_FILENAME = {
161
+ '5.7.19 - 5.7.20 || 8.0.1 - 8.0.3': 'macos10.12',
162
+ '5.7.21 - 5.7.23 || 8.0.4 - 8.0.12': 'macos10.13',
163
+ '5.7.24 - 5.7.31 || 8.0.13 - 8.0.18': 'macos10.14',
164
+ '8.0.0': 'osx10.11',
165
+ '8.0.19 - 8.0.23': 'macos10.15',
166
+ '8.0.24 - 8.0.28': 'macos11',
167
+ '8.0.30 - 8.0.31': 'macos12',
168
+ '8.0.32 - 8.0.35 || 8.1.0 - 8.2.0': 'macos13',
169
+ '8.0.36 - 8.0.40 || 8.3.0 - 8.4.3 || 9.0.1 - 9.1.0': 'macos14',
170
+ '8.0.41 || 8.4.4 || 9.2.0': 'macos15'
171
+ };
172
+ exports.MYSQL_LINUX_GLIBC_VERSIONS = {
173
+ '5.7.19 - 8.0.20': '2.12',
174
+ '8.0.21 - 9.2.0': '2.17'
175
+ };
176
+ exports.MYSQL_LINUX_MINIMAL_INSTALL_AVAILABLE = {
177
+ '5.7.19 - 8.0.15': 'no',
178
+ '8.0.16 - 8.0.20': 'no-glibc-tag',
179
+ '8.0.21 - 9.2.0': 'glibc-tag'
180
+ };
181
+ exports.MYSQL_LINUX_MINIMAL_INSTALL_AVAILABLE_ARM64 = '>=8.0.33';
182
+ exports.MYSQL_LINUX_FILE_EXTENSIONS = {
183
+ x64: {
184
+ '5.7.19 - 8.0.11': 'gz',
185
+ '8.0.12 - 9.2.0': 'xz'
186
+ },
187
+ arm64: {
188
+ '8.0.31 - 8.0.32': 'gz',
189
+ '8.0.33 - 9.2.0': 'xz'
190
+ }
191
+ };
192
+ exports.MYSQL_LINUX_MINIMAL_REBUILD_VERSIONS = '8.0.26';
package/dist/src/index.js CHANGED
@@ -1,54 +1,19 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
36
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
4
  };
38
5
  Object.defineProperty(exports, "__esModule", { value: true });
39
6
  exports.createDB = createDB;
40
7
  const Logger_1 = __importDefault(require("./libraries/Logger"));
41
- const os = __importStar(require("node:os"));
42
8
  const Executor_1 = __importDefault(require("./libraries/Executor"));
43
9
  const semver_1 = require("semver");
44
10
  const Version_1 = __importDefault(require("./libraries/Version"));
45
- const versions_json_1 = __importDefault(require("./versions.json"));
46
11
  const Downloader_1 = require("./libraries/Downloader");
47
12
  const constants_1 = require("./constants");
48
13
  async function createDB(opts) {
49
14
  const suppliedOpts = opts || {};
50
15
  const suppliedOptsKeys = Object.keys(suppliedOpts);
51
- const options = (0, constants_1.DEFAULT_OPTIONS_GENERATOR)();
16
+ const options = { ...constants_1.DEFAULT_OPTIONS };
52
17
  for (const opt of suppliedOptsKeys) {
53
18
  if (!constants_1.DEFAULT_OPTIONS_KEYS.includes(opt)) {
54
19
  throw `Option ${opt} is not a valid option.`;
@@ -73,22 +38,7 @@ async function createDB(opts) {
73
38
  if (version === null || (options.version && !(0, semver_1.satisfies)(version.version, options.version)) || unsupportedMySQLIsInstalled) {
74
39
  let binaryInfo;
75
40
  let binaryFilepath;
76
- try {
77
- binaryInfo = (0, Version_1.default)(versions_json_1.default, options.version, options);
78
- logger.log('Using MySQL binary version:', binaryInfo.version, 'from URL:', binaryInfo.url);
79
- }
80
- catch (e) {
81
- if (options.version && (0, semver_1.lt)((0, semver_1.coerce)(options.version), constants_1.MIN_SUPPORTED_MYSQL)) {
82
- //The difference between the throw here and the throw above is this throw is because the selected "version" is not supported.
83
- //The throw above is because the system-installed MySQL is out of date and "ignoreUnsupportedSystemVersion" is not set to true.
84
- throw `The selected version of MySQL (${options.version}) is not currently supported by this package. Please choose a different version to use.`;
85
- }
86
- logger.error(e);
87
- if (options.version) {
88
- throw `A MySQL version ${options.version} binary could not be found that supports your OS (${os.platform()} | ${os.version()} | ${os.release()}) and CPU architecture (${os.arch()}). Please check you have the latest version of mysql-memory-server. If the latest version still doesn't support the version you want to use, feel free to make a pull request to add support!`;
89
- }
90
- throw `A MySQL binary could not be found that supports your OS (${os.platform()} | ${os.version()} | ${os.release()}) and CPU architecture (${os.arch()}). Please check you have the latest version of mysql-memory-server. If the latest version still doesn't support your OS and CPU architecture, feel free to make a pull request to add support!`;
91
- }
41
+ binaryInfo = (0, Version_1.default)(options.version, options.arch);
92
42
  try {
93
43
  binaryFilepath = await (0, Downloader_1.downloadBinary)(binaryInfo, options, logger);
94
44
  }
@@ -1,4 +1,3 @@
1
1
  import Logger from './Logger';
2
2
  import { BinaryInfo, InternalServerOptions } from '../../types';
3
- export declare function downloadVersions(): Promise<string>;
4
3
  export declare function downloadBinary(binaryInfo: BinaryInfo, options: InternalServerOptions, logger: Logger): Promise<string>;