ts-ag 1.1.20 → 1.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js.map +1 -1
- package/dist/index.d.mts +114 -166
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +681 -144
- package/dist/index.mjs.map +1 -1
- package/dist/scripts/ts-alias.mjs.map +1 -1
- package/dist/scripts/ts-build-config.mjs.map +1 -1
- package/package.json +13 -11
package/dist/browser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.js","names":[],"sources":["../src/lambda/client-types.ts","../src/lambda/client.ts","../src/lambda/handlerUtils.ts","../src/rehype/flat-toc.ts","../src/utils/valibot.ts","../src/utils/object.ts"],"sourcesContent":["import type { ErrorBody, SuccessCode, ErrorCode } from './handlerUtils.js';\n\n// ----------------- Helpers ----------------------\n// Used to easily extract types from ApiEndpoints types\n\n/**\n * Extracts the requestInput type from an API endpoint definition\n * @template E - Union type of all API endpoints\n * @template P - Path string literal type (e.g. 'payments/account')\n * @template M - HTTP method string literal type (e.g. 'GET', 'POST')\n */\nexport type ApiInput<E extends ApiEndpoints, P extends E['path'], M extends E['method']> = Extract<\n E,\n { path: P; method: M }\n>['requestInput'];\n\n/**\n * Extracts the requestOutput type from an API endpoint definition\n * @template E - Union type of all API endpoints\n * @template P - Path string literal type (e.g. 'payments/account')\n * @template M - HTTP method string literal type (e.g. 'GET', 'POST')\n */\nexport type ApiOutput<E extends ApiEndpoints, P extends E['path'], M extends E['method']> = Extract<\n E,\n { path: P; method: M }\n>['requestOutput'];\n\n/**\n * Extracts the response type from an API endpoint definition\n * @template E - Union type of all API endpoints\n * @template P - Path string literal type (e.g. 'payments/account')\n * @template M - HTTP method string literal type (e.g. 'GET', 'POST')\n */\nexport type ApiResponse<E extends ApiEndpoints, P extends E['path'], M extends E['method']> = Extract<\n E,\n { path: P; method: M }\n>['response'];\n\n/**\n * Extracts the sucessful body type from an API endpoint definition\n * @template E - Union type of all API endpoints\n * @template P - Path string literal type (e.g. 'payments/account')\n * @template M - HTTP method string literal type (e.g. 'GET', 'POST')\n */\nexport type ApiSuccessBody<E extends ApiEndpoints, P extends E['path'], M extends E['method']> = Extract<\n Extract<E, { path: P; method: M }>['response'],\n { status: SuccessCode }\n>['json'] extends () => Promise<infer R>\n ? R\n : unknown;\n\n/**\n * Extracts the sucessful body type from an API endpoint definition\n * @template E - Union type of all API endpoints\n * @template P - Path string literal type (e.g. 'payments/account')\n * @template M - HTTP method string literal type (e.g. 'GET', 'POST')\n */\nexport type ApiErrorBody<E extends ApiEndpoints, P extends E['path'], M extends E['method']> = Extract<\n Extract<E, { path: P; method: M }>['response'],\n { status: ErrorCode }\n>['json'] extends () => Promise<infer R>\n ? R\n : unknown;\n\n/**\n * Converts a RawApiGatewayHandler response type to a fetch like response type.\n */\ntype ConvertToFetch<T> = T extends { statusCode: number; body: object; headers: object }\n ? { ok: T['statusCode'] extends SuccessCode ? true : false; json: () => Promise<T['body']>; status: T['statusCode'] }\n : T;\n\nexport type CleanResponse = Omit<Response, 'status' | 'ok' | 'json'>;\nexport type FetchResponse<T extends (...args: any) => any> = ConvertToFetch<Awaited<ReturnType<T>>> & CleanResponse;\n\n// ------------------------ Proper types ------------------\n// This is used by createApiRequest and createFormFunction\n\nexport const HTTPMethods = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS', 'HEAD'] as const;\nexport type HTTPMethod = (typeof HTTPMethods)[number];\n\nexport type ApiEndpoints = {\n path: string;\n method: HTTPMethod;\n requestInput: Record<string, any> | null;\n requestOutput: object | null;\n response: FetchResponse<\n // This means we get better types\n () => Promise<\n | { headers: object; statusCode: SuccessCode; body: any }\n | { headers: object; statusCode: ErrorCode; body: ErrorBody }\n >\n >;\n};\n","// import { deserialize } from './deserializer.js';\nimport { parse } from 'devalue';\nimport * as v from 'valibot';\n\nimport type { ApiEndpoints, ApiInput, ApiResponse } from './client-types.js';\n\nconst bodyMethods = ['POST', 'PUT', 'PATCH'] as const;\nconst queryMethods = ['GET', 'DELETE'] as const;\n\nasync function _apiRequest<T = Response>(\n path: string,\n method: 'GET' | 'POST' | 'DELETE',\n input: object | null,\n schema: ApiSchema,\n // This was here because of the deserializer being different in prod\n environment: string | 'production',\n apiUrl: string,\n headers?: HeadersInit\n): Promise<T> {\n if (schema) {\n if (schema.async === true) await v.parseAsync(schema, input);\n else v.parse(schema, input);\n }\n\n let url = `${apiUrl}${apiUrl.endsWith('/') ? '' : '/'}${path}`;\n\n if (queryMethods.includes(method as any)) {\n const params = new URLSearchParams();\n\n for (const [key, value] of Object.entries(input ?? {})) {\n if (Array.isArray(value)) {\n value.forEach((item) => params.append(key, String(item)));\n } else {\n params.append(key, String(value));\n }\n }\n\n const queryString = params.toString();\n if (queryString) url += `?${queryString}`;\n }\n\n headers = { 'Content-Type': 'application/json', ...headers };\n const response = await fetch(url, {\n method,\n headers,\n // oxlint-disable-next-line\n body: bodyMethods.includes(method as any) ? JSON.stringify(input) : undefined,\n credentials: 'include'\n });\n const contentType = response.headers.get('content-type') ?? '';\n\n let retrieved: Promise<string> | false = false;\n response.json = async () => {\n if (retrieved === false) {\n retrieved = response.text();\n }\n\n if (contentType === 'application/devalue') {\n return await parse(await retrieved);\n } else {\n return JSON.parse(await retrieved);\n }\n };\n return response as unknown as T;\n}\n\nconst HTTPMethods = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS', 'HEAD'] as const;\ntype HTTPMethod = (typeof HTTPMethods)[number];\n\nexport type ApiRequestFunction<API extends ApiEndpoints> = <\n Path extends API['path'],\n Method extends Extract<API, { path: Path }>['method']\n>(\n path: Path,\n method: Method,\n input: ApiInput<API, Path, Method>,\n headers?: HeadersInit\n) => Promise<ApiResponse<API, Path, Method>>;\n\nexport type ApiSchema = v.GenericSchema | v.GenericSchemaAsync;\n\n/**\n * @returns A function that can be used to make API requests with type safety\n * @example const clientApiRequest = createApiRequest<ApiEndpoints>();\n */\nexport function createApiRequest<API extends ApiEndpoints>(\n schemas: Partial<Record<API['path'], Partial<Record<HTTPMethod, ApiSchema>>>>,\n apiUrl: string,\n env: string\n): ApiRequestFunction<API> {\n return async function apiRequest(path, method, input, headers) {\n const schema = schemas[path]?.[method];\n if (schema === undefined) throw new Error('Schema is undefined in api request');\n\n // if (typeof schema === 'function') {\n // schema = schema();\n // }\n\n return _apiRequest<ApiResponse<API, typeof path, typeof method>>(\n path as string,\n method as 'GET' | 'POST',\n input,\n schema,\n env,\n apiUrl,\n headers\n );\n };\n}\n","import type { APIGatewayProxyResultV2, Context, APIGatewayProxyEventV2WithLambdaAuthorizer } from 'aws-lambda';\nimport { stringify } from 'devalue';\n\nexport type SuccessCode = 200 | 201 | 204;\nexport type ErrorCode = 400 | 401 | 403 | 404 | 409 | 500;\n\nexport type ErrorBody = { message: string; field?: { name: string; value: string } };\n\n/**\n * The error response for the lambda functions to return\n */\nexport type ErrorRawProxyResultV2 = {\n statusCode: ErrorCode;\n headers?: { [header: string]: string } | undefined;\n body?: ErrorBody;\n isBase64Encoded?: boolean | undefined;\n cookies?: string[] | undefined;\n};\n\nexport type OkRawProxyResultV2 = {\n statusCode: SuccessCode;\n headers?: { [header: string]: string } | undefined;\n body?: object | undefined;\n isBase64Encoded?: boolean | undefined;\n cookies?: string[] | undefined;\n};\n/**\n * A type for the raw proxy result - just using an object not a stirng for the body\n */\nexport type RawProxyResultV2 = ErrorRawProxyResultV2 | OkRawProxyResultV2;\n\n// The type of the handler returned from wrapHandler\nexport type APIGatewayHandler<E> = (event: E, context: Context) => Promise<APIGatewayProxyResultV2>;\n\n// The type of the handler passed into wrapHandler\nexport type RawApiGatewayHandler<E extends APIGatewayProxyEventV2WithLambdaAuthorizer<any>> = (\n event: E,\n context: Context\n) => Promise<RawProxyResultV2>;\n\n/**\n * Wraps a handler that returns the body as an object rather than a string.\n *\n * This means you can achieve proper type inference on your handler and have standardised serialisation\n *\n * @example\n```ts\nexport type AuthorizerContext = {\n details: JWTPayload;\n} | null;\n\nexport const wrapHandler = baseWrapHandler<APIGatewayProxyEventV2WithLambdaAuthorizer<AuthorizerContext>>\n\n*/\nexport function wrapHandler<E extends APIGatewayProxyEventV2WithLambdaAuthorizer<any>>(\n handler: RawApiGatewayHandler<E>\n): APIGatewayHandler<E> {\n return async (event: E, context: Context): Promise<APIGatewayProxyResultV2> => {\n const result = await handler(event, context);\n\n if (result.body) {\n const headers = new Headers(result.headers);\n headers.set('Content-Type', 'application/devalue');\n\n return { ...result, headers: Object.fromEntries(headers), body: stringify(result.body) };\n } else {\n return { ...result, body: undefined };\n }\n };\n}\n","import type { Root, RootContent, Element } from 'hast';\nimport rehypeParse from 'rehype-parse';\nimport type { Plugin } from 'unified';\nimport { unified } from 'unified';\nimport type { VFile } from 'vfile';\n\n/**\n * This rehype plugin extracts the headings from the markdown elements but also the raw elements.\n * So we get html headings in the TOC as well\n *\n * It sets the file.data.fm.toc to a flat map of the toc\n */\nexport const extractToc: Plugin<[], Root> = () => {\n return (tree: Root, file: VFile) => {\n const details = tree.children.flatMap(extractDetails);\n if (file.data.fm === undefined) file.data.fm = {};\n // @ts-expect-error its untyped but for svmdex it is there\n file.data.fm.toc = details;\n };\n};\nexport type Toc = TocEntry[];\nexport type TocEntry = { level: number; id: string; value: string };\n\nfunction extractDetails(content: RootContent | { type: 'raw'; value: string }): TocEntry[] {\n if (content.type === 'element' && content.tagName.startsWith('h') && 'id' in content.properties) {\n const value =\n content.children.length === 1 && content.children[0].type === 'text'\n ? content.children[0].value\n : (content.properties.id as string);\n\n return [{ level: parseInt(content.tagName.slice(1)), id: content.properties.id as string, value }];\n } else if (content.type === 'raw') {\n const parsed = parseRaw(content.value);\n return parsed.flatMap(extractDetails);\n }\n return [];\n}\n\n/**\n * Parses raw HTML and returns a flat array of all heading (h1-h6) elements as HAST nodes.\n */\nexport function parseRaw(raw: string): Element[] {\n // Parse the HTML string into a HAST Root node\n const tree = unified()\n .use(rehypeParse, { fragment: true }) // allow parsing HTML fragments\n .parse(raw) as Root;\n\n // Helper function to recursively find heading elements\n function collectHeadings(node: RootContent): Element[] {\n if (node.type === 'element' && /^h[1-6]$/.test(node.tagName)) {\n return [node];\n }\n // Check children recursively\n if ('children' in node && Array.isArray(node.children)) {\n return node.children.flatMap(collectHeadings);\n }\n return [];\n }\n\n // Flatten all headings found in the tree\n return tree.children.flatMap(collectHeadings);\n}\n","import type { GenericSchema, GenericSchemaAsync } from 'valibot';\n\nexport function isSchema(x: unknown): x is GenericSchema {\n return !!x && typeof x === 'object' && 'kind' in x && x['kind'] === 'schema';\n}\n\nexport function unwrap(schema: GenericSchema): GenericSchema {\n // Unwrap common wrappers that simply contain another schema under `wrapped`\n // optional | exactOptional | undefinedable | nullable | nullish | nonNullable | nonNullish | readonly | brand | description | metadata | title | flavor\n // Most of these share `{ type: string; wrapped: GenericSchema }`\n // Guarded unwrap to avoid infinite loops.\n let curr: any = schema as any;\n const seen = new Set<any>();\n while (curr && typeof curr === 'object' && !seen.has(curr) && 'wrapped' in curr && isSchema((curr as any).wrapped)) {\n seen.add(curr);\n curr = (curr as any).wrapped;\n }\n return curr as GenericSchema;\n}\n\nfunction isIntegerKey(s: string): boolean {\n // allow \"0\", \"01\" etc. to index tuples/arrays consistently\n return /^-?\\d+$/.test(s);\n}\n\nexport type GetSchemaByPathOptions = {\n /**\n * When a union/variant cannot be narrowed by the path segment,\n * choose index `preferOption` (default 0). Set to -1 to return undefined instead.\n */\n preferOption?: number;\n};\n\nexport function getSchemaByPath(\n root: GenericSchema | GenericSchemaAsync,\n path: string,\n opts: GetSchemaByPathOptions = {}\n): GenericSchema | undefined {\n if (!isSchema(root)) return undefined;\n if (!path) return root;\n\n const keys = path.split('.');\n let curr: GenericSchema | undefined = root;\n\n for (let i = 0; i < keys.length; i++) {\n if (!curr) return undefined;\n curr = unwrap(curr);\n const seg = keys[i];\n\n // Narrow by schema \"type\"\n const type = (curr as any).type as string | undefined;\n\n switch (type) {\n case 'object': {\n // ObjectSchema has `.entries`\n const entries = (curr as any).entries as Record<string, GenericSchema> | undefined;\n if (!entries) return undefined;\n curr = entries[seg];\n break;\n }\n\n case 'record': {\n // RecordSchema has `.value` for any key\n const value = (curr as any).value as GenericSchema | undefined;\n curr = value;\n break;\n }\n\n case 'array': {\n // ArraySchema has `.item`\n if (!isIntegerKey(seg)) return undefined;\n const item = (curr as any).item as GenericSchema | undefined;\n curr = item;\n break;\n }\n\n case 'tuple': {\n // TupleSchema has `.items` and possibly `.rest`\n if (!isIntegerKey(seg)) return undefined;\n const idx = Number(seg);\n const items = (curr as any).items as GenericSchema[] | undefined;\n const rest = (curr as any).rest as GenericSchema | undefined;\n if (!items) return undefined;\n curr = idx < items.length ? items[idx] : rest;\n break;\n }\n\n case 'union': {\n // UnionSchema has `.options` (array of schemas)\n const options = (curr as any).options as GenericSchema[] | undefined;\n if (!options?.length) return undefined;\n\n // Try to narrow by segment:\n // - if numeric seg: prefer array/tuple options\n // - if string seg: prefer object/record options that contain seg\n const numeric = isIntegerKey(seg);\n\n let next: GenericSchema | undefined;\n\n if (numeric) {\n next =\n options.find((o) => {\n const u = unwrap(o) as any;\n return u?.type === 'array' || u?.type === 'tuple';\n }) ?? options[opts.preferOption ?? 0];\n } else {\n // Prefer object/record with matching key\n next =\n options.find((o) => {\n const u = unwrap(o) as any;\n if (u?.type === 'object') {\n const ent = u.entries as Record<string, GenericSchema> | undefined;\n return !!ent && seg in ent;\n }\n return u?.type === 'record';\n }) ?? options[opts.preferOption ?? 0];\n }\n\n curr = next;\n // Loop continues to use seg against selected option\n i--; // reprocess this segment against the chosen branch\n break;\n }\n\n case 'variant': {\n // Variant (discriminated union) has `.options` too\n const options = (curr as any).options as GenericSchema[] | undefined;\n if (!options?.length) return undefined;\n // Same narrowing as union\n const numeric = isIntegerKey(seg);\n let next: GenericSchema | undefined;\n if (numeric) {\n next =\n options.find((o) => {\n const u = unwrap(o) as any;\n return u?.type === 'array' || u?.type === 'tuple';\n }) ?? options[opts.preferOption ?? 0];\n } else {\n next =\n options.find((o) => {\n const u = unwrap(o) as any;\n if (u?.type === 'object') {\n const ent = u.entries as Record<string, GenericSchema> | undefined;\n return !!ent && seg in ent;\n }\n return u?.type === 'record';\n }) ?? options[opts.preferOption ?? 0];\n }\n curr = next;\n i--;\n break;\n }\n\n default: {\n // If it’s a pipeline schema (`pipe`) or similar wrapper, many expose `.wrapped` and are handled by unwrap.\n // If we end up at a primitive or unknown structure while keys remain, fail.\n return undefined;\n }\n }\n }\n\n return curr ? unwrap(curr) : undefined;\n}\n","import { isEqual, isObject } from 'radash';\n\nimport type { DeepPartial } from '../types/deep.js';\n\n/**\n * Sets the value for an object by its dot path\n * @param obj - any object\n * @param path - the dot path eg. key1.0.1.key2\n * @param value - any value\n * @returns - the modified object\n */\nexport function setByPath<T extends object>(obj: T, path: string, value: any): T {\n const keys = path.split('.');\n let curr: any = obj;\n\n for (let i = 0; i < keys.length - 1; i++) {\n const k = keys[i];\n const next = keys[i + 1];\n // handle array indices like '0'\n if (Number.isInteger(Number(next))) {\n curr[k] ??= [];\n } else {\n curr[k] ??= {};\n }\n curr = curr[k];\n }\n\n curr[keys[keys.length - 1]] = value;\n return obj;\n}\n\n/**\n * Gets the value from an object by its dot path\n * @param obj - any object\n * @param path - the dot path eg. key1.0.1.key2\n * @returns - the value at the given path or undefined\n */\nexport function getByPath<T extends object>(obj: T, path: string): any {\n if (!obj || typeof obj !== 'object') return undefined;\n const keys = path.split('.');\n let curr: any = obj;\n\n for (const k of keys) {\n if (curr == null) return undefined;\n curr = curr[k];\n }\n\n return curr;\n}\n\nconst isPlainRecord = (v: unknown): v is Record<string, unknown> => isObject(v) && !Array.isArray(v);\n\n/**\n * Returns a deep \"patch\" object containing only the fields from `b`\n * that are different from `a`.\n *\n * Behavior:\n * - Only keys from `b` can appear in the result.\n * - New keys in `b` are included.\n * - Changed primitive/array values are included as the value from `b`.\n * - For nested plain objects, it recurses and returns only the differing nested fields.\n * - Arrays are treated as atomic (if different, the whole array from `b` is returned).\n *\n * Typing:\n * - Output is `DeepPartial<B>` because only a subset of `b`'s shape is returned.\n *\n * @template A\n * @template B\n * @param {A} a - Base/original object (can be a different shape than `b`).\n * @param {B} b - Updated object; output keys come from this object.\n * @returns {DeepPartial<B>} Deep partial of `b` containing only differences vs `a`.\n */\nexport const deepDiff = <A extends object, B extends object>(a: A, b: B): DeepPartial<B> => {\n const out: Record<string, unknown> = {};\n\n for (const key of Object.keys(b) as Array<keyof B>) {\n const aVal = (a as any)?.[key];\n const bVal = (b as any)[key];\n\n if (!((key as any) in (a as any))) {\n out[key as any] = bVal;\n continue;\n }\n\n if (isPlainRecord(aVal) && isPlainRecord(bVal)) {\n const nested = deepDiff(aVal, bVal);\n if (Object.keys(nested as any).length) out[key as any] = nested;\n continue;\n }\n\n if (!isEqual(aVal, bVal)) out[key as any] = bVal;\n }\n\n return out as DeepPartial<B>;\n};\n\n/**\n * Deeply prunes `source` to match the *shape* of `shape`.\n *\n * Rules:\n * - Only keys that exist on `shape` are kept.\n * - Pruning is deep for nested plain objects.\n * - Arrays are supported by using the first element of `shape` as the element-shape.\n * - If `shape` is `[]`, returns `[]` (drops all elements).\n * - Primitive values are kept as-is (no type coercion) if the key exists in `shape`.\n * - If `shape` expects an object/array but `source` is not compatible, returns an empty object/array of that shape.\n *\n * @typeParam S - Source object type.\n * @typeParam Sh - Shape object type.\n * @param source - The object to prune.\n * @param shape - The object whose keys/structure are the allowlist.\n * @returns A new value derived from `source`, containing only fields present in `shape`, pruned deeply.\n *\n * @example\n * const source = { a: 1, b: { c: 2, d: 3 }, e: [ { x: 1, y: 2 }, { x: 3, y: 4 } ], z: 9 };\n * const shape = { a: 0, b: { c: 0 }, e: [ { x: 0 } ] };\n * // => { a: 1, b: { c: 2 }, e: [ { x: 1 }, { x: 3 } ] }\n * const out = pruneToShape(source, shape);\n */\nexport function pruneToShape<S, Sh>(source: S, shape: Sh): Sh {\n return pruneAny(source as unknown, shape as unknown) as Sh;\n\n function pruneAny(src: unknown, sh: unknown): unknown {\n // Arrays: use first element as the \"element shape\"\n if (Array.isArray(sh)) {\n if (!Array.isArray(src)) return [];\n if (sh.length === 0) return [];\n const elemShape = sh[0];\n return src.map((v) => pruneAny(v, elemShape));\n }\n\n // Plain objects: keep only keys present on shape, recursively.\n if (isPlainObject(sh)) {\n const out: Record<string, unknown> = {};\n const srcObj = isPlainObject(src) ? (src as Record<string, unknown>) : undefined;\n\n for (const key of Object.keys(sh as Record<string, unknown>)) {\n const shVal = (sh as Record<string, unknown>)[key];\n const srcVal = srcObj ? srcObj[key] : undefined;\n\n if (Array.isArray(shVal) || isPlainObject(shVal)) {\n out[key] = pruneAny(srcVal, shVal);\n } else {\n // Primitive (or function/date/etc in shape): key exists => keep source value as-is\n out[key] = srcVal;\n }\n }\n return out;\n }\n\n // Non-object shape => allowed leaf; just return source leaf as-is.\n return src;\n }\n\n function isPlainObject(v: unknown): v is Record<string, unknown> {\n if (v === null || typeof v !== 'object') return false;\n const proto = Object.getPrototypeOf(v);\n return proto === Object.prototype || proto === null;\n }\n}\n"],"mappings":";;;;;;AA6EA,MAAa,cAAc;CAAC;CAAO;CAAQ;CAAO;CAAU;CAAS;CAAW;CAAO;;;ACvEvF,MAAM,cAAc;CAAC;CAAQ;CAAO;CAAQ;AAC5C,MAAM,eAAe,CAAC,OAAO,SAAS;AAEtC,eAAe,YACb,MACA,QACA,OACA,QAEA,aACA,QACA,SACY;AACZ,KAAI,OACF,KAAI,OAAO,UAAU,KAAM,OAAM,EAAE,WAAW,QAAQ,MAAM;KACvD,GAAE,MAAM,QAAQ,MAAM;CAG7B,IAAI,MAAM,GAAG,SAAS,OAAO,SAAS,IAAI,GAAG,KAAK,MAAM;AAExD,KAAI,aAAa,SAAS,OAAc,EAAE;EACxC,MAAM,SAAS,IAAI,iBAAiB;AAEpC,OAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,SAAS,EAAE,CAAC,CACpD,KAAI,MAAM,QAAQ,MAAM,CACtB,OAAM,SAAS,SAA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AK,GAA8B,EAAE;IAC5D,MAAM,QAAS,GAA+B;IAC9C,MAAM,SAAS,SAAS,OAAO,OAAO,KAAA;AAEtC,QAAI,MAAM,QAAQ,MAAM,IAAI,cAAc,MAAM,CAC9C,KAAI,OAAO,SAAS,QAAQ,MAAM;QAGlC,KAAI,OAAO;;AAGf,UAAO;;AAIT,SAAO;;CAGT,SAAS,cAAc,GAA0C;AAC/D,MAAI,MAAM,QAAQ,OAAO,MAAM,SAAU,QAAO;EAChD,MAAM,QAAQ,OAAO,eAAe,EAAE;AACtC,SAAO,UAAU,OAAO,aAAa,UAAU"}
|
|
1
|
+
{"version":3,"file":"browser.js","names":[],"sources":["../src/lambda/client-types.ts","../src/lambda/client.ts","../src/lambda/handlerUtils.ts","../src/rehype/flat-toc.ts","../src/utils/valibot.ts","../src/utils/object.ts"],"sourcesContent":["import type { ErrorBody, SuccessCode, ErrorCode } from './handlerUtils.js';\n\n// ----------------- Helpers ----------------------\n// Used to easily extract types from ApiEndpoints types\n\n/**\n * Extracts the requestInput type from an API endpoint definition\n * @template E - Union type of all API endpoints\n * @template P - Path string literal type (e.g. 'payments/account')\n * @template M - HTTP method string literal type (e.g. 'GET', 'POST')\n */\nexport type ApiInput<E extends ApiEndpoints, P extends E['path'], M extends E['method']> = Extract<\n E,\n { path: P; method: M }\n>['requestInput'];\n\n/**\n * Extracts the requestOutput type from an API endpoint definition\n * @template E - Union type of all API endpoints\n * @template P - Path string literal type (e.g. 'payments/account')\n * @template M - HTTP method string literal type (e.g. 'GET', 'POST')\n */\nexport type ApiOutput<E extends ApiEndpoints, P extends E['path'], M extends E['method']> = Extract<\n E,\n { path: P; method: M }\n>['requestOutput'];\n\n/**\n * Extracts the response type from an API endpoint definition\n * @template E - Union type of all API endpoints\n * @template P - Path string literal type (e.g. 'payments/account')\n * @template M - HTTP method string literal type (e.g. 'GET', 'POST')\n */\nexport type ApiResponse<E extends ApiEndpoints, P extends E['path'], M extends E['method']> = Extract<\n E,\n { path: P; method: M }\n>['response'];\n\n/**\n * Extracts the sucessful body type from an API endpoint definition\n * @template E - Union type of all API endpoints\n * @template P - Path string literal type (e.g. 'payments/account')\n * @template M - HTTP method string literal type (e.g. 'GET', 'POST')\n */\nexport type ApiSuccessBody<E extends ApiEndpoints, P extends E['path'], M extends E['method']> = Extract<\n Extract<E, { path: P; method: M }>['response'],\n { status: SuccessCode }\n>['json'] extends () => Promise<infer R>\n ? R\n : unknown;\n\n/**\n * Extracts the sucessful body type from an API endpoint definition\n * @template E - Union type of all API endpoints\n * @template P - Path string literal type (e.g. 'payments/account')\n * @template M - HTTP method string literal type (e.g. 'GET', 'POST')\n */\nexport type ApiErrorBody<E extends ApiEndpoints, P extends E['path'], M extends E['method']> = Extract<\n Extract<E, { path: P; method: M }>['response'],\n { status: ErrorCode }\n>['json'] extends () => Promise<infer R>\n ? R\n : unknown;\n\n/**\n * Converts a RawApiGatewayHandler response type to a fetch like response type.\n */\ntype ConvertToFetch<T> = T extends { statusCode: number; body: object; headers: object }\n ? { ok: T['statusCode'] extends SuccessCode ? true : false; json: () => Promise<T['body']>; status: T['statusCode'] }\n : T;\n\nexport type CleanResponse = Omit<Response, 'status' | 'ok' | 'json'>;\nexport type FetchResponse<T extends (...args: any) => any> = ConvertToFetch<Awaited<ReturnType<T>>> & CleanResponse;\n\n// ------------------------ Proper types ------------------\n// This is used by createApiRequest and createFormFunction\n\nexport const HTTPMethods = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS', 'HEAD'] as const;\nexport type HTTPMethod = (typeof HTTPMethods)[number];\n\nexport type ApiEndpoints = {\n path: string;\n method: HTTPMethod;\n requestInput: Record<string, any> | null;\n requestOutput: object | null;\n response: FetchResponse<\n // This means we get better types\n () => Promise<\n | { headers: object; statusCode: SuccessCode; body: any }\n | { headers: object; statusCode: ErrorCode; body: ErrorBody }\n >\n >;\n};\n","// import { deserialize } from './deserializer.js';\nimport { parse } from 'devalue';\nimport * as v from 'valibot';\n\nimport type { ApiEndpoints, ApiInput, ApiResponse } from './client-types.js';\n\nconst bodyMethods = ['POST', 'PUT', 'PATCH'] as const;\nconst queryMethods = ['GET', 'DELETE'] as const;\n\nasync function _apiRequest<T = Response>(\n path: string,\n method: 'GET' | 'POST' | 'DELETE',\n input: object | null,\n schema: ApiSchema,\n // This was here because of the deserializer being different in prod\n environment: string | 'production',\n apiUrl: string,\n headers?: HeadersInit\n): Promise<T> {\n if (schema) {\n if (schema.async === true) await v.parseAsync(schema, input);\n else v.parse(schema, input);\n }\n\n let url = `${apiUrl}${apiUrl.endsWith('/') ? '' : '/'}${path}`;\n\n if (queryMethods.includes(method as any)) {\n const params = new URLSearchParams();\n\n for (const [key, value] of Object.entries(input ?? {})) {\n if (Array.isArray(value)) {\n value.forEach((item) => params.append(key, String(item)));\n } else {\n params.append(key, String(value));\n }\n }\n\n const queryString = params.toString();\n if (queryString) url += `?${queryString}`;\n }\n\n headers = { 'Content-Type': 'application/json', ...headers };\n const response = await fetch(url, {\n method,\n headers,\n // oxlint-disable-next-line\n body: bodyMethods.includes(method as any) ? JSON.stringify(input) : undefined,\n credentials: 'include'\n });\n const contentType = response.headers.get('content-type') ?? '';\n\n let retrieved: Promise<string> | false = false;\n response.json = async () => {\n if (retrieved === false) {\n retrieved = response.text();\n }\n\n if (contentType === 'application/devalue') {\n return await parse(await retrieved);\n } else {\n return JSON.parse(await retrieved);\n }\n };\n return response as unknown as T;\n}\n\nconst HTTPMethods = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS', 'HEAD'] as const;\ntype HTTPMethod = (typeof HTTPMethods)[number];\n\nexport type ApiRequestFunction<API extends ApiEndpoints> = <\n Path extends API['path'],\n Method extends Extract<API, { path: Path }>['method']\n>(\n path: Path,\n method: Method,\n input: ApiInput<API, Path, Method>,\n headers?: HeadersInit\n) => Promise<ApiResponse<API, Path, Method>>;\n\nexport type ApiSchema = v.GenericSchema | v.GenericSchemaAsync;\n\n/**\n * @returns A function that can be used to make API requests with type safety\n * @example const clientApiRequest = createApiRequest<ApiEndpoints>();\n */\nexport function createApiRequest<API extends ApiEndpoints>(\n schemas: Partial<Record<API['path'], Partial<Record<HTTPMethod, ApiSchema>>>>,\n apiUrl: string,\n env: string\n): ApiRequestFunction<API> {\n return async function apiRequest(path, method, input, headers) {\n const schema = schemas[path]?.[method];\n if (schema === undefined) throw new Error('Schema is undefined in api request');\n\n // if (typeof schema === 'function') {\n // schema = schema();\n // }\n\n return _apiRequest<ApiResponse<API, typeof path, typeof method>>(\n path as string,\n method as 'GET' | 'POST',\n input,\n schema,\n env,\n apiUrl,\n headers\n );\n };\n}\n","import type { APIGatewayProxyResultV2, Context, APIGatewayProxyEventV2WithLambdaAuthorizer } from 'aws-lambda';\nimport { stringify } from 'devalue';\n\nexport type SuccessCode = 200 | 201 | 204;\nexport type ErrorCode = 400 | 401 | 403 | 404 | 409 | 500;\n\nexport type ErrorBody = { message: string; field?: { name: string; value: string } };\n\n/**\n * The error response for the lambda functions to return\n */\nexport type ErrorRawProxyResultV2 = {\n statusCode: ErrorCode;\n headers?: { [header: string]: string } | undefined;\n body?: ErrorBody;\n isBase64Encoded?: boolean | undefined;\n cookies?: string[] | undefined;\n};\n\nexport type OkRawProxyResultV2 = {\n statusCode: SuccessCode;\n headers?: { [header: string]: string } | undefined;\n body?: object | undefined;\n isBase64Encoded?: boolean | undefined;\n cookies?: string[] | undefined;\n};\n/**\n * A type for the raw proxy result - just using an object not a stirng for the body\n */\nexport type RawProxyResultV2 = ErrorRawProxyResultV2 | OkRawProxyResultV2;\n\n// The type of the handler returned from wrapHandler\nexport type APIGatewayHandler<E> = (event: E, context: Context) => Promise<APIGatewayProxyResultV2>;\n\n// The type of the handler passed into wrapHandler\nexport type RawApiGatewayHandler<E extends APIGatewayProxyEventV2WithLambdaAuthorizer<any>> = (\n event: E,\n context: Context\n) => Promise<RawProxyResultV2>;\n\n/**\n * Wraps a handler that returns the body as an object rather than a string.\n *\n * This means you can achieve proper type inference on your handler and have standardised serialisation\n *\n * @example\n```ts\nexport type AuthorizerContext = {\n details: JWTPayload;\n} | null;\n\nexport const wrapHandler = baseWrapHandler<APIGatewayProxyEventV2WithLambdaAuthorizer<AuthorizerContext>>\n\n*/\nexport function wrapHandler<E extends APIGatewayProxyEventV2WithLambdaAuthorizer<any>>(\n handler: RawApiGatewayHandler<E>\n): APIGatewayHandler<E> {\n return async (event: E, context: Context): Promise<APIGatewayProxyResultV2> => {\n const result = await handler(event, context);\n\n if (result.body) {\n const headers = new Headers(result.headers);\n headers.set('Content-Type', 'application/devalue');\n\n return { ...result, headers: Object.fromEntries(headers), body: stringify(result.body) };\n } else {\n return { ...result, body: undefined };\n }\n };\n}\n","import type { Root, RootContent, Element } from 'hast';\nimport rehypeParse from 'rehype-parse';\nimport type { Plugin } from 'unified';\nimport { unified } from 'unified';\nimport type { VFile } from 'vfile';\n\n/**\n * This rehype plugin extracts the headings from the markdown elements but also the raw elements.\n * So we get html headings in the TOC as well\n *\n * It sets the file.data.fm.toc to a flat map of the toc\n */\nexport const extractToc: Plugin<[], Root> = () => {\n return (tree: Root, file: VFile) => {\n const details = tree.children.flatMap(extractDetails);\n if (file.data.fm === undefined) file.data.fm = {};\n // @ts-expect-error its untyped but for svmdex it is there\n file.data.fm.toc = details;\n };\n};\nexport type Toc = TocEntry[];\nexport type TocEntry = { level: number; id: string; value: string };\n\nfunction extractDetails(content: RootContent | { type: 'raw'; value: string }): TocEntry[] {\n if (content.type === 'element' && content.tagName.startsWith('h') && 'id' in content.properties) {\n const value =\n content.children.length === 1 && content.children[0].type === 'text'\n ? content.children[0].value\n : (content.properties.id as string);\n\n return [{ level: parseInt(content.tagName.slice(1)), id: content.properties.id as string, value }];\n } else if (content.type === 'raw') {\n const parsed = parseRaw(content.value);\n return parsed.flatMap(extractDetails);\n }\n return [];\n}\n\n/**\n * Parses raw HTML and returns a flat array of all heading (h1-h6) elements as HAST nodes.\n */\nexport function parseRaw(raw: string): Element[] {\n // Parse the HTML string into a HAST Root node\n const tree = unified()\n .use(rehypeParse, { fragment: true }) // allow parsing HTML fragments\n .parse(raw) as Root;\n\n // Helper function to recursively find heading elements\n function collectHeadings(node: RootContent): Element[] {\n if (node.type === 'element' && /^h[1-6]$/.test(node.tagName)) {\n return [node];\n }\n // Check children recursively\n if ('children' in node && Array.isArray(node.children)) {\n return node.children.flatMap(collectHeadings);\n }\n return [];\n }\n\n // Flatten all headings found in the tree\n return tree.children.flatMap(collectHeadings);\n}\n","import type { GenericSchema, GenericSchemaAsync } from 'valibot';\n\nexport function isSchema(x: unknown): x is GenericSchema {\n return !!x && typeof x === 'object' && 'kind' in x && x['kind'] === 'schema';\n}\n\nexport function unwrap(schema: GenericSchema): GenericSchema {\n // Unwrap common wrappers that simply contain another schema under `wrapped`\n // optional | exactOptional | undefinedable | nullable | nullish | nonNullable | nonNullish | readonly | brand | description | metadata | title | flavor\n // Most of these share `{ type: string; wrapped: GenericSchema }`\n // Guarded unwrap to avoid infinite loops.\n let curr: any = schema as any;\n const seen = new Set<any>();\n while (curr && typeof curr === 'object' && !seen.has(curr) && 'wrapped' in curr && isSchema((curr as any).wrapped)) {\n seen.add(curr);\n curr = (curr as any).wrapped;\n }\n return curr as GenericSchema;\n}\n\nfunction isIntegerKey(s: string): boolean {\n // allow \"0\", \"01\" etc. to index tuples/arrays consistently\n return /^-?\\d+$/.test(s);\n}\n\nexport type GetSchemaByPathOptions = {\n /**\n * When a union/variant cannot be narrowed by the path segment,\n * choose index `preferOption` (default 0). Set to -1 to return undefined instead.\n */\n preferOption?: number;\n};\n\nexport function getSchemaByPath(\n root: GenericSchema | GenericSchemaAsync,\n path: string,\n opts: GetSchemaByPathOptions = {}\n): GenericSchema | undefined {\n if (!isSchema(root)) return undefined;\n if (!path) return root;\n\n const keys = path.split('.');\n let curr: GenericSchema | undefined = root;\n\n for (let i = 0; i < keys.length; i++) {\n if (!curr) return undefined;\n curr = unwrap(curr);\n const seg = keys[i];\n\n // Narrow by schema \"type\"\n const type = (curr as any).type as string | undefined;\n\n switch (type) {\n case 'object': {\n // ObjectSchema has `.entries`\n const entries = (curr as any).entries as Record<string, GenericSchema> | undefined;\n if (!entries) return undefined;\n curr = entries[seg];\n break;\n }\n\n case 'record': {\n // RecordSchema has `.value` for any key\n const value = (curr as any).value as GenericSchema | undefined;\n curr = value;\n break;\n }\n\n case 'array': {\n // ArraySchema has `.item`\n if (!isIntegerKey(seg)) return undefined;\n const item = (curr as any).item as GenericSchema | undefined;\n curr = item;\n break;\n }\n\n case 'tuple': {\n // TupleSchema has `.items` and possibly `.rest`\n if (!isIntegerKey(seg)) return undefined;\n const idx = Number(seg);\n const items = (curr as any).items as GenericSchema[] | undefined;\n const rest = (curr as any).rest as GenericSchema | undefined;\n if (!items) return undefined;\n curr = idx < items.length ? items[idx] : rest;\n break;\n }\n\n case 'union': {\n // UnionSchema has `.options` (array of schemas)\n const options = (curr as any).options as GenericSchema[] | undefined;\n if (!options?.length) return undefined;\n\n // Try to narrow by segment:\n // - if numeric seg: prefer array/tuple options\n // - if string seg: prefer object/record options that contain seg\n const numeric = isIntegerKey(seg);\n\n let next: GenericSchema | undefined;\n\n if (numeric) {\n next =\n options.find((o) => {\n const u = unwrap(o) as any;\n return u?.type === 'array' || u?.type === 'tuple';\n }) ?? options[opts.preferOption ?? 0];\n } else {\n // Prefer object/record with matching key\n next =\n options.find((o) => {\n const u = unwrap(o) as any;\n if (u?.type === 'object') {\n const ent = u.entries as Record<string, GenericSchema> | undefined;\n return !!ent && seg in ent;\n }\n return u?.type === 'record';\n }) ?? options[opts.preferOption ?? 0];\n }\n\n curr = next;\n // Loop continues to use seg against selected option\n i--; // reprocess this segment against the chosen branch\n break;\n }\n\n case 'variant': {\n // Variant (discriminated union) has `.options` too\n const options = (curr as any).options as GenericSchema[] | undefined;\n if (!options?.length) return undefined;\n // Same narrowing as union\n const numeric = isIntegerKey(seg);\n let next: GenericSchema | undefined;\n if (numeric) {\n next =\n options.find((o) => {\n const u = unwrap(o) as any;\n return u?.type === 'array' || u?.type === 'tuple';\n }) ?? options[opts.preferOption ?? 0];\n } else {\n next =\n options.find((o) => {\n const u = unwrap(o) as any;\n if (u?.type === 'object') {\n const ent = u.entries as Record<string, GenericSchema> | undefined;\n return !!ent && seg in ent;\n }\n return u?.type === 'record';\n }) ?? options[opts.preferOption ?? 0];\n }\n curr = next;\n i--;\n break;\n }\n\n default: {\n // If it’s a pipeline schema (`pipe`) or similar wrapper, many expose `.wrapped` and are handled by unwrap.\n // If we end up at a primitive or unknown structure while keys remain, fail.\n return undefined;\n }\n }\n }\n\n return curr ? unwrap(curr) : undefined;\n}\n","import { isEqual, isObject } from 'radash';\n\nimport type { DeepPartial } from '../types/deep.js';\n\n/**\n * Sets the value for an object by its dot path\n * @param obj - any object\n * @param path - the dot path eg. key1.0.1.key2\n * @param value - any value\n * @returns - the modified object\n */\nexport function setByPath<T extends object>(obj: T, path: string, value: any): T {\n const keys = path.split('.');\n let curr: any = obj;\n\n for (let i = 0; i < keys.length - 1; i++) {\n const k = keys[i];\n const next = keys[i + 1];\n // handle array indices like '0'\n if (Number.isInteger(Number(next))) {\n curr[k] ??= [];\n } else {\n curr[k] ??= {};\n }\n curr = curr[k];\n }\n\n curr[keys[keys.length - 1]] = value;\n return obj;\n}\n\n/**\n * Gets the value from an object by its dot path\n * @param obj - any object\n * @param path - the dot path eg. key1.0.1.key2\n * @returns - the value at the given path or undefined\n */\nexport function getByPath<T extends object>(obj: T, path: string): any {\n if (!obj || typeof obj !== 'object') return undefined;\n const keys = path.split('.');\n let curr: any = obj;\n\n for (const k of keys) {\n if (curr == null) return undefined;\n curr = curr[k];\n }\n\n return curr;\n}\n\nconst isPlainRecord = (v: unknown): v is Record<string, unknown> => isObject(v) && !Array.isArray(v);\n\n/**\n * Returns a deep \"patch\" object containing only the fields from `b`\n * that are different from `a`.\n *\n * Behavior:\n * - Only keys from `b` can appear in the result.\n * - New keys in `b` are included.\n * - Changed primitive/array values are included as the value from `b`.\n * - For nested plain objects, it recurses and returns only the differing nested fields.\n * - Arrays are treated as atomic (if different, the whole array from `b` is returned).\n *\n * Typing:\n * - Output is `DeepPartial<B>` because only a subset of `b`'s shape is returned.\n *\n * @template A\n * @template B\n * @param {A} a - Base/original object (can be a different shape than `b`).\n * @param {B} b - Updated object; output keys come from this object.\n * @returns {DeepPartial<B>} Deep partial of `b` containing only differences vs `a`.\n */\nexport const deepDiff = <A extends object, B extends object>(a: A, b: B): DeepPartial<B> => {\n const out: Record<string, unknown> = {};\n\n for (const key of Object.keys(b) as Array<keyof B>) {\n const aVal = (a as any)?.[key];\n const bVal = (b as any)[key];\n\n if (!((key as any) in (a as any))) {\n out[key as any] = bVal;\n continue;\n }\n\n if (isPlainRecord(aVal) && isPlainRecord(bVal)) {\n const nested = deepDiff(aVal, bVal);\n if (Object.keys(nested as any).length) out[key as any] = nested;\n continue;\n }\n\n if (!isEqual(aVal, bVal)) out[key as any] = bVal;\n }\n\n return out as DeepPartial<B>;\n};\n\n/**\n * Deeply prunes `source` to match the *shape* of `shape`.\n *\n * Rules:\n * - Only keys that exist on `shape` are kept.\n * - Pruning is deep for nested plain objects.\n * - Arrays are supported by using the first element of `shape` as the element-shape.\n * - If `shape` is `[]`, returns `[]` (drops all elements).\n * - Primitive values are kept as-is (no type coercion) if the key exists in `shape`.\n * - If `shape` expects an object/array but `source` is not compatible, returns an empty object/array of that shape.\n *\n * @typeParam S - Source object type.\n * @typeParam Sh - Shape object type.\n * @param source - The object to prune.\n * @param shape - The object whose keys/structure are the allowlist.\n * @returns A new value derived from `source`, containing only fields present in `shape`, pruned deeply.\n *\n * @example\n * const source = { a: 1, b: { c: 2, d: 3 }, e: [ { x: 1, y: 2 }, { x: 3, y: 4 } ], z: 9 };\n * const shape = { a: 0, b: { c: 0 }, e: [ { x: 0 } ] };\n * // => { a: 1, b: { c: 2 }, e: [ { x: 1 }, { x: 3 } ] }\n * const out = pruneToShape(source, shape);\n */\nexport function pruneToShape<S, Sh>(source: S, shape: Sh): Sh {\n return pruneAny(source as unknown, shape as unknown) as Sh;\n\n function pruneAny(src: unknown, sh: unknown): unknown {\n // Arrays: use first element as the \"element shape\"\n if (Array.isArray(sh)) {\n if (!Array.isArray(src)) return [];\n if (sh.length === 0) return [];\n const elemShape = sh[0];\n return src.map((v) => pruneAny(v, elemShape));\n }\n\n // Plain objects: keep only keys present on shape, recursively.\n if (isPlainObject(sh)) {\n const out: Record<string, unknown> = {};\n const srcObj = isPlainObject(src) ? (src as Record<string, unknown>) : undefined;\n\n for (const key of Object.keys(sh as Record<string, unknown>)) {\n const shVal = (sh as Record<string, unknown>)[key];\n const srcVal = srcObj ? srcObj[key] : undefined;\n\n if (Array.isArray(shVal) || isPlainObject(shVal)) {\n out[key] = pruneAny(srcVal, shVal);\n } else {\n // Primitive (or function/date/etc in shape): key exists => keep source value as-is\n out[key] = srcVal;\n }\n }\n return out;\n }\n\n // Non-object shape => allowed leaf; just return source leaf as-is.\n return src;\n }\n\n function isPlainObject(v: unknown): v is Record<string, unknown> {\n if (v === null || typeof v !== 'object') return false;\n const proto = Object.getPrototypeOf(v);\n return proto === Object.prototype || proto === null;\n }\n}\n"],"mappings":";;;;;;AA6EA,MAAa,cAAc;CAAC;CAAO;CAAQ;CAAO;CAAU;CAAS;CAAW;CAAO;;;ACvEvF,MAAM,cAAc;CAAC;CAAQ;CAAO;CAAQ;AAC5C,MAAM,eAAe,CAAC,OAAO,SAAS;AAEtC,eAAe,YACb,MACA,QACA,OACA,QAEA,aACA,QACA,SACY;AACZ,KAAI,OACF,KAAI,OAAO,UAAU,KAAM,OAAM,EAAE,WAAW,QAAQ,MAAM;KACvD,GAAE,MAAM,QAAQ,MAAM;CAG7B,IAAI,MAAM,GAAG,SAAS,OAAO,SAAS,IAAI,GAAG,KAAK,MAAM;AAExD,KAAI,aAAa,SAAS,OAAc,EAAE;EACxC,MAAM,SAAS,IAAI,iBAAiB;AAEpC,OAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,SAAS,EAAE,CAAC,CACpD,KAAI,MAAM,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;AAEvE,QAAK,MAAM,OAAO,OAAO,KAAK,GAA8B,EAAE;IAC5D,MAAM,QAAS,GAA+B;IAC9C,MAAM,SAAS,SAAS,OAAO,OAAO,KAAA;AAEtC,QAAI,MAAM,QAAQ,MAAM,IAAI,cAAc,MAAM,CAC9C,KAAI,OAAO,SAAS,QAAQ,MAAM;QAGlC,KAAI,OAAO;;AAGf,UAAO;;AAIT,SAAO;;CAGT,SAAS,cAAc,GAA0C;AAC/D,MAAI,MAAM,QAAQ,OAAO,MAAM,SAAU,QAAO;EAChD,MAAM,QAAQ,OAAO,eAAe,EAAE;AACtC,SAAO,UAAU,OAAO,aAAa,UAAU"}
|
package/dist/index.d.mts
CHANGED
|
@@ -5,6 +5,7 @@ import { Result, ResultAsync } from "neverthrow";
|
|
|
5
5
|
import * as _$_aws_sdk_client_cognito_identity_provider0 from "@aws-sdk/client-cognito-identity-provider";
|
|
6
6
|
import { AdminGetUserCommandOutput, AttributeType, CognitoIdentityProviderClient } from "@aws-sdk/client-cognito-identity-provider";
|
|
7
7
|
import { S3Client } from "@aws-sdk/client-s3";
|
|
8
|
+
import { DynamoDBToolboxError } from "dynamodb-toolbox";
|
|
8
9
|
import { Plugin } from "unified";
|
|
9
10
|
import { styleText } from "util";
|
|
10
11
|
import { APIGatewayProxyEventV2WithLambdaAuthorizer, APIGatewayProxyResultV2, APIGatewayRequestAuthorizerEventV2, Context } from "aws-lambda";
|
|
@@ -173,42 +174,42 @@ declare function createApiRequest<API extends ApiEndpoints>(schemas: Partial<Rec
|
|
|
173
174
|
* The separation means that they can be returned from functions that are certainly run inside a lambda fucntion but theyre not the actual return of the lambda.
|
|
174
175
|
* Im not sure it this is optimal behaviour and if not we will migrate to only using the errorResponse function
|
|
175
176
|
*/
|
|
176
|
-
declare const error_lambda_badRequest: (message: string, fieldName?: string, fieldValue?: string) =>
|
|
177
|
-
|
|
177
|
+
declare const error_lambda_badRequest: (message: string, fieldName?: string, fieldValue?: string) => type_error_lambda_badRequest;
|
|
178
|
+
declare const error_lambda_unauthorized: (message: string) => type_error_lambda_unauthorized;
|
|
179
|
+
declare const error_lambda_forbidden: (message: string) => type_error_lambda_forbidden;
|
|
180
|
+
declare const error_lambda_notFound: (message: string, fieldName?: string, fieldValue?: string) => type_error_lambda_notFound;
|
|
181
|
+
declare const error_lambda_conflict: (message: string, fieldName?: string, fieldValue?: string) => type_error_lambda_conflict;
|
|
182
|
+
declare const error_lambda_internal: (message: string) => type_error_lambda_internal;
|
|
183
|
+
type type_error_lambda_badRequest = {
|
|
184
|
+
type: 'badRequest';
|
|
178
185
|
message: string;
|
|
179
|
-
fieldName
|
|
180
|
-
fieldValue
|
|
186
|
+
fieldName?: string;
|
|
187
|
+
fieldValue?: string;
|
|
181
188
|
};
|
|
182
|
-
|
|
183
|
-
type: '
|
|
189
|
+
type type_error_lambda_unauthorized = {
|
|
190
|
+
type: 'unauthorized';
|
|
184
191
|
message: string;
|
|
185
192
|
};
|
|
186
|
-
|
|
187
|
-
type: '
|
|
193
|
+
type type_error_lambda_forbidden = {
|
|
194
|
+
type: 'forbidden';
|
|
188
195
|
message: string;
|
|
189
196
|
};
|
|
190
|
-
|
|
191
|
-
type: '
|
|
197
|
+
type type_error_lambda_notFound = {
|
|
198
|
+
type: 'notFound';
|
|
192
199
|
message: string;
|
|
193
|
-
fieldName
|
|
194
|
-
fieldValue
|
|
200
|
+
fieldName?: string;
|
|
201
|
+
fieldValue?: string;
|
|
195
202
|
};
|
|
196
|
-
|
|
197
|
-
type: '
|
|
203
|
+
type type_error_lambda_conflict = {
|
|
204
|
+
type: 'conflict';
|
|
198
205
|
message: string;
|
|
199
|
-
fieldName
|
|
200
|
-
fieldValue
|
|
206
|
+
fieldName?: string;
|
|
207
|
+
fieldValue?: string;
|
|
201
208
|
};
|
|
202
|
-
|
|
203
|
-
type: '
|
|
209
|
+
type type_error_lambda_internal = {
|
|
210
|
+
type: 'internal';
|
|
204
211
|
message: string;
|
|
205
212
|
};
|
|
206
|
-
type type_error_lambda_badRequest = ReturnType<typeof error_lambda_badRequest>;
|
|
207
|
-
type type_error_lambda_unauthorized = ReturnType<typeof error_lambda_unauthorized>;
|
|
208
|
-
type type_error_lambda_forbidden = ReturnType<typeof error_lambda_forbidden>;
|
|
209
|
-
type type_error_lambda_notFound = ReturnType<typeof error_lambda_notFound>;
|
|
210
|
-
type type_error_lambda_conflict = ReturnType<typeof error_lambda_conflict>;
|
|
211
|
-
type type_error_lambda_internal = ReturnType<typeof error_lambda_internal>;
|
|
212
213
|
type type_error_lambda = type_error_lambda_badRequest | type_error_lambda_unauthorized | type_error_lambda_forbidden | type_error_lambda_notFound | type_error_lambda_conflict | type_error_lambda_internal;
|
|
213
214
|
//#endregion
|
|
214
215
|
//#region src/lambda/response.d.ts
|
|
@@ -270,6 +271,14 @@ type LambdaErrorResponse<Type extends string = '', Extras extends object = {}> =
|
|
|
270
271
|
type: Type;
|
|
271
272
|
} & Extras;
|
|
272
273
|
};
|
|
274
|
+
/**
|
|
275
|
+
* Maps lambda errors to responses suitable to return from lambda functions
|
|
276
|
+
* @param e
|
|
277
|
+
* @param headers
|
|
278
|
+
* @param type
|
|
279
|
+
* @param extras
|
|
280
|
+
* @returns
|
|
281
|
+
*/
|
|
273
282
|
declare function response_error<Type extends string = '', Extras extends object = {}>(e: type_error_lambda, headers: Record<string, string>, type?: Type, extras?: Extras): LambdaErrorResponse<Type, Extras>;
|
|
274
283
|
/**
|
|
275
284
|
* Helper function to get a reasonable default error response from a valibot parse result
|
|
@@ -292,10 +301,7 @@ declare function response_ok<Body extends {
|
|
|
292
301
|
/**
|
|
293
302
|
* Wraps cookies parse along with the api gateway event with neverthrow
|
|
294
303
|
*/
|
|
295
|
-
declare const getCookies: (event: APIGatewayProxyEventV2WithLambdaAuthorizer<any> | APIGatewayRequestAuthorizerEventV2) => Result<_$cookie.Cookies,
|
|
296
|
-
type: 'lambda_unauthorized';
|
|
297
|
-
message: string;
|
|
298
|
-
}>;
|
|
304
|
+
declare const getCookies: (event: APIGatewayProxyEventV2WithLambdaAuthorizer<any> | APIGatewayRequestAuthorizerEventV2) => Result<_$cookie.Cookies, type_error_lambda_unauthorized>;
|
|
299
305
|
//#endregion
|
|
300
306
|
//#region src/cognito/client.d.ts
|
|
301
307
|
/**
|
|
@@ -304,115 +310,23 @@ declare const getCookies: (event: APIGatewayProxyEventV2WithLambdaAuthorizer<any
|
|
|
304
310
|
declare function getCognitoClient(): CognitoIdentityProviderClient;
|
|
305
311
|
//#endregion
|
|
306
312
|
//#region src/cognito/errors.d.ts
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
type: '
|
|
310
|
-
|
|
311
|
-
declare const error_cognito_internal: {
|
|
312
|
-
group: 'cognito';
|
|
313
|
-
type: 'cognito_internal';
|
|
314
|
-
};
|
|
315
|
-
declare const error_cognito_role: {
|
|
316
|
-
group: 'cognito';
|
|
317
|
-
type: 'cognito_role';
|
|
318
|
-
};
|
|
319
|
-
declare const error_cognito_input: {
|
|
320
|
-
group: 'cognito';
|
|
321
|
-
type: 'cognito_input';
|
|
322
|
-
};
|
|
323
|
-
declare const error_cognito_auth: {
|
|
324
|
-
group: 'cognito';
|
|
325
|
-
type: 'cognito_auth';
|
|
326
|
-
};
|
|
327
|
-
declare const error_cognito_notFound: {
|
|
328
|
-
group: 'cognito';
|
|
329
|
-
type: 'cognito_notFound';
|
|
330
|
-
};
|
|
331
|
-
declare const error_cognito_userNotFound: {
|
|
332
|
-
group: 'cognito';
|
|
333
|
-
type: 'cognito_userNotFound';
|
|
334
|
-
};
|
|
335
|
-
declare const error_cognito_tooManyRequests: {
|
|
336
|
-
group: 'cognito';
|
|
337
|
-
type: 'cognito_tooManyRequests';
|
|
338
|
-
};
|
|
339
|
-
declare const error_cognito_passwordPolicy: {
|
|
340
|
-
group: 'cognito';
|
|
341
|
-
type: 'cognito_passwordPolicy';
|
|
342
|
-
};
|
|
343
|
-
declare const error_cognito_passwordHistory: {
|
|
344
|
-
group: 'cognito';
|
|
345
|
-
type: 'cognito_passwordHistory';
|
|
346
|
-
};
|
|
347
|
-
declare const error_cognito_passwordResetRequired: {
|
|
348
|
-
group: 'cognito';
|
|
349
|
-
type: 'cognito_passwordResetRequired';
|
|
350
|
-
};
|
|
351
|
-
declare const error_cognito_codeExpired: {
|
|
352
|
-
group: 'cognito';
|
|
353
|
-
type: 'cognito_codeExpired';
|
|
354
|
-
};
|
|
355
|
-
declare const error_cognito_codeMismatch: {
|
|
356
|
-
group: 'cognito';
|
|
357
|
-
type: 'cognito_codeMismatch';
|
|
358
|
-
};
|
|
359
|
-
declare const error_cognito_delivery: {
|
|
360
|
-
group: 'cognito';
|
|
361
|
-
type: 'cognito_delivery';
|
|
362
|
-
};
|
|
363
|
-
declare const error_cognito_userExists: {
|
|
364
|
-
group: 'cognito';
|
|
365
|
-
type: 'cognito_userExists';
|
|
366
|
-
};
|
|
367
|
-
type type_error_cognito_forbidden = typeof error_cognito_forbidden;
|
|
368
|
-
type type_error_cognito_internal = typeof error_cognito_internal;
|
|
369
|
-
type type_error_cognito_role = typeof error_cognito_role;
|
|
370
|
-
type type_error_cognito_input = typeof error_cognito_input;
|
|
371
|
-
type type_error_cognito_auth = typeof error_cognito_auth;
|
|
372
|
-
type type_error_cognito_notFound = typeof error_cognito_notFound;
|
|
373
|
-
type type_error_cognito_userNotFound = typeof error_cognito_userNotFound;
|
|
374
|
-
type type_error_cognito_tooManyRequests = typeof error_cognito_tooManyRequests;
|
|
375
|
-
type type_error_cognito_passwordPolicy = typeof error_cognito_passwordPolicy;
|
|
376
|
-
type type_error_cognito_passwordHistory = typeof error_cognito_passwordHistory;
|
|
377
|
-
type type_error_cognito_passwordResetRequired = typeof error_cognito_passwordResetRequired;
|
|
378
|
-
type type_error_cognito_codeExpired = typeof error_cognito_codeExpired;
|
|
379
|
-
type type_error_cognito_codeMismatch = typeof error_cognito_codeMismatch;
|
|
380
|
-
type type_error_cognito_delivery = typeof error_cognito_delivery;
|
|
381
|
-
type type_error_cognito_userExists = typeof error_cognito_userExists;
|
|
382
|
-
type type_error_cognito = type_error_cognito_forbidden | type_error_cognito_internal | type_error_cognito_role | type_error_cognito_input | type_error_cognito_auth | type_error_cognito_notFound | type_error_cognito_userNotFound | type_error_cognito_tooManyRequests | type_error_cognito_passwordPolicy | type_error_cognito_passwordHistory | type_error_cognito_passwordResetRequired | type_error_cognito_codeExpired | type_error_cognito_codeMismatch | type_error_cognito_delivery | type_error_cognito_userExists;
|
|
383
|
-
/**
|
|
384
|
-
* Gets a generic error from the name of the aws error
|
|
385
|
-
*/
|
|
386
|
-
declare function error_cognito(error: Error): type_error_cognito;
|
|
387
|
-
/**
|
|
388
|
-
* Converts a cognito error to a lambda error.
|
|
389
|
-
* Basically just for narrowing it down a bit
|
|
390
|
-
*/
|
|
391
|
-
declare function error_lambda_fromCognito(e: type_error_cognito): {
|
|
392
|
-
type: 'lambda_badRequest';
|
|
393
|
-
message: string;
|
|
394
|
-
fieldName: string | undefined;
|
|
395
|
-
fieldValue: string | undefined;
|
|
396
|
-
} | {
|
|
397
|
-
type: 'lambda_unauthorized';
|
|
398
|
-
message: string;
|
|
399
|
-
} | {
|
|
400
|
-
type: 'lambda_forbidden';
|
|
401
|
-
message: string;
|
|
402
|
-
} | {
|
|
403
|
-
type: 'lambda_notFound';
|
|
404
|
-
message: string;
|
|
405
|
-
fieldName: string | undefined;
|
|
406
|
-
fieldValue: string | undefined;
|
|
407
|
-
} | {
|
|
408
|
-
type: 'lambda_conflict';
|
|
409
|
-
message: string;
|
|
410
|
-
fieldName: string | undefined;
|
|
411
|
-
fieldValue: string | undefined;
|
|
412
|
-
} | {
|
|
413
|
-
type: 'lambda_internal';
|
|
414
|
-
message: string;
|
|
313
|
+
/** Error wrapper for failures that happen while doing Cognito SDK work. */
|
|
314
|
+
type type_error_cognito = {
|
|
315
|
+
type: 'cognito';
|
|
316
|
+
error: unknown;
|
|
415
317
|
};
|
|
318
|
+
/** Internal reason used before converting Cognito errors into public lambda errors. */
|
|
319
|
+
type type_error_lambda_fromCognito_reason = 'auth' | 'forbidden' | 'invalidInput' | 'userNotFound' | 'resourceNotFound' | 'tooManyRequests' | 'passwordPolicy' | 'passwordHistory' | 'passwordResetRequired' | 'codeExpired' | 'codeMismatch' | 'delivery' | 'userExists' | 'conflict' | 'internal';
|
|
320
|
+
/** Per-reason public response override for endpoint-specific privacy and status choices. */
|
|
321
|
+
type type_error_lambda_fromCognito_override = {
|
|
322
|
+
message?: string;
|
|
323
|
+
} | Partial<type_error_lambda>;
|
|
324
|
+
/** Options for converting Cognito errors to lambda errors. */
|
|
325
|
+
type type_error_lambda_fromCognito_options = Partial<Record<type_error_lambda_fromCognito_reason, type_error_lambda_fromCognito_override>>;
|
|
326
|
+
/** Wrap an unknown caught value as a Cognito-domain error for neverthrow flows. */
|
|
327
|
+
declare function error_cognito(error: unknown): type_error_cognito;
|
|
328
|
+
/** Convert AWS SDK Cognito errors into a safe lambda error for API responses. */
|
|
329
|
+
declare function error_lambda_fromCognito(e: type_error_cognito, options?: type_error_lambda_fromCognito_options): type_error_lambda;
|
|
416
330
|
//#endregion
|
|
417
331
|
//#region src/cognito/user.d.ts
|
|
418
332
|
type type_userResponse = Omit<AdminGetUserCommandOutput, 'UserAttributes'> & {
|
|
@@ -588,10 +502,7 @@ declare const verifyOAuthToken: (a: {
|
|
|
588
502
|
refresh_token: string;
|
|
589
503
|
token_type: string;
|
|
590
504
|
expires_in: number;
|
|
591
|
-
},
|
|
592
|
-
group: 'cognito';
|
|
593
|
-
type: 'cognito_auth';
|
|
594
|
-
}>;
|
|
505
|
+
}, type_error_cognito>;
|
|
595
506
|
/**
|
|
596
507
|
* Exchanges an OAuth2 refresh token for Cognito tokens using the oauth token endpoint.
|
|
597
508
|
* See https://docs.aws.amazon.com/cognito/latest/developerguide/token-endpoint.html for request/response fields and grant details.
|
|
@@ -613,10 +524,7 @@ declare const refreshOAuthToken: (a: {
|
|
|
613
524
|
refresh_token: string | undefined;
|
|
614
525
|
token_type: string;
|
|
615
526
|
expires_in: number;
|
|
616
|
-
},
|
|
617
|
-
group: 'cognito';
|
|
618
|
-
type: 'cognito_auth';
|
|
619
|
-
}>;
|
|
527
|
+
}, type_error_cognito>;
|
|
620
528
|
//#endregion
|
|
621
529
|
//#region src/s3/client.d.ts
|
|
622
530
|
/**
|
|
@@ -625,17 +533,28 @@ declare const refreshOAuthToken: (a: {
|
|
|
625
533
|
declare function getS3(): S3Client;
|
|
626
534
|
//#endregion
|
|
627
535
|
//#region src/s3/errors.d.ts
|
|
628
|
-
|
|
629
|
-
|
|
536
|
+
/** Error wrapper for failures that happen while doing S3 SDK work. */
|
|
537
|
+
type type_error_s3 = {
|
|
538
|
+
type: 's3';
|
|
539
|
+
error: unknown;
|
|
630
540
|
};
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
type
|
|
635
|
-
|
|
541
|
+
/** Internal reason used before converting S3 errors into public lambda errors. */
|
|
542
|
+
type type_error_lambda_fromS3_reason = 'invalidInput' | 'objectNotFound' | 'bucketNotFound' | 'conflict' | 'throttled' | 'accessDenied' | 'internal';
|
|
543
|
+
/** Per-reason public response override for endpoint-specific privacy and status choices. */
|
|
544
|
+
type type_error_lambda_fromS3_override = {
|
|
545
|
+
message?: string;
|
|
546
|
+
} | Partial<type_error_lambda>;
|
|
547
|
+
/** Options for converting S3 errors to lambda errors. */
|
|
548
|
+
type type_error_lambda_fromS3_options = Partial<Record<type_error_lambda_fromS3_reason, type_error_lambda_fromS3_override>>;
|
|
549
|
+
/** Wrap an unknown caught value as an S3-domain error for neverthrow flows. */
|
|
550
|
+
declare function error_s3(error: unknown): type_error_s3;
|
|
551
|
+
/** Convert AWS SDK S3 errors into a safe lambda error for API responses. */
|
|
552
|
+
declare function error_lambda_fromS3(e: type_error_s3, options?: type_error_lambda_fromS3_options): type_error_lambda;
|
|
553
|
+
/** Returns true for normal S3 object-missing responses. */
|
|
554
|
+
declare function is_s3_notFound(error: unknown): boolean;
|
|
636
555
|
//#endregion
|
|
637
556
|
//#region src/s3/signedUrl.d.ts
|
|
638
|
-
declare const getSignedUrl: <InputTypesUnion extends object, InputType extends InputTypesUnion, OutputType extends _$_smithy_types0.MetadataBearer = _$_smithy_types0.MetadataBearer>(client: _$_aws_sdk_client_cognito_identity_provider0.__Client<any, InputTypesUnion, _$_smithy_types0.MetadataBearer, any>, command: _$_aws_sdk_client_cognito_identity_provider0.$Command<InputType, OutputType, any, InputTypesUnion, _$_smithy_types0.MetadataBearer>, options?: _$_smithy_types0.RequestPresigningArguments | undefined) => ResultAsync<string,
|
|
557
|
+
declare const getSignedUrl: <InputTypesUnion extends object, InputType extends InputTypesUnion, OutputType extends _$_smithy_types0.MetadataBearer = _$_smithy_types0.MetadataBearer>(client: _$_aws_sdk_client_cognito_identity_provider0.__Client<any, InputTypesUnion, _$_smithy_types0.MetadataBearer, any>, command: _$_aws_sdk_client_cognito_identity_provider0.$Command<InputType, OutputType, any, InputTypesUnion, _$_smithy_types0.MetadataBearer>, options?: _$_smithy_types0.RequestPresigningArguments | undefined) => ResultAsync<string, void>;
|
|
639
558
|
//#endregion
|
|
640
559
|
//#region src/s3/object.d.ts
|
|
641
560
|
/**
|
|
@@ -645,13 +564,11 @@ declare const getSignedUrl: <InputTypesUnion extends object, InputType extends I
|
|
|
645
564
|
* @param {string} key - The key of the object to retrieve.
|
|
646
565
|
* @returns {Promise<Buffer>} A promise that resolves to the object data as a Buffer.
|
|
647
566
|
*/
|
|
648
|
-
declare const getObject: (bucketName: string, key: string) => ResultAsync<Buffer<ArrayBufferLike>,
|
|
649
|
-
type: 's3_get';
|
|
650
|
-
}>;
|
|
567
|
+
declare const getObject: (bucketName: string, key: string) => ResultAsync<Buffer<ArrayBufferLike>, type_error_s3>;
|
|
651
568
|
/**
|
|
652
569
|
* Convenience function to get an object from S3 and return it as a string.
|
|
653
570
|
*/
|
|
654
|
-
declare function getObjectString(bucketName: string, key: string): ResultAsync<string,
|
|
571
|
+
declare function getObjectString(bucketName: string, key: string): ResultAsync<string, type_error_s3>;
|
|
655
572
|
/**
|
|
656
573
|
* Checks if an object exists in an s3 bucket by retrieving the HEAD data
|
|
657
574
|
*
|
|
@@ -659,24 +576,51 @@ declare function getObjectString(bucketName: string, key: string): ResultAsync<s
|
|
|
659
576
|
* @param {string} key - The key of the object to retrieve.
|
|
660
577
|
* @returns {Promise<Buffer>} A promise that resolves to a boolean.
|
|
661
578
|
*/
|
|
662
|
-
declare const objectExists: (bucketName: string, key: string) => ResultAsync<boolean,
|
|
663
|
-
type: 's3_get';
|
|
664
|
-
}>;
|
|
579
|
+
declare const objectExists: (bucketName: string, key: string) => ResultAsync<boolean, type_error_s3>;
|
|
665
580
|
//#endregion
|
|
666
581
|
//#region src/dynamo/errors.d.ts
|
|
667
|
-
|
|
582
|
+
/** Error wrapper for failures that happen while doing DynamoDB or DynamoDB Toolbox work. */
|
|
583
|
+
type type_error_dynamo = {
|
|
668
584
|
type: 'dynamo';
|
|
585
|
+
error: DynamoDBToolboxError | unknown;
|
|
669
586
|
};
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
587
|
+
/** Internal reason used before converting Dynamo-related errors into public lambda errors. */
|
|
588
|
+
type type_error_lambda_fromDynamo_reason = 'invalidInput' | 'conditionalCheckFailed' | 'transactionConflict' | 'resourceNotFound' | 'throttled' | 'accessDenied' | 'internal';
|
|
589
|
+
/** Per-reason public response override for endpoint-specific privacy and status choices. */
|
|
590
|
+
type type_error_lambda_fromDynamo_override = {
|
|
591
|
+
message?: string;
|
|
592
|
+
} | Partial<type_error_lambda>;
|
|
593
|
+
/** Options for converting Dynamo errors to lambda errors. */
|
|
594
|
+
type type_error_lambda_fromDynamo_options = Partial<Record<type_error_lambda_fromDynamo_reason, type_error_lambda_fromDynamo_override>> & {
|
|
595
|
+
/**
|
|
596
|
+
* By default DynamoDB and DynamoDB Toolbox details are not returned to clients.
|
|
597
|
+
* Set this to true only when the Toolbox path is already a public input field.
|
|
598
|
+
*/
|
|
599
|
+
includeToolboxPath?: boolean;
|
|
674
600
|
};
|
|
601
|
+
/** Wrap an unknown caught value as a Dynamo-domain error for neverthrow flows. */
|
|
602
|
+
declare function error_dynamo(error: unknown): type_error_dynamo;
|
|
603
|
+
/** Convert DynamoDB Toolbox or AWS SDK errors into a safe lambda error for API responses. */
|
|
604
|
+
declare function error_lambda_fromDynamo(e: type_error_dynamo, options?: type_error_lambda_fromDynamo_options): type_error_lambda;
|
|
675
605
|
//#endregion
|
|
676
606
|
//#region src/ses/errors.d.ts
|
|
677
|
-
|
|
607
|
+
/** Error wrapper for failures that happen while doing SES SDK work. */
|
|
608
|
+
type type_error_ses = {
|
|
678
609
|
type: 'ses';
|
|
610
|
+
error: unknown;
|
|
679
611
|
};
|
|
612
|
+
/** Internal reason used before converting SES errors into public lambda errors. */
|
|
613
|
+
type type_error_lambda_fromSes_reason = 'invalidInput' | 'messageRejected' | 'identityNotVerified' | 'notFound' | 'alreadyExists' | 'conflict' | 'throttled' | 'accessDenied' | 'internal';
|
|
614
|
+
/** Per-reason public response override for endpoint-specific privacy and status choices. */
|
|
615
|
+
type type_error_lambda_fromSes_override = {
|
|
616
|
+
message?: string;
|
|
617
|
+
} | Partial<type_error_lambda>;
|
|
618
|
+
/** Options for converting SES errors to lambda errors. */
|
|
619
|
+
type type_error_lambda_fromSes_options = Partial<Record<type_error_lambda_fromSes_reason, type_error_lambda_fromSes_override>>;
|
|
620
|
+
/** Wrap an unknown caught value as an SES-domain error for neverthrow flows. */
|
|
621
|
+
declare function error_ses(error: unknown): type_error_ses;
|
|
622
|
+
/** Convert AWS SDK SES errors into a safe lambda error for API responses. */
|
|
623
|
+
declare function error_lambda_fromSes(e: type_error_ses, options?: type_error_lambda_fromSes_options): type_error_lambda;
|
|
680
624
|
//#endregion
|
|
681
625
|
//#region node_modules/.pnpm/@types+unist@3.0.3/node_modules/@types/unist/index.d.ts
|
|
682
626
|
// ## Interfaces
|
|
@@ -1112,8 +1056,12 @@ declare function readPackageJson(filePath: string): Promise<PackageJson | undefi
|
|
|
1112
1056
|
//#region src/utils/cli.d.ts
|
|
1113
1057
|
declare const colorText: (format: Parameters<typeof styleText>[0], text: unknown) => string;
|
|
1114
1058
|
//#endregion
|
|
1059
|
+
//#region src/utils/errors.d.ts
|
|
1060
|
+
declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
1061
|
+
declare function getErrorName(error: unknown): string | undefined;
|
|
1062
|
+
//#endregion
|
|
1115
1063
|
//#region src/types/safe.d.ts
|
|
1116
1064
|
type SafeOmit<T, K extends keyof any> = T extends any ? Omit<T, K> : never;
|
|
1117
1065
|
//#endregion
|
|
1118
|
-
export { APIGatewayHandler, ApiEndpoints, ApiErrorBody, ApiInput, ApiOutput, ApiRequestFunction, ApiResponse, ApiSchema, ApiSuccessBody, CleanResponse, DeepOverride, DeepPartial, DeepRequired, ErrorBody, ErrorCode, ErrorRawProxyResultV2, FetchResponse, GetSchemaByPathOptions, HTTPMethod, HTTPMethods, LambdaErrorResponse, OkRawProxyResultV2, RawApiGatewayHandler, RawProxyResultV2, SafeOmit, SuccessCode, Toc, TocEntry, changePassword, colorText, computeSecretHash, confirmForgotPassword, confirmSignup, createApiRequest, deepDiff, error_cognito,
|
|
1066
|
+
export { APIGatewayHandler, ApiEndpoints, ApiErrorBody, ApiInput, ApiOutput, ApiRequestFunction, ApiResponse, ApiSchema, ApiSuccessBody, CleanResponse, DeepOverride, DeepPartial, DeepRequired, ErrorBody, ErrorCode, ErrorRawProxyResultV2, FetchResponse, GetSchemaByPathOptions, HTTPMethod, HTTPMethods, LambdaErrorResponse, OkRawProxyResultV2, RawApiGatewayHandler, RawProxyResultV2, SafeOmit, SuccessCode, Toc, TocEntry, changePassword, colorText, computeSecretHash, confirmForgotPassword, confirmSignup, createApiRequest, deepDiff, error_cognito, error_dynamo, error_lambda_badRequest, error_lambda_conflict, error_lambda_forbidden, error_lambda_fromCognito, error_lambda_fromDynamo, error_lambda_fromS3, error_lambda_fromSes, error_lambda_internal, error_lambda_notFound, error_lambda_unauthorized, error_s3, error_ses, exists, extractAttributes, extractToc, forgotPassword, getByPath, getCognitoClient, getCookies, getErrorName, getObject, getObjectString, getS3, getSchemaByPath, getSignedUrl, getUserDetails, getUserGroups, isRecord, isSchema, is_s3_notFound, login, logout, objectExists, parseRaw, pruneToShape, readPackageJson, refreshOAuthToken, refreshTokens, resetPassword, response_error, response_ok, response_valibotError, setByPath, signUp, type_error_cognito, type_error_dynamo, type_error_lambda, type_error_lambda_badRequest, type_error_lambda_conflict, type_error_lambda_forbidden, type_error_lambda_fromCognito_options, type_error_lambda_fromCognito_reason, type_error_lambda_fromDynamo_options, type_error_lambda_fromDynamo_reason, type_error_lambda_fromS3_options, type_error_lambda_fromS3_reason, type_error_lambda_fromSes_options, type_error_lambda_fromSes_reason, type_error_lambda_internal, type_error_lambda_notFound, type_error_lambda_unauthorized, type_error_response, type_error_s3, type_error_ses, type_userResponse, unwrap, verifyOAuthToken, wrapHandler, writeIfDifferent };
|
|
1119
1067
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":["Data","Point","line","column","offset","Position","start","end","Literal","Node","value","type","data","position","Parent","children","Data","UnistData","Literal","UnistLiteral","Node","UnistNode","Parent","UnistParent","Properties","Array","PropertyName","ElementContent","ElementContentMap","Comment","Element","Text","comment","element","text","RootContent","RootContentMap","Doctype","doctype","Content","Literals","Nodes","Extract","Root","Parents","data","value","children","CommentData","type","DoctypeData","ElementData","tagName","properties","content","RootData","TextData"],"sources":["../src/lambda/handlerUtils.ts","../src/lambda/client-types.ts","../src/lambda/client.ts","../src/lambda/errors.ts","../src/lambda/response.ts","../src/lambda/server/authentication.ts","../src/cognito/client.ts","../src/cognito/errors.ts","../src/cognito/user.ts","../src/cognito/password.ts","../src/s3/client.ts","../src/s3/errors.ts","../src/s3/signedUrl.ts","../src/s3/object.ts","../src/dynamo/errors.ts","../src/ses/errors.ts","../node_modules/.pnpm/@types+unist@3.0.3/node_modules/@types/unist/index.d.ts","../node_modules/.pnpm/@types+hast@3.0.4/node_modules/@types/hast/index.d.ts","../src/rehype/flat-toc.ts","../src/utils/valibot.ts","../src/types/deep.ts","../src/utils/object.ts","../src/utils/fs.ts","../src/utils/cli.ts","../src/types/safe.ts"],"x_google_ignoreList":[16,17],"mappings":";;;;;;;;;;;;;;KAGY,WAAA;AAAA,KACA,SAAA;AAAA,KAEA,SAAA;EAAc,OAAA;EAAiB,KAAA;IAAU,IAAA;IAAc,KAAA;EAAA;AAAA;;;;KAKvD,qBAAA;EACV,UAAA,EAAY,SAAA;EACZ,OAAA;IAAA,CAAa,MAAA;EAAA;EACb,IAAA,GAAO,SAAA;EACP,eAAA;EACA,OAAA;AAAA;AAAA,KAGU,kBAAA;EACV,UAAA,EAAY,WAAA;EACZ,OAAA;IAAA,CAAa,MAAA;EAAA;EACb,IAAA;EACA,eAAA;EACA,OAAA;AAAA;;;;KAKU,gBAAA,GAAmB,qBAAA,GAAwB,kBAAA;AAAA,KAG3C,iBAAA,OAAwB,KAAA,EAAO,CAAA,EAAG,OAAA,EAAS,OAAA,KAAY,OAAA,CAAQ,uBAAA;AAAA,KAG/D,oBAAA,WAA+B,0CAAA,UACzC,KAAA,EAAO,CAAA,EACP,OAAA,EAAS,OAAA,KACN,OAAA,CAAQ,gBAAA;;;;;;;;;;;;AAnBb;;;iBAmCgB,WAAA,WAAsB,0CAAA,MAAA,CACpC,OAAA,EAAS,oBAAA,CAAqB,CAAA,IAC7B,iBAAA,CAAkB,CAAA;;;;;;;;;KC7CT,QAAA,WAAmB,YAAA,YAAwB,CAAA,oBAAqB,CAAA,cAAe,OAAA,CACzF,CAAA;EACE,IAAA,EAAM,CAAA;EAAG,MAAA,EAAQ,CAAA;AAAA;;;;ADVrB;;;KCmBY,SAAA,WAAoB,YAAA,YAAwB,CAAA,oBAAqB,CAAA,cAAe,OAAA,CAC1F,CAAA;EACE,IAAA,EAAM,CAAA;EAAG,MAAA,EAAQ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,YAAA,CAAa,CAAA,CAAE,CAAA,MAAO,CAAA,CAAE,CAAA;;;;;;;;;;iBC7B9F,SAAA,kBAAA,CAA4B,GAAA,EAAK,CAAA,EAAG,IAAA,UAAc,KAAA,QAAa,CAAA;;;;;;ArBR/E;iBqBkCgB,SAAA,kBAAA,CAA4B,GAAA,EAAK,CAAA,EAAG,IAAA;;;;ArBjCpD;;;;;AAEA;;;;;;;;;;AAKA;;cqB6Da,QAAA,uCAA8C,CAAA,EAAK,CAAA,EAAC,CAAA,EAAK,CAAA,KAAI,WAAA,CAAY,CAAA;;;;;;;;;;;;ArBrDtF;;;;;;;;;;;;iBqBoGgB,YAAA,OAAA,CAAoB,MAAA,EAAQ,CAAA,EAAG,KAAA,EAAO,EAAA,GAAK,EAAA;;;;;;iBC9GrC,MAAA,CAAO,QAAA,WAAmB,OAAA;;;;;iBAa1B,gBAAA,CAAiB,QAAA,UAAkB,OAAA,WAAkB,OAAA;;;;iBA4BrD,eAAA,CAAgB,QAAA,WAAmB,OAAA,CAAQ,WAAA;;;cChDpD,SAAA,GAAS,MAAA,EAAY,UAAA,QAAkB,SAAA,MAAa,IAAA;;;KCFrD,QAAA,2BAAmC,CAAA,eAAgB,IAAA,CAAK,CAAA,EAAG,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":["Data","Point","line","column","offset","Position","start","end","Literal","Node","value","type","data","position","Parent","children","Data","UnistData","Literal","UnistLiteral","Node","UnistNode","Parent","UnistParent","Properties","Array","PropertyName","ElementContent","ElementContentMap","Comment","Element","Text","comment","element","text","RootContent","RootContentMap","Doctype","doctype","Content","Literals","Nodes","Extract","Root","Parents","data","value","children","CommentData","type","DoctypeData","ElementData","tagName","properties","content","RootData","TextData"],"sources":["../src/lambda/handlerUtils.ts","../src/lambda/client-types.ts","../src/lambda/client.ts","../src/lambda/errors.ts","../src/lambda/response.ts","../src/lambda/server/authentication.ts","../src/cognito/client.ts","../src/cognito/errors.ts","../src/cognito/user.ts","../src/cognito/password.ts","../src/s3/client.ts","../src/s3/errors.ts","../src/s3/signedUrl.ts","../src/s3/object.ts","../src/dynamo/errors.ts","../src/ses/errors.ts","../node_modules/.pnpm/@types+unist@3.0.3/node_modules/@types/unist/index.d.ts","../node_modules/.pnpm/@types+hast@3.0.4/node_modules/@types/hast/index.d.ts","../src/rehype/flat-toc.ts","../src/utils/valibot.ts","../src/types/deep.ts","../src/utils/object.ts","../src/utils/fs.ts","../src/utils/cli.ts","../src/utils/errors.ts","../src/types/safe.ts"],"x_google_ignoreList":[16,17],"mappings":";;;;;;;;;;;;;;;KAGY,WAAA;AAAA,KACA,SAAA;AAAA,KAEA,SAAA;EAAc,OAAA;EAAiB,KAAA;IAAU,IAAA;IAAc,KAAA;EAAA;AAAA;;;;KAKvD,qBAAA;EACV,UAAA,EAAY,SAAA;EACZ,OAAA;IAAA,CAAa,MAAA;EAAA;EACb,IAAA,GAAO,SAAA;EACP,eAAA;EACA,OAAA;AAAA;AAAA,KAGU,kBAAA;EACV,UAAA,EAAY,WAAA;EACZ,OAAA;IAAA,CAAa,MAAA;EAAA;EACb,IAAA;EACA,eAAA;EACA,OAAA;AAAA;;;;KAKU,gBAAA,GAAmB,qBAAA,GAAwB,kBAAA;AAAA,KAG3C,iBAAA,OAAwB,KAAA,EAAO,CAAA,EAAG,OAAA,EAAS,OAAA,KAAY,OAAA,CAAQ,uBAAA;AAAA,KAG/D,oBAAA,WAA+B,0CAAA,UACzC,KAAA,EAAO,CAAA,EACP,OAAA,EAAS,OAAA,KACN,OAAA,CAAQ,gBAAA;;;;;;;;;;;;;AAnBb;;iBAmCgB,WAAA,WAAsB,0CAAA,MAAA,CACpC,OAAA,EAAS,oBAAA,CAAqB,CAAA,IAC7B,iBAAA,CAAkB,CAAA;;;;;;;;;KC7CT,QAAA,WAAmB,YAAA,YAAwB,CAAA,oBAAqB,CAAA,cAAe,OAAA,CACzF,CAAA;EACE,IAAA,EAAM,CAAA;EAAG,MAAA,EAAQ,CAAA;AAAA;;;;;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