@scriptdb/server 1.0.8 → 1.0.9
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 +87 -6
- package/dist/index.js +3 -4
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -394,13 +394,94 @@ npm run typecheck
|
|
|
394
394
|
npm run lint
|
|
395
395
|
```
|
|
396
396
|
|
|
397
|
-
##
|
|
397
|
+
## CLI Tool
|
|
398
398
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
399
|
+
ScriptDB provides a CLI tool for easy server management:
|
|
400
|
+
|
|
401
|
+
```bash
|
|
402
|
+
# Install CLI globally
|
|
403
|
+
npm install -g @scriptdb/cli
|
|
404
|
+
|
|
405
|
+
# Start server in foreground
|
|
406
|
+
scriptdb start
|
|
407
|
+
|
|
408
|
+
# Start server in background (daemon mode with PM2)
|
|
409
|
+
scriptdb start -d
|
|
410
|
+
|
|
411
|
+
# Check server status
|
|
412
|
+
scriptdb status
|
|
413
|
+
|
|
414
|
+
# View real-time logs
|
|
415
|
+
scriptdb logs
|
|
416
|
+
|
|
417
|
+
# Monitor performance
|
|
418
|
+
scriptdb monit
|
|
419
|
+
|
|
420
|
+
# Stop server
|
|
421
|
+
scriptdb stop
|
|
422
|
+
|
|
423
|
+
# Restart server
|
|
424
|
+
scriptdb restart -d
|
|
425
|
+
|
|
426
|
+
# Start interactive shell
|
|
427
|
+
scriptdb shell
|
|
428
|
+
|
|
429
|
+
# Install packages to ScriptDB
|
|
430
|
+
scriptdb add lodash
|
|
431
|
+
|
|
432
|
+
# Install packages locally
|
|
433
|
+
scriptdb add --local lodash
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
### CLI Configuration
|
|
437
|
+
|
|
438
|
+
The CLI reads configuration from `~/.scriptdb/config.json`:
|
|
439
|
+
|
|
440
|
+
```json
|
|
441
|
+
{
|
|
442
|
+
"host": "localhost",
|
|
443
|
+
"port": 1234,
|
|
444
|
+
"users": [
|
|
445
|
+
{
|
|
446
|
+
"username": "admin",
|
|
447
|
+
"password": "your-password",
|
|
448
|
+
"hash": false
|
|
449
|
+
}
|
|
450
|
+
],
|
|
451
|
+
"folder": "databases",
|
|
452
|
+
"secure": false
|
|
453
|
+
}
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
### Process Management
|
|
457
|
+
|
|
458
|
+
The CLI uses PM2 for daemon mode, providing:
|
|
459
|
+
|
|
460
|
+
- Automatic restart on failure
|
|
461
|
+
- Log management
|
|
462
|
+
- Performance monitoring
|
|
463
|
+
- Cluster mode support
|
|
464
|
+
|
|
465
|
+
PM2 files are stored in `~/.scriptdb/`:
|
|
466
|
+
- `ecosystem.config.js` - PM2 configuration
|
|
467
|
+
- `pm2-*.log` - Log files
|
|
468
|
+
|
|
469
|
+
## Changelog
|
|
470
|
+
|
|
471
|
+
### 1.0.9 (2025-01-16)
|
|
472
|
+
|
|
473
|
+
**Added**
|
|
474
|
+
- Native `scriptdb logs` command to view real-time logs
|
|
475
|
+
- Native `scriptdb monit` command to monitor performance
|
|
476
|
+
- Native `scriptdb restart` command to restart the server
|
|
477
|
+
- Native `scriptdb stop` command to stop the server
|
|
478
|
+
- ESLint configuration for TypeScript linting
|
|
479
|
+
|
|
480
|
+
**Fixed**
|
|
481
|
+
- Fixed TypeScript type mismatch in users config normalization
|
|
482
|
+
- Fixed TypeScript "used before assigned" error for storage variable
|
|
483
|
+
- Fixed TypeScript module resolution errors
|
|
484
|
+
- Improved error handling and Windows compatibility
|
|
404
485
|
|
|
405
486
|
## License
|
|
406
487
|
|
package/dist/index.js
CHANGED
|
@@ -4313,9 +4313,8 @@ export const ${databaseName} = {};
|
|
|
4313
4313
|
if (this.users && Array.isArray(this.users) && this.users.length > 0) {
|
|
4314
4314
|
const u = this.users[0] || { username: "" };
|
|
4315
4315
|
const uname = u.username || null;
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
cred = encodeURIComponent(String(uname)) + ":" + encodeURIComponent(String(pwd)) + "@";
|
|
4316
|
+
if (uname && typeof u.password === "string" && u.password) {
|
|
4317
|
+
cred = encodeURIComponent(String(uname)) + ":" + "*****" + "@";
|
|
4319
4318
|
} else if (uname) {
|
|
4320
4319
|
cred = encodeURIComponent(String(uname)) + "@";
|
|
4321
4320
|
}
|
|
@@ -4356,7 +4355,7 @@ import { spawn } from "node:child_process";
|
|
|
4356
4355
|
import Storage from "@scriptdb/storage";
|
|
4357
4356
|
var pkgData = `{
|
|
4358
4357
|
"name": "scriptdb-workspace",
|
|
4359
|
-
"version": "1.0.
|
|
4358
|
+
"version": "1.0.9",
|
|
4360
4359
|
"description": "ScriptDB workspace for custom scripts, services, and databases",
|
|
4361
4360
|
"private": true,
|
|
4362
4361
|
"devDependencies": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scriptdb/server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "server module resolver for script database",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"typescript": "^5.0.0"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@scriptdb/client": "^1.0.
|
|
45
|
-
"@scriptdb/storage": "^1.0.
|
|
46
|
-
"@scriptdb/system-modules": "^1.0.
|
|
47
|
-
"@scriptdb/vm": "^1.0.
|
|
44
|
+
"@scriptdb/client": "^1.0.9",
|
|
45
|
+
"@scriptdb/storage": "^1.0.9",
|
|
46
|
+
"@scriptdb/system-modules": "^1.0.9",
|
|
47
|
+
"@scriptdb/vm": "^1.0.9",
|
|
48
48
|
"@types/ws": "^8.18.1",
|
|
49
49
|
"bcryptjs": "^3.0.3",
|
|
50
50
|
"bottleneck": "^2.19.5",
|