@samebase/alchemy-convex 0.14.0 → 0.14.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@samebase/alchemy-convex",
3
- "version": "0.14.0",
3
+ "version": "0.14.1",
4
4
  "description": "The Convex plane for Alchemy v2: projects, deployments, environment variables, and the push of the functions",
5
5
  "keywords": [
6
6
  "alchemy",
@@ -193,20 +193,22 @@ export const readerFunctions = (alchemyState: ComponentApi) => ({
193
193
  returns: repositoryReply,
194
194
  handler: async (ctx) => {
195
195
  const identity = await ctx.auth.getUserIdentity();
196
+ // Custom claims are bracket reads: a base app compiles this file under its own tsconfig,
197
+ // which can set noPropertyAccessFromIndexSignature.
198
+ const scope = identity?.["scope"];
199
+ const repository = identity?.["repository"];
196
200
  // Only a token of the deployment's own issuer reads, the one that `authorize` signs: a base
197
201
  // can accept other providers too, and a token of one of those with the same claims does not.
198
202
  if (
199
203
  identity === null ||
200
204
  identity.issuer !== env.CONVEX_CLOUD_URL ||
201
- identity.scope !== "alchemy:read" ||
202
- typeof identity.repository !== "string" ||
203
- !repositoryName.test(identity.repository)
205
+ scope !== "alchemy:read" ||
206
+ typeof repository !== "string" ||
207
+ !repositoryName.test(repository)
204
208
  ) {
205
209
  throw new Error("Alchemy repository read access is required.");
206
210
  }
207
- return await ctx.runQuery(alchemyState.reader.repository, {
208
- repository: identity.repository,
209
- });
211
+ return await ctx.runQuery(alchemyState.reader.repository, { repository });
210
212
  },
211
213
  }),
212
214
  });