@samebase/alchemy-convex 0.31.0 → 0.33.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/README.md +55 -46
- package/lib/{State-t0BZggNl.js → State-CuktZaOh.js} +6 -6
- package/lib/{State-t0BZggNl.js.map → State-CuktZaOh.js.map} +1 -1
- package/lib/cli.js +11 -8
- package/lib/cli.js.map +1 -1
- package/lib/index.d.ts +19 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +49 -15
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/LocalDeployment.ts +1 -1
- package/src/RunRecord.ts +10 -5
- package/src/SharedHubClient.ts +107 -43
- package/src/StackComment.ts +8 -3
- package/src/store/component/_generated/component.ts +5 -5
- package/src/store/component/runRecord.ts +2 -2
- package/src/store/convex/version.ts +2 -1
package/package.json
CHANGED
package/src/LocalDeployment.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// this machine. Each folder, such as each git worktree, has its own, with its own data.
|
|
4
4
|
//
|
|
5
5
|
// The resource writes its `env` and nothing else. The running `convex dev` owns the backend and
|
|
6
|
-
// pushes the functions, so the stage
|
|
6
|
+
// pushes the functions, so the development stage runs after `convex dev` has started, and the
|
|
7
7
|
// first push of a new local deployment takes the variables that the project's default variables
|
|
8
8
|
// for development gave it. The resource reads the deployment from
|
|
9
9
|
// `.convex/local/default/config.json`, where the Convex CLI keeps its name, ports, and admin key,
|
package/src/RunRecord.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// the Samebase research of 2026-10-21), so a state layer adds this record to
|
|
4
4
|
// the output document under the reserved key `samebase.run`. The record
|
|
5
5
|
// depends on no store: it comes from the GitHub Actions variables, or from
|
|
6
|
-
// git
|
|
6
|
+
// git in the checkout that runs the stack, and holds no secret. See docs/design/convex-state.md.
|
|
7
7
|
import { execFile } from "node:child_process";
|
|
8
8
|
import { readFile, realpath } from "node:fs/promises";
|
|
9
9
|
import { relative, sep } from "node:path";
|
|
@@ -27,13 +27,18 @@ export interface RunRecord {
|
|
|
27
27
|
readonly stackFile: string;
|
|
28
28
|
/** The branch that was deployed: the head branch of a pull request, else the pushed branch. */
|
|
29
29
|
readonly branch: string;
|
|
30
|
-
/** The pull request whose head was deployed, or null for a push and for a
|
|
30
|
+
/** The pull request whose head was deployed, or null for a push and for a checkout. */
|
|
31
31
|
readonly pullRequest: number | null;
|
|
32
32
|
/** The commit that was deployed: the head of the pull request, else GITHUB_SHA, else git HEAD. */
|
|
33
33
|
readonly headCommit: string;
|
|
34
|
-
/** The GitHub Actions run and attempt, or null for a
|
|
34
|
+
/** The GitHub Actions run and attempt, or null for a checkout. */
|
|
35
35
|
readonly runUrl: string | null;
|
|
36
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Where the record came from: the variables of a GitHub Actions run, or git in a checkout outside
|
|
38
|
+
* GitHub Actions, such as a developer's machine, a sandbox, or another CI. It says nothing of the
|
|
39
|
+
* stage: a checkout can deploy `prod`.
|
|
40
|
+
*/
|
|
41
|
+
readonly source: "github-actions" | "checkout";
|
|
37
42
|
/** ISO 8601, when the record was written. */
|
|
38
43
|
readonly recordedAt: string;
|
|
39
44
|
}
|
|
@@ -172,7 +177,7 @@ const fromGit = (where: RunEnvironment) =>
|
|
|
172
177
|
pullRequest: null,
|
|
173
178
|
headCommit: yield* git(cwd, ["rev-parse", "HEAD"]),
|
|
174
179
|
runUrl: null,
|
|
175
|
-
source: "
|
|
180
|
+
source: "checkout",
|
|
176
181
|
recordedAt: yield* now,
|
|
177
182
|
};
|
|
178
183
|
return record;
|
package/src/SharedHubClient.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Convex.SharedHubClient: one deployment of an app as a client of the central identity hub, for an
|
|
2
|
-
// app that deploys in its own GitHub Actions run, on any host, and
|
|
3
|
-
// stack.
|
|
2
|
+
// app that deploys in its own GitHub Actions run, on any host, and in development as a stage of the
|
|
3
|
+
// same stack.
|
|
4
4
|
//
|
|
5
5
|
// A run in GitHub Actions asks the hub for a new client with a GitHub OIDC token, so the stack needs
|
|
6
6
|
// no key and no Samebase account. The token names the repository. The hub reads
|
|
@@ -11,18 +11,25 @@
|
|
|
11
11
|
// token.
|
|
12
12
|
//
|
|
13
13
|
// The answer to a production registration also holds the app's initial access token (RFC 7591
|
|
14
|
-
// section 1.2) and the repository id. The state of stage `prod` keeps them. A
|
|
15
|
-
// as a stage `dev-<name>`: it reads them with `SharedHubClient.read`, and a client
|
|
16
|
-
// `deploymentType: "development"` asks the hub with the token in place of the GitHub token
|
|
14
|
+
// section 1.2) and the repository id. The state of stage `prod` keeps them. A development checkout
|
|
15
|
+
// runs the stack as a stage `dev-<name>`: it reads them with `SharedHubClient.read`, and a client
|
|
16
|
+
// with `deploymentType: "development"` asks the hub with the token in place of the GitHub token
|
|
17
|
+
// (RFC 133).
|
|
18
|
+
//
|
|
19
|
+
// A client is enrolled in the connectors it signs in through, such as `google` and `github`, at
|
|
20
|
+
// registration (RFC 137). The hub records the set on the client and never changes it: a stack with
|
|
21
|
+
// another set registers a new client.
|
|
17
22
|
//
|
|
18
23
|
// A push removes a variable that a deploy stops passing, so a failure here must not drop working
|
|
19
24
|
// variables or stop the deploy. A renewal that fails keeps the saved values. Only a client that
|
|
20
|
-
// cannot work asks for a new one: it is gone, or it has another return address
|
|
21
|
-
// request fails, the run gives the off values, so the app has guest sign-in and not a
|
|
22
|
-
// The off values are the `no-hub` variables of a checkout without a hub: Convex
|
|
23
|
-
// and the app hides the button for this client ID.
|
|
25
|
+
// cannot work asks for a new one: it is gone, or it has another return address, type, or connector
|
|
26
|
+
// set. If that request fails, the run gives the off values, so the app has guest sign-in and not a
|
|
27
|
+
// broken button. The off values are the `no-hub` variables of a checkout without a hub: Convex
|
|
28
|
+
// needs the variables, and the app hides the button for this client ID.
|
|
24
29
|
//
|
|
25
|
-
// No text in this file quotes an answer or a fetch error, so no log line can hold a secret.
|
|
30
|
+
// No text in this file quotes an answer or a fetch error, so no log line can hold a secret. The one
|
|
31
|
+
// exception is the connector names of an `invalid_connectors` refusal, each checked against the
|
|
32
|
+
// grammar of a connector name before it is printed.
|
|
26
33
|
import { Resource } from "alchemy";
|
|
27
34
|
import { isResolved } from "alchemy/Diff";
|
|
28
35
|
import * as Output from "alchemy/Output";
|
|
@@ -41,9 +48,19 @@ const REQUEST_TIMEOUT_MS = 30_000;
|
|
|
41
48
|
/** The variables of a deployment without a hub client, as the starter writes them. */
|
|
42
49
|
const OFF_VALUES = { issuer: "http://127.0.0.1:1", clientId: "no-hub", clientSecret: "no-hub" };
|
|
43
50
|
|
|
51
|
+
/** The name of a connector on the hub. */
|
|
52
|
+
const CONNECTOR_NAME = /^[a-z0-9-]{1,64}$/;
|
|
53
|
+
|
|
44
54
|
interface CommonProps {
|
|
45
55
|
/** The stable name of the app, set once in the stack. */
|
|
46
56
|
readonly app: string;
|
|
57
|
+
/**
|
|
58
|
+
* The connectors the client signs in through, by their names on the hub, such as
|
|
59
|
+
* `["google", "github"]`: at least one, each of `[a-z0-9-]{1,64}`. The hub refuses a name it does
|
|
60
|
+
* not offer, or does not allow this repository, and the log then names the allowed ones. The set
|
|
61
|
+
* is recorded on the client for good: a changed set registers a new client.
|
|
62
|
+
*/
|
|
63
|
+
readonly connectors: readonly string[];
|
|
47
64
|
/**
|
|
48
65
|
* The return address of the hub's sign-ins, such as `${site.siteUrl}/auth/hub/callback`: an https
|
|
49
66
|
* URL whose origin serves `/samebase-verification.json` with the numeric GitHub id of this
|
|
@@ -93,6 +110,8 @@ const Attributes = Schema.Struct({
|
|
|
93
110
|
deploymentType: DeploymentType,
|
|
94
111
|
/** The return address that the client serves. Empty for the off values. */
|
|
95
112
|
redirectUri: Schema.String,
|
|
113
|
+
/** The connectors the client is enrolled in, sorted, each once. Empty for the off values. */
|
|
114
|
+
connectors: Schema.Array(Schema.String),
|
|
96
115
|
/**
|
|
97
116
|
* Returned only at a production registration (RFC 7591 section 1.2). It registers development
|
|
98
117
|
* clients of this app. Empty for a preview, for a development client, and for the off values.
|
|
@@ -139,10 +158,17 @@ const offAttributes = (
|
|
|
139
158
|
registrationClientUri: "",
|
|
140
159
|
deploymentType,
|
|
141
160
|
redirectUri: "",
|
|
161
|
+
connectors: [],
|
|
142
162
|
initialAccessToken: Redacted.make(""),
|
|
143
163
|
repository: "",
|
|
144
164
|
});
|
|
145
165
|
|
|
166
|
+
/** The set of `names`: sorted, each once. */
|
|
167
|
+
const connectorSet = (names: readonly string[]) => [...new Set(names)].sort();
|
|
168
|
+
|
|
169
|
+
const sameSet = (a: readonly string[], b: readonly string[]) =>
|
|
170
|
+
a.length === b.length && a.every((name, index) => name === b[index]);
|
|
171
|
+
|
|
146
172
|
/** One request gave no usable answer. The reason holds no secret. */
|
|
147
173
|
class SharedHubClientFailed extends Schema.TaggedError<SharedHubClientFailed>()(
|
|
148
174
|
"SharedHubClientFailed",
|
|
@@ -163,6 +189,8 @@ const NewClient = Schema.Struct({
|
|
|
163
189
|
registration_access_token: Schema.NonEmptyString,
|
|
164
190
|
registration_client_uri: Schema.NonEmptyString,
|
|
165
191
|
redirect_uri: Schema.NonEmptyString,
|
|
192
|
+
/** The set the hub recorded, which must be the set the request sent. */
|
|
193
|
+
connectors: Schema.Array(Schema.String),
|
|
166
194
|
/**
|
|
167
195
|
* The terms of the shared sign-in service, which the log shows once, for the new client. Exactly
|
|
168
196
|
* this page: the log line must not print a value that the answer chose.
|
|
@@ -185,7 +213,7 @@ const REFUSALS: Readonly<Record<number, string>> = {
|
|
|
185
213
|
|
|
186
214
|
/** The reasons of a 403 that a log line shows. Any other text of the answer is never logged. */
|
|
187
215
|
const NOT_ALLOWED = new Map([
|
|
188
|
-
["paused", "
|
|
216
|
+
["paused", "this app is paused on the identity hub"],
|
|
189
217
|
["run_not_allowed", "the identity hub gives clients only to runs of main and of pull requests"],
|
|
190
218
|
["blocked", "Samebase blocked this repository or its owner"],
|
|
191
219
|
["suspended", "the identity hub suspended this repository"],
|
|
@@ -211,20 +239,37 @@ const RATE_LIMITED = new Map([
|
|
|
211
239
|
|
|
212
240
|
const Refusal = Schema.Struct({ reason: Schema.String });
|
|
213
241
|
const RateLimited = Schema.Struct({ window: Schema.String });
|
|
242
|
+
/** A 400 for a connector the hub does not offer or allow, with the names it allows. */
|
|
243
|
+
const InvalidConnectors = Schema.Struct({
|
|
244
|
+
error: Schema.Literal("invalid_connectors"),
|
|
245
|
+
allowed: Schema.Array(Schema.String),
|
|
246
|
+
});
|
|
214
247
|
|
|
215
|
-
/**
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
248
|
+
/**
|
|
249
|
+
* The text of a refusal: a known reason of a 403 or window of a 429, the allowed connectors of an
|
|
250
|
+
* `invalid_connectors` 400 (only names of the connector grammar, so no other text of the answer is
|
|
251
|
+
* printed), else the text of its status.
|
|
252
|
+
*/
|
|
253
|
+
const refusalOf = (status: number, body: unknown): string => {
|
|
254
|
+
const decoded = <S extends Schema.Codec<unknown, unknown>>(schema: S) =>
|
|
255
|
+
Option.getOrUndefined(Schema.decodeUnknownOption(schema)(body));
|
|
256
|
+
const ofStatus = () => REFUSALS[status] ?? "the identity hub refused the request";
|
|
257
|
+
switch (status) {
|
|
258
|
+
case 400: {
|
|
259
|
+
const allowed = decoded(InvalidConnectors)?.allowed.filter((name) =>
|
|
260
|
+
CONNECTOR_NAME.test(name),
|
|
261
|
+
);
|
|
262
|
+
return allowed === undefined
|
|
263
|
+
? ofStatus()
|
|
264
|
+
: `the identity hub does not offer or allow one of the connectors; it allows ${allowed.length === 0 ? "none for this app" : allowed.join(", ")}`;
|
|
265
|
+
}
|
|
266
|
+
case 403:
|
|
267
|
+
return NOT_ALLOWED.get(decoded(Refusal)?.reason ?? "") ?? ofStatus();
|
|
268
|
+
case 429:
|
|
269
|
+
return RATE_LIMITED.get(decoded(RateLimited)?.window ?? "") ?? ofStatus();
|
|
270
|
+
default:
|
|
271
|
+
return ofStatus();
|
|
272
|
+
}
|
|
228
273
|
};
|
|
229
274
|
|
|
230
275
|
const send = (who: string, url: string, token: string, init: { method: string; body?: string }) =>
|
|
@@ -266,7 +311,11 @@ const readOidcToken = (requestUrl: string, requestToken: string) =>
|
|
|
266
311
|
});
|
|
267
312
|
|
|
268
313
|
/** `POST /hub-clients` with `bearer`: the GitHub OIDC token, or the app's initial access token. */
|
|
269
|
-
const requestNewClient = (
|
|
314
|
+
const requestNewClient = (
|
|
315
|
+
props: SharedHubClientProps,
|
|
316
|
+
connectors: readonly string[],
|
|
317
|
+
bearer: string,
|
|
318
|
+
) =>
|
|
270
319
|
Effect.gen(function* () {
|
|
271
320
|
const { body, status } = yield* send(
|
|
272
321
|
"The identity hub",
|
|
@@ -278,6 +327,7 @@ const requestNewClient = (props: SharedHubClientProps, bearer: string) =>
|
|
|
278
327
|
app: props.app,
|
|
279
328
|
redirectUri: props.redirectUri,
|
|
280
329
|
softwareVersion: props.softwareVersion ?? "unknown",
|
|
330
|
+
connectors,
|
|
281
331
|
}),
|
|
282
332
|
},
|
|
283
333
|
);
|
|
@@ -289,9 +339,9 @@ const requestNewClient = (props: SharedHubClientProps, bearer: string) =>
|
|
|
289
339
|
return yield* new SharedHubClientFailed({ reason: `${reason} (HTTP ${status})` });
|
|
290
340
|
}
|
|
291
341
|
const client = yield* decode(NewClient, "The identity hub")(body);
|
|
292
|
-
// The hub registers the address that the request sent. The log
|
|
293
|
-
// value that the answer chose is printed.
|
|
294
|
-
if (client.redirect_uri !== props.redirectUri) {
|
|
342
|
+
// The hub registers the address and the connectors that the request sent. The log and the state
|
|
343
|
+
// hold the request's, so no value that the answer chose is printed or kept.
|
|
344
|
+
if (client.redirect_uri !== props.redirectUri || !sameSet(client.connectors, connectors)) {
|
|
295
345
|
return yield* new SharedHubClientFailed({ reason: "The identity hub gave a bad answer" });
|
|
296
346
|
}
|
|
297
347
|
yield* Effect.logInfo(
|
|
@@ -308,18 +358,19 @@ const requestNewClient = (props: SharedHubClientProps, bearer: string) =>
|
|
|
308
358
|
registrationClientUri: client.registration_client_uri,
|
|
309
359
|
deploymentType: props.deploymentType,
|
|
310
360
|
redirectUri: props.redirectUri,
|
|
361
|
+
connectors,
|
|
311
362
|
initialAccessToken: Redacted.make(production ? (client.initial_access_token ?? "") : ""),
|
|
312
363
|
repository: production ? (client.repository ?? "") : "",
|
|
313
364
|
};
|
|
314
365
|
});
|
|
315
366
|
|
|
316
367
|
/** A new client, or the off values. */
|
|
317
|
-
const newClient = (props: SharedHubClientProps) => {
|
|
368
|
+
const newClient = (props: SharedHubClientProps, connectors: readonly string[]) => {
|
|
318
369
|
const label = `Convex.SharedHubClient: ${props.app} on ${props.redirectUri} deploys without the hub`;
|
|
319
370
|
const off = offAttributes(props.deploymentType);
|
|
320
371
|
const request = (bearer: Effect.Effect<string, SharedHubClientFailed>) =>
|
|
321
372
|
bearer.pipe(
|
|
322
|
-
Effect.flatMap((token) => requestNewClient(props, token)),
|
|
373
|
+
Effect.flatMap((token) => requestNewClient(props, connectors, token)),
|
|
323
374
|
Effect.catchTag("SharedHubClientFailed", (error) =>
|
|
324
375
|
Effect.logWarning(`${label}: ${error.reason}. The next deploy asks again.`).pipe(
|
|
325
376
|
Effect.as(off),
|
|
@@ -331,15 +382,15 @@ const newClient = (props: SharedHubClientProps) => {
|
|
|
331
382
|
const token = Redacted.value(props.initialAccessToken);
|
|
332
383
|
return token === ""
|
|
333
384
|
? Effect.logInfo(
|
|
334
|
-
"Convex.SharedHubClient: deploy to main once for
|
|
385
|
+
"Convex.SharedHubClient: deploy to main once for hub sign-in in development.",
|
|
335
386
|
).pipe(Effect.as(off))
|
|
336
387
|
: request(Effect.succeed(token));
|
|
337
388
|
}
|
|
338
389
|
|
|
339
390
|
const requestUrl = process.env["ACTIONS_ID_TOKEN_REQUEST_URL"];
|
|
340
391
|
const requestToken = process.env["ACTIONS_ID_TOKEN_REQUEST_TOKEN"];
|
|
341
|
-
// A
|
|
342
|
-
// is a mistake to show, not a normal run.
|
|
392
|
+
// A development machine, or another CI. In a workflow, `id-token: write` gives both, so a
|
|
393
|
+
// workflow without them is a mistake to show, not a normal run.
|
|
343
394
|
if (!requestUrl || !requestToken) {
|
|
344
395
|
return (
|
|
345
396
|
process.env["GITHUB_ACTIONS"] === "true"
|
|
@@ -401,14 +452,15 @@ const SavedRow = Schema.Struct({
|
|
|
401
452
|
|
|
402
453
|
/**
|
|
403
454
|
* The attributes of the client `id` in another stage of this stack, such as
|
|
404
|
-
* `read("HubClient", { stage: "prod" })` in
|
|
455
|
+
* `read("HubClient", { stage: "prod" })` in a development stage, as Outputs: the
|
|
405
456
|
* `initialAccessToken` and the `repository` of the production client. Without that row, the off
|
|
406
457
|
* attributes, with `deploymentType: "production"`.
|
|
407
458
|
*
|
|
408
459
|
* `SharedHubClient.ref` is not enough: Alchemy fails the plan with `InvalidReferenceError` when the
|
|
409
|
-
* row is missing, and a
|
|
410
|
-
* plan resolves it, with the State service of the running stack and its `get`, so it never
|
|
411
|
-
* or upgrades a store. The store revives each secret as `Redacted`, as it does for every
|
|
460
|
+
* row is missing, and a development stage before the first deploy to main has none. This read runs
|
|
461
|
+
* when the plan resolves it, with the State service of the running stack and its `get`, so it never
|
|
462
|
+
* creates or upgrades a store. The store revives each secret as `Redacted`, as it does for every
|
|
463
|
+
* read.
|
|
412
464
|
*/
|
|
413
465
|
const read = (id: string, options: { readonly stage: string }) =>
|
|
414
466
|
Output.fromEffect(
|
|
@@ -481,11 +533,21 @@ export const SharedHubClientProvider = () =>
|
|
|
481
533
|
|
|
482
534
|
read: ({ output }) => Effect.succeed(output),
|
|
483
535
|
|
|
484
|
-
// Only a client of the same return address and
|
|
485
|
-
// version's shape, such as one that 0.
|
|
486
|
-
// one, which replaces the saved client, and for a production client also
|
|
487
|
-
// initial access token.
|
|
536
|
+
// Only a client of the same return address, type, and connector set is renewed. A saved row
|
|
537
|
+
// without this version's shape, such as one that 0.32 or earlier saved, is no client: the run
|
|
538
|
+
// asks for a new one, which replaces the saved client, and for a production client also
|
|
539
|
+
// replaces the app's initial access token.
|
|
488
540
|
reconcile: Effect.fn(function* ({ news, output }) {
|
|
541
|
+
// A bad prop is a mistake of the stack, not of the hub: the run fails, with no request.
|
|
542
|
+
if (
|
|
543
|
+
news.connectors.length === 0 ||
|
|
544
|
+
!news.connectors.every((name) => CONNECTOR_NAME.test(name))
|
|
545
|
+
) {
|
|
546
|
+
return yield* new SharedHubClientFailed({
|
|
547
|
+
reason: `${news.app} on ${news.redirectUri} needs connectors: one or more names of [a-z0-9-]{1,64}`,
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
const connectors = connectorSet(news.connectors);
|
|
489
551
|
const saved =
|
|
490
552
|
output === undefined || output.status === "off"
|
|
491
553
|
? undefined
|
|
@@ -496,10 +558,12 @@ export const SharedHubClientProvider = () =>
|
|
|
496
558
|
);
|
|
497
559
|
}
|
|
498
560
|
const renewed =
|
|
499
|
-
saved?.redirectUri === news.redirectUri &&
|
|
561
|
+
saved?.redirectUri === news.redirectUri &&
|
|
562
|
+
saved.deploymentType === news.deploymentType &&
|
|
563
|
+
sameSet(saved.connectors, connectors)
|
|
500
564
|
? yield* renew(saved, news.required === true)
|
|
501
565
|
: undefined;
|
|
502
|
-
const client = renewed ?? (yield* newClient(news));
|
|
566
|
+
const client = renewed ?? (yield* newClient(news, connectors));
|
|
503
567
|
if (news.required === true && client.status !== "on") {
|
|
504
568
|
return yield* new SharedHubClientFailed({
|
|
505
569
|
reason: `${news.app} on ${news.redirectUri} is required and has no working client (${client.status}). The warning above names the reason`,
|
package/src/StackComment.ts
CHANGED
|
@@ -54,7 +54,10 @@ const Resource = Schema.Union([
|
|
|
54
54
|
}),
|
|
55
55
|
Schema.Struct({
|
|
56
56
|
resourceType: Schema.Literal("IdentityHub.SharedClient"),
|
|
57
|
-
attr: Schema.Struct({
|
|
57
|
+
attr: Schema.Struct({
|
|
58
|
+
status: Schema.Literals(["on", "off", "suspended"]),
|
|
59
|
+
connectors: Schema.Array(Schema.String),
|
|
60
|
+
}),
|
|
58
61
|
}),
|
|
59
62
|
]);
|
|
60
63
|
type Resource = typeof Resource.Type;
|
|
@@ -188,8 +191,10 @@ const resourceRow = (resource: Resource, address: string | null) => {
|
|
|
188
191
|
);
|
|
189
192
|
}
|
|
190
193
|
case "IdentityHub.SharedClient": {
|
|
191
|
-
const { status } = resource.attr;
|
|
192
|
-
return
|
|
194
|
+
const { status, connectors } = resource.attr;
|
|
195
|
+
return status === "off"
|
|
196
|
+
? "Sign-in: not set up"
|
|
197
|
+
: `Sign-in with ${connectors.join(", ")}: ${status}`;
|
|
193
198
|
}
|
|
194
199
|
}
|
|
195
200
|
};
|
|
@@ -72,7 +72,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
72
72
|
recordedAt: string;
|
|
73
73
|
repository: string;
|
|
74
74
|
runUrl: string | null;
|
|
75
|
-
source: "github-actions" | "
|
|
75
|
+
source: "github-actions" | "checkout";
|
|
76
76
|
stackFile: string;
|
|
77
77
|
version: 1;
|
|
78
78
|
};
|
|
@@ -131,7 +131,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
131
131
|
recordedAt: string;
|
|
132
132
|
repository: string;
|
|
133
133
|
runUrl: string | null;
|
|
134
|
-
source: "github-actions" | "
|
|
134
|
+
source: "github-actions" | "checkout";
|
|
135
135
|
stackFile: string;
|
|
136
136
|
version: 1;
|
|
137
137
|
} | null;
|
|
@@ -153,7 +153,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
153
153
|
recordedAt: string;
|
|
154
154
|
repository: string;
|
|
155
155
|
runUrl: string | null;
|
|
156
|
-
source: "github-actions" | "
|
|
156
|
+
source: "github-actions" | "checkout";
|
|
157
157
|
stackFile: string;
|
|
158
158
|
version: 1;
|
|
159
159
|
} | null;
|
|
@@ -232,7 +232,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
232
232
|
recordedAt: string;
|
|
233
233
|
repository: string;
|
|
234
234
|
runUrl: string | null;
|
|
235
|
-
source: "github-actions" | "
|
|
235
|
+
source: "github-actions" | "checkout";
|
|
236
236
|
stackFile: string;
|
|
237
237
|
version: 1;
|
|
238
238
|
} | null;
|
|
@@ -254,7 +254,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
254
254
|
recordedAt: string;
|
|
255
255
|
repository: string;
|
|
256
256
|
runUrl: string | null;
|
|
257
|
-
source: "github-actions" | "
|
|
257
|
+
source: "github-actions" | "checkout";
|
|
258
258
|
stackFile: string;
|
|
259
259
|
version: 1;
|
|
260
260
|
} | null;
|
|
@@ -8,7 +8,7 @@ export const runRecord = v.object({
|
|
|
8
8
|
pullRequest: v.union(v.number(), v.null()),
|
|
9
9
|
headCommit: v.string(),
|
|
10
10
|
runUrl: v.union(v.string(), v.null()),
|
|
11
|
-
source: v.union(v.literal("github-actions"), v.literal("
|
|
11
|
+
source: v.union(v.literal("github-actions"), v.literal("checkout")),
|
|
12
12
|
recordedAt: v.string(),
|
|
13
13
|
});
|
|
14
14
|
|
|
@@ -16,7 +16,7 @@ type RunRecord = Infer<typeof runRecord>;
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* True when a write with `next` must replace `current`, the record of the stage. Records that differ
|
|
19
|
-
* only in `recordedAt`, the time of one write, name the same run. Two
|
|
19
|
+
* only in `recordedAt`, the time of one write, name the same run. Two checkout deploys of one commit
|
|
20
20
|
* have no `runUrl`, so they are the same run too. A write without a record (`null`) clears one.
|
|
21
21
|
*/
|
|
22
22
|
export const runChanged = (current: RunRecord | undefined, next: RunRecord | null) => {
|
|
@@ -12,4 +12,5 @@
|
|
|
12
12
|
// 4: the store is a component (same functions).
|
|
13
13
|
// 5: rows hold their secrets sealed: `set` and `setOutput` are actions, with `sealing`, `chooseKey`,
|
|
14
14
|
// `rotateKey`, and `reseal` (0.19.0).
|
|
15
|
-
|
|
15
|
+
// 6: a run record's `source` is `github-actions` or `checkout`, no longer `laptop` (0.32.0).
|
|
16
|
+
export const STORE_VERSION = 6;
|