@unito/integration-cli 0.62.13 → 0.63.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.
package/dist/src/commands/dev.js
CHANGED
|
@@ -97,7 +97,11 @@ class Dev extends baseCommand_1.BaseCommand {
|
|
|
97
97
|
let readOnly = flags['read-only'] ?? false;
|
|
98
98
|
if (flags['credential-id']) {
|
|
99
99
|
const credential = await (0, credentials_1.fetchCredential)(environment, this.config.configDir, flags['credential-id']);
|
|
100
|
-
credentialPayload = JSON.stringify(
|
|
100
|
+
credentialPayload = JSON.stringify({
|
|
101
|
+
...credential.payload,
|
|
102
|
+
unitoCredentialId: credential.id,
|
|
103
|
+
unitoUserId: credential.unitoUserId,
|
|
104
|
+
});
|
|
101
105
|
// When "credential-id" is provided, the default value of "read-only" is false.
|
|
102
106
|
readOnly = flags['read-only'] ?? true;
|
|
103
107
|
}
|
|
@@ -111,7 +115,11 @@ class Dev extends baseCommand_1.BaseCommand {
|
|
|
111
115
|
if (decryptedEntries.failed.length) {
|
|
112
116
|
throw new errors_1.EntryDecryptionError(decryptedEntries.failed.at(0), environment);
|
|
113
117
|
}
|
|
114
|
-
credentialPayload = JSON.stringify(
|
|
118
|
+
credentialPayload = JSON.stringify({
|
|
119
|
+
...decryptedEntries.successful,
|
|
120
|
+
unitoCredentialId: flags['test-account'],
|
|
121
|
+
unitoUserId: flags['test-account'],
|
|
122
|
+
});
|
|
115
123
|
}
|
|
116
124
|
}
|
|
117
125
|
// Load secrets.
|
|
@@ -115,7 +115,11 @@ class Test extends baseCommand_1.BaseCommand {
|
|
|
115
115
|
let readOnly = flags['read-only'] ?? false;
|
|
116
116
|
if (flags['credential-id']) {
|
|
117
117
|
const credential = await (0, credentials_1.fetchCredential)(environment, this.config.configDir, flags['credential-id']);
|
|
118
|
-
credentialPayload = JSON.stringify(
|
|
118
|
+
credentialPayload = JSON.stringify({
|
|
119
|
+
...credential.payload,
|
|
120
|
+
unitoCredentialId: credential.id,
|
|
121
|
+
unitoUserId: credential.unitoUserId,
|
|
122
|
+
});
|
|
119
123
|
// When "credential-id" is provided, the default value of "read-only" is false.
|
|
120
124
|
readOnly = flags['read-only'] ?? true;
|
|
121
125
|
}
|
|
@@ -129,7 +133,11 @@ class Test extends baseCommand_1.BaseCommand {
|
|
|
129
133
|
if (decryptedEntries.failed.length) {
|
|
130
134
|
throw new errors_1.EntryDecryptionError(decryptedEntries.failed.at(0), environment);
|
|
131
135
|
}
|
|
132
|
-
credentialPayload = JSON.stringify(
|
|
136
|
+
credentialPayload = JSON.stringify({
|
|
137
|
+
...decryptedEntries.successful,
|
|
138
|
+
unitoCredentialId: flags['test-account'],
|
|
139
|
+
unitoUserId: flags['test-account'],
|
|
140
|
+
});
|
|
133
141
|
}
|
|
134
142
|
}
|
|
135
143
|
// Load secrets.
|
|
@@ -190,7 +198,7 @@ class Test extends baseCommand_1.BaseCommand {
|
|
|
190
198
|
commandArguments.push(`--output-path=${flags['output-path']}`);
|
|
191
199
|
}
|
|
192
200
|
if (flags['crawlMode'] === configuration_1.CrawlMode.SAMPLE) {
|
|
193
|
-
commandArguments.push('--operation-collection-items-per-page=
|
|
201
|
+
commandArguments.push('--operation-collection-items-per-page=5');
|
|
194
202
|
commandArguments.push('--operation-collection-follow-next-pages=false');
|
|
195
203
|
}
|
|
196
204
|
if (flags['crawlMode'] === configuration_1.CrawlMode.SINGLE) {
|
|
@@ -62,7 +62,7 @@ describe('Dev', () => {
|
|
|
62
62
|
.stub(ConfigurationResource, 'getConfiguration', stub => stub.returns(cliConfiguration))
|
|
63
63
|
.command(['dev'])
|
|
64
64
|
.it('decrypts credentials', () => {
|
|
65
|
-
(0, test_1.expect)(spawnStub.getCall(0).args.at(1)).to.include('--credential-payload={"key":"value","encryptedToken":"decrypted-me"}');
|
|
65
|
+
(0, test_1.expect)(spawnStub.getCall(0).args.at(1)).to.include('--credential-payload={"key":"value","encryptedToken":"decrypted-me","unitoCredentialId":"development","unitoUserId":"development"}');
|
|
66
66
|
});
|
|
67
67
|
test_1.test
|
|
68
68
|
.stdout()
|
|
@@ -171,27 +171,27 @@ describe('Dev', () => {
|
|
|
171
171
|
.stdout()
|
|
172
172
|
.stub(ConfigurationResource, 'getConfiguration', stub => stub.returns({}))
|
|
173
173
|
.stub(IntegrationResource, 'validateIsIntegrationDirectory', stub => stub.returns(true))
|
|
174
|
-
.stub(CredentialResource, 'fetchCredential', stub => stub.resolves({ payload: { from: 'credential' } }))
|
|
174
|
+
.stub(CredentialResource, 'fetchCredential', stub => stub.resolves({ payload: { from: 'credential' }, id: '123', unitoUserId: '456' }))
|
|
175
175
|
.command(['dev', '--credential-id=123'])
|
|
176
176
|
.it('credential-id', () => {
|
|
177
|
-
(0, test_1.expect)(spawnStub.getCall(0).args.at(1)).to.include('--credential-payload={"from":"credential"}');
|
|
177
|
+
(0, test_1.expect)(spawnStub.getCall(0).args.at(1)).to.include('--credential-payload={"from":"credential","unitoCredentialId":"123","unitoUserId":"456"}');
|
|
178
178
|
(0, test_1.expect)(spawnStub.getCall(0).args.at(1)).to.include('--read-only');
|
|
179
179
|
});
|
|
180
180
|
test_1.test
|
|
181
181
|
.stdout()
|
|
182
182
|
.stub(ConfigurationResource, 'getConfiguration', stub => stub.returns({}))
|
|
183
183
|
.stub(IntegrationResource, 'validateIsIntegrationDirectory', stub => stub.returns(true))
|
|
184
|
-
.stub(CredentialResource, 'fetchCredential', stub => stub.resolves({ payload: { from: 'credential' } }))
|
|
184
|
+
.stub(CredentialResource, 'fetchCredential', stub => stub.resolves({ payload: { from: 'credential' }, id: '123', unitoUserId: '456' }))
|
|
185
185
|
.command(['dev', '--credential-id=123', '--no-read-only'])
|
|
186
186
|
.it('credential-id && read-only', () => {
|
|
187
|
-
(0, test_1.expect)(spawnStub.getCall(0).args.at(1)).to.include('--credential-payload={"from":"credential"}');
|
|
187
|
+
(0, test_1.expect)(spawnStub.getCall(0).args.at(1)).to.include('--credential-payload={"from":"credential","unitoCredentialId":"123","unitoUserId":"456"}');
|
|
188
188
|
(0, test_1.expect)(spawnStub.getCall(0).args.at(1)).to.not.include('--read-only');
|
|
189
189
|
});
|
|
190
190
|
test_1.test
|
|
191
191
|
.stdout()
|
|
192
192
|
.stub(ConfigurationResource, 'getConfiguration', stub => stub.resolves(cliConfiguration))
|
|
193
193
|
.stub(IntegrationResource, 'validateIsIntegrationDirectory', stub => stub.returns(true))
|
|
194
|
-
.stub(CredentialResource, 'fetchCredential', stub => stub.resolves({ payload: { from: 'credential' } }))
|
|
194
|
+
.stub(CredentialResource, 'fetchCredential', stub => stub.resolves({ payload: { from: 'credential' }, id: '123', unitoUserId: '456' }))
|
|
195
195
|
.stub(DecryptionResource, 'decryptEntries', stub => stub
|
|
196
196
|
.onFirstCall()
|
|
197
197
|
.resolves({ successful: {}, failed: [] })
|
|
@@ -209,7 +209,7 @@ describe('Dev', () => {
|
|
|
209
209
|
.stdout()
|
|
210
210
|
.stub(ConfigurationResource, 'getConfiguration', stub => stub.resolves(cliConfiguration))
|
|
211
211
|
.stub(IntegrationResource, 'validateIsIntegrationDirectory', stub => stub.returns(true))
|
|
212
|
-
.stub(CredentialResource, 'fetchCredential', stub => stub.resolves({ payload: { from: 'credential' } }))
|
|
212
|
+
.stub(CredentialResource, 'fetchCredential', stub => stub.resolves({ payload: { from: 'credential' }, unitoCredentialId: '123', unitoUserId: '456' }))
|
|
213
213
|
.stub(DecryptionResource, 'decryptEntries', stub => stub
|
|
214
214
|
.onFirstCall()
|
|
215
215
|
.resolves({ successful: {}, failed: [] })
|
|
@@ -94,7 +94,7 @@ describe('Test', () => {
|
|
|
94
94
|
.stub(IntegrationResource, 'validateIsIntegrationDirectory', stub => stub.returns(true))
|
|
95
95
|
.command(['test'])
|
|
96
96
|
.it('defaults to test account when no flag is provided', () => {
|
|
97
|
-
(0, test_1.expect)(spawnStub.getCall(0).args.at(1)).to.include('--credential-payload={"accessToken":"developmentToken"}');
|
|
97
|
+
(0, test_1.expect)(spawnStub.getCall(0).args.at(1)).to.include('--credential-payload={"accessToken":"developmentToken","unitoCredentialId":"development","unitoUserId":"development"}');
|
|
98
98
|
});
|
|
99
99
|
test_1.test
|
|
100
100
|
.stdout()
|
|
@@ -102,7 +102,7 @@ describe('Test', () => {
|
|
|
102
102
|
.stub(IntegrationResource, 'validateIsIntegrationDirectory', stub => stub.returns(true))
|
|
103
103
|
.command(['test', '--test-account', 'compliance'])
|
|
104
104
|
.it('uses compliance credentials when a flag is provided', () => {
|
|
105
|
-
(0, test_1.expect)(spawnStub.getCall(0).args.at(1)).to.include('--credential-payload={"accessToken":"token","encryptedToken":"decrypted-me"}');
|
|
105
|
+
(0, test_1.expect)(spawnStub.getCall(0).args.at(1)).to.include('--credential-payload={"accessToken":"token","encryptedToken":"decrypted-me","unitoCredentialId":"compliance","unitoUserId":"compliance"}');
|
|
106
106
|
});
|
|
107
107
|
test_1.test
|
|
108
108
|
.stdout()
|
|
@@ -126,7 +126,7 @@ describe('Test', () => {
|
|
|
126
126
|
.stub(IntegrationResource, 'validateIsIntegrationDirectory', stub => stub.returns(true))
|
|
127
127
|
.command(['test', '--crawlMode=sample'])
|
|
128
128
|
.it('sampling crawlMode', () => {
|
|
129
|
-
(0, test_1.expect)(spawnStub.getCall(0).args.at(1)).to.include('--operation-collection-items-per-page=
|
|
129
|
+
(0, test_1.expect)(spawnStub.getCall(0).args.at(1)).to.include('--operation-collection-items-per-page=5');
|
|
130
130
|
(0, test_1.expect)(spawnStub.getCall(0).args.at(1)).to.include('--operation-collection-follow-next-pages=false');
|
|
131
131
|
});
|
|
132
132
|
test_1.test
|
|
@@ -199,27 +199,27 @@ describe('Test', () => {
|
|
|
199
199
|
.stdout()
|
|
200
200
|
.stub(ConfigurationResource, 'getConfiguration', stub => stub.resolves(cliConfiguration))
|
|
201
201
|
.stub(IntegrationResource, 'validateIsIntegrationDirectory', stub => stub.returns(true))
|
|
202
|
-
.stub(CredentialResource, 'fetchCredential', stub => stub.resolves({ payload: { from: 'credential' } }))
|
|
202
|
+
.stub(CredentialResource, 'fetchCredential', stub => stub.resolves({ payload: { from: 'credential' }, id: '123', unitoUserId: '456' }))
|
|
203
203
|
.command(['test', '--credential-id=123'])
|
|
204
204
|
.it('credential-id', () => {
|
|
205
|
-
(0, test_1.expect)(spawnStub.getCall(0).args.at(1)).to.include('--credential-payload={"from":"credential"}');
|
|
205
|
+
(0, test_1.expect)(spawnStub.getCall(0).args.at(1)).to.include('--credential-payload={"from":"credential","unitoCredentialId":"123","unitoUserId":"456"}');
|
|
206
206
|
(0, test_1.expect)(spawnStub.getCall(0).args.at(1)).to.include('--read-only');
|
|
207
207
|
});
|
|
208
208
|
test_1.test
|
|
209
209
|
.stdout()
|
|
210
210
|
.stub(ConfigurationResource, 'getConfiguration', stub => stub.resolves(cliConfiguration))
|
|
211
211
|
.stub(IntegrationResource, 'validateIsIntegrationDirectory', stub => stub.returns(true))
|
|
212
|
-
.stub(CredentialResource, 'fetchCredential', stub => stub.resolves({ payload: { from: 'credential' } }))
|
|
212
|
+
.stub(CredentialResource, 'fetchCredential', stub => stub.resolves({ payload: { from: 'credential' }, id: '123', unitoUserId: '456' }))
|
|
213
213
|
.command(['test', '--credential-id=123', '--no-read-only'])
|
|
214
214
|
.it('credential-id && read-only', () => {
|
|
215
|
-
(0, test_1.expect)(spawnStub.getCall(0).args.at(1)).to.include('--credential-payload={"from":"credential"}');
|
|
215
|
+
(0, test_1.expect)(spawnStub.getCall(0).args.at(1)).to.include('--credential-payload={"from":"credential","unitoCredentialId":"123","unitoUserId":"456"}');
|
|
216
216
|
(0, test_1.expect)(spawnStub.getCall(0).args.at(1)).to.not.include('--read-only');
|
|
217
217
|
});
|
|
218
218
|
test_1.test
|
|
219
219
|
.stdout()
|
|
220
220
|
.stub(ConfigurationResource, 'getConfiguration', stub => stub.resolves(cliConfiguration))
|
|
221
221
|
.stub(IntegrationResource, 'validateIsIntegrationDirectory', stub => stub.returns(true))
|
|
222
|
-
.stub(CredentialResource, 'fetchCredential', stub => stub.resolves({ payload: { from: 'credential' } }))
|
|
222
|
+
.stub(CredentialResource, 'fetchCredential', stub => stub.resolves({ payload: { from: 'credential' }, id: '123', unitoUserId: '456' }))
|
|
223
223
|
.stub(DecryptionResource, 'decryptEntries', stub => stub
|
|
224
224
|
.onFirstCall()
|
|
225
225
|
.resolves({ successful: {}, failed: [] })
|
|
@@ -237,7 +237,7 @@ describe('Test', () => {
|
|
|
237
237
|
.stdout()
|
|
238
238
|
.stub(ConfigurationResource, 'getConfiguration', stub => stub.resolves(cliConfiguration))
|
|
239
239
|
.stub(IntegrationResource, 'validateIsIntegrationDirectory', stub => stub.returns(true))
|
|
240
|
-
.stub(CredentialResource, 'fetchCredential', stub => stub.resolves({ payload: { from: 'credential' } }))
|
|
240
|
+
.stub(CredentialResource, 'fetchCredential', stub => stub.resolves({ payload: { from: 'credential' }, id: '123', unitoUserId: '456' }))
|
|
241
241
|
.stub(DecryptionResource, 'decryptEntries', stub => stub
|
|
242
242
|
.onFirstCall()
|
|
243
243
|
.resolves({ successful: {}, failed: [] })
|
package/oclif.manifest.json
CHANGED