This is an n8n community node package that integrates the Glean Client API into n8n workflows. It enables n8n users to query the Glean Work AI platform's search index directly within their automation workflows.
Type: n8n Community Node Package Language: TypeScript (strict mode) Package Manager: pnpm (not npm)
- Strict mode enforced: All files must pass TypeScript strict type checking
- No implicit any: Type all parameters, return values, and object shapes explicitly
- Use n8n interfaces: Implement
INodeType,ICredentialType, and related interfaces fromn8n-workflow - No type assertions: Avoid
ascasts; if types don't align, fix the source
- Use pnpm, not npm: This project uses pnpm exclusively
- Why pnpm: More efficient disk usage, faster installations, better monorepo support, strict dependency resolution
- Install:
pnpm install(notnpm install) - Add packages:
pnpm add(notnpm install) - Lock file:
pnpm-lock.yamlis authoritative; commit it
- Linter: ESLint with n8n-specific rules (
eslint-plugin-n8n-nodes-base) - Always run before commit:
pnpm run lint:fix - Prepublish validation: Stricter ESLint rules apply via
.eslintrc.prepublish.js - Formatter: Prettier for consistent style
- Format before committing:
pnpm run format
- Always build before testing:
pnpm run build - TypeScript output goes to
dist/: This is what gets published - Watch mode available:
pnpm run devfor development iteration - Verify clean builds: After code changes, ensure no build errors
This package follows a single-node, single-operation pattern for simplicity:
- One node class (
GleanClient) implementsINodeType - One credential type (
GleanClientApi) implementsICredentialType - Operations are defined as routing options within the node
When adding features: Follow this structure consistently. Don't split into multiple node files unless there's a compelling reason.
The credential type handles three responsibilities:
- Configuration fields: Where users input base URL and API key
- Authentication injection: Automatically adds Bearer token to all requests
- Credential validation: Tests credentials on save
This means new operations inherit authentication automatically without duplicating auth logic.
The node is marked as usableAsTool: true, enabling use by n8n's AI Agent features. This requires:
- Clear, well-named parameters (e.g.,
queryis descriptive) - Predictable, structured output from the API
- Documentation of what the node does (via
descriptionfield)
When extending with new operations, maintain this property and ensure new parameters are clear.
- Make code changes: Write TypeScript with strict typing
- Format & lint:
pnpm run format && pnpm run lint:fix - Build:
pnpm run build(verifies TypeScript compilation) - Test: Verify in n8n environment or with test harness
- Define a new routing option in the
propertiesarray ofGleanClient.node.ts - Specify the HTTP method, URL path, and request body shape
- Use
displayOptionsto conditionally show parameters - Run
pnpm run buildto verify TypeScript compilation - Test in n8n UI to ensure routing works end-to-end
- Update the
propertiesarray inGleanClientApi.credentials.tsfor UI fields - Update
IAuthenticateGenericif the auth method changes - Update
ICredentialTestRequestif the test endpoint changes - Verify types are explicit and correct
Only add packages that are necessary. Justify new dependencies as they increase bundle size.
- Peer dependencies:
n8n-workflow(required for n8n framework interfaces) - Dev dependencies: Only for build, lint, and type checking tools
- Avoid runtime dependencies: Keep the package lightweight for community distribution
- Automatic on publish:
prepublishOnlyruns automatically when you runpnpm publish - Manual validation (optional, recommended): Run
pnpm run prepublishOnlybeforehand to catch errors early- Full TypeScript build
- ESLint validation with stricter prepublish rules
- Verify
dist/folder contains compiled.jsand.d.tsfiles - Check that no linting errors appear
Only the dist/ folder is published (configured in files field of package.json). Manually update the version field in package.json before publishing (this project has no automated versioning).
credentials/: AllICredentialTypeimplementationsnodes/: AllINodeTypeimplementations (one folder per node)dist/: Generated output, not committed (except initial setup)n8nfield inpackage.json: Entry points for n8n to discover nodes and credentials
This structure follows n8n community node conventions for discoverability and compatibility.
- n8n reads the
n8nfield inpackage.jsonto discover this package's nodes and credentials - The compiled files in
dist/are loaded at runtime - Credentials are registered globally; nodes can reference them by name
- The routing definition in each node tells n8n how to construct HTTP requests
When adding features that leverage n8n's framework:
- Use n8n's expression language (
{{$parameter.fieldName}}) for dynamic values - Leverage n8n's request handling via routing definitions
- Keep operations simple; let n8n handle HTTP details
- Simple and focused: One node, clear purpose, easy to understand and maintain
- Type-safe: Strict TypeScript throughout; no implicit any
- Consistent tooling: pnpm, ESLint, Prettier—use them consistently
- n8n first: Follow n8n patterns and interfaces; don't reinvent
- Minimal dependencies: Keep the package lightweight for distribution
- Clear code: No overly specific comments (code should be self-documenting); explain why, not what