mysqlsyncr 1.0.68 → 1.0.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/index.cjs +29 -12
- package/dist/index.js +29 -12
- package/package.json +1 -1
- package/src/differences.js +1 -1
- package/src/socketServer.js +26 -8
package/dist/index.cjs
CHANGED
|
@@ -2288,13 +2288,13 @@ const y18n = (opts) => {
|
|
|
2288
2288
|
const REQUIRE_ERROR = 'require is not supported by ESM';
|
|
2289
2289
|
const REQUIRE_DIRECTORY_ERROR = 'loading a directory of commands is not supported yet for ESM';
|
|
2290
2290
|
|
|
2291
|
-
let __dirname$
|
|
2291
|
+
let __dirname$3;
|
|
2292
2292
|
try {
|
|
2293
|
-
__dirname$
|
|
2293
|
+
__dirname$3 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
|
2294
2294
|
} catch (e) {
|
|
2295
|
-
__dirname$
|
|
2295
|
+
__dirname$3 = process.cwd();
|
|
2296
2296
|
}
|
|
2297
|
-
const mainFilename = __dirname$
|
|
2297
|
+
const mainFilename = __dirname$3.substring(0, __dirname$3.lastIndexOf('node_modules'));
|
|
2298
2298
|
|
|
2299
2299
|
({
|
|
2300
2300
|
assert: {
|
|
@@ -2340,7 +2340,7 @@ const mainFilename = __dirname$2.substring(0, __dirname$2.lastIndexOf('node_modu
|
|
|
2340
2340
|
return [...str].length
|
|
2341
2341
|
},
|
|
2342
2342
|
y18n: y18n({
|
|
2343
|
-
directory: path.resolve(__dirname$
|
|
2343
|
+
directory: path.resolve(__dirname$3, '../../../locales'),
|
|
2344
2344
|
updateFiles: false
|
|
2345
2345
|
})
|
|
2346
2346
|
});
|
|
@@ -3457,7 +3457,7 @@ var findDifferences = function findDifferences(expected, current) {
|
|
|
3457
3457
|
|
|
3458
3458
|
// Compare stored procedures
|
|
3459
3459
|
if (!expected.procedures) {
|
|
3460
|
-
console.log('No procedures found in expected
|
|
3460
|
+
console.log('No procedures found in expected');
|
|
3461
3461
|
} else {
|
|
3462
3462
|
var _loop6 = function _loop6() {
|
|
3463
3463
|
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i3], 2);
|
|
@@ -4232,6 +4232,8 @@ var compareAllDatabases = /*#__PURE__*/function () {
|
|
|
4232
4232
|
};
|
|
4233
4233
|
}();
|
|
4234
4234
|
|
|
4235
|
+
var __filename$1 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
|
4236
|
+
var __dirname$2 = path.dirname(__filename$1);
|
|
4235
4237
|
var setConfig = function setConfig(config, argv) {
|
|
4236
4238
|
if (!config.host && argv.host) {
|
|
4237
4239
|
config.host = argv.host;
|
|
@@ -4250,6 +4252,22 @@ var setConfig = function setConfig(config, argv) {
|
|
|
4250
4252
|
}
|
|
4251
4253
|
return config;
|
|
4252
4254
|
};
|
|
4255
|
+
|
|
4256
|
+
// Create a function to get the package root directory that works in both ESM and CJS
|
|
4257
|
+
var getPackageRoot = function getPackageRoot() {
|
|
4258
|
+
if (typeof __dirname$2 !== 'undefined') {
|
|
4259
|
+
// CommonJS
|
|
4260
|
+
return path.join(__dirname$2, '..');
|
|
4261
|
+
} else {
|
|
4262
|
+
// ESM
|
|
4263
|
+
var _filename = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
|
4264
|
+
var _dirname = path.dirname(_filename);
|
|
4265
|
+
return path.join(_dirname, '..');
|
|
4266
|
+
}
|
|
4267
|
+
};
|
|
4268
|
+
|
|
4269
|
+
// Use the function to get the root path
|
|
4270
|
+
var packageRoot = getPackageRoot();
|
|
4253
4271
|
var startApiServer = function startApiServer(port, argv) {
|
|
4254
4272
|
var app = express();
|
|
4255
4273
|
app.use(cors({
|
|
@@ -4263,9 +4281,8 @@ var startApiServer = function startApiServer(port, argv) {
|
|
|
4263
4281
|
limit: '50mb',
|
|
4264
4282
|
extended: true
|
|
4265
4283
|
}));
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
app.use(express["static"](path.join(__dirname, './ui/dist/spa')));
|
|
4284
|
+
console.log("Serving UI from ".concat(path.join(packageRoot, 'ui/dist/spa')));
|
|
4285
|
+
app.use(express["static"](path.join(packageRoot, 'ui/dist/spa')));
|
|
4269
4286
|
app.post('/api/getDatabasesFromExistingDumps', /*#__PURE__*/function () {
|
|
4270
4287
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(req, res) {
|
|
4271
4288
|
var config, databases;
|
|
@@ -4492,9 +4509,9 @@ var startApiServer = function startApiServer(port, argv) {
|
|
|
4492
4509
|
while (1) switch (_context8.prev = _context8.next) {
|
|
4493
4510
|
case 0:
|
|
4494
4511
|
_context8.prev = 0;
|
|
4495
|
-
_req$body$currentPath = req.body.currentPath, currentPath = _req$body$currentPath === undefined ?
|
|
4512
|
+
_req$body$currentPath = req.body.currentPath, currentPath = _req$body$currentPath === undefined ? packageRoot : _req$body$currentPath;
|
|
4496
4513
|
console.log('Browsing folder:', currentPath);
|
|
4497
|
-
resolvedPath = currentPath.startsWith('/') || currentPath.match(/^[A-Z]:\\/) ? path.resolve(currentPath) : path.resolve(
|
|
4514
|
+
resolvedPath = currentPath.startsWith('/') || currentPath.match(/^[A-Z]:\\/) ? path.resolve(currentPath) : path.resolve(currentPath);
|
|
4498
4515
|
console.log('Resolved path:', resolvedPath);
|
|
4499
4516
|
_context8.next = 7;
|
|
4500
4517
|
return fs$1.readdir(resolvedPath, {
|
|
@@ -4556,7 +4573,7 @@ var startApiServer = function startApiServer(port, argv) {
|
|
|
4556
4573
|
_context9.prev = 0;
|
|
4557
4574
|
folderPath = req.body.folderPath;
|
|
4558
4575
|
console.log('Creating folder:', folderPath);
|
|
4559
|
-
resolvedPath = folderPath.startsWith('/') || folderPath.match(/^[A-Z]:\\/) ? path.resolve(folderPath) : path.resolve(
|
|
4576
|
+
resolvedPath = folderPath.startsWith('/') || folderPath.match(/^[A-Z]:\\/) ? path.resolve(folderPath) : path.resolve(packageRoot, folderPath);
|
|
4560
4577
|
_context9.next = 6;
|
|
4561
4578
|
return fs$1.mkdir(resolvedPath, {
|
|
4562
4579
|
recursive: true
|
package/dist/index.js
CHANGED
|
@@ -2285,13 +2285,13 @@ const y18n = (opts) => {
|
|
|
2285
2285
|
const REQUIRE_ERROR = 'require is not supported by ESM';
|
|
2286
2286
|
const REQUIRE_DIRECTORY_ERROR = 'loading a directory of commands is not supported yet for ESM';
|
|
2287
2287
|
|
|
2288
|
-
let __dirname$
|
|
2288
|
+
let __dirname$3;
|
|
2289
2289
|
try {
|
|
2290
|
-
__dirname$
|
|
2290
|
+
__dirname$3 = fileURLToPath(import.meta.url);
|
|
2291
2291
|
} catch (e) {
|
|
2292
|
-
__dirname$
|
|
2292
|
+
__dirname$3 = process.cwd();
|
|
2293
2293
|
}
|
|
2294
|
-
const mainFilename = __dirname$
|
|
2294
|
+
const mainFilename = __dirname$3.substring(0, __dirname$3.lastIndexOf('node_modules'));
|
|
2295
2295
|
|
|
2296
2296
|
({
|
|
2297
2297
|
assert: {
|
|
@@ -2337,7 +2337,7 @@ const mainFilename = __dirname$2.substring(0, __dirname$2.lastIndexOf('node_modu
|
|
|
2337
2337
|
return [...str].length
|
|
2338
2338
|
},
|
|
2339
2339
|
y18n: y18n({
|
|
2340
|
-
directory: resolve(__dirname$
|
|
2340
|
+
directory: resolve(__dirname$3, '../../../locales'),
|
|
2341
2341
|
updateFiles: false
|
|
2342
2342
|
})
|
|
2343
2343
|
});
|
|
@@ -3454,7 +3454,7 @@ var findDifferences = function findDifferences(expected, current) {
|
|
|
3454
3454
|
|
|
3455
3455
|
// Compare stored procedures
|
|
3456
3456
|
if (!expected.procedures) {
|
|
3457
|
-
console.log('No procedures found in expected
|
|
3457
|
+
console.log('No procedures found in expected');
|
|
3458
3458
|
} else {
|
|
3459
3459
|
var _loop6 = function _loop6() {
|
|
3460
3460
|
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i3], 2);
|
|
@@ -4229,6 +4229,8 @@ var compareAllDatabases = /*#__PURE__*/function () {
|
|
|
4229
4229
|
};
|
|
4230
4230
|
}();
|
|
4231
4231
|
|
|
4232
|
+
var __filename = fileURLToPath(import.meta.url);
|
|
4233
|
+
var __dirname$2 = dirname(__filename);
|
|
4232
4234
|
var setConfig = function setConfig(config, argv) {
|
|
4233
4235
|
if (!config.host && argv.host) {
|
|
4234
4236
|
config.host = argv.host;
|
|
@@ -4247,6 +4249,22 @@ var setConfig = function setConfig(config, argv) {
|
|
|
4247
4249
|
}
|
|
4248
4250
|
return config;
|
|
4249
4251
|
};
|
|
4252
|
+
|
|
4253
|
+
// Create a function to get the package root directory that works in both ESM and CJS
|
|
4254
|
+
var getPackageRoot = function getPackageRoot() {
|
|
4255
|
+
if (typeof __dirname$2 !== 'undefined') {
|
|
4256
|
+
// CommonJS
|
|
4257
|
+
return join(__dirname$2, '..');
|
|
4258
|
+
} else {
|
|
4259
|
+
// ESM
|
|
4260
|
+
var _filename = fileURLToPath(import.meta.url);
|
|
4261
|
+
var _dirname = dirname(_filename);
|
|
4262
|
+
return join(_dirname, '..');
|
|
4263
|
+
}
|
|
4264
|
+
};
|
|
4265
|
+
|
|
4266
|
+
// Use the function to get the root path
|
|
4267
|
+
var packageRoot = getPackageRoot();
|
|
4250
4268
|
var startApiServer = function startApiServer(port, argv) {
|
|
4251
4269
|
var app = express();
|
|
4252
4270
|
app.use(cors({
|
|
@@ -4260,9 +4278,8 @@ var startApiServer = function startApiServer(port, argv) {
|
|
|
4260
4278
|
limit: '50mb',
|
|
4261
4279
|
extended: true
|
|
4262
4280
|
}));
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
app.use(express["static"](join(__dirname, './ui/dist/spa')));
|
|
4281
|
+
console.log("Serving UI from ".concat(join(packageRoot, 'ui/dist/spa')));
|
|
4282
|
+
app.use(express["static"](join(packageRoot, 'ui/dist/spa')));
|
|
4266
4283
|
app.post('/api/getDatabasesFromExistingDumps', /*#__PURE__*/function () {
|
|
4267
4284
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(req, res) {
|
|
4268
4285
|
var config, databases;
|
|
@@ -4489,9 +4506,9 @@ var startApiServer = function startApiServer(port, argv) {
|
|
|
4489
4506
|
while (1) switch (_context8.prev = _context8.next) {
|
|
4490
4507
|
case 0:
|
|
4491
4508
|
_context8.prev = 0;
|
|
4492
|
-
_req$body$currentPath = req.body.currentPath, currentPath = _req$body$currentPath === undefined ?
|
|
4509
|
+
_req$body$currentPath = req.body.currentPath, currentPath = _req$body$currentPath === undefined ? packageRoot : _req$body$currentPath;
|
|
4493
4510
|
console.log('Browsing folder:', currentPath);
|
|
4494
|
-
resolvedPath = currentPath.startsWith('/') || currentPath.match(/^[A-Z]:\\/) ? resolve(currentPath) : resolve(
|
|
4511
|
+
resolvedPath = currentPath.startsWith('/') || currentPath.match(/^[A-Z]:\\/) ? resolve(currentPath) : resolve(currentPath);
|
|
4495
4512
|
console.log('Resolved path:', resolvedPath);
|
|
4496
4513
|
_context8.next = 7;
|
|
4497
4514
|
return readdir(resolvedPath, {
|
|
@@ -4553,7 +4570,7 @@ var startApiServer = function startApiServer(port, argv) {
|
|
|
4553
4570
|
_context9.prev = 0;
|
|
4554
4571
|
folderPath = req.body.folderPath;
|
|
4555
4572
|
console.log('Creating folder:', folderPath);
|
|
4556
|
-
resolvedPath = folderPath.startsWith('/') || folderPath.match(/^[A-Z]:\\/) ? resolve(folderPath) : resolve(
|
|
4573
|
+
resolvedPath = folderPath.startsWith('/') || folderPath.match(/^[A-Z]:\\/) ? resolve(folderPath) : resolve(packageRoot, folderPath);
|
|
4557
4574
|
_context9.next = 6;
|
|
4558
4575
|
return mkdir(resolvedPath, {
|
|
4559
4576
|
recursive: true
|
package/package.json
CHANGED
package/src/differences.js
CHANGED
|
@@ -135,7 +135,7 @@ export const findDifferences = (expected, current) => {
|
|
|
135
135
|
|
|
136
136
|
// Compare stored procedures
|
|
137
137
|
if (!expected.procedures) {
|
|
138
|
-
console.log('No procedures found in expected
|
|
138
|
+
console.log('No procedures found in expected');
|
|
139
139
|
} else {
|
|
140
140
|
for (const [position, contents] of Object.entries(expected.procedures)) {
|
|
141
141
|
let procName = contents.Name;
|
package/src/socketServer.js
CHANGED
|
@@ -8,6 +8,11 @@ import cors from 'cors';
|
|
|
8
8
|
import { join } from 'path';
|
|
9
9
|
import { readdir, mkdir } from 'fs/promises';
|
|
10
10
|
import { resolve } from 'path';
|
|
11
|
+
import { fileURLToPath } from 'url';
|
|
12
|
+
import { dirname } from 'path';
|
|
13
|
+
|
|
14
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
15
|
+
const __dirname = dirname(__filename);
|
|
11
16
|
|
|
12
17
|
const setConfig = (config, argv) => {
|
|
13
18
|
if(!config.host && argv.host){
|
|
@@ -28,6 +33,22 @@ const setConfig = (config, argv) => {
|
|
|
28
33
|
return config;
|
|
29
34
|
}
|
|
30
35
|
|
|
36
|
+
// Create a function to get the package root directory that works in both ESM and CJS
|
|
37
|
+
const getPackageRoot = () => {
|
|
38
|
+
if (typeof __dirname !== 'undefined') {
|
|
39
|
+
// CommonJS
|
|
40
|
+
return join(__dirname, '..');
|
|
41
|
+
} else {
|
|
42
|
+
// ESM
|
|
43
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
44
|
+
const __dirname = dirname(__filename);
|
|
45
|
+
return join(__dirname, '..');
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// Use the function to get the root path
|
|
50
|
+
const packageRoot = getPackageRoot();
|
|
51
|
+
|
|
31
52
|
export const startApiServer = (port, argv) => {
|
|
32
53
|
const app = express();
|
|
33
54
|
app.use(cors({ origin: '*' }));
|
|
@@ -35,11 +56,8 @@ export const startApiServer = (port, argv) => {
|
|
|
35
56
|
app.use(express.json({ limit: '50mb' }));
|
|
36
57
|
app.use(express.urlencoded({ limit: '50mb', extended: true }));
|
|
37
58
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
: process.cwd();
|
|
41
|
-
console.log(`Serving UI from ${join(__dirname, './ui/dist/spa')}`);
|
|
42
|
-
app.use(express.static(join(__dirname, './ui/dist/spa')));
|
|
59
|
+
console.log(`Serving UI from ${join(packageRoot, 'ui/dist/spa')}`);
|
|
60
|
+
app.use(express.static(join(packageRoot, 'ui/dist/spa')));
|
|
43
61
|
|
|
44
62
|
app.post('/api/getDatabasesFromExistingDumps', async (req, res) => {
|
|
45
63
|
let { config } = req.body;
|
|
@@ -139,12 +157,12 @@ export const startApiServer = (port, argv) => {
|
|
|
139
157
|
|
|
140
158
|
app.post('/api/browse-folders', async (req, res) => {
|
|
141
159
|
try {
|
|
142
|
-
const { currentPath =
|
|
160
|
+
const { currentPath = packageRoot } = req.body;
|
|
143
161
|
console.log('Browsing folder:', currentPath);
|
|
144
162
|
|
|
145
163
|
const resolvedPath = currentPath.startsWith('/') || currentPath.match(/^[A-Z]:\\/)
|
|
146
164
|
? resolve(currentPath)
|
|
147
|
-
: resolve(
|
|
165
|
+
: resolve(currentPath);
|
|
148
166
|
|
|
149
167
|
console.log('Resolved path:', resolvedPath);
|
|
150
168
|
|
|
@@ -192,7 +210,7 @@ export const startApiServer = (port, argv) => {
|
|
|
192
210
|
|
|
193
211
|
const resolvedPath = folderPath.startsWith('/') || folderPath.match(/^[A-Z]:\\/)
|
|
194
212
|
? resolve(folderPath)
|
|
195
|
-
: resolve(
|
|
213
|
+
: resolve(packageRoot, folderPath);
|
|
196
214
|
|
|
197
215
|
await mkdir(resolvedPath, { recursive: true });
|
|
198
216
|
|