ropegeo-common 1.12.8 → 1.12.9
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/dist/components/RopeGeoCursorPaginationHttpRequest.d.ts +6 -1
- package/dist/components/RopeGeoCursorPaginationHttpRequest.d.ts.map +1 -1
- package/dist/components/RopeGeoCursorPaginationHttpRequest.js +22 -3
- package/dist/components/RopeGeoHttpRequest.d.ts +7 -1
- package/dist/components/RopeGeoHttpRequest.d.ts.map +1 -1
- package/dist/components/RopeGeoHttpRequest.js +18 -2
- package/dist/components/RopeGeoPaginationHttpRequest.d.ts +6 -1
- package/dist/components/RopeGeoPaginationHttpRequest.d.ts.map +1 -1
- package/dist/components/RopeGeoPaginationHttpRequest.js +11 -1
- package/dist/helpers/network/index.d.ts +1 -1
- package/dist/helpers/network/index.d.ts.map +1 -1
- package/dist/helpers/network/index.js +2 -1
- package/dist/helpers/network/networkRequestPolicy.d.ts +2 -0
- package/dist/helpers/network/networkRequestPolicy.d.ts.map +1 -1
- package/dist/helpers/network/networkRequestPolicy.js +7 -2
- package/package.json +1 -1
|
@@ -12,6 +12,11 @@ export type RopeGeoCursorPaginationHttpRequestProps<T = unknown> = {
|
|
|
12
12
|
* and countdown are disabled.
|
|
13
13
|
*/
|
|
14
14
|
timeoutAfterSeconds?: number;
|
|
15
|
+
/**
|
|
16
|
+
* When `false`, no HTTP requests run and children receive {@link NO_NETWORK_MESSAGE} as the error.
|
|
17
|
+
* Same semantics as `isOnline` on {@link RopeGeoHttpRequest}.
|
|
18
|
+
*/
|
|
19
|
+
isOnline?: boolean;
|
|
15
20
|
/**
|
|
16
21
|
* Response body is parsed via CursorPaginationResults.fromResponseBody (must include resultType).
|
|
17
22
|
* Parsed shape is ValidatedCursorPaginationResponse; children receive result.results as data.
|
|
@@ -26,5 +31,5 @@ export type RopeGeoCursorPaginationHttpRequestProps<T = unknown> = {
|
|
|
26
31
|
timeoutCountdown: number | null;
|
|
27
32
|
}) => ReactNode;
|
|
28
33
|
};
|
|
29
|
-
export declare function RopeGeoCursorPaginationHttpRequest<T = unknown>({ service, method, path, pathParams, queryParams, timeoutAfterSeconds, children, }: RopeGeoCursorPaginationHttpRequestProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export declare function RopeGeoCursorPaginationHttpRequest<T = unknown>({ service, method, path, pathParams, queryParams, timeoutAfterSeconds, isOnline, children, }: RopeGeoCursorPaginationHttpRequestProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
30
35
|
//# sourceMappingURL=RopeGeoCursorPaginationHttpRequest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RopeGeoCursorPaginationHttpRequest.d.ts","sourceRoot":"","sources":["../../src/components/RopeGeoCursorPaginationHttpRequest.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"RopeGeoCursorPaginationHttpRequest.d.ts","sourceRoot":"","sources":["../../src/components/RopeGeoCursorPaginationHttpRequest.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AASvC,OAAO,EACL,KAAK,sBAAsB,EAE5B,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAoB,MAAM,sBAAsB,CAAC;AAsCzE,MAAM,MAAM,uCAAuC,CAAC,CAAC,GAAG,OAAO,IAAI;IACjE,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,OAAO,MAAM,CAAC,CAAC;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,WAAW,EAAE,sBAAsB,CAAC;IACpC;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE;QACf,OAAO,EAAE,OAAO,CAAC;QACjB,WAAW,EAAE,OAAO,CAAC;QACrB,IAAI,EAAE,CAAC,EAAE,CAAC;QACV,MAAM,EAAE,KAAK,GAAG,IAAI,CAAC;QACrB,QAAQ,EAAE,MAAM,IAAI,CAAC;QACrB,OAAO,EAAE,OAAO,CAAC;QACjB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;KACjC,KAAK,SAAS,CAAC;CACjB,CAAC;AAEF,wBAAgB,kCAAkC,CAAC,CAAC,GAAG,OAAO,EAAE,EAC9D,OAAO,EACP,MAAmB,EACnB,IAAI,EACJ,UAAU,EACV,WAAW,EACX,mBAAmB,EACnB,QAAQ,EACR,QAAQ,GACT,EAAE,uCAAuC,CAAC,CAAC,CAAC,2CAoQ5C"}
|
|
@@ -30,7 +30,7 @@ function getResponseBody(raw) {
|
|
|
30
30
|
}
|
|
31
31
|
return raw;
|
|
32
32
|
}
|
|
33
|
-
function RopeGeoCursorPaginationHttpRequest({ service, method = RopeGeoHttpRequest_1.Method.GET, path, pathParams, queryParams, timeoutAfterSeconds, children, }) {
|
|
33
|
+
function RopeGeoCursorPaginationHttpRequest({ service, method = RopeGeoHttpRequest_1.Method.GET, path, pathParams, queryParams, timeoutAfterSeconds, isOnline, children, }) {
|
|
34
34
|
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
35
35
|
const [loadingMore, setLoadingMore] = (0, react_1.useState)(false);
|
|
36
36
|
const [data, setData] = (0, react_1.useState)([]);
|
|
@@ -48,6 +48,14 @@ function RopeGeoCursorPaginationHttpRequest({ service, method = RopeGeoHttpReque
|
|
|
48
48
|
return new URL(fullPath, baseUrl).toString();
|
|
49
49
|
}, [service, path, pathParams]);
|
|
50
50
|
(0, react_1.useEffect)(() => {
|
|
51
|
+
if (isOnline === false) {
|
|
52
|
+
setData([]);
|
|
53
|
+
setParams(queryParams);
|
|
54
|
+
setLoading(false);
|
|
55
|
+
setErrors(new Error(network_1.NO_NETWORK_MESSAGE));
|
|
56
|
+
setTimeoutCountdown(null);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
51
59
|
let cancelled = false;
|
|
52
60
|
const abortController = new AbortController();
|
|
53
61
|
const timedOutRef = { current: false };
|
|
@@ -148,13 +156,24 @@ function RopeGeoCursorPaginationHttpRequest({ service, method = RopeGeoHttpReque
|
|
|
148
156
|
policyDispose();
|
|
149
157
|
abortController.abort();
|
|
150
158
|
};
|
|
151
|
-
}, [
|
|
159
|
+
}, [
|
|
160
|
+
service,
|
|
161
|
+
method,
|
|
162
|
+
path,
|
|
163
|
+
pathParams,
|
|
164
|
+
queryParams,
|
|
165
|
+
buildUrl,
|
|
166
|
+
timeoutAfterSeconds,
|
|
167
|
+
isOnline,
|
|
168
|
+
]);
|
|
152
169
|
(0, react_1.useEffect)(() => {
|
|
153
170
|
return () => {
|
|
154
171
|
loadMoreAbortRef.current?.abort();
|
|
155
172
|
};
|
|
156
173
|
}, []);
|
|
157
174
|
const loadMore = (0, react_1.useCallback)(() => {
|
|
175
|
+
if (isOnline === false)
|
|
176
|
+
return;
|
|
158
177
|
if (params.cursor == null)
|
|
159
178
|
return;
|
|
160
179
|
if (loadingMoreRef.current)
|
|
@@ -238,7 +257,7 @@ function RopeGeoCursorPaginationHttpRequest({ service, method = RopeGeoHttpReque
|
|
|
238
257
|
loadingMoreRef.current = false;
|
|
239
258
|
setLoadingMore(false);
|
|
240
259
|
});
|
|
241
|
-
}, [params, method, buildUrl, timeoutAfterSeconds]);
|
|
260
|
+
}, [params, method, buildUrl, timeoutAfterSeconds, isOnline]);
|
|
242
261
|
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children({
|
|
243
262
|
loading,
|
|
244
263
|
loadingMore,
|
|
@@ -22,6 +22,12 @@ export type RopeGeoHttpRequestProps<T = unknown> = {
|
|
|
22
22
|
* Request deadline in seconds (abort + timeout error). When omitted, no timeout is enforced.
|
|
23
23
|
*/
|
|
24
24
|
timeoutAfterSeconds?: number;
|
|
25
|
+
/**
|
|
26
|
+
* When `false`, the request is not started and children receive {@link NO_NETWORK_MESSAGE} as the
|
|
27
|
+
* error. When `true` or omitted, behavior is unchanged. Pass from app-level connectivity (e.g.
|
|
28
|
+
* `expo-network`) so fetches are not fired while offline.
|
|
29
|
+
*/
|
|
30
|
+
isOnline?: boolean;
|
|
25
31
|
/**
|
|
26
32
|
* Response body is parsed via Result.fromResponseBody (must include resultType and result).
|
|
27
33
|
* Children receive the validated result.result as data (typed by T).
|
|
@@ -38,5 +44,5 @@ export type RopeGeoHttpRequestProps<T = unknown> = {
|
|
|
38
44
|
timeoutCountdown: number | null;
|
|
39
45
|
}) => ReactNode;
|
|
40
46
|
};
|
|
41
|
-
export declare function RopeGeoHttpRequest<T = unknown>({ service, method, path, pathParams, queryParams, body, timeoutAfterSeconds, children, }: RopeGeoHttpRequestProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
export declare function RopeGeoHttpRequest<T = unknown>({ service, method, path, pathParams, queryParams, body, timeoutAfterSeconds, isOnline, children, }: RopeGeoHttpRequestProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
42
48
|
//# sourceMappingURL=RopeGeoHttpRequest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RopeGeoHttpRequest.d.ts","sourceRoot":"","sources":["../../src/components/RopeGeoHttpRequest.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"RopeGeoHttpRequest.d.ts","sourceRoot":"","sources":["../../src/components/RopeGeoHttpRequest.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAWvC,eAAO,MAAM,OAAO;;CAEV,CAAC;AACX,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;AAE7D,eAAO,MAAM,MAAM;;;;;CAKT,CAAC;AACX,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,OAAO,MAAM,CAAC,CAAC;AAE1D,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAEpD,CAAC;AAmCF,MAAM,MAAM,uBAAuB,CAAC,CAAC,GAAG,OAAO,IAAI;IACjD,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;IACpE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE;QACf,OAAO,EAAE,OAAO,CAAC;QACjB,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;QACf,MAAM,EAAE,KAAK,GAAG,IAAI,CAAC;QACrB;;;;WAIG;QACH,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;KACjC,KAAK,SAAS,CAAC;CACjB,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,CAAC,GAAG,OAAO,EAAE,EAC9C,OAAO,EACP,MAAM,EACN,IAAI,EACJ,UAAU,EACV,WAAW,EACX,IAAI,EACJ,mBAAmB,EACnB,QAAQ,EACR,QAAQ,GACT,EAAE,uBAAuB,CAAC,CAAC,CAAC,2CAyJ5B"}
|
|
@@ -40,7 +40,7 @@ function buildUrl(baseUrl, path, pathParams, queryParams) {
|
|
|
40
40
|
}
|
|
41
41
|
return url.toString();
|
|
42
42
|
}
|
|
43
|
-
function RopeGeoHttpRequest({ service, method, path, pathParams, queryParams, body, timeoutAfterSeconds, children, }) {
|
|
43
|
+
function RopeGeoHttpRequest({ service, method, path, pathParams, queryParams, body, timeoutAfterSeconds, isOnline, children, }) {
|
|
44
44
|
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
45
45
|
const [data, setData] = (0, react_1.useState)(null);
|
|
46
46
|
const [errors, setErrors] = (0, react_1.useState)(null);
|
|
@@ -53,6 +53,13 @@ function RopeGeoHttpRequest({ service, method, path, pathParams, queryParams, bo
|
|
|
53
53
|
? JSON.stringify(body)
|
|
54
54
|
: body;
|
|
55
55
|
(0, react_1.useEffect)(() => {
|
|
56
|
+
if (isOnline === false) {
|
|
57
|
+
setLoading(false);
|
|
58
|
+
setData(null);
|
|
59
|
+
setErrors(new Error(network_1.NO_NETWORK_MESSAGE));
|
|
60
|
+
setTimeoutCountdown(null);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
56
63
|
let cancelled = false;
|
|
57
64
|
const abortController = new AbortController();
|
|
58
65
|
const timedOutRef = { current: false };
|
|
@@ -154,7 +161,16 @@ function RopeGeoHttpRequest({ service, method, path, pathParams, queryParams, bo
|
|
|
154
161
|
policyDispose();
|
|
155
162
|
abortController.abort();
|
|
156
163
|
};
|
|
157
|
-
}, [
|
|
164
|
+
}, [
|
|
165
|
+
service,
|
|
166
|
+
method,
|
|
167
|
+
path,
|
|
168
|
+
pathParamsKey,
|
|
169
|
+
queryParamsKey,
|
|
170
|
+
bodyKey,
|
|
171
|
+
timeoutAfterSeconds,
|
|
172
|
+
isOnline,
|
|
173
|
+
]);
|
|
158
174
|
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children({
|
|
159
175
|
loading,
|
|
160
176
|
data,
|
|
@@ -18,6 +18,11 @@ export type RopeGeoPaginationHttpRequestProps<T = unknown> = {
|
|
|
18
18
|
* When omitted, timeout and countdown are disabled.
|
|
19
19
|
*/
|
|
20
20
|
timeoutAfterSeconds?: number;
|
|
21
|
+
/**
|
|
22
|
+
* When `false`, no HTTP requests run and children receive {@link NO_NETWORK_MESSAGE} as the error.
|
|
23
|
+
* Same semantics as `isOnline` on {@link RopeGeoHttpRequest}.
|
|
24
|
+
*/
|
|
25
|
+
isOnline?: boolean;
|
|
21
26
|
children: (args: {
|
|
22
27
|
loading: boolean;
|
|
23
28
|
received: number;
|
|
@@ -39,5 +44,5 @@ export type RopeGeoPaginationHttpRequestProps<T = unknown> = {
|
|
|
39
44
|
* {@link PaginationResults.fromResponseBody}. Final `data` is pages concatenated in page order.
|
|
40
45
|
* In-flight requests use one {@link AbortController}: unmount or any failure aborts the rest.
|
|
41
46
|
*/
|
|
42
|
-
export declare function RopeGeoPaginationHttpRequest<T = unknown>({ service, method, path, pathParams, queryParams, batchSize, timeoutAfterSeconds, children, }: RopeGeoPaginationHttpRequestProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
export declare function RopeGeoPaginationHttpRequest<T = unknown>({ service, method, path, pathParams, queryParams, batchSize, timeoutAfterSeconds, isOnline, children, }: RopeGeoPaginationHttpRequestProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
43
48
|
//# sourceMappingURL=RopeGeoPaginationHttpRequest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RopeGeoPaginationHttpRequest.d.ts","sourceRoot":"","sources":["../../src/components/RopeGeoPaginationHttpRequest.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"RopeGeoPaginationHttpRequest.d.ts","sourceRoot":"","sources":["../../src/components/RopeGeoPaginationHttpRequest.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAUvC,OAAO,EACL,KAAK,gBAAgB,EAEtB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAoB,MAAM,sBAAsB,CAAC;AA8DzE,MAAM,MAAM,iCAAiC,CAAC,CAAC,GAAG,OAAO,IAAI;IAC3D,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,OAAO,MAAM,CAAC,CAAC;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,WAAW,EAAE,gBAAgB,CAAC;IAC9B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,CAAC,IAAI,EAAE;QACf,OAAO,EAAE,OAAO,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB;;;WAGG;QACH,IAAI,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC;QACjB,+FAA+F;QAC/F,MAAM,EAAE,KAAK,GAAG,IAAI,CAAC;QACrB,qGAAqG;QACrG,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;KACjC,KAAK,SAAS,CAAC;CACjB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,CAAC,GAAG,OAAO,EAAE,EACxD,OAAO,EACP,MAAmB,EACnB,IAAI,EACJ,UAAU,EACV,WAAW,EACX,SAAc,EACd,mBAAmB,EACnB,QAAQ,EACR,QAAQ,GACT,EAAE,iCAAiC,CAAC,CAAC,CAAC,2CAuPtC"}
|
|
@@ -57,7 +57,7 @@ function concatPaginationResultItemsSorted(pagesByNum) {
|
|
|
57
57
|
* {@link PaginationResults.fromResponseBody}. Final `data` is pages concatenated in page order.
|
|
58
58
|
* In-flight requests use one {@link AbortController}: unmount or any failure aborts the rest.
|
|
59
59
|
*/
|
|
60
|
-
function RopeGeoPaginationHttpRequest({ service, method = RopeGeoHttpRequest_1.Method.GET, path, pathParams, queryParams, batchSize = 10, timeoutAfterSeconds, children, }) {
|
|
60
|
+
function RopeGeoPaginationHttpRequest({ service, method = RopeGeoHttpRequest_1.Method.GET, path, pathParams, queryParams, batchSize = 10, timeoutAfterSeconds, isOnline, children, }) {
|
|
61
61
|
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
62
62
|
const [received, setReceived] = (0, react_1.useState)(0);
|
|
63
63
|
const [total, setTotal] = (0, react_1.useState)(null);
|
|
@@ -68,6 +68,15 @@ function RopeGeoPaginationHttpRequest({ service, method = RopeGeoHttpRequest_1.M
|
|
|
68
68
|
const queryParamsKey = queryParams.toQueryString();
|
|
69
69
|
const effectiveBatch = Math.max(1, Math.floor(batchSize));
|
|
70
70
|
(0, react_1.useEffect)(() => {
|
|
71
|
+
if (isOnline === false) {
|
|
72
|
+
setLoading(false);
|
|
73
|
+
setReceived(0);
|
|
74
|
+
setTotal(null);
|
|
75
|
+
setData(null);
|
|
76
|
+
setErrors(new Error(network_1.NO_NETWORK_MESSAGE));
|
|
77
|
+
setTimeoutCountdown(null);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
71
80
|
let cancelled = false;
|
|
72
81
|
const abortController = new AbortController();
|
|
73
82
|
const { signal } = abortController;
|
|
@@ -269,6 +278,7 @@ function RopeGeoPaginationHttpRequest({ service, method = RopeGeoHttpRequest_1.M
|
|
|
269
278
|
queryParams,
|
|
270
279
|
effectiveBatch,
|
|
271
280
|
timeoutAfterSeconds,
|
|
281
|
+
isOnline,
|
|
272
282
|
]);
|
|
273
283
|
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children({
|
|
274
284
|
loading,
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* Published as `ropegeo-common/helpers/network`. Prefer this entry over `ropegeo-common/helpers` in
|
|
4
4
|
* Metro/RN bundles so the full helpers barrel (S3 folder upload, etc.) is not resolved.
|
|
5
5
|
*/
|
|
6
|
-
export { NETWORK_REQUEST_TIMED_OUT_MESSAGE, installNetworkRequestPolicyTimers, isAbortError, isNetworkRequestTimeoutError, mergeParentSignalWithDeadline, resolveRequestTimeoutMs, type MergedDeadlineHandles, type NetworkRequestPolicyTimerCallbacks, } from "./networkRequestPolicy";
|
|
6
|
+
export { NETWORK_REQUEST_TIMED_OUT_MESSAGE, NO_NETWORK_MESSAGE, installNetworkRequestPolicyTimers, isAbortError, isNetworkRequestTimeoutError, mergeParentSignalWithDeadline, resolveRequestTimeoutMs, type MergedDeadlineHandles, type NetworkRequestPolicyTimerCallbacks, } from "./networkRequestPolicy";
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/helpers/network/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,iCAAiC,EACjC,iCAAiC,EACjC,YAAY,EACZ,4BAA4B,EAC5B,6BAA6B,EAC7B,uBAAuB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,kCAAkC,GACxC,MAAM,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/helpers/network/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,iCAAiC,EACjC,kBAAkB,EAClB,iCAAiC,EACjC,YAAY,EACZ,4BAA4B,EAC5B,6BAA6B,EAC7B,uBAAuB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,kCAAkC,GACxC,MAAM,wBAAwB,CAAC"}
|
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
* Metro/RN bundles so the full helpers barrel (S3 folder upload, etc.) is not resolved.
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.resolveRequestTimeoutMs = exports.mergeParentSignalWithDeadline = exports.isNetworkRequestTimeoutError = exports.isAbortError = exports.installNetworkRequestPolicyTimers = exports.NETWORK_REQUEST_TIMED_OUT_MESSAGE = void 0;
|
|
8
|
+
exports.resolveRequestTimeoutMs = exports.mergeParentSignalWithDeadline = exports.isNetworkRequestTimeoutError = exports.isAbortError = exports.installNetworkRequestPolicyTimers = exports.NO_NETWORK_MESSAGE = exports.NETWORK_REQUEST_TIMED_OUT_MESSAGE = void 0;
|
|
9
9
|
var networkRequestPolicy_1 = require("./networkRequestPolicy");
|
|
10
10
|
Object.defineProperty(exports, "NETWORK_REQUEST_TIMED_OUT_MESSAGE", { enumerable: true, get: function () { return networkRequestPolicy_1.NETWORK_REQUEST_TIMED_OUT_MESSAGE; } });
|
|
11
|
+
Object.defineProperty(exports, "NO_NETWORK_MESSAGE", { enumerable: true, get: function () { return networkRequestPolicy_1.NO_NETWORK_MESSAGE; } });
|
|
11
12
|
Object.defineProperty(exports, "installNetworkRequestPolicyTimers", { enumerable: true, get: function () { return networkRequestPolicy_1.installNetworkRequestPolicyTimers; } });
|
|
12
13
|
Object.defineProperty(exports, "isAbortError", { enumerable: true, get: function () { return networkRequestPolicy_1.isAbortError; } });
|
|
13
14
|
Object.defineProperty(exports, "isNetworkRequestTimeoutError", { enumerable: true, get: function () { return networkRequestPolicy_1.isNetworkRequestTimeoutError; } });
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/** Network helpers for optional request deadlines and timeout countdowns. */
|
|
2
2
|
/** Use this exact message so callers can detect timeout vs other failures. */
|
|
3
3
|
export declare const NETWORK_REQUEST_TIMED_OUT_MESSAGE = "Network request timed out";
|
|
4
|
+
/** Use this exact message for client-side offline gating and RN fetch failures treated as offline. */
|
|
5
|
+
export declare const NO_NETWORK_MESSAGE = "No network connection";
|
|
4
6
|
export declare function isNetworkRequestTimeoutError(e: unknown): boolean;
|
|
5
7
|
export declare function isAbortError(e: unknown): boolean;
|
|
6
8
|
/** Milliseconds for `timeoutAfterSeconds` on request components; `null` when timeout is disabled. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"networkRequestPolicy.d.ts","sourceRoot":"","sources":["../../../src/helpers/network/networkRequestPolicy.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAE7E,8EAA8E;AAC9E,eAAO,MAAM,iCAAiC,8BAA8B,CAAC;AAE7E,wBAAgB,4BAA4B,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAEhE;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"networkRequestPolicy.d.ts","sourceRoot":"","sources":["../../../src/helpers/network/networkRequestPolicy.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAE7E,8EAA8E;AAC9E,eAAO,MAAM,iCAAiC,8BAA8B,CAAC;AAE7E,sGAAsG;AACtG,eAAO,MAAM,kBAAkB,0BAA0B,CAAC;AAE1D,wBAAgB,4BAA4B,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAEhE;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAUhD;AAED,qGAAqG;AACrG,wBAAgB,uBAAuB,CAAC,mBAAmB,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CASnF;AAED,MAAM,MAAM,kCAAkC,GAAG;IAC/C,QAAQ,EAAE,MAAM,OAAO,CAAC;IACxB,kBAAkB,EAAE,CAAC,gBAAgB,EAAE,MAAM,KAAK,IAAI,CAAC;IACvD,uBAAuB,EAAE,MAAM,IAAI,CAAC;IACpC,aAAa,EAAE,MAAM,IAAI,CAAC;CAC3B,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,iCAAiC,CAC/C,kBAAkB,EAAE,MAAM,EAC1B,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,kCAAkC,GAC5C,MAAM,IAAI,CAuCZ;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,iBAAiB,EAAE,MAAM,OAAO,CAAC;CAClC,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,6BAA6B,CAC3C,YAAY,EAAE,WAAW,EACzB,UAAU,EAAE,MAAM,GACjB,qBAAqB,CAqCvB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/** Network helpers for optional request deadlines and timeout countdowns. */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.NETWORK_REQUEST_TIMED_OUT_MESSAGE = void 0;
|
|
4
|
+
exports.NO_NETWORK_MESSAGE = exports.NETWORK_REQUEST_TIMED_OUT_MESSAGE = void 0;
|
|
5
5
|
exports.isNetworkRequestTimeoutError = isNetworkRequestTimeoutError;
|
|
6
6
|
exports.isAbortError = isAbortError;
|
|
7
7
|
exports.resolveRequestTimeoutMs = resolveRequestTimeoutMs;
|
|
@@ -9,12 +9,17 @@ exports.installNetworkRequestPolicyTimers = installNetworkRequestPolicyTimers;
|
|
|
9
9
|
exports.mergeParentSignalWithDeadline = mergeParentSignalWithDeadline;
|
|
10
10
|
/** Use this exact message so callers can detect timeout vs other failures. */
|
|
11
11
|
exports.NETWORK_REQUEST_TIMED_OUT_MESSAGE = "Network request timed out";
|
|
12
|
+
/** Use this exact message for client-side offline gating and RN fetch failures treated as offline. */
|
|
13
|
+
exports.NO_NETWORK_MESSAGE = "No network connection";
|
|
12
14
|
function isNetworkRequestTimeoutError(e) {
|
|
13
15
|
return e instanceof Error && e.message === exports.NETWORK_REQUEST_TIMED_OUT_MESSAGE;
|
|
14
16
|
}
|
|
15
17
|
function isAbortError(e) {
|
|
16
|
-
if (
|
|
18
|
+
if (typeof DOMException !== "undefined" &&
|
|
19
|
+
e instanceof DOMException &&
|
|
20
|
+
e.name === "AbortError") {
|
|
17
21
|
return true;
|
|
22
|
+
}
|
|
18
23
|
if (e instanceof Error && e.name === "AbortError")
|
|
19
24
|
return true;
|
|
20
25
|
return false;
|