import type { RestOperationShape } from "./rest-operations.js"; /** * APPSYNC_JS resolver codegen for `@restResolver` operations (issue #134). * Emits a monolithic request/response pair that proxies a GraphQL field to * an AppSync HTTP data source. Per-operation interpolation is limited to * `method`, the `resourcePath` template, and the presence of query params / * a JSON body — `BASE_HEADERS` and `mapResponse` are invariant shared code. */ export interface RestResolverOptions { /** * Header name → dotted path into the resolver `ctx`, expanded into * BASE_HEADERS. Absent config yields only `Content-Type`. */ injectHeaders?: Record; /** * HTTP status code → GraphQL error type name, merged over the default * (409 → ConflictError, 403 → ForbiddenError). Anything unmapped falls * through to `Http`. */ errorMap?: Record; /** * Literal path segment prepended to every generated `resourcePath`. * Must start with `/` and must not end with `/`. Issue #140. */ resourcePathPrefix?: string; } export interface EmittedRestResolverFile { typeName: string; fieldName: string; fileName: string; content: string; } export declare const DEFAULT_ERROR_MAP: Record; export declare function restResolverFileName(op: RestOperationShape): string; export declare function emitRestResolver(op: RestOperationShape, options?: RestResolverOptions): EmittedRestResolverFile; /** * Expands `rest.injectHeaders` (header → dotted ctx path) into the shared * BASE_HEADERS factory. Content-Type is always present; injected headers * follow in config order. Issue #134. */ declare function renderBaseHeaders(injectHeaders?: Record): string; declare function renderRequest(op: RestOperationShape, resourcePathPrefix?: string): string; /** * Route template → JS expression. Each `{param}` placeholder becomes * `${util.urlEncode(ctx.args.)}` inside a template literal; routes * without path params render as a plain string literal. An optional * `resourcePathPrefix` is prepended verbatim. Issue #140. */ declare function renderResourcePath(op: RestOperationShape, resourcePathPrefix?: string): string; /** * Builds the resourcePath query string for operations carrying an exploded * array parameter. Exploded arrays repeat the key, everything else contributes * a single pair; absent optional args drop out. APPSYNC_JS has no * `Array.isArray`, so the array/scalar split is decided here at emit time. */ declare function renderQueryString(op: RestOperationShape): string; /** * Shared response mapping: parsed body on 2xx, typed `util.error` otherwise. * `errorMap` entries merge over DEFAULT_ERROR_MAP (per-status override); * unmapped statuses fall through to `Http`. */ declare function renderMapResponse(errorMap?: Record): string; export declare const __test: { renderBaseHeaders: typeof renderBaseHeaders; renderRequest: typeof renderRequest; renderResourcePath: typeof renderResourcePath; renderQueryString: typeof renderQueryString; renderMapResponse: typeof renderMapResponse; }; export {}; //# sourceMappingURL=emit-rest-resolver.d.ts.map