@nestia/fetcher 7.0.0-dev.20250608 → 7.0.1
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/README.md +93 -92
- package/package.json +1 -1
- package/src/AesPkcs5.ts +50 -50
- package/src/EncryptedFetcher.ts +174 -174
- package/src/FormDataInput.ts +87 -87
- package/src/HttpError.ts +1 -1
- package/src/IConnection.ts +255 -255
- package/src/IEncryptionPassword.ts +50 -50
- package/src/IFetchEvent.ts +31 -31
- package/src/IFetchRoute.ts +69 -69
- package/src/IPropagation.ts +100 -100
- package/src/MigrateFetcher.ts +118 -118
- package/src/NestiaSimulator.ts +82 -82
- package/src/PlainFetcher.ts +105 -105
- package/src/index.ts +7 -7
- package/src/internal/FetcherBase.ts +245 -245
package/src/FormDataInput.ts
CHANGED
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FormData input type.
|
|
3
|
-
*
|
|
4
|
-
* `FormDataInput<T>` is a type for the input of the `FormData` request, casting
|
|
5
|
-
* `File` property value type as an union of `File` and {@link FormDataInput.IFileProps},
|
|
6
|
-
* especially for the React Native environment.
|
|
7
|
-
*
|
|
8
|
-
* You know what? In the React Native environment, `File` class is not supported.
|
|
9
|
-
* Therefore, when composing a `FormData` request, you have to put the URI address
|
|
10
|
-
* of the local filesystem with file name and content type that is represented by the
|
|
11
|
-
* {@link FormDataInput.IFileProps} type.
|
|
12
|
-
*
|
|
13
|
-
* This `FormDataInput<T>` type is designed for that purpose. If the property value
|
|
14
|
-
* type is a `File` class, it converts it to an union type of `File` and
|
|
15
|
-
* {@link FormDataInput.IFileProps} type. Also, if the property value type is an array
|
|
16
|
-
* of `File` class, it converts it to an array of union type of `File` and
|
|
17
|
-
* {@link FormDataInput.IFileProps} type too.
|
|
18
|
-
*
|
|
19
|
-
* Before | After
|
|
20
|
-
* ----------|------------------------
|
|
21
|
-
* `boolean` | `boolean`
|
|
22
|
-
* `bigint` | `bigint`
|
|
23
|
-
* `number` | `number`
|
|
24
|
-
* `string` | `string`
|
|
25
|
-
* `File` | `File \| IFileProps`
|
|
26
|
-
*
|
|
27
|
-
* @template T Target object type.
|
|
28
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
29
|
-
*/
|
|
30
|
-
export type FormDataInput<T extends object> =
|
|
31
|
-
T extends Array<any>
|
|
32
|
-
? never
|
|
33
|
-
: T extends Function
|
|
34
|
-
? never
|
|
35
|
-
: {
|
|
36
|
-
[P in keyof T]: T[P] extends Array<infer U>
|
|
37
|
-
? FormDataInput.Value<U>[]
|
|
38
|
-
: FormDataInput.Value<T[P]>;
|
|
39
|
-
};
|
|
40
|
-
export namespace FormDataInput {
|
|
41
|
-
/**
|
|
42
|
-
* Value type of the `FormDataInput`.
|
|
43
|
-
*
|
|
44
|
-
* `Value<T>` is a type for the property value defined in the `FormDataInput`.
|
|
45
|
-
*
|
|
46
|
-
* If the original value type is a `File` class, `Value<T>` converts it to an union
|
|
47
|
-
* type of `File` and {@link IFileProps} type which is a structured data for the
|
|
48
|
-
* URI file location in the React Native environment.
|
|
49
|
-
*/
|
|
50
|
-
export type Value<T> = T extends File ? T | IFileProps : T;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Properties of a file.
|
|
54
|
-
*
|
|
55
|
-
* In the React Native, this `IFileProps` structured data can replace the `File`
|
|
56
|
-
* class instance in the `FormData` request.
|
|
57
|
-
*
|
|
58
|
-
* Just put the {@link uri URI address} of the local file system with the file's
|
|
59
|
-
* {@link name} and {@link type}. It would be casted to the `File` class instance
|
|
60
|
-
* automatically in the `FormData` request.
|
|
61
|
-
*
|
|
62
|
-
* Note that, this `IFileProps` type works only in the React Native environment.
|
|
63
|
-
* If you are developing a Web or NodeJS application, you have to utilize the
|
|
64
|
-
* `File` class instance directly.
|
|
65
|
-
*/
|
|
66
|
-
export interface IFileProps {
|
|
67
|
-
/**
|
|
68
|
-
* URI address of the file.
|
|
69
|
-
*
|
|
70
|
-
* In the React Native, the URI address in the local file system can replace
|
|
71
|
-
* the `File` class instance. If
|
|
72
|
-
*
|
|
73
|
-
* @format uri
|
|
74
|
-
*/
|
|
75
|
-
uri: string;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Name of the file.
|
|
79
|
-
*/
|
|
80
|
-
name: string;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Content type of the file.
|
|
84
|
-
*/
|
|
85
|
-
type: string;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* FormData input type.
|
|
3
|
+
*
|
|
4
|
+
* `FormDataInput<T>` is a type for the input of the `FormData` request, casting
|
|
5
|
+
* `File` property value type as an union of `File` and {@link FormDataInput.IFileProps},
|
|
6
|
+
* especially for the React Native environment.
|
|
7
|
+
*
|
|
8
|
+
* You know what? In the React Native environment, `File` class is not supported.
|
|
9
|
+
* Therefore, when composing a `FormData` request, you have to put the URI address
|
|
10
|
+
* of the local filesystem with file name and content type that is represented by the
|
|
11
|
+
* {@link FormDataInput.IFileProps} type.
|
|
12
|
+
*
|
|
13
|
+
* This `FormDataInput<T>` type is designed for that purpose. If the property value
|
|
14
|
+
* type is a `File` class, it converts it to an union type of `File` and
|
|
15
|
+
* {@link FormDataInput.IFileProps} type. Also, if the property value type is an array
|
|
16
|
+
* of `File` class, it converts it to an array of union type of `File` and
|
|
17
|
+
* {@link FormDataInput.IFileProps} type too.
|
|
18
|
+
*
|
|
19
|
+
* Before | After
|
|
20
|
+
* ----------|------------------------
|
|
21
|
+
* `boolean` | `boolean`
|
|
22
|
+
* `bigint` | `bigint`
|
|
23
|
+
* `number` | `number`
|
|
24
|
+
* `string` | `string`
|
|
25
|
+
* `File` | `File \| IFileProps`
|
|
26
|
+
*
|
|
27
|
+
* @template T Target object type.
|
|
28
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
29
|
+
*/
|
|
30
|
+
export type FormDataInput<T extends object> =
|
|
31
|
+
T extends Array<any>
|
|
32
|
+
? never
|
|
33
|
+
: T extends Function
|
|
34
|
+
? never
|
|
35
|
+
: {
|
|
36
|
+
[P in keyof T]: T[P] extends Array<infer U>
|
|
37
|
+
? FormDataInput.Value<U>[]
|
|
38
|
+
: FormDataInput.Value<T[P]>;
|
|
39
|
+
};
|
|
40
|
+
export namespace FormDataInput {
|
|
41
|
+
/**
|
|
42
|
+
* Value type of the `FormDataInput`.
|
|
43
|
+
*
|
|
44
|
+
* `Value<T>` is a type for the property value defined in the `FormDataInput`.
|
|
45
|
+
*
|
|
46
|
+
* If the original value type is a `File` class, `Value<T>` converts it to an union
|
|
47
|
+
* type of `File` and {@link IFileProps} type which is a structured data for the
|
|
48
|
+
* URI file location in the React Native environment.
|
|
49
|
+
*/
|
|
50
|
+
export type Value<T> = T extends File ? T | IFileProps : T;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Properties of a file.
|
|
54
|
+
*
|
|
55
|
+
* In the React Native, this `IFileProps` structured data can replace the `File`
|
|
56
|
+
* class instance in the `FormData` request.
|
|
57
|
+
*
|
|
58
|
+
* Just put the {@link uri URI address} of the local file system with the file's
|
|
59
|
+
* {@link name} and {@link type}. It would be casted to the `File` class instance
|
|
60
|
+
* automatically in the `FormData` request.
|
|
61
|
+
*
|
|
62
|
+
* Note that, this `IFileProps` type works only in the React Native environment.
|
|
63
|
+
* If you are developing a Web or NodeJS application, you have to utilize the
|
|
64
|
+
* `File` class instance directly.
|
|
65
|
+
*/
|
|
66
|
+
export interface IFileProps {
|
|
67
|
+
/**
|
|
68
|
+
* URI address of the file.
|
|
69
|
+
*
|
|
70
|
+
* In the React Native, the URI address in the local file system can replace
|
|
71
|
+
* the `File` class instance. If
|
|
72
|
+
*
|
|
73
|
+
* @format uri
|
|
74
|
+
*/
|
|
75
|
+
uri: string;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Name of the file.
|
|
79
|
+
*/
|
|
80
|
+
name: string;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Content type of the file.
|
|
84
|
+
*/
|
|
85
|
+
type: string;
|
|
86
|
+
}
|
|
87
|
+
}
|
package/src/HttpError.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { HttpError } from "@samchon/openapi";
|
|
1
|
+
export { HttpError } from "@samchon/openapi";
|