@itentialopensource/adapter-godaddy 0.2.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 (106) hide show
  1. package/.eslintignore +5 -0
  2. package/.eslintrc.js +18 -0
  3. package/.gitlab/.gitkeep +0 -0
  4. package/.gitlab/issue_templates/.gitkeep +0 -0
  5. package/.gitlab/issue_templates/Default.md +17 -0
  6. package/.gitlab/issue_templates/bugReportTemplate.md +76 -0
  7. package/.gitlab/issue_templates/featureRequestTemplate.md +14 -0
  8. package/.jshintrc +3 -0
  9. package/AUTH.md +34 -0
  10. package/BROKER.md +199 -0
  11. package/CALLS.md +748 -0
  12. package/CHANGELOG.md +9 -0
  13. package/CODE_OF_CONDUCT.md +43 -0
  14. package/CONTRIBUTING.md +13 -0
  15. package/ENHANCE.md +69 -0
  16. package/LICENSE +201 -0
  17. package/PROPERTIES.md +641 -0
  18. package/README.md +346 -0
  19. package/SUMMARY.md +9 -0
  20. package/SYSTEMINFO.md +13 -0
  21. package/TROUBLESHOOT.md +47 -0
  22. package/adapter.js +9144 -0
  23. package/adapterBase.js +1452 -0
  24. package/changelogs/CHANGELOG.md +0 -0
  25. package/entities/.generic/action.json +214 -0
  26. package/entities/.generic/schema.json +28 -0
  27. package/entities/.system/action.json +50 -0
  28. package/entities/.system/mockdatafiles/getToken-default.json +3 -0
  29. package/entities/.system/mockdatafiles/healthcheck-default.json +3 -0
  30. package/entities/.system/schema.json +19 -0
  31. package/entities/.system/schemaTokenReq.json +53 -0
  32. package/entities/.system/schemaTokenResp.json +53 -0
  33. package/entities/Abuse/action.json +66 -0
  34. package/entities/Abuse/schema.json +21 -0
  35. package/entities/Actions/action.json +66 -0
  36. package/entities/Actions/mockdatafiles/getV2CustomersCustomerIdDomainsDomainActions-default.json +126 -0
  37. package/entities/Actions/schema.json +21 -0
  38. package/entities/Aftermarket/action.json +44 -0
  39. package/entities/Aftermarket/schema.json +20 -0
  40. package/entities/Agreements/action.json +25 -0
  41. package/entities/Agreements/mockdatafiles/getAgreements-default.json +8 -0
  42. package/entities/Agreements/schema.json +19 -0
  43. package/entities/Certificate/action.json +517 -0
  44. package/entities/Certificate/mockdatafiles/certificateGetEntitlement-default.json +205 -0
  45. package/entities/Certificate/mockdatafiles/getDomainInformationByCertificateId-default.json +32 -0
  46. package/entities/Certificate/schema.json +43 -0
  47. package/entities/Countries/action.json +46 -0
  48. package/entities/Countries/schema.json +20 -0
  49. package/entities/Domains/action.json +696 -0
  50. package/entities/Domains/mockdatafiles/domainsForwardsGet-default.json +12 -0
  51. package/entities/Domains/mockdatafiles/getAgreement-default.json +8 -0
  52. package/entities/Domains/mockdatafiles/listDomains-default.json +198 -0
  53. package/entities/Domains/mockdatafiles/recordGet-default.json +24 -0
  54. package/entities/Domains/mockdatafiles/suggest-default.json +11 -0
  55. package/entities/Domains/mockdatafiles/tlds-default.json +14 -0
  56. package/entities/Domains/schema.json +52 -0
  57. package/entities/Notifications/action.json +107 -0
  58. package/entities/Notifications/mockdatafiles/getV2CustomersCustomerIdDomainsNotificationsOptIn-default.json +32 -0
  59. package/entities/Notifications/schema.json +23 -0
  60. package/entities/Orders/action.json +46 -0
  61. package/entities/Orders/schema.json +20 -0
  62. package/entities/Parking/action.json +46 -0
  63. package/entities/Parking/schema.json +20 -0
  64. package/entities/Shoppers/action.json +126 -0
  65. package/entities/Shoppers/schema.json +24 -0
  66. package/entities/Subscriptions/action.json +107 -0
  67. package/entities/Subscriptions/mockdatafiles/productGroups-default.json +10 -0
  68. package/entities/Subscriptions/schema.json +23 -0
  69. package/error.json +190 -0
  70. package/metadata.json +54 -0
  71. package/package.json +82 -0
  72. package/pronghorn.json +15805 -0
  73. package/propertiesDecorators.json +14 -0
  74. package/propertiesSchema.json +1661 -0
  75. package/refs?service=git-upload-pack +0 -0
  76. package/report/adapter-openapi.json +13714 -0
  77. package/report/adapter-openapi.yaml +20419 -0
  78. package/report/adapterInfo.json +10 -0
  79. package/report/creationReport.json +765 -0
  80. package/report/godaddy.json +13714 -0
  81. package/report/updateReport1706477552013.json +120 -0
  82. package/sampleProperties.json +254 -0
  83. package/test/integration/adapterTestBasicGet.js +83 -0
  84. package/test/integration/adapterTestConnectivity.js +142 -0
  85. package/test/integration/adapterTestIntegration.js +2925 -0
  86. package/test/unit/adapterBaseTestUnit.js +1024 -0
  87. package/test/unit/adapterTestUnit.js +4900 -0
  88. package/utils/adapterInfo.js +206 -0
  89. package/utils/addAuth.js +94 -0
  90. package/utils/artifactize.js +146 -0
  91. package/utils/basicGet.js +50 -0
  92. package/utils/checkMigrate.js +63 -0
  93. package/utils/entitiesToDB.js +179 -0
  94. package/utils/findPath.js +74 -0
  95. package/utils/methodDocumentor.js +273 -0
  96. package/utils/modify.js +152 -0
  97. package/utils/packModificationScript.js +35 -0
  98. package/utils/patches2bundledDeps.js +90 -0
  99. package/utils/pre-commit.sh +32 -0
  100. package/utils/removeHooks.js +20 -0
  101. package/utils/setup.js +33 -0
  102. package/utils/taskMover.js +309 -0
  103. package/utils/tbScript.js +239 -0
  104. package/utils/tbUtils.js +489 -0
  105. package/utils/testRunner.js +298 -0
  106. package/utils/troubleshootingAdapter.js +193 -0
@@ -0,0 +1,120 @@
1
+ {
2
+ "errors": [],
3
+ "statistics": [
4
+ {
5
+ "owner": "errorJson",
6
+ "description": "New adapter errors available for use",
7
+ "value": 0
8
+ },
9
+ {
10
+ "owner": "errorJson",
11
+ "description": "Adapter errors no longer available for use",
12
+ "value": 0
13
+ },
14
+ {
15
+ "owner": "errorJson",
16
+ "description": "Adapter errors that have been updated (e.g. recommendation changes)",
17
+ "value": 31
18
+ },
19
+ {
20
+ "owner": "packageJson",
21
+ "description": "Number of production dependencies",
22
+ "value": 17
23
+ },
24
+ {
25
+ "owner": "packageJson",
26
+ "description": "Number of development dependencies",
27
+ "value": 6
28
+ },
29
+ {
30
+ "owner": "packageJson",
31
+ "description": "Number of npm scripts",
32
+ "value": 22
33
+ },
34
+ {
35
+ "owner": "packageJson",
36
+ "description": "Runtime Library dependency",
37
+ "value": "^5.3.0"
38
+ },
39
+ {
40
+ "owner": "propertiesSchemaJson",
41
+ "description": "Adapter properties defined in the propertiesSchema file",
42
+ "value": 76
43
+ },
44
+ {
45
+ "owner": "markdown",
46
+ "description": "Number of lines in the README.md",
47
+ "value": 347
48
+ },
49
+ {
50
+ "owner": "markdown",
51
+ "description": "Number of lines in the SUMMARY.md",
52
+ "value": 9
53
+ },
54
+ {
55
+ "owner": "markdown",
56
+ "description": "Number of lines in the PROPERTIES.md",
57
+ "value": 642
58
+ },
59
+ {
60
+ "owner": "markdown",
61
+ "description": "Number of lines in the TROUBLESHOOT.md",
62
+ "value": 48
63
+ },
64
+ {
65
+ "owner": "markdown",
66
+ "description": "Number of lines in the ENHANCE.md",
67
+ "value": 70
68
+ },
69
+ {
70
+ "owner": "markdown",
71
+ "description": "Number of lines in the BROKER.md",
72
+ "value": 70
73
+ },
74
+ {
75
+ "owner": "unitTestJS",
76
+ "description": "Number of lines of code in unit tests",
77
+ "value": 4901
78
+ },
79
+ {
80
+ "owner": "unitTestJS",
81
+ "description": "Number of unit tests",
82
+ "value": 294
83
+ },
84
+ {
85
+ "owner": "integrationTestJS",
86
+ "description": "Number of lines of code in integration tests",
87
+ "value": 2926
88
+ },
89
+ {
90
+ "owner": "integrationTestJS",
91
+ "description": "Number of integration tests",
92
+ "value": 99
93
+ },
94
+ {
95
+ "owner": "staticFile",
96
+ "description": "Number of lines of code in adapterBase.js",
97
+ "value": 1453
98
+ },
99
+ {
100
+ "owner": "staticFile",
101
+ "description": "Number of static files added",
102
+ "value": 36
103
+ },
104
+ {
105
+ "owner": "Overall",
106
+ "description": "Total lines of Code",
107
+ "value": 9280
108
+ },
109
+ {
110
+ "owner": "Overall",
111
+ "description": "Total Tests",
112
+ "value": 393
113
+ },
114
+ {
115
+ "owner": "Overall",
116
+ "description": "Total Files",
117
+ "value": 6
118
+ }
119
+ ]
120
+ }
@@ -0,0 +1,254 @@
1
+ {
2
+ "id": "Adapter-godaddy",
3
+ "type": "Godaddy",
4
+ "properties": {
5
+ "host": "api.godaddy.com",
6
+ "port": 443,
7
+ "choosepath": "",
8
+ "base_path": "/",
9
+ "version": "",
10
+ "cache_location": "none",
11
+ "encode_pathvars": true,
12
+ "encode_queryvars": true,
13
+ "save_metric": false,
14
+ "stub": false,
15
+ "protocol": "https",
16
+ "authentication": {
17
+ "auth_method": "static_token",
18
+ "token": "api_key:api_secret",
19
+ "token_timeout": 600000,
20
+ "token_cache": "local",
21
+ "invalid_token_error": 401,
22
+ "auth_field": "header.headers.Authorization",
23
+ "auth_field_format": "sso-key {token}",
24
+ "auth_logging": false,
25
+ "client_id": "",
26
+ "client_secret": "",
27
+ "grant_type": "",
28
+ "sensitive": [],
29
+ "sso": {
30
+ "protocol": "",
31
+ "host": "",
32
+ "port": 0
33
+ },
34
+ "multiStepAuthCalls": [
35
+ {
36
+ "name": "",
37
+ "requestFields": {},
38
+ "responseFields": {},
39
+ "successfullResponseCode": 200
40
+ }
41
+ ]
42
+ },
43
+ "healthcheck": {
44
+ "type": "startup",
45
+ "frequency": 60000,
46
+ "query_object": {},
47
+ "addlHeaders": {}
48
+ },
49
+ "throttle": {
50
+ "throttle_enabled": false,
51
+ "number_pronghorns": 1,
52
+ "sync_async": "sync",
53
+ "max_in_queue": 1000,
54
+ "concurrent_max": 1,
55
+ "expire_timeout": 0,
56
+ "avg_runtime": 200,
57
+ "priorities": [
58
+ {
59
+ "value": 0,
60
+ "percent": 100
61
+ }
62
+ ]
63
+ },
64
+ "request": {
65
+ "number_redirects": 0,
66
+ "number_retries": 3,
67
+ "limit_retry_error": [
68
+ 0
69
+ ],
70
+ "failover_codes": [],
71
+ "attempt_timeout": 10000,
72
+ "global_request": {
73
+ "payload": {},
74
+ "uriOptions": {},
75
+ "addlHeaders": {},
76
+ "authData": {}
77
+ },
78
+ "healthcheck_on_timeout": true,
79
+ "return_raw": false,
80
+ "archiving": false,
81
+ "return_request": false
82
+ },
83
+ "proxy": {
84
+ "enabled": false,
85
+ "host": "",
86
+ "port": 1,
87
+ "protocol": "http",
88
+ "username": "",
89
+ "password": ""
90
+ },
91
+ "ssl": {
92
+ "ecdhCurve": "",
93
+ "enabled": false,
94
+ "accept_invalid_cert": false,
95
+ "ca_file": "",
96
+ "key_file": "",
97
+ "cert_file": "",
98
+ "secure_protocol": "",
99
+ "ciphers": ""
100
+ },
101
+ "mongo": {
102
+ "host": "",
103
+ "port": 0,
104
+ "database": "",
105
+ "username": "",
106
+ "password": "",
107
+ "replSet": "",
108
+ "db_ssl": {
109
+ "enabled": false,
110
+ "accept_invalid_cert": false,
111
+ "ca_file": "",
112
+ "key_file": "",
113
+ "cert_file": ""
114
+ }
115
+ },
116
+ "devicebroker": {
117
+ "getDevice": [
118
+ {
119
+ "path": "/get/devices/{id}",
120
+ "method": "GET",
121
+ "query": {},
122
+ "body": {},
123
+ "headers": {},
124
+ "handleFailure": "ignore",
125
+ "requestFields": {
126
+ "id": "name"
127
+ },
128
+ "responseDatakey": "",
129
+ "responseFields": {
130
+ "name": "host",
131
+ "ostype": "os",
132
+ "ostypePrefix": "system-",
133
+ "ipaddress": "attributes.ipaddr",
134
+ "port": "443"
135
+ }
136
+ }
137
+ ],
138
+ "getDevicesFiltered": [
139
+ {
140
+ "path": "/get/devices",
141
+ "method": "GET",
142
+ "pagination": {
143
+ "offsetVar": "",
144
+ "limitVar": "",
145
+ "incrementBy": "limit",
146
+ "requestLocation": "query"
147
+ },
148
+ "query": {},
149
+ "body": {},
150
+ "headers": {},
151
+ "handleFailure": "ignore",
152
+ "requestFields": {},
153
+ "responseDatakey": "",
154
+ "responseFields": {
155
+ "name": "host",
156
+ "ostype": "os",
157
+ "ostypePrefix": "system-",
158
+ "ipaddress": "attributes.ipaddr",
159
+ "port": "443"
160
+ }
161
+ }
162
+ ],
163
+ "isAlive": [
164
+ {
165
+ "path": "/get/devices/{id}/status",
166
+ "method": "GET",
167
+ "query": {},
168
+ "body": {},
169
+ "headers": {},
170
+ "handleFailure": "ignore",
171
+ "requestFields": {
172
+ "id": "name"
173
+ },
174
+ "responseDatakey": "",
175
+ "responseFields": {
176
+ "status": "status",
177
+ "statusValue": "online"
178
+ }
179
+ }
180
+ ],
181
+ "getConfig": [
182
+ {
183
+ "path": "/get/devices/{id}/configPart1",
184
+ "method": "GET",
185
+ "query": {},
186
+ "body": {},
187
+ "headers": {},
188
+ "handleFailure": "ignore",
189
+ "requestFields": {
190
+ "id": "name"
191
+ },
192
+ "responseDatakey": "",
193
+ "responseFields": {}
194
+ }
195
+ ],
196
+ "getCount": [
197
+ {
198
+ "path": "/get/devices",
199
+ "method": "GET",
200
+ "query": {},
201
+ "body": {},
202
+ "headers": {},
203
+ "handleFailure": "ignore",
204
+ "requestFields": {},
205
+ "responseDatakey": "",
206
+ "responseFields": {}
207
+ }
208
+ ]
209
+ },
210
+ "cache": {
211
+ "enabled": false,
212
+ "entities": [
213
+ {
214
+ "entityType": "",
215
+ "frequency": 1440,
216
+ "flushOnFail": false,
217
+ "limit": 1000,
218
+ "retryAttempts": 5,
219
+ "sort": true,
220
+ "populate": [
221
+ {
222
+ "path": "",
223
+ "method": "GET",
224
+ "pagination": {
225
+ "offsetVar": "",
226
+ "limitVar": "",
227
+ "incrementBy": "limit",
228
+ "requestLocation": "query"
229
+ },
230
+ "query": {},
231
+ "body": {},
232
+ "headers": {},
233
+ "handleFailure": "ignore",
234
+ "requestFields": {},
235
+ "responseDatakey": "",
236
+ "responseFields": {}
237
+ }
238
+ ],
239
+ "cachedTasks": [
240
+ {
241
+ "name": "",
242
+ "filterField": "",
243
+ "filterLoc": ""
244
+ }
245
+ ]
246
+ }
247
+ ]
248
+ }
249
+ },
250
+ "groups": [],
251
+ "brokers": [],
252
+ "logLevel": "none",
253
+ "timeout": 120000
254
+ }
@@ -0,0 +1,83 @@
1
+ /* @copyright Itential, LLC 2020 */
2
+
3
+ /* global describe context before after */
4
+ /* eslint global-require: warn */
5
+ /* eslint no-unused-vars: warn */
6
+ /* eslint import/no-extraneous-dependencies: warn */
7
+ /* eslint import/no-dynamic-require: warn */
8
+ /* eslint import/no-unresolved: warn */
9
+
10
+ const path = require('path');
11
+ const assert = require('assert');
12
+ const mocha = require('mocha');
13
+ const itParam = require('mocha-param');
14
+
15
+ const utils = require('../../utils/tbUtils');
16
+ const basicGet = require('../../utils/basicGet');
17
+ const { name } = require('../../package.json');
18
+ const { methods } = require('../../pronghorn.json');
19
+
20
+ const getPronghornProps = (iapDir) => {
21
+ console.log('Retrieving properties.json file...');
22
+ const rawProps = require(path.join(iapDir, 'properties.json'));
23
+ console.log('Decrypting properties...');
24
+ const pronghornProps = utils.decryptProperties(rawProps, iapDir);
25
+ console.log('Found properties.\n');
26
+ return pronghornProps;
27
+ };
28
+
29
+ let a;
30
+
31
+ describe('[integration] Adapter BasicGET Test', () => {
32
+ context('Testing GET calls without query parameters', () => {
33
+ before(async () => {
34
+ const iapDir = path.join(__dirname, '../../../../../');
35
+ if (!utils.areWeUnderIAPinstallationDirectory()) {
36
+ const sampleProperties = require('../../sampleProperties.json');
37
+ const adapter = { properties: sampleProperties };
38
+ a = basicGet.getAdapterInstance(adapter);
39
+ } else {
40
+ const pronghornProps = getPronghornProps(iapDir);
41
+ console.log('Connecting to Database...');
42
+ const database = await basicGet.connect(pronghornProps);
43
+ console.log('Connection established.');
44
+ const adapter = await database.collection(utils.SERVICE_CONFIGS_COLLECTION).findOne(
45
+ { model: name }
46
+ );
47
+ a = basicGet.getAdapterInstance(adapter);
48
+ }
49
+ });
50
+
51
+ after((done) => {
52
+ done();
53
+ });
54
+
55
+ const basicGets = methods.filter((method) => (method.route.verb === 'GET' && method.input.length === 0));
56
+ if (basicGets.length === 0) {
57
+ console.log('No non-parameter GET calls found.');
58
+ process.exit(0);
59
+ }
60
+ const functionNames = basicGets.map((g) => g.name);
61
+ const request = function request(f, ad) {
62
+ return new Promise((resolve, reject) => {
63
+ const getRespCode = (resp) => {
64
+ if (resp) {
65
+ if (resp.metrics.code !== 200) {
66
+ console.log('\x1b[31m', `Testing ${f} \nResponseCode: ${resp.metrics.code}`);
67
+ }
68
+ resolve(resp.metrics.code);
69
+ } else {
70
+ console.log('\x1b[31m', `call ${f} results in failure`);
71
+ reject(new Error(`${f} failed`));
72
+ }
73
+ };
74
+ ad[f](getRespCode, console.log);
75
+ });
76
+ };
77
+
78
+ itParam('GET call should return 200', functionNames, (fname) => {
79
+ console.log(`\t ${fname}`);
80
+ return request(fname, a).then((result) => assert.equal(result, 200));
81
+ });
82
+ });
83
+ });
@@ -0,0 +1,142 @@
1
+ /* @copyright Itential, LLC 2020 */
2
+
3
+ /* global describe it context before after */
4
+ /* eslint no-unused-vars: warn */
5
+
6
+ const assert = require('assert');
7
+ const http = require('http');
8
+ const https = require('https');
9
+ const mocha = require('mocha');
10
+ const ping = require('ping');
11
+ const dnsLookup = require('dns-lookup-promise');
12
+
13
+ let host;
14
+ process.argv.forEach((val) => {
15
+ if (val.indexOf('--HOST') === 0) {
16
+ [, host] = val.split('=');
17
+ }
18
+ });
19
+
20
+ describe('[integration] Adapter Test', () => {
21
+ context(`Testing network connection on ${host}`, () => {
22
+ after((done) => {
23
+ done();
24
+ });
25
+
26
+ it('DNS resolve', (done) => {
27
+ dnsLookup(host)
28
+ .then((addresses) => {
29
+ try {
30
+ assert.ok(addresses.length > 0);
31
+ done();
32
+ } catch (error) {
33
+ done(error);
34
+ }
35
+ })
36
+ .catch((err) => {
37
+ done(err);
38
+ });
39
+ });
40
+
41
+ it('Responds to ping', (done) => {
42
+ ping.promise.probe(host)
43
+ .then((result) => {
44
+ try {
45
+ assert.ok(result.alive);
46
+ done();
47
+ } catch (error) {
48
+ done(error);
49
+ }
50
+ })
51
+ .catch((err) => {
52
+ done(err);
53
+ });
54
+ });
55
+
56
+ it('Support HTTP on port 80', (done) => {
57
+ const requestOptions = {
58
+ host,
59
+ port: 80,
60
+ method: 'HEAD'
61
+ };
62
+
63
+ const req = http.request(requestOptions, (res) => {
64
+ try {
65
+ assert.ok(res.statusCode >= 200 && res.statusCode < 400);
66
+ done();
67
+ } catch (error) {
68
+ done(error);
69
+ }
70
+ });
71
+
72
+ req.on('error', (err) => {
73
+ done(err);
74
+ });
75
+
76
+ req.end();
77
+ });
78
+
79
+ it('Support HTTPS on port 443', (done) => {
80
+ const requestOptions = {
81
+ host,
82
+ port: 443,
83
+ method: 'HEAD'
84
+ };
85
+
86
+ const req = https.request(requestOptions, (res) => {
87
+ try {
88
+ assert.ok(res.statusCode >= 200 && res.statusCode < 400);
89
+ done();
90
+ } catch (error) {
91
+ done(error);
92
+ }
93
+ });
94
+
95
+ req.on('error', (err) => {
96
+ done(err);
97
+ });
98
+
99
+ req.end();
100
+ });
101
+
102
+ it('Support IPv4', (done) => {
103
+ const options = {
104
+ family: 4,
105
+ hints: dnsLookup.ADDRCONFIG
106
+ };
107
+
108
+ dnsLookup.lookup(host, options)
109
+ .then((address, family) => {
110
+ try {
111
+ assert.ok(address !== null && family === 4);
112
+ done();
113
+ } catch (error) {
114
+ done(error);
115
+ }
116
+ })
117
+ .catch((err) => {
118
+ done(err);
119
+ });
120
+ });
121
+
122
+ it('Support IPv6', (done) => {
123
+ const options = {
124
+ family: 6,
125
+ hints: dnsLookup.ADDRCONFIG
126
+ };
127
+
128
+ dnsLookup.lookup(host, options)
129
+ .then((address, family) => {
130
+ try {
131
+ assert.ok(address !== null && family === 6);
132
+ done();
133
+ } catch (error) {
134
+ done(error);
135
+ }
136
+ })
137
+ .catch((err) => {
138
+ done(err);
139
+ });
140
+ });
141
+ });
142
+ });