@sync-in/server 1.3.1 → 1.3.2
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/CHANGELOG.md +2 -0
- package/package.json +1 -1
- package/static/{chunk-NCIAR3N4.js → chunk-2LIE3SKB.js} +1 -1
- package/static/{chunk-2CQOSX2Q.js → chunk-3BKYCF53.js} +1 -1
- package/static/{chunk-HQC3W7BS.js → chunk-6CFIZHYI.js} +1 -1
- package/static/{chunk-HDDBV3QQ.js → chunk-7FVU676A.js} +1 -1
- package/static/{chunk-2QEYCCHN.js → chunk-7RNZNYVF.js} +1 -1
- package/static/{chunk-TFBTBTPR.js → chunk-7SJOQRBE.js} +1 -1
- package/static/{chunk-CTWOQLAR.js → chunk-BS5LXHXU.js} +1 -1
- package/static/{chunk-Y6IYSEKU.js → chunk-CPHC7U34.js} +1 -1
- package/static/{chunk-7U66TR6P.js → chunk-DYRV5R67.js} +1 -1
- package/static/{chunk-3RLZPQMJ.js → chunk-EWJD5G76.js} +1 -1
- package/static/{chunk-AXITQYVN.js → chunk-EYXC4W63.js} +1 -1
- package/static/{chunk-VIL6L67B.js → chunk-GSVMWC5N.js} +1 -1
- package/static/{chunk-EWY4ALVF.js → chunk-HNWPHW2W.js} +1 -1
- package/static/{chunk-FBG4NUDE.js → chunk-IPGNGPWY.js} +1 -1
- package/static/{chunk-5OIPLRAE.js → chunk-J5O3CY2H.js} +1 -1
- package/static/{chunk-R4USKWW6.js → chunk-JRVJIJB5.js} +1 -1
- package/static/{chunk-AYEOHGUD.js → chunk-MAWDGVNC.js} +1 -1
- package/static/{chunk-2SX3MVH3.js → chunk-N3QPDPBV.js} +1 -1
- package/static/{chunk-WA3LPP4G.js → chunk-NSXFB3SX.js} +1 -1
- package/static/{chunk-2XXS272C.js → chunk-OVO4W2GF.js} +1 -1
- package/static/{chunk-LHKO5Y4A.js → chunk-SOLCSMU7.js} +1 -1
- package/static/{chunk-RGONEEJE.js → chunk-SY5HMUMM.js} +1 -1
- package/static/{chunk-GI2LXVWQ.js → chunk-SZKZH4MJ.js} +1 -1
- package/static/{chunk-ZSMTUPAP.js → chunk-ULTPIQL3.js} +1 -1
- package/static/{chunk-AA6ZTGRW.js → chunk-VFSSL4TI.js} +1 -1
- package/static/{chunk-WQPVP63E.js → chunk-WGSPBZVN.js} +1 -1
- package/static/{chunk-ZZGFGD5E.js → chunk-X6UFHF4Q.js} +1 -1
- package/static/{chunk-ZS5YIDNI.js → chunk-XBHT4AH5.js} +1 -1
- package/static/{chunk-5JDPARJT.js → chunk-ZYB4TLJM.js} +1 -1
- package/static/index.html +1 -1
- package/static/{main-7IVUWYWM.js → main-EDITZWHO.js} +3 -3
- package/sync-in-server.js +17 -0
package/sync-in-server.js
CHANGED
|
@@ -20,6 +20,7 @@ const fs = require('fs')
|
|
|
20
20
|
// Paths relative to this script
|
|
21
21
|
const PKILL_GRACEFUL_TIMEOUT = 10000 // 10s timeout
|
|
22
22
|
const ROOT_DIR = path.resolve(__dirname)
|
|
23
|
+
const CREATE_USER_SCRIPT = path.join(ROOT_DIR, 'server', 'infrastructure', 'database', 'scripts', 'create-user.js')
|
|
23
24
|
const SERVER_ENTRY = path.join(ROOT_DIR, 'server', 'main.js')
|
|
24
25
|
const ENV_DIST_FILE = path.join(ROOT_DIR, 'environment', 'environment.dist.yaml')
|
|
25
26
|
const ENV_DIST_MIN_FILE = path.join(ROOT_DIR, 'environment', 'environment.dist.min.yaml')
|
|
@@ -40,6 +41,7 @@ Available commands:
|
|
|
40
41
|
status Show server status (daemon mode only)
|
|
41
42
|
version Show installed sync-in-server version
|
|
42
43
|
migrate-db Run database migrations
|
|
44
|
+
create-user Create an admin user in the database
|
|
43
45
|
update Update the server version
|
|
44
46
|
help Show this help message
|
|
45
47
|
|
|
@@ -47,6 +49,7 @@ Examples:
|
|
|
47
49
|
npx sync-in-server init # copy default environment.yaml
|
|
48
50
|
npx sync-in-server start # attached mode
|
|
49
51
|
npx sync-in-server start -d # daemon mode
|
|
52
|
+
npx sync-in-server create-user --role admin --login "userLogin" --password "userPassword"
|
|
50
53
|
npx sync-in-server version
|
|
51
54
|
npx sync-in-server help
|
|
52
55
|
`)
|
|
@@ -224,6 +227,17 @@ async function updateVersion() {
|
|
|
224
227
|
console.log('✅ Sync-in Server updated.')
|
|
225
228
|
}
|
|
226
229
|
|
|
230
|
+
async function createUser(args) {
|
|
231
|
+
console.log('👤 Creating user in database...')
|
|
232
|
+
const scriptArgs = [CREATE_USER_SCRIPT, ...args]
|
|
233
|
+
const result = spawnSync('node', scriptArgs, { stdio: 'inherit' })
|
|
234
|
+
if (result.status !== 0) {
|
|
235
|
+
console.error('❌ User creation failed.')
|
|
236
|
+
process.exit(result.status)
|
|
237
|
+
}
|
|
238
|
+
console.log('✅ User created successfully.')
|
|
239
|
+
}
|
|
240
|
+
|
|
227
241
|
function getPackageJson() {
|
|
228
242
|
try {
|
|
229
243
|
const pkgPath = path.join(ROOT_DIR, 'package.json')
|
|
@@ -294,6 +308,9 @@ function waitForProcessExit(pid) {
|
|
|
294
308
|
case 'migrate-db':
|
|
295
309
|
migrateDatabase()
|
|
296
310
|
break
|
|
311
|
+
case 'create-user':
|
|
312
|
+
createUser(args.slice(1)).catch(console.error)
|
|
313
|
+
break
|
|
297
314
|
case 'update':
|
|
298
315
|
updateVersion().catch(console.error)
|
|
299
316
|
break
|