@devbie/apits 0.0.0-stage → 1.0.0

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.
Files changed (51) hide show
  1. package/README.md +89 -2
  2. package/bin/apits +4 -0
  3. package/dist/cjs/core/cli.d.ts +29 -0
  4. package/dist/cjs/core/cli.js +396 -0
  5. package/dist/cjs/core/generator.d.ts +44 -0
  6. package/dist/cjs/core/generator.js +301 -0
  7. package/dist/cjs/core/writeRequestClient.d.ts +2 -0
  8. package/dist/cjs/core/writeRequestClient.js +93 -0
  9. package/dist/cjs/index.d.ts +2 -0
  10. package/dist/cjs/index.js +25 -0
  11. package/dist/cjs/types.d.ts +330 -0
  12. package/dist/cjs/types.js +90 -0
  13. package/dist/cjs/utils/console.d.ts +16 -0
  14. package/dist/cjs/utils/console.js +79 -0
  15. package/dist/cjs/utils/getOutputPath.d.ts +5 -0
  16. package/dist/cjs/utils/getOutputPath.js +43 -0
  17. package/dist/cjs/utils/helpers.d.ts +65 -0
  18. package/dist/cjs/utils/helpers.js +166 -0
  19. package/dist/cjs/utils/openApiToInterfaces.d.ts +14 -0
  20. package/dist/cjs/utils/openApiToInterfaces.js +229 -0
  21. package/dist/cjs/utils/spinner.d.ts +15 -0
  22. package/dist/cjs/utils/spinner.js +69 -0
  23. package/dist/cjs/utils/utils.d.ts +56 -0
  24. package/dist/cjs/utils/utils.js +355 -0
  25. package/dist/cjs/utils/vtilsLite.d.ts +55 -0
  26. package/dist/cjs/utils/vtilsLite.js +123 -0
  27. package/dist/esm/core/cli.d.mts +29 -0
  28. package/dist/esm/core/cli.mjs +713 -0
  29. package/dist/esm/core/generator.d.mts +44 -0
  30. package/dist/esm/core/generator.mjs +463 -0
  31. package/dist/esm/core/writeRequestClient.d.mts +2 -0
  32. package/dist/esm/core/writeRequestClient.mjs +54 -0
  33. package/dist/esm/index.d.mts +2 -0
  34. package/dist/esm/index.mjs +2 -0
  35. package/dist/esm/types.d.mts +330 -0
  36. package/dist/esm/types.mjs +94 -0
  37. package/dist/esm/utils/console.d.mts +16 -0
  38. package/dist/esm/utils/console.mjs +65 -0
  39. package/dist/esm/utils/getOutputPath.d.mts +5 -0
  40. package/dist/esm/utils/getOutputPath.mjs +12 -0
  41. package/dist/esm/utils/helpers.d.mts +65 -0
  42. package/dist/esm/utils/helpers.mjs +226 -0
  43. package/dist/esm/utils/openApiToInterfaces.d.mts +14 -0
  44. package/dist/esm/utils/openApiToInterfaces.mjs +326 -0
  45. package/dist/esm/utils/spinner.d.mts +15 -0
  46. package/dist/esm/utils/spinner.mjs +58 -0
  47. package/dist/esm/utils/utils.d.mts +56 -0
  48. package/dist/esm/utils/utils.mjs +545 -0
  49. package/dist/esm/utils/vtilsLite.d.mts +55 -0
  50. package/dist/esm/utils/vtilsLite.mjs +142 -0
  51. package/package.json +68 -4
@@ -0,0 +1,330 @@
1
+ /// <reference types="node" />
2
+ export * from "json-schema";
3
+ import { JSONSchema4 } from "json-schema";
4
+ import { OpenAPIV3 } from "openapi-types";
5
+ import { ParsedPath } from "path";
6
+ /** Returns the client import snippet placed at the top of each generated file. */
7
+ export type ClientImportTemplate = () => string;
8
+ /** Interface definition */
9
+ export interface Interface {
10
+ /** Interface name */
11
+ title: string;
12
+ /** Request path */
13
+ path: string;
14
+ /** Request method, HEAD and OPTIONS are handled like GET, others like POST */
15
+ method: Method;
16
+ /** Path parameters */
17
+ req_params: Array<{
18
+ /** Name */
19
+ name: string;
20
+ /** Description */
21
+ desc: string;
22
+ /** Example */
23
+ example: string;
24
+ /** Type (YApi-X) */
25
+ type?: RequestParamType;
26
+ }>;
27
+ /** GET only: query string */
28
+ req_query: Array<{
29
+ /** Name */
30
+ name: string;
31
+ /** Description */
32
+ desc: string;
33
+ /** Example */
34
+ example: string;
35
+ /** Required */
36
+ required: Required;
37
+ /** Type (YApi-X) */
38
+ type?: RequestQueryType;
39
+ }>;
40
+ /** POST only: request content type. No special handling needed for text, file, raw. */
41
+ req_body_type: RequestBodyType;
42
+ /** Whether it is json schema when `req_body_type = json` */
43
+ req_body_is_json_schema: boolean;
44
+ /** Request content when `req_body_type = form` */
45
+ req_body_form: Array<{
46
+ /** Name */
47
+ name: string;
48
+ /** Type */
49
+ type: RequestFormItemType;
50
+ /** Description */
51
+ desc: string;
52
+ /** Example */
53
+ example: string;
54
+ /** Required */
55
+ required: Required;
56
+ /**
57
+ * Whether the field accepts multiple files (a binary array in the
58
+ * OpenAPI schema, e.g. `files: {type: 'array', items: {format: 'binary'}}`).
59
+ * Only meaningful when `type` is `file`.
60
+ */
61
+ isArray?: boolean;
62
+ /** Allowed literal values when the form field is an enum */
63
+ enum?: Array<string | number>;
64
+ }>;
65
+ /**
66
+ * Whether the form body is `multipart/form-data` (true) or
67
+ * `application/x-www-form-urlencoded` (false). Only set when
68
+ * `req_body_type = form`.
69
+ */
70
+ req_body_multipart?: boolean;
71
+ /**
72
+ * JSON Schema fragment describing dynamic form fields (the
73
+ * `additionalProperties` of a multipart request schema). Used for
74
+ * runtime-named upload fields such as `evidence_0`, `evidence_1`, ...
75
+ */
76
+ req_body_additional?: Record<string, any>;
77
+ /** Request content when `req_body_type = json` */
78
+ req_body_other: string;
79
+ /** Response data type */
80
+ res_body_type: ResponseBodyType;
81
+ /** Whether it is json schema when `res_body_type = json` */
82
+ res_body_is_json_schema: boolean;
83
+ /** Response data */
84
+ res_body: string;
85
+ [key: string]: any;
86
+ }
87
+ /** Category information */
88
+ export interface Category {
89
+ /** Category name */
90
+ name: string;
91
+ /** Category description */
92
+ desc: string;
93
+ }
94
+ /** Request method */
95
+ export declare enum Method {
96
+ GET = "GET",
97
+ POST = "POST",
98
+ PUT = "PUT",
99
+ DELETE = "DELETE",
100
+ HEAD = "HEAD",
101
+ OPTIONS = "OPTIONS",
102
+ PATCH = "PATCH"
103
+ }
104
+ /** Required */
105
+ export declare enum Required {
106
+ /** Not required */
107
+ false = "0",
108
+ /** Required */
109
+ true = "1"
110
+ }
111
+ /** Request body type */
112
+ export declare enum RequestBodyType {
113
+ /** Query string */
114
+ query = "query",
115
+ /** Form */
116
+ form = "form",
117
+ /** JSON */
118
+ json = "json",
119
+ /** Plain text */
120
+ text = "text",
121
+ /** File */
122
+ file = "file",
123
+ /** Raw data */
124
+ raw = "raw",
125
+ /** No request data */
126
+ none = "none"
127
+ }
128
+ /** Request path parameter type */
129
+ export declare enum RequestParamType {
130
+ /** String */
131
+ string = "string",
132
+ /** Number */
133
+ number = "number"
134
+ }
135
+ /** Request query parameter type */
136
+ export declare enum RequestQueryType {
137
+ /** String */
138
+ string = "string",
139
+ /** Number */
140
+ number = "number"
141
+ }
142
+ /** Request form item type */
143
+ export declare enum RequestFormItemType {
144
+ /** Plain text */
145
+ text = "text",
146
+ /** File */
147
+ file = "file"
148
+ }
149
+ /** Response body type */
150
+ export declare enum ResponseBodyType {
151
+ /** JSON */
152
+ json = "json",
153
+ /** Plain text */
154
+ text = "text",
155
+ /** XML */
156
+ xml = "xml",
157
+ /** Raw data */
158
+ raw = "raw"
159
+ }
160
+ /** Extended interface definition */
161
+ export interface ExtendedInterface extends Interface {
162
+ parsedPath: ParsedPath;
163
+ }
164
+ /**
165
+ * Generator configuration for one OpenAPI source.
166
+ */
167
+ export interface ApiConfig {
168
+ /**
169
+ * The OpenAPI document to generate code from. Required.
170
+ *
171
+ * Accepts an http(s) URL or a local file path. Local files may be
172
+ * JSON (.json / .json5) or YAML (.yaml / .yml).
173
+ *
174
+ * @example 'http://localhost:3041/api-json'
175
+ * @example './openapi.json'
176
+ * @example './docs/openapi.yaml'
177
+ */
178
+ input: string;
179
+ /**
180
+ * Output directory for generated files (relative or absolute path).
181
+ *
182
+ * Two files are written into it: `<name>.ts` (type declarations and
183
+ * request functions) and `request.ts` (the axios client, unless
184
+ * `client` is false or the file already exists).
185
+ *
186
+ * @default 'src/api'
187
+ */
188
+ output?: string;
189
+ /**
190
+ * Base name of the generated types file: code is written to
191
+ * `<output>/<name>.ts`. Also serves as the source identifier for
192
+ * `apits gen -n <name>` filtering.
193
+ *
194
+ * Defaults to a name derived from `input`: the URL hostname
195
+ * (`http://localhost:3041/api-json` -> `localhost`) or the local file
196
+ * name without extension (`./user.openapi.yaml` -> `userOpenapi`).
197
+ * Duplicated derived names get an index suffix.
198
+ */
199
+ name?: string;
200
+ /**
201
+ * Runtime `baseURL` baked into every generated request function.
202
+ *
203
+ * Prefix with `[code]:` to emit the value as code instead of a string
204
+ * literal, e.g. to read from an env var at runtime:
205
+ *
206
+ * - `baseURL: '[code]:process.env.BASE_URL'` -> `baseURL: process.env.BASE_URL`
207
+ * - `baseURL: 'http://localhost:3000'` -> `baseURL: "http://localhost:3000"`
208
+ *
209
+ * May also be a function receiving each API path and returning the
210
+ * baseURL to use for that path (or undefined to omit).
211
+ */
212
+ baseURL?: ((path: string) => string | undefined) | string;
213
+ /**
214
+ * Returns the import snippet placed at the top of every generated file —
215
+ * use it to point at a custom request client instead of the scaffolded
216
+ * `request.ts`.
217
+ *
218
+ * Providing this option also flips the default of `client` to `false`,
219
+ * so no unused `request.ts` is scaffolded; set `client: true` explicitly
220
+ * to keep both.
221
+ *
222
+ * @default () => "import request from './request'"
223
+ */
224
+ clientImportTemplate?: ClientImportTemplate;
225
+ /**
226
+ * Type used for the `extra` argument of every generated request
227
+ * function — the object spread into the underlying client call as
228
+ * per-request overrides (headers, signal, `responseType`, ...).
229
+ *
230
+ * Defaults to `AxiosRequestConfig`, in which case each generated file
231
+ * also imports that type from `axios`. When using a custom client via
232
+ * `clientImportTemplate`, set this to that client's config type and
233
+ * make sure `clientImportTemplate` imports it, e.g.:
234
+ *
235
+ * ```ts
236
+ * clientImportTemplate: () => "import {request, type RequestConfig} from '../fetch'",
237
+ * clientConfigType: 'RequestConfig',
238
+ * ```
239
+ *
240
+ * @default 'AxiosRequestConfig'
241
+ */
242
+ clientConfigType?: string;
243
+ /**
244
+ * Whether to scaffold the default axios request client into
245
+ * `<output>/request.ts` (skipped when that file already exists).
246
+ *
247
+ * Defaults to `true`, and to `false` when `clientImportTemplate` is
248
+ * provided without an explicit `client` value.
249
+ *
250
+ * @default true
251
+ */
252
+ client?: boolean;
253
+ }
254
+ /** Combined configuration. */
255
+ export type SyntheticalConfig = Partial<ApiConfig & {
256
+ components: OpenAPIV3.Document["components"];
257
+ }>;
258
+ /** Configuration. */
259
+ export type Config = ApiConfig;
260
+ /**
261
+ * Request configuration.
262
+ */
263
+ export interface RequestConfig<Path extends string = string, ParamName extends string = string, QueryName extends string = string, RequestDataOptional extends boolean = boolean> {
264
+ /** Interface path, starting with `/` */
265
+ path: Path;
266
+ /** Request method */
267
+ method: Method;
268
+ /** Request headers, all headers except Content-Type */
269
+ requestHeaders: Record<string, string>;
270
+ /** Request body type */
271
+ requestBodyType: RequestBodyType;
272
+ /** Response body type */
273
+ responseBodyType: ResponseBodyType;
274
+ /** List of path parameter names */
275
+ paramNames: ParamName[];
276
+ /** List of query parameter names */
277
+ queryNames: QueryName[];
278
+ /** Whether request data is optional */
279
+ requestDataOptional: RequestDataOptional;
280
+ /** JSON Schema for request data (only effective when JSON Schema generation is enabled) */
281
+ requestDataJsonSchema: JSONSchema4;
282
+ /** JSON Schema for response data (only effective when JSON Schema generation is enabled) */
283
+ responseDataJsonSchema: JSONSchema4;
284
+ /** Request function name */
285
+ requestFunctionName: string;
286
+ }
287
+ /**
288
+ * Request parameters.
289
+ */
290
+ export interface RequestFunctionParams extends RequestConfig {
291
+ /** Raw data */
292
+ rawData: Record<string, any>;
293
+ /** Request data, excluding file data */
294
+ data: Record<string, any>;
295
+ /** Whether there is file data */
296
+ hasFileData: boolean;
297
+ /** Request file data */
298
+ fileData: Record<string, any>;
299
+ /** All request data, including data and fileData */
300
+ allData: Record<string, any>;
301
+ /** Get FormData instance for all request data (including files) */
302
+ getFormData: () => FormData;
303
+ }
304
+ /** Additional parameters of the request function */
305
+ export type RequestFunctionRestArgs<T extends Function> = T extends (payload: any, ...args: infer R) => any ? R : never;
306
+ /** Property definition */
307
+ export interface PropDefinition {
308
+ /** Property name */
309
+ name: string;
310
+ /** Required */
311
+ required: boolean;
312
+ /** Type */
313
+ type: JSONSchema4["type"];
314
+ /** Comment */
315
+ comment: string;
316
+ /** Whether the property is an array (used for multi-file upload fields) */
317
+ isArray?: boolean;
318
+ /** Allowed literal values for enum properties */
319
+ enum?: Array<string | number>;
320
+ }
321
+ /** Property definition list */
322
+ export type PropDefinitions = PropDefinition[];
323
+ /** Request function body generation template function */
324
+ export interface RequestFunctionTemplateProps {
325
+ baseURL?: string;
326
+ requestFunctionName: string;
327
+ requestDataTypeName: string;
328
+ extendedInterfaceInfo: ExtendedInterface;
329
+ responseDataTypeName: string;
330
+ }
@@ -0,0 +1,94 @@
1
+ export * from "json-schema";
2
+
3
+ /** Returns the client import snippet placed at the top of each generated file. */
4
+
5
+ /** Interface definition */
6
+
7
+ /** Category information */
8
+
9
+ /** Request method */
10
+ export var Method = /*#__PURE__*/function (Method) {
11
+ Method["GET"] = "GET";
12
+ Method["POST"] = "POST";
13
+ Method["PUT"] = "PUT";
14
+ Method["DELETE"] = "DELETE";
15
+ Method["HEAD"] = "HEAD";
16
+ Method["OPTIONS"] = "OPTIONS";
17
+ Method["PATCH"] = "PATCH";
18
+ return Method;
19
+ }({});
20
+
21
+ /** Required */
22
+ export var Required = /*#__PURE__*/function (Required) {
23
+ Required["false"] = "0";
24
+ Required["true"] = "1";
25
+ return Required;
26
+ }({});
27
+
28
+ /** Request body type */
29
+ export var RequestBodyType = /*#__PURE__*/function (RequestBodyType) {
30
+ RequestBodyType["query"] = "query";
31
+ RequestBodyType["form"] = "form";
32
+ RequestBodyType["json"] = "json";
33
+ RequestBodyType["text"] = "text";
34
+ RequestBodyType["file"] = "file";
35
+ RequestBodyType["raw"] = "raw";
36
+ RequestBodyType["none"] = "none";
37
+ return RequestBodyType;
38
+ }({});
39
+
40
+ /** Request path parameter type */
41
+ export var RequestParamType = /*#__PURE__*/function (RequestParamType) {
42
+ RequestParamType["string"] = "string";
43
+ RequestParamType["number"] = "number";
44
+ return RequestParamType;
45
+ }({});
46
+
47
+ /** Request query parameter type */
48
+ export var RequestQueryType = /*#__PURE__*/function (RequestQueryType) {
49
+ RequestQueryType["string"] = "string";
50
+ RequestQueryType["number"] = "number";
51
+ return RequestQueryType;
52
+ }({});
53
+
54
+ /** Request form item type */
55
+ export var RequestFormItemType = /*#__PURE__*/function (RequestFormItemType) {
56
+ RequestFormItemType["text"] = "text";
57
+ RequestFormItemType["file"] = "file";
58
+ return RequestFormItemType;
59
+ }({});
60
+
61
+ /** Response body type */
62
+ export var ResponseBodyType = /*#__PURE__*/function (ResponseBodyType) {
63
+ ResponseBodyType["json"] = "json";
64
+ ResponseBodyType["text"] = "text";
65
+ ResponseBodyType["xml"] = "xml";
66
+ ResponseBodyType["raw"] = "raw";
67
+ return ResponseBodyType;
68
+ }({});
69
+
70
+ /** Extended interface definition */
71
+
72
+ /**
73
+ * Generator configuration for one OpenAPI source.
74
+ */
75
+
76
+ /** Combined configuration. */
77
+
78
+ /** Configuration. */
79
+
80
+ /**
81
+ * Request configuration.
82
+ */
83
+
84
+ /**
85
+ * Request parameters.
86
+ */
87
+
88
+ /** Additional parameters of the request function */
89
+
90
+ /** Property definition */
91
+
92
+ /** Property definition list */
93
+
94
+ /** Request function body generation template function */
@@ -0,0 +1,16 @@
1
+ /** Log a plain message. */
2
+ export declare function log(message?: any, ...args: any[]): void;
3
+ /** Log an error message. */
4
+ export declare function error(message?: any, ...args: any[]): void;
5
+ /** Log an info message. */
6
+ export declare function info(message?: any, ...args: any[]): void;
7
+ /** Log a warning message. */
8
+ export declare function warn(message?: any, ...args: any[]): void;
9
+ /** Log a soft tip message with a prefix icon. */
10
+ export declare function tips(message?: any, ...args: any[]): void;
11
+ /** Log a success message. */
12
+ export declare function success(message?: any, ...args: any[]): void;
13
+ /** Print tabular data as a table. */
14
+ export declare function table(tabularData: any, properties?: ReadonlyArray<string>): void;
15
+ /** Print a separator line (or a blank line). */
16
+ export declare function line(blank?: boolean): void;
@@ -0,0 +1,65 @@
1
+ import chalk from "chalk";
2
+
3
+ /** Log a plain message. */
4
+ export function log(message) {
5
+ var _console;
6
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
7
+ args[_key - 1] = arguments[_key];
8
+ }
9
+ (_console = console).log.apply(_console, [message].concat(args));
10
+ }
11
+
12
+ /** Log an error message. */
13
+ export function error(message) {
14
+ var _console2;
15
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
16
+ args[_key2 - 1] = arguments[_key2];
17
+ }
18
+ (_console2 = console).error.apply(_console2, [chalk.magenta(message)].concat(args));
19
+ }
20
+
21
+ /** Log an info message. */
22
+ export function info(message) {
23
+ var _console3;
24
+ for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
25
+ args[_key3 - 1] = arguments[_key3];
26
+ }
27
+ (_console3 = console).info.apply(_console3, [chalk.yellowBright(message)].concat(args));
28
+ }
29
+
30
+ /** Log a warning message. */
31
+ export function warn(message) {
32
+ var _console4;
33
+ for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
34
+ args[_key4 - 1] = arguments[_key4];
35
+ }
36
+ (_console4 = console).warn.apply(_console4, [chalk.blue(message)].concat(args));
37
+ }
38
+
39
+ /** Log a soft tip message with a prefix icon. */
40
+ export function tips(message) {
41
+ var _console5;
42
+ for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
43
+ args[_key5 - 1] = arguments[_key5];
44
+ }
45
+ (_console5 = console).log.apply(_console5, [chalk.yellow("\uD83D\uDD08 ".concat(message, "\n"))].concat(args));
46
+ }
47
+
48
+ /** Log a success message. */
49
+ export function success(message) {
50
+ var _console6;
51
+ for (var _len6 = arguments.length, args = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
52
+ args[_key6 - 1] = arguments[_key6];
53
+ }
54
+ (_console6 = console).log.apply(_console6, [chalk.cyan("\u2713 ".concat(message))].concat(args));
55
+ }
56
+
57
+ /** Print tabular data as a table. */
58
+ export function table(tabularData, properties) {
59
+ console.table(tabularData, properties);
60
+ }
61
+
62
+ /** Print a separator line (or a blank line). */
63
+ export function line(blank) {
64
+ console.log("\n".concat(!blank ? "-----------------------" : ""));
65
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Resolve the output file path for a generated file.
3
+ */
4
+ import { Config } from "../types.mjs";
5
+ export declare const getOutputFilePath: (config: Config, file: string) => string;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Resolve the output file path for a generated file.
3
+ */
4
+
5
+ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
6
+ import path from "path";
7
+ export var getOutputFilePath = function getOutputFilePath(config, file) {
8
+ var _path$parse = path.parse(config.output || ""),
9
+ dir = _path$parse.dir,
10
+ name = _path$parse.name;
11
+ return path.join(dir, name, file);
12
+ };
@@ -0,0 +1,65 @@
1
+ import type { AppendOptions } from "form-data";
2
+ import type { Config, RequestConfig, RequestFunctionParams } from "../types.mjs";
3
+ /**
4
+ * Normalize user configuration into a config array and apply built-in
5
+ * defaults.
6
+ *
7
+ * Defaults:
8
+ * - `output` falls back to `src/api`.
9
+ * - `client` falls back to `true`, except when a custom
10
+ * `clientImportTemplate` is provided without an explicit `client` value —
11
+ * in that case the scaffolded client is skipped automatically, otherwise
12
+ * the generated `request.ts` would be dead code (the generated file
13
+ * imports the custom client instead).
14
+ *
15
+ * @param config Configuration
16
+ */
17
+ export declare function defineConfig(config: Config | Config[]): Config[];
18
+ export declare class FileData<T = any> {
19
+ /**
20
+ * Original file data.
21
+ */
22
+ private originalFileData;
23
+ /**
24
+ * Options.
25
+ */
26
+ private options;
27
+ /**
28
+ * File data helper class, unified file upload for web, mini-program and other platforms.
29
+ *
30
+ * @param originalFileData Original file data
31
+ * @param options If using internal getFormData, options will be used by it
32
+ */
33
+ constructor(originalFileData: T, options?: AppendOptions);
34
+ /**
35
+ * Get original file data.
36
+ *
37
+ * @returns Original file data
38
+ */
39
+ getOriginalFileData(): T;
40
+ /**
41
+ * Get options.
42
+ */
43
+ getOptions(): AppendOptions | undefined;
44
+ }
45
+ /**
46
+ * Parse request data, separating normal data and file data from request data.
47
+ *
48
+ * @param [requestData] Request data to parse
49
+ * @returns Object containing normal data (data) and file data (fileData), when data and fileData are empty objects, it means no such data exists
50
+ */
51
+ export declare function parseRequestData(requestData?: any): {
52
+ data: any;
53
+ fileData: any;
54
+ };
55
+ /**
56
+ * Prepare parameters to be passed to the request function.
57
+ */
58
+ export declare function prepare(requestConfig: RequestConfig, requestData: any): RequestFunctionParams;
59
+ /**
60
+ * Execute async function queue sequentially
61
+ * @param fns
62
+ * @param results
63
+ * @returns
64
+ */
65
+ export declare const asyncFnArrayOrderRun: <T = any>(fns: (() => Promise<T>)[], results?: T[]) => Promise<T[]>;