@samebase/alchemy-convex 0.16.0 → 0.18.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/NOTICE +3 -0
- package/README.md +28 -1
- package/lib/{HubClient-BYBV7cF5.js → HubClient-BZKweNfD.js} +2 -2
- package/lib/{HubClient-BYBV7cF5.js.map → HubClient-BZKweNfD.js.map} +1 -1
- package/lib/cli.js +215 -9
- package/lib/cli.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/src/HubClient.ts +3 -3
- package/src/StackComment.ts +307 -0
- package/src/cli.ts +50 -32
package/NOTICE
CHANGED
|
@@ -8,6 +8,9 @@ packages/alchemy, under the ISC license:
|
|
|
8
8
|
- the Convex CLI runner in src/Push.ts (internal/CommandRunner.ts),
|
|
9
9
|
- the deployment lookup rules in src/Deployment.ts and the project listing in src/Project.ts.
|
|
10
10
|
|
|
11
|
+
The Workers and R2 icons in assets/stack-comment are by Cloudflare, under CC BY 4.0
|
|
12
|
+
(https://creativecommons.org/licenses/by/4.0/), with Cloudflare orange fill.
|
|
13
|
+
|
|
11
14
|
ISC License
|
|
12
15
|
|
|
13
16
|
Copyright 2024 RJ Dellecese
|
package/README.md
CHANGED
|
@@ -276,7 +276,7 @@ call.
|
|
|
276
276
|
|
|
277
277
|
- `Convex.HubClient`: `{ team, app, redirectUri, deploymentType, clientName, softwareVersion? }`
|
|
278
278
|
registers one deployment as a client of the identity hub of the team. The hub is the production
|
|
279
|
-
deployment of the project `
|
|
279
|
+
deployment of the project `identity-hub`. The resource finds it by name and runs
|
|
280
280
|
its internal function `identityBroker:registerClient` with a short-lived key, so the stack needs no
|
|
281
281
|
other credential and no hub address. The first client of an `app` creates the app. Outputs
|
|
282
282
|
`issuer`, `clientId`, `clientSecret`, `redirectUri`, `deploymentType`, and `clientName`, which the
|
|
@@ -292,6 +292,33 @@ of the app, before the first push: it registers the deployment of that directory
|
|
|
292
292
|
npx alchemy-convex hub-client --team my-team --app scout --callback-path /auth/hub/callback
|
|
293
293
|
```
|
|
294
294
|
|
|
295
|
+
## Pull request comment
|
|
296
|
+
|
|
297
|
+
`alchemy-convex stack-comment` keeps one comment on a pull request. The comment has a card for each
|
|
298
|
+
stack of the repository at the stage `pr-<number>`: the folder, the address, the last run, and the
|
|
299
|
+
Convex deployments, Workers, and R2 buckets. A stack sees only itself, so a comment that a stack
|
|
300
|
+
declares cannot show this.
|
|
301
|
+
|
|
302
|
+
Run it after every deploy of the workflow. The run record gives the repository and the pull request,
|
|
303
|
+
so the command needs no argument with a team access token:
|
|
304
|
+
|
|
305
|
+
```yaml
|
|
306
|
+
permissions:
|
|
307
|
+
pull-requests: write
|
|
308
|
+
|
|
309
|
+
steps:
|
|
310
|
+
# The deploy steps of each stack.
|
|
311
|
+
- name: Update the stack comment
|
|
312
|
+
if: github.event_name == 'pull_request'
|
|
313
|
+
run: pnpm exec alchemy-convex stack-comment
|
|
314
|
+
env:
|
|
315
|
+
CONVEX_ACCESS_TOKEN: ${{ secrets.CONVEX_ACCESS_TOKEN }}
|
|
316
|
+
GITHUB_TOKEN: ${{ github.token }}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
A stack named `owner/name`, or `owner/name/<folder>` for a stack in a folder, belongs to the
|
|
320
|
+
repository `owner/name`. A stack without the stage of the pull request has no card.
|
|
321
|
+
|
|
295
322
|
## Data safety
|
|
296
323
|
|
|
297
324
|
- `Convex.Project` and `Convex.Deployment` have the removal policy `retain`. `alchemy destroy`
|
|
@@ -1782,7 +1782,7 @@ const state = (options = {}) => Layer.effect(State, Effect.gen(function* () {
|
|
|
1782
1782
|
//#endregion
|
|
1783
1783
|
//#region src/HubClient.ts
|
|
1784
1784
|
/** The name of the project of the hub in each team. */
|
|
1785
|
-
const HUB_PROJECT_NAME = "
|
|
1785
|
+
const HUB_PROJECT_NAME = "identity-hub";
|
|
1786
1786
|
const HubClient = Resource("IdentityHub.Client");
|
|
1787
1787
|
/** The hub of the team could not do the call. The reason is the Convex message: it holds no secret. */
|
|
1788
1788
|
var HubClientFailed = class extends Schema.TaggedError()("HubClientFailed", {
|
|
@@ -1910,4 +1910,4 @@ const registerDevelopmentClient = (options) => Effect.gen(function* () {
|
|
|
1910
1910
|
//#endregion
|
|
1911
1911
|
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 };
|
|
1912
1912
|
|
|
1913
|
-
//# sourceMappingURL=HubClient-
|
|
1913
|
+
//# sourceMappingURL=HubClient-BZKweNfD.js.map
|