From cb59176b63a955d52b02414f35ff8f3017c46da6 Mon Sep 17 00:00:00 2001 From: Nicu Chiciuc Date: Fri, 30 Oct 2026 11:01:27 +0200 Subject: [PATCH] Read the reader's custom claims with bracket access (0.14.1) A base app compiles src/store/functions.ts under its own tsconfig, and the hub sets noPropertyAccessFromIndexSignature, so dot access on custom claims fails its typecheck and its deploy. No function changes. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 6 ++++++ package.json | 2 +- src/store/functions.ts | 14 ++++++++------ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c26b42..881ac38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/package.json b/package.json index ea2c68e..0534c3a 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/store/functions.ts b/src/store/functions.ts index b800671..9a9bf7f 100644 --- a/src/store/functions.ts +++ b/src/store/functions.ts @@ -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 }); }, }), });