@saltcorn/cli 0.7.1-beta.3 → 0.7.2-beta.10

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/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
- * @param {object} ten
8
- * @param {function} f
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,9 +14,23 @@ 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
  };
17
+ /**
18
+ * Init specified tenant
19
+ * @param tenant - specified tenant
20
+ * @returns {Promise<void>}
21
+ */
22
+ const init_some_tenants = async (tenant) => {
23
+ const { loadAllPlugins } = require("@saltcorn/server/load_plugins");
24
+ const { init_multi_tenant } = require("@saltcorn/data/db/state");
25
+ await loadAllPlugins();
26
+ if (tenant) await init_multi_tenant(loadAllPlugins, undefined, [tenant]);
27
+ else await init_multi_tenant(loadAllPlugins, undefined, []);
28
+ //await init_multi_tenant(loadAllPlugins, undefined, tenants);
29
+ };
16
30
 
17
31
  /**
18
- * @param {string} s
32
+ * parse JSON or String
33
+ * @param {string} s
19
34
  * @returns {object}
20
35
  */
21
36
  const parseJSONorString = (s) => {
@@ -27,10 +42,17 @@ const parseJSONorString = (s) => {
27
42
  };
28
43
 
29
44
  /**
30
- * @param {numer} ms
45
+ * Sleep ms miliseconds
46
+ * @param {number} ms
31
47
  * @returns {Promise<void>}
32
48
  */
33
49
  function sleep(ms) {
34
50
  return new Promise((resolve) => setTimeout(resolve, ms));
35
51
  }
36
- module.exports = { maybe_as_tenant, parseJSONorString, sleep };
52
+
53
+ module.exports = {
54
+ maybe_as_tenant,
55
+ parseJSONorString,
56
+ sleep,
57
+ init_some_tenants,
58
+ };
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");
package/CHANGELOG.md DELETED
@@ -1,8 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## [0.4.5](https://github.com/saltcorn/saltcorn/compare/v0.4.5-beta.1...v0.4.5) (2021-05-07)
7
-
8
- **Note:** Version bump only for package @saltcorn/cli