feat(fn-secrets): add package for resolving function secrets from database#48
feat(fn-secrets): add package for resolving function secrets from database#48theothersideofgod wants to merge 5 commits into
Conversation
…abase Adds @constructive-io/fn-secrets package that enables cloud functions to resolve encrypted secrets at runtime via GraphQL. Supports per-tenant secret overrides with fallback to global defaults. - resolveSecrets(context, functionName) - returns SecretsMap - resolveSecretsRaw() - returns full secret details with source - 10 unit tests covering all error cases Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Instead of creating a new GraphQL client for each resolveSecrets() call, reuse the existing context.client and override headers via the third argument to client.request(). This enables dynamic schema access via X-Schemata header without duplicating client setup logic. - resolveSecrets() now uses context.client - Add schemata option for custom schema override - resolveSecretsRaw() still creates standalone client for direct usage - Update tests to verify header override behavior Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
- Replace require() with ESM import and MockedClass pattern - Convert jest.config.js to jest.config.cjs for CommonJS compat Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
| "author": "Constructive <developers@constructive.io>", | ||
| "license": "MIT", | ||
| "main": "dist/index.js", | ||
| "types": "dist/index.d.ts", |
There was a problem hiding this comment.
we don't use dist/ like this! see our pnpm constructive-skills
and fix ALL packages that do this please
|
|
||
| const RESOLVE_SECRETS_QUERY = ` | ||
| query ResolveSecrets( | ||
| $functionId: UUID! |
There was a problem hiding this comment.
where is this even a real GraphQL option in our code?
| /** @type {import('jest').Config} */ | ||
| module.exports = { | ||
| preset: 'ts-jest', | ||
| testEnvironment: 'node', |
There was a problem hiding this comment.
why is this .cjs? can it be like our other packages in other repos?
- Change package.json to use main/types pointing to dist root - Add publishConfig.directory: "dist" for npm publishing - Switch from tsc to makage build - Rename jest.config.cjs to jest.config.js Follows constructive-pnpm skill guidelines for TypeScript packages. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Thanks for the review! Fixed in bec6bf7: 1. package.json structure ✅
2. GraphQL queries ✅
3. jest.config.cjs → jest.config.js ✅
|
Summary
@constructive-io/fn-secretspackage for resolving encrypted secrets at runtime via GraphQLChanges
Commit 1: feat(fn-secrets): add package
resolveSecrets(context, functionName)— returnsSecretsMapfor easy useresolveSecretsRaw(options)— returns full secret details with sourceCommit 2: refactor(fn-secrets): reuse context.client
resolveSecrets()now usescontext.clientwith per-request header overrideschemataoption for custom schema access (default:infra_private,infra_public)resolveSecretsRaw()still creates standalone client for direct usageAPI
Test Plan
🤖 Generated with Claude Code