@unito/integration-cli 0.57.1 → 0.58.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 (115) hide show
  1. package/dist/.eslintrc.d.ts +6 -0
  2. package/dist/.eslintrc.js +9 -2
  3. package/dist/{integrationGenerator/integrationBoilerplate → boilerplate}/src/index.ts +1 -3
  4. package/dist/src/commands/activity.d.ts +2 -2
  5. package/dist/src/commands/activity.js +2 -2
  6. package/dist/src/commands/dev.d.ts +8 -4
  7. package/dist/src/commands/dev.js +42 -5
  8. package/dist/src/commands/encrypt.d.ts +1 -1
  9. package/dist/src/commands/encrypt.js +1 -1
  10. package/dist/src/commands/init.d.ts +1 -1
  11. package/dist/src/commands/init.js +3 -3
  12. package/dist/src/commands/invite.d.ts +1 -1
  13. package/dist/src/commands/invite.js +2 -2
  14. package/dist/src/commands/login.d.ts +1 -1
  15. package/dist/src/commands/login.js +1 -1
  16. package/dist/src/commands/oauth2.d.ts +3 -3
  17. package/dist/src/commands/oauth2.js +19 -14
  18. package/dist/src/commands/publish.d.ts +2 -2
  19. package/dist/src/commands/publish.js +12 -12
  20. package/dist/src/commands/test.js +32 -8
  21. package/dist/src/commands/upgrade.js +3 -3
  22. package/dist/src/errors.d.ts +8 -0
  23. package/dist/src/errors.js +35 -18
  24. package/dist/src/resources/configuration.js +0 -2
  25. package/dist/src/resources/credentials.d.ts +3 -0
  26. package/dist/src/resources/credentials.js +26 -0
  27. package/dist/src/resources/integrations.d.ts +1 -0
  28. package/dist/src/resources/integrations.js +37 -2
  29. package/dist/src/resources/oauth2Helper.d.ts +4 -0
  30. package/dist/src/resources/oauth2Helper.js +30 -0
  31. package/dist/src/services/integrationsPlatform.d.ts +1 -0
  32. package/dist/src/services/integrationsPlatform.js +5 -1
  33. package/dist/src/services/oauth2Helper.d.ts +78 -3
  34. package/dist/src/services/oauth2Helper.js +229 -29
  35. package/dist/test/commands/activity.test.js +12 -9
  36. package/dist/test/commands/dev.test.js +59 -10
  37. package/dist/test/commands/encrypt.test.js +6 -7
  38. package/dist/test/commands/init.test.js +7 -9
  39. package/dist/test/commands/invite.test.js +11 -11
  40. package/dist/test/commands/login.test.js +20 -23
  41. package/dist/test/commands/oauth2.test.js +6 -2
  42. package/dist/test/commands/publish.test.js +152 -218
  43. package/dist/test/commands/test.test.js +65 -13
  44. package/dist/test/commands/upgrade.test.js +4 -6
  45. package/dist/test/errors.test.js +36 -36
  46. package/dist/test/helpers/integrations.d.ts +26 -0
  47. package/dist/test/helpers/integrations.js +25 -0
  48. package/dist/test/helpers/styles.d.ts +1 -0
  49. package/dist/test/helpers/styles.js +8 -0
  50. package/dist/test/oauth2Helper/oauth2Helper.test.js +112 -128
  51. package/dist/test/resources/configuration.test.js +24 -24
  52. package/dist/test/resources/decryption.test.js +9 -9
  53. package/dist/test/resources/globalConfiguration.test.js +4 -4
  54. package/dist/test/resources/integrations.test.js +37 -0
  55. package/dist/test/resources/oauth2Helper.test.js +55 -0
  56. package/dist/test/services/integrationsPlatform.test.js +20 -20
  57. package/oclif.manifest.json +64 -9
  58. package/package.json +10 -14
  59. package/dist/integrationGenerator/errors.d.ts +0 -2
  60. package/dist/integrationGenerator/errors.js +0 -6
  61. package/dist/integrationGenerator/index.d.ts +0 -2
  62. package/dist/integrationGenerator/index.js +0 -5
  63. package/dist/integrationGenerator/integrationBoilerplate/integrationBoilerplate/.dockerignore +0 -3
  64. package/dist/integrationGenerator/integrationBoilerplate/integrationBoilerplate/.eslintrc.js +0 -74
  65. package/dist/integrationGenerator/integrationBoilerplate/integrationBoilerplate/.nvmrc +0 -1
  66. package/dist/integrationGenerator/integrationBoilerplate/integrationBoilerplate/.prettierignore +0 -1
  67. package/dist/integrationGenerator/integrationBoilerplate/integrationBoilerplate/.prettierrc +0 -7
  68. package/dist/integrationGenerator/integrationBoilerplate/integrationBoilerplate/.unito.json +0 -1
  69. package/dist/integrationGenerator/integrationBoilerplate/integrationBoilerplate/Dockerfile +0 -38
  70. package/dist/integrationGenerator/integrationBoilerplate/integrationBoilerplate/README.md +0 -21
  71. package/dist/integrationGenerator/integrationBoilerplate/integrationBoilerplate/src/index.ts +0 -94
  72. package/dist/integrationGenerator/integrationBoilerplate/package.json +0 -43
  73. package/dist/integrationGenerator/integrationBoilerplate/src/logger.ts +0 -55
  74. package/dist/integrationGenerator/integrationBoilerplate/src/middlewares/additionalLoggingContext.ts +0 -22
  75. package/dist/integrationGenerator/integrationBoilerplate/src/middlewares/correlationId.ts +0 -13
  76. package/dist/integrationGenerator/integrationBoilerplate/src/middlewares/credentials.ts +0 -38
  77. package/dist/integrationGenerator/integrationBoilerplate/src/request.ts +0 -59
  78. package/dist/integrationGenerator/integrationBoilerplate/src/routes/index.ts +0 -11
  79. package/dist/integrationGenerator/integrationBoilerplate/src/routes/me.ts +0 -15
  80. package/dist/integrationGenerator/integrationBoilerplate/src/routes/root.ts +0 -12
  81. package/dist/integrationGenerator/integrationBoilerplate/tsconfig.json +0 -37
  82. package/dist/integrationGenerator/src/index.d.ts +0 -1
  83. package/dist/integrationGenerator/src/index.js +0 -5
  84. package/dist/integrationGenerator/src/resources/index.d.ts +0 -1
  85. package/dist/integrationGenerator/src/resources/index.js +0 -5
  86. package/dist/integrationGenerator/src/resources/integration.d.ts +0 -9
  87. package/dist/integrationGenerator/src/resources/integration.js +0 -60
  88. package/dist/integrationGenerator/test/resources/integration.test.js +0 -51
  89. package/dist/src/oauth2Helper/oauth2Helper.d.ts +0 -63
  90. package/dist/src/oauth2Helper/oauth2Helper.js +0 -235
  91. package/dist/src/oauth2Helper/types.d.ts +0 -22
  92. package/dist/src/oauth2Helper/types.js +0 -2
  93. package/dist/test/mocha.hooks.d.ts +0 -2
  94. package/dist/test/mocha.hooks.js +0 -37
  95. package/dist/test/services/oauth2Helper.test.js +0 -85
  96. /package/dist/{integrationGenerator/integrationBoilerplate → boilerplate}/.dockerignore +0 -0
  97. /package/dist/{integrationGenerator/integrationBoilerplate → boilerplate}/.eslintrc.js +0 -0
  98. /package/dist/{integrationGenerator/integrationBoilerplate → boilerplate}/.nvmrc +0 -0
  99. /package/dist/{integrationGenerator/integrationBoilerplate → boilerplate}/.prettierignore +0 -0
  100. /package/dist/{integrationGenerator/integrationBoilerplate → boilerplate}/.prettierrc +0 -0
  101. /package/dist/{integrationGenerator/integrationBoilerplate → boilerplate}/.unito.json +0 -0
  102. /package/dist/{integrationGenerator/integrationBoilerplate → boilerplate}/Dockerfile +0 -0
  103. /package/dist/{integrationGenerator/integrationBoilerplate → boilerplate}/README.md +0 -0
  104. /package/dist/{integrationGenerator/integrationBoilerplate/integrationBoilerplate → boilerplate}/package.json +0 -0
  105. /package/dist/{integrationGenerator/integrationBoilerplate/integrationBoilerplate → boilerplate}/src/logger.ts +0 -0
  106. /package/dist/{integrationGenerator/integrationBoilerplate/integrationBoilerplate → boilerplate}/src/middlewares/additionalLoggingContext.ts +0 -0
  107. /package/dist/{integrationGenerator/integrationBoilerplate/integrationBoilerplate → boilerplate}/src/middlewares/correlationId.ts +0 -0
  108. /package/dist/{integrationGenerator/integrationBoilerplate/integrationBoilerplate → boilerplate}/src/middlewares/credentials.ts +0 -0
  109. /package/dist/{integrationGenerator/integrationBoilerplate/integrationBoilerplate → boilerplate}/src/request.ts +0 -0
  110. /package/dist/{integrationGenerator/integrationBoilerplate/integrationBoilerplate → boilerplate}/src/routes/index.ts +0 -0
  111. /package/dist/{integrationGenerator/integrationBoilerplate/integrationBoilerplate → boilerplate}/src/routes/me.ts +0 -0
  112. /package/dist/{integrationGenerator/integrationBoilerplate/integrationBoilerplate → boilerplate}/src/routes/root.ts +0 -0
  113. /package/dist/{integrationGenerator/integrationBoilerplate/integrationBoilerplate → boilerplate}/tsconfig.json +0 -0
  114. /package/dist/{integrationGenerator/test/resources/integration.test.d.ts → test/resources/integrations.test.d.ts} +0 -0
  115. /package/dist/test/{services → resources}/oauth2Helper.test.d.ts +0 -0
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const chai_1 = require("chai");
4
+ const strict_1 = tslib_1.__importDefault(require("node:assert/strict"));
5
5
  const sinon = tslib_1.__importStar(require("sinon"));
6
6
  const integrations_platform_client_1 = tslib_1.__importDefault(require("@unito/integrations-platform-client"));
7
7
  const IntegrationsPlatform = tslib_1.__importStar(require("../../src/services/integrationsPlatform"));
@@ -44,46 +44,46 @@ describe('integrations platform', function () {
44
44
  sinon.restore();
45
45
  });
46
46
  it('environment', function () {
47
- (0, chai_1.expect)(integrations_platform_client_1.default.defaults.baseUrl).to.equal(integrations_platform_client_1.default.servers.local);
47
+ strict_1.default.equal(integrations_platform_client_1.default.defaults.baseUrl, integrations_platform_client_1.default.servers.local);
48
48
  IntegrationsPlatform.setEnvironment(globalConfiguration_1.Environment.Production);
49
- (0, chai_1.expect)(integrations_platform_client_1.default.defaults.baseUrl).to.equal(integrations_platform_client_1.default.servers.production);
49
+ strict_1.default.equal(integrations_platform_client_1.default.defaults.baseUrl, integrations_platform_client_1.default.servers.production);
50
50
  });
51
51
  it('apiKey', function () {
52
52
  IntegrationsPlatform.setApiKey('foo');
53
- (0, chai_1.expect)(IntegrationsPlatform.getApiKey()).to.equal('foo');
54
- (0, chai_1.expect)(integrations_platform_client_1.default.defaults.headers).to.deep.equal({
53
+ strict_1.default.equal(IntegrationsPlatform.getApiKey(), 'foo');
54
+ strict_1.default.deepEqual(integrations_platform_client_1.default.defaults.headers, {
55
55
  Authorization: 'Bearer foo',
56
56
  });
57
57
  IntegrationsPlatform.setApiKey(undefined);
58
- (0, chai_1.expect)(IntegrationsPlatform.getApiKey()).to.equal(undefined);
59
- (0, chai_1.expect)(integrations_platform_client_1.default.defaults.headers).to.be.deep.equal({});
58
+ strict_1.default.equal(IntegrationsPlatform.getApiKey(), undefined);
59
+ strict_1.default.deepEqual(integrations_platform_client_1.default.defaults.headers, {});
60
60
  });
61
61
  it('getProfile', async function () {
62
62
  sinon.stub(integrations_platform_client_1.default, 'getProfile').resolves(user);
63
- (0, chai_1.expect)(await IntegrationsPlatform.getProfile()).to.deep.equal(user);
63
+ strict_1.default.deepEqual(await IntegrationsPlatform.getProfile(), user);
64
64
  });
65
65
  it('getIntegration', async function () {
66
66
  sinon.stub(integrations_platform_client_1.default, 'getIntegrationById').resolves(integration);
67
- (0, chai_1.expect)(await IntegrationsPlatform.getIntegration(1)).to.deep.equal(integration);
67
+ strict_1.default.deepEqual(await IntegrationsPlatform.getIntegration(1), integration);
68
68
  });
69
69
  it('getIntegrationByName', async function () {
70
70
  sinon.stub(integrations_platform_client_1.default, 'getIntegrationByName').resolves(integration);
71
- (0, chai_1.expect)(await IntegrationsPlatform.getIntegrationByName('foo')).to.deep.equal(integration);
71
+ strict_1.default.deepEqual(await IntegrationsPlatform.getIntegrationByName('foo'), integration);
72
72
  });
73
73
  it('getIntegrations', async function () {
74
74
  sinon.stub(integrations_platform_client_1.default, 'getIntegrations').resolves({ total: 1, data: [integrationSummary] });
75
- (0, chai_1.expect)(await IntegrationsPlatform.getIntegrations()).to.deep.equal([integrationSummary]);
75
+ strict_1.default.deepEqual(await IntegrationsPlatform.getIntegrations(), [integrationSummary]);
76
76
  });
77
77
  it('createIntegration', async function () {
78
78
  sinon.stub(integrations_platform_client_1.default, 'createIntegration').resolves(integration);
79
79
  sinon.stub(integrations_platform_client_1.default, 'getIntegrationById').resolves(integration);
80
80
  sinon.stub(integrations_platform_client_1.default, 'updateIntegration').resolves(integration);
81
- (0, chai_1.expect)(await IntegrationsPlatform.createIntegration({ name: 'foo' })).to.deep.equal(integration);
81
+ strict_1.default.deepEqual(await IntegrationsPlatform.createIntegration({ name: 'foo' }), integration);
82
82
  });
83
83
  it('updateIntegration', async function () {
84
84
  sinon.stub(integrations_platform_client_1.default, 'getIntegrationById').resolves(integration);
85
85
  sinon.stub(integrations_platform_client_1.default, 'updateIntegration').resolves(integration);
86
- (0, chai_1.expect)(await IntegrationsPlatform.updateIntegration(1, { name: 'foo' })).to.deep.equal(integration);
86
+ strict_1.default.deepEqual(await IntegrationsPlatform.updateIntegration(1, { name: 'foo' }), integration);
87
87
  });
88
88
  it('updateIntegration - create / archive authorization', async function () {
89
89
  sinon.stub(integrations_platform_client_1.default, 'getIntegrationById').resolves({
@@ -103,10 +103,10 @@ describe('integrations platform', function () {
103
103
  ],
104
104
  });
105
105
  sinon.stub(integrations_platform_client_1.default, 'updateIntegration').resolves(integration);
106
- (0, chai_1.expect)(await IntegrationsPlatform.updateIntegration(1, {
106
+ strict_1.default.deepEqual(await IntegrationsPlatform.updateIntegration(1, {
107
107
  name: 'foo',
108
108
  authorizations: [{ name: 'bar', method: configurationTypes_1.Method.CUSTOM }],
109
- })).to.deep.equal(integration);
109
+ }), integration);
110
110
  });
111
111
  it('updateIntegration - update authorization', async function () {
112
112
  sinon.stub(integrations_platform_client_1.default, 'getIntegrationById').resolves({
@@ -126,11 +126,11 @@ describe('integrations platform', function () {
126
126
  ],
127
127
  });
128
128
  sinon.stub(integrations_platform_client_1.default, 'updateIntegration').resolves(integration);
129
- (0, chai_1.expect)(await IntegrationsPlatform.updateIntegration(1, { name: 'foo' })).to.deep.equal(integration);
130
- (0, chai_1.expect)(await IntegrationsPlatform.updateIntegration(1, {
129
+ strict_1.default.deepEqual(await IntegrationsPlatform.updateIntegration(1, { name: 'foo' }), integration);
130
+ strict_1.default.deepEqual(await IntegrationsPlatform.updateIntegration(1, {
131
131
  name: 'foo',
132
132
  authorizations: [{ name: 'bar', method: configurationTypes_1.Method.CUSTOM }],
133
- })).to.deep.equal(integration);
133
+ }), integration);
134
134
  });
135
135
  it('updateIntegration - update secrets', async function () {
136
136
  sinon.stub(integrations_platform_client_1.default, 'getIntegrationById').resolves({ ...integration });
@@ -143,7 +143,7 @@ describe('integrations platform', function () {
143
143
  },
144
144
  };
145
145
  await IntegrationsPlatform.updateIntegration(integrationId, configuration);
146
- (0, chai_1.expect)(mockUpdateIntegration.getCall(0).args.at(1)).to.deep.equal({
146
+ strict_1.default.deepEqual(mockUpdateIntegration.getCall(0).args.at(1), {
147
147
  ui: undefined,
148
148
  authorizations: [],
149
149
  baseUrl: undefined,
@@ -157,7 +157,7 @@ describe('integrations platform', function () {
157
157
  });
158
158
  it('encryptData', async function () {
159
159
  sinon.stub(integrations_platform_client_1.default, 'encryptData').resolves({ encryptedData: 'encryptedFoo' });
160
- (0, chai_1.expect)(await IntegrationsPlatform.encryptData('mySuperIntegration', 'foo')).to.deep.equal({
160
+ strict_1.default.deepEqual(await IntegrationsPlatform.encryptData('mySuperIntegration', 'foo'), {
161
161
  encryptedData: 'encryptedFoo',
162
162
  });
163
163
  });
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.57.1",
2
+ "version": "0.58.0",
3
3
  "commands": {
4
4
  "activity": {
5
5
  "id": "activity",
@@ -74,6 +74,41 @@
74
74
  "description": "output more (debug) information",
75
75
  "allowNo": false
76
76
  },
77
+ "credential-payload": {
78
+ "name": "credential-payload",
79
+ "type": "option",
80
+ "description": "(advanced) credential payload to use.",
81
+ "multiple": false,
82
+ "exclusive": [
83
+ "credential-id"
84
+ ]
85
+ },
86
+ "credential-id": {
87
+ "name": "credential-id",
88
+ "type": "option",
89
+ "description": "(advanced) credential to use.",
90
+ "multiple": false,
91
+ "exclusive": [
92
+ "credential-payload"
93
+ ]
94
+ },
95
+ "test-account": {
96
+ "name": "test-account",
97
+ "type": "option",
98
+ "description": "test account to use.",
99
+ "multiple": false,
100
+ "options": [
101
+ "development",
102
+ "compliance"
103
+ ],
104
+ "default": "development"
105
+ },
106
+ "read-only": {
107
+ "name": "read-only",
108
+ "type": "boolean",
109
+ "description": "whether or not to only perform read operations",
110
+ "allowNo": true
111
+ },
77
112
  "crawlMode": {
78
113
  "name": "crawlMode",
79
114
  "type": "option",
@@ -209,15 +244,16 @@
209
244
  },
210
245
  "oauth2": {
211
246
  "id": "oauth2",
212
- "summary": "Perform an OAuth2 workflow locally",
213
- "description": "The Oauth2 command allows you to perform an OAuth2 workflow locally, either to create a new test account or to refresh an existing one.",
247
+ "summary": "Perform an OAuth2 workflow to either populate or refresh a test account's credentials.",
248
+ "description": "The Oauth2 command allows you to perform an OAuth2 workflow to populate the specified test account's accessToken and refreshToken to be used by the 'test' and 'dev' commands.\n\n If the test-account is already populated, the command will refresh the credentials if the refresh token is available.\n If you want to force a new OAuth2 flow to change the connected account or something else, use the --reauth flag.",
214
249
  "strict": true,
215
250
  "pluginName": "@unito/integration-cli",
216
251
  "pluginAlias": "@unito/integration-cli",
217
252
  "pluginType": "core",
218
253
  "aliases": [],
219
254
  "examples": [
220
- "<%= config.bin %> <%= command.id %>"
255
+ "<%= config.bin %> <%= command.id %>",
256
+ "<%= config.bin %> <%= command.id %> --reauth --test-account=compliance"
221
257
  ],
222
258
  "flags": {
223
259
  "test-account": {
@@ -235,6 +271,7 @@
235
271
  "name": "environment",
236
272
  "type": "option",
237
273
  "description": "the environment of the platform",
274
+ "hidden": true,
238
275
  "multiple": false,
239
276
  "options": [
240
277
  "local",
@@ -246,7 +283,7 @@
246
283
  "reauth": {
247
284
  "name": "reauth",
248
285
  "type": "boolean",
249
- "description": "triggers a new oauth2 flow to collect credentials and overwrite the current one",
286
+ "description": "triggers a new oauth2 flow to overwrite the test account's current credentials",
250
287
  "allowNo": false
251
288
  },
252
289
  "config-path": {
@@ -394,13 +431,25 @@
394
431
  "credential-payload": {
395
432
  "name": "credential-payload",
396
433
  "type": "option",
434
+ "description": "(advanced) credential payload to use.",
435
+ "multiple": false,
436
+ "exclusive": [
437
+ "credential-id"
438
+ ]
439
+ },
440
+ "credential-id": {
441
+ "name": "credential-id",
442
+ "type": "option",
397
443
  "description": "(advanced) credential to use.",
398
- "multiple": false
444
+ "multiple": false,
445
+ "exclusive": [
446
+ "credential-payload"
447
+ ]
399
448
  },
400
449
  "test-account": {
401
450
  "name": "test-account",
402
451
  "type": "option",
403
- "description": "Test account to use.",
452
+ "description": "test account to use.",
404
453
  "multiple": false,
405
454
  "options": [
406
455
  "development",
@@ -408,6 +457,12 @@
408
457
  ],
409
458
  "default": "development"
410
459
  },
460
+ "read-only": {
461
+ "name": "read-only",
462
+ "type": "boolean",
463
+ "description": "whether or not to only perform read operations",
464
+ "allowNo": true
465
+ },
411
466
  "crawlMode": {
412
467
  "name": "crawlMode",
413
468
  "type": "option",
@@ -430,7 +485,7 @@
430
485
  "debug": {
431
486
  "name": "debug",
432
487
  "type": "boolean",
433
- "description": "Log launch command to console before running it - including decrypted values - for debugging only",
488
+ "description": "log launch command to console before running it - including decrypted values - for debugging only",
434
489
  "hidden": true,
435
490
  "allowNo": false
436
491
  },
@@ -438,7 +493,7 @@
438
493
  "name": "config-path",
439
494
  "type": "option",
440
495
  "summary": "relative path to a custom \".unito.json\" file",
441
- "description": "Use a custom configuration file instead of the default '.unito.json' or other environment specific\n ones.\n\n If you want to force the CLI to use a specific configuration file, you can use this flag to specify the relative\n path from your integration's root folder (with a leading '/').\n\n Usage: <%= config.bin %> <%= command.id %> --config-path=/myCustomConfig.json",
496
+ "description": "use a custom configuration file instead of the default '.unito.json' or other environment specific\n ones.\n\n If you want to force the CLI to use a specific configuration file, you can use this flag to specify the relative\n path from your integration's root folder (with a leading '/').\n\n Usage: <%= config.bin %> <%= command.id %> --config-path=/myCustomConfig.json",
442
497
  "multiple": false
443
498
  }
444
499
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unito/integration-cli",
3
- "version": "0.57.1",
3
+ "version": "0.58.0",
4
4
  "description": "Integration CLI",
5
5
  "bin": {
6
6
  "integration-cli": "./bin/run"
@@ -13,18 +13,18 @@
13
13
  "email": "hello@unito.io"
14
14
  },
15
15
  "engines": {
16
- "node": ">=18.0.0"
16
+ "node": ">=20.0.0"
17
17
  },
18
18
  "scripts": {
19
19
  "prepublishOnly": "npm run lint && npm run test",
20
20
  "prepack": "oclif manifest",
21
21
  "postpack": "shx rm -f oclif.manifest.json",
22
22
  "prepare": "npm run compile",
23
- "lint": "eslint --fix src test scripts integrationGenerator/src integrationGenerator/test --ext .ts && prettier --write src test scripts integrationGenerator/src integrationGenerator/test",
24
- "compile": "ts-node scripts/generateTypes.ts > src/configurationTypes.ts && tsc -b && mkdir -p dist/schemas && cp schemas/*.json dist/schemas/ && cp -r integrationGenerator/integrationBoilerplate ./dist/integrationGenerator/integrationBoilerplate",
23
+ "lint": "eslint --fix src test scripts --ext .ts && prettier --write src test scripts",
24
+ "compile": "rm -rf dist && ts-node scripts/generateTypes.ts > src/configurationTypes.ts && tsc -b && mkdir -p dist/schemas && cp schemas/*.json dist/schemas/ && cp -r boilerplate ./dist/boilerplate",
25
25
  "compile:watch": "tsc --build -w",
26
- "test": "mocha $(find test -name '*.test.ts') $(find integrationGenerator/test -name '*.test.ts')",
27
- "test:debug": "mocha test/**/*.test.ts integrationGenerator/test/**/*.test.ts --inspect-brk",
26
+ "test": "mocha \"test/**/*.test.ts\"",
27
+ "test:debug": "mocha --inspect-brk \"test/**/*.test.ts\"",
28
28
  "ci:test": "c8 npm run test"
29
29
  },
30
30
  "files": [
@@ -35,10 +35,10 @@
35
35
  "!/bin/dev*"
36
36
  ],
37
37
  "dependencies": {
38
- "@oclif/core": "2.x",
38
+ "@oclif/core": "3.x",
39
39
  "@typescript-eslint/eslint-plugin": "6.x",
40
40
  "@typescript-eslint/parser": "6.13.x",
41
- "@unito/integration-debugger": "0.23.0",
41
+ "@unito/integration-debugger": "0.24.0",
42
42
  "@unito/integrations-platform-client": "0.46.1",
43
43
  "ajv": "8.x",
44
44
  "ajv-formats": "2.x",
@@ -56,20 +56,16 @@
56
56
  "tmp": "0.x"
57
57
  },
58
58
  "devDependencies": {
59
- "@oclif/test": "2.x",
60
- "@types/chai": "4.x",
61
- "@types/chai-as-promised": "7.x",
59
+ "@oclif/test": "3.x",
62
60
  "@types/cors": "2.x",
63
61
  "@types/express": "4.x",
64
62
  "@types/gradient-string": "1.x",
65
63
  "@types/inquirer": "9.x",
66
64
  "@types/mocha": "10.x",
67
- "@types/node": "18.x",
65
+ "@types/node": "20.x",
68
66
  "@types/openurl": "1.x",
69
67
  "@types/tmp": "0.x",
70
68
  "c8": "9.x",
71
- "chai": "4.x",
72
- "chai-as-promised": "7.x",
73
69
  "json-schema-to-typescript": "13.x",
74
70
  "mocha": "10.x",
75
71
  "oclif": "3.x",
@@ -1,2 +0,0 @@
1
- export declare class AlreadyExistingIntegrationError extends Error {
2
- }
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AlreadyExistingIntegrationError = void 0;
4
- class AlreadyExistingIntegrationError extends Error {
5
- }
6
- exports.AlreadyExistingIntegrationError = AlreadyExistingIntegrationError;
@@ -1,2 +0,0 @@
1
- export * from './src';
2
- export * from './errors';
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./src"), exports);
5
- tslib_1.__exportStar(require("./errors"), exports);
@@ -1,74 +0,0 @@
1
- module.exports = {
2
- 'env': {
3
- 'browser': true,
4
- 'es6': true,
5
- 'node': true
6
- },
7
- 'parser': '@typescript-eslint/parser',
8
- 'parserOptions': {
9
- 'project': './tsconfig.json',
10
- },
11
- 'plugins': [
12
- '@typescript-eslint'
13
- ],
14
- extends: [
15
- 'eslint:recommended',
16
- 'plugin:@typescript-eslint/recommended',
17
- ],
18
- ignorePatterns: [
19
- 'node_modules',
20
- 'dist',
21
- '.eslintrc.js'
22
- ],
23
- 'rules': {
24
- '@typescript-eslint/no-loss-of-precision': 0,
25
- '@typescript-eslint/no-explicit-any': 0,
26
- '@typescript-eslint/ban-ts-comment': 0,
27
- '@typescript-eslint/ban-ts-ignore': 0,
28
- '@typescript-eslint/explicit-module-boundary-types': 0,
29
- '@typescript-eslint/no-var-requires': 0,
30
- '@typescript-eslint/no-floating-promises': 2,
31
- '@typescript-eslint/no-unused-vars': 0,
32
- // We need null in connectors because in some API, adding null to a field makes the API remove the value to the field
33
- '@typescript-eslint/no-non-null-assertion': 0,
34
- '@typescript-eslint/prefer-namespace-keyword': 0,
35
- '@typescript-eslint/no-namespace': 0,
36
- '@typescript-eslint/no-inferrable-types': 0,
37
- '@typescript-eslint/naming-convention': [
38
- 1,
39
- {
40
- selector: [
41
- 'classProperty',
42
- 'objectLiteralProperty',
43
- 'typeProperty',
44
- 'classMethod',
45
- 'objectLiteralMethod',
46
- 'typeMethod',
47
- 'accessor',
48
- 'enumMember'
49
- ],
50
- format: null,
51
- modifiers: ['requiresQuotes']
52
- }
53
- ],
54
- 'no-whitespace-before-property': 2,
55
- 'no-trailing-spaces': 2,
56
- 'no-extra-boolean-cast': 0,
57
- 'no-inner-declarations': 0,
58
- 'no-useless-escape': 0,
59
- 'no-case-declarations': 0,
60
- 'space-unary-ops': [2,
61
- {
62
- 'words': true,
63
- 'nonwords': false,
64
- },
65
- ],
66
- 'space-before-function-paren': [2, {
67
- 'anonymous': 'always',
68
- 'named': 'never',
69
- 'asyncArrow': 'always'
70
- }],
71
- 'object-curly-spacing': [2, 'always'],
72
- 'no-console': 2,
73
- }
74
- };
@@ -1,7 +0,0 @@
1
- {
2
- "semi": true,
3
- "trailingComma": "all",
4
- "singleQuote": true,
5
- "printWidth": 180,
6
- "arrowParens": "avoid"
7
- }
@@ -1,38 +0,0 @@
1
- # syntax = docker/dockerfile:1.2
2
-
3
- #
4
- # Build
5
- #
6
-
7
- FROM --platform=$BUILDPLATFORM public.ecr.aws/docker/library/node:20-alpine as build
8
-
9
- WORKDIR /build
10
-
11
- COPY . .
12
-
13
- RUN --mount=type=secret,id=npmrc,target=.npmrc npm ci
14
-
15
- RUN npm install
16
- RUN npm run compile
17
-
18
- #
19
- # Runtime
20
- #
21
-
22
- FROM --platform=$TARGETPLATFORM public.ecr.aws/docker/library/node:20-alpine as runtime
23
-
24
- WORKDIR /app
25
-
26
- COPY --from=build \
27
- /build/tsconfig.json \
28
- /build/package.json \
29
- /build/package-lock.json \
30
- /build/dist \
31
- .
32
-
33
- RUN --mount=type=secret,id=npmrc,target=.npmrc npm ci --omit=dev
34
-
35
- RUN npm install --omit=dev
36
-
37
- ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
38
- CMD ["node", "./src/index.js"]
@@ -1,21 +0,0 @@
1
- # Integration Boilerplate
2
-
3
- Integration Boilerplate is a codebase for providing a uniform way to integrate new connector.
4
-
5
- ## Build Docker image locally
6
-
7
- ```sh
8
- cd integration-boilerplate
9
- docker build -t integration-boilerplate .
10
- ```
11
-
12
- Run the docker image
13
- ```sh
14
- docker run --name mytest1 -d -p 9200:9200 integration-boilerplate
15
- ```
16
-
17
- Accessible on http://localhost:9200
18
-
19
- ## License
20
-
21
- Copyright © 2015-present Unito Inc. All Rights Reserved.
@@ -1,94 +0,0 @@
1
- import express from 'express';
2
- import { Error as APIError } from '@unito/integration-api';
3
-
4
- import indexRouter from './routes/index';
5
- import { extractCredentials } from './middlewares/credentials';
6
- import { extractCorrelationId } from './middlewares/correlationId';
7
- import { extractAdditionalLoggingContext } from './middlewares/additionalLoggingContext';
8
- import { logger } from './logger';
9
-
10
- // Express Server initialization
11
- const app: express.Application = express();
12
-
13
- // Parse query strings with https://github.com/ljharb/qs.
14
- app.set('query parser', 'extended');
15
-
16
- app.use(express.json());
17
-
18
- // Must be one of the first handlers (to catch all the errors).
19
- app.use((req: express.Request, res: express.Response, next: express.NextFunction) => {
20
- if (req.originalUrl !== '/health') {
21
- res.on('finish', function () {
22
- const loggerLevel = res.statusCode >= 500 ? 'error' : 'info';
23
-
24
- // eslint-disable-next-line
25
- logger[loggerLevel](`${req.method} ${req.originalUrl} ${res.statusCode}`);
26
- });
27
- }
28
-
29
- next();
30
- });
31
-
32
- // Extract and validate the credentials.
33
- app.use(extractCredentials);
34
-
35
- // Extract the correlation id.
36
- app.use(extractCorrelationId);
37
-
38
- // Load the routes.
39
- app.use('/', indexRouter);
40
-
41
- // Extract the additional logging context.
42
- app.use(extractAdditionalLoggingContext);
43
-
44
- // Must be the (last - 1) handler.
45
- app.use((err: Error, _req: express.Request, res: express.Response, next: express.NextFunction) => {
46
- if (res.headersSent) {
47
- return next(err);
48
- }
49
-
50
- const originalError: APIError = {
51
- code: err.name,
52
- message: err.message,
53
- };
54
-
55
- res.status(500).json({
56
- code: '500',
57
- message: 'Oops! Something went wrong',
58
- originalError: originalError,
59
- } as APIError);
60
- });
61
-
62
- // Must be the last handler.
63
- app.use((req: express.Request, res: express.Response, _next: express.NextFunction) => {
64
- const error: APIError = {
65
- code: '404',
66
- message: `Path ${req.path} not found.`,
67
- };
68
-
69
- res.status(404).json(error);
70
- });
71
-
72
- // eslint-disable-next-line
73
- const instance = app.listen(process.env.PORT || 9200, () =>
74
- console.log(`Server started on port ${process.env.PORT || 9200}.`),
75
- );
76
-
77
- // Trap exit signals.
78
- ['SIGTERM', 'SIGINT', 'SIGUSR2'].forEach(signalType => {
79
- process.once(signalType, async () => {
80
- // eslint-disable-next-line
81
- console.log(`Received termination signal ${signalType}. Exiting.`);
82
-
83
- try {
84
- if (instance) {
85
- instance.close();
86
- }
87
- } catch (e) {
88
- // eslint-disable-next-line
89
- console.error('Failed to gracefully exit', e);
90
- }
91
-
92
- process.exit();
93
- });
94
- });
@@ -1,43 +0,0 @@
1
- {
2
- "name": "integration-boilerplate",
3
- "version": "0.0.1",
4
- "description": "Integration Boilerplate",
5
- "scripts": {
6
- "compile": "tsc",
7
- "dev": "nodemon --watch \"src/**\" --ext ts --exec \"node --inspect --no-lazy -r ts-node/register/transpile-only src/index.ts\"",
8
- "lint": "eslint --resolve-plugins-relative-to . --fix src --ext .ts && prettier --write src",
9
- "ci:audit": "check-audit",
10
- "ci:eslint": "eslint --resolve-plugins-relative-to . src --ext .ts",
11
- "ci:lint": "npm run ci:prettier && npm run ci:eslint || (echo \"Please run eslint and/or prettier and commit the changes\" && exit 1)",
12
- "ci:prettier": "prettier --cache --ignore-unknown --check src",
13
- "ci:test": "NODE_ENV=test mocha"
14
- },
15
- "author": {
16
- "name": "Unito",
17
- "email": "hello@unito.io"
18
- },
19
- "engines": {
20
- "node": ">=20.0.0"
21
- },
22
- "license": "LicenseRef-LICENSE",
23
- "dependencies": {
24
- "@unito/integration-api": "^0.x",
25
- "express": "^5.0.0-beta.1",
26
- "uuid": "9.x"
27
- },
28
- "devDependencies": {
29
- "@types/express": "4.x",
30
- "@types/mocha": "10.x",
31
- "@types/node": "20.x",
32
- "@types/uuid": "9.x",
33
- "@typescript-eslint/eslint-plugin": "5.x",
34
- "@typescript-eslint/parser": "5.x",
35
- "eslint": "8.x",
36
- "mocha": "10.x",
37
- "nodemon": "2.x",
38
- "npm-audit-resolver": "^3.0.0-RC.0",
39
- "prettier": "2.x",
40
- "ts-node": "10.x",
41
- "typescript": "5.x"
42
- }
43
- }