mysql-memory-server 1.7.1 → 1.8.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
@@ -98,10 +98,13 @@ The name of the user to use to login to the database
98
98
  If on Windows, this is the name of the named pipe that MySQL is listening on. If not on Windows, this is the path to the socket that MySQL is listening on.
99
99
  - `xSocket: string`
100
100
  If on Windows, this is the name of the named pipe that the MySQL X Plugin is listening on. If not on Windows, this is the path that the MySQL X Plugin is listening on.
101
+ - `mysql: {version: string, versionIsInstalledOnSystem: boolean}`
102
+ An object with two properties. ```version``` is the version of MySQL used to create the database. ```versionIsInstalledOnSystem``` will be true if the MySQL version used is already installed on the system and false if the version had to be downloaded from MySQL's CDN.
101
103
  - `stop: () => Promise<void>`
102
104
  The method to stop the database. The returned promise resolves when the database has successfully stopped.
103
105
 
104
106
  #### Options:
107
+ ##### For options that are not required, using ```undefined``` as a value will use the option's default value.
105
108
  - `version: string`
106
109
 
107
110
  Required: No
@@ -132,7 +135,7 @@ Required: No
132
135
 
133
136
  Default: "ERROR"
134
137
 
135
- Description: Log level for the database. If "ERROR" is used, only errors will show up in the console. If "WARN" is used, warnings and errors will show up in the console. If "LOG" is used, everything will show up in the console.
138
+ Description: Log level for this package. If "ERROR" is used, only errors from this package will show up in the console. If "WARN" is used, warnings and errors from this package will show up in the console. If "LOG" is used, every log from this package will show up in the console.
136
139
 
137
140
  - `portRetries: number`
138
141
 
@@ -140,7 +143,7 @@ Required: No
140
143
 
141
144
  Default: 10
142
145
 
143
- Description: Number of times to try connecting MySQL to a randomly generated port before giving up. According to the [MySQL Documentation](https://dev.mysql.com/doc/refman/en/server-options.html#option_mysqld_port "MySQL Documentation") if port 0 is used as the MySQL server port, the default value (3306) will be used. To get around this, a random number between 1025 - 65535 (inclusive) is generated and used for the database's port. If MySQL cannot successfully listen on a randomly generated port after `portRetries` then the `createDB()` promise is rejected. A warning is created when MySQL tries connecting to a port that is already in use.
146
+ Description: Number of times to try connecting MySQL to a randomly generated port before giving up. According to the [MySQL Documentation](https://dev.mysql.com/doc/refman/en/server-options.html#option_mysqld_port "MySQL Documentation") if port 0 is used as the MySQL server port, the default value (3306) will be used. To get around this, a random number between 1025 - 65535 (inclusive) is generated and used for the database's port. If MySQL cannot successfully listen on a randomly generated port after `portRetries` then the `createDB()` promise is rejected. A warning is created when MySQL tries connecting to a port that is already in use. This option only applies for the MySQL port if the MySQL port is not explicitly set or if it's set to 0. This option also only applies for the MySQL X port if the MySQL X port is not explicitly set or if it's set to 0.
144
147
 
145
148
  - `downloadBinaryOnce: boolean`
146
149
 
@@ -158,7 +161,7 @@ Required: No
158
161
 
159
162
  Default: 1,000
160
163
 
161
- Description: If `downloadBinaryOnce` is set to `true`, `lockRetries` is the number of times to check to see if the lock for the binary has been released (meaning it has been successfully downloaded and extracted). If the number of retries exceeds `lockRetries`, the `createDB()` promise gets rejected.
164
+ Description: If `downloadBinaryOnce` is set to `true`, `lockRetries` is the number of times to check to see if the lock for the binary has been released (meaning it has been successfully downloaded and extracted). If the number of retries exceeds `lockRetries`, the `createDB()` promise gets rejected. This option is also used for the number of times to check to see if the lock for libaio has been released (only on Linux distros that use libaio1t64 instead of libaio1)
162
165
 
163
166
  - `lockRetryWait: number`
164
167
 
@@ -166,7 +169,7 @@ Required: No
166
169
 
167
170
  Default: 1,000
168
171
 
169
- Description: If `downloadBinaryOnce` is set to `true`, `lockRetryWait` is the number of milliseconds to wait before checking if the lock has been released.
172
+ Description: If `downloadBinaryOnce` is set to `true` and/or on Linux distros that use libaio1t64 instead of libaio1, `lockRetryWait` is the number of milliseconds to wait before checking if the lock has been released.
170
173
 
171
174
  - `username: string`
172
175
 
@@ -218,10 +221,18 @@ Description: A string with MySQL queries to run before the database starts to ac
218
221
 
219
222
  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
223
 
224
+ - `arch: "arm64" | "x64"`
225
+
226
+ Required: No
227
+
228
+ Default: process.arch
229
+
230
+ Description: The MySQL binary architecture to execute. MySQL does not offer server builds for Windows on ARM, so to get this package working on Windows on ARM, set the arch option to "x64" and Windows will emulate MySQL.
231
+
221
232
  ***
222
233
  ### :warning: Internal Options :warning:
223
234
 
224
- The following options are only meant for internal use (such as CI or the internals for running this package via the CLI). Their behaviour may change or they may get removed between major/minor/patch versions and they are not to be considered stable. The options below will not follow Semantic Versioning so it is advised to not use them.
235
+ The following options are only meant for internal use (such as for testing this package or the internals for running this package via the CLI). Their behaviour may change or they may get removed between major/minor/patch versions and they are not to be considered stable. The options below will not follow Semantic Versioning so it is advised to not use them.
225
236
 
226
237
  - `_DO_NOT_USE_deleteDBAfterStopped: boolean`
227
238
 
@@ -241,18 +252,8 @@ Default: `TMPDIR/mysqlmsn/binaries` (replacing TMPDIR with the OS temp directory
241
252
 
242
253
  Description: The folder to store the MySQL binaries when they are downloaded from the CDN.
243
254
 
244
- - `_DO_NOT_USE_beforeSignalCleanupMessage: string`
245
-
246
- Required: No
247
-
248
- Default: undefined
249
-
250
- Description: The message to get displayed in the console before the cleanup that happens when the Node.js process is stopped without the ```stop()``` method being called first.
251
-
252
- - `_DO_NOT_USE_afterSignalCleanupMessage: string`
255
+ - `_DO_NOT_USE_cli: boolean`
253
256
 
254
- Required: No
255
-
256
- Default: undefined
257
+ Default: ```false``` if the package is not being executed via the CLI and ```true``` if it is.
257
258
 
258
- Description: The message to get displayed in the console after the cleanup that happens when the Node.js process is stopped without the ```stop()``` method being called first.
259
+ Description: If set to ```true```, this enables certain CLI-only functionality. For example, when ran by the CLI, logging a message to the console when a shutdown signal (like CTRL + C) has been received and the MySQL database is shutting down and getting deleted.
package/dist/src/cli.js CHANGED
@@ -6,8 +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 ephemeral MySQL database and cleaning all related files...',
10
- _DO_NOT_USE_afterSignalCleanupMessage: 'Shutdown and cleanup is complete.'
9
+ _DO_NOT_USE_cli: true
11
10
  };
12
11
  for (const opt of definedOptions) {
13
12
  const index = process.argv.indexOf(opt);
@@ -41,7 +40,7 @@ async function main() {
41
40
  }
42
41
  console.log('Creating ephemeral MySQL database...');
43
42
  const db = await (0, index_1.createDB)(options);
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`);
43
+ console.log(`A MySQL database has been successfully created with the following parameters:\n\nMySQL Version: ${db.mysql.version} (${db.mysql.versionIsInstalledOnSystem ? 'installed on this system' : 'not installed on this system - downloaded from the MySQL CDN'}) \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
44
  if (process.platform === 'win32') {
46
45
  //The connection information logs will be different for Windows compared to other platforms.
47
46
  //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.
@@ -20,12 +20,12 @@ const DEFAULT_OPTIONS_GENERATOR = () => ({
20
20
  xPort: 0,
21
21
  downloadRetries: 10,
22
22
  initSQLString: '',
23
+ arch: process.arch,
23
24
  _DO_NOT_USE_deleteDBAfterStopped: true,
24
25
  //mysqlmsn = MySQL Memory Server Node.js
25
26
  _DO_NOT_USE_dbPath: (0, path_1.normalize)(`${(0, os_1.tmpdir)()}/mysqlmsn/dbs/${(0, crypto_1.randomUUID)().replace(/-/g, '')}`),
26
27
  _DO_NOT_USE_binaryDirectoryPath: `${(0, os_1.tmpdir)()}/mysqlmsn/binaries`,
27
- _DO_NOT_USE_beforeSignalCleanupMessage: '',
28
- _DO_NOT_USE_afterSignalCleanupMessage: ''
28
+ _DO_NOT_USE_cli: false
29
29
  });
30
30
  exports.DEFAULT_OPTIONS_GENERATOR = DEFAULT_OPTIONS_GENERATOR;
31
31
  exports.DEFAULT_OPTIONS_KEYS = Object.freeze(Object.keys((0, exports.DEFAULT_OPTIONS_GENERATOR)()));
@@ -35,9 +35,10 @@ exports.LOG_LEVELS = {
35
35
  'ERROR': 2
36
36
  };
37
37
  exports.INTERNAL_OPTIONS = ['_DO_NOT_USE_deleteDBAfterStopped', '_DO_NOT_USE_dbPath', '_DO_NOT_USE_binaryDirectoryPath', '_DO_NOT_USE_beforeSignalCleanup', '_DO_NOT_USE_afterSignalCleanup'];
38
+ const allowedArches = ['x64', 'arm64', undefined];
38
39
  exports.OPTION_TYPE_CHECKS = {
39
40
  version: {
40
- check: (opt) => opt === undefined || typeof opt === 'string' && (0, semver_1.valid)(opt) !== null,
41
+ check: (opt) => opt === undefined || typeof opt === 'string' && (0, semver_1.valid)((0, semver_1.coerce)(opt)) !== null,
41
42
  errorMessage: 'Option version must be either undefined or a valid semver string.',
42
43
  definedType: 'string'
43
44
  },
@@ -101,6 +102,11 @@ exports.OPTION_TYPE_CHECKS = {
101
102
  errorMessage: 'Option initSQLString must be either undefined or a string.',
102
103
  definedType: 'string'
103
104
  },
105
+ arch: {
106
+ check: (opt) => allowedArches.includes(opt),
107
+ errorMessage: `Option arch must be either of the following: ${allowedArches.join(', ')}`,
108
+ definedType: 'string'
109
+ },
104
110
  _DO_NOT_USE_deleteDBAfterStopped: {
105
111
  check: (opt) => opt === undefined || typeof opt === 'boolean',
106
112
  errorMessage: 'Option _DO_NOT_USE_deleteDBAfterStopped must be either undefined or a boolean.',
@@ -116,14 +122,9 @@ exports.OPTION_TYPE_CHECKS = {
116
122
  errorMessage: 'Option _DO_NOT_USE_binaryDirectoryPath must be either undefined or a string.',
117
123
  definedType: 'string'
118
124
  },
119
- _DO_NOT_USE_beforeSignalCleanupMessage: {
120
- check: (opt) => opt === undefined || typeof opt === 'string',
121
- errorMessage: 'Option _DO_NOT_USE_beforeSignalCleanup must be either undefined or a string.',
122
- definedType: 'string'
123
- },
124
- _DO_NOT_USE_afterSignalCleanupMessage: {
125
- check: (opt) => opt === undefined || typeof opt === 'string',
126
- errorMessage: 'Option _DO_NOT_USE_afterSignalCleanup must be either undefined or a string.',
127
- definedType: 'string'
125
+ _DO_NOT_USE_cli: {
126
+ check: (opt) => opt === undefined || typeof opt === 'boolean',
127
+ errorMessage: 'Option _DO_NOT_USE_cli must be either undefined or a boolean.',
128
+ definedType: 'boolean'
128
129
  }
129
130
  };
package/dist/src/index.js CHANGED
@@ -60,7 +60,7 @@ async function createDB(opts) {
60
60
  }
61
61
  if (!constants_1.OPTION_TYPE_CHECKS[opt].check(suppliedOpts[opt])) {
62
62
  //Supplied option failed the check
63
- throw constants_1.OPTION_TYPE_CHECKS[opt].errorMessage;
63
+ throw `${constants_1.OPTION_TYPE_CHECKS[opt].errorMessage} | Received value: ${suppliedOpts[opt]} (type: ${typeof suppliedOpts[opt]})`;
64
64
  }
65
65
  if (suppliedOpts[opt] !== undefined) {
66
66
  options[opt] = suppliedOpts[opt];
@@ -84,7 +84,7 @@ async function createDB(opts) {
84
84
  let binaryInfo;
85
85
  let binaryFilepath;
86
86
  try {
87
- binaryInfo = (0, Version_1.default)(versions_json_1.default, options.version);
87
+ binaryInfo = (0, Version_1.default)(versions_json_1.default, options.version, options);
88
88
  logger.log('Using MySQL binary version:', binaryInfo.version, 'from URL:', binaryInfo.url);
89
89
  }
90
90
  catch (e) {
@@ -102,10 +102,10 @@ async function createDB(opts) {
102
102
  throw `Failed to download binary. The error was: "${error}"`;
103
103
  }
104
104
  logger.log('Running downloaded binary');
105
- return await executor.startMySQL(options, binaryFilepath);
105
+ return await executor.startMySQL(options, { path: binaryFilepath, version: binaryInfo.version, installedOnSystem: false });
106
106
  }
107
107
  else {
108
108
  logger.log(version);
109
- return await executor.startMySQL(options, version.path);
109
+ return await executor.startMySQL(options, version);
110
110
  }
111
111
  }
@@ -1,12 +1,14 @@
1
1
  import Logger from "./Logger";
2
- import { InstalledMySQLVersion, InternalServerOptions, MySQLDB } from "../../types";
2
+ import { DownloadedMySQLVersion, InternalServerOptions, MySQLDB } from "../../types";
3
3
  declare class Executor {
4
4
  #private;
5
5
  logger: Logger;
6
6
  DBDestroySignal: AbortController;
7
7
  removeExitHandler: () => void;
8
+ version: string;
9
+ versionInstalledOnSystem: boolean;
8
10
  constructor(logger: Logger);
9
- getMySQLVersion(preferredVersion?: string): Promise<InstalledMySQLVersion | null>;
10
- startMySQL(options: InternalServerOptions, binaryFilepath: string): Promise<MySQLDB>;
11
+ getMySQLVersion(preferredVersion?: string): Promise<DownloadedMySQLVersion | null>;
12
+ startMySQL(options: InternalServerOptions, installedMySQLBinary: DownloadedMySQLVersion): Promise<MySQLDB>;
11
13
  }
12
14
  export default Executor;
@@ -78,7 +78,7 @@ class Executor {
78
78
  return reject('Could not get MySQL version');
79
79
  }
80
80
  else {
81
- versions.push({ version: version.version, path });
81
+ versions.push({ version: version.version, path, installedOnSystem: true });
82
82
  }
83
83
  }
84
84
  if (preferredVersion) {
@@ -108,16 +108,18 @@ class Executor {
108
108
  reject('Could not get installed MySQL version');
109
109
  }
110
110
  else {
111
- resolve({ version: version.version, path: 'mysqld' });
111
+ resolve({ version: version.version, path: 'mysqld', installedOnSystem: true });
112
112
  }
113
113
  }
114
114
  }
115
115
  });
116
116
  }
117
- async startMySQL(options, binaryFilepath) {
117
+ async startMySQL(options, installedMySQLBinary) {
118
+ this.version = installedMySQLBinary.version;
119
+ this.versionInstalledOnSystem = installedMySQLBinary.installedOnSystem;
118
120
  this.removeExitHandler = (0, signal_exit_1.onExit)(() => {
119
- if (options._DO_NOT_USE_beforeSignalCleanupMessage) {
120
- console.log(options._DO_NOT_USE_beforeSignalCleanupMessage);
121
+ if (options._DO_NOT_USE_cli) {
122
+ console.log('\nShutting down the ephemeral MySQL database and cleaning all related files...');
121
123
  }
122
124
  this.DBDestroySignal.abort();
123
125
  if (options._DO_NOT_USE_deleteDBAfterStopped) {
@@ -128,7 +130,7 @@ class Executor {
128
130
  this.logger.error('An error occurred while deleting database directory path:', e);
129
131
  }
130
132
  }
131
- const binaryPathToDelete = __classPrivateFieldGet(this, _Executor_instances, "m", _Executor_returnBinaryPathToDelete).call(this, binaryFilepath, options);
133
+ const binaryPathToDelete = __classPrivateFieldGet(this, _Executor_instances, "m", _Executor_returnBinaryPathToDelete).call(this, installedMySQLBinary.path, options);
132
134
  if (binaryPathToDelete) {
133
135
  try {
134
136
  fs.rmSync(binaryPathToDelete, { force: true, recursive: true, maxRetries: 50 });
@@ -137,21 +139,21 @@ class Executor {
137
139
  this.logger.error('An error occurred while deleting database binary:', e);
138
140
  }
139
141
  }
140
- if (options._DO_NOT_USE_afterSignalCleanupMessage) {
141
- console.log(options._DO_NOT_USE_afterSignalCleanupMessage);
142
+ if (options._DO_NOT_USE_cli) {
143
+ console.log('Shutdown and cleanup is complete.');
142
144
  }
143
145
  });
144
146
  let retries = 0;
145
147
  const datadir = (0, path_1.normalize)(`${options._DO_NOT_USE_dbPath}/data`);
146
148
  do {
147
- await __classPrivateFieldGet(this, _Executor_instances, "m", _Executor_setupDataDirectories).call(this, options, binaryFilepath, datadir, true);
149
+ await __classPrivateFieldGet(this, _Executor_instances, "m", _Executor_setupDataDirectories).call(this, options, installedMySQLBinary.path, datadir, true);
148
150
  this.logger.log('Setting up directories was successful');
149
151
  const port = options.port || (0, Port_1.GenerateRandomPort)();
150
152
  const mySQLXPort = options.xPort || (0, Port_1.GenerateRandomPort)();
151
153
  this.logger.log('Using port:', port, 'and MySQLX port:', mySQLXPort, 'on retry:', retries);
152
154
  try {
153
155
  this.logger.log('Starting MySQL process');
154
- const resolved = await __classPrivateFieldGet(this, _Executor_instances, "m", _Executor_startMySQLProcess).call(this, options, port, mySQLXPort, datadir, options._DO_NOT_USE_dbPath, binaryFilepath);
156
+ const resolved = await __classPrivateFieldGet(this, _Executor_instances, "m", _Executor_startMySQLProcess).call(this, options, port, mySQLXPort, datadir, options._DO_NOT_USE_dbPath, installedMySQLBinary.path);
155
157
  this.logger.log('Starting process was successful');
156
158
  return resolved;
157
159
  }
@@ -327,6 +329,10 @@ _Executor_instances = new WeakSet(), _Executor_executeFile = function _Executor_
327
329
  xSocket,
328
330
  dbName: options.dbName,
329
331
  username: options.username,
332
+ mysql: {
333
+ version: this.version,
334
+ versionIsInstalledOnSystem: this.versionInstalledOnSystem
335
+ },
330
336
  stop: () => {
331
337
  return new Promise(async (resolve, reject) => {
332
338
  resolveFunction = resolve;
@@ -1,5 +1,5 @@
1
- import { MySQLVersion } from "../../types";
2
- export default function getBinaryURL(versions: MySQLVersion[], versionToGet?: string): {
1
+ import { InternalServerOptions, MySQLVersion } from "../../types";
2
+ export default function getBinaryURL(versions: MySQLVersion[], versionToGet: string, options: InternalServerOptions): {
3
3
  url: string;
4
4
  version: string;
5
5
  };
@@ -36,11 +36,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.default = getBinaryURL;
37
37
  const os = __importStar(require("os"));
38
38
  const semver_1 = require("semver");
39
- function getBinaryURL(versions, versionToGet = "9.x") {
39
+ function getBinaryURL(versions, versionToGet = "x", options) {
40
40
  let availableVersions = versions;
41
- availableVersions = availableVersions.filter(v => v.arch === process.arch);
41
+ availableVersions = availableVersions.filter(v => v.arch === options.arch);
42
42
  if (availableVersions.length === 0)
43
- throw `No MySQL binary could be found for your CPU architecture: ${process.arch}`;
43
+ throw `No MySQL binary could be found for your CPU architecture: ${options.arch}. ${process.platform === 'win32' && process.arch === 'arm64' ? 'This package has detected you are running Windows on ARM. MySQL does not support Windows on ARM. To get this package working, please try setting the "arch" option to "x64".' : ''}`;
44
44
  availableVersions = availableVersions.filter(v => v.os === process.platform);
45
45
  if (availableVersions.length === 0)
46
46
  throw `No MySQL binary could be found for your OS: ${process.platform}`;
@@ -14,11 +14,11 @@ export type ServerOptions = {
14
14
  xPort?: number | undefined;
15
15
  downloadRetries?: number | undefined;
16
16
  initSQLString?: string | undefined;
17
+ arch?: "arm64" | "x64" | undefined;
17
18
  _DO_NOT_USE_deleteDBAfterStopped?: boolean | undefined;
18
19
  _DO_NOT_USE_dbPath?: string | undefined;
19
20
  _DO_NOT_USE_binaryDirectoryPath?: string | undefined;
20
- _DO_NOT_USE_beforeSignalCleanupMessage?: string | undefined;
21
- _DO_NOT_USE_afterSignalCleanupMessage?: string | undefined;
21
+ _DO_NOT_USE_cli?: boolean | undefined;
22
22
  };
23
23
  export type InternalServerOptions = {
24
24
  version?: string | undefined;
@@ -34,11 +34,11 @@ export type InternalServerOptions = {
34
34
  xPort: number;
35
35
  downloadRetries: number;
36
36
  initSQLString: string;
37
+ arch: string;
37
38
  _DO_NOT_USE_deleteDBAfterStopped: boolean;
38
39
  _DO_NOT_USE_dbPath: string;
39
40
  _DO_NOT_USE_binaryDirectoryPath: string;
40
- _DO_NOT_USE_beforeSignalCleanupMessage: string;
41
- _DO_NOT_USE_afterSignalCleanupMessage: string;
41
+ _DO_NOT_USE_cli: boolean;
42
42
  };
43
43
  export type ExecutorOptions = {
44
44
  logLevel: LOG_LEVEL;
@@ -55,6 +55,10 @@ export type MySQLDB = {
55
55
  xSocket: string;
56
56
  dbName: string;
57
57
  username: string;
58
+ mysql: {
59
+ version: string;
60
+ versionIsInstalledOnSystem: boolean;
61
+ };
58
62
  stop: () => Promise<void>;
59
63
  };
60
64
  export type MySQLVersion = {
@@ -64,9 +68,10 @@ export type MySQLVersion = {
64
68
  osKernelVersionsSupported: string;
65
69
  url: string;
66
70
  };
67
- export type InstalledMySQLVersion = {
71
+ export type DownloadedMySQLVersion = {
68
72
  version: string;
69
73
  path: string;
74
+ installedOnSystem: boolean;
70
75
  };
71
76
  export type BinaryInfo = {
72
77
  url: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mysql-memory-server",
3
- "version": "1.7.1",
3
+ "version": "1.8.0",
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",
@@ -1,2 +0,0 @@
1
- declare const DBDestroySignal: AbortController;
2
- export default DBDestroySignal;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const DBDestroySignal = new AbortController();
4
- function abortSignal() {
5
- if (!DBDestroySignal.signal.aborted) {
6
- DBDestroySignal.abort('Process is exiting');
7
- }
8
- }
9
- process.on('beforeExit', abortSignal);
10
- process.on('exit', abortSignal);
11
- exports.default = DBDestroySignal;