From 093062ccc267b8c64133c73f2cfe11ba6eec852c Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Sat, 14 Feb 2026 19:38:24 -0700 Subject: [PATCH] Add ambient type declarations for @encryptid/sdk subpath imports The SDK's dist/ directory may not include .d.ts files in all build environments (server builds without TypeScript). These ambient declarations prevent "Could not find a declaration file" errors. Co-Authored-By: Claude Opus 4.6 --- src/types/encryptid-sdk.d.ts | 50 ++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/types/encryptid-sdk.d.ts diff --git a/src/types/encryptid-sdk.d.ts b/src/types/encryptid-sdk.d.ts new file mode 100644 index 0000000..b6f8ff0 --- /dev/null +++ b/src/types/encryptid-sdk.d.ts @@ -0,0 +1,50 @@ +/** + * Ambient type declarations for @encryptid/sdk subpath imports. + * + * The SDK's dist/ directory may not include .d.ts files in all environments + * (e.g., when built without TypeScript on the server). These declarations + * prevent "Could not find a declaration file" errors during Docker builds. + */ + +declare module "@encryptid/sdk/server/nextjs" { + export function getEncryptIDSession( + request: Request, + options?: Record + ): Promise | null>; + + export function withEncryptID( + handler: ( + request: Request, + session: Record + ) => Promise, + options?: Record + ): (request: Request) => Promise; + + export function createEncryptIDMiddleware( + config?: Record + ): (request: Request) => Promise; + + export function checkSpaceAccess( + request: Request, + spaceSlug: string, + options: Record + ): Promise<{ + allowed: boolean; + readOnly?: boolean; + reason?: string; + claims?: Record | null; + }>; +} + +declare module "@encryptid/sdk/server" { + export function verifyEncryptIDToken( + token: string, + options?: Record + ): Promise<{ + sub: string; + username?: string; + did?: string; + exp?: number; + [key: string]: unknown; + }>; +}