@nzz/q-cli 1.9.1 → 1.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. package/.history/bin/commands/qItem/itemService_20220627113036.js +302 -0
  2. package/.history/bin/commands/qItem/itemService_20221105174223.js +304 -0
  3. package/.history/bin/commands/qItem/itemService_20221105174236.js +304 -0
  4. package/.history/bin/commands/qItem/itemService_20221105174311.js +304 -0
  5. package/.history/bin/commands/qItem/itemService_20221105174605.js +306 -0
  6. package/.history/bin/commands/qItem/itemService_20221105174809.js +309 -0
  7. package/.history/bin/commands/qItem/itemService_20221107071956.js +317 -0
  8. package/.history/bin/commands/qItem/itemService_20221107072130.js +310 -0
  9. package/.history/bin/commands/qItem/itemService_20221107072222.js +312 -0
  10. package/.history/bin/commands/qItem/itemService_20221107072621.js +316 -0
  11. package/.history/bin/commands/qItem/itemService_20221107072850.js +315 -0
  12. package/.history/bin/commands/qItem/itemService_20221107073051.js +315 -0
  13. package/.history/bin/commands/qItem/itemService_20221107073244.js +315 -0
  14. package/.history/bin/commands/qItem/itemService_20221107075352.js +323 -0
  15. package/.history/bin/commands/qItem/itemService_20221107075536.js +316 -0
  16. package/.history/bin/commands/qItem/itemService_20221107075700.js +312 -0
  17. package/.history/bin/commands/qItem/itemService_20221107111951.js +312 -0
  18. package/.history/bin/commands/qItem/itemService_20221107113745.js +310 -0
  19. package/.history/bin/commands/qItem/itemService_20221107113901.js +310 -0
  20. package/.history/bin/commands/qItem/updateItem/updateItem_20220627113036.js +64 -0
  21. package/.history/bin/commands/qItem/updateItem/updateItem_20221105173137.js +66 -0
  22. package/.history/bin/commands/qItem/updateItem/updateItem_20221105173239.js +68 -0
  23. package/.history/bin/commands/qItem/updateItem/updateItem_20221105173610.js +69 -0
  24. package/.history/bin/commands/qItem/updateItem/updateItem_20221105173646.js +74 -0
  25. package/.history/bin/commands/qItem/updateItem/updateItem_20221105174010.js +74 -0
  26. package/.history/bin/commands/qItem/updateItem/updateItem_20221105174054.js +75 -0
  27. package/.history/package_20220808135115.json +43 -0
  28. package/.history/package_20221105171707.json +43 -0
  29. package/.history/package_20221105173355.json +43 -0
  30. package/.history/package_20221107112303.json +43 -0
  31. package/bin/commands/qItem/itemService.js +12 -4
  32. package/package.json +2 -2
@@ -0,0 +1,74 @@
1
+ const schemaService = require("./../schemaService.js");
2
+ const configStore = require("./../configStore.js");
3
+ const itemService = require("./../itemService.js");
4
+ const fs = require("fs");
5
+ const path = require("path");
6
+ const chalk = require("chalk");
7
+ const errorColor = chalk.red;
8
+ const successColor = chalk.green;
9
+
10
+ module.exports = async function (command) {
11
+ try {
12
+ const qConfigPath = path.resolve(command.config);
13
+ if (fs.existsSync(qConfigPath)) {
14
+ const qConfig = JSON.parse(fs.readFileSync(qConfigPath));
15
+ console.log("----------------")
16
+ console.log(JSON.stringify(qConfig))
17
+ const validationResult = schemaService.validateConfig(qConfig);
18
+ console.log(validationResult)
19
+
20
+ console.log("----------------")
21
+ if (validationResult.isValid) {
22
+ const config = await configStore.setupStore(
23
+ qConfig,
24
+ command.environment,
25
+ command.reset
26
+ );
27
+
28
+ for (const item of itemService.getItems(qConfig, command.environment)) {
29
+ for (const environment of item.environments) {
30
+ const result = await itemService.updateItem(
31
+ item.item,
32
+ environment,
33
+ config,
34
+ qConfigPath
35
+ );
36
+
37
+ if (result) {
38
+ console.log(
39
+ successColor(
40
+ `--------------------`
41
+ )
42
+ );
43
+
44
+ console.log(
45
+ successColor(
46
+ `Successfully updated item with id ${environment.id} on ${environment.name} environment`
47
+ )
48
+ );
49
+ }
50
+ }
51
+ }
52
+ } else {
53
+ console.error(
54
+ errorColor(
55
+ `A problem occured while validating the config file: ${validationResult.errorsText}`
56
+ )
57
+ );
58
+ process.exit(1);
59
+ }
60
+ } else {
61
+ console.error(
62
+ errorColor(
63
+ "Couldn't find config file named q.config.json in the current directory. Create a config file in the current directory or pass the path to the config file with the option -c <path>"
64
+ )
65
+ );
66
+ }
67
+ } catch (error) {
68
+ console.error(
69
+ errorColor(
70
+ `A problem occured while parsing the config file at ${command.config}. Please make sure it is valid JSON.`
71
+ )
72
+ );
73
+ }
74
+ };
@@ -0,0 +1,75 @@
1
+ const schemaService = require("./../schemaService.js");
2
+ const configStore = require("./../configStore.js");
3
+ const itemService = require("./../itemService.js");
4
+ const fs = require("fs");
5
+ const path = require("path");
6
+ const chalk = require("chalk");
7
+ const errorColor = chalk.red;
8
+ const successColor = chalk.green;
9
+
10
+ module.exports = async function (command) {
11
+ try {
12
+ const qConfigPath = path.resolve(command.config);
13
+ if (fs.existsSync(qConfigPath)) {
14
+ const qConfig = JSON.parse(fs.readFileSync(qConfigPath));
15
+ console.log("----------------")
16
+ console.log(JSON.stringify(qConfig))
17
+ const validationResult = schemaService.validateConfig(qConfig);
18
+ console.log(validationResult)
19
+
20
+ console.log("----------------")
21
+ if (validationResult.isValid) {
22
+ const config = await configStore.setupStore(
23
+ qConfig,
24
+ command.environment,
25
+ command.reset
26
+ );
27
+
28
+ for (const item of itemService.getItems(qConfig, command.environment)) {
29
+ for (const environment of item.environments) {
30
+ const result = await itemService.updateItem(
31
+ item.item,
32
+ environment,
33
+ config,
34
+ qConfigPath
35
+ );
36
+ console.log(JSON.stringify(result))
37
+
38
+ if (result) {
39
+ console.log(
40
+ successColor(
41
+ `--------------------`
42
+ )
43
+ );
44
+
45
+ console.log(
46
+ successColor(
47
+ `Successfully updated item with id ${environment.id} on ${environment.name} environment`
48
+ )
49
+ );
50
+ }
51
+ }
52
+ }
53
+ } else {
54
+ console.error(
55
+ errorColor(
56
+ `A problem occured while validating the config file: ${validationResult.errorsText}`
57
+ )
58
+ );
59
+ process.exit(1);
60
+ }
61
+ } else {
62
+ console.error(
63
+ errorColor(
64
+ "Couldn't find config file named q.config.json in the current directory. Create a config file in the current directory or pass the path to the config file with the option -c <path>"
65
+ )
66
+ );
67
+ }
68
+ } catch (error) {
69
+ console.error(
70
+ errorColor(
71
+ `A problem occured while parsing the config file at ${command.config}. Please make sure it is valid JSON.`
72
+ )
73
+ );
74
+ }
75
+ };
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@nzz/q-cli",
3
+ "version": "1.9.0",
4
+ "description": "Cli tool to setup new Q tools, new Q server implementations and start Q dev server to test developing Q tools",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/nzzdev/Q-cli.git"
12
+ },
13
+ "bin": {
14
+ "Q": "bin/q.js"
15
+ },
16
+ "author": "",
17
+ "license": "MIT",
18
+ "bugs": {
19
+ "url": "https://github.com/nzzdev/Q-cli/issues"
20
+ },
21
+ "homepage": "https://github.com/nzzdev/Q-cli#readme",
22
+ "dependencies": {
23
+ "@hapi/boom": "^9.1.1",
24
+ "@hapi/hapi": "^20.1.3",
25
+ "@hapi/inert": "^6.0.3",
26
+ "@hapi/mimos": "^5.0.0",
27
+ "@hapi/vision": "^6.1.0",
28
+ "@hapi/wreck": "^17.1.0",
29
+ "ajv": "^6.12.6",
30
+ "chalk": "^4.1.1",
31
+ "commander": "^5.1.0",
32
+ "configstore": "^5.0.1",
33
+ "deepmerge": "^4.2.2",
34
+ "form-data": "^3.0.0",
35
+ "fs-extra": "^9.0.1",
36
+ "image-size": "^0.8.3",
37
+ "joi": "^17.4.0",
38
+ "node-fetch": "^2.6.1",
39
+ "nunjucks": "^3.2.2",
40
+ "promptly": "^3.2.0",
41
+ "replace-in-file": "^3.4.4"
42
+ }
43
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@nzz/q-cli",
3
+ "version": "1.9.1",
4
+ "description": "Cli tool to setup new Q tools, new Q server implementations and start Q dev server to test developing Q tools",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/nzzdev/Q-cli.git"
12
+ },
13
+ "bin": {
14
+ "Q": "bin/q.js"
15
+ },
16
+ "author": "",
17
+ "license": "MIT",
18
+ "bugs": {
19
+ "url": "https://github.com/nzzdev/Q-cli/issues"
20
+ },
21
+ "homepage": "https://github.com/nzzdev/Q-cli#readme",
22
+ "dependencies": {
23
+ "@hapi/boom": "^9.1.1",
24
+ "@hapi/hapi": "^20.1.3",
25
+ "@hapi/inert": "^6.0.3",
26
+ "@hapi/mimos": "^5.0.0",
27
+ "@hapi/vision": "^6.1.0",
28
+ "@hapi/wreck": "^17.1.0",
29
+ "ajv": "^6.12.6",
30
+ "chalk": "^4.1.1",
31
+ "commander": "^5.1.0",
32
+ "configstore": "^5.0.1",
33
+ "deepmerge": "^4.2.2",
34
+ "form-data": "^3.0.0",
35
+ "fs-extra": "^9.0.1",
36
+ "image-size": "^0.8.3",
37
+ "joi": "^17.4.0",
38
+ "node-fetch": "^2.6.1",
39
+ "nunjucks": "^3.2.2",
40
+ "promptly": "^3.2.0",
41
+ "replace-in-file": "^3.4.4"
42
+ }
43
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@nzz/q-cli",
3
+ "version": "333.9.1",
4
+ "description": "Cli tool to setup new Q tools, new Q server implementations and start Q dev server to test developing Q tools",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/nzzdev/Q-cli.git"
12
+ },
13
+ "bin": {
14
+ "Q": "bin/q.js"
15
+ },
16
+ "author": "",
17
+ "license": "MIT",
18
+ "bugs": {
19
+ "url": "https://github.com/nzzdev/Q-cli/issues"
20
+ },
21
+ "homepage": "https://github.com/nzzdev/Q-cli#readme",
22
+ "dependencies": {
23
+ "@hapi/boom": "^9.1.1",
24
+ "@hapi/hapi": "^20.1.3",
25
+ "@hapi/inert": "^6.0.3",
26
+ "@hapi/mimos": "^5.0.0",
27
+ "@hapi/vision": "^6.1.0",
28
+ "@hapi/wreck": "^17.1.0",
29
+ "ajv": "^6.12.6",
30
+ "chalk": "^4.1.1",
31
+ "commander": "^5.1.0",
32
+ "configstore": "^5.0.1",
33
+ "deepmerge": "^4.2.2",
34
+ "form-data": "^3.0.0",
35
+ "fs-extra": "^9.0.1",
36
+ "image-size": "^0.8.3",
37
+ "joi": "^17.4.0",
38
+ "node-fetch": "^2.6.1",
39
+ "nunjucks": "^3.2.2",
40
+ "promptly": "^3.2.0",
41
+ "replace-in-file": "^3.4.4"
42
+ }
43
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@nzz/q-cli",
3
+ "version": "1.9.2",
4
+ "description": "Cli tool to setup new Q tools, new Q server implementations and start Q dev server to test developing Q tools",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/nzzdev/Q-cli.git"
12
+ },
13
+ "bin": {
14
+ "Q": "bin/q.js"
15
+ },
16
+ "author": "",
17
+ "license": "MIT",
18
+ "bugs": {
19
+ "url": "https://github.com/nzzdev/Q-cli/issues"
20
+ },
21
+ "homepage": "https://github.com/nzzdev/Q-cli#readme",
22
+ "dependencies": {
23
+ "@hapi/boom": "^9.1.1",
24
+ "@hapi/hapi": "^20.1.3",
25
+ "@hapi/inert": "^6.0.3",
26
+ "@hapi/mimos": "^5.0.0",
27
+ "@hapi/vision": "^6.1.0",
28
+ "@hapi/wreck": "^17.1.0",
29
+ "ajv": "^6.12.6",
30
+ "chalk": "^4.1.1",
31
+ "commander": "^5.1.0",
32
+ "configstore": "^5.0.1",
33
+ "deepmerge": "^4.2.2",
34
+ "form-data": "^3.0.0",
35
+ "fs-extra": "^9.0.1",
36
+ "image-size": "^0.8.3",
37
+ "joi": "^17.4.0",
38
+ "node-fetch": "^2.6.1",
39
+ "nunjucks": "^3.2.2",
40
+ "promptly": "^3.2.0",
41
+ "replace-in-file": "^3.4.4"
42
+ }
43
+ }
@@ -194,10 +194,18 @@ async function getUpdatedItem(
194
194
  const toolSchema = await schemaService.getToolSchema(
195
195
  qServer,
196
196
  existingItem.tool
197
- );
198
- // Removes additional properties not defined in the schema on the top level object of the item
199
- toolSchema.additionalProperties = false;
200
- // If options object is available additional properties not defined in the schema are removed
197
+ );
198
+ // Removes additional properties not defined in the schema on the top level object of the item
199
+ toolSchema.additionalProperties = false;
200
+
201
+ if(existingItem.customSchema) {
202
+ toolSchema.properties = {...toolSchema.properties, ...existingItem.customSchema}
203
+ }
204
+
205
+ if(existingItem.customSchemaDefinitions) {
206
+ toolSchema.definitions = {...toolSchema.definitions, ...existingItem.customSchemaDefinitions}
207
+ }
208
+ // If options object is available additional properties not defined in the schema are removed
201
209
  if (toolSchema.properties && toolSchema.properties.options) {
202
210
  toolSchema.properties.options.additionalProperties = false;
203
211
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nzz/q-cli",
3
- "version": "1.9.1",
3
+ "version": "1.9.2",
4
4
  "description": "Cli tool to setup new Q tools, new Q server implementations and start Q dev server to test developing Q tools",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -40,4 +40,4 @@
40
40
  "promptly": "^3.2.0",
41
41
  "replace-in-file": "^3.4.4"
42
42
  }
43
- }
43
+ }