@saltcorn/cli 0.7.2-beta.5 → 0.7.2-beta.6
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 +97 -54
- package/oclif.manifest.json +1 -1
- package/package.json +7 -8
- package/src/commands/add-schema.js +23 -1
- package/src/commands/backup.js +7 -3
- package/src/commands/create-user.js +14 -8
- package/src/commands/delete-tenants.js +24 -20
- package/src/commands/delete-user.js +105 -0
- package/src/commands/modify-user.js +163 -0
- package/src/commands/reset-schema.js +11 -2
- package/src/commands/restore.js +5 -0
- package/src/commands/rm-tenant.js +39 -6
- package/src/commands/run-tests.js +5 -4
- package/src/commands/setup.js +21 -10
- package/src/common.js +13 -5
- package/src/index.js +9 -2
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ $ npm install -g @saltcorn/cli
|
|
|
20
20
|
$ saltcorn COMMAND
|
|
21
21
|
running command...
|
|
22
22
|
$ saltcorn (-v|--version|version)
|
|
23
|
-
@saltcorn/cli/0.7.2-beta.
|
|
23
|
+
@saltcorn/cli/0.7.2-beta.6 darwin-arm64 node-v16.15.1
|
|
24
24
|
$ saltcorn --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ saltcorn COMMAND
|
|
@@ -33,11 +33,11 @@ USAGE
|
|
|
33
33
|
<!-- commands -->
|
|
34
34
|
* [`saltcorn add-schema`](#saltcorn-add-schema)
|
|
35
35
|
* [`saltcorn backup`](#saltcorn-backup)
|
|
36
|
-
* [`saltcorn build-app`](#saltcorn-build-app)
|
|
37
36
|
* [`saltcorn configuration-check`](#saltcorn-configuration-check)
|
|
38
37
|
* [`saltcorn create-tenant TENANT`](#saltcorn-create-tenant-tenant)
|
|
39
38
|
* [`saltcorn create-user`](#saltcorn-create-user)
|
|
40
39
|
* [`saltcorn delete-tenants`](#saltcorn-delete-tenants)
|
|
40
|
+
* [`saltcorn delete-user USER_EMAIL`](#saltcorn-delete-user-user_email)
|
|
41
41
|
* [`saltcorn fixtures`](#saltcorn-fixtures)
|
|
42
42
|
* [`saltcorn get-cfg KEY`](#saltcorn-get-cfg-key)
|
|
43
43
|
* [`saltcorn help [COMMAND]`](#saltcorn-help-command)
|
|
@@ -48,6 +48,7 @@ USAGE
|
|
|
48
48
|
* [`saltcorn localize-plugin PLUGIN PATH`](#saltcorn-localize-plugin-plugin-path)
|
|
49
49
|
* [`saltcorn make-migration`](#saltcorn-make-migration)
|
|
50
50
|
* [`saltcorn saltcorn migrate`](#saltcorn-saltcorn-migrate)
|
|
51
|
+
* [`saltcorn modify-user USER_EMAIL`](#saltcorn-modify-user-user_email)
|
|
51
52
|
* [`saltcorn plugins`](#saltcorn-plugins)
|
|
52
53
|
* [`saltcorn plugins:inspect PLUGIN...`](#saltcorn-pluginsinspect-plugin)
|
|
53
54
|
* [`saltcorn plugins:install PLUGIN...`](#saltcorn-pluginsinstall-plugin)
|
|
@@ -57,7 +58,7 @@ USAGE
|
|
|
57
58
|
* [`saltcorn release VERSION`](#saltcorn-release-version)
|
|
58
59
|
* [`saltcorn reset-schema`](#saltcorn-reset-schema)
|
|
59
60
|
* [`saltcorn restore FILE`](#saltcorn-restore-file)
|
|
60
|
-
* [`saltcorn rm-tenant
|
|
61
|
+
* [`saltcorn rm-tenant`](#saltcorn-rm-tenant)
|
|
61
62
|
* [`saltcorn run-benchmark [BASEURL]`](#saltcorn-run-benchmark-baseurl)
|
|
62
63
|
* [`saltcorn run-tests [PACKAGE]`](#saltcorn-run-tests-package)
|
|
63
64
|
* [`saltcorn scheduler`](#saltcorn-scheduler)
|
|
@@ -75,9 +76,12 @@ Add Saltcorn schema to existing database
|
|
|
75
76
|
```
|
|
76
77
|
USAGE
|
|
77
78
|
$ saltcorn add-schema
|
|
79
|
+
|
|
80
|
+
OPTIONS
|
|
81
|
+
-f, --force force command execution
|
|
78
82
|
```
|
|
79
83
|
|
|
80
|
-
_See code: [src/commands/add-schema.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.
|
|
84
|
+
_See code: [src/commands/add-schema.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.6/src/commands/add-schema.js)_
|
|
81
85
|
|
|
82
86
|
## `saltcorn backup`
|
|
83
87
|
|
|
@@ -93,23 +97,7 @@ OPTIONS
|
|
|
93
97
|
-z, --zip zip format
|
|
94
98
|
```
|
|
95
99
|
|
|
96
|
-
_See code: [src/commands/backup.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.
|
|
97
|
-
|
|
98
|
-
## `saltcorn build-app`
|
|
99
|
-
|
|
100
|
-
build mobile app from tenant
|
|
101
|
-
|
|
102
|
-
```
|
|
103
|
-
USAGE
|
|
104
|
-
$ saltcorn build-app
|
|
105
|
-
|
|
106
|
-
OPTIONS
|
|
107
|
-
-l, --localUserTables=localUserTables user defined tables that should be replicated into the app
|
|
108
|
-
-p, --platforms=platforms Platforms to build for space separated list
|
|
109
|
-
-v, --entryPoint=entryPoint Entry Point
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
_See code: [@saltcorn/mobile-builder](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.5/dist/commands/build-app.js)_
|
|
100
|
+
_See code: [src/commands/backup.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.6/src/commands/backup.js)_
|
|
113
101
|
|
|
114
102
|
## `saltcorn configuration-check`
|
|
115
103
|
|
|
@@ -123,7 +111,7 @@ OPTIONS
|
|
|
123
111
|
-t, --tenant=tenant tenant
|
|
124
112
|
```
|
|
125
113
|
|
|
126
|
-
_See code: [src/commands/configuration-check.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.
|
|
114
|
+
_See code: [src/commands/configuration-check.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.6/src/commands/configuration-check.js)_
|
|
127
115
|
|
|
128
116
|
## `saltcorn create-tenant TENANT`
|
|
129
117
|
|
|
@@ -141,7 +129,7 @@ OPTIONS
|
|
|
141
129
|
-e, --email=email Email of owner of tenant
|
|
142
130
|
```
|
|
143
131
|
|
|
144
|
-
_See code: [src/commands/create-tenant.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.
|
|
132
|
+
_See code: [src/commands/create-tenant.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.6/src/commands/create-tenant.js)_
|
|
145
133
|
|
|
146
134
|
## `saltcorn create-user`
|
|
147
135
|
|
|
@@ -159,7 +147,7 @@ OPTIONS
|
|
|
159
147
|
-t, --tenant=tenant tenant
|
|
160
148
|
```
|
|
161
149
|
|
|
162
|
-
_See code: [src/commands/create-user.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.
|
|
150
|
+
_See code: [src/commands/create-user.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.6/src/commands/create-user.js)_
|
|
163
151
|
|
|
164
152
|
## `saltcorn delete-tenants`
|
|
165
153
|
|
|
@@ -170,7 +158,28 @@ USAGE
|
|
|
170
158
|
$ saltcorn delete-tenants
|
|
171
159
|
```
|
|
172
160
|
|
|
173
|
-
_See code: [src/commands/delete-tenants.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.
|
|
161
|
+
_See code: [src/commands/delete-tenants.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.6/src/commands/delete-tenants.js)_
|
|
162
|
+
|
|
163
|
+
## `saltcorn delete-user USER_EMAIL`
|
|
164
|
+
|
|
165
|
+
Delete user.
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
USAGE
|
|
169
|
+
$ saltcorn delete-user USER_EMAIL
|
|
170
|
+
|
|
171
|
+
ARGUMENTS
|
|
172
|
+
USER_EMAIL User to delete
|
|
173
|
+
|
|
174
|
+
OPTIONS
|
|
175
|
+
-f, --force force command execution
|
|
176
|
+
-t, --tenant=tenant tenant
|
|
177
|
+
|
|
178
|
+
DESCRIPTION
|
|
179
|
+
Command deletes the user specified by USER_EMAIL.
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
_See code: [src/commands/delete-user.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.6/src/commands/delete-user.js)_
|
|
174
183
|
|
|
175
184
|
## `saltcorn fixtures`
|
|
176
185
|
|
|
@@ -189,7 +198,7 @@ DESCRIPTION
|
|
|
189
198
|
This manual step it is never required for users and rarely required for developers
|
|
190
199
|
```
|
|
191
200
|
|
|
192
|
-
_See code: [src/commands/fixtures.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.
|
|
201
|
+
_See code: [src/commands/fixtures.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.6/src/commands/fixtures.js)_
|
|
193
202
|
|
|
194
203
|
## `saltcorn get-cfg KEY`
|
|
195
204
|
|
|
@@ -207,7 +216,7 @@ OPTIONS
|
|
|
207
216
|
-t, --tenant=tenant tenant
|
|
208
217
|
```
|
|
209
218
|
|
|
210
|
-
_See code: [src/commands/get-cfg.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.
|
|
219
|
+
_See code: [src/commands/get-cfg.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.6/src/commands/get-cfg.js)_
|
|
211
220
|
|
|
212
221
|
## `saltcorn help [COMMAND]`
|
|
213
222
|
|
|
@@ -245,7 +254,7 @@ ALIASES
|
|
|
245
254
|
$ saltcorn paths
|
|
246
255
|
```
|
|
247
256
|
|
|
248
|
-
_See code: [src/commands/info.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.
|
|
257
|
+
_See code: [src/commands/info.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.6/src/commands/info.js)_
|
|
249
258
|
|
|
250
259
|
## `saltcorn install-pack`
|
|
251
260
|
|
|
@@ -261,7 +270,7 @@ OPTIONS
|
|
|
261
270
|
-t, --tenant=tenant tenant
|
|
262
271
|
```
|
|
263
272
|
|
|
264
|
-
_See code: [src/commands/install-pack.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.
|
|
273
|
+
_See code: [src/commands/install-pack.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.6/src/commands/install-pack.js)_
|
|
265
274
|
|
|
266
275
|
## `saltcorn install-plugin`
|
|
267
276
|
|
|
@@ -277,7 +286,7 @@ OPTIONS
|
|
|
277
286
|
-t, --tenant=tenant tenant
|
|
278
287
|
```
|
|
279
288
|
|
|
280
|
-
_See code: [src/commands/install-plugin.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.
|
|
289
|
+
_See code: [src/commands/install-plugin.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.6/src/commands/install-plugin.js)_
|
|
281
290
|
|
|
282
291
|
## `saltcorn list-tenants`
|
|
283
292
|
|
|
@@ -288,7 +297,7 @@ USAGE
|
|
|
288
297
|
$ saltcorn list-tenants
|
|
289
298
|
```
|
|
290
299
|
|
|
291
|
-
_See code: [src/commands/list-tenants.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.
|
|
300
|
+
_See code: [src/commands/list-tenants.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.6/src/commands/list-tenants.js)_
|
|
292
301
|
|
|
293
302
|
## `saltcorn localize-plugin PLUGIN PATH`
|
|
294
303
|
|
|
@@ -306,7 +315,7 @@ OPTIONS
|
|
|
306
315
|
-t, --tenant=tenant tenant
|
|
307
316
|
```
|
|
308
317
|
|
|
309
|
-
_See code: [src/commands/localize-plugin.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.
|
|
318
|
+
_See code: [src/commands/localize-plugin.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.6/src/commands/localize-plugin.js)_
|
|
310
319
|
|
|
311
320
|
## `saltcorn make-migration`
|
|
312
321
|
|
|
@@ -322,7 +331,7 @@ DESCRIPTION
|
|
|
322
331
|
unless you are a developer.
|
|
323
332
|
```
|
|
324
333
|
|
|
325
|
-
_See code: [src/commands/make-migration.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.
|
|
334
|
+
_See code: [src/commands/make-migration.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.6/src/commands/make-migration.js)_
|
|
326
335
|
|
|
327
336
|
## `saltcorn saltcorn migrate`
|
|
328
337
|
|
|
@@ -344,7 +353,36 @@ DESCRIPTION
|
|
|
344
353
|
servers and need to control when the migrations are run.
|
|
345
354
|
```
|
|
346
355
|
|
|
347
|
-
_See code: [src/commands/migrate.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.
|
|
356
|
+
_See code: [src/commands/migrate.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.6/src/commands/migrate.js)_
|
|
357
|
+
|
|
358
|
+
## `saltcorn modify-user USER_EMAIL`
|
|
359
|
+
|
|
360
|
+
Modify (update) user.
|
|
361
|
+
|
|
362
|
+
```
|
|
363
|
+
USAGE
|
|
364
|
+
$ saltcorn modify-user USER_EMAIL
|
|
365
|
+
|
|
366
|
+
ARGUMENTS
|
|
367
|
+
USER_EMAIL User to modify
|
|
368
|
+
|
|
369
|
+
OPTIONS
|
|
370
|
+
-a, --admin make user be Admin
|
|
371
|
+
-e, --email=email new email
|
|
372
|
+
-i, --imode interactive mode
|
|
373
|
+
-p, --password=password new password
|
|
374
|
+
-r, --role=role new role (can conflict with -a option)
|
|
375
|
+
-t, --tenant=tenant tenant
|
|
376
|
+
|
|
377
|
+
DESCRIPTION
|
|
378
|
+
Command changes the user specified by USER_EMAIL.
|
|
379
|
+
|
|
380
|
+
You can change the user group, password and email.
|
|
381
|
+
|
|
382
|
+
NOTE that -a and -r role (--role=role) can give conflict.
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
_See code: [src/commands/modify-user.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.6/src/commands/modify-user.js)_
|
|
348
386
|
|
|
349
387
|
## `saltcorn plugins`
|
|
350
388
|
|
|
@@ -496,7 +534,7 @@ ARGUMENTS
|
|
|
496
534
|
VERSION New version number
|
|
497
535
|
```
|
|
498
536
|
|
|
499
|
-
_See code: [src/commands/release.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.
|
|
537
|
+
_See code: [src/commands/release.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.6/src/commands/release.js)_
|
|
500
538
|
|
|
501
539
|
## `saltcorn reset-schema`
|
|
502
540
|
|
|
@@ -507,7 +545,7 @@ USAGE
|
|
|
507
545
|
$ saltcorn reset-schema
|
|
508
546
|
|
|
509
547
|
OPTIONS
|
|
510
|
-
-f, --force force
|
|
548
|
+
-f, --force force command execution
|
|
511
549
|
-t, --tenant=tenant tenant
|
|
512
550
|
|
|
513
551
|
DESCRIPTION
|
|
@@ -515,7 +553,7 @@ DESCRIPTION
|
|
|
515
553
|
This will delete all existing information
|
|
516
554
|
```
|
|
517
555
|
|
|
518
|
-
_See code: [src/commands/reset-schema.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.
|
|
556
|
+
_See code: [src/commands/reset-schema.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.6/src/commands/reset-schema.js)_
|
|
519
557
|
|
|
520
558
|
## `saltcorn restore FILE`
|
|
521
559
|
|
|
@@ -532,21 +570,26 @@ OPTIONS
|
|
|
532
570
|
-t, --tenant=tenant tenant
|
|
533
571
|
```
|
|
534
572
|
|
|
535
|
-
_See code: [src/commands/restore.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.
|
|
573
|
+
_See code: [src/commands/restore.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.6/src/commands/restore.js)_
|
|
536
574
|
|
|
537
|
-
## `saltcorn rm-tenant
|
|
575
|
+
## `saltcorn rm-tenant`
|
|
538
576
|
|
|
539
|
-
Remove a tenant
|
|
577
|
+
Remove a tenant.
|
|
540
578
|
|
|
541
579
|
```
|
|
542
580
|
USAGE
|
|
543
|
-
$ saltcorn rm-tenant
|
|
581
|
+
$ saltcorn rm-tenant
|
|
544
582
|
|
|
545
|
-
|
|
546
|
-
|
|
583
|
+
OPTIONS
|
|
584
|
+
-f, --force force command execution
|
|
585
|
+
-t, --tenant=tenant (required) tenant
|
|
586
|
+
|
|
587
|
+
DESCRIPTION
|
|
588
|
+
Attention! All tenant data will be lost!
|
|
589
|
+
It recommended to make backup of tenant before perform this command.
|
|
547
590
|
```
|
|
548
591
|
|
|
549
|
-
_See code: [src/commands/rm-tenant.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.
|
|
592
|
+
_See code: [src/commands/rm-tenant.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.6/src/commands/rm-tenant.js)_
|
|
550
593
|
|
|
551
594
|
## `saltcorn run-benchmark [BASEURL]`
|
|
552
595
|
|
|
@@ -565,7 +608,7 @@ OPTIONS
|
|
|
565
608
|
-t, --token=token API Token for reporting results
|
|
566
609
|
```
|
|
567
610
|
|
|
568
|
-
_See code: [src/commands/run-benchmark.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.
|
|
611
|
+
_See code: [src/commands/run-benchmark.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.6/src/commands/run-benchmark.js)_
|
|
569
612
|
|
|
570
613
|
## `saltcorn run-tests [PACKAGE]`
|
|
571
614
|
|
|
@@ -585,7 +628,7 @@ OPTIONS
|
|
|
585
628
|
--watchAll Watch files for changes and rerun all tests.
|
|
586
629
|
```
|
|
587
630
|
|
|
588
|
-
_See code: [src/commands/run-tests.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.
|
|
631
|
+
_See code: [src/commands/run-tests.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.6/src/commands/run-tests.js)_
|
|
589
632
|
|
|
590
633
|
## `saltcorn scheduler`
|
|
591
634
|
|
|
@@ -599,7 +642,7 @@ OPTIONS
|
|
|
599
642
|
-v, --verbose Verbose
|
|
600
643
|
```
|
|
601
644
|
|
|
602
|
-
_See code: [src/commands/scheduler.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.
|
|
645
|
+
_See code: [src/commands/scheduler.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.6/src/commands/scheduler.js)_
|
|
603
646
|
|
|
604
647
|
## `saltcorn serve`
|
|
605
648
|
|
|
@@ -619,7 +662,7 @@ OPTIONS
|
|
|
619
662
|
-v, --verbose Verbose
|
|
620
663
|
```
|
|
621
664
|
|
|
622
|
-
_See code: [src/commands/serve.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.
|
|
665
|
+
_See code: [src/commands/serve.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.6/src/commands/serve.js)_
|
|
623
666
|
|
|
624
667
|
## `saltcorn set-cfg KEY VALUE`
|
|
625
668
|
|
|
@@ -638,7 +681,7 @@ OPTIONS
|
|
|
638
681
|
-t, --tenant=tenant tenant
|
|
639
682
|
```
|
|
640
683
|
|
|
641
|
-
_See code: [src/commands/set-cfg.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.
|
|
684
|
+
_See code: [src/commands/set-cfg.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.6/src/commands/set-cfg.js)_
|
|
642
685
|
|
|
643
686
|
## `saltcorn setup`
|
|
644
687
|
|
|
@@ -653,11 +696,11 @@ OPTIONS
|
|
|
653
696
|
|
|
654
697
|
DESCRIPTION
|
|
655
698
|
...
|
|
656
|
-
This will attempt to install or connect a database, and set up a
|
|
699
|
+
This will attempt to install or connect a database, and set up a
|
|
657
700
|
configuration file
|
|
658
701
|
```
|
|
659
702
|
|
|
660
|
-
_See code: [src/commands/setup.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.
|
|
703
|
+
_See code: [src/commands/setup.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.6/src/commands/setup.js)_
|
|
661
704
|
|
|
662
705
|
## `saltcorn setup-benchmark`
|
|
663
706
|
|
|
@@ -671,7 +714,7 @@ OPTIONS
|
|
|
671
714
|
-t, --tenant=tenant tenant
|
|
672
715
|
```
|
|
673
716
|
|
|
674
|
-
_See code: [src/commands/setup-benchmark.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.
|
|
717
|
+
_See code: [src/commands/setup-benchmark.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.6/src/commands/setup-benchmark.js)_
|
|
675
718
|
|
|
676
719
|
## `saltcorn test-plugin PATH`
|
|
677
720
|
|
|
@@ -689,7 +732,7 @@ DESCRIPTION
|
|
|
689
732
|
Extra documentation goes here
|
|
690
733
|
```
|
|
691
734
|
|
|
692
|
-
_See code: [src/commands/test-plugin.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.
|
|
735
|
+
_See code: [src/commands/test-plugin.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.6/src/commands/test-plugin.js)_
|
|
693
736
|
|
|
694
737
|
## `saltcorn transform-field EXPRESSION FIELD TABLE [TENANT]`
|
|
695
738
|
|
|
@@ -706,5 +749,5 @@ ARGUMENTS
|
|
|
706
749
|
TENANT tenant name
|
|
707
750
|
```
|
|
708
751
|
|
|
709
|
-
_See code: [src/commands/transform-field.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.
|
|
752
|
+
_See code: [src/commands/transform-field.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.6/src/commands/transform-field.js)_
|
|
710
753
|
<!-- commandsstop -->
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.7.2-beta.5","commands":{"add-schema":{"id":"add-schema","description":"Add Saltcorn schema to existing database","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"backup":{"id":"backup","description":"Backup the PostgreSQL database to a file with pg_dump or zip","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"output":{"name":"output","type":"option","char":"o","description":"output filename"},"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"zip":{"name":"zip","type":"boolean","char":"z","description":"zip format","allowNo":false}},"args":[]},"configuration-check":{"id":"configuration-check","description":"Check configuration","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[]},"create-tenant":{"id":"create-tenant","description":"Create a tenant","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"email":{"name":"email","type":"option","char":"e","description":"Email of owner of tenant"},"description":{"name":"description","type":"option","char":"d","description":"Description of tenant"}},"args":[{"name":"tenant","description":"Tenant subdomain to create","required":true}]},"create-user":{"id":"create-user","description":"Create a new user","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"admin":{"name":"admin","type":"boolean","char":"a","description":"Admin user","allowNo":false},"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"email":{"name":"email","type":"option","char":"e","description":"email"},"role":{"name":"role","type":"option","char":"r","description":"role"},"password":{"name":"password","type":"option","char":"p","description":"password"}},"args":[]},"delete-tenants":{"id":"delete-tenants","description":"Delete inactive tenants","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"fixtures":{"id":"fixtures","description":"Load fixtures for testing\n...\nThis manual step it is never required for users and rarely required for developers\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"reset":{"name":"reset","type":"boolean","char":"r","description":"Also reset schema","allowNo":false},"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[]},"get-cfg":{"id":"get-cfg","description":"Get a configuration value","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"plugin":{"name":"plugin","type":"option","char":"p","description":"plugin"}},"args":[{"name":"key","description":"Configuration key","required":true}]},"info":{"id":"info","description":"Show paths\n...\nShow configuration and file store paths\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":["paths"],"flags":{"json":{"name":"json","type":"boolean","char":"j","description":"json format","allowNo":false}},"args":[]},"install-pack":{"id":"install-pack","description":"Install a pack","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"name":{"name":"name","type":"option","char":"n","description":"Pack name in store"},"file":{"name":"file","type":"option","char":"f","description":"File with pack JSON"}},"args":[]},"install-plugin":{"id":"install-plugin","description":"Install a plugin","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"name":{"name":"name","type":"option","char":"n","description":"Plugin name in store"},"directory":{"name":"directory","type":"option","char":"d","description":"Directory with local plugin"}},"args":[]},"list-tenants":{"id":"list-tenants","description":"List tenants in CSV format","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"localize-plugin":{"id":"localize-plugin","description":"Convert plugin to local plugin","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[{"name":"plugin","description":"Current plugin name","required":true},{"name":"path","description":"Absolute path to local plugin","required":true}]},"make-migration":{"id":"make-migration","description":"Create a new blank Database structure migration file.\nThese migrations update database structure.\nYou should not normally need to run this\nunless you are a developer.\n","usage":"make-migration","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"migrate":{"id":"migrate","description":"Run Database structure migrations\n...\nNOTE!\n- Please stop Saltcorn before run DB migrations.\n- Please make db backup before migration.\n- There are no way to rollback migration if you doesn't make backup.\n\nThis is not normally required as migrations will be run when the server starts.\nHowever, this command may be useful if you are running multiple application\nservers and need to control when the migrations are run.\n","usage":"saltcorn migrate","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"plugins":{"id":"plugins","description":"List and upgrade plugins for tenants\n...\nExtra documentation goes here\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"examples":["plugins -v - verbose output of commands","plugins -u -d - dry-run for plugin update","plugins -u -f - force plugin update"],"flags":{"upgrade":{"name":"upgrade","type":"boolean","char":"u","description":"Upgrade","allowNo":false},"dryRun":{"name":"dryRun","type":"boolean","char":"d","description":"Upgrade dry-run","allowNo":false},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose output","allowNo":false},"force":{"name":"force","type":"boolean","char":"f","description":"Force update","allowNo":false},"name":{"name":"name","type":"option","char":"n","description":"Plugin name"}},"args":[]},"release":{"id":"release","description":"Release a new saltcorn version","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"version","description":"New version number","required":true}]},"reset-schema":{"id":"reset-schema","description":"Reset the database\n...\nThis will delete all existing information\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"force":{"name":"force","type":"boolean","char":"f","description":"force","allowNo":false},"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[]},"restore":{"id":"restore","description":"Restore a previously backed up database (zip or sqlc format)","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[{"name":"file","description":"backup file to restore","required":true}]},"rm-tenant":{"id":"rm-tenant","description":"Remove a tenant","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"tenant","description":"Tenant to remove","required":true}]},"run-benchmark":{"id":"run-benchmark","description":"Run benchmark","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"token":{"name":"token","type":"option","char":"t","description":"API Token for reporting results"},"benchmark":{"name":"benchmark","type":"option","char":"b","description":"Which benchmark to run"},"delay":{"name":"delay","type":"option","char":"d","description":"delay between runs (s)","default":30}},"args":[{"name":"baseurl","description":"Base URL","required":false}]},"run-tests":{"id":"run-tests","description":"Run test suites","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"coverage":{"name":"coverage","type":"boolean","char":"c","description":"Coverage","allowNo":false},"testFilter":{"name":"testFilter","type":"option","char":"t","description":"Filter tests by suite or test name"},"watch":{"name":"watch","type":"boolean","description":"Watch files for changes and rerun tests related to changed files.","allowNo":false},"watchAll":{"name":"watchAll","type":"boolean","description":"Watch files for changes and rerun all tests.","allowNo":false}},"args":[{"name":"package","description":"which package to run tests for"}]},"scheduler":{"id":"scheduler","description":"Run the Saltcorn scheduler","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose","allowNo":false}},"args":[]},"serve":{"id":"serve","description":"Start the Saltcorn server","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"port":{"name":"port","type":"option","char":"p","description":"port","default":3000},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose","allowNo":false},"watchReaper":{"name":"watchReaper","type":"boolean","char":"r","description":"Watch reaper","allowNo":false},"dev":{"name":"dev","type":"boolean","char":"d","description":"Run in dev mode and re-start on file changes","allowNo":false},"addschema":{"name":"addschema","type":"boolean","char":"a","description":"Add schema if missing","allowNo":false},"nomigrate":{"name":"nomigrate","type":"boolean","char":"n","description":"No migrations","allowNo":false},"noscheduler":{"name":"noscheduler","type":"boolean","char":"s","description":"No scheduler","allowNo":false}},"args":[]},"set-cfg":{"id":"set-cfg","description":"Set a configuration value","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"plugin":{"name":"plugin","type":"option","char":"p","description":"plugin"}},"args":[{"name":"key","description":"Configuration key","required":true},{"name":"value","description":"Configuration value (JSON or string)","required":true}]},"setup-benchmark":{"id":"setup-benchmark","description":"Setup an instance for benchmarking","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[]},"setup":{"id":"setup","description":"Set up a new system\n...\nThis will attempt to install or connect a database, and set up a \nconfiguration file\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"coverage":{"name":"coverage","type":"boolean","char":"c","description":"Coverage","allowNo":false}},"args":[]},"test-plugin":{"id":"test-plugin","description":"Test a plugin\n...\nExtra documentation goes here\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"path","description":"path to plugin package","required":true}]},"transform-field":{"id":"transform-field","description":"transform an existing field by applying a calculated expression","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"expression","description":"expression to calculate field","required":true},{"name":"field","description":"field name","required":true},{"name":"table","description":"table name","required":true},{"name":"tenant","description":"tenant name","required":false}]}}}
|
|
1
|
+
{"version":"0.7.2-beta.6","commands":{"add-schema":{"id":"add-schema","description":"Add Saltcorn schema to existing database","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"force":{"name":"force","type":"boolean","char":"f","description":"force command execution","allowNo":false}},"args":[]},"backup":{"id":"backup","description":"Backup the PostgreSQL database to a file with pg_dump or zip","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"output":{"name":"output","type":"option","char":"o","description":"output filename"},"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"zip":{"name":"zip","type":"boolean","char":"z","description":"zip format","allowNo":false}},"args":[]},"configuration-check":{"id":"configuration-check","description":"Check configuration","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[]},"create-tenant":{"id":"create-tenant","description":"Create a tenant","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"email":{"name":"email","type":"option","char":"e","description":"Email of owner of tenant"},"description":{"name":"description","type":"option","char":"d","description":"Description of tenant"}},"args":[{"name":"tenant","description":"Tenant subdomain to create","required":true}]},"create-user":{"id":"create-user","description":"Create a new user","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"admin":{"name":"admin","type":"boolean","char":"a","description":"Admin user","allowNo":false},"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"email":{"name":"email","type":"option","char":"e","description":"email"},"role":{"name":"role","type":"option","char":"r","description":"role"},"password":{"name":"password","type":"option","char":"p","description":"password"}},"args":[]},"delete-tenants":{"id":"delete-tenants","description":"Delete inactive tenants","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"delete-user":{"id":"delete-user","description":"Delete user.\n\nCommand deletes the user specified by USER_EMAIL.\n\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"force":{"name":"force","type":"boolean","char":"f","description":"force command execution","allowNo":false},"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[{"name":"user_email","description":"User to delete","required":true}]},"fixtures":{"id":"fixtures","description":"Load fixtures for testing\n...\nThis manual step it is never required for users and rarely required for developers\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"reset":{"name":"reset","type":"boolean","char":"r","description":"Also reset schema","allowNo":false},"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[]},"get-cfg":{"id":"get-cfg","description":"Get a configuration value","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"plugin":{"name":"plugin","type":"option","char":"p","description":"plugin"}},"args":[{"name":"key","description":"Configuration key","required":true}]},"info":{"id":"info","description":"Show paths\n...\nShow configuration and file store paths\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":["paths"],"flags":{"json":{"name":"json","type":"boolean","char":"j","description":"json format","allowNo":false}},"args":[]},"install-pack":{"id":"install-pack","description":"Install a pack","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"name":{"name":"name","type":"option","char":"n","description":"Pack name in store"},"file":{"name":"file","type":"option","char":"f","description":"File with pack JSON"}},"args":[]},"install-plugin":{"id":"install-plugin","description":"Install a plugin","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"name":{"name":"name","type":"option","char":"n","description":"Plugin name in store"},"directory":{"name":"directory","type":"option","char":"d","description":"Directory with local plugin"}},"args":[]},"list-tenants":{"id":"list-tenants","description":"List tenants in CSV format","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"localize-plugin":{"id":"localize-plugin","description":"Convert plugin to local plugin","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[{"name":"plugin","description":"Current plugin name","required":true},{"name":"path","description":"Absolute path to local plugin","required":true}]},"make-migration":{"id":"make-migration","description":"Create a new blank Database structure migration file.\nThese migrations update database structure.\nYou should not normally need to run this\nunless you are a developer.\n","usage":"make-migration","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"migrate":{"id":"migrate","description":"Run Database structure migrations\n...\nNOTE!\n- Please stop Saltcorn before run DB migrations.\n- Please make db backup before migration.\n- There are no way to rollback migration if you doesn't make backup.\n\nThis is not normally required as migrations will be run when the server starts.\nHowever, this command may be useful if you are running multiple application\nservers and need to control when the migrations are run.\n","usage":"saltcorn migrate","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"modify-user":{"id":"modify-user","description":"Modify (update) user.\n\nCommand changes the user specified by USER_EMAIL.\n\nYou can change the user group, password and email.\n\nNOTE that -a and -r role (--role=role) can give conflict.\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"admin":{"name":"admin","type":"boolean","char":"a","description":"make user be Admin","allowNo":false},"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"email":{"name":"email","type":"option","char":"e","description":"new email"},"role":{"name":"role","type":"option","char":"r","description":"new role (can conflict with -a option)"},"password":{"name":"password","type":"option","char":"p","description":"new password"},"imode":{"name":"imode","type":"boolean","char":"i","description":"interactive mode","allowNo":false}},"args":[{"name":"user_email","description":"User to modify","required":true}]},"plugins":{"id":"plugins","description":"List and upgrade plugins for tenants\n...\nExtra documentation goes here\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"examples":["plugins -v - verbose output of commands","plugins -u -d - dry-run for plugin update","plugins -u -f - force plugin update"],"flags":{"upgrade":{"name":"upgrade","type":"boolean","char":"u","description":"Upgrade","allowNo":false},"dryRun":{"name":"dryRun","type":"boolean","char":"d","description":"Upgrade dry-run","allowNo":false},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose output","allowNo":false},"force":{"name":"force","type":"boolean","char":"f","description":"Force update","allowNo":false},"name":{"name":"name","type":"option","char":"n","description":"Plugin name"}},"args":[]},"release":{"id":"release","description":"Release a new saltcorn version","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"version","description":"New version number","required":true}]},"reset-schema":{"id":"reset-schema","description":"Reset the database\n...\nThis will delete all existing information\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"force":{"name":"force","type":"boolean","char":"f","description":"force command execution","allowNo":false},"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[]},"restore":{"id":"restore","description":"Restore a previously backed up database (zip or sqlc format)","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[{"name":"file","description":"backup file to restore","required":true}]},"rm-tenant":{"id":"rm-tenant","description":"Remove a tenant.\nAttention! All tenant data will be lost!\nIt recommended to make backup of tenant before perform this command.\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"force":{"name":"force","type":"boolean","char":"f","description":"force command execution","allowNo":false},"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant","required":true}},"args":[]},"run-benchmark":{"id":"run-benchmark","description":"Run benchmark","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"token":{"name":"token","type":"option","char":"t","description":"API Token for reporting results"},"benchmark":{"name":"benchmark","type":"option","char":"b","description":"Which benchmark to run"},"delay":{"name":"delay","type":"option","char":"d","description":"delay between runs (s)","default":30}},"args":[{"name":"baseurl","description":"Base URL","required":false}]},"run-tests":{"id":"run-tests","description":"Run test suites","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"coverage":{"name":"coverage","type":"boolean","char":"c","description":"Coverage","allowNo":false},"testFilter":{"name":"testFilter","type":"option","char":"t","description":"Filter tests by suite or test name"},"watch":{"name":"watch","type":"boolean","description":"Watch files for changes and rerun tests related to changed files.","allowNo":false},"watchAll":{"name":"watchAll","type":"boolean","description":"Watch files for changes and rerun all tests.","allowNo":false}},"args":[{"name":"package","description":"which package to run tests for"}]},"scheduler":{"id":"scheduler","description":"Run the Saltcorn scheduler","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose","allowNo":false}},"args":[]},"serve":{"id":"serve","description":"Start the Saltcorn server","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"port":{"name":"port","type":"option","char":"p","description":"port","default":3000},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose","allowNo":false},"watchReaper":{"name":"watchReaper","type":"boolean","char":"r","description":"Watch reaper","allowNo":false},"dev":{"name":"dev","type":"boolean","char":"d","description":"Run in dev mode and re-start on file changes","allowNo":false},"addschema":{"name":"addschema","type":"boolean","char":"a","description":"Add schema if missing","allowNo":false},"nomigrate":{"name":"nomigrate","type":"boolean","char":"n","description":"No migrations","allowNo":false},"noscheduler":{"name":"noscheduler","type":"boolean","char":"s","description":"No scheduler","allowNo":false}},"args":[]},"set-cfg":{"id":"set-cfg","description":"Set a configuration value","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"plugin":{"name":"plugin","type":"option","char":"p","description":"plugin"}},"args":[{"name":"key","description":"Configuration key","required":true},{"name":"value","description":"Configuration value (JSON or string)","required":true}]},"setup-benchmark":{"id":"setup-benchmark","description":"Setup an instance for benchmarking","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[]},"setup":{"id":"setup","description":"Set up a new system\n...\nThis will attempt to install or connect a database, and set up a\nconfiguration file\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"coverage":{"name":"coverage","type":"boolean","char":"c","description":"Coverage","allowNo":false}},"args":[]},"test-plugin":{"id":"test-plugin","description":"Test a plugin\n...\nExtra documentation goes here\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"path","description":"path to plugin package","required":true}]},"transform-field":{"id":"transform-field","description":"transform an existing field by applying a calculated expression","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"expression","description":"expression to calculate field","required":true},{"name":"field","description":"field name","required":true},{"name":"table","description":"table name","required":true},{"name":"tenant","description":"tenant name","required":false}]}}}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@saltcorn/cli",
|
|
3
3
|
"description": "Command-line interface for Saltcorn, open-source no-code platform",
|
|
4
4
|
"homepage": "https://saltcorn.com",
|
|
5
|
-
"version": "0.7.2-beta.
|
|
5
|
+
"version": "0.7.2-beta.6",
|
|
6
6
|
"author": "Tom Nielsen @glutamate",
|
|
7
7
|
"bin": {
|
|
8
8
|
"saltcorn": "./bin/saltcorn"
|
|
@@ -13,10 +13,9 @@
|
|
|
13
13
|
"@oclif/config": "^1.18.3",
|
|
14
14
|
"@oclif/plugin-plugins": "^2.1.0",
|
|
15
15
|
"@oclif/plugin-help": "^3.3.1",
|
|
16
|
-
"@saltcorn/admin-models": "0.7.2-beta.
|
|
17
|
-
"@saltcorn/data": "0.7.2-beta.
|
|
18
|
-
"@saltcorn/
|
|
19
|
-
"@saltcorn/server": "0.7.2-beta.5",
|
|
16
|
+
"@saltcorn/admin-models": "0.7.2-beta.6",
|
|
17
|
+
"@saltcorn/data": "0.7.2-beta.6",
|
|
18
|
+
"@saltcorn/server": "0.7.2-beta.6",
|
|
20
19
|
"cli-ux": "^5.6.7",
|
|
21
20
|
"contractis": "^0.1.0",
|
|
22
21
|
"dateformat": "^3.0.3",
|
|
@@ -32,7 +31,8 @@
|
|
|
32
31
|
},
|
|
33
32
|
"devDependencies": {
|
|
34
33
|
"@oclif/dev-cli": "^1.26.10",
|
|
35
|
-
"globby": "^10.0.2"
|
|
34
|
+
"globby": "^10.0.2",
|
|
35
|
+
"ts-node": "^9.1.1"
|
|
36
36
|
},
|
|
37
37
|
"engines": {
|
|
38
38
|
"node": ">=8.0.0"
|
|
@@ -53,8 +53,7 @@
|
|
|
53
53
|
"bin": "saltcorn",
|
|
54
54
|
"plugins": [
|
|
55
55
|
"@oclif/plugin-help",
|
|
56
|
-
"@oclif/plugin-plugins"
|
|
57
|
-
"@saltcorn/mobile-builder"
|
|
56
|
+
"@oclif/plugin-plugins"
|
|
58
57
|
]
|
|
59
58
|
},
|
|
60
59
|
"repository": "github:saltcorn/saltcorn",
|
|
@@ -15,9 +15,19 @@ class AddSchemaCommand extends Command {
|
|
|
15
15
|
* @returns {Promise<void>}
|
|
16
16
|
*/
|
|
17
17
|
async run() {
|
|
18
|
+
|
|
19
|
+
const { flags } = this.parse(AddSchemaCommand);
|
|
18
20
|
const reset = require("@saltcorn/data/db/reset_schema");
|
|
21
|
+
if(!flags.force){
|
|
22
|
+
const ans = await cli.confirm(
|
|
23
|
+
`This add Saltcorn schema to existing database\nContinue (y/n)?`);
|
|
24
|
+
if (!ans) {
|
|
25
|
+
console.log(`Success: Command execution canceled`);
|
|
26
|
+
this.exit(1);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
19
29
|
await reset(true);
|
|
20
|
-
|
|
30
|
+
console.log(`Success: Command execution successfully`);
|
|
21
31
|
this.exit(0);
|
|
22
32
|
}
|
|
23
33
|
}
|
|
@@ -27,4 +37,16 @@ class AddSchemaCommand extends Command {
|
|
|
27
37
|
*/
|
|
28
38
|
AddSchemaCommand.description = `Add Saltcorn schema to existing database`;
|
|
29
39
|
|
|
40
|
+
/**
|
|
41
|
+
* @type {string}
|
|
42
|
+
*/
|
|
43
|
+
AddSchemaCommand.help = `Add Saltcorn schema to existing database`;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @type {object}
|
|
47
|
+
*/
|
|
48
|
+
AddSchemaCommand.flags = {
|
|
49
|
+
force: flags.boolean({ char: "f", description: "force command execution" }),
|
|
50
|
+
};
|
|
51
|
+
|
|
30
52
|
module.exports = AddSchemaCommand;
|
package/src/commands/backup.js
CHANGED
|
@@ -7,13 +7,12 @@ const { execSync } = require("child_process");
|
|
|
7
7
|
const dateFormat = require("dateformat");
|
|
8
8
|
const os = require("os");
|
|
9
9
|
const { getConnectObject } = require("@saltcorn/data/db/connect");
|
|
10
|
-
const
|
|
11
|
-
var day = dateFormat(new Date(), "yyyymmdd");
|
|
10
|
+
const day = dateFormat(new Date(), "yyyymmdd");
|
|
12
11
|
const connobj = getConnectObject();
|
|
13
12
|
|
|
14
13
|
const pgdb = connobj.database;
|
|
15
14
|
|
|
16
|
-
|
|
15
|
+
const default_filenm = `${day}-${pgdb}-${os.hostname}.sqlc`;
|
|
17
16
|
|
|
18
17
|
/**
|
|
19
18
|
* BackupCommand Class
|
|
@@ -67,6 +66,11 @@ class BackupCommand extends Command {
|
|
|
67
66
|
*/
|
|
68
67
|
BackupCommand.description = `Backup the PostgreSQL database to a file with pg_dump or zip`;
|
|
69
68
|
|
|
69
|
+
/**
|
|
70
|
+
* @type {string}
|
|
71
|
+
*/
|
|
72
|
+
BackupCommand.help = `Backup the PostgreSQL database to a file with pg_dump or zip`;
|
|
73
|
+
|
|
70
74
|
/**
|
|
71
75
|
* @type {object}
|
|
72
76
|
*/
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
*/
|
|
5
5
|
const { Command, flags } = require("@oclif/command");
|
|
6
6
|
const { cli } = require("cli-ux");
|
|
7
|
-
const { maybe_as_tenant } = require("../common");
|
|
7
|
+
const { maybe_as_tenant, init_some_tenants } = require("../common");
|
|
8
8
|
|
|
9
|
+
// todo update logic based on modify-user command
|
|
9
10
|
/**
|
|
10
11
|
* CreateUserCommand Class
|
|
11
12
|
* @extends oclif.Command
|
|
@@ -16,6 +17,7 @@ class CreateUserCommand extends Command {
|
|
|
16
17
|
* @returns {Promise<void>}
|
|
17
18
|
*/
|
|
18
19
|
async run() {
|
|
20
|
+
|
|
19
21
|
const User = require("@saltcorn/data/models/user");
|
|
20
22
|
|
|
21
23
|
const { flags } = this.parse(CreateUserCommand);
|
|
@@ -23,12 +25,10 @@ class CreateUserCommand extends Command {
|
|
|
23
25
|
console.error("Error: specify at most one of admin and role");
|
|
24
26
|
this.exit(1);
|
|
25
27
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const tenants = await getAllTenants();
|
|
31
|
-
await init_multi_tenant(loadAllPlugins, undefined, tenants);
|
|
28
|
+
// init tenant
|
|
29
|
+
await init_some_tenants(flags.tenant);
|
|
30
|
+
|
|
31
|
+
// run function as specified tenant
|
|
32
32
|
await maybe_as_tenant(flags.tenant, async () => {
|
|
33
33
|
let role_id = flags.admin ? 1 : 8;
|
|
34
34
|
if (flags.role) {
|
|
@@ -43,7 +43,13 @@ class CreateUserCommand extends Command {
|
|
|
43
43
|
const email = flags.email || (await cli.prompt("Email address"));
|
|
44
44
|
const password =
|
|
45
45
|
flags.password || (await cli.prompt("Password", { type: "hide" }));
|
|
46
|
-
await User.create({ email, password, role_id });
|
|
46
|
+
const u = await User.create({ email, password, role_id });
|
|
47
|
+
if(u instanceof User)
|
|
48
|
+
console.log(`Success: User ${email} created successfully ${
|
|
49
|
+
typeof flags.tenant !== "undefined" ? "in tenant " + flags.tenant : ""
|
|
50
|
+
}`);
|
|
51
|
+
else
|
|
52
|
+
console.error(`Error: ${u.error}`);
|
|
47
53
|
});
|
|
48
54
|
this.exit(0);
|
|
49
55
|
}
|
|
@@ -27,27 +27,31 @@ class DeleteTenantsCommand extends Command {
|
|
|
27
27
|
|
|
28
28
|
for (const ten of tensExamine) {
|
|
29
29
|
let nusers, ntables, nviews, npages;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (nusers < 2 && ntables < 2 && nviews < 1 && npages < 1) {
|
|
37
|
-
console.log("deleting ", ten.subdomain, {
|
|
38
|
-
nusers,
|
|
39
|
-
ntables,
|
|
40
|
-
nviews,
|
|
41
|
-
npages,
|
|
42
|
-
});
|
|
43
|
-
await deleteTenant(ten.subdomain);
|
|
44
|
-
} else {
|
|
45
|
-
console.log("leaving", ten.subdomain, {
|
|
46
|
-
nusers,
|
|
47
|
-
ntables,
|
|
48
|
-
nviews,
|
|
49
|
-
npages,
|
|
30
|
+
try {
|
|
31
|
+
await db.runWithTenant(ten.subdomain, async () => {
|
|
32
|
+
nusers = await db.count("users");
|
|
33
|
+
ntables = await db.count("_sc_tables");
|
|
34
|
+
nviews = await db.count("_sc_views");
|
|
35
|
+
npages = await db.count("_sc_pages");
|
|
50
36
|
});
|
|
37
|
+
if (nusers < 2 && ntables < 2 && nviews < 1 && npages < 1) {
|
|
38
|
+
console.log("deleting ", ten.subdomain, {
|
|
39
|
+
nusers,
|
|
40
|
+
ntables,
|
|
41
|
+
nviews,
|
|
42
|
+
npages,
|
|
43
|
+
});
|
|
44
|
+
await deleteTenant(ten.subdomain);
|
|
45
|
+
} else {
|
|
46
|
+
console.log("leaving", ten.subdomain, {
|
|
47
|
+
nusers,
|
|
48
|
+
ntables,
|
|
49
|
+
nviews,
|
|
50
|
+
npages,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
} catch (e) {
|
|
54
|
+
console.error("Error in tenant", ten.subdomain, e);
|
|
51
55
|
}
|
|
52
56
|
}
|
|
53
57
|
this.exit(0);
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-cli
|
|
3
|
+
* @module commands/delete-user
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// todo support for users without emails (using user.id)
|
|
7
|
+
const { Command, flags } = require("@oclif/command");
|
|
8
|
+
const { cli } = require("cli-ux");
|
|
9
|
+
const { maybe_as_tenant } = require("../common");
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* DeleteUserCommand Class
|
|
14
|
+
* @extends oclif.Command
|
|
15
|
+
* @category saltcorn-cli
|
|
16
|
+
*/
|
|
17
|
+
class DeleteUserCommand extends Command {
|
|
18
|
+
/**
|
|
19
|
+
* @returns {Promise<void>}
|
|
20
|
+
*/
|
|
21
|
+
async run() {
|
|
22
|
+
|
|
23
|
+
const User = require("@saltcorn/data/models/user");
|
|
24
|
+
|
|
25
|
+
const { args } = this.parse(DeleteUserCommand);
|
|
26
|
+
const { flags } = this.parse(DeleteUserCommand);
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
// run function as specified tenant
|
|
30
|
+
await maybe_as_tenant(flags.tenant, async () => {
|
|
31
|
+
// try to find user
|
|
32
|
+
const u = await User.findOne({email: args.user_email});
|
|
33
|
+
if (u === null) {
|
|
34
|
+
console.error(`Error: User ${args.user_email} is not found`);
|
|
35
|
+
this.exit(1);
|
|
36
|
+
}
|
|
37
|
+
if (!u instanceof User) {
|
|
38
|
+
console.error(`Error: ${u.error}`);
|
|
39
|
+
this.exit(1);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// make changes
|
|
43
|
+
// todo handle errors
|
|
44
|
+
if (!flags.force) {
|
|
45
|
+
const ans = await cli.confirm(
|
|
46
|
+
`This will delete user ${args.user_email} ${
|
|
47
|
+
typeof flags.tenant !== "undefined" ? "from " + flags.tenant : ""
|
|
48
|
+
}.\nContinue (y/n)?`);
|
|
49
|
+
if (!ans) {
|
|
50
|
+
console.log(`Success: Command execution canceled`);
|
|
51
|
+
this.exit(1);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// delete user
|
|
57
|
+
await u.delete();
|
|
58
|
+
console.log(`Success: User ${args.user_email} deleted ${
|
|
59
|
+
typeof flags.tenant !== "undefined" ? "from " + flags.tenant : ""
|
|
60
|
+
}`);
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
);
|
|
65
|
+
this.exit(0);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @type {object}
|
|
71
|
+
*/
|
|
72
|
+
DeleteUserCommand.args = [
|
|
73
|
+
{ name: "user_email", required: true, description: "User to delete" },
|
|
74
|
+
];
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* @type {string}
|
|
78
|
+
*/
|
|
79
|
+
DeleteUserCommand.description = `Delete user.
|
|
80
|
+
|
|
81
|
+
Command deletes the user specified by USER_EMAIL.
|
|
82
|
+
|
|
83
|
+
`;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @type {string}
|
|
87
|
+
*/
|
|
88
|
+
DeleteUserCommand.help = `Delete user.
|
|
89
|
+
|
|
90
|
+
Command deletes the user specified by USER_EMAIL.
|
|
91
|
+
|
|
92
|
+
`;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* @type {object}
|
|
96
|
+
*/
|
|
97
|
+
DeleteUserCommand.flags = {
|
|
98
|
+
force: flags.boolean({ char: "f", description: "force command execution" }),
|
|
99
|
+
tenant: flags.string({
|
|
100
|
+
char: "t",
|
|
101
|
+
description: "tenant",
|
|
102
|
+
}),
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
module.exports = DeleteUserCommand;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-cli
|
|
3
|
+
* @module commands/modify-user
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// todo support for users without emails (using user.id)
|
|
7
|
+
const { Command, flags } = require("@oclif/command");
|
|
8
|
+
const { cli } = require("cli-ux");
|
|
9
|
+
const { maybe_as_tenant, init_some_tenants } = require("../common");
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* ModifyUserCommand Class
|
|
14
|
+
* @extends oclif.Command
|
|
15
|
+
* @category saltcorn-cli
|
|
16
|
+
*/
|
|
17
|
+
class ModifyUserCommand extends Command {
|
|
18
|
+
/**
|
|
19
|
+
* @returns {Promise<void>}
|
|
20
|
+
*/
|
|
21
|
+
async run() {
|
|
22
|
+
|
|
23
|
+
const User = require("@saltcorn/data/models/user");
|
|
24
|
+
|
|
25
|
+
const { args } = this.parse(ModifyUserCommand);
|
|
26
|
+
const { flags } = this.parse(ModifyUserCommand);
|
|
27
|
+
|
|
28
|
+
if (flags.admin && flags.role && flags.role !== "admin") {
|
|
29
|
+
console.error("Error: specify at most one of admin and role");
|
|
30
|
+
this.exit(1);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// init tenant
|
|
34
|
+
await init_some_tenants(flags.tenant);
|
|
35
|
+
|
|
36
|
+
// run function as specified tenant
|
|
37
|
+
await maybe_as_tenant(flags.tenant, async () => {
|
|
38
|
+
// role_id
|
|
39
|
+
let role_id; // = flags.admin ? 1 : 8;
|
|
40
|
+
if (flags.admin) role_id = 1;
|
|
41
|
+
else if (flags.role) {
|
|
42
|
+
const roles = await User.get_roles();
|
|
43
|
+
const role = roles.find((r) => r.role === flags.role);
|
|
44
|
+
if (!role) {
|
|
45
|
+
console.error(`Error: role ${flags.role} not found`);
|
|
46
|
+
this.exit(1);
|
|
47
|
+
}
|
|
48
|
+
role_id = role.id;
|
|
49
|
+
}
|
|
50
|
+
// email
|
|
51
|
+
let email;
|
|
52
|
+
if (flags.email) email = flags.email;
|
|
53
|
+
else if (flags.imode) email = await cli.prompt("New Email address", { default : args.user_email });
|
|
54
|
+
if(email === args.user_email) email = undefined; // little trick - we won't update email if it already same
|
|
55
|
+
if (email)
|
|
56
|
+
if (!User.valid_email(email)){
|
|
57
|
+
console.error(`Error: Email is invalid`);
|
|
58
|
+
this.exit(1);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// password
|
|
62
|
+
// todo check for repeated passwords
|
|
63
|
+
let password;
|
|
64
|
+
if (flags.password) password = flags.password;
|
|
65
|
+
else if (flags.imode) password = await cli.prompt("New Password", { type: "hide" });
|
|
66
|
+
if (password)
|
|
67
|
+
if (User.unacceptable_password_reason(password)){
|
|
68
|
+
console.error(`Error: ${User.unacceptable_password_reason(password)}`);
|
|
69
|
+
this.exit(1);
|
|
70
|
+
}
|
|
71
|
+
// check that user with new email does not exists
|
|
72
|
+
const u_new_email = await User.findOne({ email });
|
|
73
|
+
if(u_new_email !== null&&args.user_email!==email){
|
|
74
|
+
console.error(`Error: Cannot change email from ${args.user_email} to ${email}. User with email ${email} exists`);
|
|
75
|
+
this.exit(1);
|
|
76
|
+
}
|
|
77
|
+
// try to find user
|
|
78
|
+
const u = await User.findOne({ email: args.user_email });
|
|
79
|
+
if(u === null){
|
|
80
|
+
console.error(`Error: User ${args.user_email} is not found`);
|
|
81
|
+
this.exit(1);
|
|
82
|
+
}
|
|
83
|
+
if(!u instanceof User){
|
|
84
|
+
console.error(`Error: ${u.error}`);
|
|
85
|
+
this.exit(1);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// make changes
|
|
89
|
+
if (email && role_id)
|
|
90
|
+
await u.update({ email, role_id });
|
|
91
|
+
else if(email)
|
|
92
|
+
await u.update({ email });
|
|
93
|
+
else if(role_id)
|
|
94
|
+
await u.update({ role_id });
|
|
95
|
+
|
|
96
|
+
if (password)
|
|
97
|
+
await u.changePasswordTo(password, false);
|
|
98
|
+
|
|
99
|
+
console.log(`Success: User ${email?email:args.user_email} updated successfully ${
|
|
100
|
+
typeof flags.tenant !== "undefined" ? "in tenant " + flags.tenant : ""
|
|
101
|
+
}`);
|
|
102
|
+
|
|
103
|
+
});
|
|
104
|
+
this.exit(0);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* @type {object}
|
|
110
|
+
*/
|
|
111
|
+
ModifyUserCommand.args = [
|
|
112
|
+
{ name: "user_email", required: true, description: "User to modify" },
|
|
113
|
+
];
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @type {string}
|
|
117
|
+
*/
|
|
118
|
+
ModifyUserCommand.description = `Modify (update) user.
|
|
119
|
+
|
|
120
|
+
Command changes the user specified by USER_EMAIL.
|
|
121
|
+
|
|
122
|
+
You can change the user group, password and email.
|
|
123
|
+
|
|
124
|
+
NOTE that -a and -r role (--role=role) can give conflict.
|
|
125
|
+
`;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* @type {string}
|
|
129
|
+
*/
|
|
130
|
+
ModifyUserCommand.help = `Modify (update) user.
|
|
131
|
+
|
|
132
|
+
Command changes the user specified by USER_EMAIL.
|
|
133
|
+
|
|
134
|
+
You can change the user group, password and email.
|
|
135
|
+
|
|
136
|
+
NOTE that -a and -r role (--role=role) can give conflict.
|
|
137
|
+
`;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* @type {object}
|
|
141
|
+
*/
|
|
142
|
+
ModifyUserCommand.flags = {
|
|
143
|
+
admin: flags.boolean({ char: "a", description: "make user be Admin" }),
|
|
144
|
+
tenant: flags.string({
|
|
145
|
+
char: "t",
|
|
146
|
+
description: "tenant",
|
|
147
|
+
}),
|
|
148
|
+
email: flags.string({
|
|
149
|
+
char: "e",
|
|
150
|
+
description: "new email",
|
|
151
|
+
}),
|
|
152
|
+
role: flags.string({
|
|
153
|
+
char: "r",
|
|
154
|
+
description: "new role (can conflict with -a option)",
|
|
155
|
+
}),
|
|
156
|
+
password: flags.string({
|
|
157
|
+
char: "p",
|
|
158
|
+
description: "new password",
|
|
159
|
+
}),
|
|
160
|
+
imode: flags.boolean({ char: "i", description: "interactive mode" }),
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
module.exports = ModifyUserCommand;
|
|
@@ -17,7 +17,7 @@ class ResetCommand extends Command {
|
|
|
17
17
|
*/
|
|
18
18
|
async run() {
|
|
19
19
|
const reset = require("@saltcorn/data/db/reset_schema");
|
|
20
|
-
const db = require("@saltcorn/data/db
|
|
20
|
+
const db = require("@saltcorn/data/db");
|
|
21
21
|
const { flags } = this.parse(ResetCommand);
|
|
22
22
|
await maybe_as_tenant(flags.tenant, async () => {
|
|
23
23
|
const schema = db.getTenantSchema();
|
|
@@ -32,6 +32,7 @@ class ResetCommand extends Command {
|
|
|
32
32
|
if (ans) await reset(false, schema);
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
|
+
console.log(`Success: Command execution successfully`);
|
|
35
36
|
this.exit(0);
|
|
36
37
|
}
|
|
37
38
|
}
|
|
@@ -44,11 +45,19 @@ ResetCommand.description = `Reset the database
|
|
|
44
45
|
This will delete all existing information
|
|
45
46
|
`;
|
|
46
47
|
|
|
48
|
+
/**
|
|
49
|
+
* @type {string}
|
|
50
|
+
*/
|
|
51
|
+
ResetCommand.help = `Reset the database
|
|
52
|
+
...
|
|
53
|
+
This will delete all existing information
|
|
54
|
+
`;
|
|
55
|
+
|
|
47
56
|
/**
|
|
48
57
|
* @type {object}
|
|
49
58
|
*/
|
|
50
59
|
ResetCommand.flags = {
|
|
51
|
-
force: flags.boolean({ char: "f", description: "force" }),
|
|
60
|
+
force: flags.boolean({ char: "f", description: "force command execution" }),
|
|
52
61
|
tenant: flags.string({
|
|
53
62
|
char: "t",
|
|
54
63
|
description: "tenant",
|
package/src/commands/restore.js
CHANGED
|
@@ -91,6 +91,11 @@ RestoreCommand.args = [
|
|
|
91
91
|
*/
|
|
92
92
|
RestoreCommand.description = `Restore a previously backed up database (zip or sqlc format)`;
|
|
93
93
|
|
|
94
|
+
/**
|
|
95
|
+
* @type {string}
|
|
96
|
+
*/
|
|
97
|
+
RestoreCommand.help = `Restore a previously backed up database (zip or sqlc format)`;
|
|
98
|
+
|
|
94
99
|
/**
|
|
95
100
|
* @type {object}
|
|
96
101
|
*/
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* @module commands/rm-tenant
|
|
4
4
|
*/
|
|
5
5
|
const { Command, flags } = require("@oclif/command");
|
|
6
|
+
const {cli} = require("cli-ux");
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* RmTenantCommand Class
|
|
@@ -14,9 +15,23 @@ class RmTenantCommand extends Command {
|
|
|
14
15
|
* @returns {Promise<void>}
|
|
15
16
|
*/
|
|
16
17
|
async run() {
|
|
17
|
-
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
const { flags } = this.parse(RmTenantCommand);
|
|
21
|
+
|
|
18
22
|
const { deleteTenant } = require("@saltcorn/admin-models/models/tenant");
|
|
19
|
-
|
|
23
|
+
|
|
24
|
+
if (!flags.force) {
|
|
25
|
+
const ans = await cli.confirm(
|
|
26
|
+
`This will delete tenant ${flags.tenant}. Attention! All tenant data will be lost!\nContinue (y/n)?`);
|
|
27
|
+
if (!ans) {
|
|
28
|
+
console.log(`Success: Command execution canceled`);
|
|
29
|
+
this.exit(1);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
// make changes
|
|
33
|
+
await deleteTenant(flags.tenant);
|
|
34
|
+
|
|
20
35
|
this.exit(0);
|
|
21
36
|
}
|
|
22
37
|
}
|
|
@@ -24,18 +39,36 @@ class RmTenantCommand extends Command {
|
|
|
24
39
|
/**
|
|
25
40
|
* @type {object}
|
|
26
41
|
*/
|
|
27
|
-
RmTenantCommand.args = [
|
|
42
|
+
RmTenantCommand.args = []; /*[
|
|
28
43
|
{ name: "tenant", required: true, description: "Tenant to remove" },
|
|
29
44
|
];
|
|
30
|
-
|
|
45
|
+
*/
|
|
31
46
|
/**
|
|
32
47
|
* @type {string}
|
|
33
48
|
*/
|
|
34
|
-
RmTenantCommand.description = `Remove a tenant
|
|
49
|
+
RmTenantCommand.description = `Remove a tenant.
|
|
50
|
+
Attention! All tenant data will be lost!
|
|
51
|
+
It recommended to make backup of tenant before perform this command.
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @type {object}
|
|
56
|
+
*/
|
|
57
|
+
RmTenantCommand.help = `Remove a tenant.
|
|
58
|
+
Attention! All tenant data will be lost!
|
|
59
|
+
It recommended to make backup of tenant before perform this command.
|
|
60
|
+
`;
|
|
35
61
|
|
|
36
62
|
/**
|
|
37
63
|
* @type {object}
|
|
38
64
|
*/
|
|
39
|
-
RmTenantCommand.flags = {
|
|
65
|
+
RmTenantCommand.flags = {
|
|
66
|
+
force: flags.boolean({ char: "f", description: "force command execution" }),
|
|
67
|
+
tenant: flags.string({
|
|
68
|
+
char: "t",
|
|
69
|
+
description: "tenant",
|
|
70
|
+
required: true,
|
|
71
|
+
}),
|
|
72
|
+
};
|
|
40
73
|
|
|
41
74
|
module.exports = RmTenantCommand;
|
|
@@ -156,11 +156,12 @@ class RunTestsCommand extends Command {
|
|
|
156
156
|
const cwd = "packages/" + args.package;
|
|
157
157
|
await this.do_test("npm", ["run", "test", ...jestParams], env, cwd);
|
|
158
158
|
} else {
|
|
159
|
-
const
|
|
159
|
+
const cwd = ".";
|
|
160
160
|
await this.do_test(
|
|
161
|
-
|
|
162
|
-
["
|
|
163
|
-
env
|
|
161
|
+
"npm",
|
|
162
|
+
["--workspaces", "run", "test", ...jestParams],
|
|
163
|
+
env,
|
|
164
|
+
cwd
|
|
164
165
|
);
|
|
165
166
|
//await this.e2etest(env);
|
|
166
167
|
}
|
package/src/commands/setup.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* Set up new saltcorn configuration
|
|
2
3
|
* @category saltcorn-cli
|
|
3
4
|
* @module commands/setup
|
|
4
5
|
*/
|
|
@@ -20,20 +21,25 @@ const sudo = require("sudo");
|
|
|
20
21
|
const crypto = require("crypto");
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
|
-
*
|
|
24
|
+
* Generate password for user
|
|
24
25
|
* @returns {string}
|
|
25
26
|
*/
|
|
27
|
+
// todo deduplicate code - the same function in User
|
|
26
28
|
const gen_password = () => {
|
|
27
29
|
const s = is.str.generate().replace(" ", "");
|
|
28
30
|
if (s.length > 7) return s;
|
|
29
31
|
else return gen_password();
|
|
30
32
|
};
|
|
31
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Generate jwt secret
|
|
35
|
+
* @returns {string}
|
|
36
|
+
*/
|
|
32
37
|
const genJwtSecret = () => {
|
|
33
38
|
return crypto.randomBytes(64).toString("hex");
|
|
34
39
|
};
|
|
35
40
|
|
|
36
41
|
/**
|
|
42
|
+
* Ask for platform run mode (dev - run manually, server - run as system service)
|
|
37
43
|
*
|
|
38
44
|
* @returns {Promise<object>}
|
|
39
45
|
*/
|
|
@@ -63,7 +69,7 @@ const askDevServer = async () => {
|
|
|
63
69
|
};
|
|
64
70
|
|
|
65
71
|
/**
|
|
66
|
-
*
|
|
72
|
+
* Unload module
|
|
67
73
|
* @param {*} mod
|
|
68
74
|
*/
|
|
69
75
|
const unloadModule = (mod) => {
|
|
@@ -72,6 +78,7 @@ const unloadModule = (mod) => {
|
|
|
72
78
|
};
|
|
73
79
|
|
|
74
80
|
/**
|
|
81
|
+
* Set up platform run mode (dev - run manually, server - run as system service)
|
|
75
82
|
* @returns {Promise<void>}
|
|
76
83
|
*/
|
|
77
84
|
const setupDevMode = async () => {
|
|
@@ -95,6 +102,8 @@ const setupDevMode = async () => {
|
|
|
95
102
|
};
|
|
96
103
|
|
|
97
104
|
/**
|
|
105
|
+
* Check for locally running database (ip 127.0.0.1, port 5432)
|
|
106
|
+
*
|
|
98
107
|
* @returns {Promise<void>}
|
|
99
108
|
*/
|
|
100
109
|
const check_db = async () => {
|
|
@@ -125,7 +134,7 @@ const check_db = async () => {
|
|
|
125
134
|
};
|
|
126
135
|
|
|
127
136
|
/**
|
|
128
|
-
*
|
|
137
|
+
* Execute Linux commands
|
|
129
138
|
* @param {*} args
|
|
130
139
|
* @returns {Promise<void>}
|
|
131
140
|
*/
|
|
@@ -146,7 +155,7 @@ const asyncSudo = (args) => {
|
|
|
146
155
|
};
|
|
147
156
|
|
|
148
157
|
/**
|
|
149
|
-
*
|
|
158
|
+
* Execute Postgres commands
|
|
150
159
|
* @param {*} args
|
|
151
160
|
* @returns {Promise<void>}
|
|
152
161
|
*/
|
|
@@ -155,7 +164,7 @@ const asyncSudoPostgres = (args) => {
|
|
|
155
164
|
};
|
|
156
165
|
|
|
157
166
|
/**
|
|
158
|
-
*
|
|
167
|
+
* Ask for passworf
|
|
159
168
|
* @param {string} for_who
|
|
160
169
|
* @returns {Promise<string>}
|
|
161
170
|
*/
|
|
@@ -173,6 +182,7 @@ const get_password = async (for_who) => {
|
|
|
173
182
|
};
|
|
174
183
|
|
|
175
184
|
/**
|
|
185
|
+
* Install Database
|
|
176
186
|
* @returns {Promise<void>}
|
|
177
187
|
*/
|
|
178
188
|
const install_db = async () => {
|
|
@@ -228,7 +238,7 @@ const install_db = async () => {
|
|
|
228
238
|
};
|
|
229
239
|
|
|
230
240
|
/**
|
|
231
|
-
*
|
|
241
|
+
* Ask for Database parameters
|
|
232
242
|
* @returns {Promise<object>}
|
|
233
243
|
*/
|
|
234
244
|
const prompt_connection = async () => {
|
|
@@ -262,6 +272,7 @@ const prompt_connection = async () => {
|
|
|
262
272
|
};
|
|
263
273
|
|
|
264
274
|
/**
|
|
275
|
+
* Write platform config
|
|
265
276
|
* @returns {Promise<void>}
|
|
266
277
|
*/
|
|
267
278
|
const setup_connection_config = async () => {
|
|
@@ -310,10 +321,10 @@ const setup_connection = async () => {
|
|
|
310
321
|
* @returns {Promise<boolean>}
|
|
311
322
|
*/
|
|
312
323
|
const table_exists = async (db, tblname) => {
|
|
313
|
-
const { rows } = await db.query(`SELECT EXISTS
|
|
324
|
+
const { rows } = await db.query(`SELECT EXISTS
|
|
314
325
|
(
|
|
315
326
|
SELECT 1
|
|
316
|
-
FROM information_schema.tables
|
|
327
|
+
FROM information_schema.tables
|
|
317
328
|
WHERE table_schema = 'public'
|
|
318
329
|
AND table_name = '${tblname}'
|
|
319
330
|
);`);
|
|
@@ -381,7 +392,7 @@ class SetupCommand extends Command {
|
|
|
381
392
|
*/
|
|
382
393
|
SetupCommand.description = `Set up a new system
|
|
383
394
|
...
|
|
384
|
-
This will attempt to install or connect a database, and set up a
|
|
395
|
+
This will attempt to install or connect a database, and set up a
|
|
385
396
|
configuration file
|
|
386
397
|
`;
|
|
387
398
|
|
package/src/common.js
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
* @category saltcorn-cli
|
|
3
3
|
* @module common
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
// todo need to be reorganized
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
* @param {
|
|
7
|
+
* Execute function for specified tenant
|
|
8
|
+
* @param {object} ten - specified tenant
|
|
9
|
+
* @param {function} f - function
|
|
9
10
|
* @returns {Promise<void>}
|
|
10
11
|
*/
|
|
11
12
|
const maybe_as_tenant = async (ten, f) => {
|
|
@@ -13,7 +14,11 @@ const maybe_as_tenant = async (ten, f) => {
|
|
|
13
14
|
const db = require("@saltcorn/data/db");
|
|
14
15
|
return await db.runWithTenant(ten, f);
|
|
15
16
|
};
|
|
16
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Init specified tenant
|
|
19
|
+
* @param tenant - specified tenant
|
|
20
|
+
* @returns {Promise<void>}
|
|
21
|
+
*/
|
|
17
22
|
const init_some_tenants = async (tenant) => {
|
|
18
23
|
const { loadAllPlugins } = require("@saltcorn/server/load_plugins");
|
|
19
24
|
const { init_multi_tenant } = require("@saltcorn/data/db/state");
|
|
@@ -24,6 +29,7 @@ const init_some_tenants = async (tenant) => {
|
|
|
24
29
|
};
|
|
25
30
|
|
|
26
31
|
/**
|
|
32
|
+
* parse JSON or String
|
|
27
33
|
* @param {string} s
|
|
28
34
|
* @returns {object}
|
|
29
35
|
*/
|
|
@@ -36,12 +42,14 @@ const parseJSONorString = (s) => {
|
|
|
36
42
|
};
|
|
37
43
|
|
|
38
44
|
/**
|
|
39
|
-
*
|
|
45
|
+
* Sleep ms miliseconds
|
|
46
|
+
* @param {number} ms
|
|
40
47
|
* @returns {Promise<void>}
|
|
41
48
|
*/
|
|
42
49
|
function sleep(ms) {
|
|
43
50
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
44
51
|
}
|
|
52
|
+
|
|
45
53
|
module.exports = {
|
|
46
54
|
maybe_as_tenant,
|
|
47
55
|
parseJSONorString,
|
package/src/index.js
CHANGED
|
@@ -10,7 +10,10 @@
|
|
|
10
10
|
* @property {module:commands/backup} backup
|
|
11
11
|
* @property {module:commands/create-tenant} create-tenant
|
|
12
12
|
* @property {module:commands/create-user} create-user
|
|
13
|
+
* @property {module:commands/create-user} delete-tenants
|
|
14
|
+
* @property {module:commands/create-user} delete-user
|
|
13
15
|
* @property {module:commands/fixtures} fixtures
|
|
16
|
+
* @property {module:commands/fixtures} get-cfg
|
|
14
17
|
* @property {module:commands/info} info
|
|
15
18
|
* @property {module:commands/install-pack} install-pack
|
|
16
19
|
* @property {module:commands/install-plugin} install-plugin
|
|
@@ -18,17 +21,21 @@
|
|
|
18
21
|
* @property {module:commands/localize-plugin} localize-plugin
|
|
19
22
|
* @property {module:commands/make-migration} make-migration
|
|
20
23
|
* @property {module:commands/migrate} migrate
|
|
24
|
+
* @property {module:commands/modify-user} modify-user
|
|
21
25
|
* @property {module:commands/plugins} plugins
|
|
22
26
|
* @property {module:commands/release} release
|
|
23
27
|
* @property {module:commands/reset-schema} reset-schema
|
|
24
28
|
* @property {module:commands/restore} restore
|
|
25
29
|
* @property {module:commands/rm-tenant} rm-tenant
|
|
26
30
|
* @property {module:commands/run-benchmark} run-benchmark
|
|
31
|
+
* @property {module:commands/run-benchmark} run-test
|
|
32
|
+
* @property {module:commands/setup} scheduler
|
|
27
33
|
* @property {module:commands/setup} setup
|
|
34
|
+
* @property {module:commands/setup} setup-benchmark
|
|
28
35
|
* @property {module:commands/test-plugin} test-plugin
|
|
29
36
|
* @property {module:commands/transform-field} transform-field
|
|
30
|
-
*
|
|
37
|
+
*
|
|
31
38
|
* @category saltcorn-cli
|
|
32
|
-
*/
|
|
39
|
+
*/
|
|
33
40
|
|
|
34
41
|
module.exports = require("@oclif/command");
|