File tree Expand file tree Collapse file tree 3 files changed +20
-11
lines changed Expand file tree Collapse file tree 3 files changed +20
-11
lines changed Original file line number Diff line number Diff line change 8
8
DENIED_STATUSES ,
9
9
DONE_STATUSES ,
10
10
ERROR_STATUSES ,
11
+ PluginRequest ,
11
12
Request ,
12
13
} from "../types/request" ;
13
14
import { request } from "./request" ;
@@ -34,14 +35,14 @@ export const sshCommand = (yargs: yargs.Argv) =>
34
35
35
36
// TODO: Move this to a shared utility
36
37
/** Waits until P0 grants access for a request */
37
- const waitForProvisioning = async < T extends object > (
38
+ const waitForProvisioning = async < P extends PluginRequest > (
38
39
authn : Authn ,
39
40
requestId : string
40
41
) => {
41
42
let cancel : NodeJS . Timeout | undefined = undefined ;
42
- const result = await new Promise < Request < T > > ( ( resolve , reject ) => {
43
+ const result = await new Promise < Request < P > > ( ( resolve , reject ) => {
43
44
let isResolved = false ;
44
- const unsubscribe = onSnapshot < Request < T > , object > (
45
+ const unsubscribe = onSnapshot < Request < P > , object > (
45
46
doc ( `o/${ authn . identity . org . tenantId } /permission-requests/${ requestId } ` ) ,
46
47
( snap ) => {
47
48
const data = snap . data ( ) ;
Original file line number Diff line number Diff line change @@ -34,8 +34,13 @@ export type AwsConfig = {
34
34
// -- Specific AWS permission types
35
35
36
36
export type AwsSsh = {
37
- spec : {
38
- arn : string ;
37
+ permission : {
38
+ spec : {
39
+ arn : string ;
40
+ } ;
41
+ type : "session" ;
42
+ } ;
43
+ generated : {
44
+ documentName : string ;
39
45
} ;
40
- type : "session" ;
41
46
} ;
Original file line number Diff line number Diff line change @@ -6,15 +6,18 @@ export const ERROR_STATUSES = [
6
6
"ERRORED_NOTIFIED" ,
7
7
] as const ;
8
8
9
- export type Request < T = object > = {
9
+ export type PluginRequest = {
10
+ permission : object ;
11
+ generated ?: object ;
12
+ } ;
13
+
14
+ export type Request < P extends PluginRequest = { permission : object } > = {
10
15
status : string ;
11
16
generatedRoles : {
12
17
role : string ;
13
18
} [ ] ;
14
- generated : {
15
- documentName : string ;
16
- } ;
17
- permission : T ;
19
+ generated : P [ "generated" ] ;
20
+ permission : P [ "permission" ] ;
18
21
principal : string ;
19
22
} ;
20
23
You can’t perform that action at this time.
0 commit comments