/// import { StringEncoded } from "../../codec-string/index.js"; export type AttributeValue = undefined | S | N | NB | B | BOOL | NULL | L> | M>; export type AttributeMap = Record; export type NativeBinaryAttribute = ArrayBuffer | BigInt64Array | BigUint64Array | Buffer | DataView | Float32Array | Float64Array | Int16Array | Int32Array | Int8Array | Uint16Array | Uint32Array | Uint8Array | Uint8ClampedArray; export type DocumentValue = undefined | null | boolean | number | bigint | string | Document[] | NativeBinaryAttribute | { [key: string]: DocumentValue; }; export type ToAttributeMap = ToAttributeValue["M"]; /** * Computes the JSON representation of an object, {@link T}. */ export type ToAttributeValue = T extends undefined ? undefined : T extends null ? NULL : T extends boolean ? BOOL : T extends string ? S : T extends number ? N : T extends bigint ? NB : T extends NativeBinaryAttribute ? B : T extends ArrayLike ? L<{ [index in keyof T]: index extends "length" ? T[index] : ToAttributeValue; }> : M<{ [name in keyof T]: ToAttributeValue; }>; export interface S { S: T; } export interface B { B: Buffer; } export interface BOOL { BOOL: T; } export interface M = Record> { M: T; } export interface N { N: number extends T ? `${T}` | StringEncoded : StringEncoded; } export interface NB { N: bigint extends T ? `${T}` | StringEncoded : StringEncoded; } export interface NULL { NULL: boolean; } export interface L = ArrayLike> { L: T; }