opal-security 2.1.0 → 2.1.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.
package/README.md CHANGED
@@ -22,7 +22,7 @@ $ npm install -g opal-security
22
22
  $ opal COMMAND
23
23
  running command...
24
24
  $ opal (-v|--version|version)
25
- opal-security/2.1.0 darwin-x64 node-v14.16.1
25
+ opal-security/2.1.1 darwin-x64 node-v14.16.1
26
26
  $ opal --help [COMMAND]
27
27
  USAGE
28
28
  $ opal COMMAND
@@ -88,7 +88,7 @@ EXAMPLE
88
88
  opal aws:identity
89
89
  ```
90
90
 
91
- _See code: [src/commands/aws/identity.ts](https://github.com/opalsecurity/opal-cli/blob/v2.1.0/src/commands/aws/identity.ts)_
91
+ _See code: [src/commands/aws/identity.ts](https://github.com/opalsecurity/opal-cli/blob/v2.1.1/src/commands/aws/identity.ts)_
92
92
 
93
93
  ## `opal curl-example`
94
94
 
@@ -102,7 +102,7 @@ OPTIONS
102
102
  -h, --help show CLI help
103
103
  ```
104
104
 
105
- _See code: [src/commands/curl-example.ts](https://github.com/opalsecurity/opal-cli/blob/v2.1.0/src/commands/curl-example.ts)_
105
+ _See code: [src/commands/curl-example.ts](https://github.com/opalsecurity/opal-cli/blob/v2.1.1/src/commands/curl-example.ts)_
106
106
 
107
107
  ## `opal help [COMMAND]`
108
108
 
@@ -131,9 +131,16 @@ USAGE
131
131
 
132
132
  OPTIONS
133
133
  -h, --help show CLI help
134
- --id=id The ID of the Opal role resource.
134
+
135
+ -i, --id=id The Opal ID of the resource. You can find this from the URL, e.g.
136
+ https://opal.dev/resources/[ID]
137
+
138
+ -r, --refresh Starts a new session even if one already exists. Useful if a session is about to expire.
139
+
140
+ -s, --sessionId=sessionId The Opal ID of the session to connect to. Uses an existing session that was created via the
141
+ web flow.
142
+
135
143
  --profileName=profileName Uses a custom AWS profile name for the IAM role. Default value is the role's name.
136
- --sessionId=sessionId SessionId of a session that has already been created via the web flow.
137
144
 
138
145
  EXAMPLES
139
146
  opal iam-roles:start
@@ -141,7 +148,7 @@ EXAMPLES
141
148
  opal iam-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --profileName "custom-profile"
142
149
  ```
143
150
 
144
- _See code: [src/commands/iam-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v2.1.0/src/commands/iam-roles/start.ts)_
151
+ _See code: [src/commands/iam-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v2.1.1/src/commands/iam-roles/start.ts)_
145
152
 
146
153
  ## `opal kube-roles:start`
147
154
 
@@ -152,10 +159,17 @@ USAGE
152
159
  $ opal kube-roles:start
153
160
 
154
161
  OPTIONS
155
- -h, --help show CLI help
156
- --accessLevelRemoteId=accessLevelRemoteId The remote ID of the access level with which to access the cluster.
157
- --id=id The ID of the Opal role resource.
158
- --sessionId=sessionId SessionId of a session that has already been created via the web flow.
162
+ -a, --accessLevelRemoteId=accessLevelRemoteId The remote ID of the access level with which to access the resource.
163
+ -h, --help show CLI help
164
+
165
+ -i, --id=id The Opal ID of the resource. You can find this from the URL, e.g.
166
+ https://opal.dev/resources/[ID]
167
+
168
+ -r, --refresh Starts a new session even if one already exists. Useful if a session is
169
+ about to expire.
170
+
171
+ -s, --sessionId=sessionId The Opal ID of the session to connect to. Uses an existing session that
172
+ was created via the web flow.
159
173
 
160
174
  EXAMPLES
161
175
  opal kube-roles:start
@@ -164,7 +178,7 @@ EXAMPLES
164
178
  "arn:aws:iam::712234975475:role/acme-eks-cluster-admin-role"
165
179
  ```
166
180
 
167
- _See code: [src/commands/kube-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v2.1.0/src/commands/kube-roles/start.ts)_
181
+ _See code: [src/commands/kube-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v2.1.1/src/commands/kube-roles/start.ts)_
168
182
 
169
183
  ## `opal login`
170
184
 
@@ -182,7 +196,7 @@ EXAMPLE
182
196
  $ opal login
183
197
  ```
184
198
 
185
- _See code: [src/commands/login.ts](https://github.com/opalsecurity/opal-cli/blob/v2.1.0/src/commands/login.ts)_
199
+ _See code: [src/commands/login.ts](https://github.com/opalsecurity/opal-cli/blob/v2.1.1/src/commands/login.ts)_
186
200
 
187
201
  ## `opal logout`
188
202
 
@@ -199,29 +213,42 @@ EXAMPLE
199
213
  $ opal logout
200
214
  ```
201
215
 
202
- _See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v2.1.0/src/commands/logout.ts)_
216
+ _See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v2.1.1/src/commands/logout.ts)_
203
217
 
204
218
  ## `opal postgres-instances:start`
205
219
 
206
- Starts a session to query a Postgres database.
220
+ Starts a session to connect to a Postgres database.
207
221
 
208
222
  ```
209
223
  USAGE
210
224
  $ opal postgres-instances:start
211
225
 
212
226
  OPTIONS
213
- -h, --help show CLI help
214
- --accessLevelRemoteId=accessLevelRemoteId The remote ID of the access level with which to access the database.
215
- --id=id The ID of the Opal instance resource.
216
- --sessionId=sessionId SessionId of a session that has already been created via the web flow.
227
+ -a, --accessLevelRemoteId=accessLevelRemoteId The remote ID of the access level with which to access the resource.
228
+ -h, --help show CLI help
229
+
230
+ -i, --id=id The Opal ID of the resource. You can find this from the URL, e.g.
231
+ https://opal.dev/resources/[ID]
232
+
233
+ -r, --refresh Starts a new session even if one already exists. Useful if a session is
234
+ about to expire.
235
+
236
+ -s, --sessionId=sessionId The Opal ID of the session to connect to. Uses an existing session that
237
+ was created via the web flow.
238
+
239
+ --action=open|psql|view Method of connecting to the database.
240
+ - open: Open external database app
241
+ - psql: Start psql session in shell
242
+ - view: View connection configuration details
217
243
 
218
244
  EXAMPLES
219
245
  opal postgres-instances:start
220
246
  opal postgres-instances:start --id 51f7176b-0464-4a6f-8369-e951e187b398
221
- opal postgres-instances:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId "fullaccess"
247
+ opal postgres-instances:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId fullaccess
248
+ opal postgres-instances:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId fullaccess --action view
222
249
  ```
223
250
 
224
- _See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v2.1.0/src/commands/postgres-instances/start.ts)_
251
+ _See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v2.1.1/src/commands/postgres-instances/start.ts)_
225
252
 
226
253
  ## `opal resources:get`
227
254
 
@@ -232,14 +259,14 @@ USAGE
232
259
  $ opal resources:get
233
260
 
234
261
  OPTIONS
235
- -h, --help show CLI help
236
- --id=id (required)
262
+ -h, --help show CLI help
263
+ -i, --id=id The Opal ID of the resource. You can find this from the URL, e.g. https://opal.dev/resources/[ID]
237
264
 
238
265
  EXAMPLE
239
266
  opal resources:get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4
240
267
  ```
241
268
 
242
- _See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v2.1.0/src/commands/resources/get.ts)_
269
+ _See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v2.1.1/src/commands/resources/get.ts)_
243
270
 
244
271
  ## `opal set-custom-header`
245
272
 
@@ -257,7 +284,7 @@ EXAMPLE
257
284
  $ opal set-custom-header --header 'cf-access-token: $TOKEN'
258
285
  ```
259
286
 
260
- _See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v2.1.0/src/commands/set-custom-header.ts)_
287
+ _See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v2.1.1/src/commands/set-custom-header.ts)_
261
288
 
262
289
  ## `opal set-token`
263
290
 
@@ -274,7 +301,7 @@ EXAMPLE
274
301
  $ opal set-token
275
302
  ```
276
303
 
277
- _See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v2.1.0/src/commands/set-token.ts)_
304
+ _See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v2.1.1/src/commands/set-token.ts)_
278
305
 
279
306
  ## `opal set-url [URL]`
280
307
 
@@ -295,7 +322,7 @@ EXAMPLE
295
322
  $ opal set-url
296
323
  ```
297
324
 
298
- _See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v2.1.0/src/commands/set-url.ts)_
325
+ _See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v2.1.1/src/commands/set-url.ts)_
299
326
 
300
327
  ## `opal ssh:copyFrom`
301
328
 
@@ -306,23 +333,28 @@ USAGE
306
333
  $ opal ssh:copyFrom
307
334
 
308
335
  OPTIONS
309
- -h, --help show CLI help
310
- --dest=dest [default: .] Pick which directory you want your files to be copied to.
311
- --id=id The ID of the Opal instance resource.
312
- --sessionId=sessionId SessionId of a session that has already been created via the web flow.
336
+ -h, --help show CLI help
337
+
338
+ -i, --id=id The Opal ID of the resource. You can find this from the URL, e.g.
339
+ https://opal.dev/resources/[ID]
340
+
341
+ -s, --sessionId=sessionId The Opal ID of the session to connect to. Uses an existing session that was created via the
342
+ web flow.
313
343
 
314
- --src=src (required) The path of the directory or file you would like to copy over SCP. Note we only
315
- support one file or directory at a time.
344
+ --dest=dest [default: .] The directory you want your files to be copied to.
316
345
 
317
- --user=user [default: ssm-user] Pick which user you want to run SCP over. Keep in mind not all users will
318
- have access to each other's home directory.
346
+ --src=src (required) The directory or file you would like to copy over SCP. Note we only support one
347
+ file or directory at a time.
348
+
349
+ --user=user [default: ssm-user] The user you want to run SCP over. Keep in mind not all users will have
350
+ access to each other's home directory.
319
351
 
320
352
  EXAMPLES
321
353
  opal ssh:copyFrom --src instance/dir --dest my/dir
322
354
  opal ssh:copyFrom --src instance/dir --dest my/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
323
355
  ```
324
356
 
325
- _See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v2.1.0/src/commands/ssh/copyFrom.ts)_
357
+ _See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v2.1.1/src/commands/ssh/copyFrom.ts)_
326
358
 
327
359
  ## `opal ssh:copyTo`
328
360
 
@@ -333,23 +365,28 @@ USAGE
333
365
  $ opal ssh:copyTo
334
366
 
335
367
  OPTIONS
336
- -h, --help show CLI help
337
- --dest=dest [default: .] Pick which directory you want your files to be copied to.
338
- --id=id The ID of the Opal instance resource.
339
- --sessionId=sessionId SessionId of a session that has already been created via the web flow.
368
+ -h, --help show CLI help
369
+
370
+ -i, --id=id The Opal ID of the resource. You can find this from the URL, e.g.
371
+ https://opal.dev/resources/[ID]
340
372
 
341
- --src=src (required) The path of the directory or file you would like to copy over SCP. Note we only
342
- support one file or directory at a time.
373
+ -s, --sessionId=sessionId The Opal ID of the session to connect to. Uses an existing session that was created via the
374
+ web flow.
343
375
 
344
- --user=user [default: ssm-user] Pick which user you want to run SCP over. Keep in mind not all users will
345
- have access to each other's home directory.
376
+ --dest=dest [default: .] The directory you want your files to be copied to.
377
+
378
+ --src=src (required) The directory or file you would like to copy over SCP. Note we only support one
379
+ file or directory at a time.
380
+
381
+ --user=user [default: ssm-user] The user you want to run SCP over. Keep in mind not all users will have
382
+ access to each other's home directory.
346
383
 
347
384
  EXAMPLES
348
385
  opal ssh:copyTo --src my/dir --dest instance/dir
349
386
  opal ssh:copyTo --src my/dir --dest instance/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
350
387
  ```
351
388
 
352
- _See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v2.1.0/src/commands/ssh/copyTo.ts)_
389
+ _See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v2.1.1/src/commands/ssh/copyTo.ts)_
353
390
 
354
391
  ## `opal ssh:start`
355
392
 
@@ -360,14 +397,20 @@ USAGE
360
397
  $ opal ssh:start
361
398
 
362
399
  OPTIONS
363
- -h, --help show CLI help
364
- --id=id The ID of the Opal instance resource.
365
- --sessionId=sessionId SessionId of a session that has already been created via the web flow.
400
+ -h, --help show CLI help
401
+
402
+ -i, --id=id The Opal ID of the resource. You can find this from the URL, e.g.
403
+ https://opal.dev/resources/[ID]
404
+
405
+ -r, --refresh Starts a new session even if one already exists. Useful if a session is about to expire.
406
+
407
+ -s, --sessionId=sessionId The Opal ID of the session to connect to. Uses an existing session that was created via the
408
+ web flow.
366
409
 
367
410
  EXAMPLES
368
411
  opal ssh:start
369
412
  opal ssh:start --id 51f7176b-0464-4a6f-8369-e951e187b398
370
413
  ```
371
414
 
372
- _See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v2.1.0/src/commands/ssh/start.ts)_
415
+ _See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v2.1.1/src/commands/ssh/start.ts)_
373
416
  <!-- commandsstop -->
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const command_1 = require("@oclif/command");
4
4
  const cmd_1 = require("../../lib/cmd");
5
+ const flags_1 = require("../../lib/flags");
5
6
  class Identity extends command_1.Command {
6
7
  async run() {
7
8
  cmd_1.setMostRecentCommand(this);
@@ -13,5 +14,5 @@ exports.default = Identity;
13
14
  Identity.description = 'Gets the current caller identity for the "opal" AWS profile.';
14
15
  Identity.examples = ['opal aws:identity'];
15
16
  Identity.flags = {
16
- help: command_1.flags.help({ char: 'h' }),
17
+ help: flags_1.SHARED_FLAGS.help,
17
18
  };
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const command_1 = require("@oclif/command");
4
4
  const config_1 = require("../lib/config");
5
5
  const credentials_1 = require("../lib/credentials");
6
+ const flags_1 = require("../lib/flags");
6
7
  class CurlExample extends command_1.Command {
7
8
  async run() {
8
9
  const accessToken = await credentials_1.cred.accessToken;
@@ -21,5 +22,5 @@ curl -v ${url}/query \\
21
22
  exports.default = CurlExample;
22
23
  CurlExample.description = 'Prints out an example cURL command containing the parameters the CLI uses to query the Opal server.';
23
24
  CurlExample.flags = {
24
- help: command_1.flags.help({ char: 'h' }),
25
+ help: flags_1.SHARED_FLAGS.help,
25
26
  };
@@ -6,6 +6,7 @@ export default class StartIAMRoleSession extends Command {
6
6
  help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
7
7
  id: flags.IOptionFlag<string | undefined>;
8
8
  sessionId: flags.IOptionFlag<string | undefined>;
9
+ refresh: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
9
10
  profileName: flags.IOptionFlag<string | undefined>;
10
11
  };
11
12
  run(): Promise<void>;
@@ -8,6 +8,7 @@ const aws_1 = require("../../lib/aws");
8
8
  const resources_1 = require("../../lib/resources");
9
9
  const get_1 = require("../../commands/resources/get");
10
10
  const sessions_1 = require("../../lib/sessions");
11
+ const flags_1 = require("../../lib/flags");
11
12
  const IamSessionMetadataFragment = `
12
13
  ... on AwsIamFederatedRoleSession {
13
14
  awsAccessKeyId
@@ -20,6 +21,9 @@ class StartIAMRoleSession extends command_1.Command {
20
21
  async run() {
21
22
  cmd_1.setMostRecentCommand(this);
22
23
  const { flags } = this.parse(StartIAMRoleSession);
24
+ if (flags.sessionId && flags.refresh) {
25
+ return apollo_1.handleError(this, 'Cannot use both --sessionId and --refresh');
26
+ }
23
27
  let roleId = flags.id;
24
28
  let roleName = null;
25
29
  const sessionId = flags.sessionId;
@@ -50,7 +54,7 @@ class StartIAMRoleSession extends command_1.Command {
50
54
  if (flags.profileName && flags.profileName !== '') {
51
55
  roleName = flags.profileName;
52
56
  }
53
- const session = await sessions_1.getOrCreateSession(this, roleId, resources_1.DEFAULT_ACCESS_LEVEL, sessionId, IamSessionMetadataFragment);
57
+ const session = await sessions_1.getOrCreateSession(this, roleId, resources_1.DEFAULT_ACCESS_LEVEL, sessionId, IamSessionMetadataFragment, flags.refresh);
54
58
  const metadata = session.metadata;
55
59
  switch (metadata === null || metadata === void 0 ? void 0 : metadata.__typename) {
56
60
  case 'AwsIamFederatedRoleSession': {
@@ -74,15 +78,10 @@ StartIAMRoleSession.examples = [
74
78
  'opal iam-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --profileName "custom-profile"',
75
79
  ];
76
80
  StartIAMRoleSession.flags = {
77
- help: command_1.flags.help({ char: 'h' }),
78
- id: command_1.flags.string({
79
- multiple: false,
80
- description: 'The ID of the Opal role resource.',
81
- }),
82
- sessionId: command_1.flags.string({
83
- multiple: false,
84
- description: 'SessionId of a session that has already been created via the web flow.',
85
- }),
81
+ help: flags_1.SHARED_FLAGS.help,
82
+ id: flags_1.SHARED_FLAGS.id,
83
+ sessionId: flags_1.SHARED_FLAGS.sessionId,
84
+ refresh: flags_1.SHARED_FLAGS.refresh,
86
85
  profileName: command_1.flags.string({
87
86
  multiple: false,
88
87
  description: 'Uses a custom AWS profile name for the IAM role. Default value is the role\'s name.',
@@ -1,12 +1,13 @@
1
- import { Command, flags } from '@oclif/command';
1
+ import { Command } from '@oclif/command';
2
2
  export default class StartKubeIAMRoleSession extends Command {
3
3
  static description: string;
4
4
  static examples: string[];
5
5
  static flags: {
6
6
  help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
7
- id: flags.IOptionFlag<string | undefined>;
8
- accessLevelRemoteId: flags.IOptionFlag<string | undefined>;
9
- sessionId: flags.IOptionFlag<string | undefined>;
7
+ id: import("@oclif/command/lib/flags").IOptionFlag<string | undefined>;
8
+ accessLevelRemoteId: import("@oclif/command/lib/flags").IOptionFlag<string | undefined>;
9
+ sessionId: import("@oclif/command/lib/flags").IOptionFlag<string | undefined>;
10
+ refresh: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
10
11
  };
11
12
  run(): Promise<void>;
12
13
  }
@@ -6,6 +6,7 @@ const apollo_1 = require("../../lib/apollo");
6
6
  const aws_1 = require("../../lib/aws");
7
7
  const resources_1 = require("../../lib/resources");
8
8
  const sessions_1 = require("../../lib/sessions");
9
+ const flags_1 = require("../../lib/flags");
9
10
  const EksSessionMetadataFragment = `
10
11
  ... on AwsIamFederatedEksSession {
11
12
  awsAccessKeyId
@@ -18,6 +19,9 @@ class StartKubeIAMRoleSession extends command_1.Command {
18
19
  async run() {
19
20
  cmd_1.setMostRecentCommand(this);
20
21
  const { flags } = this.parse(StartKubeIAMRoleSession);
22
+ if (flags.sessionId && flags.refresh) {
23
+ return apollo_1.handleError(this, 'Cannot use both --sessionId and --refresh');
24
+ }
21
25
  let clusterId = flags.id;
22
26
  const sessionId = flags.sessionId;
23
27
  if (!clusterId) {
@@ -32,7 +36,7 @@ class StartKubeIAMRoleSession extends command_1.Command {
32
36
  if (!accessLevel) {
33
37
  return;
34
38
  }
35
- const session = await sessions_1.getOrCreateSession(this, clusterId, accessLevel, sessionId, EksSessionMetadataFragment);
39
+ const session = await sessions_1.getOrCreateSession(this, clusterId, accessLevel, sessionId, EksSessionMetadataFragment, flags.refresh);
36
40
  const metadata = session.metadata;
37
41
  switch (metadata === null || metadata === void 0 ? void 0 : metadata.__typename) {
38
42
  case 'AwsIamFederatedEksSession': {
@@ -58,17 +62,9 @@ StartKubeIAMRoleSession.examples = [
58
62
  'opal kube-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId "arn:aws:iam::712234975475:role/acme-eks-cluster-admin-role"',
59
63
  ];
60
64
  StartKubeIAMRoleSession.flags = {
61
- help: command_1.flags.help({ char: 'h' }),
62
- id: command_1.flags.string({
63
- multiple: false,
64
- description: 'The ID of the Opal role resource.',
65
- }),
66
- accessLevelRemoteId: command_1.flags.string({
67
- multiple: false,
68
- description: 'The remote ID of the access level with which to access the cluster.',
69
- }),
70
- sessionId: command_1.flags.string({
71
- multiple: false,
72
- description: 'SessionId of a session that has already been created via the web flow.',
73
- }),
65
+ help: flags_1.SHARED_FLAGS.help,
66
+ id: flags_1.SHARED_FLAGS.id,
67
+ accessLevelRemoteId: flags_1.SHARED_FLAGS.accessLevelRemoteId,
68
+ sessionId: flags_1.SHARED_FLAGS.sessionId,
69
+ refresh: flags_1.SHARED_FLAGS.refresh,
74
70
  };
@@ -10,7 +10,8 @@ const credentials_1 = require("../lib/credentials");
10
10
  const inquirer = require("inquirer");
11
11
  const handler_1 = require("../handler");
12
12
  const config_1 = require("../lib/config");
13
- const common_1 = require("../lib/common");
13
+ const util_1 = require("../lib/util");
14
+ const flags_1 = require("../lib/flags");
14
15
  const ISSUER_PROD = 'https://auth.opal.dev';
15
16
  const ISSUER_DEV = 'https://authdev.opal.dev';
16
17
  const GRANT_TYPE = 'urn:ietf:params:oauth:grant-type:device_code';
@@ -59,8 +60,8 @@ class Login extends command_1.Command {
59
60
  await credentials_1.cred.removeCredentials(-1);
60
61
  }
61
62
  this.log('Welcome to Opal! ⚡️\n');
62
- this.log('Please confirm your Opal instance URL:', configData[config_1.urlKey]);
63
- this.log('If this is not correct, please first use `opal set-url --help`\n');
63
+ this.log('Connecting to Opal server URL:', configData[config_1.urlKey]);
64
+ this.log('If this is incorrect, please run `opal set-url --help`\n');
64
65
  if (email) {
65
66
  this.log('Signing in as: ' + email + ' - to use a different account, run `opal login --email [EMAIL]`');
66
67
  }
@@ -80,7 +81,8 @@ class Login extends command_1.Command {
80
81
  variables: { input: { email } },
81
82
  });
82
83
  if (error) {
83
- this.log('Could not connect to Opal. Did you set the right URL? (`opal set-url --help`)');
84
+ this.log(''); // Intentional newline
85
+ return apollo_1.handleError(this, 'Could not connect to Opal. Did you set the right URL? (`opal set-url --help`)');
84
86
  }
85
87
  const signInOrganizations = (_b = (_a = signInOrganizationsResponse === null || signInOrganizationsResponse === void 0 ? void 0 : signInOrganizationsResponse.data) === null || _a === void 0 ? void 0 : _a.signInMethod) === null || _b === void 0 ? void 0 : _b.signInOrganizations;
86
88
  if (signInOrganizations && signInOrganizations.length > 0) {
@@ -133,7 +135,7 @@ class Login extends command_1.Command {
133
135
  this.log(` User Code: ${handle.user_code}\n`);
134
136
  // Wait before opening the browser window to ensure the user has time to
135
137
  // see the User Code.
136
- await common_1.sleep(1000);
138
+ await util_1.sleep(1000);
137
139
  await open(handle.verification_uri_complete, { wait: false });
138
140
  const tokenSet = await handle.poll();
139
141
  const userInfo = await client.userinfo(tokenSet);
@@ -160,7 +162,7 @@ exports.default = Login;
160
162
  Login.description = 'Authenticates you with the Opal server.';
161
163
  Login.examples = ['$ opal login'];
162
164
  Login.flags = {
163
- help: command_1.flags.help({ char: 'h' }),
165
+ help: flags_1.SHARED_FLAGS.help,
164
166
  email: command_1.flags.string({
165
167
  multiple: false,
166
168
  description: 'Email address to login with.',
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const command_1 = require("@oclif/command");
4
4
  const credentials_1 = require("../lib/credentials");
5
+ const flags_1 = require("../lib/flags");
5
6
  class Logout extends command_1.Command {
6
7
  async run() {
7
8
  try {
@@ -17,6 +18,6 @@ exports.default = Logout;
17
18
  Logout.description = 'Clears locally stored Opal server authentication credentials.';
18
19
  Logout.examples = ['$ opal logout'];
19
20
  Logout.flags = {
20
- help: command_1.flags.help({ char: 'h' }),
21
+ help: flags_1.SHARED_FLAGS.help,
21
22
  };
22
23
  Logout.args = [];
@@ -7,6 +7,8 @@ export default class StartPostgresInstanceSession extends Command {
7
7
  id: flags.IOptionFlag<string | undefined>;
8
8
  accessLevelRemoteId: flags.IOptionFlag<string | undefined>;
9
9
  sessionId: flags.IOptionFlag<string | undefined>;
10
+ refresh: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
11
+ action: flags.IOptionFlag<string | undefined>;
10
12
  };
11
13
  run(): Promise<void>;
12
14
  }