@coffre/client 0.1.15 → 0.1.16
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-DT6UT5Jx.d.ts → index-BPCoQXwT.d.ts} +168 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +16 -0
- package/dist/routes.d.ts +1 -1
- package/dist/routes.js +9 -0
- package/package.json +1 -1
- package/src/api.ts +127 -0
- package/src/index.ts +19 -1
- package/src/routes.ts +6 -0
|
@@ -328,6 +328,84 @@ type Api = {
|
|
|
328
328
|
revoked: true;
|
|
329
329
|
};
|
|
330
330
|
};
|
|
331
|
+
"GET /members/:member/bindings": {
|
|
332
|
+
input: undefined;
|
|
333
|
+
output: {
|
|
334
|
+
bindings: {
|
|
335
|
+
id: string;
|
|
336
|
+
profile: "custom" | "github" | "github-reusable" | "github-reusable-organization" | "gitlab";
|
|
337
|
+
issuer: string;
|
|
338
|
+
jwksUri: string;
|
|
339
|
+
claims: {
|
|
340
|
+
[key: string]: string;
|
|
341
|
+
};
|
|
342
|
+
label: string | null;
|
|
343
|
+
createdAt: string;
|
|
344
|
+
createdBy: string;
|
|
345
|
+
lastUsedAt: string | null;
|
|
346
|
+
}[];
|
|
347
|
+
};
|
|
348
|
+
};
|
|
349
|
+
"POST /members/:member/bindings": {
|
|
350
|
+
input: {
|
|
351
|
+
profile: "custom" | "github" | "github-reusable" | "github-reusable-organization" | "gitlab";
|
|
352
|
+
claims: {
|
|
353
|
+
[key: string]: string;
|
|
354
|
+
};
|
|
355
|
+
issuer?: string | null;
|
|
356
|
+
label?: string | null;
|
|
357
|
+
replaces?: string[];
|
|
358
|
+
};
|
|
359
|
+
output: {
|
|
360
|
+
profile: "custom" | "github" | "github-reusable" | "github-reusable-organization" | "gitlab";
|
|
361
|
+
issuer: string;
|
|
362
|
+
jwksUri: string;
|
|
363
|
+
claims: {
|
|
364
|
+
[key: string]: string;
|
|
365
|
+
};
|
|
366
|
+
replaces: {
|
|
367
|
+
id: string;
|
|
368
|
+
why: "asked" | "keys_moved";
|
|
369
|
+
}[];
|
|
370
|
+
} | {
|
|
371
|
+
binding: {
|
|
372
|
+
id: string;
|
|
373
|
+
profile: "custom" | "github" | "github-reusable" | "github-reusable-organization" | "gitlab";
|
|
374
|
+
issuer: string;
|
|
375
|
+
jwksUri: string;
|
|
376
|
+
claims: {
|
|
377
|
+
[key: string]: string;
|
|
378
|
+
};
|
|
379
|
+
label: string | null;
|
|
380
|
+
createdAt: string;
|
|
381
|
+
createdBy: string;
|
|
382
|
+
lastUsedAt: string | null;
|
|
383
|
+
};
|
|
384
|
+
replaced: string[];
|
|
385
|
+
};
|
|
386
|
+
};
|
|
387
|
+
"GET /workloads/lookup": {
|
|
388
|
+
input: {
|
|
389
|
+
github?: string;
|
|
390
|
+
gitlab?: string;
|
|
391
|
+
gitlabUrl?: string;
|
|
392
|
+
};
|
|
393
|
+
output: {
|
|
394
|
+
github: string;
|
|
395
|
+
repositoryId: string;
|
|
396
|
+
ownerId: string;
|
|
397
|
+
} | {
|
|
398
|
+
gitlab: string;
|
|
399
|
+
projectId: string;
|
|
400
|
+
namespaceId: string;
|
|
401
|
+
};
|
|
402
|
+
};
|
|
403
|
+
"DELETE /members/:member/bindings/:id": {
|
|
404
|
+
input: undefined;
|
|
405
|
+
output: {
|
|
406
|
+
unbound: true;
|
|
407
|
+
};
|
|
408
|
+
};
|
|
331
409
|
"PATCH /access/:member": {
|
|
332
410
|
input: {
|
|
333
411
|
[key: string]: "access-manager" | "auditor" | "developer" | "maintainer" | "owner" | "viewer" | null | {
|
|
@@ -431,6 +509,12 @@ type Api = {
|
|
|
431
509
|
operationId: string | null;
|
|
432
510
|
relatedSeq: number | null;
|
|
433
511
|
requestId: string | null;
|
|
512
|
+
run: null | {
|
|
513
|
+
exchangeSeq: number;
|
|
514
|
+
claims: {
|
|
515
|
+
[key: string]: string | number;
|
|
516
|
+
};
|
|
517
|
+
};
|
|
434
518
|
metadata: {
|
|
435
519
|
[key: string]: unknown;
|
|
436
520
|
};
|
|
@@ -504,6 +588,12 @@ type AuditEntryView = {
|
|
|
504
588
|
operationId: string | null;
|
|
505
589
|
relatedSeq: number | null;
|
|
506
590
|
requestId: string | null;
|
|
591
|
+
run: null | {
|
|
592
|
+
exchangeSeq: number;
|
|
593
|
+
claims: {
|
|
594
|
+
[key: string]: string | number;
|
|
595
|
+
};
|
|
596
|
+
};
|
|
507
597
|
metadata: {
|
|
508
598
|
[key: string]: unknown;
|
|
509
599
|
};
|
|
@@ -522,6 +612,40 @@ type AuthInfo = {
|
|
|
522
612
|
assertion: boolean;
|
|
523
613
|
};
|
|
524
614
|
};
|
|
615
|
+
type BindingPlan = {
|
|
616
|
+
profile: "custom" | "github" | "github-reusable" | "github-reusable-organization" | "gitlab";
|
|
617
|
+
issuer: string;
|
|
618
|
+
jwksUri: string;
|
|
619
|
+
claims: {
|
|
620
|
+
[key: string]: string;
|
|
621
|
+
};
|
|
622
|
+
replaces: {
|
|
623
|
+
id: string;
|
|
624
|
+
why: "asked" | "keys_moved";
|
|
625
|
+
}[];
|
|
626
|
+
};
|
|
627
|
+
type BindingView = {
|
|
628
|
+
id: string;
|
|
629
|
+
profile: "custom" | "github" | "github-reusable" | "github-reusable-organization" | "gitlab";
|
|
630
|
+
issuer: string;
|
|
631
|
+
jwksUri: string;
|
|
632
|
+
claims: {
|
|
633
|
+
[key: string]: string;
|
|
634
|
+
};
|
|
635
|
+
label: string | null;
|
|
636
|
+
createdAt: string;
|
|
637
|
+
createdBy: string;
|
|
638
|
+
lastUsedAt: string | null;
|
|
639
|
+
};
|
|
640
|
+
type WorkloadIds = {
|
|
641
|
+
github: string;
|
|
642
|
+
repositoryId: string;
|
|
643
|
+
ownerId: string;
|
|
644
|
+
} | {
|
|
645
|
+
gitlab: string;
|
|
646
|
+
projectId: string;
|
|
647
|
+
namespaceId: string;
|
|
648
|
+
};
|
|
525
649
|
type DryRunOutcome = "added" | "archived" | "changed" | "unchanged";
|
|
526
650
|
type DryRunResult = {
|
|
527
651
|
dryRun: true;
|
|
@@ -979,6 +1103,43 @@ declare function createClient(options: ClientOptions): {
|
|
|
979
1103
|
revoked: true;
|
|
980
1104
|
}>;
|
|
981
1105
|
};
|
|
1106
|
+
/** Trust bindings: which CI runs may sign in as a service, by their platform's ID token. */
|
|
1107
|
+
bindings: {
|
|
1108
|
+
list: (member: string) => Promise<{
|
|
1109
|
+
bindings: {
|
|
1110
|
+
id: string;
|
|
1111
|
+
profile: "custom" | "github" | "github-reusable" | "github-reusable-organization" | "gitlab";
|
|
1112
|
+
issuer: string;
|
|
1113
|
+
jwksUri: string;
|
|
1114
|
+
claims: {
|
|
1115
|
+
[key: string]: string;
|
|
1116
|
+
};
|
|
1117
|
+
label: string | null;
|
|
1118
|
+
createdAt: string;
|
|
1119
|
+
createdBy: string;
|
|
1120
|
+
lastUsedAt: string | null;
|
|
1121
|
+
}[];
|
|
1122
|
+
}>;
|
|
1123
|
+
/** The binding as it would be saved, the keys its issuer names, and what it replaces; writes nothing. */
|
|
1124
|
+
preview: (member: string, input: RouteInput<"POST /members/:member/bindings">) => Promise<BindingPlan>;
|
|
1125
|
+
create: (member: string, input: RouteInput<"POST /members/:member/bindings">) => Promise<{
|
|
1126
|
+
binding: BindingView;
|
|
1127
|
+
replaced: string[];
|
|
1128
|
+
}>;
|
|
1129
|
+
remove: (member: string, id: string) => Promise<{
|
|
1130
|
+
unbound: true;
|
|
1131
|
+
}>;
|
|
1132
|
+
/** A public GitHub repository's or GitLab project's IDs, which bindings name. */
|
|
1133
|
+
lookup: (input: RouteInput<"GET /workloads/lookup">) => Promise<{
|
|
1134
|
+
github: string;
|
|
1135
|
+
repositoryId: string;
|
|
1136
|
+
ownerId: string;
|
|
1137
|
+
} | {
|
|
1138
|
+
gitlab: string;
|
|
1139
|
+
projectId: string;
|
|
1140
|
+
namespaceId: string;
|
|
1141
|
+
}>;
|
|
1142
|
+
};
|
|
982
1143
|
access: {
|
|
983
1144
|
/** What they should hold at each place; the server applies the difference. `null` revokes. */
|
|
984
1145
|
set: (member: string, access: RouteInput<"PATCH /access/:member">) => Promise<{
|
|
@@ -1058,6 +1219,12 @@ declare function createClient(options: ClientOptions): {
|
|
|
1058
1219
|
operationId: string | null;
|
|
1059
1220
|
relatedSeq: number | null;
|
|
1060
1221
|
requestId: string | null;
|
|
1222
|
+
run: null | {
|
|
1223
|
+
exchangeSeq: number;
|
|
1224
|
+
claims: {
|
|
1225
|
+
[key: string]: string | number;
|
|
1226
|
+
};
|
|
1227
|
+
};
|
|
1061
1228
|
metadata: {
|
|
1062
1229
|
[key: string]: unknown;
|
|
1063
1230
|
};
|
|
@@ -1125,4 +1292,4 @@ declare function planImport(coffre: CoffreClient, path: string, entries: readonl
|
|
|
1125
1292
|
changes: Record<string, string>;
|
|
1126
1293
|
}>;
|
|
1127
1294
|
//#endregion
|
|
1128
|
-
export {
|
|
1295
|
+
export { SessionRow as A, Member as C, SecretKey as D, RemovedMember as E, WorkloadIds as M, SecretVersion as O, Me as S, ProjectSummary as T, BindingView as _, Params as a, IdentityRow as b, RouteOutput as c, planImport as d, AccessValue as f, BindingPlan as g, AuthInfo as h, ImportAction as i, SetResult as j, ServiceTokenRow as k, Transport as l, AuditEntryView as m, CoffreClient as n, RouteInput as o, Api as p, CoffreError as r, RouteKey as s, ClientOptions as t, createClient as u, DryRunOutcome as v, OffboardingReport as w, InstanceState as x, DryRunResult as y };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
export { type AccessValue, type Api, type AuditEntryView, type AuthInfo, ClientOptions, CoffreClient, CoffreError, type DryRunOutcome, type DryRunResult, type IdentityRow, ImportAction, type InstanceState, type Me, type Member, type OffboardingReport, Params, type ProjectSummary, type RemovedMember, RouteInput, RouteKey, RouteOutput, type SecretKey, type SecretVersion, type ServiceTokenRow, type SessionRow, type SetResult, Transport, createClient, planImport };
|
|
1
|
+
import { A as SessionRow, C as Member, D as SecretKey, E as RemovedMember, M as WorkloadIds, O as SecretVersion, S as Me, T as ProjectSummary, _ as BindingView, a as Params, b as IdentityRow, c as RouteOutput, d as planImport, f as AccessValue, g as BindingPlan, h as AuthInfo, i as ImportAction, j as SetResult, k as ServiceTokenRow, l as Transport, m as AuditEntryView, n as CoffreClient, o as RouteInput, p as Api, r as CoffreError, s as RouteKey, t as ClientOptions, u as createClient, v as DryRunOutcome, w as OffboardingReport, x as InstanceState, y as DryRunResult } from "./index-BPCoQXwT.js";
|
|
2
|
+
export { type AccessValue, type Api, type AuditEntryView, type AuthInfo, type BindingPlan, type BindingView, ClientOptions, CoffreClient, CoffreError, type DryRunOutcome, type DryRunResult, type IdentityRow, ImportAction, type InstanceState, type Me, type Member, type OffboardingReport, Params, type ProjectSummary, type RemovedMember, RouteInput, RouteKey, RouteOutput, type SecretKey, type SecretVersion, type ServiceTokenRow, type SessionRow, type SetResult, Transport, type WorkloadIds, createClient, planImport };
|
package/dist/index.js
CHANGED
|
@@ -123,6 +123,22 @@ function createClient(options) {
|
|
|
123
123
|
id
|
|
124
124
|
})
|
|
125
125
|
},
|
|
126
|
+
/** Trust bindings: which CI runs may sign in as a service, by their platform's ID token. */
|
|
127
|
+
bindings: {
|
|
128
|
+
list: (member) => call("GET /members/:member/bindings", { member }),
|
|
129
|
+
/** The binding as it would be saved, the keys its issuer names, and what it replaces; writes nothing. */
|
|
130
|
+
preview: (member, input) => {
|
|
131
|
+
const [method, route] = address("POST /members/:member/bindings", { member });
|
|
132
|
+
return send(method, `${route}?dryRun=1`, input);
|
|
133
|
+
},
|
|
134
|
+
create: (member, input) => call("POST /members/:member/bindings", { member }, input),
|
|
135
|
+
remove: (member, id) => call("DELETE /members/:member/bindings/:id", {
|
|
136
|
+
member,
|
|
137
|
+
id
|
|
138
|
+
}),
|
|
139
|
+
/** A public GitHub repository's or GitLab project's IDs, which bindings name. */
|
|
140
|
+
lookup: (input) => call("GET /workloads/lookup", {}, input)
|
|
141
|
+
},
|
|
126
142
|
access: {
|
|
127
143
|
/** What they should hold at each place; the server applies the difference. `null` revokes. */
|
|
128
144
|
set: (member, access) => call("PATCH /access/:member", { member }, access) },
|
package/dist/routes.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as Params, o as RouteInput, s as RouteKey } from "./index-
|
|
1
|
+
import { a as Params, o as RouteInput, s as RouteKey } from "./index-BPCoQXwT.js";
|
|
2
2
|
//#region src/routes.d.ts
|
|
3
3
|
export type GetKey = Extract<RouteKey, `GET ${string}`>;
|
|
4
4
|
/** Each GET route, with what to ask it. */
|
package/dist/routes.js
CHANGED
|
@@ -12,6 +12,11 @@ function getCalls({ places, secrets, members, services }) {
|
|
|
12
12
|
}]],
|
|
13
13
|
"GET /members/:member": members.map((member) => ({ params: { member } })),
|
|
14
14
|
"GET /members/:member/tokens": services.map((member) => ({ params: { member } })),
|
|
15
|
+
"GET /members/:member/bindings": services.map((member) => ({ params: { member } })),
|
|
16
|
+
"GET /workloads/lookup": [{
|
|
17
|
+
params: {},
|
|
18
|
+
input: { github: "acme/api" }
|
|
19
|
+
}],
|
|
15
20
|
"GET /sessions": [{ params: {} }],
|
|
16
21
|
"GET /identities": [{ params: {} }],
|
|
17
22
|
"GET /device-logins/:code": [{ params: { code: "BCDF-GHJK" } }],
|
|
@@ -59,6 +64,10 @@ const EVERY_ROUTE = {
|
|
|
59
64
|
"GET /members/:member/tokens": true,
|
|
60
65
|
"POST /members/:member/tokens": true,
|
|
61
66
|
"DELETE /members/:member/tokens/:id": true,
|
|
67
|
+
"GET /members/:member/bindings": true,
|
|
68
|
+
"POST /members/:member/bindings": true,
|
|
69
|
+
"DELETE /members/:member/bindings/:id": true,
|
|
70
|
+
"GET /workloads/lookup": true,
|
|
62
71
|
"PATCH /access/:member": true,
|
|
63
72
|
"GET /sessions": true,
|
|
64
73
|
"DELETE /sessions/:id": true,
|
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -331,6 +331,84 @@ export type Api = {
|
|
|
331
331
|
revoked: true;
|
|
332
332
|
};
|
|
333
333
|
};
|
|
334
|
+
"GET /members/:member/bindings": {
|
|
335
|
+
input: undefined;
|
|
336
|
+
output: {
|
|
337
|
+
bindings: {
|
|
338
|
+
id: string;
|
|
339
|
+
profile: "custom" | "github" | "github-reusable" | "github-reusable-organization" | "gitlab";
|
|
340
|
+
issuer: string;
|
|
341
|
+
jwksUri: string;
|
|
342
|
+
claims: {
|
|
343
|
+
[key: string]: string;
|
|
344
|
+
};
|
|
345
|
+
label: string | null;
|
|
346
|
+
createdAt: string;
|
|
347
|
+
createdBy: string;
|
|
348
|
+
lastUsedAt: string | null;
|
|
349
|
+
}[];
|
|
350
|
+
};
|
|
351
|
+
};
|
|
352
|
+
"POST /members/:member/bindings": {
|
|
353
|
+
input: {
|
|
354
|
+
profile: "custom" | "github" | "github-reusable" | "github-reusable-organization" | "gitlab";
|
|
355
|
+
claims: {
|
|
356
|
+
[key: string]: string;
|
|
357
|
+
};
|
|
358
|
+
issuer?: string | null;
|
|
359
|
+
label?: string | null;
|
|
360
|
+
replaces?: string[];
|
|
361
|
+
};
|
|
362
|
+
output: {
|
|
363
|
+
profile: "custom" | "github" | "github-reusable" | "github-reusable-organization" | "gitlab";
|
|
364
|
+
issuer: string;
|
|
365
|
+
jwksUri: string;
|
|
366
|
+
claims: {
|
|
367
|
+
[key: string]: string;
|
|
368
|
+
};
|
|
369
|
+
replaces: {
|
|
370
|
+
id: string;
|
|
371
|
+
why: "asked" | "keys_moved";
|
|
372
|
+
}[];
|
|
373
|
+
} | {
|
|
374
|
+
binding: {
|
|
375
|
+
id: string;
|
|
376
|
+
profile: "custom" | "github" | "github-reusable" | "github-reusable-organization" | "gitlab";
|
|
377
|
+
issuer: string;
|
|
378
|
+
jwksUri: string;
|
|
379
|
+
claims: {
|
|
380
|
+
[key: string]: string;
|
|
381
|
+
};
|
|
382
|
+
label: string | null;
|
|
383
|
+
createdAt: string;
|
|
384
|
+
createdBy: string;
|
|
385
|
+
lastUsedAt: string | null;
|
|
386
|
+
};
|
|
387
|
+
replaced: string[];
|
|
388
|
+
};
|
|
389
|
+
};
|
|
390
|
+
"GET /workloads/lookup": {
|
|
391
|
+
input: {
|
|
392
|
+
github?: string;
|
|
393
|
+
gitlab?: string;
|
|
394
|
+
gitlabUrl?: string;
|
|
395
|
+
};
|
|
396
|
+
output: {
|
|
397
|
+
github: string;
|
|
398
|
+
repositoryId: string;
|
|
399
|
+
ownerId: string;
|
|
400
|
+
} | {
|
|
401
|
+
gitlab: string;
|
|
402
|
+
projectId: string;
|
|
403
|
+
namespaceId: string;
|
|
404
|
+
};
|
|
405
|
+
};
|
|
406
|
+
"DELETE /members/:member/bindings/:id": {
|
|
407
|
+
input: undefined;
|
|
408
|
+
output: {
|
|
409
|
+
unbound: true;
|
|
410
|
+
};
|
|
411
|
+
};
|
|
334
412
|
"PATCH /access/:member": {
|
|
335
413
|
input: {
|
|
336
414
|
[key: string]: "access-manager" | "auditor" | "developer" | "maintainer" | "owner" | "viewer" | null | {
|
|
@@ -434,6 +512,12 @@ export type Api = {
|
|
|
434
512
|
operationId: string | null;
|
|
435
513
|
relatedSeq: number | null;
|
|
436
514
|
requestId: string | null;
|
|
515
|
+
run: null | {
|
|
516
|
+
exchangeSeq: number;
|
|
517
|
+
claims: {
|
|
518
|
+
[key: string]: string | number;
|
|
519
|
+
};
|
|
520
|
+
};
|
|
437
521
|
metadata: {
|
|
438
522
|
[key: string]: unknown;
|
|
439
523
|
};
|
|
@@ -509,6 +593,12 @@ export type AuditEntryView = {
|
|
|
509
593
|
operationId: string | null;
|
|
510
594
|
relatedSeq: number | null;
|
|
511
595
|
requestId: string | null;
|
|
596
|
+
run: null | {
|
|
597
|
+
exchangeSeq: number;
|
|
598
|
+
claims: {
|
|
599
|
+
[key: string]: string | number;
|
|
600
|
+
};
|
|
601
|
+
};
|
|
512
602
|
metadata: {
|
|
513
603
|
[key: string]: unknown;
|
|
514
604
|
};
|
|
@@ -529,6 +619,43 @@ export type AuthInfo = {
|
|
|
529
619
|
};
|
|
530
620
|
};
|
|
531
621
|
|
|
622
|
+
export type BindingPlan = {
|
|
623
|
+
profile: "custom" | "github" | "github-reusable" | "github-reusable-organization" | "gitlab";
|
|
624
|
+
issuer: string;
|
|
625
|
+
jwksUri: string;
|
|
626
|
+
claims: {
|
|
627
|
+
[key: string]: string;
|
|
628
|
+
};
|
|
629
|
+
replaces: {
|
|
630
|
+
id: string;
|
|
631
|
+
why: "asked" | "keys_moved";
|
|
632
|
+
}[];
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
export type BindingView = {
|
|
636
|
+
id: string;
|
|
637
|
+
profile: "custom" | "github" | "github-reusable" | "github-reusable-organization" | "gitlab";
|
|
638
|
+
issuer: string;
|
|
639
|
+
jwksUri: string;
|
|
640
|
+
claims: {
|
|
641
|
+
[key: string]: string;
|
|
642
|
+
};
|
|
643
|
+
label: string | null;
|
|
644
|
+
createdAt: string;
|
|
645
|
+
createdBy: string;
|
|
646
|
+
lastUsedAt: string | null;
|
|
647
|
+
};
|
|
648
|
+
|
|
649
|
+
export type WorkloadIds = {
|
|
650
|
+
github: string;
|
|
651
|
+
repositoryId: string;
|
|
652
|
+
ownerId: string;
|
|
653
|
+
} | {
|
|
654
|
+
gitlab: string;
|
|
655
|
+
projectId: string;
|
|
656
|
+
namespaceId: string;
|
|
657
|
+
};
|
|
658
|
+
|
|
532
659
|
export type DryRunOutcome = "added" | "archived" | "changed" | "unchanged";
|
|
533
660
|
|
|
534
661
|
export type DryRunResult = {
|
package/src/index.ts
CHANGED
|
@@ -9,13 +9,15 @@
|
|
|
9
9
|
* else: the web app hands requests straight to its router, and the CLI adds
|
|
10
10
|
* its own handling of Cloudflare Access redirects.
|
|
11
11
|
*/
|
|
12
|
-
import type { Api, AuthInfo, DryRunOutcome, DryRunResult, SetResult } from './api.ts';
|
|
12
|
+
import type { Api, AuthInfo, BindingPlan, BindingView, DryRunOutcome, DryRunResult, SetResult } from './api.ts';
|
|
13
13
|
|
|
14
14
|
export type {
|
|
15
15
|
AccessValue,
|
|
16
16
|
Api,
|
|
17
17
|
AuditEntryView,
|
|
18
18
|
AuthInfo,
|
|
19
|
+
BindingPlan,
|
|
20
|
+
BindingView,
|
|
19
21
|
DryRunOutcome,
|
|
20
22
|
DryRunResult,
|
|
21
23
|
IdentityRow,
|
|
@@ -30,6 +32,7 @@ export type {
|
|
|
30
32
|
ServiceTokenRow,
|
|
31
33
|
SessionRow,
|
|
32
34
|
SetResult,
|
|
35
|
+
WorkloadIds,
|
|
33
36
|
} from './api.ts';
|
|
34
37
|
|
|
35
38
|
export type RouteKey = keyof Api;
|
|
@@ -215,6 +218,21 @@ export function createClient(options: ClientOptions) {
|
|
|
215
218
|
revoke: (member: string, id: string) => call('DELETE /members/:member/tokens/:id', { member, id }),
|
|
216
219
|
},
|
|
217
220
|
|
|
221
|
+
/** Trust bindings: which CI runs may sign in as a service, by their platform's ID token. */
|
|
222
|
+
bindings: {
|
|
223
|
+
list: (member: string) => call('GET /members/:member/bindings', { member }),
|
|
224
|
+
/** The binding as it would be saved, the keys its issuer names, and what it replaces; writes nothing. */
|
|
225
|
+
preview: (member: string, input: RouteInput<'POST /members/:member/bindings'>) => {
|
|
226
|
+
const [method, route] = address('POST /members/:member/bindings', { member });
|
|
227
|
+
return send(method, `${route}?dryRun=1`, input) as Promise<BindingPlan>;
|
|
228
|
+
},
|
|
229
|
+
create: (member: string, input: RouteInput<'POST /members/:member/bindings'>) =>
|
|
230
|
+
call('POST /members/:member/bindings', { member }, input) as Promise<{ binding: BindingView; replaced: string[] }>,
|
|
231
|
+
remove: (member: string, id: string) => call('DELETE /members/:member/bindings/:id', { member, id }),
|
|
232
|
+
/** A public GitHub repository's or GitLab project's IDs, which bindings name. */
|
|
233
|
+
lookup: (input: RouteInput<'GET /workloads/lookup'>) => call('GET /workloads/lookup', {}, input),
|
|
234
|
+
},
|
|
235
|
+
|
|
218
236
|
access: {
|
|
219
237
|
/** What they should hold at each place; the server applies the difference. `null` revokes. */
|
|
220
238
|
set: (member: string, access: RouteInput<'PATCH /access/:member'>) =>
|
package/src/routes.ts
CHANGED
|
@@ -34,6 +34,8 @@ export function getCalls({ places, secrets, members, services }: Subjects): GetC
|
|
|
34
34
|
],
|
|
35
35
|
'GET /members/:member': members.map((member) => ({ params: { member } })),
|
|
36
36
|
'GET /members/:member/tokens': services.map((member) => ({ params: { member } })),
|
|
37
|
+
'GET /members/:member/bindings': services.map((member) => ({ params: { member } })),
|
|
38
|
+
'GET /workloads/lookup': [{ params: {}, input: { github: 'acme/api' } }],
|
|
37
39
|
'GET /sessions': [{ params: {} }],
|
|
38
40
|
'GET /identities': [{ params: {} }],
|
|
39
41
|
'GET /device-logins/:code': [{ params: { code: 'BCDF-GHJK' } }],
|
|
@@ -73,6 +75,10 @@ const EVERY_ROUTE: { [K in RouteKey]: true } = {
|
|
|
73
75
|
'GET /members/:member/tokens': true,
|
|
74
76
|
'POST /members/:member/tokens': true,
|
|
75
77
|
'DELETE /members/:member/tokens/:id': true,
|
|
78
|
+
'GET /members/:member/bindings': true,
|
|
79
|
+
'POST /members/:member/bindings': true,
|
|
80
|
+
'DELETE /members/:member/bindings/:id': true,
|
|
81
|
+
'GET /workloads/lookup': true,
|
|
76
82
|
'PATCH /access/:member': true,
|
|
77
83
|
'GET /sessions': true,
|
|
78
84
|
'DELETE /sessions/:id': true,
|