@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,239 @@
1
+ /* eslint-disable no-console */
2
+ /* eslint import/no-unresolved: warn */
3
+ /* eslint global-require: warn */
4
+
5
+ // suppress eslint rule in adapter
6
+ /* eslint arrow-parens: warn */
7
+ /* eslint import/no-extraneous-dependencies: warn */
8
+ /* eslint import/no-dynamic-require: warn */
9
+
10
+ const program = require('commander');
11
+ const rls = require('readline-sync');
12
+ const prompts = require('prompts');
13
+ const utils = require('./tbUtils');
14
+ const basicGet = require('./basicGet');
15
+ const { name } = require('../package.json');
16
+ const sampleProperties = require('../sampleProperties.json');
17
+ const adapterPronghorn = require('../pronghorn.json');
18
+ const { addAuthInfo } = require('./addAuth');
19
+
20
+ const { troubleshoot, offline } = require('./troubleshootingAdapter');
21
+
22
+ const executeInStandaloneMode = async (command) => {
23
+ console.info('\n> Executing the script outside of IAP installation directory');
24
+ console.info('> Using sampleProperties.json configuration');
25
+ switch (command) {
26
+ case 'install': {
27
+ console.error('Not currently in IAP directory - installation not possible');
28
+ break;
29
+ }
30
+ case 'connectivity': {
31
+ const { host } = sampleProperties.properties;
32
+ console.log(`perform networking diagnositics to ${host}`);
33
+ utils.runConnectivity(host);
34
+ break;
35
+ }
36
+ case 'healthcheck': {
37
+ const a = basicGet.getAdapterInstance({ properties: sampleProperties });
38
+ await utils.healthCheck(a);
39
+ break;
40
+ }
41
+ case 'basicget': {
42
+ utils.runBasicGet();
43
+ break;
44
+ }
45
+ default: {
46
+ if (rls.keyInYN('Troubleshooting without IAP?')) {
47
+ await offline();
48
+ }
49
+ }
50
+ }
51
+ process.exit(0);
52
+ };
53
+
54
+ const getAdapterInstanceConfig = async (command) => {
55
+ const instances = await utils.getAllAdapterInstances();
56
+ if (!instances || instances.length === 0) {
57
+ return console.log('None adapter instances found!');
58
+ }
59
+
60
+ let instance;
61
+ if (instances.length === 1) {
62
+ [instance] = instances;
63
+ } else {
64
+ const choices = instances.map((item) => ({ title: item.name }));
65
+ const menu = {
66
+ type: 'select',
67
+ name: 'index',
68
+ message: `Pick an adapter for ${command} check`,
69
+ choices
70
+ };
71
+
72
+ console.log('\n');
73
+ const selected = await prompts(menu);
74
+ console.log('\n');
75
+ instance = instances[selected.index];
76
+ }
77
+
78
+ if (!instance) {
79
+ console.error('No adapter instance selected');
80
+ return null;
81
+ }
82
+
83
+ const { serviceItem: adapterConfig } = await utils.getAdapterConfig(instance._id); /* eslint-disable-line no-underscore-dangle */
84
+
85
+ console.log('\nAdapter instance configuration =>');
86
+ console.log('======================================');
87
+ console.log(adapterConfig);
88
+ console.log('======================================');
89
+
90
+ return adapterConfig;
91
+ };
92
+
93
+ const executeCommandOnInstance = async (command) => {
94
+ const adapterConfig = await getAdapterInstanceConfig(command);
95
+ if (!adapterConfig) {
96
+ process.exit(0);
97
+ }
98
+
99
+ switch (command) {
100
+ case 'connectivity': {
101
+ const { host } = adapterConfig.properties.properties;
102
+ console.log(`perform networking diagnositics to ${host}`);
103
+ utils.runConnectivity(host, true);
104
+ break;
105
+ }
106
+ case 'healthcheck': {
107
+ const adapterInstance = basicGet.getAdapterInstance(adapterConfig);
108
+ await utils.healthCheck(adapterInstance);
109
+ break;
110
+ }
111
+ case 'basicget': {
112
+ utils.runBasicGet(true);
113
+ break;
114
+ }
115
+ case 'troubleshoot': {
116
+ const adapter = { properties: adapterConfig };
117
+ await troubleshoot({}, true, true, adapter);
118
+ break;
119
+ }
120
+ default: {
121
+ console.error(`Unknown command: ${command}`);
122
+ }
123
+ }
124
+ return process.exit(0);
125
+ };
126
+
127
+ const executeUnderIAPInstallationDirectory = async (command) => {
128
+ if (command === 'install') {
129
+ const { database, serviceItem, pronghornProps } = await utils.getAdapterConfig();
130
+ const filter = { id: pronghornProps.id };
131
+ const profileItem = await database.collection(utils.IAP_PROFILES_COLLECTION).findOne(filter);
132
+ if (!profileItem) {
133
+ console.log(`Could not find IAP profile for id ${pronghornProps.id}`);
134
+ process.exit(0);
135
+ }
136
+ if (serviceItem) {
137
+ console.log(`A service by the name ${name} already exits!`);
138
+ if (rls.keyInYN(`Do you want to completely remove ${name}?`)) {
139
+ console.log(`Removing ${name} from db...`);
140
+ await database.collection(utils.SERVICE_CONFIGS_COLLECTION).deleteOne({ model: name });
141
+ console.log(`${name} removed from db.`);
142
+ if (profileItem.services.includes(serviceItem.name)) {
143
+ const serviceIndex = profileItem.services.indexOf(serviceItem.name);
144
+ profileItem.services.splice(serviceIndex, 1);
145
+ const update = { $set: { services: profileItem.services } };
146
+ await database.collection(utils.IAP_PROFILES_COLLECTION).updateOne({ id: pronghornProps.id }, update);
147
+ console.log(`${serviceItem.name} removed from profileItem.services.`);
148
+ console.log(`Rerun the script to reinstall ${serviceItem.name}.`);
149
+ process.exit(0);
150
+ } else {
151
+ process.exit(0);
152
+ }
153
+ } else {
154
+ console.log('Exiting...');
155
+ process.exit(0);
156
+ }
157
+ } else {
158
+ const dirname = utils.getCurrentExecutionPath();
159
+ utils.verifyInstallationDir(dirname, name);
160
+ utils.runTest();
161
+ if (rls.keyInYN(`Do you want to install ${name} to IAP?`)) {
162
+ console.log('Creating database entries...');
163
+ const adapter = utils.createAdapter(pronghornProps, profileItem, sampleProperties, adapterPronghorn);
164
+ adapter.properties.properties = await addAuthInfo(adapter.properties.properties);
165
+
166
+ await database.collection(utils.SERVICE_CONFIGS_COLLECTION).insertOne(adapter);
167
+ profileItem.services.push(adapter.name);
168
+ const update = { $set: { services: profileItem.services } };
169
+ await database.collection(utils.IAP_PROFILES_COLLECTION).updateOne({ id: pronghornProps.id }, update);
170
+ console.log('Database entry creation complete.');
171
+ }
172
+ console.log('Exiting...');
173
+ process.exit(0);
174
+ }
175
+ } else if (['healthcheck', 'basicget', 'connectivity', 'troubleshoot'].includes(command)) {
176
+ await executeCommandOnInstance(command);
177
+ }
178
+ };
179
+
180
+ const main = async (command) => {
181
+ if (!utils.areWeUnderIAPinstallationDirectory()) {
182
+ executeInStandaloneMode(command); // configuration from sampleproperties.json
183
+ } else {
184
+ executeUnderIAPInstallationDirectory(command); // configuration from $IAP_HOME/properties.json
185
+ }
186
+ };
187
+
188
+ program
189
+ .command('connectivity')
190
+ .alias('c')
191
+ .description('networking diagnostics')
192
+ .action(() => {
193
+ main('connectivity');
194
+ });
195
+
196
+ program
197
+ .command('install')
198
+ .alias('i')
199
+ .description('install current adapter')
200
+ .action(() => {
201
+ main('install');
202
+ });
203
+
204
+ program
205
+ .command('healthcheck')
206
+ .alias('hc')
207
+ .description('perfom none interative healthcheck with current setting')
208
+ .action(() => {
209
+ main('healthcheck');
210
+ });
211
+
212
+ program
213
+ .command('basicget')
214
+ .alias('bg')
215
+ .description('perfom basicget')
216
+ .action(() => {
217
+ main('basicget');
218
+ });
219
+
220
+ program
221
+ .command('troubleshoot')
222
+ .alias('tb')
223
+ .description('perfom troubleshooting')
224
+ .action(() => {
225
+ main('troubleshoot');
226
+ });
227
+
228
+ // Allow commander to parse `process.argv`
229
+ program.parse(process.argv);
230
+
231
+ if (process.argv.length < 3) {
232
+ main();
233
+ }
234
+ const allowedParams = ['install', 'healthcheck', 'basicget', 'connectivity', 'troubleshoot'];
235
+ if (process.argv.length === 3 && !allowedParams.includes(process.argv[2])) {
236
+ console.log(`unknown parameter ${process.argv[2]}`);
237
+ console.log('try `node troubleshootingAdapter.js -h` to see allowed parameters. Exiting...');
238
+ process.exit(0);
239
+ }