sql-dashboard 1.0.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/LICENSE +21 -0
- package/README.md +494 -0
- package/dist/base.driver-BKzf8BxS.d.mts +102 -0
- package/dist/base.driver-BdK7obt0.d.ts +102 -0
- package/dist/chunk-7YLO3OSN.mjs +19513 -0
- package/dist/chunk-BPXOTU3D.js +76 -0
- package/dist/chunk-HIQUIRDJ.mjs +76 -0
- package/dist/chunk-MTCZXLV5.mjs +232 -0
- package/dist/chunk-OCL5Y3AH.mjs +51 -0
- package/dist/chunk-OQJUWTZV.js +51 -0
- package/dist/chunk-P4QE6SGC.mjs +69 -0
- package/dist/chunk-TNHUK2FI.mjs +1033 -0
- package/dist/chunk-YGKUVVJT.mjs +5494 -0
- package/dist/connection-CzduPMhl.d.mts +68 -0
- package/dist/connection-CzduPMhl.d.ts +68 -0
- package/dist/dashboard-CkGz4ID-.d.mts +45 -0
- package/dist/dashboard-D9xSb-hQ.d.ts +45 -0
- package/dist/drivers/mssql.driver.d.mts +26 -0
- package/dist/drivers/mssql.driver.d.ts +26 -0
- package/dist/drivers/mssql.driver.js +64824 -0
- package/dist/drivers/mssql.driver.mjs +8 -0
- package/dist/drivers/mysql.driver.d.mts +29 -0
- package/dist/drivers/mysql.driver.d.ts +29 -0
- package/dist/drivers/mysql.driver.js +19672 -0
- package/dist/drivers/mysql.driver.mjs +9 -0
- package/dist/drivers/postgres.driver.d.mts +29 -0
- package/dist/drivers/postgres.driver.d.ts +29 -0
- package/dist/drivers/postgres.driver.js +5588 -0
- package/dist/drivers/postgres.driver.mjs +8 -0
- package/dist/export/index.d.mts +23 -0
- package/dist/export/index.d.ts +23 -0
- package/dist/export/index.js +102 -0
- package/dist/export/index.mjs +75 -0
- package/dist/index.d.mts +579 -0
- package/dist/index.d.ts +579 -0
- package/dist/index.js +26694 -0
- package/dist/index.mjs +26694 -0
- package/dist/middleware/express.d.mts +11 -0
- package/dist/middleware/express.d.ts +11 -0
- package/dist/middleware/express.js +90896 -0
- package/dist/middleware/express.mjs +91 -0
- package/dist/middleware/fastify.d.mts +10 -0
- package/dist/middleware/fastify.d.ts +10 -0
- package/dist/middleware/fastify.js +90860 -0
- package/dist/middleware/fastify.mjs +54 -0
- package/dist/open-JHAWMLA2.mjs +602 -0
- package/dist/open-T3PIT3AO.js +602 -0
- package/dist/query-BFhJHNeb.d.mts +16 -0
- package/dist/query-BFhJHNeb.d.ts +16 -0
- package/dist/tedious-LLE7JVQC.js +63830 -0
- package/dist/tedious-PHHFLMLD.mjs +63830 -0
- package/package.json +131 -0
|
@@ -0,0 +1,602 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
var _chunkOQJUWTZVjs = require('./chunk-OQJUWTZV.js');
|
|
4
|
+
|
|
5
|
+
// node_modules/is-docker/index.js
|
|
6
|
+
var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
7
|
+
function hasDockerEnv() {
|
|
8
|
+
try {
|
|
9
|
+
_fs2.default.statSync("/.dockerenv");
|
|
10
|
+
return true;
|
|
11
|
+
} catch (e) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function hasDockerCGroup() {
|
|
16
|
+
try {
|
|
17
|
+
return _fs2.default.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
|
|
18
|
+
} catch (e2) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function isDocker() {
|
|
23
|
+
if (isDockerCached === void 0) {
|
|
24
|
+
isDockerCached = hasDockerEnv() || hasDockerCGroup();
|
|
25
|
+
}
|
|
26
|
+
return isDockerCached;
|
|
27
|
+
}
|
|
28
|
+
var isDockerCached;
|
|
29
|
+
var init_is_docker = _chunkOQJUWTZVjs.__esm.call(void 0, {
|
|
30
|
+
"node_modules/is-docker/index.js"() {
|
|
31
|
+
"use strict";
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// node_modules/is-inside-container/index.js
|
|
36
|
+
|
|
37
|
+
function isInsideContainer() {
|
|
38
|
+
if (cachedResult === void 0) {
|
|
39
|
+
cachedResult = hasContainerEnv() || isDocker();
|
|
40
|
+
}
|
|
41
|
+
return cachedResult;
|
|
42
|
+
}
|
|
43
|
+
var cachedResult, hasContainerEnv;
|
|
44
|
+
var init_is_inside_container = _chunkOQJUWTZVjs.__esm.call(void 0, {
|
|
45
|
+
"node_modules/is-inside-container/index.js"() {
|
|
46
|
+
"use strict";
|
|
47
|
+
init_is_docker();
|
|
48
|
+
hasContainerEnv = () => {
|
|
49
|
+
try {
|
|
50
|
+
_fs2.default.statSync("/run/.containerenv");
|
|
51
|
+
return true;
|
|
52
|
+
} catch (e3) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// node_modules/is-wsl/index.js
|
|
60
|
+
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
61
|
+
var _os = require('os'); var _os2 = _interopRequireDefault(_os);
|
|
62
|
+
|
|
63
|
+
var isWsl, is_wsl_default;
|
|
64
|
+
var init_is_wsl = _chunkOQJUWTZVjs.__esm.call(void 0, {
|
|
65
|
+
"node_modules/is-wsl/index.js"() {
|
|
66
|
+
"use strict";
|
|
67
|
+
init_is_inside_container();
|
|
68
|
+
isWsl = () => {
|
|
69
|
+
if (_process2.default.platform !== "linux") {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
if (_os2.default.release().toLowerCase().includes("microsoft")) {
|
|
73
|
+
if (isInsideContainer()) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
if (_fs2.default.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft")) {
|
|
80
|
+
return !isInsideContainer();
|
|
81
|
+
}
|
|
82
|
+
} catch (e4) {
|
|
83
|
+
}
|
|
84
|
+
if (_fs2.default.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop") || _fs2.default.existsSync("/run/WSL")) {
|
|
85
|
+
return !isInsideContainer();
|
|
86
|
+
}
|
|
87
|
+
return false;
|
|
88
|
+
};
|
|
89
|
+
is_wsl_default = _process2.default.env.__IS_WSL_TEST__ ? isWsl : isWsl();
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// node_modules/wsl-utils/index.js
|
|
94
|
+
|
|
95
|
+
var _promises = require('fs/promises'); var _promises2 = _interopRequireDefault(_promises);
|
|
96
|
+
var wslDrivesMountPoint, powerShellPathFromWsl, powerShellPath;
|
|
97
|
+
var init_wsl_utils = _chunkOQJUWTZVjs.__esm.call(void 0, {
|
|
98
|
+
"node_modules/wsl-utils/index.js"() {
|
|
99
|
+
"use strict";
|
|
100
|
+
init_is_wsl();
|
|
101
|
+
init_is_wsl();
|
|
102
|
+
wslDrivesMountPoint = /* @__PURE__ */ (() => {
|
|
103
|
+
const defaultMountPoint = "/mnt/";
|
|
104
|
+
let mountPoint;
|
|
105
|
+
return async function() {
|
|
106
|
+
if (mountPoint) {
|
|
107
|
+
return mountPoint;
|
|
108
|
+
}
|
|
109
|
+
const configFilePath = "/etc/wsl.conf";
|
|
110
|
+
let isConfigFileExists = false;
|
|
111
|
+
try {
|
|
112
|
+
await _promises2.default.access(configFilePath, _promises.constants.F_OK);
|
|
113
|
+
isConfigFileExists = true;
|
|
114
|
+
} catch (e5) {
|
|
115
|
+
}
|
|
116
|
+
if (!isConfigFileExists) {
|
|
117
|
+
return defaultMountPoint;
|
|
118
|
+
}
|
|
119
|
+
const configContent = await _promises2.default.readFile(configFilePath, { encoding: "utf8" });
|
|
120
|
+
const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
|
|
121
|
+
if (!configMountPoint) {
|
|
122
|
+
return defaultMountPoint;
|
|
123
|
+
}
|
|
124
|
+
mountPoint = configMountPoint.groups.mountPoint.trim();
|
|
125
|
+
mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
|
|
126
|
+
return mountPoint;
|
|
127
|
+
};
|
|
128
|
+
})();
|
|
129
|
+
powerShellPathFromWsl = async () => {
|
|
130
|
+
const mountPoint = await wslDrivesMountPoint();
|
|
131
|
+
return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
|
|
132
|
+
};
|
|
133
|
+
powerShellPath = async () => {
|
|
134
|
+
if (is_wsl_default) {
|
|
135
|
+
return powerShellPathFromWsl();
|
|
136
|
+
}
|
|
137
|
+
return `${_process2.default.env.SYSTEMROOT || _process2.default.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
// node_modules/define-lazy-prop/index.js
|
|
143
|
+
function defineLazyProperty(object, propertyName, valueGetter) {
|
|
144
|
+
const define = (value) => Object.defineProperty(object, propertyName, { value, enumerable: true, writable: true });
|
|
145
|
+
Object.defineProperty(object, propertyName, {
|
|
146
|
+
configurable: true,
|
|
147
|
+
enumerable: true,
|
|
148
|
+
get() {
|
|
149
|
+
const result = valueGetter();
|
|
150
|
+
define(result);
|
|
151
|
+
return result;
|
|
152
|
+
},
|
|
153
|
+
set(value) {
|
|
154
|
+
define(value);
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
return object;
|
|
158
|
+
}
|
|
159
|
+
var init_define_lazy_prop = _chunkOQJUWTZVjs.__esm.call(void 0, {
|
|
160
|
+
"node_modules/define-lazy-prop/index.js"() {
|
|
161
|
+
"use strict";
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
// node_modules/default-browser-id/index.js
|
|
166
|
+
var _util = require('util');
|
|
167
|
+
|
|
168
|
+
var _child_process = require('child_process'); var _child_process2 = _interopRequireDefault(_child_process);
|
|
169
|
+
async function defaultBrowserId() {
|
|
170
|
+
if (_process2.default.platform !== "darwin") {
|
|
171
|
+
throw new Error("macOS only");
|
|
172
|
+
}
|
|
173
|
+
const { stdout } = await execFileAsync("defaults", ["read", "com.apple.LaunchServices/com.apple.launchservices.secure", "LSHandlers"]);
|
|
174
|
+
const match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
|
|
175
|
+
const browserId = _nullishCoalesce(_optionalChain([match, 'optionalAccess', _ => _.groups, 'access', _2 => _2.id]), () => ( "com.apple.Safari"));
|
|
176
|
+
if (browserId === "com.apple.safari") {
|
|
177
|
+
return "com.apple.Safari";
|
|
178
|
+
}
|
|
179
|
+
return browserId;
|
|
180
|
+
}
|
|
181
|
+
var execFileAsync;
|
|
182
|
+
var init_default_browser_id = _chunkOQJUWTZVjs.__esm.call(void 0, {
|
|
183
|
+
"node_modules/default-browser-id/index.js"() {
|
|
184
|
+
"use strict";
|
|
185
|
+
execFileAsync = _util.promisify.call(void 0, _child_process.execFile);
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
// node_modules/run-applescript/index.js
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
|
|
194
|
+
if (_process2.default.platform !== "darwin") {
|
|
195
|
+
throw new Error("macOS only");
|
|
196
|
+
}
|
|
197
|
+
const outputArguments = humanReadableOutput ? [] : ["-ss"];
|
|
198
|
+
const execOptions = {};
|
|
199
|
+
if (signal) {
|
|
200
|
+
execOptions.signal = signal;
|
|
201
|
+
}
|
|
202
|
+
const { stdout } = await execFileAsync2("osascript", ["-e", script, outputArguments], execOptions);
|
|
203
|
+
return stdout.trim();
|
|
204
|
+
}
|
|
205
|
+
var execFileAsync2;
|
|
206
|
+
var init_run_applescript = _chunkOQJUWTZVjs.__esm.call(void 0, {
|
|
207
|
+
"node_modules/run-applescript/index.js"() {
|
|
208
|
+
"use strict";
|
|
209
|
+
execFileAsync2 = _util.promisify.call(void 0, _child_process.execFile);
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
// node_modules/bundle-name/index.js
|
|
214
|
+
async function bundleName(bundleId) {
|
|
215
|
+
return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string
|
|
216
|
+
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
|
|
217
|
+
}
|
|
218
|
+
var init_bundle_name = _chunkOQJUWTZVjs.__esm.call(void 0, {
|
|
219
|
+
"node_modules/bundle-name/index.js"() {
|
|
220
|
+
"use strict";
|
|
221
|
+
init_run_applescript();
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
// node_modules/default-browser/windows.js
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
async function defaultBrowser(_execFileAsync = execFileAsync3) {
|
|
229
|
+
const { stdout } = await _execFileAsync("reg", [
|
|
230
|
+
"QUERY",
|
|
231
|
+
" HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice",
|
|
232
|
+
"/v",
|
|
233
|
+
"ProgId"
|
|
234
|
+
]);
|
|
235
|
+
const match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout);
|
|
236
|
+
if (!match) {
|
|
237
|
+
throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
|
|
238
|
+
}
|
|
239
|
+
const { id } = match.groups;
|
|
240
|
+
const dotIndex = id.lastIndexOf(".");
|
|
241
|
+
const hyphenIndex = id.lastIndexOf("-");
|
|
242
|
+
const baseIdByDot = dotIndex === -1 ? void 0 : id.slice(0, dotIndex);
|
|
243
|
+
const baseIdByHyphen = hyphenIndex === -1 ? void 0 : id.slice(0, hyphenIndex);
|
|
244
|
+
return _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(windowsBrowserProgIds[id], () => ( windowsBrowserProgIds[baseIdByDot])), () => ( windowsBrowserProgIds[baseIdByHyphen])), () => ( { name: id, id }));
|
|
245
|
+
}
|
|
246
|
+
var execFileAsync3, windowsBrowserProgIds, _windowsBrowserProgIdMap, UnknownBrowserError;
|
|
247
|
+
var init_windows = _chunkOQJUWTZVjs.__esm.call(void 0, {
|
|
248
|
+
"node_modules/default-browser/windows.js"() {
|
|
249
|
+
"use strict";
|
|
250
|
+
execFileAsync3 = _util.promisify.call(void 0, _child_process.execFile);
|
|
251
|
+
windowsBrowserProgIds = {
|
|
252
|
+
MSEdgeHTM: { name: "Edge", id: "com.microsoft.edge" },
|
|
253
|
+
// The missing `L` is correct.
|
|
254
|
+
MSEdgeBHTML: { name: "Edge Beta", id: "com.microsoft.edge.beta" },
|
|
255
|
+
MSEdgeDHTML: { name: "Edge Dev", id: "com.microsoft.edge.dev" },
|
|
256
|
+
AppXq0fevzme2pys62n3e0fbqa7peapykr8v: { name: "Edge", id: "com.microsoft.edge.old" },
|
|
257
|
+
ChromeHTML: { name: "Chrome", id: "com.google.chrome" },
|
|
258
|
+
ChromeBHTML: { name: "Chrome Beta", id: "com.google.chrome.beta" },
|
|
259
|
+
ChromeDHTML: { name: "Chrome Dev", id: "com.google.chrome.dev" },
|
|
260
|
+
ChromiumHTM: { name: "Chromium", id: "org.chromium.Chromium" },
|
|
261
|
+
BraveHTML: { name: "Brave", id: "com.brave.Browser" },
|
|
262
|
+
BraveBHTML: { name: "Brave Beta", id: "com.brave.Browser.beta" },
|
|
263
|
+
BraveDHTML: { name: "Brave Dev", id: "com.brave.Browser.dev" },
|
|
264
|
+
BraveSSHTM: { name: "Brave Nightly", id: "com.brave.Browser.nightly" },
|
|
265
|
+
FirefoxURL: { name: "Firefox", id: "org.mozilla.firefox" },
|
|
266
|
+
OperaStable: { name: "Opera", id: "com.operasoftware.Opera" },
|
|
267
|
+
VivaldiHTM: { name: "Vivaldi", id: "com.vivaldi.Vivaldi" },
|
|
268
|
+
"IE.HTTP": { name: "Internet Explorer", id: "com.microsoft.ie" }
|
|
269
|
+
};
|
|
270
|
+
_windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));
|
|
271
|
+
UnknownBrowserError = class extends Error {
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
// node_modules/default-browser/index.js
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
async function defaultBrowser2() {
|
|
281
|
+
if (_process2.default.platform === "darwin") {
|
|
282
|
+
const id = await defaultBrowserId();
|
|
283
|
+
const name = await bundleName(id);
|
|
284
|
+
return { name, id };
|
|
285
|
+
}
|
|
286
|
+
if (_process2.default.platform === "linux") {
|
|
287
|
+
const { stdout } = await execFileAsync4("xdg-mime", ["query", "default", "x-scheme-handler/http"]);
|
|
288
|
+
const id = stdout.trim();
|
|
289
|
+
const name = titleize(id.replace(/.desktop$/, "").replace("-", " "));
|
|
290
|
+
return { name, id };
|
|
291
|
+
}
|
|
292
|
+
if (_process2.default.platform === "win32") {
|
|
293
|
+
return defaultBrowser();
|
|
294
|
+
}
|
|
295
|
+
throw new Error("Only macOS, Linux, and Windows are supported");
|
|
296
|
+
}
|
|
297
|
+
var execFileAsync4, titleize;
|
|
298
|
+
var init_default_browser = _chunkOQJUWTZVjs.__esm.call(void 0, {
|
|
299
|
+
"node_modules/default-browser/index.js"() {
|
|
300
|
+
"use strict";
|
|
301
|
+
init_default_browser_id();
|
|
302
|
+
init_bundle_name();
|
|
303
|
+
init_windows();
|
|
304
|
+
execFileAsync4 = _util.promisify.call(void 0, _child_process.execFile);
|
|
305
|
+
titleize = (string) => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
// node_modules/open/index.js
|
|
310
|
+
|
|
311
|
+
var _buffer = require('buffer');
|
|
312
|
+
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
313
|
+
var _url = require('url');
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
async function getWindowsDefaultBrowserFromWsl() {
|
|
318
|
+
const powershellPath = await powerShellPath();
|
|
319
|
+
const rawCommand = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
|
|
320
|
+
const encodedCommand = _buffer.Buffer.from(rawCommand, "utf16le").toString("base64");
|
|
321
|
+
const { stdout } = await execFile5(
|
|
322
|
+
powershellPath,
|
|
323
|
+
[
|
|
324
|
+
"-NoProfile",
|
|
325
|
+
"-NonInteractive",
|
|
326
|
+
"-ExecutionPolicy",
|
|
327
|
+
"Bypass",
|
|
328
|
+
"-EncodedCommand",
|
|
329
|
+
encodedCommand
|
|
330
|
+
],
|
|
331
|
+
{ encoding: "utf8" }
|
|
332
|
+
);
|
|
333
|
+
const progId = stdout.trim();
|
|
334
|
+
const browserMap = {
|
|
335
|
+
ChromeHTML: "com.google.chrome",
|
|
336
|
+
BraveHTML: "com.brave.Browser",
|
|
337
|
+
MSEdgeHTM: "com.microsoft.edge",
|
|
338
|
+
FirefoxURL: "org.mozilla.firefox"
|
|
339
|
+
};
|
|
340
|
+
return browserMap[progId] ? { id: browserMap[progId] } : {};
|
|
341
|
+
}
|
|
342
|
+
function detectArchBinary(binary) {
|
|
343
|
+
if (typeof binary === "string" || Array.isArray(binary)) {
|
|
344
|
+
return binary;
|
|
345
|
+
}
|
|
346
|
+
const { [arch]: archBinary } = binary;
|
|
347
|
+
if (!archBinary) {
|
|
348
|
+
throw new Error(`${arch} is not supported`);
|
|
349
|
+
}
|
|
350
|
+
return archBinary;
|
|
351
|
+
}
|
|
352
|
+
function detectPlatformBinary({ [platform]: platformBinary }, { wsl }) {
|
|
353
|
+
if (wsl && is_wsl_default) {
|
|
354
|
+
return detectArchBinary(wsl);
|
|
355
|
+
}
|
|
356
|
+
if (!platformBinary) {
|
|
357
|
+
throw new Error(`${platform} is not supported`);
|
|
358
|
+
}
|
|
359
|
+
return detectArchBinary(platformBinary);
|
|
360
|
+
}
|
|
361
|
+
var execFile5, __dirname, localXdgOpenPath, platform, arch, pTryEach, baseOpen, open, openApp, apps, open_default;
|
|
362
|
+
var init_open = _chunkOQJUWTZVjs.__esm.call(void 0, {
|
|
363
|
+
"node_modules/open/index.js"() {
|
|
364
|
+
init_wsl_utils();
|
|
365
|
+
init_define_lazy_prop();
|
|
366
|
+
init_default_browser();
|
|
367
|
+
init_is_inside_container();
|
|
368
|
+
execFile5 = _util.promisify.call(void 0, _child_process2.default.execFile);
|
|
369
|
+
__dirname = _path2.default.dirname(_url.fileURLToPath.call(void 0, import.meta.url));
|
|
370
|
+
localXdgOpenPath = _path2.default.join(__dirname, "xdg-open");
|
|
371
|
+
({ platform, arch } = _process2.default);
|
|
372
|
+
pTryEach = async (array, mapper) => {
|
|
373
|
+
let latestError;
|
|
374
|
+
for (const item of array) {
|
|
375
|
+
try {
|
|
376
|
+
return await mapper(item);
|
|
377
|
+
} catch (error) {
|
|
378
|
+
latestError = error;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
throw latestError;
|
|
382
|
+
};
|
|
383
|
+
baseOpen = async (options) => {
|
|
384
|
+
options = {
|
|
385
|
+
wait: false,
|
|
386
|
+
background: false,
|
|
387
|
+
newInstance: false,
|
|
388
|
+
allowNonzeroExitCode: false,
|
|
389
|
+
...options
|
|
390
|
+
};
|
|
391
|
+
if (Array.isArray(options.app)) {
|
|
392
|
+
return pTryEach(options.app, (singleApp) => baseOpen({
|
|
393
|
+
...options,
|
|
394
|
+
app: singleApp
|
|
395
|
+
}));
|
|
396
|
+
}
|
|
397
|
+
let { name: app, arguments: appArguments = [] } = _nullishCoalesce(options.app, () => ( {}));
|
|
398
|
+
appArguments = [...appArguments];
|
|
399
|
+
if (Array.isArray(app)) {
|
|
400
|
+
return pTryEach(app, (appName) => baseOpen({
|
|
401
|
+
...options,
|
|
402
|
+
app: {
|
|
403
|
+
name: appName,
|
|
404
|
+
arguments: appArguments
|
|
405
|
+
}
|
|
406
|
+
}));
|
|
407
|
+
}
|
|
408
|
+
if (app === "browser" || app === "browserPrivate") {
|
|
409
|
+
const ids = {
|
|
410
|
+
"com.google.chrome": "chrome",
|
|
411
|
+
"google-chrome.desktop": "chrome",
|
|
412
|
+
"com.brave.Browser": "brave",
|
|
413
|
+
"org.mozilla.firefox": "firefox",
|
|
414
|
+
"firefox.desktop": "firefox",
|
|
415
|
+
"com.microsoft.msedge": "edge",
|
|
416
|
+
"com.microsoft.edge": "edge",
|
|
417
|
+
"com.microsoft.edgemac": "edge",
|
|
418
|
+
"microsoft-edge.desktop": "edge"
|
|
419
|
+
};
|
|
420
|
+
const flags = {
|
|
421
|
+
chrome: "--incognito",
|
|
422
|
+
brave: "--incognito",
|
|
423
|
+
firefox: "--private-window",
|
|
424
|
+
edge: "--inPrivate"
|
|
425
|
+
};
|
|
426
|
+
const browser = is_wsl_default ? await getWindowsDefaultBrowserFromWsl() : await defaultBrowser2();
|
|
427
|
+
if (browser.id in ids) {
|
|
428
|
+
const browserName = ids[browser.id];
|
|
429
|
+
if (app === "browserPrivate") {
|
|
430
|
+
appArguments.push(flags[browserName]);
|
|
431
|
+
}
|
|
432
|
+
return baseOpen({
|
|
433
|
+
...options,
|
|
434
|
+
app: {
|
|
435
|
+
name: apps[browserName],
|
|
436
|
+
arguments: appArguments
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
throw new Error(`${browser.name} is not supported as a default browser`);
|
|
441
|
+
}
|
|
442
|
+
let command;
|
|
443
|
+
const cliArguments = [];
|
|
444
|
+
const childProcessOptions = {};
|
|
445
|
+
if (platform === "darwin") {
|
|
446
|
+
command = "open";
|
|
447
|
+
if (options.wait) {
|
|
448
|
+
cliArguments.push("--wait-apps");
|
|
449
|
+
}
|
|
450
|
+
if (options.background) {
|
|
451
|
+
cliArguments.push("--background");
|
|
452
|
+
}
|
|
453
|
+
if (options.newInstance) {
|
|
454
|
+
cliArguments.push("--new");
|
|
455
|
+
}
|
|
456
|
+
if (app) {
|
|
457
|
+
cliArguments.push("-a", app);
|
|
458
|
+
}
|
|
459
|
+
} else if (platform === "win32" || is_wsl_default && !isInsideContainer() && !app) {
|
|
460
|
+
command = await powerShellPath();
|
|
461
|
+
cliArguments.push(
|
|
462
|
+
"-NoProfile",
|
|
463
|
+
"-NonInteractive",
|
|
464
|
+
"-ExecutionPolicy",
|
|
465
|
+
"Bypass",
|
|
466
|
+
"-EncodedCommand"
|
|
467
|
+
);
|
|
468
|
+
if (!is_wsl_default) {
|
|
469
|
+
childProcessOptions.windowsVerbatimArguments = true;
|
|
470
|
+
}
|
|
471
|
+
const encodedArguments = ["Start"];
|
|
472
|
+
if (options.wait) {
|
|
473
|
+
encodedArguments.push("-Wait");
|
|
474
|
+
}
|
|
475
|
+
if (app) {
|
|
476
|
+
encodedArguments.push(`"\`"${app}\`""`);
|
|
477
|
+
if (options.target) {
|
|
478
|
+
appArguments.push(options.target);
|
|
479
|
+
}
|
|
480
|
+
} else if (options.target) {
|
|
481
|
+
encodedArguments.push(`"${options.target}"`);
|
|
482
|
+
}
|
|
483
|
+
if (appArguments.length > 0) {
|
|
484
|
+
appArguments = appArguments.map((argument) => `"\`"${argument}\`""`);
|
|
485
|
+
encodedArguments.push("-ArgumentList", appArguments.join(","));
|
|
486
|
+
}
|
|
487
|
+
options.target = _buffer.Buffer.from(encodedArguments.join(" "), "utf16le").toString("base64");
|
|
488
|
+
} else {
|
|
489
|
+
if (app) {
|
|
490
|
+
command = app;
|
|
491
|
+
} else {
|
|
492
|
+
const isBundled = !__dirname || __dirname === "/";
|
|
493
|
+
let exeLocalXdgOpen = false;
|
|
494
|
+
try {
|
|
495
|
+
await _promises2.default.access(localXdgOpenPath, _promises.constants.X_OK);
|
|
496
|
+
exeLocalXdgOpen = true;
|
|
497
|
+
} catch (e6) {
|
|
498
|
+
}
|
|
499
|
+
const useSystemXdgOpen = _nullishCoalesce(_process2.default.versions.electron, () => ( (platform === "android" || isBundled || !exeLocalXdgOpen)));
|
|
500
|
+
command = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
|
|
501
|
+
}
|
|
502
|
+
if (appArguments.length > 0) {
|
|
503
|
+
cliArguments.push(...appArguments);
|
|
504
|
+
}
|
|
505
|
+
if (!options.wait) {
|
|
506
|
+
childProcessOptions.stdio = "ignore";
|
|
507
|
+
childProcessOptions.detached = true;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
if (platform === "darwin" && appArguments.length > 0) {
|
|
511
|
+
cliArguments.push("--args", ...appArguments);
|
|
512
|
+
}
|
|
513
|
+
if (options.target) {
|
|
514
|
+
cliArguments.push(options.target);
|
|
515
|
+
}
|
|
516
|
+
const subprocess = _child_process2.default.spawn(command, cliArguments, childProcessOptions);
|
|
517
|
+
if (options.wait) {
|
|
518
|
+
return new Promise((resolve, reject) => {
|
|
519
|
+
subprocess.once("error", reject);
|
|
520
|
+
subprocess.once("close", (exitCode) => {
|
|
521
|
+
if (!options.allowNonzeroExitCode && exitCode > 0) {
|
|
522
|
+
reject(new Error(`Exited with code ${exitCode}`));
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
resolve(subprocess);
|
|
526
|
+
});
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
subprocess.unref();
|
|
530
|
+
return subprocess;
|
|
531
|
+
};
|
|
532
|
+
open = (target, options) => {
|
|
533
|
+
if (typeof target !== "string") {
|
|
534
|
+
throw new TypeError("Expected a `target`");
|
|
535
|
+
}
|
|
536
|
+
return baseOpen({
|
|
537
|
+
...options,
|
|
538
|
+
target
|
|
539
|
+
});
|
|
540
|
+
};
|
|
541
|
+
openApp = exports.openApp = (name, options) => {
|
|
542
|
+
if (typeof name !== "string" && !Array.isArray(name)) {
|
|
543
|
+
throw new TypeError("Expected a valid `name`");
|
|
544
|
+
}
|
|
545
|
+
const { arguments: appArguments = [] } = _nullishCoalesce(options, () => ( {}));
|
|
546
|
+
if (appArguments !== void 0 && appArguments !== null && !Array.isArray(appArguments)) {
|
|
547
|
+
throw new TypeError("Expected `appArguments` as Array type");
|
|
548
|
+
}
|
|
549
|
+
return baseOpen({
|
|
550
|
+
...options,
|
|
551
|
+
app: {
|
|
552
|
+
name,
|
|
553
|
+
arguments: appArguments
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
};
|
|
557
|
+
apps = exports.apps = {};
|
|
558
|
+
defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
|
|
559
|
+
darwin: "google chrome",
|
|
560
|
+
win32: "chrome",
|
|
561
|
+
linux: ["google-chrome", "google-chrome-stable", "chromium"]
|
|
562
|
+
}, {
|
|
563
|
+
wsl: {
|
|
564
|
+
ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
|
|
565
|
+
x64: ["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe", "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]
|
|
566
|
+
}
|
|
567
|
+
}));
|
|
568
|
+
defineLazyProperty(apps, "brave", () => detectPlatformBinary({
|
|
569
|
+
darwin: "brave browser",
|
|
570
|
+
win32: "brave",
|
|
571
|
+
linux: ["brave-browser", "brave"]
|
|
572
|
+
}, {
|
|
573
|
+
wsl: {
|
|
574
|
+
ia32: "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",
|
|
575
|
+
x64: ["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe", "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]
|
|
576
|
+
}
|
|
577
|
+
}));
|
|
578
|
+
defineLazyProperty(apps, "firefox", () => detectPlatformBinary({
|
|
579
|
+
darwin: "firefox",
|
|
580
|
+
win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
|
|
581
|
+
linux: "firefox"
|
|
582
|
+
}, {
|
|
583
|
+
wsl: "/mnt/c/Program Files/Mozilla Firefox/firefox.exe"
|
|
584
|
+
}));
|
|
585
|
+
defineLazyProperty(apps, "edge", () => detectPlatformBinary({
|
|
586
|
+
darwin: "microsoft edge",
|
|
587
|
+
win32: "msedge",
|
|
588
|
+
linux: ["microsoft-edge", "microsoft-edge-dev"]
|
|
589
|
+
}, {
|
|
590
|
+
wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
|
|
591
|
+
}));
|
|
592
|
+
defineLazyProperty(apps, "browser", () => "browser");
|
|
593
|
+
defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
|
|
594
|
+
open_default = exports.default = open;
|
|
595
|
+
}
|
|
596
|
+
});
|
|
597
|
+
init_open();
|
|
598
|
+
|
|
599
|
+
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
exports.apps = apps; exports.default = open_default; exports.openApp = openApp;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type QueryStatus = 'success' | 'error' | 'cancelled';
|
|
2
|
+
interface QueryResult {
|
|
3
|
+
id: string;
|
|
4
|
+
status: QueryStatus;
|
|
5
|
+
rows: Record<string, unknown>[];
|
|
6
|
+
columns: string[];
|
|
7
|
+
rowCount: number;
|
|
8
|
+
affectedRows?: number;
|
|
9
|
+
duration: number;
|
|
10
|
+
query: string;
|
|
11
|
+
error?: string;
|
|
12
|
+
warning?: string;
|
|
13
|
+
insertedId?: string | number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type { QueryResult as Q };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type QueryStatus = 'success' | 'error' | 'cancelled';
|
|
2
|
+
interface QueryResult {
|
|
3
|
+
id: string;
|
|
4
|
+
status: QueryStatus;
|
|
5
|
+
rows: Record<string, unknown>[];
|
|
6
|
+
columns: string[];
|
|
7
|
+
rowCount: number;
|
|
8
|
+
affectedRows?: number;
|
|
9
|
+
duration: number;
|
|
10
|
+
query: string;
|
|
11
|
+
error?: string;
|
|
12
|
+
warning?: string;
|
|
13
|
+
insertedId?: string | number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type { QueryResult as Q };
|