@coffre/client 0.4.5 → 0.5.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/{index-ZGDlpCwB.d.ts → index-D0kM4Gfi.d.ts} +498 -91
- package/dist/index.d.ts +2 -2
- package/dist/index.js +12 -0
- package/dist/routes.d.ts +1 -1
- package/dist/routes.js +5 -0
- package/package.json +1 -1
- package/src/api.ts +346 -52
- package/src/index.ts +17 -3
- package/src/routes.ts +5 -0
package/src/api.ts
CHANGED
|
@@ -13,9 +13,35 @@ export type Api = {
|
|
|
13
13
|
};
|
|
14
14
|
registered: boolean;
|
|
15
15
|
tampered: boolean;
|
|
16
|
-
instanceRole: "
|
|
16
|
+
instanceRole: "admin" | "auditor" | "developer" | "member" | "owner" | "root-admin";
|
|
17
|
+
scope: {
|
|
18
|
+
projects: "all" | {
|
|
19
|
+
only: string[];
|
|
20
|
+
} | {
|
|
21
|
+
except: string[];
|
|
22
|
+
};
|
|
23
|
+
environments: "all" | {
|
|
24
|
+
only: string[];
|
|
25
|
+
} | {
|
|
26
|
+
except: string[];
|
|
27
|
+
};
|
|
28
|
+
};
|
|
17
29
|
isRootAdmin: boolean;
|
|
30
|
+
runsInstance: boolean;
|
|
18
31
|
canReadAudit: boolean;
|
|
32
|
+
setsUpServices: boolean;
|
|
33
|
+
serviceSetup: null | {
|
|
34
|
+
projects: "all" | {
|
|
35
|
+
only: string[];
|
|
36
|
+
} | {
|
|
37
|
+
except: string[];
|
|
38
|
+
};
|
|
39
|
+
environments: "all" | {
|
|
40
|
+
only: string[];
|
|
41
|
+
} | {
|
|
42
|
+
except: string[];
|
|
43
|
+
};
|
|
44
|
+
};
|
|
19
45
|
features: {
|
|
20
46
|
mcp: string | null;
|
|
21
47
|
workloads: boolean;
|
|
@@ -47,13 +73,6 @@ export type Api = {
|
|
|
47
73
|
}[];
|
|
48
74
|
secretCount: number | null;
|
|
49
75
|
}[];
|
|
50
|
-
everyProject: {
|
|
51
|
-
member: string;
|
|
52
|
-
place: string;
|
|
53
|
-
role: "access-manager" | "auditor" | "developer" | "maintainer" | "owner" | "viewer";
|
|
54
|
-
roleName: string;
|
|
55
|
-
expiresAt: string | null;
|
|
56
|
-
}[];
|
|
57
76
|
};
|
|
58
77
|
};
|
|
59
78
|
"PUT /projects/:project": {
|
|
@@ -67,13 +86,6 @@ export type Api = {
|
|
|
67
86
|
archivedAt: string | null;
|
|
68
87
|
};
|
|
69
88
|
created: boolean;
|
|
70
|
-
inherited: {
|
|
71
|
-
member: string;
|
|
72
|
-
place: string;
|
|
73
|
-
role: "access-manager" | "auditor" | "developer" | "maintainer" | "owner" | "viewer";
|
|
74
|
-
roleName: string;
|
|
75
|
-
expiresAt: string | null;
|
|
76
|
-
}[];
|
|
77
89
|
};
|
|
78
90
|
};
|
|
79
91
|
"PATCH /projects/:project": {
|
|
@@ -128,13 +140,6 @@ export type Api = {
|
|
|
128
140
|
archivedAt: string | null;
|
|
129
141
|
};
|
|
130
142
|
created: boolean;
|
|
131
|
-
inherited: {
|
|
132
|
-
member: string;
|
|
133
|
-
place: string;
|
|
134
|
-
role: "access-manager" | "auditor" | "developer" | "maintainer" | "owner" | "viewer";
|
|
135
|
-
roleName: string;
|
|
136
|
-
expiresAt: string | null;
|
|
137
|
-
}[];
|
|
138
143
|
forked: null | {
|
|
139
144
|
from: string;
|
|
140
145
|
keys: number;
|
|
@@ -155,13 +160,6 @@ export type Api = {
|
|
|
155
160
|
name: string;
|
|
156
161
|
archivedAt: string | null;
|
|
157
162
|
};
|
|
158
|
-
inherited: {
|
|
159
|
-
member: string;
|
|
160
|
-
place: string;
|
|
161
|
-
role: "access-manager" | "auditor" | "developer" | "maintainer" | "owner" | "viewer";
|
|
162
|
-
roleName: string;
|
|
163
|
-
expiresAt: string | null;
|
|
164
|
-
}[];
|
|
165
163
|
};
|
|
166
164
|
};
|
|
167
165
|
"DELETE /projects/:project/:environment": {
|
|
@@ -389,7 +387,21 @@ export type Api = {
|
|
|
389
387
|
member: string;
|
|
390
388
|
principalType: "service" | "user";
|
|
391
389
|
principalId: string;
|
|
392
|
-
instanceRole: "
|
|
390
|
+
instanceRole: "admin" | "auditor" | "developer" | "member" | "owner" | "root-admin";
|
|
391
|
+
scope: null | {
|
|
392
|
+
projects: "all" | {
|
|
393
|
+
only: string[];
|
|
394
|
+
} | {
|
|
395
|
+
except: string[];
|
|
396
|
+
};
|
|
397
|
+
environments: "all" | {
|
|
398
|
+
only: string[];
|
|
399
|
+
} | {
|
|
400
|
+
except: string[];
|
|
401
|
+
};
|
|
402
|
+
};
|
|
403
|
+
reachesByRole: boolean;
|
|
404
|
+
managed: boolean;
|
|
393
405
|
isRootAdmin: boolean;
|
|
394
406
|
tampered: boolean;
|
|
395
407
|
grants: {
|
|
@@ -415,7 +427,19 @@ export type Api = {
|
|
|
415
427
|
principalType: "service" | "user";
|
|
416
428
|
principalId: string;
|
|
417
429
|
status: "active" | "removed" | "tampered";
|
|
418
|
-
instanceRole: "
|
|
430
|
+
instanceRole: "admin" | "auditor" | "developer" | "member" | "owner" | "root-admin";
|
|
431
|
+
scope: {
|
|
432
|
+
projects: "all" | {
|
|
433
|
+
only: string[];
|
|
434
|
+
} | {
|
|
435
|
+
except: string[];
|
|
436
|
+
};
|
|
437
|
+
environments: "all" | {
|
|
438
|
+
only: string[];
|
|
439
|
+
} | {
|
|
440
|
+
except: string[];
|
|
441
|
+
};
|
|
442
|
+
};
|
|
419
443
|
isRootAdmin: boolean;
|
|
420
444
|
removedAt: string | null;
|
|
421
445
|
removedBy: string | null;
|
|
@@ -442,6 +466,9 @@ export type Api = {
|
|
|
442
466
|
hint: string;
|
|
443
467
|
expiresAt: string;
|
|
444
468
|
lastUsedAt: string | null;
|
|
469
|
+
scope: null | {
|
|
470
|
+
[key: string]: "access-manager" | "auditor" | "developer" | "maintainer" | "owner" | "viewer";
|
|
471
|
+
};
|
|
445
472
|
}[];
|
|
446
473
|
apps: {
|
|
447
474
|
id: string;
|
|
@@ -469,11 +496,35 @@ export type Api = {
|
|
|
469
496
|
};
|
|
470
497
|
"PUT /members/:member": {
|
|
471
498
|
input: {
|
|
472
|
-
|
|
499
|
+
role?: "admin" | "auditor" | "developer" | "member" | "owner";
|
|
500
|
+
scope?: {
|
|
501
|
+
projects?: "all" | {
|
|
502
|
+
only: string[];
|
|
503
|
+
} | {
|
|
504
|
+
except: string[];
|
|
505
|
+
};
|
|
506
|
+
environments?: "all" | {
|
|
507
|
+
only: string[];
|
|
508
|
+
} | {
|
|
509
|
+
except: string[];
|
|
510
|
+
};
|
|
511
|
+
};
|
|
473
512
|
};
|
|
474
513
|
output: {
|
|
475
514
|
member: string;
|
|
476
|
-
instanceRole: "
|
|
515
|
+
instanceRole: "admin" | "auditor" | "developer" | "member" | "owner";
|
|
516
|
+
scope: {
|
|
517
|
+
projects: "all" | {
|
|
518
|
+
only: string[];
|
|
519
|
+
} | {
|
|
520
|
+
except: string[];
|
|
521
|
+
};
|
|
522
|
+
environments: "all" | {
|
|
523
|
+
only: string[];
|
|
524
|
+
} | {
|
|
525
|
+
except: string[];
|
|
526
|
+
};
|
|
527
|
+
};
|
|
477
528
|
created: boolean;
|
|
478
529
|
};
|
|
479
530
|
};
|
|
@@ -487,11 +538,23 @@ export type Api = {
|
|
|
487
538
|
identities: number;
|
|
488
539
|
apps: number;
|
|
489
540
|
};
|
|
490
|
-
report: {
|
|
541
|
+
report: null | {
|
|
491
542
|
principalType: "service" | "user";
|
|
492
543
|
principalId: string;
|
|
493
544
|
status: "active" | "removed" | "tampered";
|
|
494
|
-
instanceRole: "
|
|
545
|
+
instanceRole: "admin" | "auditor" | "developer" | "member" | "owner" | "root-admin";
|
|
546
|
+
scope: {
|
|
547
|
+
projects: "all" | {
|
|
548
|
+
only: string[];
|
|
549
|
+
} | {
|
|
550
|
+
except: string[];
|
|
551
|
+
};
|
|
552
|
+
environments: "all" | {
|
|
553
|
+
only: string[];
|
|
554
|
+
} | {
|
|
555
|
+
except: string[];
|
|
556
|
+
};
|
|
557
|
+
};
|
|
495
558
|
isRootAdmin: boolean;
|
|
496
559
|
removedAt: string | null;
|
|
497
560
|
removedBy: string | null;
|
|
@@ -518,6 +581,9 @@ export type Api = {
|
|
|
518
581
|
hint: string;
|
|
519
582
|
expiresAt: string;
|
|
520
583
|
lastUsedAt: string | null;
|
|
584
|
+
scope: null | {
|
|
585
|
+
[key: string]: "access-manager" | "auditor" | "developer" | "maintainer" | "owner" | "viewer";
|
|
586
|
+
};
|
|
521
587
|
}[];
|
|
522
588
|
apps: {
|
|
523
589
|
id: string;
|
|
@@ -556,6 +622,9 @@ export type Api = {
|
|
|
556
622
|
expiresAt: string;
|
|
557
623
|
lastUsedAt: string | null;
|
|
558
624
|
lastUsedIp: string | null;
|
|
625
|
+
scope: null | {
|
|
626
|
+
[key: string]: "access-manager" | "auditor" | "developer" | "maintainer" | "owner" | "viewer";
|
|
627
|
+
};
|
|
559
628
|
}[];
|
|
560
629
|
};
|
|
561
630
|
};
|
|
@@ -563,11 +632,21 @@ export type Api = {
|
|
|
563
632
|
input: {
|
|
564
633
|
expiresInDays: number;
|
|
565
634
|
label?: string | null;
|
|
635
|
+
scope?: {
|
|
636
|
+
[key: string]: "access-manager" | "auditor" | "developer" | "maintainer" | "owner" | "viewer";
|
|
637
|
+
};
|
|
566
638
|
};
|
|
567
639
|
output: {
|
|
568
640
|
id: string;
|
|
569
641
|
token: string;
|
|
570
642
|
expiresAt: string;
|
|
643
|
+
scope: {
|
|
644
|
+
[key: string]: "access-manager" | "auditor" | "developer" | "maintainer" | "owner" | "viewer";
|
|
645
|
+
};
|
|
646
|
+
} | {
|
|
647
|
+
scope: {
|
|
648
|
+
[key: string]: "access-manager" | "auditor" | "developer" | "maintainer" | "owner" | "viewer";
|
|
649
|
+
};
|
|
571
650
|
};
|
|
572
651
|
};
|
|
573
652
|
"DELETE /members/:member/tokens/:id": {
|
|
@@ -585,7 +664,10 @@ export type Api = {
|
|
|
585
664
|
issuer: string;
|
|
586
665
|
jwksUri: string;
|
|
587
666
|
claims: {
|
|
588
|
-
[key: string]: string;
|
|
667
|
+
[key: string]: string | string[];
|
|
668
|
+
};
|
|
669
|
+
scope: null | {
|
|
670
|
+
[key: string]: "access-manager" | "auditor" | "developer" | "maintainer" | "owner" | "viewer";
|
|
589
671
|
};
|
|
590
672
|
label: string | null;
|
|
591
673
|
createdAt: string;
|
|
@@ -598,9 +680,12 @@ export type Api = {
|
|
|
598
680
|
input: {
|
|
599
681
|
profile: "custom" | "github" | "github-reusable" | "github-reusable-organization" | "gitlab";
|
|
600
682
|
claims: {
|
|
601
|
-
[key: string]: string;
|
|
683
|
+
[key: string]: string | string[];
|
|
602
684
|
};
|
|
603
685
|
issuer?: string | null;
|
|
686
|
+
scope?: {
|
|
687
|
+
[key: string]: "access-manager" | "auditor" | "developer" | "maintainer" | "owner" | "viewer";
|
|
688
|
+
};
|
|
604
689
|
label?: string | null;
|
|
605
690
|
replaces?: string[];
|
|
606
691
|
};
|
|
@@ -609,7 +694,10 @@ export type Api = {
|
|
|
609
694
|
issuer: string;
|
|
610
695
|
jwksUri: string;
|
|
611
696
|
claims: {
|
|
612
|
-
[key: string]: string;
|
|
697
|
+
[key: string]: string | string[];
|
|
698
|
+
};
|
|
699
|
+
scope: {
|
|
700
|
+
[key: string]: "access-manager" | "auditor" | "developer" | "maintainer" | "owner" | "viewer";
|
|
613
701
|
};
|
|
614
702
|
replaces: {
|
|
615
703
|
id: string;
|
|
@@ -622,7 +710,10 @@ export type Api = {
|
|
|
622
710
|
issuer: string;
|
|
623
711
|
jwksUri: string;
|
|
624
712
|
claims: {
|
|
625
|
-
[key: string]: string;
|
|
713
|
+
[key: string]: string | string[];
|
|
714
|
+
};
|
|
715
|
+
scope: null | {
|
|
716
|
+
[key: string]: "access-manager" | "auditor" | "developer" | "maintainer" | "owner" | "viewer";
|
|
626
717
|
};
|
|
627
718
|
label: string | null;
|
|
628
719
|
createdAt: string;
|
|
@@ -904,6 +995,8 @@ export type Api = {
|
|
|
904
995
|
label: string;
|
|
905
996
|
value: string;
|
|
906
997
|
kind?: "mono" | "time";
|
|
998
|
+
note?: string;
|
|
999
|
+
warn?: true;
|
|
907
1000
|
}[];
|
|
908
1001
|
asks: null | {
|
|
909
1002
|
value: {
|
|
@@ -912,7 +1005,10 @@ export type Api = {
|
|
|
912
1005
|
};
|
|
913
1006
|
};
|
|
914
1007
|
kind: "change" | "reveal";
|
|
1008
|
+
reveals: boolean;
|
|
915
1009
|
digest: string;
|
|
1010
|
+
basis: string | null;
|
|
1011
|
+
ready: boolean;
|
|
916
1012
|
createdAt: string;
|
|
917
1013
|
expiresAt: string;
|
|
918
1014
|
outcome: null | {
|
|
@@ -929,6 +1025,7 @@ export type Api = {
|
|
|
929
1025
|
input: {
|
|
930
1026
|
approve: boolean;
|
|
931
1027
|
digest: string;
|
|
1028
|
+
basis?: string | null;
|
|
932
1029
|
value?: string;
|
|
933
1030
|
};
|
|
934
1031
|
output: {
|
|
@@ -944,9 +1041,91 @@ export type Api = {
|
|
|
944
1041
|
label: string;
|
|
945
1042
|
value: string;
|
|
946
1043
|
kind?: "mono" | "time";
|
|
1044
|
+
note?: string;
|
|
1045
|
+
warn?: true;
|
|
947
1046
|
}[];
|
|
948
1047
|
};
|
|
949
1048
|
};
|
|
1049
|
+
"GET /members/:member/access": {
|
|
1050
|
+
input: undefined;
|
|
1051
|
+
output: {
|
|
1052
|
+
member: string;
|
|
1053
|
+
principalType: "service" | "user";
|
|
1054
|
+
principalId: string;
|
|
1055
|
+
status: "active" | "removed" | "tampered";
|
|
1056
|
+
instanceRole: "admin" | "auditor" | "developer" | "member" | "owner" | "root-admin";
|
|
1057
|
+
scope: null | {
|
|
1058
|
+
projects: "all" | {
|
|
1059
|
+
only: string[];
|
|
1060
|
+
} | {
|
|
1061
|
+
except: string[];
|
|
1062
|
+
};
|
|
1063
|
+
environments: "all" | {
|
|
1064
|
+
only: string[];
|
|
1065
|
+
} | {
|
|
1066
|
+
except: string[];
|
|
1067
|
+
};
|
|
1068
|
+
};
|
|
1069
|
+
isRootAdmin: boolean;
|
|
1070
|
+
managed: boolean;
|
|
1071
|
+
grants: {
|
|
1072
|
+
id: string;
|
|
1073
|
+
project: string;
|
|
1074
|
+
environment: string | null;
|
|
1075
|
+
role: "access-manager" | "auditor" | "developer" | "maintainer" | "owner" | "viewer";
|
|
1076
|
+
roleName: string;
|
|
1077
|
+
permissions: ("audit.read" | "environment.manage" | "grant.manage" | "project.manage" | "secret.archive" | "secret.read" | "secret.write")[];
|
|
1078
|
+
expiresAt: string | null;
|
|
1079
|
+
}[];
|
|
1080
|
+
};
|
|
1081
|
+
};
|
|
1082
|
+
"PUT /settings": {
|
|
1083
|
+
input: {
|
|
1084
|
+
serviceAccounts: {
|
|
1085
|
+
projects?: "all" | {
|
|
1086
|
+
only: string[];
|
|
1087
|
+
} | {
|
|
1088
|
+
except: string[];
|
|
1089
|
+
};
|
|
1090
|
+
environments?: "all" | {
|
|
1091
|
+
only: string[];
|
|
1092
|
+
} | {
|
|
1093
|
+
except: string[];
|
|
1094
|
+
};
|
|
1095
|
+
};
|
|
1096
|
+
};
|
|
1097
|
+
output: {
|
|
1098
|
+
serviceAccounts: {
|
|
1099
|
+
projects: "all" | {
|
|
1100
|
+
only: string[];
|
|
1101
|
+
} | {
|
|
1102
|
+
except: string[];
|
|
1103
|
+
};
|
|
1104
|
+
environments: "all" | {
|
|
1105
|
+
only: string[];
|
|
1106
|
+
} | {
|
|
1107
|
+
except: string[];
|
|
1108
|
+
};
|
|
1109
|
+
};
|
|
1110
|
+
};
|
|
1111
|
+
};
|
|
1112
|
+
"GET /settings": {
|
|
1113
|
+
input: undefined;
|
|
1114
|
+
output: {
|
|
1115
|
+
serviceAccounts: {
|
|
1116
|
+
projects: "all" | {
|
|
1117
|
+
only: string[];
|
|
1118
|
+
} | {
|
|
1119
|
+
except: string[];
|
|
1120
|
+
};
|
|
1121
|
+
environments: "all" | {
|
|
1122
|
+
only: string[];
|
|
1123
|
+
} | {
|
|
1124
|
+
except: string[];
|
|
1125
|
+
};
|
|
1126
|
+
};
|
|
1127
|
+
};
|
|
1128
|
+
};
|
|
950
1129
|
};
|
|
951
1130
|
|
|
952
1131
|
export type AccessValue = "access-manager" | "auditor" | "developer" | "maintainer" | "owner" | "viewer" | null | {
|
|
@@ -968,6 +1147,8 @@ export type ApprovalView = {
|
|
|
968
1147
|
label: string;
|
|
969
1148
|
value: string;
|
|
970
1149
|
kind?: "mono" | "time";
|
|
1150
|
+
note?: string;
|
|
1151
|
+
warn?: true;
|
|
971
1152
|
}[];
|
|
972
1153
|
asks: null | {
|
|
973
1154
|
value: {
|
|
@@ -976,7 +1157,10 @@ export type ApprovalView = {
|
|
|
976
1157
|
};
|
|
977
1158
|
};
|
|
978
1159
|
kind: "change" | "reveal";
|
|
1160
|
+
reveals: boolean;
|
|
979
1161
|
digest: string;
|
|
1162
|
+
basis: string | null;
|
|
1163
|
+
ready: boolean;
|
|
980
1164
|
createdAt: string;
|
|
981
1165
|
expiresAt: string;
|
|
982
1166
|
outcome: null | {
|
|
@@ -1059,7 +1243,10 @@ export type BindingPlan = {
|
|
|
1059
1243
|
issuer: string;
|
|
1060
1244
|
jwksUri: string;
|
|
1061
1245
|
claims: {
|
|
1062
|
-
[key: string]: string;
|
|
1246
|
+
[key: string]: string | string[];
|
|
1247
|
+
};
|
|
1248
|
+
scope: {
|
|
1249
|
+
[key: string]: "access-manager" | "auditor" | "developer" | "maintainer" | "owner" | "viewer";
|
|
1063
1250
|
};
|
|
1064
1251
|
replaces: {
|
|
1065
1252
|
id: string;
|
|
@@ -1073,7 +1260,10 @@ export type BindingView = {
|
|
|
1073
1260
|
issuer: string;
|
|
1074
1261
|
jwksUri: string;
|
|
1075
1262
|
claims: {
|
|
1076
|
-
[key: string]: string;
|
|
1263
|
+
[key: string]: string | string[];
|
|
1264
|
+
};
|
|
1265
|
+
scope: null | {
|
|
1266
|
+
[key: string]: "access-manager" | "auditor" | "developer" | "maintainer" | "owner" | "viewer";
|
|
1077
1267
|
};
|
|
1078
1268
|
label: string | null;
|
|
1079
1269
|
createdAt: string;
|
|
@@ -1124,6 +1314,8 @@ export type Decision = {
|
|
|
1124
1314
|
label: string;
|
|
1125
1315
|
value: string;
|
|
1126
1316
|
kind?: "mono" | "time";
|
|
1317
|
+
note?: string;
|
|
1318
|
+
warn?: true;
|
|
1127
1319
|
}[];
|
|
1128
1320
|
};
|
|
1129
1321
|
|
|
@@ -1183,14 +1375,6 @@ export type IdentityRow = {
|
|
|
1183
1375
|
lastSignInAt: string | null;
|
|
1184
1376
|
};
|
|
1185
1377
|
|
|
1186
|
-
export type InheritedGrant = {
|
|
1187
|
-
member: string;
|
|
1188
|
-
place: string;
|
|
1189
|
-
role: "access-manager" | "auditor" | "developer" | "maintainer" | "owner" | "viewer";
|
|
1190
|
-
roleName: string;
|
|
1191
|
-
expiresAt: string | null;
|
|
1192
|
-
};
|
|
1193
|
-
|
|
1194
1378
|
export type Me = {
|
|
1195
1379
|
principal: {
|
|
1196
1380
|
type: "service" | "user";
|
|
@@ -1198,9 +1382,35 @@ export type Me = {
|
|
|
1198
1382
|
};
|
|
1199
1383
|
registered: boolean;
|
|
1200
1384
|
tampered: boolean;
|
|
1201
|
-
instanceRole: "
|
|
1385
|
+
instanceRole: "admin" | "auditor" | "developer" | "member" | "owner" | "root-admin";
|
|
1386
|
+
scope: {
|
|
1387
|
+
projects: "all" | {
|
|
1388
|
+
only: string[];
|
|
1389
|
+
} | {
|
|
1390
|
+
except: string[];
|
|
1391
|
+
};
|
|
1392
|
+
environments: "all" | {
|
|
1393
|
+
only: string[];
|
|
1394
|
+
} | {
|
|
1395
|
+
except: string[];
|
|
1396
|
+
};
|
|
1397
|
+
};
|
|
1202
1398
|
isRootAdmin: boolean;
|
|
1399
|
+
runsInstance: boolean;
|
|
1203
1400
|
canReadAudit: boolean;
|
|
1401
|
+
setsUpServices: boolean;
|
|
1402
|
+
serviceSetup: null | {
|
|
1403
|
+
projects: "all" | {
|
|
1404
|
+
only: string[];
|
|
1405
|
+
} | {
|
|
1406
|
+
except: string[];
|
|
1407
|
+
};
|
|
1408
|
+
environments: "all" | {
|
|
1409
|
+
only: string[];
|
|
1410
|
+
} | {
|
|
1411
|
+
except: string[];
|
|
1412
|
+
};
|
|
1413
|
+
};
|
|
1204
1414
|
features: {
|
|
1205
1415
|
mcp: string | null;
|
|
1206
1416
|
workloads: boolean;
|
|
@@ -1216,7 +1426,21 @@ export type Member = {
|
|
|
1216
1426
|
member: string;
|
|
1217
1427
|
principalType: "service" | "user";
|
|
1218
1428
|
principalId: string;
|
|
1219
|
-
instanceRole: "
|
|
1429
|
+
instanceRole: "admin" | "auditor" | "developer" | "member" | "owner" | "root-admin";
|
|
1430
|
+
scope: null | {
|
|
1431
|
+
projects: "all" | {
|
|
1432
|
+
only: string[];
|
|
1433
|
+
} | {
|
|
1434
|
+
except: string[];
|
|
1435
|
+
};
|
|
1436
|
+
environments: "all" | {
|
|
1437
|
+
only: string[];
|
|
1438
|
+
} | {
|
|
1439
|
+
except: string[];
|
|
1440
|
+
};
|
|
1441
|
+
};
|
|
1442
|
+
reachesByRole: boolean;
|
|
1443
|
+
managed: boolean;
|
|
1220
1444
|
isRootAdmin: boolean;
|
|
1221
1445
|
tampered: boolean;
|
|
1222
1446
|
grants: {
|
|
@@ -1230,6 +1454,52 @@ export type Member = {
|
|
|
1230
1454
|
}[];
|
|
1231
1455
|
};
|
|
1232
1456
|
|
|
1457
|
+
export type MemberAccess = {
|
|
1458
|
+
member: string;
|
|
1459
|
+
principalType: "service" | "user";
|
|
1460
|
+
principalId: string;
|
|
1461
|
+
status: "active" | "removed" | "tampered";
|
|
1462
|
+
instanceRole: "admin" | "auditor" | "developer" | "member" | "owner" | "root-admin";
|
|
1463
|
+
scope: null | {
|
|
1464
|
+
projects: "all" | {
|
|
1465
|
+
only: string[];
|
|
1466
|
+
} | {
|
|
1467
|
+
except: string[];
|
|
1468
|
+
};
|
|
1469
|
+
environments: "all" | {
|
|
1470
|
+
only: string[];
|
|
1471
|
+
} | {
|
|
1472
|
+
except: string[];
|
|
1473
|
+
};
|
|
1474
|
+
};
|
|
1475
|
+
isRootAdmin: boolean;
|
|
1476
|
+
managed: boolean;
|
|
1477
|
+
grants: {
|
|
1478
|
+
id: string;
|
|
1479
|
+
project: string;
|
|
1480
|
+
environment: string | null;
|
|
1481
|
+
role: "access-manager" | "auditor" | "developer" | "maintainer" | "owner" | "viewer";
|
|
1482
|
+
roleName: string;
|
|
1483
|
+
permissions: ("audit.read" | "environment.manage" | "grant.manage" | "project.manage" | "secret.archive" | "secret.read" | "secret.write")[];
|
|
1484
|
+
expiresAt: string | null;
|
|
1485
|
+
}[];
|
|
1486
|
+
};
|
|
1487
|
+
|
|
1488
|
+
export type SettingsView = {
|
|
1489
|
+
serviceAccounts: {
|
|
1490
|
+
projects: "all" | {
|
|
1491
|
+
only: string[];
|
|
1492
|
+
} | {
|
|
1493
|
+
except: string[];
|
|
1494
|
+
};
|
|
1495
|
+
environments: "all" | {
|
|
1496
|
+
only: string[];
|
|
1497
|
+
} | {
|
|
1498
|
+
except: string[];
|
|
1499
|
+
};
|
|
1500
|
+
};
|
|
1501
|
+
};
|
|
1502
|
+
|
|
1233
1503
|
export type MissingKey = {
|
|
1234
1504
|
key: string;
|
|
1235
1505
|
in: string[];
|
|
@@ -1240,7 +1510,19 @@ export type OffboardingReport = {
|
|
|
1240
1510
|
principalType: "service" | "user";
|
|
1241
1511
|
principalId: string;
|
|
1242
1512
|
status: "active" | "removed" | "tampered";
|
|
1243
|
-
instanceRole: "
|
|
1513
|
+
instanceRole: "admin" | "auditor" | "developer" | "member" | "owner" | "root-admin";
|
|
1514
|
+
scope: {
|
|
1515
|
+
projects: "all" | {
|
|
1516
|
+
only: string[];
|
|
1517
|
+
} | {
|
|
1518
|
+
except: string[];
|
|
1519
|
+
};
|
|
1520
|
+
environments: "all" | {
|
|
1521
|
+
only: string[];
|
|
1522
|
+
} | {
|
|
1523
|
+
except: string[];
|
|
1524
|
+
};
|
|
1525
|
+
};
|
|
1244
1526
|
isRootAdmin: boolean;
|
|
1245
1527
|
removedAt: string | null;
|
|
1246
1528
|
removedBy: string | null;
|
|
@@ -1267,6 +1549,9 @@ export type OffboardingReport = {
|
|
|
1267
1549
|
hint: string;
|
|
1268
1550
|
expiresAt: string;
|
|
1269
1551
|
lastUsedAt: string | null;
|
|
1552
|
+
scope: null | {
|
|
1553
|
+
[key: string]: "access-manager" | "auditor" | "developer" | "maintainer" | "owner" | "viewer";
|
|
1554
|
+
};
|
|
1270
1555
|
}[];
|
|
1271
1556
|
apps: {
|
|
1272
1557
|
id: string;
|
|
@@ -1381,6 +1666,9 @@ export type ServiceTokenRow = {
|
|
|
1381
1666
|
expiresAt: string;
|
|
1382
1667
|
lastUsedAt: string | null;
|
|
1383
1668
|
lastUsedIp: string | null;
|
|
1669
|
+
scope: null | {
|
|
1670
|
+
[key: string]: "access-manager" | "auditor" | "developer" | "maintainer" | "owner" | "viewer";
|
|
1671
|
+
};
|
|
1384
1672
|
};
|
|
1385
1673
|
|
|
1386
1674
|
export type SessionRow = {
|
|
@@ -1408,3 +1696,9 @@ export type SetResult = {
|
|
|
1408
1696
|
};
|
|
1409
1697
|
};
|
|
1410
1698
|
};
|
|
1699
|
+
|
|
1700
|
+
export type TokenPlan = {
|
|
1701
|
+
scope: {
|
|
1702
|
+
[key: string]: "access-manager" | "auditor" | "developer" | "maintainer" | "owner" | "viewer";
|
|
1703
|
+
};
|
|
1704
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* its own handling of Cloudflare Access redirects. A request that never
|
|
11
11
|
* reaches the instance throws `Unreachable`, which says why.
|
|
12
12
|
*/
|
|
13
|
-
import type { Api, AuthInfo, BindingPlan, BindingView, DeletionResult, DryRunOutcome, DryRunResult, SetResult } from './api.ts';
|
|
13
|
+
import type { Api, AuthInfo, BindingPlan, BindingView, DeletionResult, DryRunOutcome, DryRunResult, SetResult, TokenPlan } from './api.ts';
|
|
14
14
|
import { Unreachable } from './reach.ts';
|
|
15
15
|
|
|
16
16
|
export type {
|
|
@@ -30,10 +30,10 @@ export type {
|
|
|
30
30
|
DryRunOutcome,
|
|
31
31
|
DryRunResult,
|
|
32
32
|
IdentityRow,
|
|
33
|
-
InheritedGrant,
|
|
34
33
|
ListedReference,
|
|
35
34
|
Me,
|
|
36
35
|
Member,
|
|
36
|
+
MemberAccess,
|
|
37
37
|
MissingKey,
|
|
38
38
|
OffboardingReport,
|
|
39
39
|
ProjectSummary,
|
|
@@ -44,6 +44,7 @@ export type {
|
|
|
44
44
|
ServiceTokenRow,
|
|
45
45
|
SessionRow,
|
|
46
46
|
SetResult,
|
|
47
|
+
TokenPlan,
|
|
47
48
|
WorkloadIds,
|
|
48
49
|
} from './api.ts';
|
|
49
50
|
|
|
@@ -246,6 +247,8 @@ export function createClient(options: ClientOptions) {
|
|
|
246
247
|
list: (path?: string) => call('GET /members', {}, { path }),
|
|
247
248
|
/** What they hold, and what to rotate if they leave. */
|
|
248
249
|
get: (member: string) => call('GET /members/:member', { member }),
|
|
250
|
+
/** Their instance role and scope, and the grants you manage, in one read. */
|
|
251
|
+
access: (member: string) => call('GET /members/:member/access', { member }),
|
|
249
252
|
add: (member: string, input: RouteInput<'PUT /members/:member'> = {}) =>
|
|
250
253
|
call('PUT /members/:member', { member }, input),
|
|
251
254
|
/** Offboards; returns what to rotate. */
|
|
@@ -254,9 +257,14 @@ export function createClient(options: ClientOptions) {
|
|
|
254
257
|
|
|
255
258
|
tokens: {
|
|
256
259
|
list: (member: string) => call('GET /members/:member/tokens', { member }),
|
|
260
|
+
/** What the token would reach, as the server would issue it now; issues nothing. */
|
|
261
|
+
preview: (member: string, input: RouteInput<'POST /members/:member/tokens'>) => {
|
|
262
|
+
const [method, route] = address('POST /members/:member/tokens', { member });
|
|
263
|
+
return send(method, `${route}?dryRun=1`, input) as Promise<TokenPlan>;
|
|
264
|
+
},
|
|
257
265
|
/** The value is in the answer, and only there. */
|
|
258
266
|
issue: (member: string, input: RouteInput<'POST /members/:member/tokens'>) =>
|
|
259
|
-
call('POST /members/:member/tokens', { member }, input)
|
|
267
|
+
call('POST /members/:member/tokens', { member }, input) as Promise<Extract<RouteOutput<'POST /members/:member/tokens'>, { token: string }>>,
|
|
260
268
|
revoke: (member: string, id: string) => call('DELETE /members/:member/tokens/:id', { member, id }),
|
|
261
269
|
},
|
|
262
270
|
|
|
@@ -344,6 +352,12 @@ export function createClient(options: ClientOptions) {
|
|
|
344
352
|
disconnect: (id: string) => call('DELETE /apps/:id', { id }),
|
|
345
353
|
},
|
|
346
354
|
|
|
355
|
+
/** The instance's settings, for those who run it: where people set up service accounts themselves. */
|
|
356
|
+
settings: {
|
|
357
|
+
get: () => call('GET /settings', {}),
|
|
358
|
+
set: (input: RouteInput<'PUT /settings'>) => call('PUT /settings', {}, input),
|
|
359
|
+
},
|
|
360
|
+
|
|
347
361
|
audit: {
|
|
348
362
|
list: (query: RouteInput<'GET /audit'> = {}) => call('GET /audit', {}, query),
|
|
349
363
|
verify: () => call('GET /audit/verification', {}),
|