@saltcorn/cli 0.8.8-beta.1 → 0.8.8-beta.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/README.md +79 -41
- package/oclif.manifest.json +1 -1
- package/package.json +6 -6
- package/src/commands/build-app.js +8 -1
- package/src/commands/list-tenants.js +29 -36
- package/src/commands/list-triggers.js +7 -22
- package/src/commands/run-js.js +79 -0
- package/src/commands/run-sql.js +6 -40
- package/src/commands/sync-upload-data.js +246 -0
- package/src/common.js +20 -0
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.8.8-beta.
|
|
23
|
+
@saltcorn/cli/0.8.8-beta.2 linux-x64 node-v18.7.0
|
|
24
24
|
$ saltcorn --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ saltcorn COMMAND
|
|
@@ -62,6 +62,7 @@ USAGE
|
|
|
62
62
|
* [`saltcorn restore FILE`](#saltcorn-restore-file)
|
|
63
63
|
* [`saltcorn rm-tenant`](#saltcorn-rm-tenant)
|
|
64
64
|
* [`saltcorn run-benchmark [BASEURL]`](#saltcorn-run-benchmark-baseurl)
|
|
65
|
+
* [`saltcorn run-js`](#saltcorn-run-js)
|
|
65
66
|
* [`saltcorn run-sql`](#saltcorn-run-sql)
|
|
66
67
|
* [`saltcorn run-tests [PACKAGE]`](#saltcorn-run-tests-package)
|
|
67
68
|
* [`saltcorn run-trigger TRIGGER`](#saltcorn-run-trigger-trigger)
|
|
@@ -70,6 +71,7 @@ USAGE
|
|
|
70
71
|
* [`saltcorn set-cfg [KEY] [VALUE]`](#saltcorn-set-cfg-key-value)
|
|
71
72
|
* [`saltcorn setup`](#saltcorn-setup)
|
|
72
73
|
* [`saltcorn setup-benchmark`](#saltcorn-setup-benchmark)
|
|
74
|
+
* [`saltcorn sync-upload-data`](#saltcorn-sync-upload-data)
|
|
73
75
|
* [`saltcorn take-snapshot`](#saltcorn-take-snapshot)
|
|
74
76
|
* [`saltcorn transform-field EXPRESSION FIELD TABLE [TENANT]`](#saltcorn-transform-field-expression-field-table-tenant)
|
|
75
77
|
|
|
@@ -85,7 +87,7 @@ OPTIONS
|
|
|
85
87
|
-f, --force force command execution
|
|
86
88
|
```
|
|
87
89
|
|
|
88
|
-
_See code: [src/commands/add-schema.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
90
|
+
_See code: [src/commands/add-schema.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/add-schema.js)_
|
|
89
91
|
|
|
90
92
|
## `saltcorn backup`
|
|
91
93
|
|
|
@@ -102,7 +104,7 @@ OPTIONS
|
|
|
102
104
|
-z, --zip Backup public in saltcorn zip format
|
|
103
105
|
```
|
|
104
106
|
|
|
105
|
-
_See code: [src/commands/backup.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
107
|
+
_See code: [src/commands/backup.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/backup.js)_
|
|
106
108
|
|
|
107
109
|
## `saltcorn build-app`
|
|
108
110
|
|
|
@@ -138,11 +140,14 @@ OPTIONS
|
|
|
138
140
|
|
|
139
141
|
--splashPage=splashPage Name of a page that should be shown while the app is loading.
|
|
140
142
|
|
|
143
|
+
--synchedTables=synchedTables Table names for which the offline should be synchronized with the saltcorn
|
|
144
|
+
server
|
|
145
|
+
|
|
141
146
|
--tenantAppName=tenantAppName Optional name of a tenant application, if set, the app will be build for this
|
|
142
147
|
tenant
|
|
143
148
|
```
|
|
144
149
|
|
|
145
|
-
_See code: [src/commands/build-app.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
150
|
+
_See code: [src/commands/build-app.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/build-app.js)_
|
|
146
151
|
|
|
147
152
|
## `saltcorn build-cordova-builder`
|
|
148
153
|
|
|
@@ -156,7 +161,7 @@ OPTIONS
|
|
|
156
161
|
--buildClean run a clean build with --no-cache
|
|
157
162
|
```
|
|
158
163
|
|
|
159
|
-
_See code: [src/commands/build-cordova-builder.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
164
|
+
_See code: [src/commands/build-cordova-builder.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/build-cordova-builder.js)_
|
|
160
165
|
|
|
161
166
|
## `saltcorn configuration-check`
|
|
162
167
|
|
|
@@ -170,7 +175,7 @@ OPTIONS
|
|
|
170
175
|
-t, --tenant=tenant tenant
|
|
171
176
|
```
|
|
172
177
|
|
|
173
|
-
_See code: [src/commands/configuration-check.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
178
|
+
_See code: [src/commands/configuration-check.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/configuration-check.js)_
|
|
174
179
|
|
|
175
180
|
## `saltcorn configuration-check-backups FILES`
|
|
176
181
|
|
|
@@ -187,7 +192,7 @@ OPTIONS
|
|
|
187
192
|
-d, --destructive destructive
|
|
188
193
|
```
|
|
189
194
|
|
|
190
|
-
_See code: [src/commands/configuration-check-backups.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
195
|
+
_See code: [src/commands/configuration-check-backups.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/configuration-check-backups.js)_
|
|
191
196
|
|
|
192
197
|
## `saltcorn create-tenant TENANT`
|
|
193
198
|
|
|
@@ -206,7 +211,7 @@ OPTIONS
|
|
|
206
211
|
--url=url Url of tenant
|
|
207
212
|
```
|
|
208
213
|
|
|
209
|
-
_See code: [src/commands/create-tenant.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
214
|
+
_See code: [src/commands/create-tenant.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/create-tenant.js)_
|
|
210
215
|
|
|
211
216
|
## `saltcorn create-user`
|
|
212
217
|
|
|
@@ -224,7 +229,7 @@ OPTIONS
|
|
|
224
229
|
-t, --tenant=tenant tenant
|
|
225
230
|
```
|
|
226
231
|
|
|
227
|
-
_See code: [src/commands/create-user.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
232
|
+
_See code: [src/commands/create-user.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/create-user.js)_
|
|
228
233
|
|
|
229
234
|
## `saltcorn delete-tenants`
|
|
230
235
|
|
|
@@ -235,7 +240,7 @@ USAGE
|
|
|
235
240
|
$ saltcorn delete-tenants
|
|
236
241
|
```
|
|
237
242
|
|
|
238
|
-
_See code: [src/commands/delete-tenants.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
243
|
+
_See code: [src/commands/delete-tenants.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/delete-tenants.js)_
|
|
239
244
|
|
|
240
245
|
## `saltcorn delete-user USER_EMAIL`
|
|
241
246
|
|
|
@@ -256,7 +261,7 @@ DESCRIPTION
|
|
|
256
261
|
Command deletes the user specified by USER_EMAIL.
|
|
257
262
|
```
|
|
258
263
|
|
|
259
|
-
_See code: [src/commands/delete-user.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
264
|
+
_See code: [src/commands/delete-user.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/delete-user.js)_
|
|
260
265
|
|
|
261
266
|
## `saltcorn dev:localize-plugin PLUGIN [PATH]`
|
|
262
267
|
|
|
@@ -275,7 +280,7 @@ OPTIONS
|
|
|
275
280
|
-u, --unlocalize Unlocalize plugin (local to npm)
|
|
276
281
|
```
|
|
277
282
|
|
|
278
|
-
_See code: [src/commands/dev/localize-plugin.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
283
|
+
_See code: [src/commands/dev/localize-plugin.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/dev/localize-plugin.js)_
|
|
279
284
|
|
|
280
285
|
## `saltcorn make-migration`
|
|
281
286
|
|
|
@@ -291,7 +296,7 @@ DESCRIPTION
|
|
|
291
296
|
unless you are a developer.
|
|
292
297
|
```
|
|
293
298
|
|
|
294
|
-
_See code: [src/commands/dev/make-migration.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
299
|
+
_See code: [src/commands/dev/make-migration.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/dev/make-migration.js)_
|
|
295
300
|
|
|
296
301
|
## `saltcorn dev:post-release [TASK]`
|
|
297
302
|
|
|
@@ -305,7 +310,7 @@ ARGUMENTS
|
|
|
305
310
|
TASK (docker|vagrant|all|none) What to do
|
|
306
311
|
```
|
|
307
312
|
|
|
308
|
-
_See code: [src/commands/dev/post-release.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
313
|
+
_See code: [src/commands/dev/post-release.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/dev/post-release.js)_
|
|
309
314
|
|
|
310
315
|
## `saltcorn dev:release VERSION`
|
|
311
316
|
|
|
@@ -319,7 +324,7 @@ ARGUMENTS
|
|
|
319
324
|
VERSION New version number
|
|
320
325
|
```
|
|
321
326
|
|
|
322
|
-
_See code: [src/commands/dev/release.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
327
|
+
_See code: [src/commands/dev/release.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/dev/release.js)_
|
|
323
328
|
|
|
324
329
|
## `saltcorn dev:test-plugin PATH`
|
|
325
330
|
|
|
@@ -337,7 +342,7 @@ DESCRIPTION
|
|
|
337
342
|
Extra documentation goes here
|
|
338
343
|
```
|
|
339
344
|
|
|
340
|
-
_See code: [src/commands/dev/test-plugin.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
345
|
+
_See code: [src/commands/dev/test-plugin.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/dev/test-plugin.js)_
|
|
341
346
|
|
|
342
347
|
## `saltcorn fixtures`
|
|
343
348
|
|
|
@@ -356,7 +361,7 @@ DESCRIPTION
|
|
|
356
361
|
This manual step it is never required for users and rarely required for developers
|
|
357
362
|
```
|
|
358
363
|
|
|
359
|
-
_See code: [src/commands/fixtures.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
364
|
+
_See code: [src/commands/fixtures.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/fixtures.js)_
|
|
360
365
|
|
|
361
366
|
## `saltcorn get-cfg [KEY]`
|
|
362
367
|
|
|
@@ -374,7 +379,7 @@ OPTIONS
|
|
|
374
379
|
-t, --tenant=tenant tenant
|
|
375
380
|
```
|
|
376
381
|
|
|
377
|
-
_See code: [src/commands/get-cfg.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
382
|
+
_See code: [src/commands/get-cfg.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/get-cfg.js)_
|
|
378
383
|
|
|
379
384
|
## `saltcorn help [COMMAND]`
|
|
380
385
|
|
|
@@ -412,7 +417,7 @@ ALIASES
|
|
|
412
417
|
$ saltcorn paths
|
|
413
418
|
```
|
|
414
419
|
|
|
415
|
-
_See code: [src/commands/info.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
420
|
+
_See code: [src/commands/info.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/info.js)_
|
|
416
421
|
|
|
417
422
|
## `saltcorn inspect TYPE [NAME]`
|
|
418
423
|
|
|
@@ -430,7 +435,7 @@ OPTIONS
|
|
|
430
435
|
-t, --tenant=tenant tenant
|
|
431
436
|
```
|
|
432
437
|
|
|
433
|
-
_See code: [src/commands/inspect.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
438
|
+
_See code: [src/commands/inspect.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/inspect.js)_
|
|
434
439
|
|
|
435
440
|
## `saltcorn install-pack`
|
|
436
441
|
|
|
@@ -446,7 +451,7 @@ OPTIONS
|
|
|
446
451
|
-t, --tenant=tenant tenant
|
|
447
452
|
```
|
|
448
453
|
|
|
449
|
-
_See code: [src/commands/install-pack.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
454
|
+
_See code: [src/commands/install-pack.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/install-pack.js)_
|
|
450
455
|
|
|
451
456
|
## `saltcorn install-plugin`
|
|
452
457
|
|
|
@@ -462,7 +467,7 @@ OPTIONS
|
|
|
462
467
|
-t, --tenant=tenant tenant
|
|
463
468
|
```
|
|
464
469
|
|
|
465
|
-
_See code: [src/commands/install-plugin.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
470
|
+
_See code: [src/commands/install-plugin.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/install-plugin.js)_
|
|
466
471
|
|
|
467
472
|
## `saltcorn list-tenants`
|
|
468
473
|
|
|
@@ -477,7 +482,7 @@ OPTIONS
|
|
|
477
482
|
-v, --verbose verbose output
|
|
478
483
|
```
|
|
479
484
|
|
|
480
|
-
_See code: [src/commands/list-tenants.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
485
|
+
_See code: [src/commands/list-tenants.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/list-tenants.js)_
|
|
481
486
|
|
|
482
487
|
## `saltcorn list-triggers`
|
|
483
488
|
|
|
@@ -492,7 +497,7 @@ OPTIONS
|
|
|
492
497
|
-v, --verbose verbose output
|
|
493
498
|
```
|
|
494
499
|
|
|
495
|
-
_See code: [src/commands/list-triggers.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
500
|
+
_See code: [src/commands/list-triggers.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/list-triggers.js)_
|
|
496
501
|
|
|
497
502
|
## `saltcorn saltcorn migrate`
|
|
498
503
|
|
|
@@ -514,7 +519,7 @@ DESCRIPTION
|
|
|
514
519
|
servers and need to control when the migrations are run.
|
|
515
520
|
```
|
|
516
521
|
|
|
517
|
-
_See code: [src/commands/migrate.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
522
|
+
_See code: [src/commands/migrate.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/migrate.js)_
|
|
518
523
|
|
|
519
524
|
## `saltcorn modify-user USER_EMAIL`
|
|
520
525
|
|
|
@@ -543,7 +548,7 @@ DESCRIPTION
|
|
|
543
548
|
NOTE that -a and -r role (--role=role) can give conflict.
|
|
544
549
|
```
|
|
545
550
|
|
|
546
|
-
_See code: [src/commands/modify-user.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
551
|
+
_See code: [src/commands/modify-user.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/modify-user.js)_
|
|
547
552
|
|
|
548
553
|
## `saltcorn plugins`
|
|
549
554
|
|
|
@@ -570,7 +575,7 @@ EXAMPLES
|
|
|
570
575
|
plugins -u -f - force plugin update
|
|
571
576
|
```
|
|
572
577
|
|
|
573
|
-
_See code: [src/commands/plugins.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
578
|
+
_See code: [src/commands/plugins.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/plugins.js)_
|
|
574
579
|
|
|
575
580
|
## `saltcorn reset-schema`
|
|
576
581
|
|
|
@@ -589,7 +594,7 @@ DESCRIPTION
|
|
|
589
594
|
This will delete all existing information
|
|
590
595
|
```
|
|
591
596
|
|
|
592
|
-
_See code: [src/commands/reset-schema.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
597
|
+
_See code: [src/commands/reset-schema.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/reset-schema.js)_
|
|
593
598
|
|
|
594
599
|
## `saltcorn restore FILE`
|
|
595
600
|
|
|
@@ -606,7 +611,7 @@ OPTIONS
|
|
|
606
611
|
-t, --tenant=tenant tenant
|
|
607
612
|
```
|
|
608
613
|
|
|
609
|
-
_See code: [src/commands/restore.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
614
|
+
_See code: [src/commands/restore.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/restore.js)_
|
|
610
615
|
|
|
611
616
|
## `saltcorn rm-tenant`
|
|
612
617
|
|
|
@@ -625,7 +630,7 @@ DESCRIPTION
|
|
|
625
630
|
It recommended to make backup of tenant before perform this command.
|
|
626
631
|
```
|
|
627
632
|
|
|
628
|
-
_See code: [src/commands/rm-tenant.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
633
|
+
_See code: [src/commands/rm-tenant.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/rm-tenant.js)_
|
|
629
634
|
|
|
630
635
|
## `saltcorn run-benchmark [BASEURL]`
|
|
631
636
|
|
|
@@ -644,7 +649,23 @@ OPTIONS
|
|
|
644
649
|
-t, --token=token API Token for reporting results
|
|
645
650
|
```
|
|
646
651
|
|
|
647
|
-
_See code: [src/commands/run-benchmark.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
652
|
+
_See code: [src/commands/run-benchmark.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/run-benchmark.js)_
|
|
653
|
+
|
|
654
|
+
## `saltcorn run-js`
|
|
655
|
+
|
|
656
|
+
Run javascript code
|
|
657
|
+
|
|
658
|
+
```
|
|
659
|
+
USAGE
|
|
660
|
+
$ saltcorn run-js
|
|
661
|
+
|
|
662
|
+
OPTIONS
|
|
663
|
+
-c, --code=code js code
|
|
664
|
+
-f, --file=file path to script file
|
|
665
|
+
-t, --tenant=tenant tenant name
|
|
666
|
+
```
|
|
667
|
+
|
|
668
|
+
_See code: [src/commands/run-js.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/run-js.js)_
|
|
648
669
|
|
|
649
670
|
## `saltcorn run-sql`
|
|
650
671
|
|
|
@@ -660,7 +681,7 @@ OPTIONS
|
|
|
660
681
|
-t, --tenant=tenant tenant name
|
|
661
682
|
```
|
|
662
683
|
|
|
663
|
-
_See code: [src/commands/run-sql.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
684
|
+
_See code: [src/commands/run-sql.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/run-sql.js)_
|
|
664
685
|
|
|
665
686
|
## `saltcorn run-tests [PACKAGE]`
|
|
666
687
|
|
|
@@ -684,7 +705,7 @@ OPTIONS
|
|
|
684
705
|
--watchAll Watch files for changes and rerun all tests.
|
|
685
706
|
```
|
|
686
707
|
|
|
687
|
-
_See code: [src/commands/run-tests.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
708
|
+
_See code: [src/commands/run-tests.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/run-tests.js)_
|
|
688
709
|
|
|
689
710
|
## `saltcorn run-trigger TRIGGER`
|
|
690
711
|
|
|
@@ -701,7 +722,7 @@ OPTIONS
|
|
|
701
722
|
-t, --tenant=tenant tenant
|
|
702
723
|
```
|
|
703
724
|
|
|
704
|
-
_See code: [src/commands/run-trigger.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
725
|
+
_See code: [src/commands/run-trigger.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/run-trigger.js)_
|
|
705
726
|
|
|
706
727
|
## `saltcorn scheduler`
|
|
707
728
|
|
|
@@ -715,7 +736,7 @@ OPTIONS
|
|
|
715
736
|
-v, --verbose Verbose
|
|
716
737
|
```
|
|
717
738
|
|
|
718
|
-
_See code: [src/commands/scheduler.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
739
|
+
_See code: [src/commands/scheduler.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/scheduler.js)_
|
|
719
740
|
|
|
720
741
|
## `saltcorn serve`
|
|
721
742
|
|
|
@@ -736,7 +757,7 @@ OPTIONS
|
|
|
736
757
|
--subdomain_offset=subdomain_offset Number of parts to remove to access subdomain in 'multi_tenant' mode
|
|
737
758
|
```
|
|
738
759
|
|
|
739
|
-
_See code: [src/commands/serve.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
760
|
+
_See code: [src/commands/serve.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/serve.js)_
|
|
740
761
|
|
|
741
762
|
## `saltcorn set-cfg [KEY] [VALUE]`
|
|
742
763
|
|
|
@@ -757,7 +778,7 @@ OPTIONS
|
|
|
757
778
|
-t, --tenant=tenant tenant
|
|
758
779
|
```
|
|
759
780
|
|
|
760
|
-
_See code: [src/commands/set-cfg.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
781
|
+
_See code: [src/commands/set-cfg.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/set-cfg.js)_
|
|
761
782
|
|
|
762
783
|
## `saltcorn setup`
|
|
763
784
|
|
|
@@ -776,7 +797,7 @@ DESCRIPTION
|
|
|
776
797
|
configuration file
|
|
777
798
|
```
|
|
778
799
|
|
|
779
|
-
_See code: [src/commands/setup.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
800
|
+
_See code: [src/commands/setup.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/setup.js)_
|
|
780
801
|
|
|
781
802
|
## `saltcorn setup-benchmark`
|
|
782
803
|
|
|
@@ -790,7 +811,24 @@ OPTIONS
|
|
|
790
811
|
-t, --tenant=tenant tenant
|
|
791
812
|
```
|
|
792
813
|
|
|
793
|
-
_See code: [src/commands/setup-benchmark.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
814
|
+
_See code: [src/commands/setup-benchmark.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/setup-benchmark.js)_
|
|
815
|
+
|
|
816
|
+
## `saltcorn sync-upload-data`
|
|
817
|
+
|
|
818
|
+
Runs a sync for data supplied by the mobile app
|
|
819
|
+
|
|
820
|
+
```
|
|
821
|
+
USAGE
|
|
822
|
+
$ saltcorn sync-upload-data
|
|
823
|
+
|
|
824
|
+
OPTIONS
|
|
825
|
+
--directory=directory directory name for input output data
|
|
826
|
+
--syncTimestamp=syncTimestamp new timestamp for the sync_info rows
|
|
827
|
+
--tenantAppName=tenantAppName Optional name of a tenant application
|
|
828
|
+
--userEmail=userEmail email of the user running the sync
|
|
829
|
+
```
|
|
830
|
+
|
|
831
|
+
_See code: [src/commands/sync-upload-data.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/sync-upload-data.js)_
|
|
794
832
|
|
|
795
833
|
## `saltcorn take-snapshot`
|
|
796
834
|
|
|
@@ -805,7 +843,7 @@ OPTIONS
|
|
|
805
843
|
-t, --tenant=tenant tenant
|
|
806
844
|
```
|
|
807
845
|
|
|
808
|
-
_See code: [src/commands/take-snapshot.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
846
|
+
_See code: [src/commands/take-snapshot.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/take-snapshot.js)_
|
|
809
847
|
|
|
810
848
|
## `saltcorn transform-field EXPRESSION FIELD TABLE [TENANT]`
|
|
811
849
|
|
|
@@ -822,5 +860,5 @@ ARGUMENTS
|
|
|
822
860
|
TENANT tenant name
|
|
823
861
|
```
|
|
824
862
|
|
|
825
|
-
_See code: [src/commands/transform-field.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.
|
|
863
|
+
_See code: [src/commands/transform-field.js](https://github.com/saltcorn/saltcorn/blob/v0.8.8-beta.2/src/commands/transform-field.js)_
|
|
826
864
|
<!-- commandsstop -->
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.8.8-beta.1","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 saltcorn backup zip","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose","allowNo":false},"output":{"name":"output","type":"option","char":"o","description":"output filename"},"tenant":{"name":"tenant","type":"option","char":"t","description":"Backup tenant in saltcorn zip format"},"zip":{"name":"zip","type":"boolean","char":"z","description":"Backup public in saltcorn zip format","allowNo":false}},"args":[]},"build-app":{"id":"build-app","description":"Build mobile app","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenantAppName":{"name":"tenantAppName","type":"option","description":"Optional name of a tenant application, if set, the app will be build for this tenant"},"platforms":{"name":"platforms","type":"option","char":"p","description":"Platforms to build for, space separated list"},"entryPoint":{"name":"entryPoint","type":"option","char":"e","description":"This is the first view or page (see -t) after the login."},"entryPointType":{"name":"entryPointType","type":"option","char":"t","description":"Type of the entry point ('view' or 'page'). The default is 'view'."},"localUserTables":{"name":"localUserTables","type":"option","char":"l","description":"user defined tables that should be replicated into the app"},"useDocker":{"name":"useDocker","type":"boolean","char":"d","description":"Use a docker container to build the app.","allowNo":false},"buildDirectory":{"name":"buildDirectory","type":"option","char":"b","description":"A directory where the app should be build"},"copyAppDirectory":{"name":"copyAppDirectory","type":"option","char":"c","description":"If set, the app file will be copied here, please set 'user email', too"},"userEmail":{"name":"userEmail","type":"option","char":"u","description":"Email of the user building the app"},"appName":{"name":"appName","type":"option","description":"Name of the mobile app (default SaltcornMobileApp)"},"appVersion":{"name":"appVersion","type":"option","description":"Version of the mobile app (default 1.0.0)"},"appIcon":{"name":"appIcon","type":"option","description":"A png that will be used as launcher icon. The default is a png of a saltcorn symbol."},"serverURL":{"name":"serverURL","type":"option","char":"s","description":"URL to a saltcorn server"},"splashPage":{"name":"splashPage","type":"option","description":"Name of a page that should be shown while the app is loading."},"allowOfflineMode":{"name":"allowOfflineMode","type":"boolean","description":"Switch to offline mode when there is no internet, sync the data when a connection is available again.","allowNo":false},"buildForEmulator":{"name":"buildForEmulator","type":"boolean","description":"build without '--device', generates no .ipa file so that iOS apps can be build without developer accounts","allowNo":false}},"args":[]},"build-cordova-builder":{"id":"build-cordova-builder","description":"Build the 'saltcorn/cordova-builder' docker image","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"buildClean":{"name":"buildClean","type":"boolean","description":"run a clean build with --no-cache","allowNo":false}},"args":[]},"configuration-check-backups":{"id":"configuration-check-backups","description":"Check configuration","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"destructive":{"name":"destructive","type":"boolean","char":"d","description":"destructive","allowNo":false}},"args":[{"name":"files","description":"backup file to check. can be repeated, e.g. with *","required":true}]},"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":{"url":{"name":"url","type":"option","description":"Url of tenant"},"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. The value is printed to stdout as a JSON 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":false}]},"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":[]},"inspect":{"id":"inspect","description":"Inspect an entity's JSON representation, or list entities","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[{"name":"type","description":"Entity type","required":true,"options":["view","page","trigger","table"]},{"name":"name","description":"Entity name. If not supplied, list all names"}]},"install-pack":{"id":"install-pack","description":"Install a pack or restore a snapshot","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":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant","required":false},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"verbose output","required":false,"allowNo":false}},"args":[]},"list-triggers":{"id":"list-triggers","description":"List triggers","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant","required":false},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"verbose output","required":false,"allowNo":false}},"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":[]},"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-sql":{"id":"run-sql","description":"Run sql expression","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant name"},"sql":{"name":"sql","type":"option","char":"s","description":"sql statement"},"file":{"name":"file","type":"option","char":"f","description":"path to sql file name"}},"args":[]},"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},"listTests":{"name":"listTests","type":"boolean","char":"l","description":"List tests","allowNo":false},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose","allowNo":false},"detectOpenHandles":{"name":"detectOpenHandles","type":"boolean","char":"d","description":"Detect Open Handles","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},"database":{"name":"database","type":"option","description":"Run on specified database. Default is saltcorn_test"}},"args":[{"name":"package","description":"which package to run tests for"}]},"run-trigger":{"id":"run-trigger","description":"Run a trigger","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant","required":false}},"args":[{"name":"trigger","description":"trigger name","required":true}]},"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},"subdomain_offset":{"name":"subdomain_offset","type":"option","description":"Number of parts to remove to access subdomain in 'multi_tenant' mode"}},"args":[]},"set-cfg":{"id":"set-cfg","description":"Set a configuration value. The supplied value (argument, or file stdin) will be parsed as JSON. If this fails, it is stored as a string.","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"},"file":{"name":"file","type":"option","char":"f","description":"file"},"stdin":{"name":"stdin","type":"boolean","char":"i","description":"read value from stdin","allowNo":false}},"args":[{"name":"key","description":"Configuration key","required":false},{"name":"value","description":"Configuration value (JSON or string)"}]},"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":[]},"take-snapshot":{"id":"take-snapshot","description":"Print a current snapshout to stdout","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"fresh":{"name":"fresh","type":"boolean","char":"f","description":"fresh","allowNo":false}},"args":[]},"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}]},"dev:localize-plugin":{"id":"dev:localize-plugin","description":"Convert plugin to local plugin","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"unlocalize":{"name":"unlocalize","type":"boolean","char":"u","description":"Unlocalize plugin (local to npm)","allowNo":false},"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"}]},"dev:make-migration":{"id":"dev: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":[]},"dev:post-release":{"id":"dev:post-release","description":"Post-release tasks: docker and vagrant builds","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"task","description":"What to do","options":["docker","vagrant","all","none"]}]},"dev:release":{"id":"dev:release","description":"Release a new saltcorn version","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"version","description":"New version number","required":true}]},"dev:test-plugin":{"id":"dev: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}]}}}
|
|
1
|
+
{"version":"0.8.8-beta.2","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 saltcorn backup zip","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose","allowNo":false},"output":{"name":"output","type":"option","char":"o","description":"output filename"},"tenant":{"name":"tenant","type":"option","char":"t","description":"Backup tenant in saltcorn zip format"},"zip":{"name":"zip","type":"boolean","char":"z","description":"Backup public in saltcorn zip format","allowNo":false}},"args":[]},"build-app":{"id":"build-app","description":"Build mobile app","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenantAppName":{"name":"tenantAppName","type":"option","description":"Optional name of a tenant application, if set, the app will be build for this tenant"},"platforms":{"name":"platforms","type":"option","char":"p","description":"Platforms to build for, space separated list"},"entryPoint":{"name":"entryPoint","type":"option","char":"e","description":"This is the first view or page (see -t) after the login."},"entryPointType":{"name":"entryPointType","type":"option","char":"t","description":"Type of the entry point ('view' or 'page'). The default is 'view'."},"localUserTables":{"name":"localUserTables","type":"option","char":"l","description":"user defined tables that should be replicated into the app"},"synchedTables":{"name":"synchedTables","type":"option","description":"Table names for which the offline should be synchronized with the saltcorn server"},"useDocker":{"name":"useDocker","type":"boolean","char":"d","description":"Use a docker container to build the app.","allowNo":false},"buildDirectory":{"name":"buildDirectory","type":"option","char":"b","description":"A directory where the app should be build"},"copyAppDirectory":{"name":"copyAppDirectory","type":"option","char":"c","description":"If set, the app file will be copied here, please set 'user email', too"},"userEmail":{"name":"userEmail","type":"option","char":"u","description":"Email of the user building the app"},"appName":{"name":"appName","type":"option","description":"Name of the mobile app (default SaltcornMobileApp)"},"appVersion":{"name":"appVersion","type":"option","description":"Version of the mobile app (default 1.0.0)"},"appIcon":{"name":"appIcon","type":"option","description":"A png that will be used as launcher icon. The default is a png of a saltcorn symbol."},"serverURL":{"name":"serverURL","type":"option","char":"s","description":"URL to a saltcorn server"},"splashPage":{"name":"splashPage","type":"option","description":"Name of a page that should be shown while the app is loading."},"allowOfflineMode":{"name":"allowOfflineMode","type":"boolean","description":"Switch to offline mode when there is no internet, sync the data when a connection is available again.","allowNo":false},"buildForEmulator":{"name":"buildForEmulator","type":"boolean","description":"build without '--device', generates no .ipa file so that iOS apps can be build without developer accounts","allowNo":false}},"args":[]},"build-cordova-builder":{"id":"build-cordova-builder","description":"Build the 'saltcorn/cordova-builder' docker image","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"buildClean":{"name":"buildClean","type":"boolean","description":"run a clean build with --no-cache","allowNo":false}},"args":[]},"configuration-check-backups":{"id":"configuration-check-backups","description":"Check configuration","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"destructive":{"name":"destructive","type":"boolean","char":"d","description":"destructive","allowNo":false}},"args":[{"name":"files","description":"backup file to check. can be repeated, e.g. with *","required":true}]},"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":{"url":{"name":"url","type":"option","description":"Url of tenant"},"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. The value is printed to stdout as a JSON 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":false}]},"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":[]},"inspect":{"id":"inspect","description":"Inspect an entity's JSON representation, or list entities","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[{"name":"type","description":"Entity type","required":true,"options":["view","page","trigger","table"]},{"name":"name","description":"Entity name. If not supplied, list all names"}]},"install-pack":{"id":"install-pack","description":"Install a pack or restore a snapshot","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":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant","required":false},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"verbose output","required":false,"allowNo":false}},"args":[]},"list-triggers":{"id":"list-triggers","description":"List triggers","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant","required":false},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"verbose output","required":false,"allowNo":false}},"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":[]},"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-js":{"id":"run-js","description":"Run javascript code","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant name"},"code":{"name":"code","type":"option","char":"c","description":"js code"},"file":{"name":"file","type":"option","char":"f","description":"path to script file"}},"args":[]},"run-sql":{"id":"run-sql","description":"Run sql expression","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant name"},"sql":{"name":"sql","type":"option","char":"s","description":"sql statement"},"file":{"name":"file","type":"option","char":"f","description":"path to sql file name"}},"args":[]},"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},"listTests":{"name":"listTests","type":"boolean","char":"l","description":"List tests","allowNo":false},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose","allowNo":false},"detectOpenHandles":{"name":"detectOpenHandles","type":"boolean","char":"d","description":"Detect Open Handles","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},"database":{"name":"database","type":"option","description":"Run on specified database. Default is saltcorn_test"}},"args":[{"name":"package","description":"which package to run tests for"}]},"run-trigger":{"id":"run-trigger","description":"Run a trigger","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant","required":false}},"args":[{"name":"trigger","description":"trigger name","required":true}]},"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},"subdomain_offset":{"name":"subdomain_offset","type":"option","description":"Number of parts to remove to access subdomain in 'multi_tenant' mode"}},"args":[]},"set-cfg":{"id":"set-cfg","description":"Set a configuration value. The supplied value (argument, or file stdin) will be parsed as JSON. If this fails, it is stored as a string.","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"},"file":{"name":"file","type":"option","char":"f","description":"file"},"stdin":{"name":"stdin","type":"boolean","char":"i","description":"read value from stdin","allowNo":false}},"args":[{"name":"key","description":"Configuration key","required":false},{"name":"value","description":"Configuration value (JSON or string)"}]},"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":[]},"sync-upload-data":{"id":"sync-upload-data","description":"Runs a sync for data supplied by the mobile app","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenantAppName":{"name":"tenantAppName","type":"option","description":"Optional name of a tenant application"},"userEmail":{"name":"userEmail","type":"option","description":"email of the user running the sync"},"directory":{"name":"directory","type":"option","description":"directory name for input output data"},"syncTimestamp":{"name":"syncTimestamp","type":"option","description":"new timestamp for the sync_info rows"}},"args":[]},"take-snapshot":{"id":"take-snapshot","description":"Print a current snapshout to stdout","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"fresh":{"name":"fresh","type":"boolean","char":"f","description":"fresh","allowNo":false}},"args":[]},"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}]},"dev:localize-plugin":{"id":"dev:localize-plugin","description":"Convert plugin to local plugin","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"unlocalize":{"name":"unlocalize","type":"boolean","char":"u","description":"Unlocalize plugin (local to npm)","allowNo":false},"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"}]},"dev:make-migration":{"id":"dev: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":[]},"dev:post-release":{"id":"dev:post-release","description":"Post-release tasks: docker and vagrant builds","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"task","description":"What to do","options":["docker","vagrant","all","none"]}]},"dev:release":{"id":"dev:release","description":"Release a new saltcorn version","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"version","description":"New version number","required":true}]},"dev:test-plugin":{"id":"dev: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}]}}}
|
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.8.8-beta.
|
|
5
|
+
"version": "0.8.8-beta.2",
|
|
6
6
|
"author": "Tom Nielsen @glutamate",
|
|
7
7
|
"bin": {
|
|
8
8
|
"saltcorn": "./bin/saltcorn"
|
|
@@ -13,11 +13,11 @@
|
|
|
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.8.8-beta.
|
|
17
|
-
"@saltcorn/data": "0.8.8-beta.
|
|
18
|
-
"@saltcorn/mobile-app": "0.8.8-beta.
|
|
19
|
-
"@saltcorn/mobile-builder": "0.8.8-beta.
|
|
20
|
-
"@saltcorn/server": "0.8.8-beta.
|
|
16
|
+
"@saltcorn/admin-models": "0.8.8-beta.2",
|
|
17
|
+
"@saltcorn/data": "0.8.8-beta.2",
|
|
18
|
+
"@saltcorn/mobile-app": "0.8.8-beta.2",
|
|
19
|
+
"@saltcorn/mobile-builder": "0.8.8-beta.2",
|
|
20
|
+
"@saltcorn/server": "0.8.8-beta.2",
|
|
21
21
|
"cli-ux": "^5.6.7",
|
|
22
22
|
"contractis": "^0.1.0",
|
|
23
23
|
"dateformat": "^3.0.3",
|
|
@@ -5,7 +5,6 @@ const { MobileBuilder } = require("@saltcorn/mobile-builder/mobile-builder");
|
|
|
5
5
|
const { init_multi_tenant } = require("@saltcorn/data/db/state");
|
|
6
6
|
const { loadAllPlugins } = require("@saltcorn/server/load_plugins");
|
|
7
7
|
const User = require("@saltcorn/data/models/user");
|
|
8
|
-
const Table = require("@saltcorn/data/models/table");
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
*
|
|
@@ -82,6 +81,7 @@ class BuildAppCommand extends Command {
|
|
|
82
81
|
useDocker: flags.useDocker,
|
|
83
82
|
platforms: flags.platforms,
|
|
84
83
|
localUserTables: flags.localUserTables,
|
|
84
|
+
synchedTables: flags.synchedTables,
|
|
85
85
|
entryPoint: flags.entryPoint,
|
|
86
86
|
entryPointType: flags.entryPointType ? flags.entryPointType : "view",
|
|
87
87
|
serverURL: flags.serverURL,
|
|
@@ -138,6 +138,13 @@ BuildAppCommand.flags = {
|
|
|
138
138
|
description: "user defined tables that should be replicated into the app",
|
|
139
139
|
multiple: true,
|
|
140
140
|
}),
|
|
141
|
+
synchedTables: flags.string({
|
|
142
|
+
name: "synched tables",
|
|
143
|
+
string: "synchedTables",
|
|
144
|
+
description:
|
|
145
|
+
"Table names for which the offline should be synchronized with the saltcorn server",
|
|
146
|
+
multiple: true,
|
|
147
|
+
}),
|
|
141
148
|
useDocker: flags.boolean({
|
|
142
149
|
name: "use docker build container",
|
|
143
150
|
char: "d",
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* @module commands/list-tenants
|
|
4
4
|
*/
|
|
5
5
|
const { Command, flags } = require("@oclif/command");
|
|
6
|
+
const db = require("@saltcorn/data/db");
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -18,50 +19,42 @@ class ListTenantsCommand extends Command {
|
|
|
18
19
|
const {flags, args} = this.parse(ListTenantsCommand);
|
|
19
20
|
|
|
20
21
|
const { getAllTenants } = require("@saltcorn/admin-models/models/tenant");
|
|
21
|
-
|
|
22
|
-
const tenantList = await getAllTenants();
|
|
22
|
+
let tenantList = flags.tenant? [flags.tenant] : await getAllTenants();
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
console.log('name');
|
|
26
|
-
else
|
|
27
|
-
console.log(
|
|
28
|
-
"domain , files, users, tables, views, pages"
|
|
29
|
-
);
|
|
30
|
-
console.log('-------------------');
|
|
24
|
+
let tenantDetails = new Object();
|
|
31
25
|
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
let index=0;
|
|
27
|
+
for (const domain of tenantList) {
|
|
28
|
+
index++;
|
|
34
29
|
await db.runWithTenant(domain, async () => {
|
|
35
30
|
if (!flags.verbose)
|
|
36
|
-
|
|
31
|
+
tenantDetails[index] = { domain : domain };
|
|
37
32
|
else
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
tenantDetails[index] = {
|
|
34
|
+
domain: domain,
|
|
35
|
+
users: await db.count("users"),
|
|
36
|
+
roles: await db.count("_sc_roles"),
|
|
37
|
+
tables: await db.count("_sc_tables"),
|
|
38
|
+
views: await db.count("_sc_views"),
|
|
39
|
+
pages: await db.count("_sc_pages"),
|
|
40
|
+
files: await db.count("_sc_files"),
|
|
41
|
+
triggers: await db.count("_sc_triggers"),
|
|
42
|
+
tags: await db.count ("_sc_tags"),
|
|
43
|
+
}
|
|
47
44
|
});
|
|
48
45
|
}
|
|
46
|
+
|
|
47
|
+
// print
|
|
48
|
+
if(!flags.verbose)
|
|
49
|
+
console.table(
|
|
50
|
+
tenantDetails,
|
|
51
|
+
["domain"]
|
|
52
|
+
);
|
|
49
53
|
else
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
else
|
|
55
|
-
console.log(
|
|
56
|
-
"%s, %s, %s, %s, %s, %s",
|
|
57
|
-
domain.padEnd(24),
|
|
58
|
-
(await db.count("_sc_files")).toString().padStart(8),
|
|
59
|
-
(await db.count("users")).toString().padStart(8),
|
|
60
|
-
(await db.count("_sc_tables")).toString().padStart(8),
|
|
61
|
-
(await db.count("_sc_views")).toString().padStart(8),
|
|
62
|
-
(await db.count("_sc_pages")).toString().padStart(8),
|
|
63
|
-
);
|
|
64
|
-
});
|
|
54
|
+
console.table(
|
|
55
|
+
tenantDetails,
|
|
56
|
+
["domain","users","roles","tables","views","pages", "files","triggers", "tags"]
|
|
57
|
+
);
|
|
65
58
|
|
|
66
59
|
|
|
67
60
|
this.exit(0);
|
|
@@ -29,32 +29,17 @@ class ListTriggersCommand extends Command {
|
|
|
29
29
|
this.exit(1);
|
|
30
30
|
}
|
|
31
31
|
if(!flags.verbose){
|
|
32
|
-
console.
|
|
32
|
+
console.table(triggers,
|
|
33
|
+
["name"]
|
|
34
|
+
);
|
|
33
35
|
}
|
|
34
36
|
else {
|
|
35
|
-
console.
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
console.table(triggers,
|
|
38
|
+
["id","name","action","when_trigger","min_role",
|
|
39
|
+
"channel","table_id","table_name","description"]
|
|
38
40
|
);
|
|
39
41
|
}
|
|
40
|
-
|
|
41
|
-
for (let trigger of triggers){
|
|
42
|
-
if(!flags.verbose)
|
|
43
|
-
console.log(trigger.name);
|
|
44
|
-
else{
|
|
45
|
-
console.log(
|
|
46
|
-
trigger.id
|
|
47
|
-
+","+trigger.name
|
|
48
|
-
+","+trigger.action
|
|
49
|
-
+","+trigger.when_trigger
|
|
50
|
-
+","+trigger.min_role
|
|
51
|
-
+","+trigger.channel
|
|
52
|
-
+","+trigger.table_id
|
|
53
|
-
+","+trigger.table_name
|
|
54
|
-
+","+trigger.description
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
42
|
+
|
|
58
43
|
});
|
|
59
44
|
this.exit(0);
|
|
60
45
|
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-cli
|
|
3
|
+
* @module commands/run-js
|
|
4
|
+
*/
|
|
5
|
+
const { Command, flags } = require("@oclif/command");
|
|
6
|
+
const { cli } = require("cli-ux");
|
|
7
|
+
const { maybe_as_tenant, init_some_tenants, readFileSync} = require("../common");
|
|
8
|
+
const vm = require("vm");
|
|
9
|
+
const db = require("@saltcorn/data/db");
|
|
10
|
+
const Table = require("@saltcorn/data/models/table");
|
|
11
|
+
const { getState, features } = require("@saltcorn/data/db/state");
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* RunTriggerCommand Class
|
|
15
|
+
* @extends oclif.Command
|
|
16
|
+
* @category saltcorn-cli
|
|
17
|
+
*/
|
|
18
|
+
class RunJSCommand extends Command {
|
|
19
|
+
/**
|
|
20
|
+
* @returns {Promise<void>}
|
|
21
|
+
*/
|
|
22
|
+
async run() {
|
|
23
|
+
const { flags, args } = this.parse(RunJSCommand);
|
|
24
|
+
await init_some_tenants(flags.tenant);
|
|
25
|
+
|
|
26
|
+
const that = this;
|
|
27
|
+
await maybe_as_tenant(flags.tenant, async () => {
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
const code = flags.code? flags.code : readFileSync(flags.file);
|
|
31
|
+
// run script as here https://github.com/saltcorn/js-code-view/blob/main/js-code-view.js
|
|
32
|
+
const f = vm.runInNewContext(`async () => {${code}\n}`, {
|
|
33
|
+
Table,
|
|
34
|
+
// user,
|
|
35
|
+
console,
|
|
36
|
+
// Actions,
|
|
37
|
+
// emitEvent,
|
|
38
|
+
// markupTags,
|
|
39
|
+
db,
|
|
40
|
+
// req: extraArgs.req,
|
|
41
|
+
// state,
|
|
42
|
+
...getState().function_context,
|
|
43
|
+
});
|
|
44
|
+
return await f();
|
|
45
|
+
|
|
46
|
+
});
|
|
47
|
+
this.exit(0);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @type {string}
|
|
53
|
+
*/
|
|
54
|
+
RunJSCommand.description = `Run javascript code`;
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @type {object}
|
|
59
|
+
*/
|
|
60
|
+
RunJSCommand.flags = {
|
|
61
|
+
tenant: flags.string({
|
|
62
|
+
name: "tenant",
|
|
63
|
+
char: "t",
|
|
64
|
+
description: "tenant name",
|
|
65
|
+
}),
|
|
66
|
+
code: flags.string({
|
|
67
|
+
name: "code",
|
|
68
|
+
char: "c",
|
|
69
|
+
description: "js code",
|
|
70
|
+
}),
|
|
71
|
+
file: flags.string({
|
|
72
|
+
name: "file",
|
|
73
|
+
char: "f",
|
|
74
|
+
description: "path to script file",
|
|
75
|
+
}),
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
module.exports = RunJSCommand;
|
package/src/commands/run-sql.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
const { Command, flags } = require("@oclif/command");
|
|
6
6
|
const { cli } = require("cli-ux");
|
|
7
|
-
const { maybe_as_tenant, init_some_tenants } = require("../common");
|
|
7
|
+
const { maybe_as_tenant, init_some_tenants, readFileSync } = require("../common");
|
|
8
8
|
const db = require("@saltcorn/data/db");
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -13,24 +13,7 @@ const db = require("@saltcorn/data/db");
|
|
|
13
13
|
* @category saltcorn-cli
|
|
14
14
|
*/
|
|
15
15
|
class RunSQLCommand extends Command {
|
|
16
|
-
|
|
17
|
-
* Read sql select file
|
|
18
|
-
* @param filename
|
|
19
|
-
* @returns {null|string}
|
|
20
|
-
*/
|
|
21
|
-
readFile(filename){
|
|
22
|
-
const path = require('path'), fs = require('fs');
|
|
23
|
-
try {
|
|
24
|
-
//let p = path.join(__dirname, filename);
|
|
25
|
-
let str = fs.readFileSync(filename, 'utf8');
|
|
26
|
-
// let str = fs.readFileSync(p, {encoding: 'utf8'});
|
|
27
|
-
console.log(str);
|
|
28
|
-
return str;
|
|
29
|
-
} catch (e) {
|
|
30
|
-
console.error(e.message);
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
16
|
+
|
|
34
17
|
/**
|
|
35
18
|
* @returns {Promise<void>}
|
|
36
19
|
*/
|
|
@@ -63,7 +46,7 @@ class RunSQLCommand extends Command {
|
|
|
63
46
|
|
|
64
47
|
console.log("current tenant:", schema);
|
|
65
48
|
//if(flags.sql){
|
|
66
|
-
const sql_str = flags.sql? flags.sql :
|
|
49
|
+
const sql_str = flags.sql? flags.sql : readFileSync(flags.file);
|
|
67
50
|
// check that file not find (not directly)
|
|
68
51
|
if (sql_str === null ){
|
|
69
52
|
this.exit(1);
|
|
@@ -76,24 +59,7 @@ class RunSQLCommand extends Command {
|
|
|
76
59
|
}
|
|
77
60
|
// print sql statement
|
|
78
61
|
console.log(sql_str);
|
|
79
|
-
|
|
80
|
-
if( query.fields){
|
|
81
|
-
let columns_str = "";
|
|
82
|
-
for (let field of query.fields){
|
|
83
|
-
columns_str += field.name + ",";
|
|
84
|
-
}
|
|
85
|
-
console.log(columns_str);
|
|
86
|
-
}
|
|
87
|
-
// print results
|
|
88
|
-
|
|
89
|
-
for ( let row of query.rows ) {
|
|
90
|
-
|
|
91
|
-
let value_str = "";
|
|
92
|
-
for ( let prop in row ) {
|
|
93
|
-
value_str += row[prop]+",";
|
|
94
|
-
}
|
|
95
|
-
console.log(value_str);
|
|
96
|
-
}
|
|
62
|
+
console.table (query.rows);
|
|
97
63
|
});
|
|
98
64
|
this.exit(0);
|
|
99
65
|
}
|
|
@@ -113,12 +79,12 @@ RunSQLCommand.flags = {
|
|
|
113
79
|
description: "tenant name",
|
|
114
80
|
}),
|
|
115
81
|
sql: flags.string({
|
|
116
|
-
name: "sql
|
|
82
|
+
name: "sql",
|
|
117
83
|
char: "s",
|
|
118
84
|
description: "sql statement",
|
|
119
85
|
}),
|
|
120
86
|
file: flags.string({
|
|
121
|
-
name: "
|
|
87
|
+
name: "file",
|
|
122
88
|
char: "f",
|
|
123
89
|
description: "path to sql file name",
|
|
124
90
|
}),
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
const { Command, flags } = require("@oclif/command");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const { init_multi_tenant } = require("@saltcorn/data/db/state");
|
|
4
|
+
const User = require("@saltcorn/data/models/user");
|
|
5
|
+
const Table = require("@saltcorn/data/models/table");
|
|
6
|
+
const fs = require("fs").promises;
|
|
7
|
+
const { getState } = require("@saltcorn/data/db/state");
|
|
8
|
+
const db = require("@saltcorn/data/db");
|
|
9
|
+
const { loadAllPlugins } = require("@saltcorn/server/load_plugins");
|
|
10
|
+
|
|
11
|
+
const pickFields = (table, pkName, row, keepId) => {
|
|
12
|
+
const result = {};
|
|
13
|
+
for (const { name, type, calculated } of table.getFields()) {
|
|
14
|
+
if ((!keepId && name === pkName) || calculated || !row[name]) continue;
|
|
15
|
+
if (type?.name === "Date") {
|
|
16
|
+
result[name] = row[name] ? new Date(row[name]) : undefined;
|
|
17
|
+
} else {
|
|
18
|
+
result[name] = row[name];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return result;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const translateInsertFks = async (allChanges, allTranslations) => {
|
|
25
|
+
const schema = db.getTenantSchemaPrefix();
|
|
26
|
+
const rowIds = (fk, targetTrans, tblName, pkName, changes) => {
|
|
27
|
+
if (Object.keys(targetTrans || {}).length > 0) {
|
|
28
|
+
const srcTrans = allTranslations[tblName] || {};
|
|
29
|
+
// ids with a fk where the target was translated
|
|
30
|
+
const insertIds = (changes.inserts || [])
|
|
31
|
+
.filter((row) => targetTrans[row[fk.name]] !== undefined)
|
|
32
|
+
.map((row) => srcTrans[row[pkName]] || row[pkName]);
|
|
33
|
+
return insertIds;
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
for (const [tblName, changes] of Object.entries(allChanges)) {
|
|
39
|
+
const table = Table.findOne({ name: tblName });
|
|
40
|
+
if (!table) throw new Error(`The table '${tblName}' does not exists`);
|
|
41
|
+
const pkName = table.pk_name;
|
|
42
|
+
for (const fk of table.getForeignKeys()) {
|
|
43
|
+
const targetTrans = allTranslations[fk.reftable_name];
|
|
44
|
+
const ids = rowIds(fk, targetTrans, table.name, pkName, changes);
|
|
45
|
+
if (ids?.length > 0) {
|
|
46
|
+
for (const [from, to] of Object.entries(targetTrans)) {
|
|
47
|
+
await db.query(
|
|
48
|
+
`update ${schema}"${db.sqlsanitize(tblName)}" set "${db.sqlsanitize(
|
|
49
|
+
fk.name
|
|
50
|
+
)}" = ${to}
|
|
51
|
+
where "${db.sqlsanitize(
|
|
52
|
+
fk.name
|
|
53
|
+
)}" = ${from} and "${db.sqlsanitize(pkName)}" in (${ids.join(
|
|
54
|
+
","
|
|
55
|
+
)})`
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const applyInserts = async (changes, syncTimestamp, user) => {
|
|
64
|
+
const schema = db.getTenantSchemaPrefix();
|
|
65
|
+
const allTranslations = {};
|
|
66
|
+
for (const [tblName, vals] of Object.entries(changes)) {
|
|
67
|
+
const table = Table.findOne({ name: tblName });
|
|
68
|
+
if (!table) throw new Error(`The table '${tblName}' does not exists`);
|
|
69
|
+
if (vals.inserts?.length > 0) {
|
|
70
|
+
const pkName = table.pk_name;
|
|
71
|
+
await db.query(
|
|
72
|
+
`alter table ${schema}"${db.sqlsanitize(tblName)}" disable trigger all`
|
|
73
|
+
);
|
|
74
|
+
const translations = {};
|
|
75
|
+
for (const insert of vals.inserts || []) {
|
|
76
|
+
const row = pickFields(table, pkName, insert);
|
|
77
|
+
const newId = await table.insertRow(
|
|
78
|
+
row,
|
|
79
|
+
user,
|
|
80
|
+
undefined,
|
|
81
|
+
true,
|
|
82
|
+
syncTimestamp
|
|
83
|
+
);
|
|
84
|
+
if (!newId) throw new Error(`Unable to insert into ${tblName}`);
|
|
85
|
+
else if (newId !== insert[pkName]) translations[insert[pkName]] = newId;
|
|
86
|
+
}
|
|
87
|
+
allTranslations[tblName] = translations;
|
|
88
|
+
await db.query(
|
|
89
|
+
`alter table ${schema}"${db.sqlsanitize(tblName)}" enable trigger all`
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return allTranslations;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const applyUpdates = async (changes, allTranslations, syncTimestamp, user) => {
|
|
97
|
+
for (const [tblName, vals] of Object.entries(changes)) {
|
|
98
|
+
if (vals.updates?.length > 0) {
|
|
99
|
+
const table = Table.findOne({ name: tblName });
|
|
100
|
+
if (!table) throw new Error(`The table '${tblName}' does not exists`);
|
|
101
|
+
const pkName = table.pk_name;
|
|
102
|
+
const insertTranslations = allTranslations[tblName];
|
|
103
|
+
for (const update of vals.updates) {
|
|
104
|
+
const row = pickFields(table, pkName, update, true);
|
|
105
|
+
if (insertTranslations?.[row[pkName]])
|
|
106
|
+
row[pkName] = insertTranslations[row[pkName]];
|
|
107
|
+
for (const fk of table.getForeignKeys()) {
|
|
108
|
+
const oldVal = row[fk.name];
|
|
109
|
+
if (oldVal) {
|
|
110
|
+
const newVal = allTranslations[fk.reftable_name]?.[oldVal];
|
|
111
|
+
if (newVal) row[fk.name] = newVal;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const result = await table.updateRow(
|
|
115
|
+
row,
|
|
116
|
+
row[pkName],
|
|
117
|
+
user,
|
|
118
|
+
true,
|
|
119
|
+
undefined,
|
|
120
|
+
undefined,
|
|
121
|
+
syncTimestamp
|
|
122
|
+
);
|
|
123
|
+
if (result) throw new Error(`Unable to update ${tblName}: ${result}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const applyDeletes = async (changes, user) => {
|
|
130
|
+
for (const [tblName, vals] of Object.entries(changes)) {
|
|
131
|
+
const table = Table.findOne({ name: tblName });
|
|
132
|
+
if (!table) throw new Error(`The table '${tblName}' does not exists`);
|
|
133
|
+
const pkName = table.pk_name;
|
|
134
|
+
if (vals.deletes?.length > 0) {
|
|
135
|
+
const delIds = [];
|
|
136
|
+
const latestInfos = await table.latestSyncInfos(
|
|
137
|
+
vals.deletes.map((del) => del[pkName])
|
|
138
|
+
);
|
|
139
|
+
const refToInfo = {};
|
|
140
|
+
for (const info of latestInfos) {
|
|
141
|
+
refToInfo[info.ref] = info;
|
|
142
|
+
}
|
|
143
|
+
for (const del of vals.deletes) {
|
|
144
|
+
const appTimestamp = new Date(del.last_modified);
|
|
145
|
+
const info = refToInfo[del[pkName]];
|
|
146
|
+
if (!info || appTimestamp >= info.last_modified)
|
|
147
|
+
delIds.push(del[pkName]);
|
|
148
|
+
}
|
|
149
|
+
if (delIds.length > 0) {
|
|
150
|
+
await table.deleteRows({ [pkName]: { in: delIds } }, user, true);
|
|
151
|
+
if ((await table.countRows({ [pkName]: { in: delIds } })) !== 0)
|
|
152
|
+
throw new Error(
|
|
153
|
+
`Unable to delete in '${tblName}': Some rows were not deleted`
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const writeTranslatedIds = async (translatedIds, directory) => {
|
|
161
|
+
const writeName = path.join(directory, "translated-ids.out");
|
|
162
|
+
await fs.writeFile(writeName, JSON.stringify(translatedIds));
|
|
163
|
+
await fs.rename(writeName, path.join(directory, "translated-ids.json"));
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
const writeErrorFile = async (message, directory) => {
|
|
167
|
+
const writeName = path.join(directory, "error.out");
|
|
168
|
+
await fs.writeFile(writeName, JSON.stringify({ message }));
|
|
169
|
+
await fs.rename(writeName, path.join(directory, "error.json"));
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
*
|
|
174
|
+
*/
|
|
175
|
+
class SyncUploadData extends Command {
|
|
176
|
+
async run() {
|
|
177
|
+
let returnCode = 0,
|
|
178
|
+
inTransaction = false;
|
|
179
|
+
const { flags } = await this.parse(SyncUploadData);
|
|
180
|
+
if (db.is_it_multi_tenant() && flags.tenantAppName) {
|
|
181
|
+
await init_multi_tenant(loadAllPlugins, true, [flags.tenantAppName]);
|
|
182
|
+
}
|
|
183
|
+
const doSync = async () => {
|
|
184
|
+
try {
|
|
185
|
+
const changes = JSON.parse(
|
|
186
|
+
await fs.readFile(path.join(flags.directory, "changes.json"))
|
|
187
|
+
);
|
|
188
|
+
const syncTimestamp = flags.syncTimestamp;
|
|
189
|
+
const user = flags.userEmail
|
|
190
|
+
? await User.findOne({ email: flags.userEmail })
|
|
191
|
+
: undefined;
|
|
192
|
+
await loadAllPlugins();
|
|
193
|
+
await db.begin();
|
|
194
|
+
inTransaction = true;
|
|
195
|
+
const translatedIds = await applyInserts(changes, syncTimestamp, user);
|
|
196
|
+
await translateInsertFks(changes, translatedIds);
|
|
197
|
+
await applyUpdates(changes, translatedIds, syncTimestamp, user);
|
|
198
|
+
await applyDeletes(changes, user);
|
|
199
|
+
await db.commit();
|
|
200
|
+
await writeTranslatedIds(translatedIds, flags.directory);
|
|
201
|
+
} catch (error) {
|
|
202
|
+
returnCode = 1;
|
|
203
|
+
getState().log(2, `Unable to sync: ${error.message}`);
|
|
204
|
+
await writeErrorFile(error.message, flags.directory);
|
|
205
|
+
if (inTransaction) await db.rollback();
|
|
206
|
+
} finally {
|
|
207
|
+
process.exit(returnCode);
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
if (
|
|
211
|
+
flags.tenantAppName &&
|
|
212
|
+
flags.tenantAppName !== db.connectObj.default_schema
|
|
213
|
+
) {
|
|
214
|
+
await db.runWithTenant(flags.tenantAppName, doSync);
|
|
215
|
+
} else {
|
|
216
|
+
await doSync();
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
SyncUploadData.description = "Runs a sync for data supplied by the mobile app";
|
|
222
|
+
|
|
223
|
+
SyncUploadData.flags = {
|
|
224
|
+
tenantAppName: flags.string({
|
|
225
|
+
name: "tenant",
|
|
226
|
+
string: "tenant",
|
|
227
|
+
description: "Optional name of a tenant application",
|
|
228
|
+
}),
|
|
229
|
+
userEmail: flags.string({
|
|
230
|
+
name: "user email",
|
|
231
|
+
string: "userEmail",
|
|
232
|
+
description: "email of the user running the sync",
|
|
233
|
+
}),
|
|
234
|
+
directory: flags.string({
|
|
235
|
+
name: "directory",
|
|
236
|
+
string: "directory",
|
|
237
|
+
description: "directory name for input output data",
|
|
238
|
+
}),
|
|
239
|
+
syncTimestamp: flags.integer({
|
|
240
|
+
name: "syncTimestamp",
|
|
241
|
+
string: "syncTimestamp",
|
|
242
|
+
description: "new timestamp for the sync_info rows",
|
|
243
|
+
}),
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
module.exports = SyncUploadData;
|
package/src/common.js
CHANGED
|
@@ -50,9 +50,29 @@ function sleep(ms) {
|
|
|
50
50
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Read txt file (SyncMode)
|
|
55
|
+
* @param filename - absolute path to file
|
|
56
|
+
* @returns {null|string}
|
|
57
|
+
*/
|
|
58
|
+
function readFileSync(filename){
|
|
59
|
+
const path = require('path'), fs = require('fs');
|
|
60
|
+
try {
|
|
61
|
+
//let p = path.join(__dirname, filename);
|
|
62
|
+
let str = fs.readFileSync(filename, 'utf8');
|
|
63
|
+
// let str = fs.readFileSync(p, {encoding: 'utf8'});
|
|
64
|
+
console.log(str);
|
|
65
|
+
return str;
|
|
66
|
+
} catch (e) {
|
|
67
|
+
console.error(e.message);
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
53
72
|
module.exports = {
|
|
54
73
|
maybe_as_tenant,
|
|
55
74
|
parseJSONorString,
|
|
56
75
|
sleep,
|
|
57
76
|
init_some_tenants,
|
|
77
|
+
readFileSync,
|
|
58
78
|
};
|