rezo 1.0.125 → 1.0.127
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 +21 -1
- package/dist/adapters/curl.cjs +4 -0
- package/dist/adapters/curl.js +4 -0
- package/dist/adapters/entries/curl.d.ts +179 -4
- package/dist/adapters/entries/fetch.d.ts +179 -4
- package/dist/adapters/entries/http.d.ts +179 -4
- package/dist/adapters/entries/http2.d.ts +179 -4
- package/dist/adapters/entries/react-native.cjs +6 -1
- package/dist/adapters/entries/react-native.d.ts +363 -4
- package/dist/adapters/entries/react-native.js +7 -1
- package/dist/adapters/entries/xhr.d.ts +179 -4
- package/dist/adapters/fetch.cjs +16 -2
- package/dist/adapters/fetch.js +16 -2
- package/dist/adapters/http.cjs +56 -3
- package/dist/adapters/http.js +56 -3
- package/dist/adapters/http2.cjs +44 -9
- package/dist/adapters/http2.js +44 -9
- package/dist/adapters/index.cjs +6 -6
- package/dist/adapters/picker.cjs +81 -23
- package/dist/adapters/picker.js +81 -23
- package/dist/adapters/react-native.cjs +1899 -131
- package/dist/adapters/react-native.js +1899 -131
- package/dist/adapters/xhr.cjs +37 -13
- package/dist/adapters/xhr.js +37 -13
- package/dist/cache/index.cjs +9 -9
- package/dist/cookies/cookie-jar.cjs +4 -4
- package/dist/cookies/index.cjs +10 -10
- package/dist/core/rezo.cjs +1 -0
- package/dist/core/rezo.js +1 -0
- package/dist/crawler/addon/oxylabs/index.cjs +1 -1
- package/dist/crawler/crawler.cjs +1 -1
- package/dist/crawler/crawler.js +1 -1
- package/dist/crawler/index.cjs +42 -42
- package/dist/crawler/plugin/index.cjs +1 -1
- package/dist/crawler/scraper.cjs +1 -1
- package/dist/crawler/scraper.js +1 -1
- package/dist/crawler.d.ts +178 -3
- package/dist/dom/index.cjs +23 -1
- package/dist/dom/index.js +20 -1
- package/dist/entries/crawler.cjs +6 -6
- package/dist/index.cjs +48 -48
- package/dist/index.d.ts +179 -4
- package/dist/internal/agents/index.cjs +14 -14
- package/dist/platform/browser.d.ts +179 -4
- package/dist/platform/bun.d.ts +179 -4
- package/dist/platform/deno.d.ts +179 -4
- package/dist/platform/node.d.ts +179 -4
- package/dist/platform/react-native-providers.cjs +458 -0
- package/dist/platform/react-native-providers.js +452 -0
- package/dist/platform/react-native.cjs +6 -1
- package/dist/platform/react-native.d.ts +363 -4
- package/dist/platform/react-native.js +7 -1
- package/dist/platform/worker.d.ts +179 -4
- package/dist/proxy/index.cjs +4 -4
- package/dist/queue/index.cjs +8 -8
- package/dist/responses/buildResponse.cjs +1 -1
- package/dist/responses/buildResponse.js +1 -1
- package/dist/responses/stream.cjs +62 -1
- package/dist/responses/stream.js +62 -1
- package/dist/responses/universal/index.cjs +11 -11
- package/dist/responses/universal/stream.cjs +59 -0
- package/dist/responses/universal/stream.js +59 -0
- package/dist/stealth/index.cjs +17 -17
- package/dist/stealth/profiles/index.cjs +10 -10
- package/dist/utils/http-config.cjs +13 -6
- package/dist/utils/http-config.js +13 -6
- package/dist/version.cjs +1 -1
- package/dist/version.js +1 -1
- package/dist/wget/asset-extractor.cjs +2 -2
- package/dist/wget/asset-extractor.js +2 -2
- package/dist/wget/index.cjs +51 -51
- package/dist/wget/index.d.ts +178 -3
- package/package.json +33 -10
- package/dist/dom/index.d.ts +0 -23
package/README.md
CHANGED
|
@@ -104,7 +104,9 @@ Rezo selects the optimal adapter for your runtime automatically.
|
|
|
104
104
|
| **cURL** | Node.js | ● | ● | ● | ● |
|
|
105
105
|
| **Fetch** | Browsers, Deno, Edge | | | | ● |
|
|
106
106
|
| **XHR** | Browsers | | | | |
|
|
107
|
-
| **React Native** | iOS, Android | | | |
|
|
107
|
+
| **React Native** | iOS, Android | Partial | | | Optional |
|
|
108
|
+
|
|
109
|
+
React Native uses a dedicated adapter. Base RN support covers buffered requests, retries, timeout/abort, hooks, cookies, and adapter-managed redirects. File downloads, provider-backed upload/download progress, readable streaming, NetInfo preflight, and background-task workflows are enabled through optional RN providers.
|
|
108
110
|
|
|
109
111
|
## Examples
|
|
110
112
|
|
|
@@ -142,6 +144,24 @@ const stream = await rezo.stream('https://api.example.com/events');
|
|
|
142
144
|
stream.on('data', (chunk) => process.stdout.write(chunk));
|
|
143
145
|
```
|
|
144
146
|
|
|
147
|
+
**React Native provider setup:**
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
import rezo, {
|
|
151
|
+
createReactNativeFsAdapter,
|
|
152
|
+
createNetInfoProvider,
|
|
153
|
+
} from 'rezo/platform/react-native';
|
|
154
|
+
import RNFS from 'react-native-fs';
|
|
155
|
+
import NetInfo from '@react-native-community/netinfo';
|
|
156
|
+
|
|
157
|
+
const api = rezo.create({
|
|
158
|
+
reactNative: {
|
|
159
|
+
fileSystemAdapter: createReactNativeFsAdapter(RNFS, { background: true }),
|
|
160
|
+
networkInfoProvider: createNetInfoProvider(NetInfo),
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
```
|
|
164
|
+
|
|
145
165
|
**26 lifecycle hooks:**
|
|
146
166
|
|
|
147
167
|
```typescript
|
package/dist/adapters/curl.cjs
CHANGED
|
@@ -1548,6 +1548,7 @@ class CurlCommandBuilder {
|
|
|
1548
1548
|
buildDownloadOptions(config, originalRequest, tempFiles) {
|
|
1549
1549
|
const saveTo = originalRequest.saveTo || config.fileName;
|
|
1550
1550
|
if (saveTo) {
|
|
1551
|
+
this.addArg("--create-dirs");
|
|
1551
1552
|
this.addArg("-o", saveTo);
|
|
1552
1553
|
}
|
|
1553
1554
|
}
|
|
@@ -2047,6 +2048,7 @@ class CurlExecutor {
|
|
|
2047
2048
|
};
|
|
2048
2049
|
streamResult.emit("finish", finishEvent);
|
|
2049
2050
|
streamResult.emit("done", finishEvent);
|
|
2051
|
+
streamResult.emit("complete", finishEvent);
|
|
2050
2052
|
resolve(streamResult);
|
|
2051
2053
|
return;
|
|
2052
2054
|
}
|
|
@@ -2073,6 +2075,7 @@ class CurlExecutor {
|
|
|
2073
2075
|
};
|
|
2074
2076
|
downloadResult.emit("finish", finishEvent);
|
|
2075
2077
|
downloadResult.emit("done", finishEvent);
|
|
2078
|
+
downloadResult.emit("complete", finishEvent);
|
|
2076
2079
|
resolve(downloadResult);
|
|
2077
2080
|
return;
|
|
2078
2081
|
}
|
|
@@ -2100,6 +2103,7 @@ class CurlExecutor {
|
|
|
2100
2103
|
};
|
|
2101
2104
|
uploadResult.emit("finish", finishEvent);
|
|
2102
2105
|
uploadResult.emit("done", finishEvent);
|
|
2106
|
+
uploadResult.emit("complete", finishEvent);
|
|
2103
2107
|
resolve(uploadResult);
|
|
2104
2108
|
return;
|
|
2105
2109
|
}
|
package/dist/adapters/curl.js
CHANGED
|
@@ -1548,6 +1548,7 @@ class CurlCommandBuilder {
|
|
|
1548
1548
|
buildDownloadOptions(config, originalRequest, tempFiles) {
|
|
1549
1549
|
const saveTo = originalRequest.saveTo || config.fileName;
|
|
1550
1550
|
if (saveTo) {
|
|
1551
|
+
this.addArg("--create-dirs");
|
|
1551
1552
|
this.addArg("-o", saveTo);
|
|
1552
1553
|
}
|
|
1553
1554
|
}
|
|
@@ -2047,6 +2048,7 @@ class CurlExecutor {
|
|
|
2047
2048
|
};
|
|
2048
2049
|
streamResult.emit("finish", finishEvent);
|
|
2049
2050
|
streamResult.emit("done", finishEvent);
|
|
2051
|
+
streamResult.emit("complete", finishEvent);
|
|
2050
2052
|
resolve(streamResult);
|
|
2051
2053
|
return;
|
|
2052
2054
|
}
|
|
@@ -2073,6 +2075,7 @@ class CurlExecutor {
|
|
|
2073
2075
|
};
|
|
2074
2076
|
downloadResult.emit("finish", finishEvent);
|
|
2075
2077
|
downloadResult.emit("done", finishEvent);
|
|
2078
|
+
downloadResult.emit("complete", finishEvent);
|
|
2076
2079
|
resolve(downloadResult);
|
|
2077
2080
|
return;
|
|
2078
2081
|
}
|
|
@@ -2100,6 +2103,7 @@ class CurlExecutor {
|
|
|
2100
2103
|
};
|
|
2101
2104
|
uploadResult.emit("finish", finishEvent);
|
|
2102
2105
|
uploadResult.emit("done", finishEvent);
|
|
2106
|
+
uploadResult.emit("complete", finishEvent);
|
|
2103
2107
|
resolve(uploadResult);
|
|
2104
2108
|
return;
|
|
2105
2109
|
}
|
|
@@ -742,6 +742,12 @@ export interface BaseEventEmitter {
|
|
|
742
742
|
* Emits 'data' events for response body chunks
|
|
743
743
|
*/
|
|
744
744
|
export interface RezoStreamResponse extends BaseEventEmitter {
|
|
745
|
+
/** Pipe stream data to a writable destination (file stream, stdout, etc.) */
|
|
746
|
+
pipe<T extends NodeJS.WritableStream>(destination: T, options?: {
|
|
747
|
+
end?: boolean;
|
|
748
|
+
}): T;
|
|
749
|
+
/** Pipe stream data to a file path (creates directories automatically) */
|
|
750
|
+
pipeTo(filePath: string): this;
|
|
745
751
|
on(event: "data", listener: (chunk: Uint8Array | string) => void): this;
|
|
746
752
|
on(event: "error", listener: (err: RezoError) => void): this;
|
|
747
753
|
on(event: "finish", listener: (info: StreamFinishEvent) => void): this;
|
|
@@ -2731,6 +2737,171 @@ declare class RezoStealth {
|
|
|
2731
2737
|
*/
|
|
2732
2738
|
static fromUserAgent(userAgent: string): RezoStealth;
|
|
2733
2739
|
}
|
|
2740
|
+
export interface RezoReactNativeFileDownloadHeadersEvent {
|
|
2741
|
+
status: number;
|
|
2742
|
+
statusText?: string;
|
|
2743
|
+
headers?: Record<string, string>;
|
|
2744
|
+
finalUrl?: string;
|
|
2745
|
+
contentType?: string;
|
|
2746
|
+
contentLength?: number;
|
|
2747
|
+
}
|
|
2748
|
+
export interface RezoReactNativeFileDownloadProgressEvent {
|
|
2749
|
+
loaded: number;
|
|
2750
|
+
total?: number;
|
|
2751
|
+
speed?: number;
|
|
2752
|
+
averageSpeed?: number;
|
|
2753
|
+
estimatedTime?: number;
|
|
2754
|
+
}
|
|
2755
|
+
export interface RezoReactNativeFileDownloadRequest {
|
|
2756
|
+
url: string;
|
|
2757
|
+
destination: string;
|
|
2758
|
+
method: string;
|
|
2759
|
+
headers: Record<string, string>;
|
|
2760
|
+
body?: unknown;
|
|
2761
|
+
timeout?: number | null;
|
|
2762
|
+
signal?: AbortSignal | null;
|
|
2763
|
+
onHeaders?: (event: RezoReactNativeFileDownloadHeadersEvent) => void | Promise<void>;
|
|
2764
|
+
onProgress?: (event: RezoReactNativeFileDownloadProgressEvent) => void | Promise<void>;
|
|
2765
|
+
}
|
|
2766
|
+
export interface RezoReactNativeFileDownloadResult {
|
|
2767
|
+
status: number;
|
|
2768
|
+
statusText?: string;
|
|
2769
|
+
headers?: Record<string, string>;
|
|
2770
|
+
finalUrl?: string;
|
|
2771
|
+
contentType?: string;
|
|
2772
|
+
contentLength?: number;
|
|
2773
|
+
filePath: string;
|
|
2774
|
+
fileSize?: number;
|
|
2775
|
+
}
|
|
2776
|
+
export interface RezoReactNativeFileUploadSource {
|
|
2777
|
+
uri: string;
|
|
2778
|
+
name?: string;
|
|
2779
|
+
type?: string;
|
|
2780
|
+
fieldName?: string;
|
|
2781
|
+
size?: number;
|
|
2782
|
+
}
|
|
2783
|
+
export interface RezoReactNativeFileUploadProgressEvent {
|
|
2784
|
+
loaded: number;
|
|
2785
|
+
total?: number;
|
|
2786
|
+
speed?: number;
|
|
2787
|
+
averageSpeed?: number;
|
|
2788
|
+
estimatedTime?: number;
|
|
2789
|
+
}
|
|
2790
|
+
export interface RezoReactNativeFileUploadRequest {
|
|
2791
|
+
url: string;
|
|
2792
|
+
method: string;
|
|
2793
|
+
headers: Record<string, string>;
|
|
2794
|
+
file: RezoReactNativeFileUploadSource;
|
|
2795
|
+
fields?: Record<string, string>;
|
|
2796
|
+
binaryStreamOnly?: boolean;
|
|
2797
|
+
timeout?: number | null;
|
|
2798
|
+
signal?: AbortSignal | null;
|
|
2799
|
+
onHeaders?: (event: RezoReactNativeFileDownloadHeadersEvent) => void | Promise<void>;
|
|
2800
|
+
onProgress?: (event: RezoReactNativeFileUploadProgressEvent) => void | Promise<void>;
|
|
2801
|
+
}
|
|
2802
|
+
export interface RezoReactNativeFileUploadResult {
|
|
2803
|
+
status: number;
|
|
2804
|
+
statusText?: string;
|
|
2805
|
+
headers?: Record<string, string>;
|
|
2806
|
+
finalUrl?: string;
|
|
2807
|
+
contentType?: string;
|
|
2808
|
+
contentLength?: number;
|
|
2809
|
+
body?: unknown;
|
|
2810
|
+
uploadSize?: number;
|
|
2811
|
+
fileName?: string;
|
|
2812
|
+
}
|
|
2813
|
+
export interface RezoReactNativeStreamHeadersEvent {
|
|
2814
|
+
status: number;
|
|
2815
|
+
statusText?: string;
|
|
2816
|
+
headers?: Record<string, string>;
|
|
2817
|
+
finalUrl?: string;
|
|
2818
|
+
contentType?: string;
|
|
2819
|
+
contentLength?: number;
|
|
2820
|
+
}
|
|
2821
|
+
export interface RezoReactNativeStreamProgressEvent {
|
|
2822
|
+
loaded: number;
|
|
2823
|
+
total?: number;
|
|
2824
|
+
speed?: number;
|
|
2825
|
+
averageSpeed?: number;
|
|
2826
|
+
estimatedTime?: number;
|
|
2827
|
+
}
|
|
2828
|
+
export interface RezoReactNativeStreamRequest {
|
|
2829
|
+
url: string;
|
|
2830
|
+
method: string;
|
|
2831
|
+
headers: Record<string, string>;
|
|
2832
|
+
body?: unknown;
|
|
2833
|
+
timeout?: number | null;
|
|
2834
|
+
signal?: AbortSignal | null;
|
|
2835
|
+
onHeaders?: (event: RezoReactNativeStreamHeadersEvent) => void | Promise<void>;
|
|
2836
|
+
onChunk?: (chunk: Uint8Array | string) => void | Promise<void>;
|
|
2837
|
+
onProgress?: (event: RezoReactNativeStreamProgressEvent) => void | Promise<void>;
|
|
2838
|
+
}
|
|
2839
|
+
export interface RezoReactNativeStreamResult {
|
|
2840
|
+
status: number;
|
|
2841
|
+
statusText?: string;
|
|
2842
|
+
headers?: Record<string, string>;
|
|
2843
|
+
finalUrl?: string;
|
|
2844
|
+
contentType?: string;
|
|
2845
|
+
contentLength?: number;
|
|
2846
|
+
}
|
|
2847
|
+
export interface RezoReactNativeUploadConfig extends RezoReactNativeFileUploadSource {
|
|
2848
|
+
enabled?: boolean;
|
|
2849
|
+
fields?: Record<string, string>;
|
|
2850
|
+
binaryStreamOnly?: boolean;
|
|
2851
|
+
}
|
|
2852
|
+
export interface RezoReactNativeFileSystemAdapterCapabilities {
|
|
2853
|
+
fileDownload?: boolean;
|
|
2854
|
+
downloadProgress?: boolean;
|
|
2855
|
+
uploadFromFile?: boolean;
|
|
2856
|
+
uploadProgress?: boolean;
|
|
2857
|
+
backgroundTasks?: boolean;
|
|
2858
|
+
}
|
|
2859
|
+
export interface RezoReactNativeFileSystemAdapter {
|
|
2860
|
+
name: string;
|
|
2861
|
+
capabilities?: RezoReactNativeFileSystemAdapterCapabilities;
|
|
2862
|
+
downloadFile?: (request: RezoReactNativeFileDownloadRequest) => Promise<RezoReactNativeFileDownloadResult>;
|
|
2863
|
+
uploadFile?: (request: RezoReactNativeFileUploadRequest) => Promise<RezoReactNativeFileUploadResult>;
|
|
2864
|
+
}
|
|
2865
|
+
export interface RezoReactNativeStreamTransport {
|
|
2866
|
+
name: string;
|
|
2867
|
+
stream(request: RezoReactNativeStreamRequest): Promise<RezoReactNativeStreamResult>;
|
|
2868
|
+
}
|
|
2869
|
+
export interface RezoReactNativeNetworkState {
|
|
2870
|
+
type?: string;
|
|
2871
|
+
isConnected: boolean | null;
|
|
2872
|
+
isInternetReachable: boolean | null;
|
|
2873
|
+
isExpensive?: boolean;
|
|
2874
|
+
details?: Record<string, any>;
|
|
2875
|
+
}
|
|
2876
|
+
export interface RezoReactNativeNetworkInfoProvider {
|
|
2877
|
+
fetch(): Promise<RezoReactNativeNetworkState>;
|
|
2878
|
+
subscribe?(listener: (state: RezoReactNativeNetworkState) => void): (() => void) | Promise<() => void>;
|
|
2879
|
+
}
|
|
2880
|
+
export interface RezoReactNativeBackgroundTaskDefinition {
|
|
2881
|
+
name: string;
|
|
2882
|
+
minimumInterval?: number;
|
|
2883
|
+
metadata?: Record<string, any>;
|
|
2884
|
+
}
|
|
2885
|
+
export interface RezoReactNativeBackgroundTaskConfig {
|
|
2886
|
+
enabled?: boolean;
|
|
2887
|
+
name: string;
|
|
2888
|
+
minimumInterval?: number;
|
|
2889
|
+
metadata?: Record<string, any>;
|
|
2890
|
+
keepRegistered?: boolean;
|
|
2891
|
+
}
|
|
2892
|
+
export interface RezoReactNativeBackgroundTaskProvider {
|
|
2893
|
+
registerTask(task: RezoReactNativeBackgroundTaskDefinition): Promise<void>;
|
|
2894
|
+
unregisterTask(name: string): Promise<void>;
|
|
2895
|
+
isTaskRegistered?(name: string): Promise<boolean>;
|
|
2896
|
+
}
|
|
2897
|
+
export interface RezoReactNativeOptions {
|
|
2898
|
+
fileSystemAdapter?: RezoReactNativeFileSystemAdapter;
|
|
2899
|
+
streamTransport?: RezoReactNativeStreamTransport;
|
|
2900
|
+
networkInfoProvider?: RezoReactNativeNetworkInfoProvider;
|
|
2901
|
+
backgroundTaskProvider?: RezoReactNativeBackgroundTaskProvider;
|
|
2902
|
+
backgroundTask?: RezoReactNativeBackgroundTaskConfig | null;
|
|
2903
|
+
upload?: RezoReactNativeUploadConfig | null;
|
|
2904
|
+
}
|
|
2734
2905
|
export type queueOptions = QueueConfig;
|
|
2735
2906
|
export interface CacheConfig {
|
|
2736
2907
|
/** Response cache configuration */
|
|
@@ -2741,6 +2912,8 @@ export interface CacheConfig {
|
|
|
2741
2912
|
export type CacheOption = boolean | CacheConfig;
|
|
2742
2913
|
export interface RezoDefaultOptions {
|
|
2743
2914
|
baseURL?: string;
|
|
2915
|
+
/** Optional React Native integrations such as file-system or network-state providers */
|
|
2916
|
+
reactNative?: RezoReactNativeOptions;
|
|
2744
2917
|
/** Hooks for request/response lifecycle */
|
|
2745
2918
|
hooks?: Partial<RezoHooks>;
|
|
2746
2919
|
/**
|
|
@@ -3153,7 +3326,7 @@ export interface RezoConfig {
|
|
|
3153
3326
|
/** @description Final resolved URL after redirects and processing */
|
|
3154
3327
|
finalUrl: string;
|
|
3155
3328
|
/** @description HTTP adapter used for the request */
|
|
3156
|
-
adapterUsed: "http" | "https" | "http2" | "fetch" | "xhr" | "curl";
|
|
3329
|
+
adapterUsed: "http" | "https" | "http2" | "fetch" | "xhr" | "curl" | "react-native";
|
|
3157
3330
|
/** @description Metadata about the adapter used */
|
|
3158
3331
|
adapterMetadata?: {
|
|
3159
3332
|
/** @description Adapter version */
|
|
@@ -3567,6 +3740,8 @@ export type ContentType = "application/json" | "application/x-www-form-urlencode
|
|
|
3567
3740
|
export interface RezoRequestConfig<D = any> {
|
|
3568
3741
|
/** The target URL for the request */
|
|
3569
3742
|
url: string | URL;
|
|
3743
|
+
/** Optional React Native integrations for this request */
|
|
3744
|
+
reactNative?: RezoReactNativeOptions;
|
|
3570
3745
|
/**
|
|
3571
3746
|
* The absolute request url
|
|
3572
3747
|
*/
|
|
@@ -4234,7 +4409,7 @@ export type ToRedirectOptions = {
|
|
|
4234
4409
|
* @public - Use with all methods
|
|
4235
4410
|
* @internal - Do not use internally within the library
|
|
4236
4411
|
*/
|
|
4237
|
-
export type RezoHttpRequest = Omit<RezoRequestConfig, "body" | "url" | "method" | "form" | "json" | "formData" | "multipart" | "fullUrl" | "responseType">;
|
|
4412
|
+
export type RezoHttpRequest = Omit<RezoRequestConfig, "body" | "url" | "method" | "form" | "json" | "formData" | "multipart" | "fullUrl" | "responseType" | "fileName" | "saveTo" | "baseURL">;
|
|
4238
4413
|
/**
|
|
4239
4414
|
* Method-aware request types for better TypeScript inference
|
|
4240
4415
|
* These types remove data/body fields from methods that don't typically use them
|
|
@@ -4243,7 +4418,7 @@ export type RezoHttpRequest = Omit<RezoRequestConfig, "body" | "url" | "method"
|
|
|
4243
4418
|
* RezoHttpGetRequest - Request options for GET requests (no request body)
|
|
4244
4419
|
* @public - Use with GET method
|
|
4245
4420
|
*/
|
|
4246
|
-
export type RezoHttpGetRequest = Omit<RezoHttpRequest, "data" | "body">;
|
|
4421
|
+
export type RezoHttpGetRequest = Omit<RezoHttpRequest, "data" | "body" | "fileName" | "saveTo">;
|
|
4247
4422
|
/**
|
|
4248
4423
|
* RezoHttpPostRequest - Request options for POST requests (includes request body)
|
|
4249
4424
|
* @public - Use with POST method
|
|
@@ -5848,7 +6023,7 @@ export interface RezoInstance extends Rezo, RezoCallable {
|
|
|
5848
6023
|
*
|
|
5849
6024
|
* IMPORTANT: Update these values when bumping package version.
|
|
5850
6025
|
*/
|
|
5851
|
-
export declare const VERSION = "1.0.
|
|
6026
|
+
export declare const VERSION = "1.0.127";
|
|
5852
6027
|
/**
|
|
5853
6028
|
* cURL Options Configuration
|
|
5854
6029
|
*
|
|
@@ -742,6 +742,12 @@ export interface BaseEventEmitter {
|
|
|
742
742
|
* Emits 'data' events for response body chunks
|
|
743
743
|
*/
|
|
744
744
|
export interface RezoStreamResponse extends BaseEventEmitter {
|
|
745
|
+
/** Pipe stream data to a writable destination (file stream, stdout, etc.) */
|
|
746
|
+
pipe<T extends NodeJS.WritableStream>(destination: T, options?: {
|
|
747
|
+
end?: boolean;
|
|
748
|
+
}): T;
|
|
749
|
+
/** Pipe stream data to a file path (creates directories automatically) */
|
|
750
|
+
pipeTo(filePath: string): this;
|
|
745
751
|
on(event: "data", listener: (chunk: Uint8Array | string) => void): this;
|
|
746
752
|
on(event: "error", listener: (err: RezoError) => void): this;
|
|
747
753
|
on(event: "finish", listener: (info: StreamFinishEvent) => void): this;
|
|
@@ -2731,6 +2737,171 @@ declare class RezoStealth {
|
|
|
2731
2737
|
*/
|
|
2732
2738
|
static fromUserAgent(userAgent: string): RezoStealth;
|
|
2733
2739
|
}
|
|
2740
|
+
export interface RezoReactNativeFileDownloadHeadersEvent {
|
|
2741
|
+
status: number;
|
|
2742
|
+
statusText?: string;
|
|
2743
|
+
headers?: Record<string, string>;
|
|
2744
|
+
finalUrl?: string;
|
|
2745
|
+
contentType?: string;
|
|
2746
|
+
contentLength?: number;
|
|
2747
|
+
}
|
|
2748
|
+
export interface RezoReactNativeFileDownloadProgressEvent {
|
|
2749
|
+
loaded: number;
|
|
2750
|
+
total?: number;
|
|
2751
|
+
speed?: number;
|
|
2752
|
+
averageSpeed?: number;
|
|
2753
|
+
estimatedTime?: number;
|
|
2754
|
+
}
|
|
2755
|
+
export interface RezoReactNativeFileDownloadRequest {
|
|
2756
|
+
url: string;
|
|
2757
|
+
destination: string;
|
|
2758
|
+
method: string;
|
|
2759
|
+
headers: Record<string, string>;
|
|
2760
|
+
body?: unknown;
|
|
2761
|
+
timeout?: number | null;
|
|
2762
|
+
signal?: AbortSignal | null;
|
|
2763
|
+
onHeaders?: (event: RezoReactNativeFileDownloadHeadersEvent) => void | Promise<void>;
|
|
2764
|
+
onProgress?: (event: RezoReactNativeFileDownloadProgressEvent) => void | Promise<void>;
|
|
2765
|
+
}
|
|
2766
|
+
export interface RezoReactNativeFileDownloadResult {
|
|
2767
|
+
status: number;
|
|
2768
|
+
statusText?: string;
|
|
2769
|
+
headers?: Record<string, string>;
|
|
2770
|
+
finalUrl?: string;
|
|
2771
|
+
contentType?: string;
|
|
2772
|
+
contentLength?: number;
|
|
2773
|
+
filePath: string;
|
|
2774
|
+
fileSize?: number;
|
|
2775
|
+
}
|
|
2776
|
+
export interface RezoReactNativeFileUploadSource {
|
|
2777
|
+
uri: string;
|
|
2778
|
+
name?: string;
|
|
2779
|
+
type?: string;
|
|
2780
|
+
fieldName?: string;
|
|
2781
|
+
size?: number;
|
|
2782
|
+
}
|
|
2783
|
+
export interface RezoReactNativeFileUploadProgressEvent {
|
|
2784
|
+
loaded: number;
|
|
2785
|
+
total?: number;
|
|
2786
|
+
speed?: number;
|
|
2787
|
+
averageSpeed?: number;
|
|
2788
|
+
estimatedTime?: number;
|
|
2789
|
+
}
|
|
2790
|
+
export interface RezoReactNativeFileUploadRequest {
|
|
2791
|
+
url: string;
|
|
2792
|
+
method: string;
|
|
2793
|
+
headers: Record<string, string>;
|
|
2794
|
+
file: RezoReactNativeFileUploadSource;
|
|
2795
|
+
fields?: Record<string, string>;
|
|
2796
|
+
binaryStreamOnly?: boolean;
|
|
2797
|
+
timeout?: number | null;
|
|
2798
|
+
signal?: AbortSignal | null;
|
|
2799
|
+
onHeaders?: (event: RezoReactNativeFileDownloadHeadersEvent) => void | Promise<void>;
|
|
2800
|
+
onProgress?: (event: RezoReactNativeFileUploadProgressEvent) => void | Promise<void>;
|
|
2801
|
+
}
|
|
2802
|
+
export interface RezoReactNativeFileUploadResult {
|
|
2803
|
+
status: number;
|
|
2804
|
+
statusText?: string;
|
|
2805
|
+
headers?: Record<string, string>;
|
|
2806
|
+
finalUrl?: string;
|
|
2807
|
+
contentType?: string;
|
|
2808
|
+
contentLength?: number;
|
|
2809
|
+
body?: unknown;
|
|
2810
|
+
uploadSize?: number;
|
|
2811
|
+
fileName?: string;
|
|
2812
|
+
}
|
|
2813
|
+
export interface RezoReactNativeStreamHeadersEvent {
|
|
2814
|
+
status: number;
|
|
2815
|
+
statusText?: string;
|
|
2816
|
+
headers?: Record<string, string>;
|
|
2817
|
+
finalUrl?: string;
|
|
2818
|
+
contentType?: string;
|
|
2819
|
+
contentLength?: number;
|
|
2820
|
+
}
|
|
2821
|
+
export interface RezoReactNativeStreamProgressEvent {
|
|
2822
|
+
loaded: number;
|
|
2823
|
+
total?: number;
|
|
2824
|
+
speed?: number;
|
|
2825
|
+
averageSpeed?: number;
|
|
2826
|
+
estimatedTime?: number;
|
|
2827
|
+
}
|
|
2828
|
+
export interface RezoReactNativeStreamRequest {
|
|
2829
|
+
url: string;
|
|
2830
|
+
method: string;
|
|
2831
|
+
headers: Record<string, string>;
|
|
2832
|
+
body?: unknown;
|
|
2833
|
+
timeout?: number | null;
|
|
2834
|
+
signal?: AbortSignal | null;
|
|
2835
|
+
onHeaders?: (event: RezoReactNativeStreamHeadersEvent) => void | Promise<void>;
|
|
2836
|
+
onChunk?: (chunk: Uint8Array | string) => void | Promise<void>;
|
|
2837
|
+
onProgress?: (event: RezoReactNativeStreamProgressEvent) => void | Promise<void>;
|
|
2838
|
+
}
|
|
2839
|
+
export interface RezoReactNativeStreamResult {
|
|
2840
|
+
status: number;
|
|
2841
|
+
statusText?: string;
|
|
2842
|
+
headers?: Record<string, string>;
|
|
2843
|
+
finalUrl?: string;
|
|
2844
|
+
contentType?: string;
|
|
2845
|
+
contentLength?: number;
|
|
2846
|
+
}
|
|
2847
|
+
export interface RezoReactNativeUploadConfig extends RezoReactNativeFileUploadSource {
|
|
2848
|
+
enabled?: boolean;
|
|
2849
|
+
fields?: Record<string, string>;
|
|
2850
|
+
binaryStreamOnly?: boolean;
|
|
2851
|
+
}
|
|
2852
|
+
export interface RezoReactNativeFileSystemAdapterCapabilities {
|
|
2853
|
+
fileDownload?: boolean;
|
|
2854
|
+
downloadProgress?: boolean;
|
|
2855
|
+
uploadFromFile?: boolean;
|
|
2856
|
+
uploadProgress?: boolean;
|
|
2857
|
+
backgroundTasks?: boolean;
|
|
2858
|
+
}
|
|
2859
|
+
export interface RezoReactNativeFileSystemAdapter {
|
|
2860
|
+
name: string;
|
|
2861
|
+
capabilities?: RezoReactNativeFileSystemAdapterCapabilities;
|
|
2862
|
+
downloadFile?: (request: RezoReactNativeFileDownloadRequest) => Promise<RezoReactNativeFileDownloadResult>;
|
|
2863
|
+
uploadFile?: (request: RezoReactNativeFileUploadRequest) => Promise<RezoReactNativeFileUploadResult>;
|
|
2864
|
+
}
|
|
2865
|
+
export interface RezoReactNativeStreamTransport {
|
|
2866
|
+
name: string;
|
|
2867
|
+
stream(request: RezoReactNativeStreamRequest): Promise<RezoReactNativeStreamResult>;
|
|
2868
|
+
}
|
|
2869
|
+
export interface RezoReactNativeNetworkState {
|
|
2870
|
+
type?: string;
|
|
2871
|
+
isConnected: boolean | null;
|
|
2872
|
+
isInternetReachable: boolean | null;
|
|
2873
|
+
isExpensive?: boolean;
|
|
2874
|
+
details?: Record<string, any>;
|
|
2875
|
+
}
|
|
2876
|
+
export interface RezoReactNativeNetworkInfoProvider {
|
|
2877
|
+
fetch(): Promise<RezoReactNativeNetworkState>;
|
|
2878
|
+
subscribe?(listener: (state: RezoReactNativeNetworkState) => void): (() => void) | Promise<() => void>;
|
|
2879
|
+
}
|
|
2880
|
+
export interface RezoReactNativeBackgroundTaskDefinition {
|
|
2881
|
+
name: string;
|
|
2882
|
+
minimumInterval?: number;
|
|
2883
|
+
metadata?: Record<string, any>;
|
|
2884
|
+
}
|
|
2885
|
+
export interface RezoReactNativeBackgroundTaskConfig {
|
|
2886
|
+
enabled?: boolean;
|
|
2887
|
+
name: string;
|
|
2888
|
+
minimumInterval?: number;
|
|
2889
|
+
metadata?: Record<string, any>;
|
|
2890
|
+
keepRegistered?: boolean;
|
|
2891
|
+
}
|
|
2892
|
+
export interface RezoReactNativeBackgroundTaskProvider {
|
|
2893
|
+
registerTask(task: RezoReactNativeBackgroundTaskDefinition): Promise<void>;
|
|
2894
|
+
unregisterTask(name: string): Promise<void>;
|
|
2895
|
+
isTaskRegistered?(name: string): Promise<boolean>;
|
|
2896
|
+
}
|
|
2897
|
+
export interface RezoReactNativeOptions {
|
|
2898
|
+
fileSystemAdapter?: RezoReactNativeFileSystemAdapter;
|
|
2899
|
+
streamTransport?: RezoReactNativeStreamTransport;
|
|
2900
|
+
networkInfoProvider?: RezoReactNativeNetworkInfoProvider;
|
|
2901
|
+
backgroundTaskProvider?: RezoReactNativeBackgroundTaskProvider;
|
|
2902
|
+
backgroundTask?: RezoReactNativeBackgroundTaskConfig | null;
|
|
2903
|
+
upload?: RezoReactNativeUploadConfig | null;
|
|
2904
|
+
}
|
|
2734
2905
|
export type queueOptions = QueueConfig;
|
|
2735
2906
|
export interface CacheConfig {
|
|
2736
2907
|
/** Response cache configuration */
|
|
@@ -2741,6 +2912,8 @@ export interface CacheConfig {
|
|
|
2741
2912
|
export type CacheOption = boolean | CacheConfig;
|
|
2742
2913
|
export interface RezoDefaultOptions {
|
|
2743
2914
|
baseURL?: string;
|
|
2915
|
+
/** Optional React Native integrations such as file-system or network-state providers */
|
|
2916
|
+
reactNative?: RezoReactNativeOptions;
|
|
2744
2917
|
/** Hooks for request/response lifecycle */
|
|
2745
2918
|
hooks?: Partial<RezoHooks>;
|
|
2746
2919
|
/**
|
|
@@ -3153,7 +3326,7 @@ export interface RezoConfig {
|
|
|
3153
3326
|
/** @description Final resolved URL after redirects and processing */
|
|
3154
3327
|
finalUrl: string;
|
|
3155
3328
|
/** @description HTTP adapter used for the request */
|
|
3156
|
-
adapterUsed: "http" | "https" | "http2" | "fetch" | "xhr" | "curl";
|
|
3329
|
+
adapterUsed: "http" | "https" | "http2" | "fetch" | "xhr" | "curl" | "react-native";
|
|
3157
3330
|
/** @description Metadata about the adapter used */
|
|
3158
3331
|
adapterMetadata?: {
|
|
3159
3332
|
/** @description Adapter version */
|
|
@@ -3567,6 +3740,8 @@ export type ContentType = "application/json" | "application/x-www-form-urlencode
|
|
|
3567
3740
|
export interface RezoRequestConfig<D = any> {
|
|
3568
3741
|
/** The target URL for the request */
|
|
3569
3742
|
url: string | URL;
|
|
3743
|
+
/** Optional React Native integrations for this request */
|
|
3744
|
+
reactNative?: RezoReactNativeOptions;
|
|
3570
3745
|
/**
|
|
3571
3746
|
* The absolute request url
|
|
3572
3747
|
*/
|
|
@@ -4234,7 +4409,7 @@ export type ToRedirectOptions = {
|
|
|
4234
4409
|
* @public - Use with all methods
|
|
4235
4410
|
* @internal - Do not use internally within the library
|
|
4236
4411
|
*/
|
|
4237
|
-
export type RezoHttpRequest = Omit<RezoRequestConfig, "body" | "url" | "method" | "form" | "json" | "formData" | "multipart" | "fullUrl" | "responseType">;
|
|
4412
|
+
export type RezoHttpRequest = Omit<RezoRequestConfig, "body" | "url" | "method" | "form" | "json" | "formData" | "multipart" | "fullUrl" | "responseType" | "fileName" | "saveTo" | "baseURL">;
|
|
4238
4413
|
/**
|
|
4239
4414
|
* Method-aware request types for better TypeScript inference
|
|
4240
4415
|
* These types remove data/body fields from methods that don't typically use them
|
|
@@ -4243,7 +4418,7 @@ export type RezoHttpRequest = Omit<RezoRequestConfig, "body" | "url" | "method"
|
|
|
4243
4418
|
* RezoHttpGetRequest - Request options for GET requests (no request body)
|
|
4244
4419
|
* @public - Use with GET method
|
|
4245
4420
|
*/
|
|
4246
|
-
export type RezoHttpGetRequest = Omit<RezoHttpRequest, "data" | "body">;
|
|
4421
|
+
export type RezoHttpGetRequest = Omit<RezoHttpRequest, "data" | "body" | "fileName" | "saveTo">;
|
|
4247
4422
|
/**
|
|
4248
4423
|
* RezoHttpPostRequest - Request options for POST requests (includes request body)
|
|
4249
4424
|
* @public - Use with POST method
|
|
@@ -5848,7 +6023,7 @@ export interface RezoInstance extends Rezo, RezoCallable {
|
|
|
5848
6023
|
*
|
|
5849
6024
|
* IMPORTANT: Update these values when bumping package version.
|
|
5850
6025
|
*/
|
|
5851
|
-
export declare const VERSION = "1.0.
|
|
6026
|
+
export declare const VERSION = "1.0.127";
|
|
5852
6027
|
export declare const isRezoError: typeof RezoError.isRezoError;
|
|
5853
6028
|
export declare const Cancel: typeof RezoError;
|
|
5854
6029
|
export declare const CancelToken: {
|