Skip to content
This repository was archived by the owner on Oct 31, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.14.1 (unreleased)

A base app compiles the exported store functions under its own tsconfig. `reader:repository` reads
its custom claims with bracket access, so a base app with `noPropertyAccessFromIndexSignature` needs
no change. No function changes.

## 0.14.0 (unreleased)

The package exports the functions of the state store, so that the base app of a team serves the
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@samebase/alchemy-convex",
"version": "0.14.0",
"version": "0.14.1",
"description": "The Convex plane for Alchemy v2: projects, deployments, environment variables, and the push of the functions",
"keywords": [
"alchemy",
Expand Down
14 changes: 8 additions & 6 deletions src/store/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,20 +193,22 @@ export const readerFunctions = (alchemyState: ComponentApi) => ({
returns: repositoryReply,
handler: async (ctx) => {
const identity = await ctx.auth.getUserIdentity();
// Custom claims are bracket reads: a base app compiles this file under its own tsconfig,
// which can set noPropertyAccessFromIndexSignature.
const scope = identity?.["scope"];
const repository = identity?.["repository"];
// Only a token of the deployment's own issuer reads, the one that `authorize` signs: a base
// can accept other providers too, and a token of one of those with the same claims does not.
if (
identity === null ||
identity.issuer !== env.CONVEX_CLOUD_URL ||
identity.scope !== "alchemy:read" ||
typeof identity.repository !== "string" ||
!repositoryName.test(identity.repository)
scope !== "alchemy:read" ||
typeof repository !== "string" ||
!repositoryName.test(repository)
) {
throw new Error("Alchemy repository read access is required.");
}
return await ctx.runQuery(alchemyState.reader.repository, {
repository: identity.repository,
});
return await ctx.runQuery(alchemyState.reader.repository, { repository });
},
}),
});
Loading