@itentialopensource/adapter-servicenow 2.2.1 → 2.4.0

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.
Files changed (52) hide show
  1. package/.eslintignore +1 -0
  2. package/AUTH.md +39 -0
  3. package/BROKER.md +199 -0
  4. package/CALLS.md +169 -0
  5. package/CHANGELOG.md +62 -40
  6. package/CODE_OF_CONDUCT.md +12 -17
  7. package/CONTRIBUTING.md +88 -74
  8. package/ENHANCE.md +69 -0
  9. package/PROPERTIES.md +641 -0
  10. package/README.md +228 -420
  11. package/SUMMARY.md +9 -0
  12. package/SYSTEMINFO.md +11 -0
  13. package/TROUBLESHOOT.md +47 -0
  14. package/adapter.js +1665 -52
  15. package/adapterBase.js +1270 -238
  16. package/entities/.generic/action.json +214 -0
  17. package/entities/.generic/schema.json +28 -0
  18. package/entities/.system/action.json +3 -2
  19. package/entities/ChangeManagement/action.json +63 -0
  20. package/entities/ChangeManagement/schema.json +4 -1
  21. package/error.json +12 -0
  22. package/package.json +45 -20
  23. package/pronghorn.json +767 -77
  24. package/propertiesDecorators.json +14 -0
  25. package/propertiesSchema.json +476 -8
  26. package/refs?service=git-upload-pack +0 -0
  27. package/report/adapterInfo.json +10 -0
  28. package/report/updateReport1615339875463.json +95 -0
  29. package/report/updateReport1653406010548.json +120 -0
  30. package/sampleProperties.json +102 -5
  31. package/storage/metrics.json +2205 -0
  32. package/test/integration/adapterTestBasicGet.js +85 -0
  33. package/test/integration/adapterTestConnectivity.js +93 -0
  34. package/test/integration/adapterTestIntegration.js +29 -98
  35. package/test/unit/adapterBaseTestUnit.js +949 -0
  36. package/test/unit/adapterTestUnit.js +780 -109
  37. package/utils/adapterInfo.js +206 -0
  38. package/utils/addAuth.js +94 -0
  39. package/utils/basicGet.js +50 -0
  40. package/utils/checkMigrate.js +63 -0
  41. package/utils/entitiesToDB.js +179 -0
  42. package/utils/findPath.js +74 -0
  43. package/utils/modify.js +154 -0
  44. package/utils/packModificationScript.js +1 -1
  45. package/utils/patches2bundledDeps.js +90 -0
  46. package/utils/pre-commit.sh +3 -0
  47. package/utils/removeHooks.js +20 -0
  48. package/utils/tbScript.js +184 -0
  49. package/utils/tbUtils.js +469 -0
  50. package/utils/testRunner.js +16 -16
  51. package/utils/troubleshootingAdapter.js +190 -0
  52. package/img/adapter.png +0 -0
@@ -0,0 +1,214 @@
1
+ {
2
+ "actions": [
3
+ {
4
+ "name": "getGenerics",
5
+ "protocol": "REST",
6
+ "method": "GET",
7
+ "entitypath": "{base_path}/{version}/{pathv1}/{pathv2}/{pathv3}/{pathv4}/{pathv5}/{pathv6}/{pathv7}/{pathv8}/{pathv9}/{pathv10}/{pathv11}/{pathv12}/{pathv13}/{pathv14}/{pathv15}/{pathv16}/{pathv17}/{pathv18}/{pathv19}/{pathv20}?{query}",
8
+ "requestSchema": "schema.json",
9
+ "responseSchema": "schema.json",
10
+ "timeout": 0,
11
+ "sendEmpty": false,
12
+ "sendGetBody": false,
13
+ "requestDatatype": "JSON",
14
+ "responseDatatype": "JSON",
15
+ "headers": {},
16
+ "responseObjects": [
17
+ {
18
+ "type": "default",
19
+ "key": "",
20
+ "mockFile": ""
21
+ }
22
+ ]
23
+ },
24
+ {
25
+ "name": "createGeneric",
26
+ "protocol": "REST",
27
+ "method": "POST",
28
+ "entitypath": "{base_path}/{version}/{pathv1}/{pathv2}/{pathv3}/{pathv4}/{pathv5}/{pathv6}/{pathv7}/{pathv8}/{pathv9}/{pathv10}/{pathv11}/{pathv12}/{pathv13}/{pathv14}/{pathv15}/{pathv16}/{pathv17}/{pathv18}/{pathv19}/{pathv20}?{query}",
29
+ "requestSchema": "schema.json",
30
+ "responseSchema": "schema.json",
31
+ "timeout": 0,
32
+ "sendEmpty": false,
33
+ "sendGetBody": false,
34
+ "requestDatatype": "JSON",
35
+ "responseDatatype": "JSON",
36
+ "headers": {},
37
+ "responseObjects": [
38
+ {
39
+ "type": "default",
40
+ "key": "",
41
+ "mockFile": ""
42
+ }
43
+ ]
44
+ },
45
+ {
46
+ "name": "updateGeneric",
47
+ "protocol": "REST",
48
+ "method": "PUT",
49
+ "entitypath": "{base_path}/{version}/{pathv1}/{pathv2}/{pathv3}/{pathv4}/{pathv5}/{pathv6}/{pathv7}/{pathv8}/{pathv9}/{pathv10}/{pathv11}/{pathv12}/{pathv13}/{pathv14}/{pathv15}/{pathv16}/{pathv17}/{pathv18}/{pathv19}/{pathv20}?{query}",
50
+ "requestSchema": "schema.json",
51
+ "responseSchema": "schema.json",
52
+ "timeout": 0,
53
+ "sendEmpty": false,
54
+ "sendGetBody": false,
55
+ "requestDatatype": "JSON",
56
+ "responseDatatype": "JSON",
57
+ "headers": {},
58
+ "responseObjects": [
59
+ {
60
+ "type": "default",
61
+ "key": "",
62
+ "mockFile": ""
63
+ }
64
+ ]
65
+ },
66
+ {
67
+ "name": "patchGeneric",
68
+ "protocol": "REST",
69
+ "method": "PATCH",
70
+ "entitypath": "{base_path}/{version}/{pathv1}/{pathv2}/{pathv3}/{pathv4}/{pathv5}/{pathv6}/{pathv7}/{pathv8}/{pathv9}/{pathv10}/{pathv11}/{pathv12}/{pathv13}/{pathv14}/{pathv15}/{pathv16}/{pathv17}/{pathv18}/{pathv19}/{pathv20}?{query}",
71
+ "requestSchema": "schema.json",
72
+ "responseSchema": "schema.json",
73
+ "timeout": 0,
74
+ "sendEmpty": false,
75
+ "sendGetBody": false,
76
+ "requestDatatype": "JSON",
77
+ "responseDatatype": "JSON",
78
+ "headers": {},
79
+ "responseObjects": [
80
+ {
81
+ "type": "default",
82
+ "key": "",
83
+ "mockFile": ""
84
+ }
85
+ ]
86
+ },
87
+ {
88
+ "name": "deleteGeneric",
89
+ "protocol": "REST",
90
+ "method": "DELETE",
91
+ "entitypath": "{base_path}/{version}/{pathv1}/{pathv2}/{pathv3}/{pathv4}/{pathv5}/{pathv6}/{pathv7}/{pathv8}/{pathv9}/{pathv10}/{pathv11}/{pathv12}/{pathv13}/{pathv14}/{pathv15}/{pathv16}/{pathv17}/{pathv18}/{pathv19}/{pathv20}?{query}",
92
+ "requestSchema": "schema.json",
93
+ "responseSchema": "schema.json",
94
+ "timeout": 0,
95
+ "sendEmpty": false,
96
+ "sendGetBody": false,
97
+ "requestDatatype": "JSON",
98
+ "responseDatatype": "JSON",
99
+ "headers": {},
100
+ "responseObjects": [
101
+ {
102
+ "type": "default",
103
+ "key": "",
104
+ "mockFile": ""
105
+ }
106
+ ]
107
+ },
108
+ {
109
+ "name": "getGenericsNoBase",
110
+ "protocol": "REST",
111
+ "method": "GET",
112
+ "entitypath": "/{pathv1}/{pathv2}/{pathv3}/{pathv4}/{pathv5}/{pathv6}/{pathv7}/{pathv8}/{pathv9}/{pathv10}/{pathv11}/{pathv12}/{pathv13}/{pathv14}/{pathv15}/{pathv16}/{pathv17}/{pathv18}/{pathv19}/{pathv20}?{query}",
113
+ "requestSchema": "schema.json",
114
+ "responseSchema": "schema.json",
115
+ "timeout": 0,
116
+ "sendEmpty": false,
117
+ "sendGetBody": false,
118
+ "requestDatatype": "JSON",
119
+ "responseDatatype": "JSON",
120
+ "headers": {},
121
+ "responseObjects": [
122
+ {
123
+ "type": "default",
124
+ "key": "",
125
+ "mockFile": ""
126
+ }
127
+ ]
128
+ },
129
+ {
130
+ "name": "createGenericNoBase",
131
+ "protocol": "REST",
132
+ "method": "POST",
133
+ "entitypath": "/{pathv1}/{pathv2}/{pathv3}/{pathv4}/{pathv5}/{pathv6}/{pathv7}/{pathv8}/{pathv9}/{pathv10}/{pathv11}/{pathv12}/{pathv13}/{pathv14}/{pathv15}/{pathv16}/{pathv17}/{pathv18}/{pathv19}/{pathv20}?{query}",
134
+ "requestSchema": "schema.json",
135
+ "responseSchema": "schema.json",
136
+ "timeout": 0,
137
+ "sendEmpty": false,
138
+ "sendGetBody": false,
139
+ "requestDatatype": "JSON",
140
+ "responseDatatype": "JSON",
141
+ "headers": {},
142
+ "responseObjects": [
143
+ {
144
+ "type": "default",
145
+ "key": "",
146
+ "mockFile": ""
147
+ }
148
+ ]
149
+ },
150
+ {
151
+ "name": "updateGenericNoBase",
152
+ "protocol": "REST",
153
+ "method": "PUT",
154
+ "entitypath": "/{pathv1}/{pathv2}/{pathv3}/{pathv4}/{pathv5}/{pathv6}/{pathv7}/{pathv8}/{pathv9}/{pathv10}/{pathv11}/{pathv12}/{pathv13}/{pathv14}/{pathv15}/{pathv16}/{pathv17}/{pathv18}/{pathv19}/{pathv20}?{query}",
155
+ "requestSchema": "schema.json",
156
+ "responseSchema": "schema.json",
157
+ "timeout": 0,
158
+ "sendEmpty": false,
159
+ "sendGetBody": false,
160
+ "requestDatatype": "JSON",
161
+ "responseDatatype": "JSON",
162
+ "headers": {},
163
+ "responseObjects": [
164
+ {
165
+ "type": "default",
166
+ "key": "",
167
+ "mockFile": ""
168
+ }
169
+ ]
170
+ },
171
+ {
172
+ "name": "patchGenericNoBase",
173
+ "protocol": "REST",
174
+ "method": "PATCH",
175
+ "entitypath": "/{pathv1}/{pathv2}/{pathv3}/{pathv4}/{pathv5}/{pathv6}/{pathv7}/{pathv8}/{pathv9}/{pathv10}/{pathv11}/{pathv12}/{pathv13}/{pathv14}/{pathv15}/{pathv16}/{pathv17}/{pathv18}/{pathv19}/{pathv20}?{query}",
176
+ "requestSchema": "schema.json",
177
+ "responseSchema": "schema.json",
178
+ "timeout": 0,
179
+ "sendEmpty": false,
180
+ "sendGetBody": false,
181
+ "requestDatatype": "JSON",
182
+ "responseDatatype": "JSON",
183
+ "headers": {},
184
+ "responseObjects": [
185
+ {
186
+ "type": "default",
187
+ "key": "",
188
+ "mockFile": ""
189
+ }
190
+ ]
191
+ },
192
+ {
193
+ "name": "deleteGenericNoBase",
194
+ "protocol": "REST",
195
+ "method": "DELETE",
196
+ "entitypath": "/{pathv1}/{pathv2}/{pathv3}/{pathv4}/{pathv5}/{pathv6}/{pathv7}/{pathv8}/{pathv9}/{pathv10}/{pathv11}/{pathv12}/{pathv13}/{pathv14}/{pathv15}/{pathv16}/{pathv17}/{pathv18}/{pathv19}/{pathv20}?{query}",
197
+ "requestSchema": "schema.json",
198
+ "responseSchema": "schema.json",
199
+ "timeout": 0,
200
+ "sendEmpty": false,
201
+ "sendGetBody": false,
202
+ "requestDatatype": "JSON",
203
+ "responseDatatype": "JSON",
204
+ "headers": {},
205
+ "responseObjects": [
206
+ {
207
+ "type": "default",
208
+ "key": "",
209
+ "mockFile": ""
210
+ }
211
+ ]
212
+ }
213
+ ]
214
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "$id": "generic_schema.json",
3
+ "type": "object",
4
+ "schema": "http://json-schema.org/draft-07/schema#",
5
+ "translate": false,
6
+ "dynamicfields": true,
7
+ "properties": {
8
+ "ph_request_type": {
9
+ "type": "string",
10
+ "description": "type of request (internal to adapter)",
11
+ "default": "getGeneric",
12
+ "enum": [
13
+ "getGenerics",
14
+ "createGeneric",
15
+ "updateGeneric",
16
+ "patchGeneric",
17
+ "deleteGeneric",
18
+ "getGenericsNoBase",
19
+ "createGenericNoBase",
20
+ "updateGenericNoBase",
21
+ "patchGenericNoBase",
22
+ "deleteGenericNoBase"
23
+ ],
24
+ "external_name": "ph_request_type"
25
+ }
26
+ },
27
+ "definitions": {}
28
+ }
@@ -11,7 +11,7 @@
11
11
  "sendEmpty": false,
12
12
  "sendGetBody": false,
13
13
  "requestDatatype": "urlencode",
14
- "responseDatatype": "urlencode",
14
+ "responseDatatype": "JSON",
15
15
  "headers": {},
16
16
  "sso": {
17
17
  "protocol": "",
@@ -21,7 +21,8 @@
21
21
  "responseObjects": [
22
22
  {
23
23
  "type": "default",
24
- "key": "mockdatafiles/getToken-default.json"
24
+ "key": "",
25
+ "mockFile": "mockdatafiles/getToken-default.json"
25
26
  }
26
27
  ]
27
28
  },
@@ -189,6 +189,27 @@
189
189
  }
190
190
  ]
191
191
  },
192
+ {
193
+ "name": "updateNormalChangeRequestById",
194
+ "protocol": "REST",
195
+ "method": "PATCH",
196
+ "entitypath": "{base_path}/{version}/sn_chg_rest/change/normal/{pathv1}?{query}",
197
+ "requestSchema": "schema.json",
198
+ "responseSchema": "schema.json",
199
+ "timeout": 0,
200
+ "sendEmpty": false,
201
+ "sendGetBody": false,
202
+ "requestDatatype": "JSON",
203
+ "responseDatatype": "JSON",
204
+ "headers": {},
205
+ "responseObjects": [
206
+ {
207
+ "type": "default",
208
+ "key": "",
209
+ "mockFile": "mockdatafiles/deleteNormalChangeRequestById-default.json"
210
+ }
211
+ ]
212
+ },
192
213
  {
193
214
  "name": "deleteNormalChangeRequestById",
194
215
  "protocol": "REST",
@@ -440,6 +461,48 @@
440
461
  "mockFile": ""
441
462
  }
442
463
  ]
464
+ },
465
+ {
466
+ "name": "createChangeRequestRiskAssessment",
467
+ "protocol": "REST",
468
+ "method": "POST",
469
+ "entitypath": "{base_path}/{version}/sn_chg_rest/change/risk_copy_asmt?{query}",
470
+ "requestSchema": "schema.json",
471
+ "responseSchema": "schema.json",
472
+ "timeout": 0,
473
+ "sendEmpty": false,
474
+ "sendGetBody": false,
475
+ "requestDatatype": "JSON",
476
+ "responseDatatype": "JSON",
477
+ "headers": {},
478
+ "responseObjects": [
479
+ {
480
+ "type": "default",
481
+ "key": "result",
482
+ "mockFile": ""
483
+ }
484
+ ]
485
+ },
486
+ {
487
+ "name": "autoApproveChangeRequest",
488
+ "protocol": "REST",
489
+ "method": "PATCH",
490
+ "entitypath": "{base_path}/{version}/sn_chg_rest/change/{pathv1}/approvals?{query}",
491
+ "requestSchema": "schema.json",
492
+ "responseSchema": "schema.json",
493
+ "timeout": 0,
494
+ "sendEmpty": false,
495
+ "sendGetBody": false,
496
+ "requestDatatype": "JSON",
497
+ "responseDatatype": "JSON",
498
+ "headers": {},
499
+ "responseObjects": [
500
+ {
501
+ "type": "default",
502
+ "key": "result",
503
+ "mockFile": ""
504
+ }
505
+ ]
443
506
  }
444
507
  ]
445
508
  }
@@ -18,6 +18,7 @@
18
18
  "getStandardChangeTemplateById",
19
19
  "getNormalChangeRequest",
20
20
  "createNormalChangeRequest",
21
+ "updateNormalChangeRequestById",
21
22
  "getNormalChangeRequestById",
22
23
  "deleteNormalChangeRequestById",
23
24
  "getEmergencyChangeRequest",
@@ -30,7 +31,9 @@
30
31
  "deleteChangeTaskByTaskId",
31
32
  "getChangeRequestConflict",
32
33
  "createChangeRequestConflict",
33
- "cancelChangeRequestConflict"
34
+ "cancelChangeRequestConflict",
35
+ "createChangeRequestRiskAssessment",
36
+ "autoApproveChangeRequest"
34
37
  ],
35
38
  "external_name": "ph_request_type"
36
39
  },
package/error.json CHANGED
@@ -96,6 +96,12 @@
96
96
  "displayString": "Invalid properties: $VARIABLE$",
97
97
  "recommendation": "Verify the properties for the adapter"
98
98
  },
99
+ {
100
+ "key": "Missing Properties",
101
+ "icode": "AD.306",
102
+ "displayString": "Property $VARIABLE$ is required",
103
+ "recommendation": "Please provide the required property"
104
+ },
99
105
  {
100
106
  "key": "Query Not Translated",
101
107
  "icode": "AD.310",
@@ -168,6 +174,12 @@
168
174
  "displayString": "Failure response received for $VARIABLE$",
169
175
  "recommendation": "Check the reason for failure in the stack trace"
170
176
  },
177
+ {
178
+ "key": "Suspended Adapter",
179
+ "icode": "AD.600",
180
+ "displayString": "Adapter is suspended",
181
+ "recommendation": "Check if external system is functional and unsuspend if appropriate"
182
+ },
171
183
  {
172
184
  "key": "Caught Exception",
173
185
  "icode": "AD.900",
package/package.json CHANGED
@@ -1,20 +1,33 @@
1
1
  {
2
2
  "name": "@itentialopensource/adapter-servicenow",
3
- "version": "2.2.1",
3
+ "version": "2.4.0",
4
4
  "description": "This adapter integrates with system described as: servicenowMadrid.",
5
5
  "main": "adapter.js",
6
- "wizardVersion": "2.41.25",
7
- "engineVersion": "1.52.2",
6
+ "systemName": "ServiceNow",
7
+ "wizardVersion": "2.44.7",
8
+ "engineVersion": "1.61.6",
9
+ "adapterType": "http",
8
10
  "scripts": {
9
11
  "artifactize": "npm i && node utils/packModificationScript.js",
10
- "preinstall": "node utils/setup.js",
12
+ "preinstall": "node utils/setup.js && npm install --package-lock-only --ignore-scripts && npx npm-force-resolutions",
11
13
  "lint": "node --max_old_space_size=4096 ./node_modules/eslint/bin/eslint.js . --ext .json --ext .js",
12
14
  "lint:errors": "node --max_old_space_size=4096 ./node_modules/eslint/bin/eslint.js . --ext .json --ext .js --quiet",
15
+ "test:baseunit": "mocha test/unit/adapterBaseTestUnit.js --LOG=error",
13
16
  "test:unit": "mocha test/unit/adapterTestUnit.js --LOG=error",
14
17
  "test:integration": "mocha test/integration/adapterTestIntegration.js --LOG=error",
15
18
  "test:cover": "nyc --reporter html --reporter text mocha --reporter dot test/*",
16
- "test": "npm run test:unit && npm run test:integration",
17
- "deploy": "npm publish --registry=http://registry.npmjs.org --access=public",
19
+ "test": "npm run test:baseunit && npm run test:unit && npm run test:integration",
20
+ "adapter:install": "npm i && node utils/tbScript.js install",
21
+ "adapter:checkMigrate": "node utils/checkMigrate.js",
22
+ "adapter:findPath": "node utils/findPath.js",
23
+ "adapter:migrate": "node utils/modify.js -m",
24
+ "adapter:update": "node utils/modify.js -u",
25
+ "adapter:revert": "node utils/modify.js -r",
26
+ "troubleshoot": "node utils/tbScript.js",
27
+ "healthcheck": "node utils/tbScript.js healthcheck",
28
+ "basicget": "node utils/tbScript.js basicget",
29
+ "connectivity": "node utils/tbScript.js connectivity",
30
+ "deploy": "npm publish --registry=https://registry.npmjs.org --access=public",
18
31
  "build": "npm run deploy"
19
32
  },
20
33
  "keywords": [
@@ -24,6 +37,8 @@
24
37
  "Integration",
25
38
  "App-Artifacts",
26
39
  "Adapter",
40
+ "ITSM",
41
+ "Testing",
27
42
  "servicenow",
28
43
  "Released"
29
44
  ],
@@ -34,27 +49,37 @@
34
49
  },
35
50
  "repository": {
36
51
  "type": "git",
37
- "url": "git@gitlab.com:itentialopensource/adapters/adapter-servicenow.git"
52
+ "url": "git@gitlab.com:itentialopensource/adapters/itsm-testing/adapter-servicenow.git"
38
53
  },
39
54
  "author": "Itential",
40
- "homepage": "https://gitlab.com/itentialopensource/adapters/adapter-servicenow#readme",
55
+ "homepage": "https://gitlab.com/itentialopensource/adapters/itsm-testing/adapter-servicenow#readme",
41
56
  "dependencies": {
42
- "@itentialopensource/adapter-utils": "^4.34.4",
57
+ "@itentialopensource/adapter-utils": "^4.45.6",
43
58
  "ajv": "^6.12.0",
59
+ "axios": "^0.21.0",
60
+ "commander": "^2.20.0",
44
61
  "fs-extra": "^8.1.0",
45
- "package-json-validator": "^0.6.3",
46
- "readline-sync": "^1.4.10"
62
+ "json-query": "^2.2.2",
63
+ "mocha": "^9.0.1",
64
+ "mocha-param": "^2.0.1",
65
+ "mongodb": "^4.1.0",
66
+ "network-diagnostics": "^0.5.3",
67
+ "nyc": "^15.1.0",
68
+ "readline-sync": "^1.4.10",
69
+ "semver": "^7.3.2",
70
+ "winston": "^3.3.3"
47
71
  },
48
72
  "devDependencies": {
49
- "chai": "^4.2.0",
50
- "eslint": "^7.2.0",
51
- "eslint-config-airbnb-base": "^14.2.0",
52
- "eslint-plugin-import": "^2.21.2",
53
- "eslint-plugin-json": "^2.1.1",
54
- "mocha": "^8.0.1",
55
- "nyc": "^15.1.0",
56
- "testdouble": "^3.16.0",
57
- "winston": "^3.2.1"
73
+ "chai": "^4.3.4",
74
+ "eslint": "^7.29.0",
75
+ "eslint-config-airbnb-base": "^14.2.1",
76
+ "eslint-plugin-import": "^2.23.4",
77
+ "eslint-plugin-json": "^3.0.0",
78
+ "package-json-validator": "^0.6.3",
79
+ "testdouble": "^3.16.1"
80
+ },
81
+ "resolutions": {
82
+ "minimist": "^1.2.5"
58
83
  },
59
84
  "private": false
60
85
  }