@coffre/client 0.1.11 → 0.1.13
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-BJ5QCCxe.d.ts → index-BOnwnquP.d.ts} +1 -666
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -74
- package/dist/routes.d.ts +1 -1
- package/dist/routes.js +0 -8
- package/package.json +1 -1
- package/src/api.ts +0 -403
- package/src/index.ts +0 -19
- package/src/routes.ts +0 -8
- package/src/sync-fields.ts +0 -85
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { type AccessValue, type Api, type AuditEntryView, type AuthInfo, ClientOptions, CoffreClient, CoffreError, type DryRunOutcome, type DryRunResult, type
|
|
1
|
+
import { C as RemovedMember, D as SessionRow, E as ServiceTokenRow, O as SetResult, S as ProjectSummary, T as SecretVersion, _ as DryRunResult, a as Params, b as Member, c as RouteOutput, d as planImport, f as AccessValue, g as DryRunOutcome, h as AuthInfo, i as ImportAction, 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 IdentityRow, w as SecretKey, x as OffboardingReport, y as Me } from "./index-BOnwnquP.js";
|
|
2
|
+
export { type AccessValue, type Api, type AuditEntryView, type AuthInfo, ClientOptions, CoffreClient, CoffreError, type DryRunOutcome, type DryRunResult, type IdentityRow, ImportAction, 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 };
|
package/dist/index.js
CHANGED
|
@@ -1,67 +1,3 @@
|
|
|
1
|
-
//#region src/sync-fields.ts
|
|
2
|
-
function initialValues(provider) {
|
|
3
|
-
return Object.fromEntries(provider.fields.map((field) => [field.name, field.type === "text" ? "" : field.initial]));
|
|
4
|
-
}
|
|
5
|
-
/** Whether the rest of the form makes the field meaningful. */
|
|
6
|
-
function isAsked(field, values) {
|
|
7
|
-
if (field.type === "options" || field.when === void 0) return true;
|
|
8
|
-
const picked = values[field.when.field];
|
|
9
|
-
const list = Array.isArray(picked) ? picked : [];
|
|
10
|
-
return list.length === field.when.is.length && field.when.is.every((value) => list.includes(value));
|
|
11
|
-
}
|
|
12
|
-
/** The label of the first required field left empty, or null when the form can be sent. */
|
|
13
|
-
function firstMissing(provider, values) {
|
|
14
|
-
for (const field of provider.fields) {
|
|
15
|
-
if (!isAsked(field, values)) continue;
|
|
16
|
-
const value = values[field.name];
|
|
17
|
-
if ((typeof value === "string" ? value.trim() === "" : (value ?? []).length === 0) && (field.type === "options" || field.optional !== true)) return field.label;
|
|
18
|
-
}
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* The provider's config. Text is trimmed, and an optional field left empty
|
|
23
|
-
* is left out rather than sent as "", which the server rightly refuses.
|
|
24
|
-
*/
|
|
25
|
-
function configFromForm(provider, values) {
|
|
26
|
-
const config = {};
|
|
27
|
-
for (const field of provider.fields) {
|
|
28
|
-
if (!isAsked(field, values)) continue;
|
|
29
|
-
const value = values[field.name];
|
|
30
|
-
if (field.type === "options") {
|
|
31
|
-
const picked = Array.isArray(value) ? value : [];
|
|
32
|
-
config[field.name] = field.multiple ? picked : picked[0];
|
|
33
|
-
} else {
|
|
34
|
-
const text = typeof value === "string" ? value.trim() : "";
|
|
35
|
-
if (text !== "") config[field.name] = text;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return config;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* The config from `name=value` arguments, as the CLI takes them. A field with
|
|
42
|
-
* several options takes them comma-separated, and one left out gets what the
|
|
43
|
-
* form preselects. Text goes as typed, for the server to check.
|
|
44
|
-
*/
|
|
45
|
-
function configFromArguments(provider, assignments) {
|
|
46
|
-
const config = {};
|
|
47
|
-
for (const assignment of assignments) {
|
|
48
|
-
const equals = assignment.indexOf("=");
|
|
49
|
-
const name = equals === -1 ? assignment : assignment.slice(0, equals);
|
|
50
|
-
const field = provider.fields.find((candidate) => candidate.name === name);
|
|
51
|
-
if (equals === -1 || field === void 0) {
|
|
52
|
-
const names = provider.fields.map((candidate) => candidate.name).join(", ");
|
|
53
|
-
throw new Error(`${provider.label} takes ${names} as name=value; got ${JSON.stringify(assignment)}`);
|
|
54
|
-
}
|
|
55
|
-
if (Object.hasOwn(config, name)) throw new Error(`${name} is given twice`);
|
|
56
|
-
const value = assignment.slice(equals + 1);
|
|
57
|
-
if (field.type === "text") config[name] = value;
|
|
58
|
-
else if (field.multiple) config[name] = value.split(",").map((item) => item.trim()).filter((item) => item !== "");
|
|
59
|
-
else config[name] = value;
|
|
60
|
-
}
|
|
61
|
-
for (const field of provider.fields) if (field.type === "options" && !Object.hasOwn(config, field.name)) config[field.name] = field.multiple ? field.initial : field.initial[0];
|
|
62
|
-
return config;
|
|
63
|
-
}
|
|
64
|
-
//#endregion
|
|
65
1
|
//#region src/index.ts
|
|
66
2
|
/** The API's error shape, `{ error, message }`, with the HTTP status. */
|
|
67
3
|
const COFFRE_ERROR = Symbol.for("@coffre/client:CoffreError");
|
|
@@ -205,15 +141,6 @@ set: (member, access) => call("PATCH /access/:member", { member }, access) },
|
|
|
205
141
|
get: (code) => call("GET /device-logins/:code", { code }),
|
|
206
142
|
decide: (code, approve) => call("POST /device-logins/:code", { code }, { approve })
|
|
207
143
|
},
|
|
208
|
-
syncs: {
|
|
209
|
-
/** Where a sync can push on this instance, and what each asks for. */
|
|
210
|
-
providers: () => call("GET /syncs/providers", {}),
|
|
211
|
-
list: (path) => call("GET /syncs/:project/:environment", place(path)),
|
|
212
|
-
add: (path, input) => call("POST /syncs/:project/:environment", place(path), input),
|
|
213
|
-
update: (id, patch) => call("PATCH /syncs/by-id/:id", { id }, patch),
|
|
214
|
-
remove: (id) => call("DELETE /syncs/by-id/:id", { id }),
|
|
215
|
-
run: (id) => call("POST /syncs/by-id/:id/runs", { id })
|
|
216
|
-
},
|
|
217
144
|
audit: {
|
|
218
145
|
list: (query = {}) => call("GET /audit", {}, query),
|
|
219
146
|
verify: () => call("GET /audit/verification", {}),
|
|
@@ -254,4 +181,4 @@ async function planImport(coffre, path, entries) {
|
|
|
254
181
|
};
|
|
255
182
|
}
|
|
256
183
|
//#endregion
|
|
257
|
-
export { CoffreError,
|
|
184
|
+
export { CoffreError, createClient, planImport };
|
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-BOnwnquP.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
|
@@ -15,8 +15,6 @@ function getCalls({ places, secrets, members, services }) {
|
|
|
15
15
|
"GET /sessions": [{ params: {} }],
|
|
16
16
|
"GET /identities": [{ params: {} }],
|
|
17
17
|
"GET /device-logins/:code": [{ params: { code: "BCDF-GHJK" } }],
|
|
18
|
-
"GET /syncs/providers": [{ params: {} }],
|
|
19
|
-
"GET /syncs/:project/:environment": places.map((params) => ({ params })),
|
|
20
18
|
"GET /audit": [{
|
|
21
19
|
params: {},
|
|
22
20
|
input: { limit: 500 }
|
|
@@ -68,12 +66,6 @@ const EVERY_ROUTE = {
|
|
|
68
66
|
"DELETE /identities/:id": true,
|
|
69
67
|
"GET /device-logins/:code": true,
|
|
70
68
|
"POST /device-logins/:code": true,
|
|
71
|
-
"GET /syncs/providers": true,
|
|
72
|
-
"GET /syncs/:project/:environment": true,
|
|
73
|
-
"POST /syncs/:project/:environment": true,
|
|
74
|
-
"PATCH /syncs/by-id/:id": true,
|
|
75
|
-
"DELETE /syncs/by-id/:id": true,
|
|
76
|
-
"POST /syncs/by-id/:id/runs": true,
|
|
77
69
|
"GET /audit": true,
|
|
78
70
|
"GET /audit/verification": true,
|
|
79
71
|
"GET /audit/keys": true
|
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -237,35 +237,6 @@ export type Api = {
|
|
|
237
237
|
expiresAt: string;
|
|
238
238
|
lastUsedAt: string | null;
|
|
239
239
|
}[];
|
|
240
|
-
syncs: {
|
|
241
|
-
id: string;
|
|
242
|
-
provider: string;
|
|
243
|
-
providerLabel: string;
|
|
244
|
-
brand: "cloudflare" | "github" | "other" | "railway" | "vercel";
|
|
245
|
-
offered: boolean;
|
|
246
|
-
destination: string;
|
|
247
|
-
config: {
|
|
248
|
-
[key: string]: string | number | boolean | null | Json[] | {
|
|
249
|
-
[key: string]: Json;
|
|
250
|
-
};
|
|
251
|
-
};
|
|
252
|
-
credential: string;
|
|
253
|
-
createdAt: string;
|
|
254
|
-
createdBy: string;
|
|
255
|
-
paused: boolean;
|
|
256
|
-
running: boolean;
|
|
257
|
-
lastRunAt: string | null;
|
|
258
|
-
lastStatus: "failed" | "ok" | "partial" | null;
|
|
259
|
-
lastError: string | null;
|
|
260
|
-
synced: number;
|
|
261
|
-
pending: number;
|
|
262
|
-
skipped: {
|
|
263
|
-
key: string;
|
|
264
|
-
reason: string;
|
|
265
|
-
}[];
|
|
266
|
-
project: string;
|
|
267
|
-
environment: string;
|
|
268
|
-
}[];
|
|
269
240
|
};
|
|
270
241
|
};
|
|
271
242
|
"PUT /members/:member": {
|
|
@@ -318,35 +289,6 @@ export type Api = {
|
|
|
318
289
|
expiresAt: string;
|
|
319
290
|
lastUsedAt: string | null;
|
|
320
291
|
}[];
|
|
321
|
-
syncs: {
|
|
322
|
-
id: string;
|
|
323
|
-
provider: string;
|
|
324
|
-
providerLabel: string;
|
|
325
|
-
brand: "cloudflare" | "github" | "other" | "railway" | "vercel";
|
|
326
|
-
offered: boolean;
|
|
327
|
-
destination: string;
|
|
328
|
-
config: {
|
|
329
|
-
[key: string]: string | number | boolean | null | Json[] | {
|
|
330
|
-
[key: string]: Json;
|
|
331
|
-
};
|
|
332
|
-
};
|
|
333
|
-
credential: string;
|
|
334
|
-
createdAt: string;
|
|
335
|
-
createdBy: string;
|
|
336
|
-
paused: boolean;
|
|
337
|
-
running: boolean;
|
|
338
|
-
lastRunAt: string | null;
|
|
339
|
-
lastStatus: "failed" | "ok" | "partial" | null;
|
|
340
|
-
lastError: string | null;
|
|
341
|
-
synced: number;
|
|
342
|
-
pending: number;
|
|
343
|
-
skipped: {
|
|
344
|
-
key: string;
|
|
345
|
-
reason: string;
|
|
346
|
-
}[];
|
|
347
|
-
project: string;
|
|
348
|
-
environment: string;
|
|
349
|
-
}[];
|
|
350
292
|
};
|
|
351
293
|
};
|
|
352
294
|
};
|
|
@@ -457,219 +399,6 @@ export type Api = {
|
|
|
457
399
|
decided: true;
|
|
458
400
|
};
|
|
459
401
|
};
|
|
460
|
-
"GET /syncs/providers": {
|
|
461
|
-
input: undefined;
|
|
462
|
-
output: {
|
|
463
|
-
providers: {
|
|
464
|
-
brand: "cloudflare" | "github" | "other" | "railway" | "vercel";
|
|
465
|
-
id: string;
|
|
466
|
-
credential: {
|
|
467
|
-
placeholder: string;
|
|
468
|
-
hint: string;
|
|
469
|
-
};
|
|
470
|
-
label: string;
|
|
471
|
-
fields: ({
|
|
472
|
-
type: "text";
|
|
473
|
-
name: string;
|
|
474
|
-
label: string;
|
|
475
|
-
placeholder: string;
|
|
476
|
-
optional?: boolean;
|
|
477
|
-
hint?: string;
|
|
478
|
-
when?: {
|
|
479
|
-
field: string;
|
|
480
|
-
is: string[];
|
|
481
|
-
};
|
|
482
|
-
} | {
|
|
483
|
-
type: "options";
|
|
484
|
-
name: string;
|
|
485
|
-
label: string;
|
|
486
|
-
options: {
|
|
487
|
-
value: string;
|
|
488
|
-
label: string;
|
|
489
|
-
}[];
|
|
490
|
-
multiple: boolean;
|
|
491
|
-
initial: string[];
|
|
492
|
-
hint?: string;
|
|
493
|
-
})[];
|
|
494
|
-
}[];
|
|
495
|
-
};
|
|
496
|
-
};
|
|
497
|
-
"GET /syncs/:project/:environment": {
|
|
498
|
-
input: undefined;
|
|
499
|
-
output: {
|
|
500
|
-
syncs: {
|
|
501
|
-
id: string;
|
|
502
|
-
provider: string;
|
|
503
|
-
providerLabel: string;
|
|
504
|
-
brand: "cloudflare" | "github" | "other" | "railway" | "vercel";
|
|
505
|
-
offered: boolean;
|
|
506
|
-
destination: string;
|
|
507
|
-
config: {
|
|
508
|
-
[key: string]: string | number | boolean | null | Json[] | {
|
|
509
|
-
[key: string]: Json;
|
|
510
|
-
};
|
|
511
|
-
};
|
|
512
|
-
credential: string;
|
|
513
|
-
createdAt: string;
|
|
514
|
-
createdBy: string;
|
|
515
|
-
paused: boolean;
|
|
516
|
-
running: boolean;
|
|
517
|
-
lastRunAt: string | null;
|
|
518
|
-
lastStatus: "failed" | "ok" | "partial" | null;
|
|
519
|
-
lastError: string | null;
|
|
520
|
-
synced: number;
|
|
521
|
-
pending: number;
|
|
522
|
-
skipped: {
|
|
523
|
-
key: string;
|
|
524
|
-
reason: string;
|
|
525
|
-
}[];
|
|
526
|
-
}[];
|
|
527
|
-
canManage: boolean;
|
|
528
|
-
};
|
|
529
|
-
};
|
|
530
|
-
"POST /syncs/:project/:environment": {
|
|
531
|
-
input: {
|
|
532
|
-
provider: string;
|
|
533
|
-
config: {
|
|
534
|
-
[key: string]: unknown;
|
|
535
|
-
};
|
|
536
|
-
credential: string;
|
|
537
|
-
};
|
|
538
|
-
output: {
|
|
539
|
-
id: string;
|
|
540
|
-
provider: string;
|
|
541
|
-
providerLabel: string;
|
|
542
|
-
brand: "cloudflare" | "github" | "other" | "railway" | "vercel";
|
|
543
|
-
offered: boolean;
|
|
544
|
-
destination: string;
|
|
545
|
-
config: {
|
|
546
|
-
[key: string]: string | number | boolean | null | Json[] | {
|
|
547
|
-
[key: string]: Json;
|
|
548
|
-
};
|
|
549
|
-
};
|
|
550
|
-
credential: string;
|
|
551
|
-
createdAt: string;
|
|
552
|
-
createdBy: string;
|
|
553
|
-
paused: boolean;
|
|
554
|
-
running: boolean;
|
|
555
|
-
lastRunAt: string | null;
|
|
556
|
-
lastStatus: "failed" | "ok" | "partial" | null;
|
|
557
|
-
lastError: string | null;
|
|
558
|
-
synced: number;
|
|
559
|
-
pending: number;
|
|
560
|
-
skipped: {
|
|
561
|
-
key: string;
|
|
562
|
-
reason: string;
|
|
563
|
-
}[];
|
|
564
|
-
};
|
|
565
|
-
};
|
|
566
|
-
"PATCH /syncs/by-id/:id": {
|
|
567
|
-
input: {
|
|
568
|
-
paused: boolean;
|
|
569
|
-
};
|
|
570
|
-
output: {
|
|
571
|
-
id: string;
|
|
572
|
-
provider: string;
|
|
573
|
-
providerLabel: string;
|
|
574
|
-
brand: "cloudflare" | "github" | "other" | "railway" | "vercel";
|
|
575
|
-
offered: boolean;
|
|
576
|
-
destination: string;
|
|
577
|
-
config: {
|
|
578
|
-
[key: string]: string | number | boolean | null | Json[] | {
|
|
579
|
-
[key: string]: Json;
|
|
580
|
-
};
|
|
581
|
-
};
|
|
582
|
-
credential: string;
|
|
583
|
-
createdAt: string;
|
|
584
|
-
createdBy: string;
|
|
585
|
-
paused: boolean;
|
|
586
|
-
running: boolean;
|
|
587
|
-
lastRunAt: string | null;
|
|
588
|
-
lastStatus: "failed" | "ok" | "partial" | null;
|
|
589
|
-
lastError: string | null;
|
|
590
|
-
synced: number;
|
|
591
|
-
pending: number;
|
|
592
|
-
skipped: {
|
|
593
|
-
key: string;
|
|
594
|
-
reason: string;
|
|
595
|
-
}[];
|
|
596
|
-
};
|
|
597
|
-
};
|
|
598
|
-
"DELETE /syncs/by-id/:id": {
|
|
599
|
-
input: undefined;
|
|
600
|
-
output: {
|
|
601
|
-
id: string;
|
|
602
|
-
provider: string;
|
|
603
|
-
providerLabel: string;
|
|
604
|
-
brand: "cloudflare" | "github" | "other" | "railway" | "vercel";
|
|
605
|
-
offered: boolean;
|
|
606
|
-
destination: string;
|
|
607
|
-
config: {
|
|
608
|
-
[key: string]: string | number | boolean | null | Json[] | {
|
|
609
|
-
[key: string]: Json;
|
|
610
|
-
};
|
|
611
|
-
};
|
|
612
|
-
credential: string;
|
|
613
|
-
createdAt: string;
|
|
614
|
-
createdBy: string;
|
|
615
|
-
paused: boolean;
|
|
616
|
-
running: boolean;
|
|
617
|
-
lastRunAt: string | null;
|
|
618
|
-
lastStatus: "failed" | "ok" | "partial" | null;
|
|
619
|
-
lastError: string | null;
|
|
620
|
-
synced: number;
|
|
621
|
-
pending: number;
|
|
622
|
-
skipped: {
|
|
623
|
-
key: string;
|
|
624
|
-
reason: string;
|
|
625
|
-
}[];
|
|
626
|
-
};
|
|
627
|
-
};
|
|
628
|
-
"POST /syncs/by-id/:id/runs": {
|
|
629
|
-
input: undefined;
|
|
630
|
-
output: {
|
|
631
|
-
sync: {
|
|
632
|
-
id: string;
|
|
633
|
-
provider: string;
|
|
634
|
-
providerLabel: string;
|
|
635
|
-
brand: "cloudflare" | "github" | "other" | "railway" | "vercel";
|
|
636
|
-
offered: boolean;
|
|
637
|
-
destination: string;
|
|
638
|
-
config: {
|
|
639
|
-
[key: string]: string | number | boolean | null | Json[] | {
|
|
640
|
-
[key: string]: Json;
|
|
641
|
-
};
|
|
642
|
-
};
|
|
643
|
-
credential: string;
|
|
644
|
-
createdAt: string;
|
|
645
|
-
createdBy: string;
|
|
646
|
-
paused: boolean;
|
|
647
|
-
running: boolean;
|
|
648
|
-
lastRunAt: string | null;
|
|
649
|
-
lastStatus: "failed" | "ok" | "partial" | null;
|
|
650
|
-
lastError: string | null;
|
|
651
|
-
synced: number;
|
|
652
|
-
pending: number;
|
|
653
|
-
skipped: {
|
|
654
|
-
key: string;
|
|
655
|
-
reason: string;
|
|
656
|
-
}[];
|
|
657
|
-
};
|
|
658
|
-
outcome: {
|
|
659
|
-
status: "busy";
|
|
660
|
-
} | {
|
|
661
|
-
status: "failed" | "ok" | "partial";
|
|
662
|
-
upserted: string[];
|
|
663
|
-
deleted: string[];
|
|
664
|
-
failed: {
|
|
665
|
-
key: string;
|
|
666
|
-
operation: "delete" | "upsert";
|
|
667
|
-
message: string;
|
|
668
|
-
}[];
|
|
669
|
-
error: string | null;
|
|
670
|
-
};
|
|
671
|
-
};
|
|
672
|
-
};
|
|
673
402
|
"GET /audit": {
|
|
674
403
|
input: {
|
|
675
404
|
path?: string;
|
|
@@ -876,35 +605,6 @@ export type OffboardingReport = {
|
|
|
876
605
|
expiresAt: string;
|
|
877
606
|
lastUsedAt: string | null;
|
|
878
607
|
}[];
|
|
879
|
-
syncs: {
|
|
880
|
-
id: string;
|
|
881
|
-
provider: string;
|
|
882
|
-
providerLabel: string;
|
|
883
|
-
brand: "cloudflare" | "github" | "other" | "railway" | "vercel";
|
|
884
|
-
offered: boolean;
|
|
885
|
-
destination: string;
|
|
886
|
-
config: {
|
|
887
|
-
[key: string]: string | number | boolean | null | Json[] | {
|
|
888
|
-
[key: string]: Json;
|
|
889
|
-
};
|
|
890
|
-
};
|
|
891
|
-
credential: string;
|
|
892
|
-
createdAt: string;
|
|
893
|
-
createdBy: string;
|
|
894
|
-
paused: boolean;
|
|
895
|
-
running: boolean;
|
|
896
|
-
lastRunAt: string | null;
|
|
897
|
-
lastStatus: "failed" | "ok" | "partial" | null;
|
|
898
|
-
lastError: string | null;
|
|
899
|
-
synced: number;
|
|
900
|
-
pending: number;
|
|
901
|
-
skipped: {
|
|
902
|
-
key: string;
|
|
903
|
-
reason: string;
|
|
904
|
-
}[];
|
|
905
|
-
project: string;
|
|
906
|
-
environment: string;
|
|
907
|
-
}[];
|
|
908
608
|
};
|
|
909
609
|
|
|
910
610
|
export type ProjectSummary = {
|
|
@@ -930,20 +630,6 @@ export type RemovedMember = {
|
|
|
930
630
|
toRotate: number;
|
|
931
631
|
};
|
|
932
632
|
|
|
933
|
-
export type RunOutcome = {
|
|
934
|
-
status: "busy";
|
|
935
|
-
} | {
|
|
936
|
-
status: "failed" | "ok" | "partial";
|
|
937
|
-
upserted: string[];
|
|
938
|
-
deleted: string[];
|
|
939
|
-
failed: {
|
|
940
|
-
key: string;
|
|
941
|
-
operation: "delete" | "upsert";
|
|
942
|
-
message: string;
|
|
943
|
-
}[];
|
|
944
|
-
error: string | null;
|
|
945
|
-
};
|
|
946
|
-
|
|
947
633
|
export type SecretKey = {
|
|
948
634
|
key: string;
|
|
949
635
|
archived: boolean;
|
|
@@ -994,92 +680,3 @@ export type SetResult = {
|
|
|
994
680
|
};
|
|
995
681
|
};
|
|
996
682
|
};
|
|
997
|
-
|
|
998
|
-
export type SyncField = {
|
|
999
|
-
type: "text";
|
|
1000
|
-
name: string;
|
|
1001
|
-
label: string;
|
|
1002
|
-
placeholder: string;
|
|
1003
|
-
optional?: boolean;
|
|
1004
|
-
hint?: string;
|
|
1005
|
-
when?: {
|
|
1006
|
-
field: string;
|
|
1007
|
-
is: string[];
|
|
1008
|
-
};
|
|
1009
|
-
} | {
|
|
1010
|
-
type: "options";
|
|
1011
|
-
name: string;
|
|
1012
|
-
label: string;
|
|
1013
|
-
options: {
|
|
1014
|
-
value: string;
|
|
1015
|
-
label: string;
|
|
1016
|
-
}[];
|
|
1017
|
-
multiple: boolean;
|
|
1018
|
-
initial: string[];
|
|
1019
|
-
hint?: string;
|
|
1020
|
-
};
|
|
1021
|
-
|
|
1022
|
-
export type SyncProviderInfo = {
|
|
1023
|
-
brand: "cloudflare" | "github" | "other" | "railway" | "vercel";
|
|
1024
|
-
id: string;
|
|
1025
|
-
credential: {
|
|
1026
|
-
placeholder: string;
|
|
1027
|
-
hint: string;
|
|
1028
|
-
};
|
|
1029
|
-
label: string;
|
|
1030
|
-
fields: ({
|
|
1031
|
-
type: "text";
|
|
1032
|
-
name: string;
|
|
1033
|
-
label: string;
|
|
1034
|
-
placeholder: string;
|
|
1035
|
-
optional?: boolean;
|
|
1036
|
-
hint?: string;
|
|
1037
|
-
when?: {
|
|
1038
|
-
field: string;
|
|
1039
|
-
is: string[];
|
|
1040
|
-
};
|
|
1041
|
-
} | {
|
|
1042
|
-
type: "options";
|
|
1043
|
-
name: string;
|
|
1044
|
-
label: string;
|
|
1045
|
-
options: {
|
|
1046
|
-
value: string;
|
|
1047
|
-
label: string;
|
|
1048
|
-
}[];
|
|
1049
|
-
multiple: boolean;
|
|
1050
|
-
initial: string[];
|
|
1051
|
-
hint?: string;
|
|
1052
|
-
})[];
|
|
1053
|
-
};
|
|
1054
|
-
|
|
1055
|
-
export type SyncView = {
|
|
1056
|
-
id: string;
|
|
1057
|
-
provider: string;
|
|
1058
|
-
providerLabel: string;
|
|
1059
|
-
brand: "cloudflare" | "github" | "other" | "railway" | "vercel";
|
|
1060
|
-
offered: boolean;
|
|
1061
|
-
destination: string;
|
|
1062
|
-
config: {
|
|
1063
|
-
[key: string]: string | number | boolean | null | Json[] | {
|
|
1064
|
-
[key: string]: Json;
|
|
1065
|
-
};
|
|
1066
|
-
};
|
|
1067
|
-
credential: string;
|
|
1068
|
-
createdAt: string;
|
|
1069
|
-
createdBy: string;
|
|
1070
|
-
paused: boolean;
|
|
1071
|
-
running: boolean;
|
|
1072
|
-
lastRunAt: string | null;
|
|
1073
|
-
lastStatus: "failed" | "ok" | "partial" | null;
|
|
1074
|
-
lastError: string | null;
|
|
1075
|
-
synced: number;
|
|
1076
|
-
pending: number;
|
|
1077
|
-
skipped: {
|
|
1078
|
-
key: string;
|
|
1079
|
-
reason: string;
|
|
1080
|
-
}[];
|
|
1081
|
-
};
|
|
1082
|
-
|
|
1083
|
-
export type Json = string | number | boolean | null | Json[] | {
|
|
1084
|
-
[key: string]: Json;
|
|
1085
|
-
};
|
package/src/index.ts
CHANGED
|
@@ -19,24 +19,17 @@ export type {
|
|
|
19
19
|
DryRunOutcome,
|
|
20
20
|
DryRunResult,
|
|
21
21
|
IdentityRow,
|
|
22
|
-
Json,
|
|
23
22
|
Me,
|
|
24
23
|
Member,
|
|
25
24
|
OffboardingReport,
|
|
26
25
|
ProjectSummary,
|
|
27
26
|
RemovedMember,
|
|
28
|
-
RunOutcome,
|
|
29
27
|
SecretKey,
|
|
30
28
|
SecretVersion,
|
|
31
29
|
ServiceTokenRow,
|
|
32
30
|
SessionRow,
|
|
33
31
|
SetResult,
|
|
34
|
-
SyncField,
|
|
35
|
-
SyncProviderInfo,
|
|
36
|
-
SyncView,
|
|
37
32
|
} from './api.ts';
|
|
38
|
-
export { configFromArguments, configFromForm, firstMissing, initialValues, isAsked } from './sync-fields.ts';
|
|
39
|
-
export type { FormValues } from './sync-fields.ts';
|
|
40
33
|
|
|
41
34
|
export type RouteKey = keyof Api;
|
|
42
35
|
/** What a caller sends: the body, or the query string for a GET. */
|
|
@@ -245,18 +238,6 @@ export function createClient(options: ClientOptions) {
|
|
|
245
238
|
decide: (code: string, approve: boolean) => call('POST /device-logins/:code', { code }, { approve }),
|
|
246
239
|
},
|
|
247
240
|
|
|
248
|
-
syncs: {
|
|
249
|
-
/** Where a sync can push on this instance, and what each asks for. */
|
|
250
|
-
providers: () => call('GET /syncs/providers', {}),
|
|
251
|
-
list: (path: string) => call('GET /syncs/:project/:environment', place(path)),
|
|
252
|
-
add: (path: string, input: RouteInput<'POST /syncs/:project/:environment'>) =>
|
|
253
|
-
call('POST /syncs/:project/:environment', place(path), input),
|
|
254
|
-
update: (id: string, patch: RouteInput<'PATCH /syncs/by-id/:id'>) =>
|
|
255
|
-
call('PATCH /syncs/by-id/:id', { id }, patch),
|
|
256
|
-
remove: (id: string) => call('DELETE /syncs/by-id/:id', { id }),
|
|
257
|
-
run: (id: string) => call('POST /syncs/by-id/:id/runs', { id }),
|
|
258
|
-
},
|
|
259
|
-
|
|
260
241
|
audit: {
|
|
261
242
|
list: (query: RouteInput<'GET /audit'> = {}) => call('GET /audit', {}, query),
|
|
262
243
|
verify: () => call('GET /audit/verification', {}),
|
package/src/routes.ts
CHANGED
|
@@ -37,8 +37,6 @@ export function getCalls({ places, secrets, members, services }: Subjects): GetC
|
|
|
37
37
|
'GET /sessions': [{ params: {} }],
|
|
38
38
|
'GET /identities': [{ params: {} }],
|
|
39
39
|
'GET /device-logins/:code': [{ params: { code: 'BCDF-GHJK' } }],
|
|
40
|
-
'GET /syncs/providers': [{ params: {} }],
|
|
41
|
-
'GET /syncs/:project/:environment': places.map((params) => ({ params })),
|
|
42
40
|
'GET /audit': [{ params: {}, input: { limit: 500 } }, { params: {}, input: { limit: 500, detail: '1' } }],
|
|
43
41
|
'GET /audit/verification': [{ params: {} }],
|
|
44
42
|
'GET /audit/keys': [{ params: {} }],
|
|
@@ -82,12 +80,6 @@ const EVERY_ROUTE: { [K in RouteKey]: true } = {
|
|
|
82
80
|
'DELETE /identities/:id': true,
|
|
83
81
|
'GET /device-logins/:code': true,
|
|
84
82
|
'POST /device-logins/:code': true,
|
|
85
|
-
'GET /syncs/providers': true,
|
|
86
|
-
'GET /syncs/:project/:environment': true,
|
|
87
|
-
'POST /syncs/:project/:environment': true,
|
|
88
|
-
'PATCH /syncs/by-id/:id': true,
|
|
89
|
-
'DELETE /syncs/by-id/:id': true,
|
|
90
|
-
'POST /syncs/by-id/:id/runs': true,
|
|
91
83
|
'GET /audit': true,
|
|
92
84
|
'GET /audit/verification': true,
|
|
93
85
|
'GET /audit/keys': true,
|