run402-mcp
Version:
MCP server for Run402 — full-stack backend infrastructure for AI agents: Postgres, auth, storage, serverless functions and atomic deploys. Paid with x402/MPP. Includes $0.03 image generation.
33 lines • 2.11 kB
TypeScript
/**
* v1.50 client-side validators for asset metadata, EXIF policy, and the
* `Assets.list` (`assets.ls`) sort + filter surface. Every validator
* throws {@link LocalError} with the same `code` the gateway would return
* for the equivalent server-side rejection so consumers can branch on
* `e.code` regardless of whether validation happened locally or remotely.
*
* - `INVALID_ASSET_METADATA` — nested objects, non-allowed leaf types,
* undefined leaves, or serialized size > 4 KB.
* - `INVALID_EXIF_POLICY` — value other than `"keep"` | `"strip"`.
* - `INVALID_SORT` — sort value not in {@link ASSET_SORT_KEYS}.
* - `INVALID_FILTER_KEY` — unknown key on the filter bag.
*/
import { type AssetFilter, type AssetMetadata, type AssetSortKey, type ExifPolicy } from "./assets.types.js";
/** Maximum serialized size (bytes) for the caller-provided metadata bag. */
export declare const ASSET_METADATA_MAX_BYTES = 4096;
/** v1.50: validate caller-supplied metadata bag. Throws {@link LocalError}
* with `code === "INVALID_ASSET_METADATA"` for any structural violation. */
export declare function assertAssetMetadata(value: unknown, context: string): asserts value is AssetMetadata;
/** v1.50: validate the EXIF policy enum. */
export declare function assertExifPolicy(value: unknown, context: string): asserts value is ExifPolicy;
/** v1.50: validate the sort key enum. */
export declare function assertAssetSortKey(value: unknown, context: string): asserts value is AssetSortKey;
/** v1.50: reject unknown filter keys; type-check each known key. */
export declare function assertAssetFilter(value: unknown, context: string): asserts value is AssetFilter;
/**
* v1.50: serialize a validated filter bag as query parameters. The wire
* convention is `filter[<key>]=<value>` per design D-filter (see private
* gateway docs). Booleans render as `"true"` / `"false"`; numbers
* render verbatim; string arrays are not allowed on filter values.
*/
export declare function appendAssetFilterTo(qs: URLSearchParams, filter: AssetFilter): void;
//# sourceMappingURL=assets-validation.d.ts.map