import { AgentsClient } from './resources/agents.js'; import { AuditClient } from './resources/audit.js'; import { GrantsClient } from './resources/grants.js'; import { TokensClient } from './resources/tokens.js'; import { WebhooksClient } from './resources/webhooks.js'; import { BillingClient } from './resources/billing.js'; import { PoliciesClient } from './resources/policies.js'; import { ComplianceClient } from './resources/compliance.js'; import { AnomaliesClient } from './resources/anomalies.js'; import { ScimClient } from './resources/scim.js'; import { SsoClient } from './resources/sso.js'; import { PrincipalSessionsClient } from './resources/principal-sessions.js'; import { VaultClient } from './resources/vault.js'; import { BudgetsClient } from './resources/budgets.js'; import { EventsClient } from './resources/events.js'; import { UsageClient } from './resources/usage.js'; import { DomainsClient } from './resources/domains.js'; import { WebAuthnClient } from './resources/webauthn.js'; import { CredentialsClient } from './resources/credentials.js'; import { PassportsClient } from './resources/passports.js'; import { DpdpClient } from './resources/dpdp.js'; import { CommerceClient } from './resources/commerce.js'; import { ToolManifest, type EnforceOptions, type EnforceResult, type WrapToolOptions, type EnforceMiddlewareOptions } from './manifest.js'; import { RevocationFeed, type RevocationFeedState } from './revocations/index.js'; import { DecisionsClient } from './resources/decisions.js'; import type { AuthorizationRequest, AuthorizeParams, GrantexClientOptions, RateLimit, RotateKeyResponse, SignupParams, SignupResponse, UpdateDeveloperSettingsParams, UpdateDeveloperSettingsResponse } from './types.js'; export declare class Grantex { #private; readonly agents: AgentsClient; readonly grants: GrantsClient; readonly tokens: TokensClient; readonly audit: AuditClient; readonly webhooks: WebhooksClient; readonly billing: BillingClient; readonly policies: PoliciesClient; readonly compliance: ComplianceClient; readonly anomalies: AnomaliesClient; readonly scim: ScimClient; readonly sso: SsoClient; readonly principalSessions: PrincipalSessionsClient; readonly vault: VaultClient; readonly budgets: BudgetsClient; readonly events: EventsClient; readonly usage: UsageClient; readonly domains: DomainsClient; readonly webauthn: WebAuthnClient; readonly credentials: CredentialsClient; readonly passports: PassportsClient; readonly dpdp: DpdpClient; readonly commerce: CommerceClient; readonly decisions: DecisionsClient; get lastRateLimit(): RateLimit | undefined; constructor(options?: GrantexClientOptions); /** * Create a new developer account without an API key. * Returns the developer ID and a one-time API key. */ static signup(params: SignupParams, options?: { baseUrl?: string; }): Promise; /** * Initiate the delegated authorization flow for a user. * `userId` is transparently mapped to `principalId` in the request body. */ authorize(params: AuthorizeParams): Promise; /** * Rotate the current API key. Returns a new key; the old key is invalidated. */ rotateKey(): Promise; /** * Update developer settings (e.g. FIDO/WebAuthn requirements). */ updateSettings(params: UpdateDeveloperSettingsParams): Promise; /** * Load a tool manifest for scope enforcement. * Manifests define what permission level each tool requires. */ loadManifest(manifest: ToolManifest): void; /** * Load multiple tool manifests at once. */ loadManifests(manifests: ToolManifest[]): void; /** * Load all JSON manifest files from a directory. * Each `.json` file is parsed as a ToolManifest and loaded. */ loadManifestsFromDir(dirPath: string): Promise; /** * Enforce scope for a tool call. * * 1. Verifies the grant token JWT locally using the issuer's JWKS * 2. Looks up the tool's required permission from loaded manifests * 3. Checks if the granted scope level covers the required permission * * Fails closed: unknown connectors/tools are denied by default. * * @example * ```ts * const result = await grantex.enforce({ * grantToken: token, * connector: 'salesforce', * tool: 'delete_contact', * }); * if (!result.allowed) throw new Error(result.reason); * ``` */ /** * The revocation feed this client uses for `revocationCheck: 'feed'`, * started on first use. Call `stopRevocationFeed()` to close it. */ revocationFeed(): RevocationFeed; /** What the revocation feed knows, and whether it is fresh enough to be trusted. */ revocationFeedState(): RevocationFeedState | undefined; /** Stop following the revocation feed and release its connection. */ stopRevocationFeed(): Promise; enforce(options: EnforceOptions): Promise; /** * Wrap a LangChain StructuredTool with automatic Grantex scope enforcement. * Before each tool invocation, the grant token is verified and scopes are checked. * * @param tool - The LangChain StructuredTool to wrap * @param options - Connector name, tool name, and grant token (string or getter function) * @returns A new StructuredTool that enforces scopes before calling the original * * @example * ```ts * const protectedTool = grantex.wrapTool(myTool, { * connector: 'salesforce', * tool: 'create_lead', * grantToken: () => currentState.grant_token, * }); * ``` */ wrapTool Promise; }>(tool: T, options: WrapToolOptions): T; /** * Create Express/Fastify middleware that enforces Grantex scopes on every request. * * @example * ```ts * app.use('/api/tools/*', grantex.enforceMiddleware({ * extractToken: (req) => req.headers.authorization?.replace('Bearer ', ''), * extractConnector: (req) => req.params.connector, * extractTool: (req) => req.params.tool, * })); * ``` */ enforceMiddleware(options: EnforceMiddlewareOptions): (req: unknown, res: unknown, next: unknown) => void; } //# sourceMappingURL=client.d.ts.map