@scriptdb/cli 1.0.7 → 1.0.8
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.js +32 -7
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -95254,7 +95254,7 @@ import { spawn } from "node:child_process";
|
|
|
95254
95254
|
import Storage from "@scriptdb/storage";
|
|
95255
95255
|
var pkgData = `{
|
|
95256
95256
|
"name": "scriptdb-workspace",
|
|
95257
|
-
"version": "1.0.
|
|
95257
|
+
"version": "1.0.8",
|
|
95258
95258
|
"description": "ScriptDB workspace for custom scripts, services, and databases",
|
|
95259
95259
|
"private": true,
|
|
95260
95260
|
"devDependencies": {
|
|
@@ -95300,6 +95300,7 @@ var tsconfigData = `
|
|
|
95300
95300
|
var dotGitignoreData = `
|
|
95301
95301
|
# Ignore all files in this directory
|
|
95302
95302
|
node_modules/
|
|
95303
|
+
bin/
|
|
95303
95304
|
`;
|
|
95304
95305
|
var ecosystemData = `
|
|
95305
95306
|
module.exports = {
|
|
@@ -95603,7 +95604,7 @@ class ScriptDBClient {
|
|
|
95603
95604
|
parsed.password = "";
|
|
95604
95605
|
this.uri = parsed.toString();
|
|
95605
95606
|
} catch (e) {
|
|
95606
|
-
this.uri =
|
|
95607
|
+
this.uri = uri;
|
|
95607
95608
|
}
|
|
95608
95609
|
this.host = parsed.hostname || "localhost";
|
|
95609
95610
|
this.port = parsed.port ? parseInt(parsed.port, 10) : 1234;
|
|
@@ -95694,6 +95695,12 @@ class ScriptDBClient {
|
|
|
95694
95695
|
this._connecting = null;
|
|
95695
95696
|
return reject(error);
|
|
95696
95697
|
}
|
|
95698
|
+
if (!this.client) {
|
|
95699
|
+
const error = new Error("Failed to create client socket");
|
|
95700
|
+
this.logger?.error?.("Connection failed", error.message);
|
|
95701
|
+
this._connecting = null;
|
|
95702
|
+
return reject(error);
|
|
95703
|
+
}
|
|
95697
95704
|
const onError = (err) => {
|
|
95698
95705
|
this.logger?.error?.("Client socket error:", err && err.message ? err.message : err);
|
|
95699
95706
|
this._handleDisconnect(err);
|
|
@@ -95704,7 +95711,7 @@ class ScriptDBClient {
|
|
|
95704
95711
|
};
|
|
95705
95712
|
this.client.on("error", onError);
|
|
95706
95713
|
this.client.on("close", onClose);
|
|
95707
|
-
if (this.socketTimeout > 0) {
|
|
95714
|
+
if (this.socketTimeout > 0 && this.client) {
|
|
95708
95715
|
this.client.setTimeout(this.socketTimeout);
|
|
95709
95716
|
this.client.on("timeout", () => {
|
|
95710
95717
|
this.logger?.warn?.("Socket timeout, destroying connection");
|
|
@@ -96561,8 +96568,23 @@ async function server() {
|
|
|
96561
96568
|
allowed.host = parsedConfig.host;
|
|
96562
96569
|
if (parsedConfig.port !== undefined)
|
|
96563
96570
|
allowed.port = parsedConfig.port;
|
|
96564
|
-
if (parsedConfig.users !== undefined)
|
|
96565
|
-
|
|
96571
|
+
if (parsedConfig.users !== undefined) {
|
|
96572
|
+
if (Array.isArray(parsedConfig.users)) {
|
|
96573
|
+
if (parsedConfig.users.length === 0) {
|
|
96574
|
+
allowed.users = [];
|
|
96575
|
+
} else if (typeof parsedConfig.users[0] === "string") {
|
|
96576
|
+
allowed.users = parsedConfig.users.map((username) => ({
|
|
96577
|
+
username,
|
|
96578
|
+
password: "",
|
|
96579
|
+
hash: false
|
|
96580
|
+
}));
|
|
96581
|
+
} else {
|
|
96582
|
+
allowed.users = parsedConfig.users;
|
|
96583
|
+
}
|
|
96584
|
+
} else {
|
|
96585
|
+
allowed.users = [parsedConfig.users];
|
|
96586
|
+
}
|
|
96587
|
+
}
|
|
96566
96588
|
if (typeof parsedConfig.folder === "string")
|
|
96567
96589
|
allowed.folder = parsedConfig.folder;
|
|
96568
96590
|
if (typeof parsedConfig.secure === "boolean")
|
|
@@ -96629,7 +96651,7 @@ async function server() {
|
|
|
96629
96651
|
} catch (err) {
|
|
96630
96652
|
exitWithError("Failed to initialize VM", err);
|
|
96631
96653
|
}
|
|
96632
|
-
let storage;
|
|
96654
|
+
let storage = null;
|
|
96633
96655
|
try {
|
|
96634
96656
|
storage = new Storage2(baseDir, basePath);
|
|
96635
96657
|
await storage.initialize();
|
|
@@ -96637,6 +96659,9 @@ async function server() {
|
|
|
96637
96659
|
} catch (err) {
|
|
96638
96660
|
exitWithError("Failed to initialize Storage", err);
|
|
96639
96661
|
}
|
|
96662
|
+
if (!storage) {
|
|
96663
|
+
exitWithError("Storage was not initialized");
|
|
96664
|
+
}
|
|
96640
96665
|
let scriptDBServer;
|
|
96641
96666
|
try {
|
|
96642
96667
|
scriptDBServer = new Protocal({
|
|
@@ -97271,7 +97296,7 @@ function ensureScriptDBDir() {
|
|
|
97271
97296
|
if (!existsSync3(PACKAGE_JSON)) {
|
|
97272
97297
|
const packageJsonContent = {
|
|
97273
97298
|
name: "scriptdb-workspace",
|
|
97274
|
-
version: "1.0.
|
|
97299
|
+
version: "1.0.8",
|
|
97275
97300
|
description: "ScriptDB workspace for custom scripts, services, and databases",
|
|
97276
97301
|
private: true,
|
|
97277
97302
|
devDependencies: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scriptdb/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "CLI tool to start and manage ScriptDB server",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"typescript": "^5.0.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@scriptdb/client": "^1.0.
|
|
42
|
-
"@scriptdb/server": "^1.0.
|
|
41
|
+
"@scriptdb/client": "^1.0.8",
|
|
42
|
+
"@scriptdb/server": "^1.0.8",
|
|
43
43
|
"bcryptjs": "^3.0.3",
|
|
44
44
|
"bottleneck": "^2.19.5",
|
|
45
45
|
"jsonwebtoken": "^9.0.3",
|