@samebase/alchemy-convex 0.20.0 → 0.22.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 +15 -6
- package/lib/{HubClient-Dzw8uZNy.js → HubClient-B6hjkbjW.js} +9 -9
- package/lib/{HubClient-Dzw8uZNy.js.map → HubClient-B6hjkbjW.js.map} +1 -1
- package/lib/cli.js +7 -5
- package/lib/cli.js.map +1 -1
- package/lib/index.d.ts +7 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +28 -11
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/HubClient.ts +10 -5
- package/src/SharedHubClient.ts +55 -21
- package/src/cli.ts +5 -4
package/README.md
CHANGED
|
@@ -308,13 +308,17 @@ 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,
|
|
312
|
-
the central identity hub through samebase.com, for an app that deploys in its own GitHub
|
|
313
|
-
run. The workflow needs `permissions: id-token: write` and no Samebase key.
|
|
314
|
-
|
|
315
|
-
`
|
|
311
|
+
- `Convex.SharedHubClient`: `{ app, redirectUri, deploymentType, softwareVersion? }` gets a client
|
|
312
|
+
of the central identity hub through samebase.com, for an app that deploys in its own GitHub
|
|
313
|
+
Actions run, on any host. The workflow needs `permissions: id-token: write` and no Samebase key.
|
|
314
|
+
The origin of `redirectUri` must serve `/samebase-verification.json` with the numeric GitHub id of
|
|
315
|
+
the repository, `{ "repository": "123" }`, which `gh api repos/<owner>/<name> --jq .id` prints.
|
|
316
|
+
Samebase reads it before it registers the client, so the site must be live first. Outputs
|
|
317
|
+
`status`, `issuer`, `clientId`, `clientSecret`, `registrationAccessToken`,
|
|
318
|
+
`registrationClientUri`, `deploymentType`, and `redirectUri`.
|
|
316
319
|
- 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
|
|
320
|
+
new one, and a client on another `redirectUri` too.
|
|
321
|
+
- A refusal logs its reason, such as a host that does not serve the file.
|
|
318
322
|
- No failure stops a deploy or a destroy. A failed renewal keeps the saved values. Without saved
|
|
319
323
|
values, `status` is `off`, and `issuer`, `clientId`, and `clientSecret` are the `no-hub` values
|
|
320
324
|
of a checkout without a hub. A run without a GitHub OIDC token, such as on a laptop, does the
|
|
@@ -333,6 +337,11 @@ of the app, before the first push: it registers the deployment of that directory
|
|
|
333
337
|
npx alchemy-convex hub-client --team my-team --app scout --callback-path /auth/hub/callback
|
|
334
338
|
```
|
|
335
339
|
|
|
340
|
+
For a separate API-connection callback, register another client with
|
|
341
|
+
`--callback-path /oauth/hub/callback --env-prefix RESOURCE_HUB`. This writes `RESOURCE_HUB_ISSUER`,
|
|
342
|
+
`RESOURCE_HUB_CLIENT_ID`, and `RESOURCE_HUB_CLIENT_SECRET`, preserving the sign-in client's
|
|
343
|
+
variables. Each callback remains one exact registered URI.
|
|
344
|
+
|
|
336
345
|
## Pull request comment
|
|
337
346
|
|
|
338
347
|
`alchemy-convex stack-comment` keeps one comment on a pull request. The comment has a card for each
|
|
@@ -1910,12 +1910,6 @@ const HubClientProvider = () => Provider.effect(HubClient, Effect.gen(function*
|
|
|
1910
1910
|
delete: ({ olds, output }) => unregister(api, olds.team, output.clientId).pipe(Effect.asVoid)
|
|
1911
1911
|
};
|
|
1912
1912
|
}));
|
|
1913
|
-
/** The variables that a deployment reads to sign in through the hub. */
|
|
1914
|
-
const HUB_VARIABLES = [
|
|
1915
|
-
"HUB_ISSUER",
|
|
1916
|
-
"HUB_CLIENT_ID",
|
|
1917
|
-
"HUB_CLIENT_SECRET"
|
|
1918
|
-
];
|
|
1919
1913
|
/**
|
|
1920
1914
|
* `alchemy-convex hub-client`: a stack deploys production and previews, and this covers the
|
|
1921
1915
|
* development deployment, which no stack deploys. A deployment with all three variables keeps
|
|
@@ -1924,12 +1918,18 @@ const HUB_VARIABLES = [
|
|
|
1924
1918
|
*/
|
|
1925
1919
|
const registerDevelopmentClient = (options) => Effect.gen(function* () {
|
|
1926
1920
|
const { convex } = options;
|
|
1921
|
+
const envPrefix = options.envPrefix ?? "HUB";
|
|
1922
|
+
const variables = [
|
|
1923
|
+
`${envPrefix}_ISSUER`,
|
|
1924
|
+
`${envPrefix}_CLIENT_ID`,
|
|
1925
|
+
`${envPrefix}_CLIENT_SECRET`
|
|
1926
|
+
];
|
|
1927
1927
|
const names = convex([
|
|
1928
1928
|
"env",
|
|
1929
1929
|
"list",
|
|
1930
1930
|
"--names-only"
|
|
1931
1931
|
]).split("\n");
|
|
1932
|
-
if (
|
|
1932
|
+
if (variables.every((name) => names.includes(name))) return void 0;
|
|
1933
1933
|
const siteUrl = yield* Schema.decodeUnknownEffect(Schema.fromJsonString(Schema.String))(convex([
|
|
1934
1934
|
"run",
|
|
1935
1935
|
"--inline-query",
|
|
@@ -1951,10 +1951,10 @@ const registerDevelopmentClient = (options) => Effect.gen(function* () {
|
|
|
1951
1951
|
"env",
|
|
1952
1952
|
"set",
|
|
1953
1953
|
"--force"
|
|
1954
|
-
],
|
|
1954
|
+
], `${envPrefix}_ISSUER='${client.issuer}'\n${envPrefix}_CLIENT_ID='${client.clientId}'\n${envPrefix}_CLIENT_SECRET='${Redacted.value(client.clientSecret)}'\n`);
|
|
1955
1955
|
return callbackUrl;
|
|
1956
1956
|
});
|
|
1957
1957
|
//#endregion
|
|
1958
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 };
|
|
1959
1959
|
|
|
1960
|
-
//# sourceMappingURL=HubClient-
|
|
1960
|
+
//# sourceMappingURL=HubClient-B6hjkbjW.js.map
|