@samebase/alchemy-convex 0.19.1 → 0.20.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 CHANGED
@@ -308,6 +308,22 @@ call.
308
308
  the `Convex.Deployment` writes to the deployment. Another `redirectUri` is a new client, and a
309
309
  destroy deletes the client.
310
310
 
311
+ - `Convex.SharedHubClient`: `{ app, deployment, deploymentType, softwareVersion? }` gets a client of
312
+ the central identity hub through samebase.com, for an app that deploys in its own GitHub Actions
313
+ run. The workflow needs `permissions: id-token: write` and no Samebase key. Outputs `status`,
314
+ `issuer`, `clientId`, `clientSecret`, `registrationAccessToken`, `registrationClientUri`,
315
+ `deployment`, `deploymentType`, and `redirectUri`.
316
+ - Each deploy reads the saved client on the hub with its own token. A client that is gone gets a
317
+ new one, and a client on another deployment too.
318
+ - No failure stops a deploy or a destroy. A failed renewal keeps the saved values. Without saved
319
+ values, `status` is `off`, and `issuer`, `clientId`, and `clientSecret` are the `no-hub` values
320
+ of a checkout without a hub. A run without a GitHub OIDC token, such as on a laptop, does the
321
+ same, and logs no warning.
322
+ - `status` is `suspended` when the hub suspended the client. The client keeps its values.
323
+ - A destroy deletes a preview client. It does nothing to a production client, because the
324
+ production deployment can stay.
325
+ - `SAMEBASE_URL` replaces `https://samebase.com`.
326
+
311
327
  A development deployment has no stack, so the package has a command for it. Run it in the directory
312
328
  of the app, before the first push: it registers the deployment of that directory with
313
329
  `CONVEX_ACCESS_TOKEN` or the Convex CLI login, and writes `HUB_ISSUER`, `HUB_CLIENT_ID`, and
@@ -320,9 +336,10 @@ npx alchemy-convex hub-client --team my-team --app scout --callback-path /auth/h
320
336
  ## Pull request comment
321
337
 
322
338
  `alchemy-convex stack-comment` keeps one comment on a pull request. The comment has a card for each
323
- stack of the repository at the stage `pr-<number>`: the folder, the address, the last run, and the
324
- Convex deployments, Workers, and R2 buckets. A stack sees only itself, so a comment that a stack
325
- declares cannot show this.
339
+ stack of the repository at the stage `pr-<number>`: the folder, the address, the last run, the
340
+ Convex deployments, Workers, and R2 buckets, and the Google sign-in status of a
341
+ `Convex.SharedHubClient`. A stack sees only itself, so a comment that a stack declares cannot show
342
+ this.
326
343
 
327
344
  Run it after every deploy of the workflow. The run record gives the repository and the pull request,
328
345
  so the command needs no argument with a team access token:
@@ -304,7 +304,7 @@ rootDir: Schema.String }) {
304
304
  var CodePushFailed = class extends Schema.TaggedError()("CodePushFailed", {
305
305
  /** Exit code of the CLI. Undefined when it did not start or a signal stopped it. */
306
306
  exitCode: Schema.UndefinedOr(Schema.Number),
307
- /** The last lines of the CLI output, with the deploy key removed. */
307
+ /** The last lines of the CLI output, with the deploy key and the `Redacted` values of `env` removed. */
308
308
  outputTail: Schema.String
309
309
  }) {
310
310
  get message() {
@@ -597,7 +597,11 @@ const push = (spawner, key, options) => Effect.gen(function* () {
597
597
  const runPush = (spawner, key, options) => Effect.gen(function* () {
598
598
  const { cwd, program } = options;
599
599
  const secret = Redacted.value(key);
600
- const secrets = [secret, secret.slice(secret.indexOf("|") + 1)].filter((value) => value.length >= 8);
600
+ const secrets = [
601
+ secret,
602
+ secret.slice(secret.indexOf("|") + 1),
603
+ ...Object.values(options.env).flatMap((value) => Redacted.isRedacted(value) ? [Redacted.value(value)] : [])
604
+ ].filter((value) => value.length >= 8);
601
605
  const result = yield* withKeyFile(secret, ({ envFile, home }) => Effect.gen(function* () {
602
606
  const [command, ...programArgs] = program;
603
607
  const args = options.command === void 0 ? [
@@ -1953,4 +1957,4 @@ const registerDevelopmentClient = (options) => Effect.gen(function* () {
1953
1957
  //#endregion
1954
1958
  export { PushTargetMismatch as A, DEPLOY_KEY_ENV as B, DeploymentProvider as C, ConvexAppNotFound as D, CodePushFailed as E, ManagementApi as F, fromValues as H, ManagementApiLive as I, ACCESS_TOKEN_ENV as L, installedCli as M, parseDeployOutput as N, ConvexCliNotFound as O, ConvexApiError as P, Credentials as R, DeploymentIdentityChange as S, ProductionDeploymentNotFound as T, fromConfig as V, ProjectProvider as _, registerDevelopmentClient as a, AmbiguousDeployment as b, RUN_RECORD_KEY as c, withRunRecord as d, AmbiguousProject as f, ProjectNotFound as g, ProjectDeploymentChange as h, HubClientProvider as i, VariablesOwnedBySomeoneElse as j, EnvironmentNeedsDeployKey as k, RunRecordError as l, Project as m, HubClient as n, STORE_PROJECT_NAME as o, CreatedProjectNotFound as p, HubClientFailed as r, state as s, HUB_PROJECT_NAME as t, runRecord as u, ProjectTeamChange as v, DeploymentResource as w, Deployment as x, AbsoluteRootDir as y, CredentialsError as z };
1955
1959
 
1956
- //# sourceMappingURL=HubClient-NUvPkolM.js.map
1960
+ //# sourceMappingURL=HubClient-Dzw8uZNy.js.map