/** * Copyright 2026 - present Nazmul Hassan * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { Ar as RequireExactly, S as NormalPrimitive, ai as KeyForObject, ci as NestedKeyString, ii as KeyForArray, qr as DotNotationKey } from "./index-Dx3yeNwR.cjs"; import { U as QueryString } from "./string-DHFDNqwf.cjs"; import { f as TypeOrArray } from "./array-D4KUVs0t.cjs"; //#region src/types/form.d.ts /** - Configuration options to control FormData generation behavior. */ interface FormDataConfigs { /** * * An array of dot-notation keys to exclude from processing. * * Ignored keys are omitted entirely, even if included in other options. */ ignoreKeys?: DotNotationKey[]; /** * * Specifies which keys should be included even if their values are falsy. * * Use `*` to preserve all keys. */ requiredKeys?: '*' | DotNotationKey[]; /** * * Defines which keys should be converted to lowercase. * * Use `*` to apply to all keys. */ lowerCaseKeys?: '*' | DotNotationKey[]; /** * * Defines which values should be converted to lowercase. * * Use `*` to apply to all keys. */ lowerCaseValues?: '*' | NestedKeyString[]; /** * * An array of keys (values must be object) to preserve in their original structure. * - Use `*` to preserve all keys with object values in their dot-notation format. * - If a key exists in both `dotNotateNested` and `stringifyNested`, `dotNotateNested` takes precedence. */ dotNotateNested?: '*' | KeyForObject[]; /** * * Specifies which keys (values must be objects) should be stringified instead of being dot-notated. * - Defaults to `*`, meaning all keys with object values will be stringified. Which is standard in modern form submissions. * - Use `*` to stringify all nested objects. * - If a key exists in both `dotNotateNested` and `stringifyNested`, `dotNotateNested` takes precedence. */ stringifyNested?: '*' | KeyForObject[]; /** * * Controls how arrays should be serialized in FormData. * - If a key is included, the array will be broken into individual key-value pairs (`key[0]: value, key[1]: value`). * - Use `*` to apply this behavior to all array keys. */ breakArray?: '*' | KeyForArray[]; /** - Enables automatic trimming of string values before appending them to FormData. */ trimStrings?: boolean; } /** * Represents a file upload operation, commonly used in libraries like `FilePond` or `Ant Design Upload`. */ type FileUpload = RequireExactly<{ /** The primary file being uploaded. */ file: File | CustomFile; /** The list of files associated with the upload. */ fileList: CustomFile[]; }, 1>; /** * Represents a custom file structure used in file upload components. */ interface CustomFile { /** Unique identifier for the file. */ uid: string; /** The timestamp (milliseconds) when the file was last modified. */ lastModified: number; /** A string representation of the last modified date. */ lastModifiedDate: Date; /** The name of the file. */ name: string; /** The size of the file in bytes. */ size: number; /** The MIME type of the file. */ type: string; /** Upload progress percentage (0-100). */ percent: number; /** The original file object before any transformations. */ originFileObj: OriginFileObj; /** The URL for a thumbnail preview of the file. */ thumbUrl: string; /** Optional error information if the upload fails. */ error?: FileError; /** Optional server response after a successful upload. */ response?: string; /** Optional status of the file upload (e.g., "uploading", "done", "error"). */ status?: string; } /** * Represents the original file object before any modifications. */ interface OriginFileObj extends File { /** Unique identifier for the original file. */ uid: string; } /** * Represents an error that occurs during a file upload. */ interface FileError extends Error { /** HTTP status code of the error. */ status: number; /** The HTTP method used for the request (e.g., "POST", "PUT"). */ method: string; /** The URL where the upload was attempted. */ url: string; } /** THe return type of `serializeForm` wither as object or query string. */ type SerializedForm = T extends false ? Record : QueryString; /** * Represents the parsed form data. */ type ParsedFormData = T extends string ? Record : TypeOrArray> : Record : TypeOrArray>; //#endregion export { OriginFileObj as a, FormDataConfigs as i, FileError as n, ParsedFormData as o, FileUpload as r, SerializedForm as s, CustomFile as t };