@unito/integration-cli 0.67.0 → 1.0.1

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.
@@ -1786,10 +1786,11 @@
1786
1786
  }
1787
1787
  },
1788
1788
  "node_modules/flatted": {
1789
- "version": "3.3.1",
1790
- "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz",
1791
- "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==",
1792
- "dev": true
1789
+ "version": "3.4.1",
1790
+ "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.1.tgz",
1791
+ "integrity": "sha512-IxfVbRFVlV8V/yRaGzk0UVIcsKKHMSfYw66T/u4nTwlWteQePsxe//LjudR1AMX4tZW3WFCh3Zqa/sjlqpbURQ==",
1792
+ "dev": true,
1793
+ "license": "ISC"
1793
1794
  },
1794
1795
  "node_modules/form-data": {
1795
1796
  "version": "4.0.4",
@@ -13,7 +13,6 @@ const configuration_1 = require("../resources/configuration");
13
13
  const decryption_1 = require("../resources/decryption");
14
14
  const credentials_1 = require("../resources/credentials");
15
15
  const METHOD_MAP = {
16
- get: 'GET',
17
16
  getItem: 'GET',
18
17
  getCollection: 'GET',
19
18
  createItem: 'POST',
@@ -23,8 +22,8 @@ const METHOD_MAP = {
23
22
  class Graph extends baseCommand_1.BaseCommand {
24
23
  static description = 'Query a running integration graph and print the response';
25
24
  static examples = [
26
- '<%= config.bin %> <%= command.id %> --path=/sobjects/Opportunity/records/abc123',
27
- '<%= config.bin %> <%= command.id %> get --path=/sobjects/Opportunity --port=9201',
25
+ '<%= config.bin %> <%= command.id %> getItem --path=/sobjects/Opportunity/records/abc123',
26
+ '<%= config.bin %> <%= command.id %> getCollection --path=/sobjects/Opportunity --port=9201',
28
27
  `<%= config.bin %> <%= command.id %> createItem --path=/sobjects/Task/records --body='{"Name":"New Task"}'`,
29
28
  '<%= config.bin %> <%= command.id %> updateItem --path=/sobjects/Task/records/abc123 --body=\'{"Name":"Updated"}\'',
30
29
  '<%= config.bin %> <%= command.id %> deleteItem --path=/sobjects/Task/records/abc123',
@@ -33,8 +32,8 @@ class Graph extends baseCommand_1.BaseCommand {
33
32
  operation: core_1.Args.string({
34
33
  description: 'Operation to perform on the graph path',
35
34
  required: false,
36
- default: 'get',
37
- options: ['get', 'getItem', 'getCollection', 'createItem', 'updateItem', 'deleteItem'],
35
+ default: 'getItem',
36
+ options: ['getItem', 'getCollection', 'createItem', 'updateItem', 'deleteItem'],
38
37
  }),
39
38
  };
40
39
  async catch(error) {
@@ -88,6 +88,10 @@ class Test extends baseCommand_1.BaseCommand {
88
88
  allowNo: true,
89
89
  default: false,
90
90
  }),
91
+ port: core_1.Flags.integer({
92
+ description: 'port to run the integration on',
93
+ default: 9200,
94
+ }),
91
95
  };
92
96
  async catch(error) {
93
97
  /* istanbul ignore if */
@@ -159,7 +163,7 @@ class Test extends baseCommand_1.BaseCommand {
159
163
  // Launch the tests.
160
164
  const commandArguments = [
161
165
  `${process.env.NODE_MODULES_FOLDER}/@unito/integration-debugger/dist/src/index.js`,
162
- '--integration-url=http://localhost:9200',
166
+ `--integration-url=http://localhost:${flags.port}`,
163
167
  '--spawn-process=npm run dev',
164
168
  `--credential-payload=${credentialPayload}`,
165
169
  `--secrets-payload=${JSON.stringify(secrets)}`,
@@ -211,7 +215,7 @@ class Test extends baseCommand_1.BaseCommand {
211
215
  const child = child_process_1.default.spawn('node', commandArguments, {
212
216
  detached: true,
213
217
  stdio: 'inherit',
214
- env: { ...process.env, ...environmentVariables, NODE_ENV: 'development', PORT: '9200' },
218
+ env: { ...process.env, ...environmentVariables, NODE_ENV: 'development', PORT: String(flags.port) },
215
219
  });
216
220
  // istanbul ignore next
217
221
  child.on('exit', (code) => {
@@ -143,8 +143,8 @@ describe('graph', () => {
143
143
  json: () => Promise.resolve(MOCK_RESPONSE),
144
144
  }))
145
145
  .stdout()
146
- .command(['graph', 'get', '--path=/sobjects/Opportunity'])
147
- .it('accepts explicit "get" operation arg', ctx => {
146
+ .command(['graph', 'getItem', '--path=/sobjects/Opportunity'])
147
+ .it('accepts explicit "getItem" operation arg', ctx => {
148
148
  (0, test_1.expect)(ctx.stdout).to.contain('"label": "Opportunity"');
149
149
  });
150
150
  test_1.test
@@ -360,8 +360,8 @@ describe('graph', () => {
360
360
  json: () => Promise.resolve(MOCK_RESPONSE),
361
361
  }))
362
362
  .stdout()
363
- .command(['graph', 'get', '--path=/sobjects/Opportunity', '--body={"ignored":true}'])
364
- .it('GET operations ignore --body flag', () => {
363
+ .command(['graph', 'getItem', '--path=/sobjects/Opportunity', '--body={"ignored":true}'])
364
+ .it('getItem operations ignore --body flag', () => {
365
365
  const fetchStub = global.fetch;
366
366
  const [, options] = fetchStub.firstCall.args;
367
367
  (0, test_1.expect)(options.method).to.equal('GET');
@@ -72,6 +72,15 @@ describe('Test', () => {
72
72
  .command(['test'])
73
73
  .exit(-1)
74
74
  .it('handled exception');
75
+ test_1.test
76
+ .stdout()
77
+ .stub(ConfigurationResource, 'getConfiguration', stub => stub.resolves(cliConfiguration))
78
+ .stub(IntegrationResource, 'validateIsIntegrationDirectory', stub => stub.returns(true))
79
+ .command(['test', '--port=9300'])
80
+ .it('custom port', () => {
81
+ (0, test_1.expect)(spawnStub.getCall(0).args.at(1)).to.include('--integration-url=http://localhost:9300');
82
+ (0, test_1.expect)(spawnStub.getCall(0).args.at(2).env.PORT).to.equal('9300');
83
+ });
75
84
  test_1.test
76
85
  .stdout()
77
86
  .stub(ConfigurationResource, 'getConfiguration', stub => stub.resolves(cliConfiguration))
@@ -257,11 +257,10 @@
257
257
  "aliases": [],
258
258
  "args": {
259
259
  "operation": {
260
- "default": "get",
260
+ "default": "getItem",
261
261
  "description": "Operation to perform on the graph path",
262
262
  "name": "operation",
263
263
  "options": [
264
- "get",
265
264
  "getItem",
266
265
  "getCollection",
267
266
  "createItem",
@@ -273,8 +272,8 @@
273
272
  },
274
273
  "description": "Query a running integration graph and print the response",
275
274
  "examples": [
276
- "<%= config.bin %> <%= command.id %> --path=/sobjects/Opportunity/records/abc123",
277
- "<%= config.bin %> <%= command.id %> get --path=/sobjects/Opportunity --port=9201",
275
+ "<%= config.bin %> <%= command.id %> getItem --path=/sobjects/Opportunity/records/abc123",
276
+ "<%= config.bin %> <%= command.id %> getCollection --path=/sobjects/Opportunity --port=9201",
278
277
  "<%= config.bin %> <%= command.id %> createItem --path=/sobjects/Task/records --body='{\"Name\":\"New Task\"}'",
279
278
  "<%= config.bin %> <%= command.id %> updateItem --path=/sobjects/Task/records/abc123 --body='{\"Name\":\"Updated\"}'",
280
279
  "<%= config.bin %> <%= command.id %> deleteItem --path=/sobjects/Task/records/abc123"
@@ -949,6 +948,14 @@
949
948
  "name": "skip-install",
950
949
  "allowNo": true,
951
950
  "type": "boolean"
951
+ },
952
+ "port": {
953
+ "description": "port to run the integration on",
954
+ "name": "port",
955
+ "default": 9200,
956
+ "hasDynamicHelp": false,
957
+ "multiple": false,
958
+ "type": "option"
952
959
  }
953
960
  },
954
961
  "hasDynamicHelp": false,
@@ -1000,5 +1007,5 @@
1000
1007
  ]
1001
1008
  }
1002
1009
  },
1003
- "version": "0.67.0"
1010
+ "version": "1.0.1"
1004
1011
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unito/integration-cli",
3
- "version": "0.67.0",
3
+ "version": "1.0.1",
4
4
  "description": "Integration CLI",
5
5
  "bin": {
6
6
  "integration-cli": "./bin/run"